/* ============================================================================
   Meridian — Revenue Ops design system
   Translated from "Reservation Manager Design System" handoff (Claude Design),
   Revenue Ops Component Library v0.1.

   The load-bearing rule of this system, and of the product:
     SOLID border  = confirmed by the PMS.
     DASHED border = the system inferred it, and has not been told.
   Never style an inferred thing to look confirmed. That is R-01 in CSS.
   ========================================================================= */

:root {
  /* Surfaces */
  --canvas:        #F3F2EE;
  --surface:       #FFFFFF;
  --surface-sunk:  #FBFBF9;
  --surface-alt:   #FAFAF7;

  /* Sage — agreement, confirmation, the recommended path */
  --sage-tint:     #EDF1EA;
  --sage-tint-2:   #F7F9F5;
  --sage-line:     #C6D0BE;
  --sage:          #6E8168;
  --sage-deep:     #4F5F4A;
  --sage-deeper:   #3E4C3A;
  --sage-deepest:  #35412F;
  --sage-on:       #F6F7F3;

  /* Ink */
  --ink:           #23261F;
  --ink-strong:    #373C33;
  --ink-soft:      #5B6058;
  --ink-mute:      #8A8F86;
  --ink-faint:     #A8AEA2;

  /* Lines */
  --line:          #E2E1DB;
  --line-soft:     #EFEFEA;
  --line-strong:   #CFD2C9;
  --line-input:    #D8D8D1;

  /* Clay — INFERRED. Always paired with a dashed border. */
  --clay:          #B5834A;
  --clay-line:     #C09B62;
  --clay-line-2:   #D3B98C;
  --clay-bg:       #FAF5EC;
  --clay-text:     #8A6A38;

  /* Terracotta — risk, refusal, destructive */
  --risk:          #A8543F;
  --risk-line:     #E0BEB4;
  --risk-bg:       #F8EBE7;
  --risk-bg-2:     #FBF1ED;
  --risk-text:     #8F4331;

  /* Slate — neutral information */
  --info:          #5C7183;
  --info-line:     #C7D3DB;
  --info-bg:       #EEF2F5;
  --info-text:     #3F5566;

  /* Type */
  --font-display: 'Newsreader', Georgia, serif;
  --font-body:    'Instrument Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  /* Spacing — 4 · 8 · 12 · 16 · 24 · 32 · 48 */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;

  /* Radius — 6 for cards, 3 for controls */
  --r-card:    6px;
  --r-control: 3px;
  --r-pill:    999px;

  /* Elevation */
  --shadow-raised:  0 1px 2px rgba(35, 38, 31, .05);
  --shadow-overlay: 0 8px 28px -12px rgba(35, 38, 31, .18);

  --measure: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }

@keyframes mer-spin     { to { transform: rotate(360deg); } }
@keyframes mer-pulse-dot { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--sage-deep); text-decoration: none; }
a:hover { color: var(--ink); }
::selection { background: #DDE5D6; }

:focus-visible {
  outline: 2px solid #A9BCA0;
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Type ---------------------------------------------------------------- */

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; letter-spacing: -.015em; }
h1 { font-size: 38px; line-height: 1.12; letter-spacing: -.02em; }
h2 { font-size: 27px; line-height: 1.2; }
h3 { font-size: 20px; font-family: var(--font-body); font-weight: 500; letter-spacing: -.01em; }
p  { margin: 0 0 var(--s4); }

.mer-eyebrow {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.mer-lead { font-size: 17px; line-height: 1.6; color: var(--ink-soft); max-width: 62ch; }
.mer-muted { color: var(--ink-mute); }

/* Numbers, IDs, money, dates — mono and tabular so columns line up. */
.mer-mono, .mer-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.mer-ref {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-mute);
  background: #F2F2ED;
  border-radius: var(--r-control);
  padding: 3px 7px;
}

/* --- Shell --------------------------------------------------------------- */

.mer-shell { min-height: 100vh; display: flex; flex-direction: column; }

.mer-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 242, 238, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.mer-topbar-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--s7);
  height: 60px;
  display: flex;
  align-items: center;
  gap: var(--s6);
}

