/* Ported from KPI-Dashboard's styles-editorial.css / styles-ops.css so this
   app looks and feels like the same product family. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --paper:     #ffffff;
  --paper-2:   #fafafa;
  --paper-3:   #f5f5f5;

  --rule:      #0a0a0a;
  --rule-soft: rgba(10,10,10,0.16);
  --hairline:  #dcdcdc;

  --ink:       #0a0a0a;
  --ink-2:     #3a3a3a;
  --ink-3:     #757575;
  --ink-4:     #a8a8a8;

  --signal:    #e0432a;
  --signal-2:  #b22912;
  --signal-soft: rgba(224,67,42,0.10);

  --c-emerald:   #0d9f6e;   --c-emerald-s: #e3f6ee;
  --c-violet:    #6d5ef0;   --c-violet-s:  #ecebfe;
  --c-teal:      #0ea5b5;   --c-teal-s:    #e0f4f6;
  --c-amber:     #c5870f;   --c-amber-s:   #fbf2dc;
  --c-red:       #e0432a;   --c-red-s:     #fcebe7;
  --c-blue:      #2f6fed;   --c-blue-s:    #e4eefd;
  --c-magenta:   #c026a8;   --c-magenta-s: #fbe5f4;
  --c-lime:      #5a9e1e;   --c-lime-s:    #ebf5dd;
  --c-slate:     #5b6b7a;   --c-slate-s:   #e8ecf0;
  --c-rose:      #d04060;   --c-rose-s:    #fbe6ec;

  --display: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --sans:    "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
a { color: inherit; }

/* ── Top nav ───────────────────────────────────────────────── */
.topnav {
  display: flex; align-items: center; gap: 4px;
  padding: 0 32px; height: 56px;
  border-bottom: 2px solid var(--rule);
  background: var(--paper);
}
.topnav-brand { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: -0.02em; margin-right: 28px; }
.topnav-brand em { font-style: normal; color: var(--signal); }
.topnav-links { display: flex; gap: 4px; }
.topnav-links a {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--ink-3); text-decoration: none; padding: 8px 12px; border-radius: 5px;
}
.topnav-links a:hover { color: var(--ink); background: var(--paper-2); }
.topnav-links a.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--signal); }
.topnav-spacer { flex: 1; }
.topnav-user { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-right: 14px; }

/* ── Page layout ───────────────────────────────────────────── */
.page { padding: 28px 36px 80px; max-width: 1200px; margin: 0 auto; }
.page-h {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 24px;
  border-bottom: 2px solid var(--rule); padding-bottom: 16px; margin-bottom: 22px;
}
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--signal); font-weight: 500; margin-bottom: 10px; }
.headline { font-family: var(--display); font-weight: 700; font-size: 36px; line-height: 0.95; letter-spacing: -0.03em; margin: 0; color: var(--ink); }
.headline em { font-style: normal; color: var(--ink); font-weight: 700; }
.dek { font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--ink-3); max-width: 64ch; margin-top: 12px; }
.byline { font-family: var(--mono); font-size: 12px; color: var(--ink-3); text-align: right; display: flex; flex-direction: column; gap: 4px; }

.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; }
.col-1  { grid-column: span 1; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }
.col-12 { grid-column: span 12; }

.rule { border-top: 1px solid var(--rule); margin: 36px 0 24px; }

