/* Meridian dashboard — dialed.gg look, shared with Dave's Cockpit/ConvertX pages. */

@font-face { font-family: "Inter"; src: url("fonts/Inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --font: "Inter", -apple-system, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --page: #ffffff;
  --page-2: #f5f5f5;
  --ink: #0d0d0d;
  --muted: rgba(0, 0, 0, 0.55);
  --faint: rgba(0, 0, 0, 0.08);
  --card: #111111;
  --card-ink: #ffffff;
  --card-muted: rgba(255, 255, 255, 0.55);
  --card-line: rgba(255, 255, 255, 0.08);
  --card-border: transparent;
  --shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.35), 0 10px 30px -10px rgba(0, 0, 0, 0.2);
  --glow: radial-gradient(120% 90% at 70% 110%, rgba(84, 110, 150, 0.55) 0%, rgba(40, 52, 72, 0.25) 35%, rgba(0, 0, 0, 0) 65%);
  --up: #30d158;
  --down: #ff6961;
  --warn: #ffd60a;
  --accent: #5e5ce6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #000000; --page-2: #0a0a0a; --ink: #f5f5f5; --muted: rgba(255, 255, 255, 0.55); --faint: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.09); --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #000000; --page-2: #0a0a0a; --ink: #f5f5f5; --muted: rgba(255, 255, 255, 0.55); --faint: rgba(255, 255, 255, 0.1);
  --card-border: rgba(255, 255, 255, 0.09); --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { font-weight: 500; letter-spacing: -0.035em; margin: 0; }
h2 { font-size: 24px; }
h3 { font-size: 17px; letter-spacing: -0.02em; }
code { font-family: var(--mono); font-size: 12px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
main.wrap { padding-top: 24px; padding-bottom: 72px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--faint); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.mark svg { width: 22px; height: 22px; }
.brand-name { font-size: 20px; letter-spacing: -0.04em; }
.top-right { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 36px; height: 36px; border-radius: 9999px; border: 0; background: var(--page-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 17px; height: 17px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.up { background: var(--up); box-shadow: 0 0 0 4px color-mix(in srgb, var(--up) 22%, transparent); }
.dot.down { background: var(--down); }
.dot.warn { background: var(--warn); }

.tabs { display: flex; gap: 6px; padding-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; height: 34px; padding: 0 16px; border-radius: 9999px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.tab:hover { color: var(--ink); background: var(--page-2); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--page); }

/* Badges */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; background: var(--page-2); color: var(--muted); white-space: nowrap; }
.card .badge { background: rgba(255, 255, 255, 0.1); color: var(--card-muted); }
.badge.dry { background: #ffd60a; color: #1a1500; }
.badge.live { background: #ff453a; color: #fff; }
.badge.ok { background: rgba(48, 209, 88, 0.18); color: var(--up); }
.badge.bad { background: rgba(255, 69, 58, 0.18); color: var(--down); }
.badge.amber { background: rgba(255, 214, 10, 0.16); color: var(--warn); }

/* Banner */
.banner { border-radius: 16px; padding: 16px 20px; background: var(--page-2); margin-bottom: 20px; line-height: 1.5; }
.banner code { display: block; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--card); color: #fff; overflow-x: auto; white-space: nowrap; }
.banner.warn { background: rgba(255, 159, 10, 0.12); color: var(--ink); }

/* Cards */
.card { position: relative; background: linear-gradient(180deg, #141414 0%, #0d0d0d 100%); color: var(--card-ink); border-radius: 20px; padding: 24px 26px; box-shadow: var(--shadow); border: 1px solid var(--card-border); overflow: hidden; }
.card .muted { color: var(--card-muted); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.kicker { font-size: 13px; color: var(--card-muted); letter-spacing: -0.01em; }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: end; padding: 44px 44px 40px; border-radius: 24px; background: var(--glow), linear-gradient(180deg, #111 0%, #0b0b0b 100%); }
.big { font-size: 52px; letter-spacing: -0.055em; line-height: 1; margin: 12px 0 10px; font-variant-numeric: tabular-nums; }
.hero-side { display: grid; gap: 8px; min-width: 200px; }
.cycle { display: flex; justify-content: space-between; gap: 18px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); font-variant-numeric: tabular-nums; }
.cycle span { color: var(--card-muted); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.stat .num { font-size: 30px; letter-spacing: -0.045em; margin-top: 14px; font-variant-numeric: tabular-nums; line-height: 1.05; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); margin-top: 0; }

/* Chart */
.chart { position: relative; height: 220px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis { stroke: rgba(255, 255, 255, 0.1); stroke-width: 1; }
.chart .zero { stroke: rgba(255, 255, 255, 0.25); stroke-dasharray: 3 4; }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .lbl { fill: rgba(255, 255, 255, 0.45); font-size: 11px; font-family: var(--font); }
.chart .hover-dot { stroke: #0d0d0d; stroke-width: 2; opacity: 0; }
.chart .hover-dot.on { opacity: 1; }
.chart-tip { position: absolute; pointer-events: none; background: #fff; color: #000; font-size: 12px; padding: 6px 9px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -120%); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }
.empty { color: var(--card-muted); display: grid; place-items: center; min-height: 140px; text-align: center; line-height: 1.5; padding: 12px; }
.panel > .empty, .pos-grid > .empty, .dec-list > .empty, .les-list > .empty { color: var(--muted); background: var(--page-2); border-radius: 20px; }

.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 240px; overflow-y: auto; }
.events li { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--card-line); }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--card-muted); font-size: 12px; flex: none; width: 74px; font-variant-numeric: tabular-nums; }

/* Toolbar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 16px; }
.bar h2 { display: flex; align-items: center; gap: 10px; }
.bar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input { height: 36px; border-radius: 9999px; border: 1px solid var(--faint); background: var(--page-2); color: var(--ink); font: inherit; font-size: 13px; padding: 0 14px; min-width: 0; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }

/* Pills */
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 19px; border-radius: 9999px; border: 0; background: var(--ink); color: var(--page); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease; }
.card .pill { background: #fff; color: #000; }
.pill:active { transform: scale(0.97); }
.pill:disabled { opacity: 0.4; cursor: default; transform: none; }
.pill.ghost, .card .pill.ghost { background: rgba(127, 127, 127, 0.16); color: inherit; }
.pill.danger, .card .pill.danger { background: rgba(255, 69, 58, 0.16); color: var(--down); }
.pill.sm { height: 30px; padding: 0 14px; font-size: 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.pills.end { justify-content: flex-end; }

/* Positions */
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.pos .pair { font-size: 22px; letter-spacing: -0.04em; }
.pos .sub { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pos .pnl { font-size: 36px; letter-spacing: -0.05em; margin: 18px 0 4px; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin-top: 16px; }
.kv div { display: flex; flex-direction: column; gap: 2px; }
.kv span { font-size: 12px; color: var(--card-muted); }
.kv b { font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.range { margin-top: 16px; }
.range-track { position: relative; height: 8px; border-radius: 9999px; background: rgba(255, 255, 255, 0.1); }
.range-fill { position: absolute; top: 0; bottom: 0; border-radius: 9999px; background: rgba(94, 92, 230, 0.8); }
.range-pin { position: absolute; top: -4px; width: 3px; height: 16px; border-radius: 2px; background: #fff; transform: translateX(-50%); }
.range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--card-muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.note { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); font-size: 13px; line-height: 1.45; }
.addr { font-family: var(--mono); font-size: 11px; color: var(--card-muted); text-decoration: none; }
.addr:hover { color: #fff; }

/* Tables */
.table-card { padding: 6px 0; }
.table-scroll { overflow-x: auto; max-height: 560px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { position: sticky; top: 0; background: #111; text-align: left; font-weight: 500; color: var(--card-muted); padding: 10px 14px; white-space: nowrap; }
.table td { padding: 10px 14px; border-top: 1px solid var(--card-line); vertical-align: top; font-variant-numeric: tabular-nums; }
.table td.wrap-cell { min-width: 220px; color: rgba(255, 255, 255, 0.75); }
.table .num { text-align: right; white-space: nowrap; }
.table tr.empty-row td { text-align: center; color: var(--card-muted); padding: 36px 14px; }

/* Decisions */
.dec-list, .les-list { display: grid; gap: 12px; }
.dec .dec-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dec .dec-pool { font-size: 17px; letter-spacing: -0.02em; }
.dec time { margin-left: auto; color: var(--card-muted); font-size: 12px; }
.dec p { margin: 10px 0 0; line-height: 1.5; color: rgba(255, 255, 255, 0.8); }
.dec .reason { color: var(--card-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { font-size: 12px; padding: 4px 9px; border-radius: 8px; background: rgba(255, 255, 255, 0.07); color: rgba(255, 255, 255, 0.75); }
.chip.risk { background: rgba(255, 69, 58, 0.14); color: #ff8a80; }
details.more { margin-top: 12px; color: var(--card-muted); font-size: 13px; }
details.more summary { cursor: pointer; }
details.more ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.5; }

/* Lessons + config */
.les { padding: 18px 22px; }
.les p { margin: 0; line-height: 1.5; }
.les .chips { margin-top: 10px; }
.cfg { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.cfg dt { color: var(--card-muted); }
.cfg dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Logs */
.log-card { padding: 0; }
.log { margin: 0; height: calc(100vh - 240px); min-height: 360px; overflow: auto; padding: 18px 20px; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: rgba(255, 255, 255, 0.8); white-space: pre-wrap; word-break: break-word; }
.log .l-warn { color: #ffd60a; }
.log .l-error { color: #ff6961; }
.log .l-ts { color: rgba(255, 255, 255, 0.35); }
.log .l-cat { color: #8e8cff; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.live-dot.on { background: var(--up); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* Modal */
.modal { border: 0; border-radius: 22px; padding: 26px; width: min(440px, calc(100vw - 32px)); background: #141414; color: #fff; box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5); }
.modal::backdrop { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px); }
.modal p { line-height: 1.5; color: rgba(255, 255, 255, 0.65); }
.modal label { display: grid; gap: 8px; margin-top: 14px; }
.modal .check { display: inline-flex; color: rgba(255, 255, 255, 0.75); }
.modal .input { background: rgba(255, 255, 255, 0.08); color: #fff; border-color: rgba(255, 255, 255, 0.12); height: 42px; }
.modal .pill.ghost { color: #fff; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 12px 18px; border-radius: 14px; max-width: calc(100vw - 32px); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3); z-index: 50; font-size: 13px; line-height: 1.4; }
.toast.bad { background: #ff453a; color: #fff; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2.wide-left { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  main.wrap { padding-top: 16px; }
  .top-row { height: 56px; }
  #bot-label { display: none; }
  .hero { grid-template-columns: 1fr; padding: 28px 24px; align-items: start; }
  .big { font-size: 40px; }
  .stats { gap: 12px; }
  .card { padding: 20px; border-radius: 18px; }
  .stat .num { font-size: 24px; }
  .pos-grid { grid-template-columns: 1fr; }
  .bar-right, .bar-right .input { width: 100%; }
  .bar-right .input { flex: 1 1 140px; width: auto; }
  h2 { font-size: 21px; }
}

/* Login */
.login-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
.login-wrap { width: min(400px, calc(100vw - 32px)); padding: 24px 0; }
.login-card { display: grid; gap: 16px; padding: 32px 30px; border-radius: 24px; background: var(--glow), linear-gradient(180deg, #111 0%, #0b0b0b 100%); }
.login-card .brand-name { color: #fff; }
.login-card > p { margin: 0; }
.login-card label { display: grid; gap: 8px; }
.login-card .input { height: 44px; background: rgba(255, 255, 255, 0.08); color: #fff; border-color: rgba(255, 255, 255, 0.12); font-size: 15px; }
.login-card .pill { height: 44px; margin-top: 6px; font-size: 14px; }
.login-error { margin: 0; color: #ff8a80; font-size: 13px; }