.mer-brand { display: flex; align-items: baseline; gap: 10px; }
.mer-brand-name { font-family: var(--font-display); font-size: 19px; letter-spacing: -.01em; color: var(--ink); }
.mer-brand-sub { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-mute); }

.mer-nav { display: flex; gap: 22px; margin-left: auto; font-size: 13px; }
.mer-nav a { color: var(--ink-soft); padding: 4px 0; border-bottom: 1px solid transparent; }
.mer-nav a:hover { color: var(--ink); }
.mer-nav a.active { color: var(--ink); border-bottom-color: var(--sage); }

.mer-main { flex: 1; }
.mer-page { max-width: var(--measure); margin: 0 auto; padding: var(--s7) var(--s7) 96px; }

.mer-page-head { margin-bottom: var(--s7); }
.mer-page-head .mer-eyebrow { margin-bottom: var(--s3); display: block; }

/* --- Cards --------------------------------------------------------------- */

.mer-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 26px;
}
.mer-card--raised { box-shadow: var(--shadow-raised); }
.mer-card--flush { padding: 0; overflow: hidden; }

.mer-card-label {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 18px;
  display: block;
}

/* Recommendation inset — sage. Confirmed, agreed, safe. */
.mer-inset-sage {
  background: var(--sage-tint);
  border: 1px solid #D6DED0;
  border-radius: var(--r-card);
  padding: 18px 20px;
}

/* Inferred inset — DASHED. Never make this solid. */
.mer-inset-inferred {
  background: var(--clay-bg);
  border: 1px dashed var(--clay-line-2);
  border-radius: var(--r-card);
  padding: 18px 20px;
}

/* --- Buttons ------------------------------------------------------------- */
/* Accept is the only filled button on a card. Refusing is never the loud choice. */

.mer-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--r-control);
  padding: 10px 20px;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  line-height: 1.2;
}

.mer-btn-primary { color: var(--sage-on); background: var(--sage-deep); border: 1px solid var(--sage-deep); }
.mer-btn-primary:hover { background: var(--sage-deeper); border-color: var(--sage-deeper); }
.mer-btn-primary:active { background: var(--sage-deepest); }

