/* Kida, new view. Tokens from the DPlava design, Geist type. The dark theme uses neutral grays (13. nov), not navy. */
:root {
  color-scheme: light;
  --bg: #F6F7FA; --card: #FFFFFF; --line: #E2E5EC; --nav-on: #E9EDF7;
  --text: #12151C; --muted: #555D6E; --faint: #8A92A3;
  --accent: #1F4FD8; --on-accent: #FFFFFF; --accent-soft: #E9EFFD;
  --good: #137A4B; --good-soft: #E3F4EC; --warn: #9A5B00; --warn-soft: #FDF1DC; --bad: #B42318; --bad-soft: #FDE8E6;
  --series-1: #1F4FD8; --series-2: #eb6834; --series-3: #1baf7a;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(18, 21, 28, .04);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0F0F11; --card: #18181B; --line: #2C2C31; --nav-on: #232327;
    --text: #EDEDEF; --muted: #A3A3AB; --faint: #77777F;
    --accent: #8FB0FF; --on-accent: #111113; --accent-soft: #212532;
    --good: #5BD69B; --good-soft: #13281F; --warn: #F2B860; --warn-soft: #2E2312; --bad: #FF8A80; --bad-soft: #321716;
    --series-1: #5C88F0; --series-2: #d95926; --series-3: #199e70;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F0F11; --card: #18181B; --line: #2C2C31; --nav-on: #232327;
  --text: #EDEDEF; --muted: #A3A3AB; --faint: #77777F;
  --accent: #8FB0FF; --on-accent: #111113; --accent-soft: #212532;
  --good: #5BD69B; --good-soft: #13281F; --warn: #F2B860; --warn-soft: #2E2312; --bad: #FF8A80; --bad-soft: #321716;
  --series-1: #5C88F0; --series-2: #d95926; --series-3: #199e70;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 15px/1.5 'Geist', system-ui, sans-serif; -webkit-font-smoothing: antialiased; overflow-wrap: break-word; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.num { font-variant-numeric: tabular-nums; }

/* Shell: menu on the left, content on the right; on a phone a top bar and a bottom menu */
.app { display: flex; min-height: 100vh; }
.side { width: 232px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 22px 14px; background: var(--card); border-right: 1px solid var(--line); }
.logo { display: flex; align-items: flex-end; gap: 10px; padding: 0 12px 22px; font-weight: 700; font-size: 24px; line-height: 1; letter-spacing: -0.03em; text-decoration: none; color: var(--text); }
.logo-mark { display: flex; align-items: flex-end; gap: 3px; height: 24px; }
.logo-mark i { width: 5px; border-radius: 2px; display: block; }
.nav-link { min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border-radius: 12px; text-decoration: none; color: var(--text); font-size: 15px; }
.nav-link:hover { background: var(--nav-on); }
.nav-link[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.nav-link .ico { width: 20px; text-align: center; }
.nav-sep { height: 1px; margin: 10px 14px; background: var(--line); }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 0 4px; }
.shop-name { padding: 0 10px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .row { display: flex; gap: 6px; }
.main { flex: 1; min-width: 0; padding: 28px clamp(16px, 3vw, 36px) 60px; }
.topbar, .tabbar, .more-sheet { display: none; }

@media (max-width: 860px) {
  .app { display: block; }
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; height: 58px; padding: 0 16px; align-items: center; justify-content: space-between; background: var(--card); border-bottom: 1px solid var(--line); }
  .main { padding: 16px 16px 96px; overflow-x: clip; }
  .tabbar { display: grid; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: 12px; background: transparent; font-size: 12px; text-decoration: none; color: var(--text); cursor: pointer; }
  .tabbar .ico { font-size: 18px; line-height: 1; }
  .tabbar [aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
  .more-sheet.open { display: grid; position: fixed; z-index: 30; left: 0; right: 0; bottom: 72px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 16px; border-radius: 20px 20px 0 0; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -12px 40px rgba(0, 0, 0, .12); }
  .more-sheet a, .more-sheet button { min-height: 58px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-radius: 14px; border: 0; background: var(--nav-on); text-decoration: none; color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer; }
}

/* Page head: a title, a one line subtitle, actions on the right */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(26px, 3.2vw, 36px); line-height: 1.12; font-weight: 600; letter-spacing: -0.035em; }
.page-head .sub { color: var(--muted); margin-top: 6px; }

/* Cards and grid */
.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.grid-2 { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.card.accent { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.card.accent .card-title { color: var(--accent); }
.big { font-size: clamp(30px, 3.6vw, 44px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.12; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Buttons: one primary per screen, others quiet */
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
/* Buttons inside the decision card: one filled, the rest quiet */
.btn.on-accent { background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: var(--shadow-accent); }
.btn.ghost-on-accent { background: var(--card); color: var(--text); border-color: var(--line); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }

/* Status chips: color always comes with a word */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--nav-on); color: var(--muted); white-space: nowrap; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.plain::before { display: none; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

/* The ⓘ next to a label: hover on a computer, tap on a phone */
.tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; font-style: normal; cursor: help; background: var(--card); flex-shrink: 0; }
.tip:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.tip-pop { position: fixed; z-index: 50; max-width: 280px; padding: 10px 12px; border-radius: 10px; background: #12151C; color: #F6F7FA; font-size: 13px; font-weight: 400; line-height: 1.45; box-shadow: 0 8px 28px rgba(0, 0, 0, .25); pointer-events: none; }

/* Segmented control (periods, metric switch) */
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--nav-on); gap: 2px; }
.seg button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* KPI tiles */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.kpi .label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi .value { font-size: clamp(20px, 1.9vw, 26px); font-weight: 600; letter-spacing: -0.03em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta { font-size: 12px; font-weight: 600; margin-top: 2px; color: var(--muted); }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); font-size: 12px; white-space: nowrap; }
.chart-tip b { font-size: 14px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 14px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; border-radius: 4px; background: var(--nav-on); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--series-1); min-width: 2px; }
.bar-row .val { font-weight: 600; text-align: right; min-width: 64px; }

/* 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: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t td.r, table.t th.r { text-align: right; }
table.t tr:last-child td { border-bottom: 0; }
.cell-name { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lists of connections and things to do */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--nav-on); flex-shrink: 0; }

