/* ---------- tokens ---------- */
:root {
  --bg: #f4f5f9;
  --bg-elev: #ffffff;
  --bg-sub: #f0f1f6;
  --border: #e3e5ee;
  --border-strong: #cfd3e0;
  --text: #16181f;
  --text-2: #4b5063;
  --muted: #7a8097;
  --accent: #4f5df0;
  --accent-2: #6d7cff;
  --accent-soft: rgba(79, 93, 240, 0.12);
  --green: #1fa971;
  --green-soft: rgba(31, 169, 113, 0.14);
  --amber: #d98b07;
  --amber-soft: rgba(217, 139, 7, 0.14);
  --red: #e0453c;
  --red-soft: rgba(224, 69, 60, 0.14);
  --blue: #2b7fd9;
  --blue-soft: rgba(43, 127, 217, 0.14);
  --shadow: 0 1px 2px rgba(20, 24, 40, 0.05), 0 8px 24px -12px rgba(20, 24, 40, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 232px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
:root[data-theme="dark"], :root:not([data-theme="light"]) {
  --bg: #0f1117;
  --bg-elev: #171a23;
  --bg-sub: #1d2130;
  --border: #262a3a;
  --border-strong: #353a4f;
  --text: #e8eaf2;
  --text-2: #b4b9cc;
  --muted: #7c829a;
  --accent: #7c88ff;
  --accent-2: #9aa3ff;
  --accent-soft: rgba(124, 136, 255, 0.16);
  --green: #38c58a;
  --green-soft: rgba(56, 197, 138, 0.16);
  --amber: #f0a92c;
  --amber-soft: rgba(240, 169, 44, 0.16);
  --red: #f0635a;
  --red-soft: rgba(240, 99, 90, 0.16);
  --blue: #5aa2f2;
  --blue-soft: rgba(90, 162, 242, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
}
:root[data-theme="light"] {
  --bg: #f4f5f9; --bg-elev: #ffffff; --bg-sub: #f0f1f6; --border: #e3e5ee; --border-strong: #cfd3e0;
  --text: #16181f; --text-2: #4b5063; --muted: #7a8097; --accent: #4f5df0; --accent-2: #6d7cff; --accent-soft: rgba(79,93,240,.12);
  --green: #1fa971; --green-soft: rgba(31,169,113,.14); --amber: #d98b07; --amber-soft: rgba(217,139,7,.14);
  --red: #e0453c; --red-soft: rgba(224,69,60,.14); --blue: #2b7fd9; --blue-soft: rgba(43,127,217,.14);
  --shadow: 0 1px 2px rgba(20,24,40,.05), 0 8px 24px -12px rgba(20,24,40,.12);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
p { margin: 0 0 8px; }
a { color: var(--accent); text-decoration: none; }
a.link:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: var(--bg-sub); padding: 1px 5px; border-radius: 5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.grow { flex: 1; }
[hidden] { display: none !important; }
body.unauthed .auth-only { display: none !important; }
body.authed #login { display: none !important; }

/* ---------- controls ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type="checkbox"]):not([type="file"]), select, textarea {
  background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 10px; outline: none; transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; font-family: var(--mono); font-size: 12px; resize: vertical; }
label { display: inline-flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
label > input, label > select { font-size: 13px; color: var(--text); }
label.ck { flex-direction: row; align-items: center; gap: 6px; cursor: pointer; }
label.ck input { accent-color: var(--accent); width: 15px; height: 15px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 12px; font-weight: 500; transition: background 120ms var(--ease), transform 100ms var(--ease), border-color 120ms var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-sub); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-sub); color: var(--text); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.icon-btn { padding: 6px 9px; font-size: 15px; }
.segmented { display: inline-flex; background: var(--bg-sub); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }
.segmented button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--text-2); font-weight: 500; font-size: 12px; }
.segmented button.on { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar label { flex-direction: row; align-items: center; gap: 6px; }
.toolbar .lbl { font-size: 12px; color: var(--muted); margin-right: 2px; }

/* switch */
.switch { position: relative; width: 34px; height: 20px; border-radius: 20px; background: var(--border-strong); border: 0; cursor: pointer; padding: 0; transition: background 150ms var(--ease); flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 150ms var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(14px); }
.switch.accent.on { background: var(--accent); }
.switch:disabled { opacity: .45; cursor: not-allowed; }

/* pills / chips */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--bg-sub); color: var(--text-2); white-space: nowrap; }
.pill.ok, .pill.on { background: var(--green-soft); color: var(--green); }
.pill.off { background: var(--bg-sub); color: var(--muted); }
.pill.warn, .pill.test { background: var(--amber-soft); color: var(--amber); }
.pill.err { background: var(--red-soft); color: var(--red); }
.pill.info { background: var(--blue-soft); color: var(--blue); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--bg-sub); border: 1px solid var(--border); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.green .dot, .dot.green { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.amber .dot, .dot.amber { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.red .dot, .dot.red { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--bg-elev); border-right: 1px solid var(--border); padding: 18px 14px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; padding: 0 6px; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #9c6bff); flex: none; position: relative; }
.logo::after { content: ""; position: absolute; inset: 7px; border: 2.5px solid #fff; border-radius: 3px; border-right-color: transparent; border-bottom-color: transparent; transform: rotate(45deg); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; transition: background 120ms var(--ease), color 120ms var(--ease); }
.nav a:hover { background: var(--bg-sub); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.ic { width: 16px; height: 16px; display: inline-block; background: currentColor; flex: none; opacity: .9;
  -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.ic-pulse { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h4l3-8 4 16 3-8h4'/%3E%3C/svg%3E"); }
.ic-grid { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E"); }
.ic-route { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='5' cy='6' r='2.5'/%3E%3Ccircle cx='19' cy='18' r='2.5'/%3E%3Cpath d='M7.5 6H14a4 4 0 0 1 0 8H10a4 4 0 0 0 0 8h6.5'/%3E%3C/svg%3E"); }
.ic-send { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'%3E%3Cpath d='M21 3L10 14M21 3l-7 18-4-7-7-4z'/%3E%3C/svg%3E"); }
.ic-list { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E"); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.who { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
#nav-toggle { display: none; }
.page { display: flex; flex-direction: column; gap: 16px; padding: 20px 24px; animation: fade 180ms var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
footer { padding: 16px 24px 24px; }
.banner { margin: 12px 24px 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); font-weight: 500; }
.banner.err { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }

/* ---------- cards ---------- */
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { margin-top: 12px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-sub); display: flex; flex-direction: column; gap: 8px; }

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: .7; }
.kpi.good::before { background: var(--green); } .kpi.warn::before { background: var(--amber); } .kpi.bad::before { background: var(--red); }
.k-val { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.k-val.k-na { color: var(--muted); font-size: 18px; }
.k-lbl { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* pipeline */
.pipeline { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 6px 2px; }
.pnode { flex: 1 1 0; min-width: 120px; background: var(--bg-sub); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; transition: border-color 120ms var(--ease), transform 100ms var(--ease); display: flex; flex-direction: column; gap: 4px; }
.pnode:hover { border-color: var(--accent); }
.pnode:active { transform: scale(.985); }
.pnode.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pnode .ttl { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; }
.pnode .sub { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pedge { flex: 0 0 auto; width: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: 10.5px; font-family: var(--mono); gap: 2px; }
.pedge .line { width: 100%; height: 2px; background: linear-gradient(90deg, var(--border-strong), var(--accent)); position: relative; border-radius: 2px; }
.pedge .line::after { content: ""; position: absolute; right: -1px; top: -3px; border: 4px solid transparent; border-left: 6px solid var(--accent); }
.pstack { display: flex; flex-direction: column; gap: 8px; flex: 1 1 0; min-width: 120px; }
.node-detail { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-sub); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.node-detail .note { width: 100%; color: var(--amber); font-size: 12px; }

/* charts */
.chart-wrap { position: relative; }
.chart { width: 100%; height: 180px; display: block; }
.chart .bar { fill: var(--accent); opacity: .85; transition: opacity 100ms; }
.chart .bar.fail { fill: var(--red); }
.chart .bar:hover { opacity: 1; }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .chart-empty { fill: var(--muted); font-size: 13px; }
.chart .ylabel { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 10.5px; font-family: var(--mono); margin-top: 4px; }

/* routing buckets */
.route-row { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; padding: 6px 0; }
.route-row .track { height: 10px; background: var(--bg-sub); border-radius: 6px; overflow: hidden; }
.route-bar { height: 100%; border-radius: 6px; background: var(--accent); transition: width 400ms var(--ease); min-width: 2px; }
.route-bar.sent_standard { background: var(--green); }
.route-bar.sent_custom { background: var(--blue); }
.route-bar.internal_only { background: var(--muted); }
.route-bar.sensitive_blocked { background: var(--amber); }
.route-bar.dlq { background: var(--red); }

/* tables */
.table-scroll { overflow: auto; max-height: 520px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-sub); color: var(--muted); font-weight: 500; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
thead th.num { text-align: right; }
tbody td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
td.fields { font-family: var(--mono); font-size: 11px; color: var(--muted); word-break: break-all; max-width: 460px; }
td.msg { max-width: 520px; }
td.trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lvl-WARN { color: var(--amber); font-weight: 600; } .lvl-ERROR { color: var(--red); font-weight: 600; } .lvl-INFO { color: var(--blue); } .lvl-DEBUG { color: var(--muted); }
.stat-failed { color: var(--red); font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--bg-elev); border-radius: 999px; padding: 3px 10px 3px 4px; font-size: 12px; cursor: pointer; }
.badge:hover { border-color: var(--accent); }
.badge .c { background: var(--amber-soft); color: var(--amber); border-radius: 999px; padding: 1px 7px; font-weight: 600; font-family: var(--mono); font-size: 11px; }
.badge.err .c { background: var(--red-soft); color: var(--red); }
.badge.dlq .c { background: var(--red-soft); color: var(--red); }

/* strips (auto-send / routing status) */
.strip { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 12px; background: var(--bg-sub); border-radius: var(--radius-sm); font-size: 12.5px; }
.lane { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lane strong { font-weight: 600; }
.as-on { color: var(--green); font-weight: 600; } .as-off { color: var(--red); font-weight: 600; }
.lane-err { color: var(--red); }

/* picker */
.picker { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elev); display: flex; flex-direction: column; }
.picker-search { border: 0 !important; border-bottom: 1px solid var(--border) !important; border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important; }
.picker-toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.picker-count { margin-left: auto; }
.picker-list { max-height: 240px; overflow: auto; padding: 4px; }
.picker-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--text); }
.picker-row:hover { background: var(--bg-sub); }
.picker-row.disabled { color: var(--muted); cursor: not-allowed; }
.picker-row input { accent-color: var(--accent); }
.picker-lbl { flex: 1; } .picker-tag { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.picker-empty { padding: 10px; }

/* push */
.push-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.preview-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--bg-sub); display: flex; flex-direction: column; gap: 8px; }
.notes { display: flex; flex-direction: column; gap: 4px; }
.note { padding: 6px 10px; border-radius: 6px; background: var(--bg-sub); font-size: 12.5px; }
.note.ok { background: var(--green-soft); color: var(--green); }
.note.err { background: var(--red-soft); color: var(--red); }
.note.warn { background: var(--amber-soft); color: var(--amber); }
.mini-table { width: 100%; font-size: 12px; }
.mini-table th { background: transparent; position: static; }
.job-running { color: var(--blue); font-weight: 600; } .job-queued { color: var(--amber); } .job-completed { color: var(--green); } .job-failed, .job-cancelled { color: var(--red); }
.oc-sent_ok { color: var(--green); } .oc-meta_rejected, .oc-retryable_exhausted { color: var(--red); } .oc-too_old, .oc-skipped_already_sent, .oc-skipped_bad_device, .oc-blocked { color: var(--muted); }
.pivot-wrap { overflow: auto; max-height: 420px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pivot th, .pivot td { white-space: nowrap; }
.pivot .pivot-pin { position: sticky; left: 0; background: var(--bg-elev); z-index: 2; }
.pivot thead .pivot-pin { z-index: 3; background: var(--bg-sub); }
.pivot .pivot-total { font-weight: 600; background: var(--bg-sub); }
.pivot .pivot-total-row td { font-weight: 600; background: var(--bg-sub); }
.results-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 8px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.form-status { min-height: 18px; font-size: 12.5px; color: var(--red); }

/* dialog + toasts */
.dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow); max-width: 520px; width: calc(100% - 32px); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(2px); }
.dialog form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body { font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; display: flex; flex-direction: column; gap: 8px; }
.dialog-body .secret { display: flex; gap: 6px; align-items: center; }
.dialog-body .secret code { flex: 1; word-break: break-all; padding: 8px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--bg-elev); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 13px; max-width: 360px; animation: rise 160ms var(--ease); }
.toast.ok { border-left-color: var(--green); } .toast.err { border-left-color: var(--red); } .toast.warn { border-left-color: var(--amber); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .grid-2, .push-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 20; width: var(--sidebar-w); transform: translateX(-100%); transition: transform 200ms var(--ease); }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  #nav-toggle { display: inline-flex; }
  .page, .topbar, footer { padding-left: 16px; padding-right: 16px; }
  .banner { margin-left: 16px; margin-right: 16px; }
  .route-row { grid-template-columns: 110px 1fr 56px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
