:root, [data-theme="dark"] {
  --bg: #0D1117; --side: #0A0D12; --panel: #151A21; --panel2: #1B212A; --border: #262D36;
  --text: #E6EAF0; --muted: #9AA4B1; --accent: #7AA2F7; --on-accent: #0B1020; --nav-on: #1F2733;
  --track: #252C36; --ok: #3FB950; --warn: #D7A22A; --err: #FF7B72; --row-on: #1B2230;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F5F7FA; --side: #FFFFFF; --panel: #FFFFFF; --panel2: #F3F5F8; --border: #DCE1E8;
  --text: #1C2128; --muted: #57606A; --accent: #2F5FD0; --on-accent: #FFFFFF; --nav-on: #E8EEFB;
  --track: #E4E8EE; --ok: #1A7F37; --warn: #8A5A00; --err: #C4251C; --row-on: #EEF3FD;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 'IBM Plex Sans', system-ui, sans-serif; }
a { color: var(--accent); }
.mono, .num { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.muted { color: var(--muted); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .err { color: var(--err); } .run { color: var(--accent); }
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 220px; max-width: 260px; padding: 20px 14px; background: var(--side); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 800px) { .side { max-width: none; } }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.logo { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: var(--on-accent); }
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 11px; }
.side a.nav { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--muted); }
.side a.nav:hover { color: var(--text); background: var(--nav-on); }
.side a.nav.on { background: var(--nav-on); color: var(--text); font-weight: 600; }
.side .grow { flex: 1; }
.side form { margin: 0; }
main { flex: 999 1 560px; min-width: 0; padding: 24px clamp(16px, 3vw, 40px) 48px; display: flex; flex-direction: column; gap: 20px; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.top h1 { margin: 0; font-size: 24px; font-weight: 600; flex: 1 1 240px; }
.top .sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.switch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; }
@media (max-width: 520px) { .theme-btn .t-label { display: none; } .switch select { flex: 1 1 120px; min-width: 0; } }
.switch label { color: var(--muted); font-size: 13px; }
select, textarea, input[type=text], input[type=number], input[type=password], input[type=search], input:not([type]) {
  min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--nav-on); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel h2 { margin: 0; font-size: 16px; font-weight: 600; }