/* Empty, loading, toast */
.empty { padding: 26px; text-align: center; color: var(--muted); }
.skel { border-radius: 10px; background: linear-gradient(90deg, var(--nav-on), var(--card), var(--nav-on)); background-size: 200% 100%; animation: skel 1.2s infinite; }
@keyframes skel { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 12px 18px; border-radius: 12px; background: #12151C; color: #F6F7FA; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; }
.toast { transform: translate(-50%, 18px); transition: opacity .2s ease, transform .32s cubic-bezier(.2, .8, .2, 1); }
.toast.show { transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
@media (max-width: 860px) { .toast { bottom: 88px; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
details.more > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }

/* Forms: a short label with ⓘ, the field under it */
.field { display: grid; gap: 6px; min-width: 0; }
.field > .lbl { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 15px; }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* On/off switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .knob { width: 42px; height: 24px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; flex-shrink: 0; }
.switch .knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(18px); }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Sub tabs inside a screen */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a, .tabs button { flex-shrink: 0; padding: 10px 14px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; border-bottom: 2px solid transparent; cursor: pointer; }
.tabs [aria-current="page"], .tabs [aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* Connection cards */
.conn-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); align-items: start; }
.conn-head { display: flex; align-items: center; gap: 12px; }
.conn-logo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 15px; background: var(--nav-on); color: var(--text); flex-shrink: 0; }
.conn-head .grow { flex: 1; min-width: 0; }
.conn-head .title { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.conn-body { margin-top: 12px; display: grid; gap: 10px; font-size: 14px; }
.code { display: block; padding: 10px 12px; border-radius: 10px; background: var(--nav-on); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; white-space: pre-wrap; }
.dns { display: grid; gap: 6px; }
.dns-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 6px; font-size: 12.5px; }

