/* HEAD SNIPPET ------------------------------------------------------------
   Meridian foundation - shared token sheet + classes (matches the React
   client token sheet so both apps render as one suite).

   Every template MUST add these exact lines inside its <head>:

   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500;1,600&family=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet">
   <link rel="stylesheet" href="{{ url_for('static', filename='meridian.css') }}">

   Pages that use window.mConfirm() (any page replacing window.confirm)
   additionally load the dialog helper:

   <script src="{{ url_for('static', filename='meridian.js') }}" defer></script>

   Notes for template authors:
   - Colors ONLY via the CSS variables below. No icon libraries; typographic
     glyphs only.
   - Cormorant Garamond (.m-serif) for display headings only; Helvetica stack
     for UI; IBM Plex Mono (.m-mono, tabular-nums) for money / times / counts /
     dates-as-digits / document numbers / emails-as-identifiers.
   - Radii: 2px controls, 3px cards. Circles only for avatars and status dots.
   - .m-topstrip is absolutely positioned: its parent needs
     position: relative (add overflow: hidden when the parent has a radius).
   ------------------------------------------------------------------------- */

/* == Meridian design tokens (shared by both apps) ========================= */
:root {
  /* Core - README "Design Tokens" */
  --paper: #f6f3ec;            /* page background, warm ivory */
  --surface: #fdfbf6;          /* cards, tables */
  --surface-alt: #f1ede3;      /* table headers, inset bands */
  --hairline: #e3ddce;         /* primary border */
  --hairline-soft: #efe9dc;    /* row dividers */
  --hairline-strong: #cfc7b4;  /* inputs, buttons */
  --ink: #1d2733;              /* near-black navy: text, dark panels */
  --navy: #1e3a5f;             /* primary buttons, links */
  --brass: #9a7b3f;            /* accent: active nav, rules, section labels */
  --brass-light: #c9b483;      /* brass on dark ink */
  --text-secondary: #5c6470;
  --text-tertiary: #777161;
  --text-muted: #8f8b80;
  --text-faint: #a8a294;

  /* Canonical extension set */
  --navy-hover:#16304f;
  --ok:#33684b;
  --danger:#a33d36;
  --danger-hover:#8d322c;
  --amber:#a06b21;
  --orange:#c25e2f;
  --purple:#7a4a8a;
  --pri-urgent:#a33d36;
  --pri-high:#a06b21;
  --pri-normal:#1e3a5f;
  --pri-low:#8f8b80;
  --tint-red:rgba(163,61,54,0.04);
  --tint-amber:rgba(160,107,33,0.08);
  --tint-brass:rgba(154,123,63,0.05);
  --tint-green:rgba(51,104,75,0.05);
  --on-dark:#f6f3ec;
  --on-dark-secondary:rgba(246,243,236,0.55);
  --on-dark-faint:rgba(246,243,236,0.42);
  --on-dark-hairline:rgba(246,243,236,0.1);
  --on-dark-underline:rgba(246,243,236,0.25);
  --brass-light-hover:#d8c496;
}

/* == Base ================================================================= */
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a {
  color: var(--navy);
  text-decoration: none;
  transition: color 150ms ease;
}
a:hover { color: var(--brass); }

input::placeholder,
textarea::placeholder { color: var(--text-faint); }

/* == Typography =========================================================== */

/* Small-caps label - 9.5-11px, 600, letterspaced, uppercase. Color is set
   where used (brass section labels, muted table heads, on-dark, etc.). */
.m-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Display serif - headings only, never body/UI text. */
.m-serif {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
}

/* Figures - money, times, counts, dates-as-digits, document numbers,
   emails-as-identifiers. */
.m-mono {
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
}

/* == Buttons ============================================================== */
.m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 24px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}
.m-btn:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 2px;
}
.m-btn:disabled,
.m-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Primary - navy fill, ivory text. */
.m-btn--primary {
  background: var(--navy);
  color: var(--on-dark);
}
.m-btn--primary:hover:not(:disabled) { background: var(--navy-hover); }

/* Ghost - transparent, hairline-strong border; hover border to brass. */
.m-btn--ghost {
  border: 1px solid var(--hairline-strong);
  color: var(--text-secondary);
}
.m-btn--ghost:hover:not(:disabled) {
  border-color: var(--brass);
  color: var(--ink);
}

/* Destructive - red fill. */
.m-btn--danger {
  background: var(--danger);
  color: var(--on-dark);
}
.m-btn--danger:hover:not(:disabled) { background: var(--danger-hover); }

/* Destructive ghost - red text, border appears on hover. */
.m-btn--danger-ghost {
  border: 1px solid transparent;
  color: var(--danger);
}
.m-btn--danger-ghost:hover:not(:disabled) { border-color: var(--danger); }

/* Brass CTA - brass-light fill, ink text (registry / licensing consoles). */
.m-btn--brass {
  background: var(--brass-light);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.12em;
}
.m-btn--brass:hover:not(:disabled) { background: var(--brass-light-hover); }

/* == Inputs =============================================================== */

/* Underline input (light surfaces): borderless, 1px bottom hairline-strong,
   focus swaps the underline to navy. No glow rings. */
.m-input {
  padding: 11px 2px;
  border: none;
  border-bottom: 1px solid var(--hairline-strong);
  border-radius: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  box-sizing: border-box;
  transition: border-color 150ms ease;
}
.m-input:focus { border-bottom-color: var(--navy); }

textarea.m-input { resize: vertical; }

/* Underline input on ink panels: on-dark underline, focus to brass-light. */
.m-input--dark {
  color: var(--on-dark);
  border-bottom-color: var(--on-dark-underline);
}
.m-input--dark:focus { border-bottom-color: var(--brass-light); }

/* Label + input stack. */
.m-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* == Cards ================================================================ */
.m-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 3px;
}

/* Ink card - dark panel, no border, on-dark text. */
.m-card--ink {
  background: var(--ink);
  border: none;
  color: var(--on-dark);
}

/* 2px brass gradient accent strip along the top edge of a card.
   Parent must be position: relative (plus overflow: hidden with a radius). */
.m-topstrip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brass), rgba(154,123,63,0.15));
}

/* == Status dots ========================================================== */
.m-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.m-dot--ok     { background: var(--ok); }
.m-dot--danger { background: var(--danger); }
.m-dot--amber  { background: var(--amber); }
.m-dot--orange { background: var(--orange); }
.m-dot--purple { background: var(--purple); }
.m-dot--navy   { background: var(--navy); }

/* == Avatars ============================================================== */

/* Neutral initials circle. Size is 32px by default; screens may override
   width/height/font-size inline (24-38px in the designs). */
.m-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e7e2d5; /* neutral avatar plate - per README Geometry */
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

/* On-ink avatar - ink circle, brass initials. */
.m-avatar--ink {
  background: #1d2733;
  color: #c9b483;
}

/* == Dialog =============================================================== */

/* Full-viewport scrim that centers the dialog. */
.m-scrim {
  position: fixed;
  inset: 0;
  background: rgba(29,39,51,0.55);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Confirm dialog - ivory, 2px red top border. Sized as drawn: max-width
   measures the content box (440px content + 34px side paddings). */
.m-dialog {
  width: 100%;
  max-width: 440px;
  box-sizing: content-box;
  background: var(--surface);
  border-radius: 3px;
  border-top: 2px solid var(--danger);
  padding: 30px 34px;
  box-shadow: 0 24px 64px rgba(19,26,36,0.35);
}
