:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #111621;
  --panel-soft: #0d121c;
  --line: #20283a;
  --text: #f7f9ff;
  --muted: #97a2b8;
  --blue: #7280ff;
  --blue-soft: #202a58;
  --green: #42d392;
  --orange: #ffad48;
  --red: #ff7a87;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 18% 0, #18203c 0, transparent 32%), var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 28px;
}

[hidden] { display: none !important; }

.login-card {
  width: min(540px, 100%);
  margin: 9vh auto 0;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(17, 22, 33, .94);
  box-shadow: 0 30px 80px #0008;
}

.login-card > div { margin: 18px 0 28px; }
.eyebrow { margin: 0 0 4px; color: #8997ff; font-size: 12px; font-weight: 800; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(30px, 4vw, 40px); letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 24px; letter-spacing: -.025em; }
h3 { margin: 0 0 18px; font-size: 16px; }
.login-card p, header p, .muted { color: var(--muted); }
label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; }
.login-row { display: flex; gap: 10px; }

input, button, .button-link { border-radius: 11px; font: inherit; }
input { min-width: 0; flex: 1; padding: 12px 14px; border: 1px solid #343e55; background: #090d16; color: #fff; }
button, .button-link { border: 0; padding: 11px 16px; background: var(--blue); color: #fff; font-weight: 750; cursor: pointer; text-decoration: none; }
button:focus-visible, input:focus-visible, .button-link:focus-visible { outline: 3px solid #8793ff66; outline-offset: 2px; }
.error { min-height: 22px; margin: 9px 0 0 !important; color: var(--red) !important; }

header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
header p { margin-bottom: 0; }
.actions { display: flex; gap: 9px; }
.secondary { border: 1px solid var(--line); background: var(--panel); color: #d9deec; }
.notice { margin-bottom: 18px; padding: 13px 16px; border: 1px solid #6d562a; border-radius: 12px; background: #2a2112; color: #ffd391; }

.source-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 34px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0b1019aa;
  color: var(--muted);
  font-size: 12px;
}

.source-strip span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.live-dot { background: var(--green); box-shadow: 0 0 0 3px #42d39218; }
.snapshot-dot { background: var(--blue); }
.setup-dot { background: var(--orange); }

.section-block { margin-bottom: 42px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-heading > p { max-width: 360px; margin: 0; color: var(--muted); text-align: right; font-size: 12px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.cards article, .panel { border: 1px solid var(--line); background: linear-gradient(145deg, #141a27, #0e131d); box-shadow: 0 16px 40px #0004; }
.cards article { min-width: 0; padding: 20px; border-radius: 18px; }
.cards span { display: block; min-height: 42px; color: var(--muted); font-size: 13px; }
.cards strong { display: block; overflow-wrap: anywhere; font-size: clamp(29px, 3.2vw, 38px); letter-spacing: -.045em; }
.cards small { color: #718098; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sales-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
.panel { min-width: 0; padding: 22px; border-radius: 18px; }
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-title h3 { margin-bottom: 0; }
.caption { color: #718098; font-size: 11px; text-align: right; }
.status { flex: 0 0 auto; padding: 5px 9px; border-radius: 99px; background: #32291a; color: var(--orange); font-size: 11px; font-weight: 800; }
.status.live { background: #143125; color: var(--green); }
.status.snapshot { background: var(--blue-soft); color: #aab2ff; }

.rows { display: grid; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 11px 0; border-bottom: 1px solid #1c2331; color: var(--muted); }
.row:last-child { border-bottom: 0; }
.row > span { min-width: 0; }
.row small { display: block; max-width: 360px; margin-top: 2px; color: #68748b; font-size: 10px; }
.row strong { flex: 0 0 auto; color: var(--text); text-align: right; }

.rank-list { display: grid; gap: 13px; }
.rank-item > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 13px; }
.rank-item span { overflow-wrap: anywhere; color: var(--muted); }
.rank-item strong { flex: 0 0 auto; }
.rank-item > i { display: block; height: 5px; margin-top: 6px; overflow: hidden; border-radius: 99px; background: #222a39; }
.rank-item b { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #9b72ff); }

.bar-chart { display: flex; align-items: flex-end; gap: 10px; min-height: 210px; padding: 16px 2px 2px; overflow-x: auto; }
.bar-column { display: grid; grid-template-rows: 24px 150px 22px; min-width: 74px; flex: 1 0 74px; align-items: end; text-align: center; }
.bar-column .bar-value { overflow: hidden; color: #b5bed1; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.bar-column > i { display: block; width: min(42px, 70%); min-height: 8px; margin: 0 auto; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, #8b76ff, #5d75ff); }
.bar-column > span { color: #718098; font-size: 10px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 10px 8px; border-bottom: 1px solid #1c2331; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; text-align: left; }
th { color: #718098; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
td { color: #dce1ec; }

.funnel { display: grid; grid-template-columns: minmax(130px, 1fr) auto minmax(130px, 1fr) auto minmax(130px, 1fr) auto minmax(130px, 1fr); align-items: stretch; gap: 10px; }
.funnel-step { display: flex; min-height: 128px; flex-direction: column; justify-content: center; padding: 16px; border: 1px solid #2a3450; border-radius: 14px; background: #121a2b; }
.funnel-step span, .funnel-step small { color: var(--muted); }
.funnel-step strong { margin: 3px 0; font-size: 28px; letter-spacing: -.04em; }
.funnel-step small { font-size: 10px; }
.funnel-step.disabled { opacity: .57; border-style: dashed; }
.funnel-arrow { align-self: center; color: #59647a; font-size: 20px; }

.mini-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mini-metrics > div { min-width: 0; padding: 15px; border: 1px solid #222b3d; border-radius: 13px; background: #0d121d; }
.mini-metrics strong { display: block; overflow-wrap: anywhere; font-size: 25px; }
.mini-metrics span { display: block; color: var(--muted); font-size: 10px; }
.button-link { display: inline-block; margin-top: 18px; }

.release-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 10px; }
.release-grid > div { padding: 14px; border: 1px solid #222b3d; border-radius: 13px; background: var(--panel-soft); }
.release-grid span, .release-grid small { display: block; color: var(--muted); }
.release-grid strong { display: block; margin: 3px 0; font-size: 24px; }
.release-grid small { font-size: 10px; }
.setup-panel { display: flex; min-height: 0; align-items: center; justify-content: space-between; gap: 24px; }
.setup-panel p { max-width: 820px; margin-bottom: 0; }
.setup-panel .rows { margin-top: 14px; }
.compact-copy { max-width: 850px; margin-bottom: 18px; }
.footnote { margin: 12px 0 0; color: #718098; font-size: 11px; }
.empty { margin: 0; padding: 16px 0; color: #718098; }
footer { padding: 10px 0 26px; color: #69758c; text-align: center; font-size: 12px; }

@media (max-width: 980px) {
  main { width: min(100% - 28px, 820px); padding-top: 30px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel { grid-template-columns: 1fr; }
  .funnel-arrow { transform: rotate(90deg); }
}

@media (max-width: 720px) {
  .grid, .sales-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .login-row, header, .section-heading, .setup-panel { align-items: stretch; flex-direction: column; }
  .section-heading { display: flex; }
  .section-heading > p { max-width: none; text-align: left; }
  .section-heading .status { align-self: flex-start; }
  .actions { margin-top: 10px; }
  .mini-metrics { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  main { width: min(100% - 20px, 440px); }
  .cards { grid-template-columns: 1fr; }
  .cards span { min-height: 0; }
  .login-card, .panel { padding: 19px; }
  .row { align-items: flex-start; }
}