/* Dialog for editing one thing */
dialog.sheet { border: 0; padding: 0; border-radius: 18px; width: min(var(--sheet-w, 720px), calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); background: var(--card); color: var(--text); box-shadow: 0 24px 80px rgba(0,0,0,.3); }
dialog.sheet::backdrop { background: rgba(10, 12, 18, .45); }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 18px; }
.sheet-body { padding: 18px 20px 22px; display: grid; gap: 14px; }
.sheet-foot { position: sticky; bottom: 0; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 20px; background: var(--card); border-top: 1px solid var(--line); }
/* Phones: a bottom sheet as wide as the screen. dvh is the height that is
   really visible; plain vh on iOS counts the space under the browser bars,
   which cut off the top of tall sheets. */
@media (max-width: 860px) {
  dialog.sheet { width: 100%; max-width: 100%; max-height: 92vh; max-height: calc(100dvh - 12px - env(safe-area-inset-top)); margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .sheet-head { padding: 12px 16px; }
  .sheet-body { padding: 14px 16px 18px; }
  .sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
}
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; display: grid; place-items: center; font-size: 18px; color: var(--muted); }
.note { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 13.5px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }

/* Period picker for reports */
.period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.range-btn { min-height: 42px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.range-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.range-btn svg { width: 16px; height: 16px; color: var(--muted); }
.rb-narrow { display: none; }
@media (max-width: 700px) { .period .seg { display: none; } .period { width: 100%; justify-content: flex-start; } .rb-wide { display: none; } .rb-narrow { display: inline; } }
@media (min-width: 861px) { dialog.range-sheet { width: min(860px, calc(100vw - 24px)); } }
.range-body { display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.range-presets { display: grid; align-content: start; gap: 2px; padding: 14px 10px; border-right: 1px solid var(--line); }
.range-presets button { text-align: left; min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font-size: 14px; cursor: pointer; }
.range-presets button:hover { background: var(--nav-on); }
.range-presets button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.range-cal { position: relative; padding: 14px 18px 18px; }
.cal-nav { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; }
.cal-nav button { pointer-events: auto; }
.cal-nav button:disabled { opacity: .35; cursor: default; }
.cal-months { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.cal-title { text-align: center; font-weight: 600; height: 36px; line-height: 36px; margin-bottom: 6px; }
.cal-week, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-week span { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-days button { height: 38px; border: 0; background: transparent; color: var(--text); font-size: 14px; cursor: pointer; border-radius: 0; font-variant-numeric: tabular-nums; }
.cal-days button:hover:not(:disabled):not(.edge):not(.in) { background: var(--nav-on); border-radius: 9px; }
.cal-days button.in { background: var(--accent-soft); border-radius: 0; }
.cal-days button.edge { background: var(--accent); color: var(--on-accent); font-weight: 700; border-radius: 9px; }
.cal-days button.now:not(.edge) { box-shadow: 0 0 0 1px var(--line) inset; border-radius: 9px; font-weight: 700; }
.cal-days button:disabled { color: var(--muted); opacity: .4; cursor: default; }
.range-foot { justify-content: space-between; align-items: center; }
@media (max-width: 860px) {
  .range-body { grid-template-columns: minmax(0, 1fr); }
  .range-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); border-right: 0; border-bottom: 1px solid var(--line); }
  .cal-months .cal-month:first-child { display: none; }
  .cal-months { grid-template-columns: minmax(0, 1fr); }
  .cal-days button { height: 42px; }
}
.chart .bar { fill: var(--series-1); }
.chart .bar.on { opacity: .8; }

/* ── Depth: three shadow levels, tuned per theme ─────────────────────────── */
:root {
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-2: 0 2px 4px -2px rgba(16, 24, 40, .06), 0 8px 20px -4px rgba(16, 24, 40, .10);
  --shadow-3: 0 24px 56px -12px rgba(16, 24, 40, .28);
  --shadow-accent: 0 1px 2px rgba(31, 79, 216, .25), 0 6px 14px -4px rgba(31, 79, 216, .38);
  --shadow: var(--shadow-1);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .035);
    --shadow-2: 0 10px 28px -8px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .05);
    --shadow-3: 0 28px 70px -14px rgba(0, 0, 0, .8);
    --shadow-accent: 0 6px 18px -6px rgba(143, 176, 255, .45);
  }
}
:root[data-theme="dark"] {
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .035);
  --shadow-2: 0 10px 28px -8px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .05);
  --shadow-3: 0 28px 70px -14px rgba(0, 0, 0, .8);
  --shadow-accent: 0 6px 18px -6px rgba(143, 176, 255, .45);
}
.card, .kpi { box-shadow: var(--shadow-1); transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease; }
.card:hover, .kpi:hover { box-shadow: var(--shadow-2); }
.btn { box-shadow: var(--shadow-1); transition: box-shadow .15s ease, filter .15s ease, transform .1s ease, background .15s ease; }
.btn:hover:not(:disabled) { box-shadow: var(--shadow-2); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--shadow-1); }
.btn.primary { box-shadow: var(--shadow-accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.07); box-shadow: var(--shadow-accent); }
.btn:disabled { box-shadow: none; }
.nav-link { transition: background .15s ease; }
.nav-link[aria-current="page"] { box-shadow: var(--shadow-accent); }
.tabbar [aria-current="page"] { box-shadow: var(--shadow-accent); }
.seg button[aria-pressed="true"] { box-shadow: var(--shadow-2); }
.range-btn { box-shadow: var(--shadow-1); }
dialog.sheet { box-shadow: var(--shadow-3); }
.chart-tip { box-shadow: var(--shadow-2); }
.more-sheet.open { box-shadow: var(--shadow-3); }
.list-item { transition: background .15s ease; border-radius: 10px; }
@media (hover: hover) { .list-item:hover { background: color-mix(in srgb, var(--nav-on) 55%, transparent); } }
/* Bars on the phone stay readable over content scrolling underneath */
@media (max-width: 860px) {
  .topbar, .tabbar { background: color-mix(in srgb, var(--card) 86%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); }
  .tabbar { box-shadow: 0 -8px 24px -12px rgba(16, 24, 40, .18); }
}
@media (prefers-reduced-motion: reduce) { .card, .kpi, .btn, .nav-link, .list-item { transition: none; } }

