/* Iron Veil dashboard
   No external fonts or assets: the Content-Security-Policy only allows this
   server. IBM Plex is used when it is installed, otherwise the system fonts. */

:root {
  color-scheme: dark;
  --bg:          #0f1012;
  --surface:     #141518;
  --surface-2:   #18191c;
  --surface-3:   #1d1f23;
  --border:      #222428;
  --border-2:    #2e3035;
  --border-3:    #383b41;
  --text:        #eceae4;
  --text-2:      #d6d3cb;
  --muted:       #a19f98;
  --faint:       #85837c;
  --accent:      #f0a63a;
  --accent-hi:   #ffb651;
  --accent-ink:  #1a1205;
  --accent-text: #f0a63a;
  --accent-soft: rgba(240, 166, 58, .13);
  --ok:          #6fcf8e;
  --ok-soft:     #1e2b22;
  --ok-line:     #3d6b4b;
  --warn:        #f0a63a;
  --warn-soft:   #2a2213;
  --warn-line:   #8a6227;
  --danger:      #f2624b;
  --danger-ink:  #1b0905;
  --danger-soft: #1e1412;
  --danger-line: #7a3328;
  --danger-text: #f7b4a8;
  --info:        #b9ccf2;
  --info-soft:   #20283a;
  --info-line:   #4f6fa8;
  --scrim:       rgba(5, 6, 8, .62);
  --shadow-lg:   0 18px 48px rgba(0, 0, 0, .5);
  --radius:      10px;
  --radius-sm:   6px;
  --spring:      cubic-bezier(.34, 1.5, .5, 1);
  --out:         cubic-bezier(.2, .8, .2, 1);
  --mono: "IBM Plex Mono", "Cascadia Mono", "JetBrains Mono", Consolas, ui-monospace, Menlo, monospace;
  --sans: "IBM Plex Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f4f0; --surface: #ffffff; --surface-2: #f2f1ec; --surface-3: #e9e7e1;
    --border: #e2e0d9; --border-2: #d4d1c8; --border-3: #c3bfb4;
    --text: #17171a; --text-2: #2c2c30; --muted: #5e5c56; --faint: #6f6c65;
    --accent: #e89a2c; --accent-hi: #f2a93b; --accent-ink: #1a1205; --accent-text: #8f5300; --accent-soft: rgba(232, 154, 44, .16);
    --ok: #1c7a3d; --ok-soft: #e1f2e6; --ok-line: #9cccab;
    --warn: #8f5300; --warn-soft: #fbefd9; --warn-line: #e0b26b;
    --danger: #c8361f; --danger-ink: #ffffff; --danger-soft: #fbe6e1; --danger-line: #e9a597; --danger-text: #a52a16;
    --info: #24508f; --info-soft: #e3ebf8; --info-line: #9bb5df;
    --scrim: rgba(20, 20, 24, .4); --shadow-lg: 0 18px 48px rgba(20, 20, 24, .18);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f4f0; --surface: #ffffff; --surface-2: #f2f1ec; --surface-3: #e9e7e1;
  --border: #e2e0d9; --border-2: #d4d1c8; --border-3: #c3bfb4;
  --text: #17171a; --text-2: #2c2c30; --muted: #5e5c56; --faint: #6f6c65;
  --accent: #e89a2c; --accent-hi: #f2a93b; --accent-ink: #1a1205; --accent-text: #8f5300; --accent-soft: rgba(232, 154, 44, .16);
  --ok: #1c7a3d; --ok-soft: #e1f2e6; --ok-line: #9cccab;
  --warn: #8f5300; --warn-soft: #fbefd9; --warn-line: #e0b26b;
  --danger: #c8361f; --danger-ink: #ffffff; --danger-soft: #fbe6e1; --danger-line: #e9a597; --danger-text: #a52a16;
  --info: #24508f; --info-soft: #e3ebf8; --info-line: #9bb5df;
  --scrim: rgba(20, 20, 24, .4); --shadow-lg: 0 18px 48px rgba(20, 20, 24, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.2px; }
p { margin: 0; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mono  { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.num   { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow  { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }
.row   { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ── Boot ───────────────────────────────────────────────── */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); }
.boot-mark, .brand-mark {
  width: 30px; height: 30px; border-radius: 6px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font: 600 13px var(--mono); letter-spacing: -.5px;
}
.boot-mark::after, .brand-mark::after { content: "FS"; }
.boot-mark { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.9); opacity: .6; } }

/* ── Entrance motion ────────────────────────────────────── */
.rise { animation: rise .55s var(--out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--border-3); border-radius: var(--radius-sm);
  background: transparent; color: var(--text);
  font-weight: 500; font-size: 13px; text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s, transform .09s;
}
.btn:hover { background: var(--surface-3); border-color: var(--faint); }
.btn:active { transform: translateY(1px) scale(.97); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.btn.block { width: 100%; min-height: 48px; font-size: 15px; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.danger { color: var(--danger-text); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); font-weight: 600; }
.btn.danger.solid:hover { filter: brightness(1.08); }
.btn.selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.btn.done { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.btn.lit { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }

.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hold-to-confirm: fills while held, springs back if released early. */
.hold {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--danger-line); border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger-text);
  font-weight: 600; font-size: 13px; cursor: pointer;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.hold .hold-fill {
  position: absolute; inset: 0; z-index: -1; background: var(--danger);
  transform: scaleX(0); transform-origin: left;
  transition: transform .45s var(--spring);
}
.hold.holding .hold-fill { transition: none; }
.hold.armed { color: var(--danger-ink); }
.hold.nudge { animation: shake .34s; }
.hold:disabled { opacity: .55; cursor: not-allowed; }

/* ── Inputs ─────────────────────────────────────────────── */
.input {
  width: 100%; min-height: 42px; padding: 0 12px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  transition: border-color .15s, background .15s;
}
.input:hover { border-color: var(--border-3); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.input:disabled { opacity: .55; }
.input.sm { width: 84px; min-height: 34px; padding: 0 8px; font-size: 13px; }
select.input.sm { width: 104px; }
.input.mono { font-family: var(--mono); letter-spacing: .8px; font-size: 14px; }
textarea.input { min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.hint { font-size: 12px; color: var(--faint); }
.form-error {
  display: none; margin-bottom: 16px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger-text); font-size: 13px;
}
.form-error.show { display: block; animation: rise .3s var(--out); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }

/* Switch */
.switch { position: relative; display: inline-flex; width: 60px; height: 40px; flex: none; cursor: pointer; align-items: center; justify-content: center; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: inherit; }
.switch .track { position: relative; width: 46px; height: 24px; border-radius: 12px; background: var(--border-3); transition: background .25s; pointer-events: none; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 9px;
  background: var(--text); transition: transform .38s var(--spring), width .15s, background .25s;
}
.switch:active .track::after { width: 22px; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(22px); background: var(--accent-ink); }
.switch:active input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 3px; }
.switch input:disabled + .track { opacity: .45; }
.switch:has(input:disabled) { cursor: not-allowed; }

/* ── Badges & pills ─────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin-right: 4px;
  border-radius: 11px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.badge.ok     { background: var(--ok-soft); color: var(--ok); }
.badge.warn   { background: transparent; color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn-line); }
.badge.danger { background: var(--danger); color: var(--danger-ink); }
.badge.info   { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px; max-width: 100%;
  border-radius: 4px; border: 1px solid var(--border-2); background: var(--surface-3);
  font: 500 12px var(--mono); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 15px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.on  { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--warn-line); }
.pill.off { background: var(--surface-3); color: var(--muted); }

.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: ping 2s cubic-bezier(0, 0, .2, 1) infinite; }
.pulse.off { background: var(--faint); }
.pulse.off::after { animation: none; }
.pulse.bad { background: var(--danger); }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(2.8); opacity: 0; } }

.ping-good { color: var(--muted); }
.ping-mid  { color: var(--warn); }
.ping-bad  { color: var(--danger); }

/* ── Shell ──────────────────────────────────────────────── */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar {
  flex: 1 1 236px; max-width: 100%;
  padding: 20px 14px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin: 14px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .9px; text-transform: uppercase; color: var(--faint); }
.nav-group:first-child { margin-top: 0; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px;
  border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--surface-3); color: var(--text); }
.nav a::after {
  content: ""; position: absolute; right: 12px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); opacity: 0; transform: scale(.3); transition: opacity .2s, transform .3s var(--spring);
}
.nav a.active::after { opacity: 1; transform: scale(1); }
.nav a.active .count { margin-right: 14px; }
.nav .count { margin-left: auto; font: 500 12px var(--mono); color: var(--muted); }
.sidebar-foot { margin-top: auto; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--surface-3); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font: 500 12px var(--mono); text-transform: uppercase;
}
.me-name { font-weight: 600; font-size: 13px; }
.me .muted { font-size: 12px; }