/* ── Big stats strip ───────────────────────────────────────── */
.lede { display: grid; border-bottom: 2px solid var(--rule); margin-bottom: 32px; }
.lede-cell { position: relative; padding: 18px 24px 20px; border-right: 1px solid var(--hairline); }
.lede-cell:last-child { border-right: 0; }
.lede-cell::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--ink-4); }
.lede-cell.cap-emerald::before { background: var(--c-emerald); }
.lede-cell.cap-violet::before  { background: var(--c-violet); }
.lede-cell.cap-amber::before   { background: var(--c-amber); }
.lede-cell.cap-blue::before    { background: var(--c-blue); }
.lede-cell.cap-slate::before   { background: var(--c-slate); }
.lede-cell.cap-signal::before  { background: var(--signal); }
.lede-lbl { font-family: var(--sans); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.lede-val { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; color: var(--ink); }
.lede-val.neg { color: var(--signal); }

/* ── Section headers ───────────────────────────────────────── */
.sect-h { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--rule); padding-bottom: 8px; margin-bottom: 16px; }
.sect-h .l { display: flex; align-items: baseline; gap: 14px; }
.sect-h .num { font-family: var(--mono); font-size: 12px; color: var(--signal); letter-spacing: 0.06em; font-weight: 500; }
.sect-h h2 { font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
.sect-h h2 em { font-style: normal; color: var(--signal); font-weight: 500; }
.sect-h .meta { font-size: 12px; color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 500; }

/* ── Forms ─────────────────────────────────────────────────── */
.ed-label { display: block; font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 4px; }
.ed-input, .ed-select, .ed-textarea {
  width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: transparent;
  padding: 8px 0; font-family: var(--mono); font-size: 13px; color: var(--ink); outline: none;
  appearance: none; -webkit-appearance: none;
}
.ed-input:focus, .ed-select:focus, .ed-textarea:focus { border-bottom-color: var(--signal); }
.ed-textarea { min-height: 60px; resize: vertical; font-family: var(--sans); }
.ed-select {
  padding-right: 16px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 8px) center, calc(100% - 4px) center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.filterbar { display: flex; gap: 0; align-items: stretch; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 18px 0 0; }
.filterbar .field { display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 0; border-right: 1px solid var(--hairline); font-size: 12px; letter-spacing: 0.04em; }
.filterbar .field:first-child { padding-left: 0; }
.filterbar .field .l { color: var(--ink-3); letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; }
.filterbar select, .filterbar input {
  appearance: none; -webkit-appearance: none; background: transparent; border: 0;
  font-family: var(--mono); font-size: 13px; color: var(--ink); padding: 0; outline: none; letter-spacing: 0;
}
.filterbar .spacer { flex: 1; border-right: 0; padding: 0; }
.filterbar .actions { padding: 8px 0; display: flex; gap: 8px; align-items: center; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  appearance: none; border: 1px solid var(--rule); background: transparent; color: var(--ink);
  padding: 7px 13px; font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  letter-spacing: 0.10em; text-transform: uppercase; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-signal { background: var(--signal); border-color: var(--signal); color: var(--paper); }
.btn-signal:hover { background: var(--signal-2); border-color: var(--signal-2); }
.btn-ghost { border-color: transparent; color: var(--ink-3); padding-left: 0; padding-right: 0; }
.btn-ghost:hover { background: transparent; color: var(--ink); text-decoration: underline; }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* ── Badges / pills ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans); font-size: 11.5px;
  letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; padding: 2px 7px;
  border: 0.5px solid var(--rule); background: transparent; color: var(--ink);
}
.badge .dot { width: 6px; height: 6px; flex: none; border-radius: 50%; }

.empty { border: 1px dashed var(--ink-4); padding: 28px; text-align: center; font-family: var(--sans); font-size: 14.5px; color: var(--ink-3); }

.plate { border: 1px solid var(--rule); padding: 18px 20px; }

/* ── Soft Cards — a lower-density, easier-to-scan list style ──── */
.card-canvas { background: var(--paper-3); border-radius: 12px; padding: 14px; }
.card-list { display: flex; flex-direction: column; gap: 8px; }
.card-row {
  display: grid; align-items: center; gap: 16px;
  background: var(--paper); border-radius: 10px; padding: 14px 18px 14px 22px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05); border-left: 3px solid var(--row-accent, var(--ink-4));
  text-decoration: none; color: inherit;
}
.card-avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--sans); font-weight: 600; font-size: 13.5px; }
.card-primary { min-width: 0; }
.card-name { font-family: var(--sans); font-weight: 600; font-size: 14.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-family: var(--sans); font-weight: 400; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-field { min-width: 0; overflow: hidden; }
.card-field-l { font-family: var(--sans); font-weight: 600; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-4); }
.card-field-v { font-family: var(--sans); font-weight: 400; font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.card-pill { display: inline-block; font-family: var(--sans); font-weight: 600; font-size: 13px; padding: 3px 12px; border-radius: 20px; white-space: nowrap; color: var(--row-accent, var(--ink-3)); background: var(--row-accent-soft, var(--paper-3)); }
.card-meta { text-align: right; min-width: 0; overflow: hidden; }
.card-meta-primary { font-family: var(--sans); font-weight: 400; font-size: 13.5px; color: var(--ink-3); white-space: nowrap; }
.card-meta-secondary { font-family: var(--sans); font-weight: 400; font-size: 12.5px; color: var(--ink-4); margin-top: 2px; white-space: nowrap; }

/* ── Login ─────────────────────────────────────────────────── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--paper); border: 1px solid var(--rule); padding: 44px; width: 100%; max-width: 380px; }
.login-card h1 { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 4px; }
.login-card h1 em { font-style: normal; color: var(--signal); }
.login-card .sub { font-size: 13px; color: var(--ink-3); margin-bottom: 28px; }
.login-card .field { margin-bottom: 14px; }
.login-btn { width: 100%; background: var(--signal); color: #fff; border: none; padding: 13px; font-size: 14px; font-weight: 700; cursor: pointer; margin-top: 6px; font-family: var(--sans); }
.login-btn:hover { background: var(--signal-2); }
.err { background: #fff0f0; color: #c0392b; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; }