/* Big numbers shrink to fit their tile instead of being cut off */
.kpi { container-type: inline-size; }
.kpi .value { font-size: clamp(17px, 14.5cqi, 26px); }

/* ⓘ: a bigger invisible target for a finger, the dot stays small */
.tip::after { content: ''; position: absolute; inset: -12px; }

/* Checkboxes and radios in the brand color, big enough to hit */
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
.switch input[type="checkbox"] { width: 1px; height: 1px; }
.name-tag { display: inline-block; padding: 0 7px; margin: 0 1px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: .85em; font-weight: 600; vertical-align: 1px; }
.hour-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hour-chips button { min-width: 48px; min-height: 36px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.hour-chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-accent); }
.thumb-logo { display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; }
.thumb-logo.meta { background: linear-gradient(135deg, #1877F2, #0A5BD3); }
.thumb-logo.google { background: linear-gradient(135deg, #4285F4 0 50%, #34A853 50%); }
.ad-nums { display: grid; grid-template-columns: repeat(3, minmax(72px, auto)); gap: 4px 18px; text-align: right; }
.ad-nums > div { display: grid; gap: 2px; justify-items: end; }
@media (max-width: 860px) {
  .ad-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 8px; align-items: center; }
  .ad-row > .thumb { grid-row: 1 / span 2; align-self: start; }
  .ad-row > .grow { grid-column: 2; grid-row: 1; }
  .ad-row > .btn { grid-column: 3; grid-row: 1; }
  .ad-row > .chip { grid-column: 2 / -1; grid-row: 2; justify-self: start; }
  .ad-row .ad-nums { grid-column: 2 / -1; grid-row: 3; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: left; }
  .ad-row .ad-nums > div { justify-items: start; }
}


/* A post shown the way the Instagram feed shows it */
.phone { width: min(380px, 100%); margin: 0 auto; border: 1px solid var(--line); border-radius: 22px; background: var(--card); overflow: hidden; box-shadow: var(--shadow-2); }
.ph-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 14px; }
.ph-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #F58529, #DD2A7B 50%, #8134AF); box-shadow: 0 0 0 2px var(--card), 0 0 0 3px #DD2A7B; }
.ph-media { position: relative; background: var(--nav-on); }
.ph-media video, .ph-track img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.ph-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ph-track::-webkit-scrollbar { display: none; }
.ph-track img { flex: 0 0 100%; scroll-snap-align: start; }
.ph-dots { position: absolute; left: 0; right: 0; bottom: -18px; display: flex; justify-content: center; gap: 4px; }
.ph-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.ph-dots i.on { background: var(--accent); }
.ph-empty { aspect-ratio: 4 / 5; display: grid; place-items: center; color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }
.ph-actions { display: flex; gap: 14px; padding: 24px 14px 6px; font-size: 20px; }
.ph-cap { padding: 0 14px 6px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.ph-actions svg { width: 24px; height: 24px; }
.ph-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .85); color: #12151C; font-size: 20px; line-height: 1; cursor: pointer; box-shadow: var(--shadow-2); }
.ph-arrow.prev { left: 8px; } .ph-arrow.next { right: 8px; }
@media (hover: none) { .ph-arrow { display: none; } }

/* First steps on Today */
.steps-bar { height: 8px; border-radius: 999px; background: var(--nav-on); overflow: hidden; margin: 12px 0 10px; }
.steps-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #1baf7a)); transition: width .4s ease; }
.steps { display: grid; gap: 2px; }
.step { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; }
a.step:hover { background: var(--nav-on); }
.step-dot { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.step.done { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.step.done .step-dot { background: var(--good); border-color: var(--good); color: #fff; }
.step-go { margin-left: auto; color: var(--muted); font-size: 18px; }
.res-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); max-width: 560px; }
.res-cell { display: grid; gap: 1px; }
.res-cell b { font-size: 17px; }
@media (max-width: 520px) { .res-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* The bell */
.side-top { display: flex; align-items: center; justify-content: space-between; padding-right: 4px; }
.side-top .logo { padding-bottom: 0; }
.side > .side-top { margin-bottom: 22px; }
.bell { position: relative; width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; box-shadow: var(--shadow-1); }
.bell:hover { box-shadow: var(--shadow-2); }
.bell-n { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--card); }
.bell-n.urgent { background: #E5484D; color: #fff; }
.bell-n[hidden] { display: none; }
.notices { display: grid; gap: 6px; }
.notice { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 14px; background: var(--card); }
.notice:hover { box-shadow: var(--shadow-2); }
.notice-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.notice.bad .notice-dot { background: var(--bad); }
.notice.warn .notice-dot { background: var(--warn); }
.notice.info .notice-dot { background: var(--accent); }

/* Autopilot: pick a way of working, budget only when it matters */
.mode-cards { display: grid; gap: 8px; }
.mode-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--card); transition: border-color .15s, box-shadow .15s, background .15s; }
.mode-card:hover { box-shadow: var(--shadow-2); }
.mode-card input { margin-top: 2px; flex-shrink: 0; }
.mode-card > span { display: grid; gap: 2px; }
.mode-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.ap-budget { display: grid; gap: 12px; padding: 14px; border-radius: 12px; background: var(--nav-on); }
.ap-budget[hidden] { display: none; }
.adv-title { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
details.more { border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
details.more > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; color: var(--text); }
details.more > summary::after { content: '›'; font-size: 20px; color: var(--muted); transition: transform .2s; }
details.more[open] > summary::after { transform: rotate(90deg); }
details.more[open] { padding-bottom: 14px; }
.seg-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-scroll::-webkit-scrollbar { display: none; }
.seg-scroll .seg button { white-space: nowrap; }
.send-group { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; font-weight: 600; }

/* Empty screens: a calm picture, one line, the button underneath */
.card.empty { display: grid; justify-items: center; gap: 4px; padding: 40px 24px; font-size: 15px; }
.card.empty::before { content: ''; width: 76px; height: 76px; margin-bottom: 10px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--accent-soft) 0 62%, color-mix(in srgb, var(--accent-soft) 45%, transparent) 63% 100%); }
.card.empty::after { content: ''; position: absolute; width: 32px; height: 32px; margin-top: 22px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z'/%3E%3Cpath d='M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z'/%3E%3Cpath d='M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z'/%3E%3C/svg%3E") center / contain no-repeat; }
.card.empty { position: relative; }
.card.empty::after { top: 40px; left: 50%; margin: 22px 0 0 -16px; }

/* Moving between screens: a short rise, skipped for people who turn motion off */

/* One column stacks never grow past their parent: an implicit grid column is
   as wide as its widest child, so a long name or a table would push the page
   wider than the phone (iOS then widens the whole page and cuts the right edge). */
.grid, .stack, .bars, .list, .field, .conn-body, .dns, .sheet-body, .range-presets, .steps, .notices, .mode-cards, .ap-budget, .side-foot { grid-template-columns: minmax(0, 1fr); }
.card-head { flex-wrap: wrap; }
.card-head > :first-child { min-width: 0; }
.chip { max-width: 100%; }
.chip.wrap { white-space: normal; }

/* Editor next to its preview; on a phone one at a time with a switch on top */
.split { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
.split-tabs { display: none; }
@media (max-width: 860px) {
  .split, .split.wide-left { grid-template-columns: minmax(0, 1fr); }
  .split-tabs { display: flex; width: 100%; margin-bottom: 4px; }
  .split-tabs button { flex: 1; }
  .split[data-show="a"] > :nth-child(2), .split[data-show="b"] > :first-child { display: none; }
}
@media (max-width: 860px) { .sheet-foot .btn { flex: 1 1 auto; } }
@media (max-width: 860px) {
  .sheet-foot .btn { min-height: 40px; padding: 0 12px; font-size: 13px; }
  .sheet .seg button { padding: 0 10px; white-space: nowrap; }
}

/* ── Motion (13. nov). Short, and off with "reduce motion". ─────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-pop { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes sheet-drop { to { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes grow-x { from { transform: scaleX(0); } }
.tabs { position: relative; }
.tab-ink { position: absolute; left: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); transition: transform .32s cubic-bezier(.2, .8, .2, 1), width .32s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
.tabs.has-ink [aria-current="page"] { border-bottom-color: transparent; }
.btn, .tabbar a, .tabbar button, .nav-link, .seg button, .mode-card, .step, .notice, .list-item { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
  .fade { animation: fade-in .3s ease-out both; animation-delay: calc(var(--i, 0) * 25ms); }
  dialog.sheet[open] { animation: sheet-pop .26s cubic-bezier(.2, .8, .2, 1); }
  dialog.sheet[open]::backdrop { animation: fade-in .25s ease-out; }
  dialog.sheet.closing { animation: sheet-drop .2s ease-in forwards; }
  dialog.sheet.closing::backdrop { animation: fade-out .2s ease-in forwards; }
  .chart .line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .9s cubic-bezier(.35, .6, .2, 1) .1s forwards; }
  .chart .area { animation: fade-in .6s ease-out .45s both; }
  .chart .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: grow-y .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 14ms); }
  .bar-fill { transform-origin: 0 50%; animation: grow-x .6s cubic-bezier(.2, .8, .2, 1) both; }
  .steps-bar span { animation: grow-x .7s cubic-bezier(.2, .8, .2, 1) both; transform-origin: 0 50%; }
  .btn:active:not(:disabled) { transform: scale(.97); }
  .tabbar a:active, .tabbar button:active, .nav-link:active, .seg button:active, .mode-card:active, .step:active, .notice:active { transform: scale(.96); }
  .tabbar a, .tabbar button, .seg button, .step, .notice { transition: transform .12s ease, background .15s ease; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 860px) {
  dialog.sheet[open] { animation: sheet-up .34s cubic-bezier(.2, .8, .2, 1); }
  dialog.sheet.closing { animation: sheet-down .22s ease-in forwards; }
}
