:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --ink: #1b1c1e;
  --muted: #6a6d72;
  --line: #e2e2de;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --ok: #2f6f3e;
  --bar2: #9a9ca1;
  --t-info: #2563a8;
  --t-success: #2f6f3e;
  --t-warning: #a15c07;
  --t-danger: #b42318;
  --t-promo: #7a3db8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --surface: #1b1c1f;
    --ink: #e7e7e5;
    --muted: #9a9ca1;
    --line: #2c2e32;
    --accent: #f0743e;
    --accent-ink: #131416;
    --danger: #f2766b;
    --ok: #7cc48d;
    --bar2: #5d6066;
    --t-info: #6fa8e8;
    --t-success: #7cc48d;
    --t-warning: #e0a44a;
    --t-danger: #f2766b;
    --t-promo: #b98ae8;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
h1 { font-size: 18px; margin: 0 0 16px; }
h2 { font-size: 14px; margin: 0; font-weight: 600; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--danger); min-height: 1.4em; margin: 8px 0 0; }

input, select, textarea, button {
  font: inherit; color: inherit;
}
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--danger); }
button.link { background: none; border: 0; padding: 4px; color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; display: grid; gap: 8px; }

.top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; height: 48px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; white-space: nowrap; }
nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
nav a { color: var(--muted); text-decoration: none; padding: 13px 8px; border-bottom: 2px solid transparent; white-space: nowrap; }
nav a.on { color: var(--ink); border-bottom-color: var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.view { display: grid; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-width: 0; }
.panel-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }

.kpis { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.kpi.live { border-color: var(--accent); }
.kpi.live .l::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 5px; vertical-align: 1px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.kpi .n { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12px; }

.chart svg { display: block; width: 100%; height: auto; }
.chart .legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.scroll { overflow-x: auto; }
.t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.t th, .t td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t th { font-weight: 600; color: var(--muted); font-size: 12px; white-space: nowrap; }
.t td.num, .t th.num { text-align: right; }
.t tr:last-child td { border-bottom: 0; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.tag.bad { color: var(--danger); border-color: currentColor; }
.tag.good { color: var(--ok); border-color: currentColor; }
.bar { height: 6px; background: var(--accent); border-radius: 3px; }

.toolbar { display: flex; gap: 8px; }
.toolbar input { flex: 1; }
.toolbar select { width: auto; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 10px; color: var(--muted); font-size: 12px; }

.list { display: grid; gap: 8px; }
.fb { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.fb-h { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.fb-h strong { color: var(--ink); font-size: 13px; }
.fb-msg { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 8px; }
.fb-a { display: flex; gap: 6px; flex-wrap: wrap; }

.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.form label.check { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; }
.form label.check input { width: auto; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.form .checks { display: flex; gap: 20px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 0; display: grid; gap: 8px; min-width: 0; }
legend { font-size: 12px; font-weight: 600; padding: 0 4px; }
.actions { display: flex; align-items: center; gap: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 6px; font-size: 13px;
  max-width: calc(100% - 32px);
}

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .nt-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .top { flex-wrap: wrap; height: auto; padding: 8px 16px 0; gap: 4px 12px; }
  .brand { flex: 1; }
  nav { order: 3; flex-basis: 100%; }
  nav a { padding: 10px 8px; }
  main { padding: 12px 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .t .hide-sm { display: none; }
  .toolbar { flex-wrap: wrap; }
  .toolbar input { flex-basis: 100%; }
}
.dev-line { padding: 4px 0; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); }
.dev-line:last-child { border-bottom: 0; }
.dev-line .mono { word-break: break-all; }
button.small { padding: 2px 8px; font-size: 12px; margin-top: 2px; }

/* crashes */
.crash .frame { color: var(--muted); overflow-wrap: anywhere; margin-bottom: 6px; }
.crash-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); }
.crash-stats b { color: var(--ink); }
.crash details { margin-top: 8px; }
.crash summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.stack { font: 11px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; overflow-x: auto; max-height: 360px; margin: 6px 0 0; white-space: pre; }
.ell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel.narrow { max-width: 420px; }

/* notices editor */
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.nt-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.tpl-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.form label.tpl { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px; cursor: pointer; color: var(--ink); font-size: 13px; }
.form label.tpl > span:last-child { display: grid; }
.tpl input, .chip input { position: absolute; opacity: 0; pointer-events: none; }
.tpl:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tpl:has(input:focus-visible), .chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.thumb { position: relative; width: 44px; height: 64px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); overflow: hidden; }
.thumb i { position: absolute; left: 4px; right: 4px; height: 4px; border-radius: 2px; background: var(--line); }
.thumb i:nth-child(1) { top: 16px; } .thumb i:nth-child(2) { top: 26px; } .thumb i:nth-child(3) { top: 36px; }
.thumb-banner::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 9px; background: var(--accent); }
.thumb-card::before { content: ""; position: absolute; left: 4px; right: 4px; top: 44px; height: 14px; border-radius: 3px; background: var(--accent); }
.thumb-dialog::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.25); z-index: 1; }
.thumb-dialog::after { content: ""; position: absolute; left: 7px; right: 7px; top: 22px; height: 20px; border-radius: 4px; background: var(--accent); z-index: 2; }
.thumb-fullscreen::before { content: ""; position: absolute; inset: 0; background: var(--accent); z-index: 1; }
.thumb-fullscreen::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 6px; height: 7px; border-radius: 4px; background: var(--surface); z-index: 2; }
.tone-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.form label.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer; color: var(--ink); font-size: 13px; text-transform: capitalize; }
.chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--tone); }
.chip:has(input:checked) { border-color: var(--tone); box-shadow: inset 0 0 0 1px var(--tone); }
.tone-info { --tone: var(--t-info); } .tone-success { --tone: var(--t-success); } .tone-warning { --tone: var(--t-warning); }
.tone-danger { --tone: var(--t-danger); } .tone-promo { --tone: var(--t-promo); }

