/* TradeMirrorly campaign portal. Dark is the desktop app's palette; light is Designs.md. Components read tokens only. */
@font-face {
  font-family: "Satoshi";
  src: url("../fonts/Satoshi-Variable.70880e42f07b.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-alt: #0a0a0a;
  --surface: #111111;
  --raised: #1a1a1a;
  --line: #222222;
  --line-strong: #333333;
  --fg: #ffffff;
  --fg-2: #b3b3b3;
  --fg-muted: #999999;
  --fg-faint: #8a8a8a;
  --ink: #0a0a0a;
  --accent: #5b8cff;
  --action: #1e47f0;
  --action-hover: #3358ff;
  --accent-wash: rgba(91, 140, 255, 0.12);
  --sky: #3aa0ff;
  --sky-wash: rgba(58, 160, 255, 0.12);
  --warm: #199e70; /* warm-up dots: dataviz slot 3, distinct from campaign blue */
  --green: #4a9e5c;
  --green-text: #6cc47f;
  --green-wash: rgba(74, 158, 92, 0.14);
  --amber: #d4a843;
  --amber-text: #e2bd62;
  --amber-wash: rgba(212, 168, 67, 0.14);
  --red: #d71921;
  --red-text: #ff6b70;
  --red-wash: rgba(215, 25, 33, 0.16);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Satoshi", "General Sans", Inter, ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sidebar: 236px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f8fc;
  --bg-alt: #eef1f8;
  --surface: #ffffff;
  --raised: #f0f2f8;
  --line: #e6e8f0;
  --line-strong: #cdd2df;
  --fg: #070b1e;
  --fg-2: #4a5168;
  --fg-muted: #5f667c;
  --fg-faint: #666d82;
  --ink: #ffffff;
  --accent: #1e47f0;
  --action: #1e47f0;
  --action-hover: #1636c8;
  --accent-wash: #eef2ff;
  --sky-wash: #e6f3ff;
  --warm: #1baf7a;
  --green-text: #2f7a40;
  --green-wash: #e8f5eb;
  --amber-text: #8a6a12;
  --amber-wash: #fbf3dd;
  --red-text: #b3141b;
  --red-wash: #fdeaea;
  --shadow: 0 1px 2px rgba(7, 11, 30, 0.04), 0 0 0 1px rgba(7, 11, 30, 0.02);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
code, .mono { font-family: var(--mono); font-size: 13px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px; border-right: 1px solid var(--line); background: var(--bg);
}
.brand { display: block; padding: 4px 8px 18px; }
.brand img { height: 26px; width: auto; }
:root[data-theme="light"] .brand img, :root[data-theme="light"] .brand-ink { filter: brightness(0); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav + .nav { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 999px;
  color: var(--fg-2); font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--raised); color: var(--fg); text-decoration: none; }
.nav a.active { background: var(--fg); color: var(--ink); font-weight: 700; }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent); }
.nav a.active .count { color: var(--ink); }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; font-size: 13px; color: var(--fg-faint); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; justify-content: flex-end;
  padding: 12px 28px; border-bottom: 1px solid var(--line); min-height: 56px;
}
.topbar .spacer { flex: 1; }
.topbar .menu-toggle { display: none; }
.content { padding: 28px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--fg-muted); margin-top: 6px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 13px; color: var(--fg-muted); margin-bottom: 6px; }
.crumbs a { color: var(--fg-muted); }

.banner {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 28px; background: var(--amber-wash); color: var(--amber-text);
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.banner a { color: inherit; font-weight: 700; text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
  font: 600 14px/1 var(--font); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--raised); text-decoration: none; }
.btn-primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn-danger { color: var(--red-text); }
.btn-danger:hover { background: var(--red-wash); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--raised); color: var(--fg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled], .btn.disabled { opacity: 0.45; pointer-events: none; }
.icon-btn { width: 36px; padding: 0; }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
form.inline { display: inline; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head .sub { color: var(--fg-muted); font-size: 13px; margin-top: 2px; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.stack { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 18px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: 16px 18px; }
.stat .label { color: var(--fg-muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--fg-faint); font-size: 12px; margin-top: 2px; }
.stat .value.good { color: var(--green-text); }
.stat .value.warn { color: var(--amber-text); }
.stat .value.bad { color: var(--red-text); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--fg-muted); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--bg-alt); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .primary-cell a { color: var(--fg); font-weight: 600; }
.table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

.empty { padding: 36px 20px; text-align: center; color: var(--fg-muted); }
.empty h3 { color: var(--fg); margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--raised); color: var(--fg-2); border: 1px solid var(--line);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.chip.plain::before { display: none; }
.chip.green { background: var(--green-wash); color: var(--green-text); border-color: transparent; }
.chip.amber { background: var(--amber-wash); color: var(--amber-text); border-color: transparent; }
.chip.red { background: var(--red-wash); color: var(--red-text); border-color: transparent; }
.chip.blue { background: var(--accent-wash); color: var(--accent); border-color: transparent; }
.chip.sky { background: var(--sky-wash); color: var(--sky); border-color: transparent; }
:root[data-theme="light"] .chip.sky { color: #0b6fc9; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full, .form-grid > .wide { grid-column: 1 / -1; }
.field label, .form-grid > div > label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--fg); }
.field .help, .helptext { display: block; color: var(--fg-muted); font-size: 12.5px; margin-top: 5px; }
input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="number"],
input[type="search"], input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--bg-alt); color: var(--fg);
  font: 400 14px/1.4 var(--font);
}
textarea { min-height: 120px; resize: vertical; }
textarea.code, input.code { font-family: var(--mono); font-size: 13px; }
select[multiple] { min-height: 110px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check label { margin: 0; font-weight: 600; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--red-text); font-size: 13px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }
fieldset { border: 0; padding: 0; margin: 0; }
.choice-list { display: grid; gap: 8px; }
.choice-list label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.choice-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.toolbar input[type="search"] { max-width: 280px; }
.toolbar select { width: auto; min-width: 140px; }