.mer-btn-secondary { color: var(--ink-strong); background: var(--surface); border: 1px solid var(--line-strong); }
.mer-btn-secondary:hover { background: #F7F8F4; border-color: #B4BAAC; }

.mer-btn-quiet { color: var(--ink-soft); background: transparent; border: 1px solid transparent; padding: 10px 14px; }
.mer-btn-quiet:hover { background: #E9E9E3; color: var(--ink); }

.mer-btn-danger { color: var(--risk); background: var(--surface); border: 1px solid var(--risk-line); }
.mer-btn-danger:hover { background: #FBF0EC; border-color: #CE9C8C; }

.mer-btn:disabled,
.mer-btn[disabled] {
  color: var(--ink-faint);
  background: #F0F0EB;
  border-color: var(--line);
  cursor: not-allowed;
}

.mer-btn--sm { font-size: 13px; padding: 7px 14px; }

.mer-spinner {
  width: 13px; height: 13px;
  border: 1.75px solid rgba(255, 255, 255, .32);
  border-top-color: var(--sage-on);
  border-radius: 50%;
  animation: mer-spin .7s linear infinite;
  flex: none;
}

.mer-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.mer-actions .mer-push { margin-left: auto; }

/* --- Inputs -------------------------------------------------------------- */

.mer-field { display: grid; gap: 7px; }
.mer-field > span:first-child { font-size: 12.5px; font-weight: 500; color: var(--ink-strong); }
.mer-hint { font-size: 12px; color: var(--ink-mute); }

.mer-input, .mer-select, .mer-textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #FCFCFA;
  border: 1px solid var(--line-input);
  border-radius: var(--r-control);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}
.mer-input:focus, .mer-select:focus, .mer-textarea:focus {
  border-color: #8FA286;
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(143, 162, 134, .16);
}
.mer-input--mono { font-family: var(--font-mono); }
.mer-textarea { resize: vertical; line-height: 1.5; min-height: 76px; }
.mer-select { appearance: none; cursor: pointer; padding-right: 36px; }

/* A required reason is a risk-coloured field — an unaudited override is the defect. */
.mer-field--required > span:first-child { color: var(--risk); }
.mer-field--required .mer-input,
.mer-field--required .mer-textarea { background: #FEFAF8; border-color: #D9A692; }

.mer-filters {
  display: flex;
  gap: var(--s4);
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px 22px;
  margin-bottom: var(--s5);
}
.mer-filters .mer-field { min-width: 180px; }

/* --- Provenance chips ---------------------------------------------------- */
/* The whole system in six chips. Solid = told. Dashed = worked out. */

.mer-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--r-control);
  padding: 5px 10px;
  white-space: nowrap;
}

.mer-chip--confirmed { background: var(--sage-tint); border: 1px solid var(--sage-line); color: var(--sage-deeper); }
.mer-chip--inferred  { background: var(--clay-bg);  border: 1px dashed var(--clay-line); color: var(--clay-text); }
.mer-chip--risk      { background: var(--risk-bg);  border: 1px solid var(--risk-line); color: var(--risk-text); }
.mer-chip--info      { background: var(--info-bg);  border: 1px solid var(--info-line); color: var(--info-text); }
.mer-chip--neutral   { background: #F2F2ED;         border: 1px solid #DEDED7;          color: #6C7168; }
.mer-chip--strong    { background: var(--ink);      border: 1px solid var(--ink);       color: #EFEFEB; }

/* A refusal is an outcome, not an error (DR-06). Give it the same weight. */
.mer-chip--refusal   { background: var(--clay-bg);  border: 1px dashed var(--clay-line); color: var(--clay-text); }

.mer-live {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--sage-deeper);
}
.mer-live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--sage); animation: mer-pulse-dot 1.8s ease-in-out infinite;
}

/* Priority ticks */
.mer-tick { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; }
.mer-tick::before { content: ""; width: 3px; height: 13px; flex: none; }
.mer-tick--now  { color: var(--risk-text); }
.mer-tick--now::before  { background: var(--risk); }
.mer-tick--soon { color: var(--clay-text); }
.mer-tick--soon::before { background: var(--clay); }
.mer-tick--none { color: var(--ink-soft); }
.mer-tick--none::before { background: #B7BCB2; }

/* --- Tables -------------------------------------------------------------- */

.mer-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.mer-table thead th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-sunk);
  white-space: nowrap;
}
.mer-table tbody td { padding: 16px 18px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
.mer-table tbody tr:last-child td { border-bottom: none; }
.mer-table tbody tr:hover { background: #FCFCFA; }
.mer-table td.mer-num, .mer-table td .mer-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* An ageing item gets a terracotta edge — visible without being an alarm. */
.mer-row--ageing { box-shadow: inset 3px 0 0 var(--risk); }
.mer-row--ageing td:first-child { padding-left: 21px; }

.mer-flag-ageing {
  display: inline-block;
  margin-left: var(--s2);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--risk-text);
  background: var(--risk-bg);
  border: 1px solid var(--risk-line);
  border-radius: var(--r-control);
  padding: 2px 7px;
}

.mer-empty {
  border: 1px dashed #DEDED7;
  border-radius: var(--r-card);
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
}
.mer-empty-title { font-family: var(--font-display); font-size: 21px; margin-bottom: var(--s2); }
.mer-empty-body { font-size: 13px; color: var(--ink-mute); line-height: 1.55; max-width: 46ch; margin: 0 auto; }

/* --- Definition facts ---------------------------------------------------- */

.mer-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.mer-facts dt {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-sunk);
  white-space: nowrap;
}
.mer-facts dd {
  margin: 0;
  padding: 14px 20px;
  font-size: 14.5px;
  border-bottom: 1px solid var(--line-soft);
}
.mer-facts dt:last-of-type, .mer-facts dd:last-of-type { border-bottom: none; }

