/* Design tokens: neutral surfaces, hairlines, one restrained accent (green), system type. Light + dark. */
:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.2);
  --text: #1d1d1f;
  --text-2: #5f5f64;
  --text-3: #85858a;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.16);
  --accent: #12804a;
  --accent-text: #0f7a45;
  --on-accent: #ffffff;
  --accent-soft: rgba(18, 128, 74, 0.1);
  --danger: #c4161c;
  --danger-soft: rgba(196, 22, 28, 0.08);
  --warn: #9a5b00;
  --warn-dot: #e08a00;
  --focus: rgba(18, 128, 74, 0.45);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.02);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --sidebar: 232px;
  --content: 1080px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #232325;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);
    --text: #f5f5f7;
    --text-2: #aeaeb2;
    --text-3: #8d8d93;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.18);
    --accent: #30d158;
    --accent-text: #30d158;
    --on-accent: #00230d;
    --accent-soft: rgba(48, 209, 88, 0.14);
    --danger: #ff6961;
    --danger-soft: rgba(255, 105, 97, 0.12);
    --warn: #ffb340;
    --warn-dot: #ff9f0a;
    --focus: rgba(48, 209, 88, 0.5);
    --shadow: none;
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.47 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; letter-spacing: -0.005em;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; }
code, pre, kbd, .mono { font-family: var(--mono); font-size: 0.88em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }

/* ---------- type scale */
.t-large { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.022em; }
.t-title { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.t-title2 { font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.t-head { font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.t-body { font-size: 15px; }
.t-sub { font-size: 13px; line-height: 1.4; color: var(--text-2); }
.t-cap { font-size: 12px; line-height: 1.35; color: var(--text-3); }
.t-label { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- app shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 4px;
  padding: calc(20px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  border-right: 1px solid var(--line); background: var(--surface-2);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 17px; height: 17px; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: var(--r);
  color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none;
}
.nav a svg { width: 18px; height: 18px; color: var(--text-2); flex: none; }
.nav a:hover { background: var(--fill); }
.nav a[aria-current="page"] { background: var(--fill-strong); }
.nav a[aria-current="page"] svg { color: var(--text); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 10px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.conn-mini { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.conn-mini .who { min-width: 0; }
.conn-mini .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; padding: calc(32px + env(safe-area-inset-top)) calc(40px + env(safe-area-inset-right)) calc(64px + env(safe-area-inset-bottom)) 40px; }
.page { max-width: var(--content); margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .t-sub { margin-top: 4px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 8px; overflow-x: auto;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px; border-right: 0; border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-2) 88%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand { padding: 0 4px 0 0; }
  .brand-text, .nav-sep, .sidebar-foot, .nav .nav-label { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { min-height: 44px; min-width: 44px; justify-content: center; padding: 0 12px; }
  .nav a[aria-current="page"] .nav-label { display: inline; }
  .main { padding: 20px 16px calc(48px + env(safe-area-inset-bottom)); }
  .t-title { font-size: 26px; }
}

/* ---------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line); }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr { height: 1px; background: var(--line); border: 0; margin: 16px 0; }

/* ---------- controls */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: var(--r); border: 1px solid transparent; background: var(--fill); color: var(--text);
  font: 500 14px/1 var(--font); letter-spacing: -0.005em; cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background-color .15s ease, opacity .15s ease, transform .05s ease;
}
.btn:hover { background: var(--fill-strong); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-plain { background: transparent; color: var(--accent-text); padding: 0 8px; }
.btn-plain:hover { background: var(--accent-soft); }
.btn-outline { background: transparent; border-color: var(--line-strong); }
.btn-outline:hover { background: var(--fill); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-lg { min-height: 44px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn[disabled], .btn.is-busy { opacity: 0.5; pointer-events: none; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .hint, .switch .hint, .hint { font-size: 12px; color: var(--text-3); }
.grid > .field { margin-top: 0; }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: var(--r); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: 15px/1.35 var(--font); transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.input.mono { font-family: var(--mono); font-size: 13px; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2385858a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.field-error { font-size: 13px; color: var(--danger); }
.input-group { display: flex; gap: 8px; }

.segmented { display: inline-flex; align-self: flex-start; padding: 2px; border-radius: 9px; background: var(--fill); gap: 2px; }
.segmented button {
  appearance: none; border: 0; background: transparent; color: var(--text); min-height: 30px; padding: 0 12px; border-radius: 7px;
  font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
}
.segmented button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 0.5px rgba(0,0,0,.04); }
@media (prefers-color-scheme: dark) { .segmented button[aria-pressed="true"] { background: #636366; } }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  appearance: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text); font: 500 13px/1 var(--font); cursor: pointer;
}
.chip:hover { background: var(--fill); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .count { color: inherit; opacity: .6; font-variant-numeric: tabular-nums; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 42px; height: 26px; border-radius: 13px; background: var(--fill-strong); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }

.check { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; font-size: 14px; min-height: 32px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* ---------- status */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; display: inline-block; }
.dot.ok { background: var(--accent); }
.dot.warn { background: var(--warn-dot); }
.dot.bad { background: var(--danger); }
.dot.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--fill); font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--accent-text); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.status svg { width: 16px; height: 16px; }
.status.read { color: var(--accent-text); }
.status.failed, .status.expired { color: var(--danger); }
.status.canceled { color: var(--text-3); }

/* ---------- tables / lists */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table .msg-preview { max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.table-wrap { overflow-x: auto; }
@media (max-width: 720px) {
  .table.responsive thead { display: none; }
  .table.responsive tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.responsive tr:last-child { border-bottom: 0; }
  .table.responsive td { padding: 0; border: 0; }
  .table.responsive td.c-msg { grid-column: 1 / -1; }
  .table.responsive .msg-preview { max-width: none; }
  .table.responsive td.c-chev { display: none; }
}
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); min-height: 52px; }
.list > li:last-child { border-bottom: 0; }

.empty { text-align: center; padding: 48px 24px; }
.empty .glyph { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--text-3); }
.empty .t-head { margin-bottom: 4px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- stat tiles & chart */
.stat { padding: 16px 20px; }
.stat .value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .t-cap { margin-top: 2px; }
.chart { display: block; width: 100%; height: 120px; }
.chart-ticks { display: grid; margin-top: 6px; font-size: 11px; color: var(--text-3); text-align: center; white-space: nowrap; }
.chart-ticks span { overflow: visible; }
.grid-ov { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 860px) { .grid-ov { grid-template-columns: 1fr; } }
.chart .bar { fill: var(--accent); }
.chart .bar-fail { fill: var(--danger); }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--text-3); font: 11px var(--font); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }

/* ---------- avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--fill-strong); color: var(--text-2); display: grid; place-items: center; font-weight: 600; font-size: 15px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }

/* ---------- connect / QR */
.connect { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; padding: 32px; }
@media (max-width: 860px) { .connect { grid-template-columns: 1fr; padding: 20px; gap: 24px; } .connect .qr-col { order: -1; } }
.steps { list-style: none; counter-reset: s; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; font-size: 15px; }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-2); margin-top: 1px; }
.qr-col { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-box { position: relative; width: 300px; height: 300px; max-width: 100%; aspect-ratio: 1; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.qr-box img { width: 268px; height: 268px; max-width: 90%; max-height: 90%; image-rendering: pixelated; transition: opacity .3s; }
.qr-box .state { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: color-mix(in srgb, #fff 92%, transparent); color: #1d1d1f; }
.qr-box .state .t-sub { color: #5f5f64; }
.qr-box.dark-ok { background: var(--surface); }
.qr-box.dark-ok .state { background: var(--surface); color: var(--text); }
.qr-box.dark-ok .state .t-sub { color: var(--text-2); }
.code-boxes { display: flex; gap: 6px; justify-content: center; font: 600 28px/1 var(--mono); letter-spacing: 0; }
.code-boxes span { width: 34px; height: 46px; display: grid; place-items: center; border-radius: var(--r); background: var(--fill); }
.code-boxes .sep { width: 12px; background: transparent; color: var(--text-3); }
.progress { width: 220px; height: 4px; border-radius: 2px; background: var(--fill-strong); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .4s ease; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--fill-strong); border-top-color: var(--text-2); animation: spin .8s linear infinite; margin: 0 auto; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.success-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; margin: 0 auto; }
.success-mark svg { width: 28px; height: 28px; }

/* ---------- checklist */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line); }
.checklist .tick { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex: none; color: transparent; }
.checklist .done .tick { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.checklist .done .t-body { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.checklist .tick svg { width: 14px; height: 14px; }

/* ---------- code */
.code { position: relative; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; color: var(--text); white-space: pre; }
.code .copy { position: absolute; top: 8px; right: 8px; }
.code-tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--line); }
.code-tabs button { appearance: none; border: 0; background: transparent; padding: 8px 10px; font: 500 12px var(--font); color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.code-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.tok-s { color: #0f7a45; } .tok-k { color: #8a3ffc; } .tok-n { color: #b45309; } .tok-c { color: var(--text-3); }
@media (prefers-color-scheme: dark) { .tok-s { color: #7ee2a0; } .tok-k { color: #c7a4ff; } .tok-n { color: #ffc069; } }
.secret { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font: 13px var(--mono); overflow-wrap: anywhere; }
.secret span { flex: 1; min-width: 0; }

/* ---------- banners, toasts, dialogs */
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--text-2); }
.banner.warn svg { color: var(--warn-dot); }
.banner.bad { border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: var(--danger-soft); }
.banner.bad svg { color: var(--danger); }
.banner .grow > div + div { margin-top: 2px; }
.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { pointer-events: auto; min-width: 240px; max-width: min(520px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 12px; background: #1d1d1f; color: #f5f5f7; font-size: 14px; box-shadow: var(--shadow-pop); display: flex; gap: 10px; align-items: center; animation: toast-in .25s ease; }
.toast.bad { background: #8e1014; }
@media (prefers-color-scheme: dark) { .toast { background: #3a3a3c; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
dialog { border: 0; padding: 0; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); }
dialog:focus { outline: none; }
dialog::backdrop { background: rgba(0, 0, 0, 0.32); }
dialog.sheet { margin-right: 0; margin-top: 0; height: 100dvh; max-height: 100dvh; border-radius: 0; width: min(560px, 100vw); }
dialog.sheet[open] { animation: sheet-in .25s ease; }
@keyframes sheet-in { from { transform: translateX(24px); opacity: 0; } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dialog-body { padding: 20px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.ok::before { background: var(--accent); }
.timeline li.bad::before { background: var(--danger); }
.bubble { background: var(--accent-soft); border-radius: 12px 12px 4px 12px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }

/* ---------- auth screen */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(380px, 100%); }
.auth-card .brand-mark { width: 48px; height: 48px; border-radius: 12px; margin-bottom: 20px; }
.auth-card .brand-mark svg { width: 28px; height: 28px; }

.skeleton { background: linear-gradient(90deg, var(--fill) 0%, var(--fill-strong) 50%, var(--fill) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } }

/* ---------- ban protection */
.pill .pill-icon { width: 14px; height: 14px; }
.meters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 24px; }
@media (max-width: 860px) { .meters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.meter .bar { height: 4px; border-radius: 2px; background: var(--fill-strong); overflow: hidden; margin-top: 8px; }
.meter .bar > div { height: 100%; background: var(--accent); transition: width .4s ease; }
.meter.full .bar > div { background: var(--warn-dot); }
.signals { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.signals li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; color: var(--text); }
.signals li.info { color: var(--text-2); }
.signals .dot { transform: translateY(-1px); }
.hold-line { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--text-2); }
.hold-line svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.form-group + .form-group { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-group > .t-label { margin-bottom: 4px; }
.range { display: flex; align-items: center; gap: 8px; }
.range .input { width: 96px; }
.range .unit { color: var(--text-3); font-size: 14px; }
.optouts li .grow { min-width: 0; }
.switch.multi { align-items: flex-start; }
.switch.multi .track { margin-top: 1px; }
.switch .hint { display: block; margin-top: 2px; line-height: 1.4; }
.form-group .grid { margin-top: 12px; }
.form-group .grid-2 > .field > label { min-height: 18px; }
.form-group > .t-label + .field { margin-top: 12px; }
@media (max-width: 720px) {
  .acct-head { flex-wrap: wrap; }
  .acct-head > .grow { flex: 1 1 calc(100% - 96px); min-width: 0; }
  .acct-actions { flex-basis: 100%; justify-content: flex-start !important; }
}
@media (max-width: 560px) { .meters { grid-template-columns: 1fr; } }
.field > label.switch, .field > label.check { font-size: 14px; font-weight: 400; }