.main { flex: 999 1 560px; min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 56px; display: flex; flex-direction: column; gap: 22px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; }
.topbar h2 { font-size: 26px; letter-spacing: -.3px; }
.topbar .sub { margin-top: 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 13px; color: var(--muted); }
.topbar .sub .live-txt { color: var(--text); }
.topbar .sub .sep { color: var(--faint); }
.content { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.content > * { animation: rise .5s var(--out) both; }
.content > *:nth-child(2) { animation-delay: 60ms; }
.content > *:nth-child(3) { animation-delay: 120ms; }
.content > *:nth-child(4) { animation-delay: 180ms; }

.banner { padding: 12px 16px; border-radius: 8px; font-size: 13.5px; border: 1px solid; animation: rise .4s var(--out); }
.banner.warn   { background: var(--warn-soft); border-color: var(--warn-line); color: var(--text); }
.banner.danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-text); }

/* ── Cards ──────────────────────────────────────────────── */
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.card-head h3 { font-size: 15px; }
.card-head p { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 4px 20px 20px; }
.card > .btn, .card > .row { margin: 0 20px 20px; }

.split { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.split > .card { flex: 999 1 540px; }
.split > .stack { flex: 1 1 300px; }

/* Stat strip: one bordered band, hairline dividers. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.stats .stat { border: 0; border-radius: 0; background: none; padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border); }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font: 500 34px/1 var(--mono); letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 16px; color: var(--faint); letter-spacing: 0; }
.stat-value.hot { color: var(--danger); }
.stat-value.bump { animation: bump .5s var(--spring); }
@keyframes bump { 40% { transform: translateY(-3px); color: var(--accent-text); } }

/* ── Live feed ──────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: grid; grid-template-columns: 74px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.6fr) auto;
  gap: 16px; align-items: center; min-height: 54px; padding: 8px 20px; border-top: 1px solid var(--border); font-size: 13px;
  transition: background .15s;
}
.feed-item:hover { background: var(--surface-2); }
.feed-time { font: 400 12px var(--mono); color: var(--muted); }
.feed-who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.feed-who b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-who span { font: 400 12px var(--mono); color: var(--faint); }
.feed-meta { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-head { min-height: 36px; padding-top: 0; padding-bottom: 0; font-size: 12px; color: var(--faint); background: var(--surface-2); }
.feed-head:hover { background: var(--surface-2); }
.fresh { animation: slidein .5s cubic-bezier(.25, 1.2, .4, 1) both, flash 2.6s ease-out both; }
@keyframes slidein { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes flash { 0%, 20% { background: var(--accent-soft); } 100% { background: transparent; } }
@media (max-width: 760px) {
  .feed-item { grid-template-columns: 60px minmax(0, 1fr) auto; }
  .feed-item .hide-s { display: none; }
}

/* Top rules meter */
.meters { display: flex; flex-direction: column; gap: 14px; }
.meter-row { display: flex; flex-direction: column; gap: 6px; }
.meter-row .row { justify-content: space-between; font: 400 13px var(--mono); }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transform-origin: left; transition: transform .8s var(--out); }

