@font-face {
  font-family: "Founders Grotesk Web";
  src: url("/public/fonts/FoundersGroteskWeb-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Founders Grotesk Web";
  src: url("/public/fonts/FoundersGroteskWeb-Semibold.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}

:root {
  --ink: #292929;
  --paper: #f1f1f1;
  --line: rgba(41, 41, 41, 0.18);
  --muted: rgba(41, 41, 41, 0.58);
  --green: #186f3d;
  --orange: #9a5b00;
  --font: "Founders Grotesk Web", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font: 15px/1.4 var(--font); }
button, input, select { font: inherit; }
button, a { color: inherit; }
button { cursor: pointer; }
a { text-decoration: none; }
[hidden] { display: none !important; }

.login-gate { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); min-height: 100vh; }
.login-copy, .login-form { display: grid; align-content: center; padding: clamp(28px, 7vw, 110px); }
.login-copy { border-right: 1px solid var(--ink); }
.login-copy img { width: 112px; margin-bottom: 54px; }
.login-copy h1 { max-width: 720px; }
.login-copy > p:last-child { max-width: 460px; margin: 24px 0 0; color: var(--muted); }
.login-form { gap: 18px; }
.login-form label { display: grid; gap: 7px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.login-form input { min-height: 44px; border: 1px solid var(--line); border-radius: 0; padding: 9px 10px; background: transparent; }
.login-form input:focus { outline: 1px solid var(--ink); outline-offset: 1px; }
.form-message { min-height: 20px; margin: 0; color: #a70000; font-size: 12px; }

.app-shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-width: 0; min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; min-width: 0; gap: 30px; height: 100vh; padding: 24px 16px; border-right: 1px solid var(--ink); }
.brand-lockup { padding-bottom: 18px; border-bottom: 1px solid var(--ink); }
.brand-lockup img { width: 118px; height: auto; }
.brand-lockup p, .eyebrow, .muted-label, .status-dot, .page-foot, .period-control, .search-control { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.brand-lockup p { margin: 10px 0 0; color: var(--muted); }
.nav-list { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding: 7px 9px; border: 1px solid transparent; border-radius: 0; background: transparent; color: var(--ink); text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.nav-item:hover, .nav-item.is-active { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.nav-item span { opacity: .6; font-size: 9px; }
.sidebar-foot { display: grid; gap: 10px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.sidebar-foot a { border-bottom: 1px solid transparent; width: max-content; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.sidebar-foot a:hover { border-color: var(--ink); }
.status-dot { color: var(--muted); }
.status-dot i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--orange); }

.main-content { min-width: 0; padding: 24px clamp(18px, 4vw, 58px) 30px; }
.topbar { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--ink); }
.eyebrow { margin: 0 0 8px; color: var(--muted); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(32px, 4.6vw, 64px); line-height: .92; font-weight: 600; }
h2 { margin-bottom: 0; font-size: clamp(28px, 3.7vw, 52px); line-height: .94; font-weight: 600; }
h3 { margin-bottom: 0; font-size: 18px; line-height: 1; font-weight: 600; }
.topbar-actions { display: flex; align-items: end; gap: 12px; }
.period-control, .search-control { display: grid; gap: 5px; color: var(--muted); }
.period-control select, .search-control input { min-height: 38px; border: 1px solid var(--line); border-radius: 0; padding: 7px 10px; background: transparent; color: var(--ink); font-size: 13px; letter-spacing: 0; text-transform: none; }
.button { min-height: 40px; border: 1px solid var(--ink); border-radius: 999px; padding: 9px 16px; background: transparent; color: var(--ink); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.button:hover, .button-dark { background: var(--ink); color: var(--paper); }
.data-status { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-top: 18px; padding: 10px 12px; border-block: 1px solid var(--line); }
.data-status p, .data-status time { margin: 0; font-size: 12px; }
.data-status time { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.view { padding-top: 38px; }
.view[hidden] { display: none; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.section-heading .eyebrow { margin-bottom: 12px; }
.section-note { max-width: 420px; margin-bottom: 0; color: var(--muted); font-size: 13px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metrics-grid.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-panel, .panel { border: 1px solid var(--line); background: rgba(255,255,255,.34); }
.metric-panel { display: grid; min-height: 142px; align-content: space-between; gap: 12px; padding: 14px; }
.metric-panel > span, .metric-panel small { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.metric-panel strong { font-size: clamp(24px, 3vw, 40px); line-height: .9; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-panel small { letter-spacing: 0; text-transform: none; }
.positive { color: var(--green) !important; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 10px; margin-top: 10px; }
.panel { min-width: 0; padding: 16px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.panel-heading .eyebrow { margin-bottom: 8px; }
.legend, .panel-index, .muted-label { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.legend { display: flex; flex-wrap: wrap; justify-content: end; gap: 10px; align-items: center; }
.legend i { width: 9px; height: 9px; display: inline-block; }
.legend-sales { background: var(--ink); }
.legend-visitors { background: #8b9690; }
.chart-note { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.chart-wrap { display: grid; grid-template-columns: 48px minmax(0, 1fr); height: 220px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; padding: 3px 8px 3px 0; color: var(--muted); font-size: 10px; text-align: right; }
.chart-bars { display: grid; grid-template-columns: repeat(12, minmax(7px, 1fr)); align-items: end; gap: 8px; padding: 4px 0; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(33.33% - 1px), var(--line) 33.33%, var(--line) 33.33%); }
.bar-group { display: flex; align-items: end; justify-content: center; gap: 3px; height: 100%; }
.bar { display: block; width: min(13px, 42%); min-height: 4px; }
.bar.sales { background: var(--ink); }
.bar.visitors { background: #8b9690; opacity: .8; }
.chart-labels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; margin: 8px 0 0 48px; color: var(--muted); font-size: 9px; text-align: center; text-transform: uppercase; }
.insight-list, .rank-list, .device-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.insight-list li { display: grid; gap: 5px; padding: 14px 0; border-top: 1px solid var(--line); }
.insight-list li:first-child { padding-top: 0; border-top: 0; }
.insight-list strong { font-size: 14px; font-weight: 600; }
.insight-list span, .panel-copy { color: var(--muted); font-size: 13px; }
.table-panel { margin-top: 10px; }
.panel-heading a { border-bottom: 1px solid var(--ink); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.data-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 11px 8px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
td strong { font-weight: 600; }
.number { text-align: right; }
td.number { font-variant-numeric: tabular-nums; }
.rank-row, .device-row { display: grid; grid-template-columns: minmax(120px, .7fr) 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); font-size: 12px; }
.rank-row:first-child, .device-row:first-child { border-top: 0; }
.rank-bar { height: 8px; background: rgba(41,41,41,.08); }
.rank-bar i { display: block; height: 100%; background: var(--ink); }
.rank-row strong { font-variant-numeric: tabular-nums; }
.device-row { grid-template-columns: 90px 1fr auto; }
.device-row i { height: 8px; background: #8b9690; }
.funnel-panel { padding: 26px; }
.funnel-step { display: grid; grid-template-columns: 180px minmax(0, 1fr) 90px; gap: 18px; align-items: center; padding: 17px 0; border-top: 1px solid var(--line); }
.funnel-step:first-child { border-top: 0; }
.funnel-step span, .funnel-foot span { font-size: 12px; font-weight: 600; }
.funnel-track { height: 28px; background: rgba(41,41,41,.08); }
.funnel-track i { display: block; height: 100%; background: var(--ink); }
.funnel-step strong { text-align: right; font-size: 18px; font-variant-numeric: tabular-nums; }
.funnel-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--ink); }
.funnel-foot strong { font-size: 18px; }
.outcome-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.outcome-grid div { display: grid; gap: 5px; padding: 10px 0; border-top: 1px solid var(--line); }
.outcome-grid strong { font-size: 26px; line-height: 1; }
.outcome-grid span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.toolbar-row { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 22px; }
.rule-grid { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 0 14px; }
.rule-grid span, .rule-grid p { padding: 13px 0; border-top: 1px solid var(--line); }
.rule-grid span { color: var(--muted); font-size: 10px; font-weight: 700; }
.rule-grid p { margin: 0; font-size: 13px; }
.consent-grid { margin-top: 0; }
.consent-panel { display: grid; align-content: start; gap: 12px; }
.consent-panel .panel-heading { margin-bottom: 0; }
.consent-badge { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 800; }
.consent-badge.is-on { border-color: var(--green); color: var(--green); }
.consent-log { display: grid; gap: 0; }
.consent-log p { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 11px 0; border-top: 1px solid var(--line); font-size: 12px; }
.consent-log span { color: var(--muted); }
.data-model-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.data-model-card { display: grid; min-height: 262px; align-content: start; }
.data-model-card .panel-index { justify-self: end; }
.data-model-card .eyebrow { margin-top: 18px; }
.data-model-card h3 { font-size: 21px; }
.data-model-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: auto 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.data-model-card dt { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.data-model-card dd { margin: 4px 0 0; font-size: 15px; font-weight: 600; }
.data-stream-grid { grid-template-columns: minmax(0, 1.55fr) minmax(260px, .7fr); }
.health-list { display: grid; }
.health-list p { display: flex; justify-content: space-between; gap: 14px; margin: 0; padding: 12px 0; border-top: 1px solid var(--line); font-size: 12px; }
.health-list p:first-child { border-top: 0; padding-top: 0; }
.health-list span { color: var(--muted); text-align: right; }
.page-foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 38px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); width: 100%; }
  .sidebar { position: static; width: 100%; height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--ink); }
  .brand-lockup { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding-bottom: 12px; }
  .brand-lockup p { margin: 0; }
  .nav-list { display: flex; min-width: 0; overflow-x: auto; gap: 5px; overscroll-behavior-inline: contain; }
  .nav-item { flex: 0 0 auto; }
  .sidebar-foot { display: flex; flex-wrap: wrap; margin-top: 0; padding-top: 12px; }
  .main-content { padding: 20px 16px 24px; }
}

@media (max-width: 720px) {
  .login-gate { grid-template-columns: 1fr; }
  .login-copy { min-height: 44vh; border-right: 0; border-bottom: 1px solid var(--ink); }
  .login-copy img { margin-bottom: 32px; }
  .topbar, .section-heading, .toolbar-row { display: grid; align-items: start; }
  .topbar-actions { align-items: stretch; flex-direction: column; }
  .topbar-actions > * { width: 100%; }
  .data-status { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .data-status time { margin-top: 3px; }
  .metrics-grid, .metrics-grid.three-up, .split-grid { grid-template-columns: 1fr; }
  .data-model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-bars { gap: 3px; }
  .chart-labels { gap: 3px; }
  .funnel-step { grid-template-columns: 1fr 56px; gap: 8px; }
  .funnel-track { grid-column: 1 / -1; grid-row: 2; }
  .funnel-step strong { grid-column: 2; grid-row: 1; }
  .outcome-grid { grid-template-columns: repeat(2, 1fr); }
  .page-foot { display: grid; gap: 4px; }
  .data-model-grid { grid-template-columns: 1fr; }
}
