/* EDGE Markets — Portal stylesheet
   The internal finance portal rendered on the EDGE "light document" surface:
   white cards on a faint slate page, ink-navy chrome, IBM Plex type, mono
   tabular figures in every data table, restrained directional colour.
   Tokens below are inlined from the EDGE Markets Design System (tokens/*.css)
   so this file is self-contained. Do NOT apply to the daily revenue email —
   that lives on the separate "report" surface. */

/* ============================================================ TOKENS ===== */
:root {
  /* Brand */
  --edge-blue: #2563EB;
  --edge-blue-bright: #3B82F6;
  --edge-blue-700: #1D4ED8;
  --edge-blue-050: #EFF4FF;
  --edge-gold: #FFDA00;
  --edge-gold-600: #D4B400;
  --edge-gold-050: #FFF7CC;
  --indigo: #342EA8;

  /* Ink navy (chrome) */
  --ink-900: #04070F;
  --ink-800: #0B1322;
  --ink-700: #121A29;
  --ink-600: #1B2536;
  --ink-500: #2A3648;
  --ink-400: #3A4860;

  /* Slate neutrals */
  --slate-900: #0F172A;
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-050: #F8FAFC;
  --white: #FFFFFF;

  /* Financial semantics */
  --gain: #047857;
  --gain-050: #ECFDF5;
  --loss: #DC2626;
  --loss-050: #FEF2F2;
  --watch: #B45309;
  --watch-050: #FFF7ED;

  /* Semantic aliases — light document surface */
  --bg-page: var(--slate-050);
  --surface-card: var(--white);
  --surface-sunken: var(--slate-100);
  --surface-tint: var(--edge-blue-050);
  --border-default: var(--slate-200);
  --border-strong: var(--slate-300);
  --text-strong: var(--slate-900);
  --text-body: var(--slate-700);
  --text-muted: var(--slate-500);
  --accent: var(--edge-blue);
  --accent-hover: var(--edge-blue-700);
  --header-bar: var(--ink-800);
  --eyebrow: var(--slate-500);
  --focus-ring: color-mix(in srgb, var(--edge-blue) 45%, transparent);

  /* Type */
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-cond: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ls-eyebrow: 0.14em;
  --ls-tight: -0.02em;
  --ls-snug: -0.01em;

  /* Spacing / radius / borders */
  --r-xs: 3px;
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;
  --bw-hair: 1px;

  /* Shadows — restrained, cool-tinted */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.05);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
}

/* ===================================================== BASE ELEMENTS ===== */
body {
  font-family: var(--font-sans);
  color: var(--text-body);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-strong);
  letter-spacing: var(--ls-snug);
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

::selection { background: color-mix(in srgb, var(--edge-blue) 22%, transparent); }

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Tabular numbers wherever figures live in data context */
table, .num, .metric__value, .eyebrow { font-variant-numeric: tabular-nums; }

/* ====================================================== EYEBROW ========== */
/* The board-deck "SECTION 3 · PATH TO PROFITABILITY" device. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--eyebrow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow--tick::before {
  content: "";
  width: 14px;
  height: 2px;
  background: var(--accent);
  display: inline-block;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ======================================================= PAGE HEAD ======= */
.page-head { margin-bottom: 28px; }
.page-head h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: var(--ls-tight);
  color: var(--text-strong);
  margin-top: 6px;
}
.page-head .lede {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 8px;
  max-width: 70ch;
}

/* ========================================================= CARDS ========= */
.card {
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.card--tight { padding: 16px; }

/* Section header inside a card */
.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: var(--ls-snug);
}
.card-sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* Clickable card — quiet lift on hover */
.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.card-link:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  color: inherit;
}
.card-link:active { transform: translateY(0.5px); }

/* ==================================================== METRIC CARD ======== */
/* The signature KPI device: 3px accent rule on top, mono eyebrow label,
   big mono figure, muted context line. */
.metric {
  position: relative;
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-top: 3px solid var(--accent);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px 20px;
}
.metric--gain { border-top-color: var(--gain); }
.metric--loss { border-top-color: var(--loss); }
.metric--watch { border-top-color: var(--watch); }
.metric--gold { border-top-color: var(--edge-gold); }
.metric--neutral { border-top-color: var(--slate-400); }

.metric__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}
.metric__value {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: var(--ls-tight);
  color: var(--text-strong);
  margin-top: 10px;
}
.metric__value--sm { font-size: 22px; }
.metric__context { color: var(--text-muted); font-size: 13px; margin-top: 8px; }