/* ── Tables ─────────────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 20px 14px; }
.toolbar .input[type="search"] { max-width: 340px; }
.toolbar select.input { width: auto; min-width: 200px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--faint);
  padding: 9px 14px; background: var(--surface-2); border-top: 1px solid var(--border); white-space: nowrap;
}
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
td { padding: 11px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background .15s, opacity .3s, transform .3s; }
tbody tr:hover { background: var(--surface-2); }
tr.clickable { cursor: pointer; }
tr.clickable.selected { background: var(--surface-3); }
tr.leaving { opacity: 0; transform: translateX(24px); }
td.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }
.cell-name { font-weight: 500; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
.cell-detail { max-width: 420px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.who { display: flex; align-items: center; gap: 10px; }
.who .avatar { width: 30px; height: 30px; }

.group-row td { background: var(--surface-2); font-size: 11.5px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); padding-top: 8px; padding-bottom: 8px; }
.rule-name { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.rule-changed { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.rule-desc { font-size: 12px; color: var(--muted); max-width: 440px; }

/* ── Callouts & settings ────────────────────────────────── */
.callout { padding: 14px 16px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface); font-size: 13.5px; color: var(--text-2); line-height: 1.55; }
.callout.warn { border-color: var(--warn-line); background: var(--warn-soft); }
.callout pre { margin: 10px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-3); white-space: pre-wrap; font-size: 12.5px; color: var(--text); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-top: 1px solid var(--border); }
.setting-row:first-child { border-top: 0; padding-top: 4px; }
.setting-row h4 { font-size: 14px; }
.setting-row p { margin-top: 3px; font-size: 12.5px; color: var(--muted); max-width: 560px; }
.enf { border-radius: 8px; padding: 2px 16px; border: 1px solid var(--border-2); transition: border-color .3s, background .3s; }
.enf.on { border-color: var(--warn-line); background: var(--accent-soft); }
.savebar {
  position: sticky; bottom: 16px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px 10px 18px; border-radius: 10px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  animation: pop .45s var(--spring) both;
}
.savebar .btn { color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }
.savebar .btn:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); }
.savebar .btn.primary { color: var(--accent-ink); border-color: var(--accent); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }

/* Bypass picker */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin-top: 14px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); cursor: pointer; transition: background .15s, border-color .15s; }
.check:hover { background: var(--surface-2); }
.check:has(input:checked) { border-color: var(--warn-line); background: var(--accent-soft); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
td .tags { margin-top: 0; }

/* ── Key/value lists ────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; margin: 0; font-size: 13px; }
.kv dt { color: var(--faint); font-size: 12px; }
.kv dd { margin: 0; min-width: 0; }

/* ── Drawer ─────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 30; background: var(--scrim); animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 31;
  width: min(440px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border-2); box-shadow: var(--shadow-lg);
  animation: drawer .42s cubic-bezier(.2, 1.05, .3, 1) both;
}
.drawer.closing { animation: drawer-out .22s ease-in both; }
.scrim.closing { animation: fade .22s ease reverse both; }
@keyframes drawer { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes drawer-out { to { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.drawer-head .avatar { width: 46px; height: 46px; background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 600; }
.drawer-head h3 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-head .row { margin-top: 4px; font-size: 12px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 22px 24px; }
.drawer-section { padding: 18px 0; border-top: 1px solid var(--border); }
.drawer-section:first-child { border-top: 0; }
.drawer-section > * { animation: rise .45s var(--out) both; }
.drawer-section h4 { font-size: 12px; font-weight: 500; color: var(--faint); margin-bottom: 12px; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.action-grid .btn { min-height: 44px; }
.ban-box { display: flex; flex-direction: column; gap: 10px; }
.ban-box .hold { width: 100%; min-height: 48px; }

/* ── Modals ─────────────────────────────────────────────── */
.modal-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--scrim); animation: fade .2s ease both; }
.modal {
  width: min(480px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: modal .38s var(--spring) both;
}
.modal.wide { width: min(880px, 100%); }
@keyframes modal { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-head { padding: 20px 22px 6px; }
.modal-head h3 { font-size: 17px; }
.modal-head p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.modal-body { padding: 14px 22px 4px; overflow-y: auto; }
.modal-body > p.muted { margin-bottom: 12px; line-height: 1.55; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 22px 20px; }
.shot { display: block; width: 100%; border-radius: 8px; margin-bottom: 12px; }
.shot-loading { padding: 36px 0; text-align: center; color: var(--muted); }

/* ── Toasts ─────────────────────────────────────────────── */
#toasts { position: fixed; left: 50%; bottom: 24px; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: 8px; max-width: 520px;
  background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toast .5s cubic-bezier(.2, 1.3, .4, 1) both;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ok); }