/* phone preview: fixed dark app look, independent of the panel theme */
.phone { position: relative; width: 100%; max-width: 320px; height: 580px; border: 8px solid #26272b; border-radius: 28px; background: #0f1012; color: #ececea; overflow: hidden; font-size: 13px; }
.phone .tone-info { --tone: #6fa8e8; } .phone .tone-success { --tone: #6cc283; } .phone .tone-warning { --tone: #e8a33d; }
.phone .tone-danger { --tone: #f06a5f; } .phone .tone-promo { --tone: #b98ae8; }
.app-fake { padding: 10px; display: grid; gap: 10px; }
.app-bar { font-weight: 700; font-size: 15px; padding: 4px 2px; }
.app-row { height: 10px; width: 50%; border-radius: 4px; background: #24262a; }
.app-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.app-tiles i { aspect-ratio: 2 / 3; border-radius: 6px; background: #1c1d20; }
.nx { position: absolute; top: 6px; right: 8px; font-size: 18px; line-height: 1; opacity: .7; }
.nbtn { display: inline-block; background: var(--tone); color: #0f1012; font-weight: 600; border-radius: 8px; padding: 8px 14px; text-align: center; }
.nbtn.ghost { background: none; color: #ececea; border: 1px solid #3a3c41; }
.nbtn.big { display: block; padding: 14px; font-size: 15px; border-radius: 12px; }
.nimg { display: block; width: 100%; max-height: 140px; object-fit: cover; border-radius: 8px; background: #24262a; }
.n-banner { position: relative; margin: 0 -10px; padding: 8px 30px 8px 12px; background: color-mix(in srgb, var(--tone) 22%, #0f1012); border-left: 3px solid var(--tone); font-size: 12px; }
.n-banner .nlink { color: var(--tone); text-decoration: underline; font-weight: 600; }
.n-card { position: relative; display: grid; gap: 6px; padding: 12px; border-radius: 12px; background: #1a1b1e; border: 1px solid color-mix(in srgb, var(--tone) 50%, #1a1b1e); }
.n-card b { padding-right: 18px; } .n-card p, .n-dialog p, .n-full p { margin: 0; color: #c4c5c3; }
.n-card .nbtn { justify-self: start; }
.n-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 20px; }
.n-dialog { width: 100%; display: grid; gap: 8px; padding: 16px; border-radius: 16px; background: #1c1d20; border-top: 3px solid var(--tone); }
.n-dialog b { font-size: 15px; }
.nrow { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.n-full { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; padding: 36px 18px 18px; background: color-mix(in srgb, var(--tone) 18%, #0f1012); }
.n-full .nimg { max-height: 200px; }
.nfull-body { flex: 1; display: grid; align-content: start; gap: 8px; }
.nfull-body b { font-size: 22px; line-height: 1.2; }