/* ---------- Messages & alerts ---------- */
.messages { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.messages li { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--raised); border: 1px solid var(--line); font-size: 14px; }
.messages .success { background: var(--green-wash); color: var(--green-text); border-color: transparent; }
.messages .warning { background: var(--amber-wash); color: var(--amber-text); border-color: transparent; }
.messages .error { background: var(--red-wash); color: var(--red-text); border-color: transparent; }
.callout { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-wash); color: var(--fg); font-size: 14px; }
.callout.warn { background: var(--amber-wash); }
.callout.bad { background: var(--red-wash); }

/* ---------- Key/value ---------- */
dl.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--fg-muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.copy-field { display: flex; gap: 6px; align-items: center; }
.copy-field code { flex: 1; min-width: 0; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--bg-alt); border: 1px solid var(--line); overflow-x: auto; white-space: nowrap; }

/* ---------- Meters ---------- */
.meter { height: 6px; border-radius: 999px; background: var(--raised); overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.meter.green > span { background: var(--green); }
.meter.amber > span { background: var(--amber); }
.split-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--raised); min-width: 120px; }
.split-bar span { height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--fg-muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }

/* ---------- Today's sends timeline (signature element) ---------- */
.timeline { position: relative; height: 34px; margin: 6px 0 2px; }
.timeline .track { position: absolute; left: 0; right: 0; top: 16px; height: 2px; background: var(--line-strong); border-radius: 2px; }
.timeline .dot {
  position: absolute; top: 11px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  border: 2px solid var(--accent); background: var(--surface);
}
.timeline .dot.sent { background: var(--accent); }
.timeline .dot.warmup { border-color: var(--warm); }
.timeline .dot.warmup.sent { background: var(--warm); }
.timeline .dot.failed { border-color: var(--red); background: var(--red); }
.timeline .now { position: absolute; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; background: var(--fg); opacity: 0.7; }
.timeline-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.domain-row { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.domain-row:last-child { border-bottom: 0; }
.domain-row .head { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.domain-row .name { font-weight: 700; }
.domain-row .counts { font-variant-numeric: tabular-nums; color: var(--fg-2); font-size: 14px; }

/* ---------- Tabs & pagination ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 12px; color: var(--fg-muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--fg); border-bottom-color: var(--accent); }
.tabs a:hover { color: var(--fg); text-decoration: none; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 14px; font-size: 13px; color: var(--fg-muted); border-top: 1px solid var(--line); }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 260px; }
.chart-box.short { height: 200px; }

/* ---------- Preview ---------- */
.preview-frame { width: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
pre.text-preview { white-space: pre-wrap; font-family: var(--mono); font-size: 13px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin: 0; max-height: 520px; overflow: auto; }

/* ---------- Login (the one Aurora surface) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.aurora {
  position: relative; overflow: hidden; padding: 44px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(60% 50% at 80% 20%, rgba(143, 211, 255, 0.28), transparent 70%),
              linear-gradient(140deg, #101a3d 0%, #2545b5 58%, #4197fd 100%);
  color: #fff;
}
.aurora img { height: 30px; width: auto; align-self: flex-start; }
.aurora .line-art { position: absolute; top: 26%; left: -40px; width: calc(100% + 80px); opacity: 0.5; pointer-events: none; }
.aurora h1 { font-size: 40px; letter-spacing: -0.035em; line-height: 1.08; max-width: 14ch; position: relative; }
.aurora p { color: rgba(255, 255, 255, 0.78); max-width: 40ch; position: relative; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 24px; margin-bottom: 6px; }
.auth-card .field { margin-top: 16px; }
.auth-card .btn { width: 100%; height: 42px; margin-top: 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform 0.2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5); }
  .topbar .menu-toggle { display: inline-flex; }
  .topbar, .content, .banner { padding-left: 16px; padding-right: 16px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .aurora { min-height: 220px; padding: 28px; }
  .aurora h1 { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