.toast.warn::before { background: var(--accent); }
.toast.error { background: var(--danger); color: var(--danger-ink); }
.toast.error::before { background: currentColor; }
.toast.out { animation: toast-out .25s ease-in both; }
@keyframes toast { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ── Auth ───────────────────────────────────────────────── */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-side {
  flex: 1 1 420px; padding: clamp(28px, 5vw, 64px); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.auth-side h1 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -.8px; max-width: 460px; }
.auth-side p { margin-top: 18px; font-size: 16px; line-height: 1.55; color: var(--muted); max-width: 440px; }
.auth-facts { display: flex; flex-direction: column; gap: 8px; font: 400 12px var(--mono); color: var(--faint); }
.brand-row { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.auth-main { flex: 1 1 420px; padding: clamp(28px, 5vw, 64px); display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; }
.auth-card > h2 { font-size: 22px; }
.auth-card > .lead { margin-top: -14px; font-size: 14px; color: var(--muted); }
.auth-card form .field:last-of-type { margin-bottom: 20px; }
.auth-note { font-size: 13px; color: var(--faint); line-height: 1.5; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.linkish:hover { color: var(--accent-hi); }
.auth-card .input { min-height: 48px; font-size: 15px; padding: 0 14px; }
.auth-card .input.mono { font-size: 16px; text-transform: uppercase; }
.shake { animation: shake .4s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }

.seg { position: relative; display: flex; padding: 4px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.seg button { position: relative; z-index: 1; flex: 1; min-height: 42px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 500; cursor: pointer; transition: color .2s; }
.seg button.on { color: var(--text); }
.seg .seg-slider { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 6px; background: var(--surface-3); transition: transform .42s var(--spring); }
.seg.right .seg-slider { transform: translateX(100%); }

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.eye { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 42px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.eye:hover { color: var(--text); background: var(--surface-3); }
.eye svg { width: 18px; height: 18px; }

.groups { display: flex; gap: 6px; }
.groups i { flex: 1; height: 3px; border-radius: 2px; background: var(--border-2); transition: background .2s, transform .35s cubic-bezier(.34, 1.8, .5, 1); }
.groups i.full { background: var(--accent); transform: scaleY(1.7); }
.strength { display: flex; align-items: center; gap: 10px; }
.strength .bars { flex: 1; display: flex; gap: 4px; }
.strength .bars i { flex: 1; height: 4px; border-radius: 2px; background: var(--border-2); transition: background .25s; }
.strength span { min-width: 110px; text-align: right; font-size: 12px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 760px) {
  /* Phone: the menu becomes one scrollable row. Log out lives under My account. */
  .sidebar { flex-basis: 100%; padding: 12px 12px 0; gap: 10px; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav { flex-direction: row; gap: 4px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
  .nav-group, .sidebar-foot, .nav a::after { display: none; }
  .nav a { flex: none; min-height: 38px; }
  .nav a.active { background: var(--accent-soft); color: var(--accent-text); }
  .main { padding-top: 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat { padding: 16px; }
  .topbar h2 { font-size: 22px; }
  .stat-value { font-size: 28px; }
  .kv { grid-template-columns: 80px minmax(0, 1fr) auto; }
}