/* --- Rule trace ---------------------------------------------------------- */

.mer-trace-narrative {
  font-size: 15px;
  color: var(--ink-soft);
  border-left: 2px solid var(--sage-line);
  padding-left: var(--s4);
  margin-bottom: var(--s5);
}

/* --- Timeline (glass box) ------------------------------------------------ */

.mer-timeline { list-style: none; margin: 0; padding: 0; display: grid; }

.mer-stage {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: var(--s4);
  padding-bottom: 22px;
  align-items: start;
}
.mer-stage::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--sage);
  margin-top: 6px;
  justify-self: center;
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line);
}
.mer-stage--refusal::before { background: var(--clay); }

.mer-stage-body { min-width: 0; }
.mer-stage-name { font-size: 14.5px; font-weight: 500; display: block; margin-bottom: var(--s1); }
.mer-stage-line { display: block; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.mer-stage-line strong { font-weight: 500; color: var(--ink-strong); }

/* A refused stage is boxed in dashed clay — the guard holding, not a failure. */
.mer-stage--refusal .mer-stage-body {
  border: 1px dashed var(--clay-line-2);
  background: var(--clay-bg);
  border-radius: 4px;
  padding: 14px 16px;
}
.mer-stage--refusal .mer-stage-line { color: var(--clay-text); }
.mer-stage--refusal .mer-stage-line strong { color: var(--clay-text); }

/* --- Glass-box console --------------------------------------------------- */

.mer-console {
  background: var(--ink);
  border-radius: var(--r-card);
  padding: var(--s5);
  color: #EFEFEB;
}
.mer-console .mer-card-label { color: rgba(239, 239, 235, .5); }

.mer-console-btn {
  font-family: inherit;
  text-align: left;
  width: 100%;
  font-size: 13.5px;
  color: #EFEFEB;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--r-control);
  padding: 11px 13px;
  cursor: pointer;
  transition: background .16s ease;
  display: grid;
  gap: 3px;
}
.mer-console-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.mer-console-btn:disabled { opacity: .45; cursor: not-allowed; }

/* The R-01 look-alikes are highlighted — they are the point of the demo. */
.mer-console-btn--lookalike {
  color: var(--ink);
  background: #DFC08A;
  border-color: #DFC08A;
  font-weight: 500;
}
.mer-console-btn--lookalike:hover:not(:disabled) { background: #D5B279; }
.mer-console-btn--lookalike .mer-console-proves { color: rgba(35, 38, 31, .72); }

.mer-console-label { font-size: 13.5px; }
.mer-console-proves { font-size: 11.5px; color: rgba(239, 239, 235, .55); line-height: 1.45; }

.mer-console-note {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(239, 239, 235, .14);
  font-size: 12.5px;
  color: rgba(239, 239, 235, .6);
  line-height: 1.55;
}

/* --- Layout helpers ------------------------------------------------------ */

.mer-split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--s5); align-items: start; }
.mer-stack { display: grid; gap: var(--s5); }
.mer-stack--tight { display: grid; gap: var(--s3); }
.mer-row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.mer-divider { border: none; border-top: 1px dotted var(--line); margin: var(--s5) 0; }

.mer-notice { border-radius: var(--r-card); padding: 14px 18px; font-size: 14px; }
.mer-notice--ok      { background: var(--sage-tint); border: 1px solid var(--sage-line); color: var(--sage-deeper); }
.mer-notice--refused { background: var(--risk-bg);   border: 1px solid var(--risk-line); color: var(--risk-text); }

@media (max-width: 900px) {
  .mer-split { grid-template-columns: 1fr; }
  .mer-topbar-inner, .mer-page { padding-left: var(--s5); padding-right: var(--s5); }
  .mer-nav { gap: var(--s4); }
  h1 { font-size: 30px; }
}

