@font-face { font-family: 'Figtree'; font-weight: 400; font-display: swap; src: url('/assets/fonts/figtree-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; font-weight: 400; font-display: swap; src: url('/assets/fonts/figtree-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Figtree'; font-weight: 500; font-display: swap; src: url('/assets/fonts/figtree-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 600; font-display: swap; src: url('/assets/fonts/figtree-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 700; font-display: swap; src: url('/assets/fonts/figtree-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 700; font-display: swap; src: url('/assets/fonts/bricolage-grotesque-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 800; font-display: swap; src: url('/assets/fonts/bricolage-grotesque-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url('/assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }

:root {
  --navy: #0E1E3F;
  --navy-2: #1B2E55;
  --cream: #F6F3EC;
  --sand: #EDE6D4;
  --line: #DDD6C6;
  --line-2: #EAE4D6;
  --row: #F8F6F0;
  --bar: #F1ECDF;
  --gold: #E0A11B;
  --gold-text: #6B5212;
  --ink-2: #3E4A63;
  --ink-3: #5A6478;
  --ok: #1F7A4A;
  --bad: #A33A1F;
  --live: #2F8F5B;
  --white: #FFFFFF;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--cream); color: var(--navy); }
body { font: 15px/1.5 Figtree, system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--navy); }
a:hover { color: var(--navy-2); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
h1 { font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: -0.03em; }
h2 { font-size: 18px; font-weight: 700; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); left: 0; top: 0; white-space: nowrap; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--navy); background: var(--white); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--navy); }
.btn:hover { background: var(--row); }
.btn.primary { background: var(--navy); color: var(--cream); }
.btn.primary:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .seg button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field input, .field select, .field textarea { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid #C9C1AE; background: var(--white); }
.field textarea { padding: 12px 14px; resize: vertical; min-height: 96px; }
.field .hint { font-size: 13px; color: var(--ink-3); }
.error { color: var(--bad); font-weight: 600; font-size: 14px; }

.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--sand); border-radius: 12px; flex-wrap: wrap; }
.seg button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--white); }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.dark { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi .label { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.kpi .value { font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: -0.03em; line-height: 1.15; }
.delta { font-size: 13px; font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--ink-3); }

/* Layout */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; flex: 1 1 220px; max-width: 250px; background: var(--navy); color: var(--cream); padding: 24px 16px; display: flex; flex-direction: column; gap: 26px; }
.side a { color: inherit; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 8px; }
.brand span { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-title { padding: 0 10px 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #9FAAC2; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 10px; border-radius: 10px; text-decoration: none; color: #D5DBE7; }
.nav a:hover { background: rgba(255,255,255,.06); color: var(--cream); }
.nav a[aria-current="page"] { background: var(--navy-2); color: var(--cream); font-weight: 600; }
.nav a.add { color: #F3C257; font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: #9FAAC2; }
.side-foot button { background: none; border: 0; color: #D5DBE7; text-align: left; padding: 0 10px; min-height: 40px; cursor: pointer; border-radius: 10px; }
.side-foot button:hover { background: rgba(255,255,255,.06); }
.main { flex: 999 1 640px; min-width: 0; padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 22px; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.top .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); display: inline-block; flex: none; }
.dot.off { background: #9AA3B5; }
.live-pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(47,143,91,.5); } 50% { box-shadow: 0 0 0 6px rgba(47,143,91,0); } }
@media (prefers-reduced-motion: reduce) { .live-pulse { animation: none; } }

/* Live card */
.live { display: grid; grid-template-columns: minmax(160px, 220px) minmax(0, 1fr); gap: 20px; align-items: center; }
.live .big { font-family: var(--display); font-weight: 800; font-size: 56px; line-height: 1; letter-spacing: -0.03em; }
.live ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.live li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 8px; background: var(--navy-2); }
@media (max-width: 640px) { .live { grid-template-columns: 1fr; } }

/* Chart */
.chart { position: relative; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 240px; border-bottom: 1px solid var(--line); }
.bars .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 2px; position: relative; }
.bars .col:hover .seg-a, .bars .col:hover .seg-r { filter: brightness(1.15); }
.seg-r { background: var(--gold); border-radius: 3px 3px 0 0; }
.seg-a { background: var(--navy); }
.axis { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); margin-top: 8px; }
.legend { display: flex; gap: 18px; font-size: 14px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.tip { position: absolute; pointer-events: none; background: var(--navy); color: var(--cream); padding: 8px 12px; border-radius: 10px; font-size: 13px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; }

/* Tables */
.rows { display: flex; flex-direction: column; gap: 4px; }
.rowh { display: flex; justify-content: space-between; padding: 0 10px; font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.r { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; padding: 0 10px; border-radius: 8px; overflow: hidden; }
.r .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar); }
.r .n { position: relative; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.r .v { position: relative; font-weight: 700; display: flex; gap: 16px; }
.r .v span:nth-child(2) { color: var(--ink-3); font-weight: 500; min-width: 48px; text-align: right; }
.empty { padding: 18px 10px; color: var(--ink-3); font-size: 14px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; font-weight: 600; color: var(--ink-3); padding: 6px 10px; border-radius: 8px; cursor: pointer; min-height: 36px; }
.tabs button[aria-selected="true"] { background: var(--sand); color: var(--navy); }

table.t { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
table.t th { text-align: left; font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 0 12px; }
table.t td { background: var(--row); padding: 10px 12px; vertical-align: middle; }
table.t td:first-child { border-radius: 10px 0 0 10px; }
table.t td:last-child { border-radius: 0 10px 10px 0; }
.pill { padding: 4px 10px; border-radius: 999px; background: var(--sand); font-size: 13px; font-weight: 600; white-space: nowrap; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 28px; min-width: 90px; }
.spark span { flex: 1; max-width: 6px; border-radius: 2px; background: var(--navy); min-height: 1px; }
.scroll-x { overflow-x: auto; position: relative; }

/* Dark insight tiles */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.tile { background: var(--navy-2); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.tile .label { font-size: 14px; color: #C9D0DF; }
.tile .value { font-family: var(--display); font-weight: 800; font-size: 28px; }

/* Choice cards */
.choices { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.choice { text-align: left; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; background: var(--white); border: 1px solid var(--line); cursor: pointer; }
.choice[aria-pressed="true"] { background: var(--cream); border: 2px solid var(--navy); }
.choice strong { font-size: 16px; }
.choice span { font-size: 14px; color: var(--ink-2); }

.code { background: var(--navy); color: var(--cream); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.code code { font-family: var(--mono); font-size: 14px; white-space: pre-wrap; word-break: break-all; }
.code .small { color: #B9C2D6; }

.swatches { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--white); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--navy); }
.colorpick { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 6px; border-radius: 999px; border: 1px solid #C9C1AE; font-size: 14px; font-weight: 600; cursor: pointer; background: var(--white); }
.colorpick input { width: 32px; height: 32px; border: 0; padding: 0; background: transparent; cursor: pointer; }
.preview { width: 100%; height: 440px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.switch input { width: 22px; height: 22px; accent-color: var(--navy); }

/* Site icons */
.fav { position: relative; flex: none; width: 18px; height: 18px; border-radius: 5px; background: rgba(255,255,255,.14); color: #D5DBE7; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; overflow: hidden; }
.fav img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.fav.mid { width: 32px; height: 32px; border-radius: 8px; font-size: 15px; background: var(--sand); color: var(--navy); }
.fav.big { width: 30px; height: 30px; border-radius: 8px; font-size: 15px; font-family: Figtree, system-ui, sans-serif; letter-spacing: 0; background: var(--sand); color: var(--navy); }
.fav.mid img, .fav.big img { padding: 3px; }
.nav a .fav + .nm { flex: 1; }
.nav a { justify-content: flex-start; }
.nav a .dot { margin-left: auto; }
.with-fav { display: flex; align-items: center; gap: 12px; }
.card-site { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* Sidebar: folders, admin */
.nav .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a.nav-title-link { min-height: 36px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #9FAAC2; }
.nav a.nav-title-link[aria-current="page"] { color: var(--cream); background: var(--navy-2); }
.folder summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: 10px; cursor: pointer; color: #C9D0DF; font-weight: 600; list-style: none; }
.folder summary::-webkit-details-marker { display: none; }
.folder summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; flex: none; }
.folder[open] summary::before { transform: rotate(45deg); }
.folder summary .nm { flex: 1; }
.folder summary:hover { background: rgba(255,255,255,.06); }
.folder summary:focus-visible, .nav a:focus-visible, .sitetabs a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.folder > a { padding-left: 26px; }
.folder-empty { display: block; padding: 6px 10px 6px 26px; font-size: 13px; color: #8F9AB3; }
.count { font-size: 12px; font-weight: 700; color: #9FAAC2; background: rgba(255,255,255,.08); border-radius: 999px; padding: 1px 8px; }
.group-title .count { color: var(--ink-3); background: var(--sand); }
.side-foot a.admin-link { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 10px; text-decoration: none; color: #F3C257; font-weight: 600; font-size: 15px; }
.side-foot a.admin-link:hover { background: rgba(255,255,255,.06); }
.side-foot a.admin-link[aria-current="page"] { background: var(--navy-2); }
.side-foot a.who-link { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 10px; text-decoration: none; color: #D5DBE7; font-size: 15px; }
.side-foot a.who-link:hover { background: rgba(255,255,255,.06); }
.side-foot a.who-link[aria-current="page"] { background: var(--navy-2); color: var(--cream); }
.danger-zone { border-color: #E3B9AC; }
.del-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.side-foot .who { padding: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Site header with section tabs */
.sitehead { display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--line); margin: -4px 0 0; }
.sitehead-title { display: flex; flex-direction: column; gap: 2px; }
.sitetabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: -1px; }
.sitetabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; text-decoration: none; font-weight: 600; color: var(--ink-3); border-bottom: 3px solid transparent; }
.sitetabs a:hover { color: var(--navy); }
.sitetabs a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--gold); }

/* Period picker */
.periodbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.top.toolbar { align-items: center; }
.range, .inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.range input, .inline-form input { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid #C9C1AE; background: var(--white); }
.inline-form input:not([type=date]) { min-width: 220px; }

/* Folder groups on the sites page */
.group { display: flex; flex-direction: column; gap: 12px; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 44px; }
.group-title { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.group-actions { display: flex; gap: 4px; }

/* Admin */
.admin-t tbody tr { cursor: pointer; }
.admin-t tbody tr:hover td { background: var(--bar); }
.admin-t tbody tr:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.admin-t a { text-decoration: none; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-active { background: #E3F1E8; color: var(--ok); }
.s-trial { background: #FBF0D6; color: var(--gold-text); }
.s-expired { background: var(--sand); color: var(--ink-2); }
.s-suspended { background: #F6E1DA; color: var(--bad); }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .card { padding: 32px; }
.login form { width: min(400px, 100%); background: var(--white); border: 1px solid var(--line); border-radius: 24px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: var(--cream); padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 50; }
.notice { background: var(--sand); border-radius: 14px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }

@media (max-width: 720px) {
  .side { position: static; height: auto; max-width: none; flex-basis: 100%; padding: 14px 16px; gap: 12px; }
  .side .nav-title { display: none; }
  .side-foot { flex-direction: row; flex-wrap: wrap; align-items: center; margin-top: 0; }
  .side-foot > span { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 20px 16px 48px; }
}
