:root {
  color-scheme: dark;
  --background: #101015;
  --sidebar: #14141a;
  --surface: #19191f;
  --line: #2a2933;
  --text: #eeedf2;
  --muted: #a29fae;
  --quiet: #838092;
  --lime: #c9f675;
  --pink: #fb8ccc;
  --violet: #bba6ff;
  --mono: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  --sans: "Inter", system-ui, sans-serif;
  font-family: var(--sans);
  background: var(--background);
  color: var(--text);
  font-size: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
svg { flex-shrink: 0; vertical-align: middle; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 14px; left: 15px; z-index: 5; padding: 12px; color: var(--background); background: var(--lime); border-radius: 6px; }

.layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; min-width: 0; height: 100vh; display: flex; flex-direction: column; padding: 29px 17px 20px; background: var(--sidebar); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; align-self: flex-start; margin: 0 0 40px 8px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: var(--lime); background: #252b1f; border: 1px solid #3c4a2b; border-radius: 12px; }
.brand-mark svg { width: 27px; height: 27px; }
.brand strong, .mobile-brand { display: block; font-size: 22px; font-weight: 800; line-height: 1; letter-spacing: -.055em; }
.brand-dot { color: var(--lime); }
.brand small, .sidebar-footer small { display: block; margin-top: 5px; color: var(--quiet); font-size: 11px; }
#navigation { display: grid; gap: 5px; }
#navigation a { display: flex; gap: 12px; align-items: center; padding: 11px 12px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); font-weight: 600; }
#navigation a:hover { color: var(--text); background: #1d1d25; }
#navigation a[aria-current] { color: var(--lime); background: #252a20; border-color: #39442b; }
#navigation a svg { width: 17px; height: 17px; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 13px 11px; border-top: 1px solid var(--line); font-size: 12px; }
.sidebar-pulse, .demo-badge i, .status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.sidebar-pulse { color: var(--pink); box-shadow: 0 0 12px #fb8ccc77; }
.mobile-brand { display: none; }

main { min-width: 0; outline: none; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 82px; padding: 0 clamp(20px, 3.2vw, 46px); border-bottom: 1px solid var(--line); }
.page-header h1 { font-size: 21px; letter-spacing: -.04em; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.demo-badge { display: inline-flex; gap: 7px; align-items: center; color: #e8acd5; border: 1px solid #54394c; background: #2c202b; border-radius: 999px; padding: 6px 9px; font-size: 11px; white-space: nowrap; }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 12px; white-space: nowrap; }
.button:hover { background: #282833; border-color: #555161; }
.button.primary { color: #161a13; background: var(--lime); border-color: var(--lime); }
.button.primary:hover { background: #ddffa3; border-color: #ddffa3; }
.page-content { display: grid; gap: 18px; max-width: 1450px; margin: 0 auto; padding: 26px clamp(20px, 3.2vw, 46px) 46px; }

.hero { isolation: isolate; overflow: hidden; position: relative; min-height: 222px; display: flex; align-items: center; border-radius: 13px; border: 1px solid #493144; background: #1d1421; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -2; background-image: linear-gradient(#e68ac00b 1px, transparent 1px), linear-gradient(90deg, #e68ac00b 1px, transparent 1px), radial-gradient(ellipse at 68% 45%, #3c1e38, #1d1421 69%); background-size: 27px 27px, 27px 27px, auto; }
.hero-art { position: absolute; inset: 0 0 0 37%; z-index: -1; background-image: linear-gradient(90deg, #1d1421, transparent 28%), url("./assets/hero.webp"); background-size: cover; background-position: center, 67% 51%; mask-image: linear-gradient(90deg, transparent 1%, #000 23%); opacity: .87; }
.hero-content { width: 100%; padding: 22px clamp(20px, 3.2vw, 39px); }
.hero h2 { margin: 11px 0 4px; font-size: clamp(32px, 4.3vw, 58px); letter-spacing: -.074em; font-weight: 780; line-height: 1.07; }
.hero p { color: #baadbf; font-size: 13px; }
.hero p span { padding: 0 2px; color: #ee8ac5; }
.hero-button { margin-top: 20px; color: #f6c3e6; border-color: #63445d; background: #332439; }
.hero-button:hover { background: #422c47; border-color: #aa6e9a; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 650; padding: 5px 8px; border-radius: 5px; border: 1px solid currentColor; white-space: nowrap; }
.status.lime { color: var(--lime); background: #c9f67511; border-color: #c9f67534; }
.status.pink { color: var(--pink); background: #fb8ccc12; border-color: #fb8ccc36; }

.panel { min-width: 0; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.stat { padding: 16px 19px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: #c1bfcb; font-size: 12px; font-weight: 650; }
.icon-box { width: 34px; height: 34px; flex: 0 0 34px; display: inline-grid; place-items: center; border: 1px solid #41404d; border-radius: 8px; color: var(--muted); background: #23232e; }
.icon-box.lime { color: var(--lime); background: #272f21; border-color: #3a482d; }
.icon-box.pink { color: var(--pink); background: #342331; border-color: #4f3447; }
.icon-box.violet { color: var(--violet); background: #2a243a; border-color: #3f355a; }
.stat-value { margin-top: 5px; font-size: 34px; line-height: 1.12; font-weight: 750; letter-spacing: -.045em; }
.stat-value span { margin-left: 5px; color: #c5c1ce; font-size: 14px; font-weight: 600; letter-spacing: 0; }
.stat p, .panel-top p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(260px, 1fr); gap: 15px; }
.panel-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 11px; }
.panel-top > svg { color: var(--quiet); }
.panel h2 { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.chart-panel, .routing, .content-panel { padding: 17px 19px; }
.segments { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #14141b; }
.segments button { min-width: 37px; padding: 4px 5px; border-radius: 4px; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; }
.segments button[aria-pressed="true"] { background: #2e3825; color: var(--lime); }
.segments button:hover { color: var(--text); }
.chart { display: grid; grid-template-columns: 25px minmax(0, 1fr); gap: 8px; margin-top: 19px; }
.chart-scale { display: flex; justify-content: space-between; flex-direction: column; align-items: flex-end; height: 140px; font: 10px var(--mono); color: var(--quiet); }
.chart-plot { display: block; width: 100%; height: 140px; overflow: visible; }
.chart-labels { display: flex; justify-content: space-between; margin-top: 8px; color: var(--quiet); font: 10px var(--mono); }
.routing ol { position: relative; display: grid; gap: 15px; list-style: none; margin: 19px 0 0; padding: 0; }
.routing ol::before { position: absolute; content: ""; top: 18px; bottom: 19px; left: 16px; border-left: 1px dashed #5d5267; }
.routing li { display: flex; align-items: center; gap: 11px; }
.routing li .icon-box { position: relative; }
.routing strong, .routing small { display: block; }
.routing strong { font-size: 12px; }
.routing small { margin-top: 3px; color: var(--muted); font: 11px var(--mono); }
.infra .panel-top { padding: 17px 19px 14px; }
.text-link { display: inline-flex; align-items: center; gap: 5px; color: var(--lime); font-size: 12px; white-space: nowrap; }
.text-link:hover, .facts a:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 13px; border-top: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 19px; }
th:last-child, td:last-child { padding-right: 19px; }
th { font-size: 11px; font-weight: 600; color: var(--muted); background: #17171d; }
td { font-size: 12px; color: var(--muted); }
td strong { color: var(--text); }
.mono { font-family: var(--mono); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.36fr); gap: 15px; align-items: start; }
.facts { margin: 17px 0 0; }
.facts > div { display: flex; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.facts dt { flex-shrink: 1; color: var(--muted); }
.facts dd { flex-shrink: 0; margin: 0; text-align: right; }
.facts a { color: var(--lime); }
.notice { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notice svg { color: var(--pink); }
.content-panel .notice { margin-top: 12px; }
.empty { display: grid; place-items: center; text-align: center; padding: 34px 0 22px; }
.empty h3 { margin: 13px 0 6px; font-size: 14px; }
.empty p { max-width: 32rem; color: var(--muted); font-size: 13px; }
.journal-list { padding: 0; list-style: none; }
.journal-list li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.journal-list li small, .journal-list li time { color: var(--muted); font-size: 12px; }
.journal-list li small { display: block; margin-top: 5px; }
.journal-list li time { margin-left: auto; white-space: nowrap; }

dialog { color: var(--text); width: min(450px, calc(100% - 28px)); padding: 21px; border: 1px solid #443d50; border-radius: 12px; background: #19181f; }
dialog::backdrop { background: #08070bc9; }
.dialog-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.dialog-top h2 { font-size: 20px; letter-spacing: -.04em; }
.dialog-top p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.icon-button { width: 31px; height: 31px; display: inline-grid; flex-shrink: 0; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #1e1d26; }
.icon-button:hover { color: var(--pink); border-color: #76536e; }
form label { display: grid; gap: 5px; margin-bottom: 11px; color: var(--muted); font-size: 12px; font-weight: 650; }
form input { min-width: 0; height: 38px; padding: 7px 9px; border-radius: 6px; border: 1px solid var(--line); color: var(--text); background: #111117; }
form input::placeholder { color: #817d90; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) 86px; gap: 10px; }
.form-error { color: var(--pink); font-size: 12px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 15px; }
#toast { position: fixed; z-index: 3; right: 18px; bottom: 18px; max-width: calc(100% - 36px); padding: 12px 15px; border: 1px solid #465237; border-radius: 7px; background: #202719; color: var(--lime); opacity: 0; pointer-events: none; transition: opacity .16s; }
#toast.visible { opacity: 1; }

@media (max-width: 1020px) {
  .layout { grid-template-columns: 178px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.5fr) minmax(230px, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 63px minmax(0, 1fr); }
  .brand { margin-left: 0; }
  .brand > span:nth-child(2), #navigation a span, .sidebar-footer { display: none; }
  #navigation a { justify-content: center; padding-inline: 6px; }
  .sidebar { padding-inline: 10px; }
}
@media (max-width: 640px) {
  .layout { display: block; }
  .mobile-brand { display: block; position: absolute; top: 15px; left: 16px; font-size: 20px; }
  .sidebar { height: 76px; padding: 38px 10px 0; z-index: 2; border-right: 0; border-bottom: 1px solid var(--line); }
  .mobile-brand { z-index: 3; }
  .brand { display: none; }
  #navigation { display: flex; justify-content: space-between; gap: 2px; }
  #navigation a { flex: 1; flex-direction: column; gap: 1px; min-width: 0; min-height: 32px; padding: 2px 3px; font-size: 10px; text-align: center; }
  #navigation a span { display: block; }
  #navigation a svg { width: 13px; height: 13px; }
  .page-header { min-height: 61px; padding-inline: 12px; }
  .page-header h1 { font-size: 17px; }
  .header-actions { gap: 4px; }
  .demo-badge { font-size: 9px; padding: 4px 5px; gap: 3px; }
  .demo-badge i { width: 4px; height: 4px; }
  .header-actions .button { padding: 5px 6px; min-height: 31px; gap: 3px; font-size: 10px; }
  .header-actions .button svg { width: 12px; }
  .page-content { gap: 12px; padding: 12px 12px 26px; }
  .hero { min-height: 185px; }
  .hero-art { inset-inline-start: 27%; opacity: .65; }
  .hero-content { padding-inline: 13px; }
  .hero h2 { font-size: clamp(28px, 8.5vw, 44px); }
  .hero p { font-size: 11px; }
  .hero-button { margin-top: 13px; }
  .stats { gap: 5px; }
  .stat { padding: 8px 6px 10px; }
  .stat-top { font-size: 10px; }
  .stat-top .icon-box { width: 21px; height: 21px; flex-basis: 21px; border-radius: 5px; }
  .stat-top svg { width: 13px; height: 13px; }
  .stat-value { font-size: 23px; }
  .stat-value span { font-size: 10px; margin-left: 2px; }
  .stat p { font-size: 9px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 12px; }
  .chart-panel, .routing, .content-panel { padding: 13px; }
  .infra .panel-top { padding: 13px; }
  .facts dd { flex-shrink: 1; }
  .facts > div { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}

#audience-report { display: grid; gap: 15px; min-width: 0; }
.audience-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.audience-metric { padding: 17px 19px; }
.audience-metric h2 { color: var(--text); font-size: 13px; }
.audience-metric .stat-value { margin-top: 10px; }
.audience-metric .stat-value.unavailable { font-size: 25px; color: var(--muted); }
.audience-key { display: inline-flex; align-items: center; gap: 7px; }
.audience-key i { width: 7px; height: 7px; border-radius: 50%; background: var(--series-color); flex-shrink: 0; }
.audience-key.follows, .audience-plot .follows { --series-color: var(--lime); }
.audience-key.starts, .audience-plot .starts { --series-color: var(--pink); }
.audience-chart { padding: 19px; }
.audience-chart-grid { display: grid; grid-template-columns: 27px minmax(0, 1fr); gap: 10px; margin-top: 21px; }
.audience-scale { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; height: 208px; color: var(--muted); font: 10px var(--mono); }
.audience-plot { display: block; width: 100%; height: 208px; overflow: visible; cursor: crosshair; }
.audience-plot .follows, .audience-plot .starts { color: var(--series-color); }
.audience-gridline { stroke: var(--line); stroke-dasharray: 4 5; stroke-width: 1; vector-effect: non-scaling-stroke; }
.audience-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.audience-cursor { stroke: #97899d; stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.audience-dot { fill: currentColor; stroke: var(--surface); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.audience-picker { display: flex; align-items: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.audience-picker input { width: min(100%, 220px); margin: 0; accent-color: var(--lime); }
.audience-day { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; min-height: 38px; margin-top: 9px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: #15151b; font-size: 12px; }
.audience-day time { font-family: var(--mono); }
.audience-day strong { color: var(--text); }
.audience-table summary { padding: 13px 19px; cursor: pointer; font-weight: 650; }
.audience-table td { font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .audience-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .audience-metric { padding: 12px 10px; }
  .audience-metric:last-child { grid-column: span 2; }
  .audience-metric h2 { font-size: 12px; }
  .audience-metric p { font-size: 11px; }
  .audience-chart { padding: 13px; }
  .audience-chart-grid { gap: 6px; grid-template-columns: 20px minmax(0, 1fr); }
  .audience-table summary { padding-inline: 13px; }
}

[hidden] { display: none !important; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.login-card { width: min(100%, 390px); padding: 25px; }
.login-brand { font-size: 24px; font-weight: 800; letter-spacing: -.05em; }
.login-card h1 { margin: 18px 0 14px; font-size: 21px; }
.login-flow { display: grid; justify-items: start; gap: 8px; margin-top: 15px; color: var(--muted); }
.login-flow strong { font: 24px var(--mono); letter-spacing: .15em; color: var(--lime); }
.login-status { margin-top: 12px; color: var(--muted); font-size: 12px; }

.bscheck { margin-top: 15px; }
.bs-key, .bs-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.bs-key label { margin: 0; flex: 0 1 290px; }
.bs-settings { margin: 15px 0; }
.bs-settings .form-row { grid-template-columns: minmax(0, 220px) minmax(0, 150px); }
.bs-networks, .bs-history details { margin: 0 0 8px; border: 1px solid var(--line); border-radius: 7px; }
.bs-networks summary, .bs-history summary { padding: 10px; cursor: pointer; }
.bs-history summary span:last-child { padding-left: 9px; color: var(--muted); }
.bs-history details .notice { padding: 0 10px 10px; }
.bs-operator-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 5px 10px; max-height: 240px; padding: 4px 10px 10px; overflow: auto; }
.bs-operator-grid label, form label.bs-checkbox { display: flex; align-items: start; margin-bottom: 8px; }
.bs-operator-grid input, form label.bs-checkbox input { height: auto; accent-color: var(--lime); }
.bs-operator-grid small { color: var(--quiet); font-size: 11px; }
.bs-history-title { margin: 15px 0 7px; font-size: 14px; }
.bscheck .form-error { margin-top: 12px; }
button:disabled { opacity: .6; cursor: wait; }

#overview-data { display: grid; gap: 18px; }
@media (max-width: 640px) {
  #overview-data { gap: 12px; }
}