/* Blazor's error strip, restyled so it does not look like a browser default. */
#blazor-error-ui {
  background: var(--risk-bg);
  border-top: 1px solid var(--risk-line);
  color: var(--risk-text);
  bottom: 0;
  display: none;
  left: 0;
  padding: 12px 18px;
  position: fixed;
  width: 100%;
  z-index: 1000;
  font-size: 13.5px;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 18px; top: 11px; }

/* --- Landing ------------------------------------------------------------- */

.mer-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 72px;
  align-items: end;
  padding: 72px 0 64px;
}
.mer-hero h1 { font-weight: 300; font-size: 54px; line-height: 1.06; margin: var(--s5) 0 var(--s5); }
.mer-hero-actions { margin-top: var(--s6); }
.mer-hero-aside { padding: var(--s5); }
.mer-hero-rule {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink);
  margin: 0 0 var(--s4);
}
.mer-hero-note { font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); margin: var(--s2) 0 0; }
.mer-inset-inferred .mer-hero-note { color: var(--clay-text); }
.mer-inset-inferred .mer-hero-note strong { font-weight: 500; color: var(--clay-text); }
.mer-inset-sage .mer-hero-note { color: var(--sage-deeper); }

.mer-section { padding: var(--s7) 0; }
.mer-section-head { display: flex; align-items: baseline; gap: 20px; margin-bottom: 40px; flex-wrap: wrap; }
.mer-section-num { font-size: 12px; color: var(--ink-faint); }
.mer-section-aside { margin: 0 0 0 auto; font-size: 13.5px; max-width: 44ch; }

.mer-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s5); }
.mer-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s5); }

.mer-card-title { font-family: var(--font-display); font-weight: 400; font-size: 24px; margin: var(--s3) 0 var(--s2); letter-spacing: -.01em; }
.mer-card--link { display: block; color: inherit; transition: border-color .16s ease, box-shadow .16s ease; }
.mer-card--link:hover { border-color: var(--line-strong); box-shadow: var(--shadow-raised); color: inherit; }
.mer-card-more { display: inline-block; margin-top: var(--s4); font-size: 13.5px; color: var(--sage-deep); font-weight: 500; }
.mer-card--consequence { background: var(--risk-bg-2); border-color: var(--risk-line); }
.mer-card--consequence .mer-card-label { color: var(--risk-text); }
.mer-card--consequence .mer-hero-note { color: var(--risk-text); }

.mer-lookalike-signal {
  font-size: 14px;
  background: #F2F2ED;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  padding: 10px 12px;
  margin: 0;
  color: var(--ink);
}

.mer-list { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.9; }
.mer-footnote { margin-top: var(--s6); font-size: 13px; color: var(--ink-mute); max-width: 74ch; }

@media (max-width: 900px) {
  .mer-hero { grid-template-columns: 1fr; gap: var(--s6); padding-top: var(--s6); }
  .mer-hero h1 { font-size: 34px; }
  .mer-section-aside { margin-left: 0; }
}

/* --- Demo outcome + basis badges ----------------------------------------- */
/* These class names are emitted from C# (ScenarioNarrative, DepartureBadgeDisplay).
   Do not rename them here — rename at the source or the badge silently loses style. */

.mer-outcome-head { display: flex; align-items: flex-start; gap: var(--s5); justify-content: space-between; flex-wrap: wrap; }
.mer-outcome-head h2 { max-width: 46ch; }

.outcome {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--r-control);
  padding: 6px 11px;
  white-space: nowrap;
  flex: none;
}
.outcome-decision { background: var(--sage-tint); border: 1px solid var(--sage-line); color: var(--sage-deeper); }
/* Inferred and refusal are both dashed clay — a refusal is the guard holding (DR-06). */
.outcome-inferred { background: var(--clay-bg); border: 1px dashed var(--clay-line); color: var(--clay-text); }
.outcome-refusal  { background: var(--clay-bg); border: 1px dashed var(--clay-line); color: var(--clay-text); }
.outcome-error    { background: var(--risk-bg); border: 1px solid var(--risk-line); color: var(--risk-text); }

