/* VA Analytics — one stylesheet, no build step. */
:root{
  --sb-bg:#173a64;--sb-bg2:#1f4a7c;--sb-line:rgba(255,255,255,.12);--sb-text:#e8eef6;--sb-muted:#a9bdd4;
  --accent:#2563c9;--accent-ink:#fff;--accent-soft:#e7effb;--accent-dark:#1b4c9c;
  --bg:#f4f6f9;--card:#fff;--line:#e3e7ec;--line2:#eef1f4;--text:#1d2330;--muted:#5a6472;
  --hover:#f3f5f8;--track:#eef1f4;--input-line:#c5ccd5;--hover-line:#c7ced7;--icon-hover:#e8ecf1;--kbd-bg:#f6f7f9;--chip-off:#eef0f3;--grid:#e8ebef;--grid0:#c3c8cf;--topbar:rgba(244,246,249,.92);--link:var(--accent);--link-hover:var(--accent-dark);
  --ok:#0f7a3a;--ok-bg:#e8f6ed;--warn:#7a4a00;--warn-bg:#fff4d6;--bad:#a8251b;--bad-bg:#fdecea;
  --radius:12px;--sb-w:264px;--font:"Inter","Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;
}
html[data-theme=orange]{--sb-bg:#3d1a0c;--sb-bg2:#58260f;--sb-muted:#e6c3ae;--sb-text:#fbeee6;--accent:#c2410c;--accent-soft:#fff0e6;--accent-dark:#9a3412}
html[data-theme=maroon]{--sb-bg:#4a1018;--sb-bg2:#62202a;--accent:#a3243b;--accent-soft:#fbe9ec;--accent-dark:#7e1a2d}
html[data-theme=forest]{--sb-bg:#163f2c;--sb-bg2:#1f5139;--accent:#1f7a4d;--accent-soft:#e6f4ec;--accent-dark:#175c3a}
html[data-theme=teal]{--sb-bg:#0f3f45;--sb-bg2:#17525a;--accent:#0f7c86;--accent-soft:#e3f4f5;--accent-dark:#0b5d64}
html[data-theme=purple]{--sb-bg:#34205a;--sb-bg2:#452c73;--accent:#6d43c4;--accent-soft:#efe9fb;--accent-dark:#53309a}
html[data-theme=indigo]{--sb-bg:#1e2560;--sb-bg2:#2a327a;--accent:#4450d6;--accent-soft:#eaecfc;--accent-dark:#323cb0}
html[data-theme=charcoal]{--sb-bg:#1f2329;--sb-bg2:#2e343c;--accent:#3466c4;--accent-soft:#e8effb;--accent-dark:#2d56a8}
html[data-theme=ocean]{--sb-bg:#0c3557;--sb-bg2:#134670;--accent:#0a6bb8;--accent-soft:#e3f1fb;--accent-dark:#09599a}
html[data-theme=brown]{--sb-bg:#3d2a1e;--sb-bg2:#523a2b;--accent:#a0602a;--accent-soft:#f8eee4;--accent-dark:#7c4a20}
html[data-theme=slate]{--sb-bg:#2f3b4b;--sb-bg2:#3e4c5f;--accent:#4a6fa5;--accent-soft:#eaf0f8;--accent-dark:#385683}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:var(--font);font-size:14px;line-height:1.5;color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased}
a{color:var(--link)}a:hover{color:var(--link-hover)}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
h1,h2,h3{margin:0;line-height:1.25}
svg{display:block}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.hidden{display:none!important}

/* ---------- Layout ---------- */
.app{display:flex;min-height:100vh}
.sidebar{width:var(--sb-w);flex:none;background:var(--sb-bg);color:var(--sb-text);display:flex;flex-direction:column;position:sticky;top:0;height:100vh;transition:width .18s ease;z-index:40}
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.content{padding:24px;max-width:1320px;width:100%;margin:0 auto;display:flex;flex-direction:column;gap:20px}

/* Sidebar header */
.sb-head{display:flex;align-items:center;gap:10px;padding:18px 16px 12px}
.sb-logo{width:40px;height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex:none;overflow:hidden}
.sb-logo img{width:40px;height:40px;display:block}
.sb-brand{min-width:0;flex:1}
.sb-brand b{display:block;font-size:16px;color:#fff;letter-spacing:.2px}
.sb-brand span{display:block;font-size:12px;color:var(--sb-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.icon-btn{width:38px;height:38px;border-radius:9px;border:0;background:transparent;color:inherit;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;flex:none}
.sidebar .icon-btn:hover{background:var(--sb-bg2)}
.sb-switch{margin:4px 12px 10px;position:relative}
.sb-switch summary{list-style:none;display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:12px;background:var(--sb-bg2);border:1px solid var(--sb-line);cursor:pointer}
.sb-switch summary::-webkit-details-marker{display:none}
.sb-switch .sw-ico{width:34px;height:34px;border-radius:8px;background:rgba(255,255,255,.12);display:flex;align-items:center;justify-content:center;flex:none}
.sb-switch .sw-text{min-width:0;flex:1}
.sb-switch .sw-text b{display:block;font-size:14px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sb-switch .sw-text span{display:block;font-size:12px;color:var(--sb-muted)}
.sb-switch .menu{position:absolute;left:0;right:0;top:calc(100% + 6px);background:var(--card);color:var(--text);border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,.22);padding:6px;z-index:60;max-height:320px;overflow:auto}
.sb-switch .menu a{display:flex;align-items:center;gap:8px;padding:9px 10px;border-radius:8px;color:var(--text);text-decoration:none;font-size:14px}
.sb-switch .menu a:hover,.sb-switch .menu a[aria-current=true]{background:var(--accent-soft);color:var(--accent-dark)}
.sb-switch .menu .dot{width:8px;height:8px;border-radius:50%;background:#1a9a52;flex:none}
.sb-switch .menu .dot.off{background:#b7bec8}

/* Sidebar nav */
.sb-nav{flex:1;overflow-y:auto;padding:4px 12px 12px;display:flex;flex-direction:column;gap:2px}
.sb-label{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--sb-muted);padding:14px 10px 6px}
.sb-link,.sb-group>summary{display:flex;align-items:center;gap:12px;min-height:44px;padding:0 12px;border-radius:10px;color:var(--sb-text);text-decoration:none;font-weight:500;cursor:pointer;position:relative;list-style:none}
.sb-group>summary::-webkit-details-marker{display:none}
.sb-link:hover,.sb-group>summary:hover{background:rgba(255,255,255,.07);color:#fff}
.sb-link.active{background:var(--sb-bg2);color:#fff;font-weight:600}
.sb-link.active::before{content:"";position:absolute;left:-12px;top:10px;bottom:10px;width:3px;border-radius:0 3px 3px 0;background:#fff}
.sb-link svg,.sb-group>summary svg{flex:none;opacity:.95}
.sb-link .txt,.sb-group>summary .txt{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sb-group>summary .chev{transition:transform .15s}
.sb-group[open]>summary .chev{transform:rotate(180deg)}
.sb-sub{margin:2px 0 6px 22px;padding-left:12px;border-left:1px solid var(--sb-line);display:flex;flex-direction:column;gap:2px}
.sb-sub a{display:flex;align-items:center;min-height:38px;padding:0 12px;border-radius:8px;color:var(--sb-muted);text-decoration:none;font-size:14px;position:relative}
.sb-sub a:hover{color:#fff;background:rgba(255,255,255,.07)}
.sb-sub a.active{color:#fff;font-weight:600;background:var(--sb-bg2)}
.sb-sub a.active::before{content:"";position:absolute;left:-13px;top:8px;bottom:8px;width:3px;border-radius:3px;background:#fff}
.badge{min-width:22px;height:22px;padding:0 7px;border-radius:999px;font-size:12px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;background:#d64545;color:#fff}
.sb-foot{padding:10px 12px 14px;border-top:1px solid var(--sb-line);display:flex;flex-direction:column;gap:2px}
.sb-user{display:flex;align-items:center;gap:10px;padding:8px 12px;color:var(--sb-muted);font-size:13px}
.sb-user form{margin-left:auto}
.sb-user button{background:none;border:0;color:#fff;font-weight:600;cursor:pointer;padding:6px 4px}

/* Collapsed sidebar */
html.sb-collapsed .sidebar{width:76px}
html.sb-collapsed .sb-brand,html.sb-collapsed .sb-switch .sw-text,html.sb-collapsed .sb-switch summary .chev,
html.sb-collapsed .sb-link .txt,html.sb-collapsed .sb-group>summary .txt,html.sb-collapsed .sb-group>summary .chev,
html.sb-collapsed .sb-sub,html.sb-collapsed .sb-label,html.sb-collapsed .sb-user .who{display:none}
html.sb-collapsed .sb-head{flex-direction:column;padding:14px 8px}
html.sb-collapsed .sb-switch{margin:4px 10px 10px}
html.sb-collapsed .sb-switch summary{justify-content:center;padding:8px}
html.sb-collapsed .sb-nav,html.sb-collapsed .sb-foot{padding-left:10px;padding-right:10px}
html.sb-collapsed .sb-link,html.sb-collapsed .sb-group>summary{justify-content:center;padding:0}
html.sb-collapsed .sb-user{justify-content:center;padding:6px 0}
html.sb-collapsed .sb-user form{margin:0}

/* Top bar */
.topbar{position:sticky;top:0;z-index:30;display:flex;align-items:center;gap:12px;padding:12px 24px;background:var(--topbar);backdrop-filter:blur(6px);border-bottom:1px solid var(--line)}
.topbar .icon-btn{color:var(--muted)}
.topbar .icon-btn:hover{background:var(--icon-hover);color:var(--text)}
.menu-btn{display:none}
.crumbs{display:flex;align-items:center;gap:6px;min-width:0;flex:1;font-size:14px;color:var(--muted)}
.crumbs a{color:var(--muted);text-decoration:none;display:inline-flex;align-items:center}
.crumbs a:hover{color:var(--text)}
.crumbs .sep{color:#a0a8b3}
.crumbs .here{color:var(--text);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search{position:relative;width:min(360px,34vw)}
.search input{width:100%;height:42px;border:1px solid var(--line);border-radius:12px;background:var(--card);color:var(--text);padding:0 64px 0 38px}
.search .s-ico{position:absolute;left:12px;top:12px;color:var(--muted)}
.search kbd{position:absolute;right:10px;top:9px;font-family:ui-monospace,Menlo,monospace;font-size:12px;color:var(--muted);border:1px solid var(--line);border-radius:6px;padding:1px 6px;background:var(--kbd-bg)}
.search .results{position:absolute;left:0;right:0;top:48px;background:var(--card);border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 32px rgba(15,23,42,.14);padding:6px;max-height:360px;overflow:auto}
.search .results a{display:flex;justify-content:space-between;gap:10px;padding:9px 10px;border-radius:8px;color:var(--text);text-decoration:none}
.search .results a:hover,.search .results a.sel{background:var(--accent-soft)}
.search .results small{color:var(--muted)}
.pill{display:inline-flex;align-items:center;gap:8px;height:40px;padding:0 14px;border-radius:999px;border:1px solid var(--line);background:var(--card);font-size:13px;font-weight:600;white-space:nowrap;text-decoration:none;color:var(--text)}
.pill .dot{width:8px;height:8px;border-radius:50%;background:#1a9a52}
.pill.warn .dot{background:#d48a00}

/* Page header + sub tabs */
.page-head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px}
.page-head h1{font-size:24px;font-weight:700}
.page-head p{margin:4px 0 0;color:var(--muted)}
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);overflow-x:auto;scrollbar-width:none}
.tabs a{padding:10px 14px;color:var(--muted);text-decoration:none;font-weight:500;border-bottom:3px solid transparent;white-space:nowrap}
.tabs a:hover{color:var(--text)}
.tabs a.active{color:var(--accent);border-bottom-color:var(--accent);font-weight:600}
.toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px}

/* Cards */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:20px}
.card h2{font-size:16px;font-weight:600}
.card .sub{margin:4px 0 0;color:var(--muted);font-size:13px}
.card-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:14px}
.grid{display:grid;gap:16px}
.grid.kpis{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
.grid.two{grid-template-columns:repeat(auto-fit,minmax(min(100%,460px),1fr))}
.grid.three{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))}
.kpi{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:16px}
.kpi .k-label{font-size:13px;color:var(--muted)}
.kpi .k-value{font-size:26px;font-weight:700;margin-top:4px}
.kpi .k-delta{font-size:12px;font-weight:600;margin-top:2px;color:var(--muted)}
.kpi .k-delta.up{color:var(--ok)}.kpi .k-delta.down{color:var(--bad)}
.kpi svg{margin-top:8px}

/* Buttons + forms */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:42px;padding:0 16px;border-radius:10px;border:1px solid var(--line);background:var(--card);color:var(--text);font-weight:600;text-decoration:none;cursor:pointer;white-space:nowrap}
.btn:hover{border-color:var(--hover-line);color:var(--text)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn.primary:hover{background:var(--accent-dark);color:#fff}
.btn.danger{color:var(--bad);border-color:#f0b9b3}
.btn.small{min-height:34px;padding:0 12px;font-size:13px}
.btn[disabled]{opacity:.55;cursor:not-allowed}
.field{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}
.field label,.field .lbl{font-weight:600;font-size:13px}
.field .help{font-size:12px;color:var(--muted)}
.input,select.input,textarea.input{width:100%;min-height:44px;border:1px solid var(--input-line);border-radius:10px;padding:10px 12px;background:var(--card);color:var(--text)}
textarea.input{min-height:96px;resize:vertical}
.input:focus{border-color:var(--accent);outline:none;box-shadow:0 0 0 3px var(--accent-soft)}
.form-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));gap:0 16px}
.check{display:flex;gap:10px;align-items:flex-start;margin-bottom:12px}
.check input{width:18px;height:18px;margin:2px 0 0}
.error-text{color:var(--bad);font-size:13px;font-weight:500}
.alert{padding:12px 16px;border-radius:10px;font-weight:500;border:1px solid}
.alert.ok{background:var(--ok-bg);color:var(--ok);border-color:#b9e2c8}
.alert.err{background:var(--bad-bg);color:var(--bad);border-color:#f3c0ba}
.alert.warn{background:var(--warn-bg);color:var(--warn);border-color:#f0c36d}
.code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:13px;background:#1d2330;color:#e7ebf1;border-radius:10px;padding:14px;overflow-x:auto;white-space:pre;margin:0}
.chip{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap}
.chip.ok{background:var(--ok-bg);color:var(--ok)}.chip.warn{background:var(--warn-bg);color:var(--warn)}.chip.bad{background:var(--bad-bg);color:var(--bad)}.chip.off{background:var(--chip-off);color:var(--muted)}

/* Tables */
.table-wrap{overflow-x:auto}
table.t{width:100%;border-collapse:collapse;font-size:14px}
table.t th{text-align:left;font-size:12px;font-weight:600;color:var(--muted);padding:10px 8px;border-bottom:1px solid var(--line);white-space:nowrap}
table.t td{padding:10px 8px;border-bottom:1px solid var(--line2);vertical-align:middle}
table.t .num{text-align:right;font-variant-numeric:tabular-nums}
table.t .trunc{max-width:340px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.empty{padding:28px;text-align:center;color:var(--muted)}

/* Charts */
.chart{width:100%}
.legend{display:flex;flex-wrap:wrap;gap:12px;font-size:13px;margin-top:10px}
.legend span{display:inline-flex;align-items:center;gap:6px}
.legend i{width:12px;height:12px;border-radius:3px;display:inline-block}
.bars{display:flex;flex-direction:column;gap:10px}
.bar-row{display:grid;grid-template-columns:minmax(90px,170px) minmax(0,1fr) 72px;align-items:center;gap:10px;font-size:13px}
.bar-row .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bar-track{height:8px;border-radius:4px;background:var(--track);overflow:hidden;display:flex}
.bar-fill{height:100%;border-radius:4px;background:var(--accent)}
.bar-row .val{text-align:right;font-weight:600;font-variant-numeric:tabular-nums}
.donut-wrap{display:flex;flex-wrap:wrap;align-items:center;gap:20px}
.donut-legend{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px;font-size:13px;flex:1;min-width:150px}
.donut-legend li{display:flex;align-items:center;gap:8px}
.donut-legend li span:nth-child(2){flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.heat{overflow-x:auto}
.heat-grid{min-width:600px;display:grid;grid-template-columns:40px repeat(24,minmax(0,1fr));gap:3px;font-size:11px;color:var(--muted)}
.heat-cell{height:20px;border-radius:3px;background:var(--accent)}
.tip{position:fixed;z-index:100;pointer-events:none;background:#1d2330;color:#fff;font-size:12px;padding:6px 9px;border-radius:7px;white-space:nowrap}
.loading{color:var(--muted);padding:20px 0}
.site-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:16px}
.site-card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:18px;display:flex;flex-direction:column;gap:10px}
.site-card h3{font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.site-card .row{display:flex;justify-content:space-between;gap:8px;align-items:center}
.stats3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.stats3 small{display:block;color:var(--muted);font-size:12px}
.stats3 b{font-size:18px}

/* Date range picker */
.dr{position:relative}
.dr-pop{position:absolute;top:48px;left:0;z-index:50;width:740px;max-width:calc(100vw - 32px);background:var(--card);border:1px solid var(--line);border-radius:14px;box-shadow:0 16px 40px rgba(15,23,42,.18);display:flex;flex-direction:column}
.dr-body{display:flex;flex-wrap:wrap}
.dr-presets{flex:1 1 160px;padding:12px;border-right:1px solid var(--line);display:flex;flex-direction:column;gap:2px}
.dr-presets button{text-align:left;min-height:38px;padding:0 12px;border:0;border-radius:8px;background:none;cursor:pointer;font-weight:500}
.dr-presets button:hover{background:var(--hover)}
.dr-presets button.on{background:var(--accent-soft);color:var(--accent-dark);font-weight:600}
.dr-months{flex:999 1 460px;min-width:0;padding:16px;display:flex;flex-wrap:wrap;gap:24px}
.dr-month{flex:1 1 230px;min-width:0}
.dr-mh{display:flex;align-items:center;justify-content:space-between;height:36px;font-weight:700}
.dr-mh button{width:36px;height:36px;border:0;background:none;border-radius:8px;cursor:pointer;font-size:18px}
.dr-mh button:hover{background:var(--hover)}
.dr-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;margin-top:6px}
.dr-grid .wd{text-align:center;font-size:12px;font-weight:600;color:var(--muted);padding:4px 0}
.dr-grid button{height:40px;border:0;border-radius:8px;background:none;cursor:pointer;font-size:14px}
.dr-grid button:hover:not([disabled]){background:var(--hover)}
.dr-grid button.in{background:var(--accent-soft)}
.dr-grid button.end{background:var(--accent);color:#fff;font-weight:700}
.dr-grid button.today{text-decoration:underline;font-weight:700}
.dr-grid button[disabled]{color:#b0b6bf;cursor:default}
.dr-foot{border-top:1px solid var(--line);padding:12px 16px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px}
.dr-foot .hint{color:var(--muted);font-size:13px}

/* Settings layout */
.settings{display:flex;flex-wrap:wrap;gap:20px;align-items:flex-start}
.settings-nav{flex:1 1 240px;max-width:300px;background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:12px}
.settings-nav .grp{font-size:11.5px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--accent);padding:14px 12px 6px;margin-top:6px;display:flex;align-items:center;gap:8px;border-top:1px solid var(--line2)}
.settings-nav .grp::before{content:"";width:4px;height:14px;border-radius:2px;background:var(--accent)}
.settings-nav .grp:first-child{border-top:0;margin-top:0}
html.dark .settings-nav .grp{color:var(--link)}
.settings-nav a{display:flex;align-items:center;gap:10px;min-height:44px;padding:0 12px;border-radius:10px;color:var(--text);text-decoration:none;font-weight:500}
.settings-nav a:hover{background:var(--hover)}
.settings-nav a.active{background:var(--accent);color:var(--accent-ink);font-weight:600}
.settings-body{flex:999 1 560px;min-width:0;display:flex;flex-direction:column;gap:20px}
.theme-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
.theme-opt{border:2px solid var(--line);border-radius:12px;padding:10px;background:var(--card);color:var(--text);cursor:pointer;text-align:left;display:flex;flex-direction:column;gap:8px;font-weight:600}
.theme-opt.on{border-color:var(--accent)}
.theme-opt .sw{height:54px;border-radius:8px;display:flex;overflow:hidden}
.theme-opt .sw i{flex:1}

/* Guest pages */
.guest{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;padding:40px 16px}
.guest-brand{display:flex;align-items:center;gap:10px;font-size:20px;font-weight:700;color:var(--text)}
.guest-brand img{width:min(300px,80vw);height:auto;display:block}
.guest-card{width:100%;max-width:420px;background:#fff;border:1px solid var(--line);border-radius:16px;padding:32px 28px;box-shadow:0 8px 28px rgba(15,23,42,.06)}
.guest-card.wide{max-width:560px}
.guest-card h2{font-size:22px;margin-bottom:6px}
.guest-card .lead{margin:0 0 20px;color:var(--muted)}
.guest-foot{font-size:12px;color:var(--muted);text-align:center;max-width:420px}

/* Modal */
.modal{position:fixed;inset:0;z-index:90;background:rgba(15,23,42,.45);display:flex;align-items:center;justify-content:center;padding:16px}
.modal .box{background:var(--card);color:var(--text);border-radius:14px;max-width:440px;width:100%;padding:24px}

/* Mobile */
.overlay{display:none}
@media (max-width:900px){
  .sidebar{position:fixed;left:0;top:0;bottom:0;transform:translateX(-100%);transition:transform .2s ease;width:var(--sb-w)!important}
  html.sb-open .sidebar{transform:none}
  html.sb-open .overlay{display:block;position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:35}
  html.sb-collapsed .sb-brand,html.sb-collapsed .sb-link .txt,html.sb-collapsed .sb-group>summary .txt,html.sb-collapsed .sb-sub,html.sb-collapsed .sb-label,html.sb-collapsed .sb-switch .sw-text{display:revert}
  .collapse-btn{display:none!important}
  .menu-btn{display:inline-flex}
  .topbar{padding:10px 16px}
  .search{display:none}
  .content{padding:16px}
  .back-btn{display:none!important}
}
@media (max-width:560px){.pill .txt{display:none}.pill{padding:0 12px}}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}

/* ---------- V2 ---------- */
.stack{display:flex;flex-direction:column;gap:20px}
.stack > :empty{display:none}
.grid.two > *,.grid.three > *{min-width:0}
/* One navigation per level: on wide screens the left menu already shows these sub-tabs. */
@media (min-width:1025px){.page-tabs{display:none}}
.inline-edit{display:inline-block;position:relative;text-align:left}
.inline-edit > summary{list-style:none;cursor:pointer}
.inline-edit > summary::-webkit-details-marker{display:none}
.edit-pop{position:absolute;right:0;top:calc(100% + 6px);z-index:20;width:300px;max-width:calc(100vw - 48px);background:var(--card);border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 32px rgba(15,23,42,.16);padding:16px;white-space:normal}
.site-checks{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:0 16px}
.site-checks .check{margin-bottom:8px}
.journey{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.journey .step{font-size:13px;padding:4px 10px;border-radius:6px;background:var(--hover);border:1px solid var(--line2);max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.journey .step.goal{background:var(--ok-bg);color:var(--ok);border-color:#b9e2c8;font-weight:600}
.journey .step.left{background:var(--bad-bg);color:var(--bad);border-color:#f3c0ba;font-weight:600}
.journey .arrow{color:#8a929c}
.j-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(120px,220px) 64px;gap:12px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line2)}
.j-row:last-child{border-bottom:0}
.funnel{display:flex;flex-direction:column;gap:12px}
.funnel .f-row{display:flex;flex-direction:column;gap:6px}
.funnel .f-top{display:flex;justify-content:space-between;gap:10px;font-size:14px}
.funnel .f-bar{height:28px;border-radius:6px;background:var(--accent);min-width:4px}
.scroll-row{display:grid;grid-template-columns:minmax(120px,260px) minmax(0,1fr) 64px;gap:12px;align-items:center;font-size:13px;padding:6px 0}
.scroll-track{display:flex;height:22px;border-radius:5px;overflow:hidden;background:var(--track)}
.scroll-track > div{height:100%}
.cohort td.c{text-align:center;font-weight:600;border-radius:4px}
.kpi.warn .k-value{color:var(--bad)}
@media (max-width:560px){.j-row{grid-template-columns:1fr}.scroll-row{grid-template-columns:1fr}}

/* Rows of boxes never leave an empty slot: the last boxes in a row grow to fill it. */
.grid.kpis,.grid.three,.site-cards,.theme-grid{display:flex;flex-wrap:wrap}
.grid.kpis > *{flex:1 1 170px;min-width:0}
.grid.three > *{flex:1 1 300px;min-width:0}
.site-cards > *{flex:1 1 280px;min-width:0}
.theme-grid > *{flex:1 1 150px;min-width:0}
/* Long addresses and file paths wrap instead of pushing the page sideways. */
code{overflow-wrap:anywhere;word-break:break-word}
/* Side-by-side boxes are the same height; a chart with little data sits in the middle of its box instead of leaving a blank bottom. */
.grid.two > .card{display:flex;flex-direction:column}
.grid.two > .card > [data-slot]{flex:1;display:flex;flex-direction:column;justify-content:center}
.grid.two > .card > [data-slot] > .table-wrap{align-self:stretch}
/* Install label may wrap to two lines instead of being cut. */
#installBtn .txt{white-space:normal;line-height:1.25}
/* Phones: breadcrumb shows only where you are. */
@media (max-width:560px){
  .crumbs > a:not(:first-child),.crumbs > .sep{display:none}
  .crumbs > .sep:last-of-type{display:inline}
  .j-row{grid-template-columns:minmax(0,1fr) 48px}
  .j-row .journey{grid-column:1/-1}
}
.crumbs a,.crumbs .here{white-space:nowrap}
@media (max-width:900px){.settings-nav{max-width:none}}

/* Red "update waiting" ribbon (shown after a new ZIP is uploaded, gone after the button is clicked) */
.update-ribbon{display:flex;flex-wrap:wrap;gap:10px 16px;align-items:center;justify-content:space-between;background:#b42318;color:#fff;border-radius:12px;padding:12px 16px;box-shadow:0 2px 10px rgba(180,35,24,.25)}
.update-ribbon .ur-text{line-height:1.5;min-width:0;overflow-wrap:anywhere}
.update-ribbon form{margin:0}
.update-ribbon .ur-btn{background:#fff;color:#b42318;border-color:#fff;font-weight:700;white-space:normal}
.btn.ur-btn{background:#b42318;color:#fff;border-color:#b42318;font-weight:700}
.update-ribbon .btn.ur-btn{background:#fff;color:#b42318;border-color:#fff}
.update-card.is-due{border-color:#f3c0ba;box-shadow:inset 4px 0 0 #b42318}
.sb-link .sb-update{margin-left:auto;background:#d64545}
.sb-collapsed .sb-link .sb-update{position:absolute;top:4px;right:6px;min-width:16px;height:16px;font-size:10px;padding:0 4px}
@media (max-width:600px){.update-ribbon form,.update-ribbon .ur-btn{width:100%}}

/* "My Websites" menu: one line per website with a status dot */
.sb-mysites .sb-count{margin-left:auto;font-size:12px;font-weight:600;color:var(--sb-muted);background:rgba(255,255,255,.1);border-radius:999px;padding:1px 8px}
.sb-mysites .sb-count+.chev{margin-left:6px}
.sb-sub a .sname{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sb-sub a .sdot{width:8px;height:8px;border-radius:50%;flex:none;margin-right:10px;background:#3ccf7a}
.sb-sub a .sdot.warn{background:#f5b342}.sb-sub a .sdot.off{background:#8a8f98}
.sb-sub a.sb-order{font-size:13px;opacity:.85}
/* Change order page */
.order-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.order-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;padding:12px 4px;border-bottom:1px solid var(--line2);scroll-margin-top:90px}
.order-row:last-child{border-bottom:0}
.order-row:target{background:var(--accent-soft);border-radius:10px}
.order-num{width:30px;height:30px;border-radius:50%;background:var(--accent-soft);color:var(--accent-dark);font-weight:700;display:flex;align-items:center;justify-content:center;flex:none}
.order-name{flex:1;min-width:180px}
.order-name b{display:block}.order-name span{color:var(--muted);font-size:13px;overflow-wrap:anywhere}
.order-btns{display:flex;flex-wrap:wrap;gap:6px}
.order-btns form{margin:0}
.order-btns .btn[disabled]{opacity:.4;cursor:default}
@media (max-width:600px){.order-btns{width:100%}.order-btns form{flex:1}.order-btns .btn{width:100%}}

/* Dark mode (moon icon at the top right). The sidebar is already dark in every theme. */
.mode-btn .i-sun{display:none}
html.dark .mode-btn .i-sun{display:block}html.dark .mode-btn .i-moon{display:none}
html.dark{color-scheme:dark;
  --bg:#121417;--card:#1b1e23;--line:#2d3139;--line2:#252930;--text:#e6e8ec;--muted:#a3abb7;
  --hover:#252930;--track:#2a2e35;--input-line:#3d424b;--hover-line:#4b515b;--icon-hover:#262a31;--kbd-bg:#22262c;--chip-off:#2a2e35;--grid:#2a2e35;--grid0:#4b515b;--topbar:rgba(18,20,23,.92);
  --ok:#5fd08b;--ok-bg:#16301f;--warn:#f2c46b;--warn-bg:#352a10;--bad:#ff9b91;--bad-bg:#3a1b18;
  --accent-soft:color-mix(in srgb,var(--accent) 24%,#1b1e23);
  --link:color-mix(in srgb,var(--accent) 55%,#ffffff);--link-hover:color-mix(in srgb,var(--accent) 35%,#ffffff)}
html.dark .alert{border-color:var(--line)}
html.dark .tabs a.active{color:var(--link);border-bottom-color:var(--link)}
html.dark .order-num{color:var(--link)}
html.dark .update-card.is-due{border-color:#5a2a25}
html.dark .shadow,html.dark .card{box-shadow:none}

/* Notifications: bell at the top right, popup with X, and the Notifications page */
.notes-wrap{position:relative}
.bell-btn{position:relative}
.bell-count{position:absolute;top:2px;right:0;min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:#d64545;color:#fff;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;line-height:1}
.notes-pop{position:absolute;right:0;top:calc(100% + 8px);z-index:70;width:400px;max-width:calc(100vw - 24px);background:var(--card);color:var(--text);border:1px solid var(--line);border-radius:14px;box-shadow:0 16px 40px rgba(15,23,42,.2);display:flex;flex-direction:column;max-height:min(560px,calc(100vh - 90px))}
.notes-pop.hidden{display:none}
.notes-head{display:flex;align-items:center;justify-content:space-between;padding:10px 10px 10px 16px;border-bottom:1px solid var(--line2)}
.notes-head b{font-size:16px}
.notes-scroll{overflow-y:auto;padding:4px 12px 8px}
.notes-grp{font-size:11.5px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--accent);padding:12px 4px 4px}
html.dark .notes-grp{color:var(--link)}
.notes-all{display:block;text-align:center;padding:12px;border-top:1px solid var(--line2);font-weight:600;text-decoration:none}
.note-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.note{display:flex;gap:12px;align-items:flex-start;padding:12px 4px;border-bottom:1px solid var(--line2)}
.note:last-child{border-bottom:0}
.note-dot{width:10px;height:10px;border-radius:50%;margin-top:6px;flex:none;background:var(--muted)}
.note.danger .note-dot{background:#d64545}.note.warning .note-dot{background:#e0a020}.note.info .note-dot{background:var(--accent)}
.note-body{flex:1;min-width:0}
.note-body b{display:block;font-size:14px}
.note-body p{margin:3px 0 0;color:var(--muted);font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.note-body .note-names{color:var(--text)}
.note .btn{flex:none}
.note-list.compact .note .btn{min-height:34px;padding:0 10px;font-size:13px}
@media (max-width:600px){.notes-pop{position:fixed;left:12px;right:12px;top:64px;width:auto}.note{flex-wrap:wrap}.note .btn{margin-left:22px}}