/* ========================================================= BUTTONS ======= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: filter var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.btn:active { transform: translateY(0.5px); }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { filter: brightness(0.93); color: var(--white); }
.btn-secondary {
  background: var(--surface-card);
  color: var(--text-strong);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-sunken); color: var(--text-strong); }
.btn-ghost { background: transparent; color: var(--text-body); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--text-strong); }

/* ========================================================== FORMS ======== */
.label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.input {
  display: block;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-strong);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder { color: var(--slate-400); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ========================================================= BADGES ======== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--neutral { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }
.badge--info    { background: var(--edge-blue-050); color: var(--edge-blue-700); border-color: #DBE6FF; }
.badge--gain    { background: var(--gain-050); color: var(--gain); border-color: #C7F0DD; }
.badge--loss    { background: var(--loss-050); color: var(--loss); border-color: #FBD5D5; }
.badge--watch   { background: var(--watch-050); color: var(--watch); border-color: #FCE3C7; }
.badge--gold    { background: var(--edge-gold-050); color: #8A6D00; border-color: #F2E08A; }

.dot { width: 7px; height: 7px; border-radius: 999px; display: inline-block; }
.dot--gain { background: var(--gain); }
.dot--loss { background: var(--loss); }
.dot--watch { background: var(--watch); }
.dot--gold { background: var(--edge-gold); }

/* Directional text helpers — colour used ONLY to signal direction. */
.t-gain { color: var(--gain); }
.t-loss { color: var(--loss); }
.t-watch { color: var(--watch); }
.t-muted { color: var(--text-muted); }
.t-strong { color: var(--text-strong); }

/* ===================================================== DATA TABLE ========= */
/* Dense financial table: condensed uppercase headers, mono tabular figures,
   hairline rules, 1.5px rule under the header, tinted total/hover rows. */
.table-wrap {
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead th {
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1.5px solid var(--border-strong);
  white-space: nowrap;
  background: var(--surface-card);
}
.data-table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-default);
  color: var(--text-body);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-tint); }
.data-table .num,
.data-table td.num,
.data-table th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}
.data-table th.num { color: var(--text-muted); }
/* total / emphasis rows */
.data-table tr.is-total td {
  background: var(--surface-tint);
  border-top: 1.5px solid var(--border-strong);
  font-weight: 600;
  color: var(--text-strong);
}
.data-table tr.row-link { cursor: pointer; }
/* flagged row: rebate exceeds revenue */
.data-table tr.row-loss td { background: var(--loss-050); }
.data-table tr.row-loss:hover td { background: #FCE4E4; }
.data-table .cell-key { color: var(--text-strong); font-weight: 500; }
.data-table .empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px;
}

/* ======================================================== DETAILS ========= */
.disclosure {
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  background: var(--surface-card);
  overflow: hidden;
}
.disclosure > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-strong);
  background: var(--surface-sunken);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before {
  content: "▸";
  color: var(--text-muted);
  margin-right: 10px;
  display: inline-block;
  transition: transform var(--dur-fast) var(--ease-out);
}
.disclosure[open] > summary::before { transform: rotate(90deg); }

/* ===================================================== DEFINITION ========= */
/* key/value detail blocks used on customer/merchant/account detail pages */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; }
.kv dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  align-self: center;
}
.kv dd { margin: 0; color: var(--text-strong); }
.kv dd.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ========================================================= NAV =========== */
.edge-nav {
  background: var(--header-bar);
  border-bottom: 1px solid var(--ink-600);
}
.edge-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.edge-wordmark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--white);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
}
.edge-wordmark:hover { color: var(--white); }
.edge-wordmark .dot { color: var(--edge-gold); width: auto; height: auto; }
.edge-nav__links { display: flex; flex-wrap: wrap; gap: 2px; }
.edge-nav__link {
  color: #C3CDDC;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.edge-nav__link:hover { background: rgba(59, 130, 246, 0.14); color: var(--white); }
.edge-nav__link.is-active {
  color: var(--white);
  background: rgba(59, 130, 246, 0.18);
  box-shadow: inset 0 -2px 0 var(--edge-blue-bright);
}
.edge-nav__user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.edge-nav__user .who { color: var(--slate-400); font-family: var(--font-mono); }
.edge-nav__logout {
  color: #C3CDDC;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--ink-500);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.edge-nav__logout:hover { background: var(--ink-600); color: var(--white); }

/* footer classification strip */
.edge-foot {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-top: 1px solid var(--border-default);
  margin-top: 40px;
  padding: 18px 0;
}