.basis {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--r-control);
  padding: 3px 8px;
  white-space: nowrap;
}
.basis-confirmed { background: var(--sage-tint); border: 1px solid var(--sage-line); color: var(--sage-deeper); }
.basis-inferred  { background: var(--clay-bg);  border: 1px dashed var(--clay-line); color: var(--clay-text); }

.mer-basis-explain { display: block; font-size: 12px; color: var(--ink-mute); margin-top: 5px; line-height: 1.45; max-width: 42ch; }

/* --- Decision detail ----------------------------------------------------- */

.mer-detail-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s5); align-items: start; }

@media (max-width: 1000px) {
  .mer-detail-split { grid-template-columns: 1fr; }
}

/* --- The decision card --------------------------------------------------- */

.mer-page--narrow { max-width: 720px; }

.mer-decision {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-raised);
  overflow: hidden;
}

.mer-decision-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s5) var(--s5) var(--s4);
  border-bottom: 1px solid var(--line-soft);
}
.mer-decision-head h1 { font-size: 22px; margin: 0; }
.mer-decision-waiting {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--risk-text);
  white-space: nowrap;
}

.mer-keyfacts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4) var(--s5);
  margin: 0;
  padding: var(--s5);
  border-bottom: 1px solid var(--line-soft);
}
.mer-keyfact dt {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.mer-keyfact dd { margin: 0; font-size: 16px; color: var(--ink-strong); }

.mer-suggestion { padding: var(--s5); border-bottom: 1px solid var(--line-soft); }
.mer-suggestion-outcome {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink-strong);
  margin: 8px 0 0;
}
.mer-suggestion-why { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 var(--s4); }

.mer-disclosure { border-bottom: 1px solid var(--line-soft); }
.mer-disclosure > summary {
  cursor: pointer;
  padding: 14px var(--s5);
  font-size: 13px;
  color: var(--ink-soft);
  list-style: none;
  user-select: none;
}
.mer-disclosure > summary::-webkit-details-marker { display: none; }
.mer-disclosure > summary::before { content: "▸ "; color: var(--ink-mute); }
.mer-disclosure[open] > summary::before { content: "▾ "; }
.mer-disclosure > summary:hover { color: var(--ink); background: var(--surface-sunk); }
.mer-disclosure-body { padding: 0 var(--s5) var(--s5); }

.mer-decision-actions { display: flex; gap: 10px; padding: var(--s5); }
.mer-decision-actions .mer-btn { flex: 1; }

/* --- Reason dialog ------------------------------------------------------- */

.mer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 38, 31, .32);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
  z-index: 50;
}
.mer-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-overlay);
  padding: var(--s5);
  width: min(460px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  display: grid;
  gap: var(--s4);
}
.mer-dialog h2 { font-size: 18px; margin: 0; }
.mer-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 560px) {
  .mer-keyfacts { grid-template-columns: 1fr; }
  .mer-decision-actions { flex-direction: column; }
}

/* --- Glass box: legend, grouped console, answer-first outcome -------------- */

.mer-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
  margin-top: var(--s5);
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.mer-legend-item { display: grid; gap: 8px; align-content: start; }
.mer-legend-item p { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.mer-legend-item .basis { justify-self: start; }

.mer-console-group { display: grid; gap: 8px; margin-bottom: var(--s5); }
.mer-console-group:last-child { margin-bottom: 0; }
.mer-console-group-name {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.mer-console-group-note {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.mer-answer {
  margin: var(--s4) 0 0;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-strong);
  border-left: 2px solid var(--sage-line);
  padding-left: var(--s4);
}

.mer-stage-what { font-size: 14.5px; color: var(--ink-strong); }

@media (max-width: 700px) {
  .mer-legend { grid-template-columns: 1fr; }
}