.panel h3 { margin: 0; font-size: 14px; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.row > .wide { flex: 3 1 560px; } .row > .narrow { flex: 1 1 300px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.tile .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tile .value { font-size: 26px; font-weight: 600; font-family: 'IBM Plex Mono', monospace; }
.tile .sub { font-size: 12px; color: var(--muted); }
.tile .sub.ok { color: var(--ok); } .tile .sub.warn { color: var(--warn); } .tile .sub.err { color: var(--err); } .tile .sub.run { color: var(--accent); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 500; padding: 8px; }
td { padding: 10px 8px; border-top: 1px solid var(--border); vertical-align: top; }
td.c, th.c { text-align: center; }
td.r, th.r { text-align: right; }
td.num, th { white-space: nowrap; }
tr.off td { opacity: .45; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid currentColor; font-size: 12px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; flex-shrink: 0; }
.bar { height: 8px; border-radius: 6px; background: var(--track); overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); border-radius: 6px; transition: width .6s; }
.bar.thin { height: 5px; }
.flash { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.flash.error { border-color: var(--err); color: var(--err); background: color-mix(in srgb, var(--err) 8%, transparent); }
.events { display: flex; flex-direction: column; }
.event { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.event .dot { margin-top: 7px; }
.live-run { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.live-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 22px; font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.stats span span { color: var(--muted); }
.accts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.acct { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; min-width: 0; }
.acct .now { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.svc label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.crumbs a { text-decoration: none; }
.mailhead { display: grid; grid-template-columns: 90px 1fr; gap: 4px 12px; font-size: 13px; }
.mailhead dt { color: var(--muted); } .mailhead dd { margin: 0; overflow-wrap: anywhere; }
iframe.mail { width: 100%; min-height: 520px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
pre { margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel2); overflow: auto; font: 12.5px/1.5 'IBM Plex Mono', monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.form { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form .inline { flex-direction: row; align-items: center; gap: 10px; color: var(--text); }
.sr { position: absolute; left: -9999px; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .panel { width: 100%; max-width: 380px; }
details summary { cursor: pointer; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.impersonate { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: center; padding: 8px 16px;
  background: var(--warn); color: #1a1300; font-size: 13px; }
.impersonate .btn { border-color: #1a1300; color: #1a1300; }
.impersonate .btn:hover, .impersonate .btn:active { background: rgba(26,19,0,.12); color: #1a1300; }
.impersonate .btn:focus-visible { outline: 2px solid #1a1300; outline-offset: 2px; }
.impersonate form { margin: 0; }
.login details { display: flex; flex-direction: column; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
@media (max-width: 800px) { .side { position: static; height: auto; } }
.theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: inline; }
[data-theme="dark"] .theme-btn .i-moon { display: none; }
.login { position: relative; }
.login-theme { position: absolute; top: 16px; right: 16px; }
.days { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.picker { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 0; }
.code-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.bigcode { font-size: 30px; font-weight: 600; letter-spacing: .12em; padding: 6px 16px; border: 1px dashed var(--accent); border-radius: 10px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
dialog.confirm { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--text);
  padding: 22px 24px 18px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.45); }
dialog.confirm::backdrop { background: rgba(5, 8, 12, .55); backdrop-filter: blur(2px); }
dialog.confirm form { display: flex; flex-direction: column; gap: 18px; margin: 0; }
.confirm-msg { margin: 0; font-size: 15px; line-height: 1.5; }
.confirm-btns { display: flex; justify-content: flex-end; gap: 10px; }
.btn.danger-solid { background: var(--err); border-color: var(--err); color: #fff; font-weight: 600; }
.btn.danger-solid:hover { filter: brightness(1.08); }
[hidden] { display: none !important; }
.badge { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--warn); color: #1a1300; font-size: 12px; font-weight: 700; text-align: center; }
.badge.crit { background: var(--err); color: #fff; }
.keep { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.keep input { width: 100%; }
.holds { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 240px; overflow: auto; }
details.inline-remove { display: inline-block; }
details.inline-remove > summary { list-style: none; display: inline-flex; }
details.inline-remove > summary::-webkit-details-marker { display: none; }
details.inline-remove[open] { display: block; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 16px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.tabs .badge { margin-left: 0; font-size: 11px; }
.tabpanel { display: flex; flex-direction: column; gap: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.dest { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; }
.dest:hover { border-color: var(--accent); }
textarea { padding: 8px 12px; resize: vertical; }

.brand.has-logo { flex-direction: column; align-items: flex-start; gap: 8px; }
.logo.img { width: auto; height: 36px; background: none; border-radius: 0; }
.logo.img img { display: block; max-height: 36px; max-width: 150px; }
.login-logo img { display: block; max-height: 56px; max-width: 240px; }
.brand-preview { border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 5px; vertical-align: -4px; border: 1px solid var(--border); }
input[type=color] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); cursor: pointer; }
input[type=file] { font: inherit; color: var(--muted); max-width: 100%; }

.flash-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.removed-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; flex: 1 1 240px; }
.title-row h1 { flex: 0 1 auto; }
.rename summary { list-style: none; cursor: pointer; }
.rename summary::-webkit-details-marker { display: none; }
.rename[open] summary { display: none; }
.rename-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rename-form input { min-width: 0; width: min(320px, 70vw); }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.meter-box { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.meter-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; }
.meter { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.meter span.warn { background: var(--warn); }
.meter span.err { background: var(--err); }
.meter-sub { font-size: 12px; overflow-wrap: anywhere; }
