/* ============================================================
   Command Center — dense tactical dashboard theme
   ============================================================ */
:root {
  --bg: #070b12;
  --bg-2: #0b1120;
  --panel: rgba(15, 22, 36, 0.72);
  --panel-solid: #0d1524;
  --panel-head: rgba(255, 255, 255, 0.03);
  --border: rgba(120, 165, 210, 0.14);
  --border-strong: rgba(120, 165, 210, 0.28);
  --text: #dbe4ef;
  --muted: #8b9bb3;
  --faint: #5d6b82;
  --accent: #22d3ee;
  --accent-dim: rgba(34, 211, 238, 0.15);
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 10px;
  --tb-h: 62px;
}

/* Light theme — applied when <html data-theme="light"> (resolved by applyTheme in app.js).
   'auto' resolves to light/dark in JS from the viewer's OS, so only these two states hit CSS. */
:root[data-theme="light"] {
  --bg: #eef2f7;
  --bg-2: #e3e9f2;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --panel-head: rgba(10, 30, 60, 0.035);
  --border: rgba(30, 60, 100, 0.16);
  --border-strong: rgba(30, 60, 100, 0.30);
  --text: #16202e;
  --muted: #55627a;
  --faint: #8592a6;
  --accent-dim: rgba(20, 120, 150, 0.12);
  --good: #0f9d6b;
  --warn: #b45309;
  --bad: #dc2626;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ---- Background layers ---- */
#bg {
  position: fixed; inset: 0; z-index: -2;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  background-color: var(--bg);
  transition: opacity .4s ease;
}
#scrim {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(34,211,238,.07), transparent 60%),
    linear-gradient(180deg, rgba(4,7,12,.82) 0%, rgba(4,7,12,.66) 40%, rgba(4,7,12,.86) 100%);
}

#app { min-height: 100%; display: flex; flex-direction: column; }

/* ============================================================
   Top bar
   ============================================================ */
#topbar {
  height: var(--tb-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: rgba(7, 11, 18, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.tb-clock { display: flex; align-items: baseline; gap: 12px; }
.tb-time { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: 1px; color: #fff; }
.tb-time .sec { color: var(--accent); font-size: 16px; }
.tb-date { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; }

.tb-center { display: flex; align-items: center; gap: 14px; min-width: 0; overflow: hidden; }
.tb-wx { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel); }
.tb-wx .wx-ico { width: 26px; height: 26px; color: var(--accent); }
.tb-wx .wx-temp { font-family: var(--mono); font-size: 18px; font-weight: 600; }
.tb-wx .wx-meta { font-size: 11px; color: var(--muted); line-height: 1.25; }
.tb-wx .wx-loc { color: var(--text); font-weight: 600; }

.tb-status { display: flex; gap: 6px; flex-wrap: wrap; overflow: hidden; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-family: var(--mono);
  text-transform: uppercase; letter-spacing: .5px; padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: rgba(255,255,255,.02); white-space: nowrap; }
.pill .led { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill.up .led { background: var(--good); box-shadow: 0 0 8px var(--good); }
.pill.down { color: var(--bad); border-color: rgba(248,113,113,.35); }
.pill.down .led { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

.tb-right { display: flex; align-items: center; gap: 10px; }

.btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; transition: .15s; }
.btn:hover { border-color: var(--accent); color: #fff; }
.btn.primary { background: var(--accent); color: #04222a; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.icon { padding: 8px; }
.btn svg { width: 16px; height: 16px; }

.user-chip { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.user-chip .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-dim); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user-chip .u-name { font-size: 13px; } .user-chip .u-role { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; }

/* ============================================================
   Main area
   ============================================================ */
#main { flex: 1; padding: 16px; }
#statusline { font-family: var(--mono); font-size: 11px; color: var(--faint);
  padding: 8px 18px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; }

/* ---- Widget grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
  grid-auto-flow: dense;
}
.span-2 { grid-column: span 2; }
.tall .panel-body { max-height: 460px; }
@media (max-width: 760px) { .span-2 { grid-column: span 1; } }

/* ---- Panel ---- */
.panel {
  background: var(--panel);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,.28);
}
.panel-head {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--panel-head);
}
.panel-head .p-ico { width: 16px; height: 16px; color: var(--accent); flex: none; }
.panel-head .p-title { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text); }
.panel-head .p-meta { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.panel-head .p-led { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.p-led.ok { background: var(--good); box-shadow: 0 0 7px var(--good); }
.p-led.err { background: var(--bad); box-shadow: 0 0 7px var(--bad); }
.p-led.load { background: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.panel-body { padding: 12px; overflow: auto; flex: 1; max-height: 340px; }

/* thin scrollbars */
.panel-body::-webkit-scrollbar, .modal-body::-webkit-scrollbar { width: 8px; height: 8px; }
.panel-body::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* ---- Common widget bits ---- */
.empty { color: var(--faint); font-size: 13px; text-align: center; padding: 22px 8px; }
.notconf { text-align: center; padding: 18px 10px; color: var(--muted); }
.notconf .nc-ico { width: 30px; height: 30px; color: var(--faint); margin-bottom: 8px; }
.notconf .nc-title { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.notconf .nc-sub { font-size: 12px; color: var(--faint); margin-bottom: 10px; }

.row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid rgba(255,255,255,.04); }
.row:last-child { border-bottom: 0; }
.row .r-main { min-width: 0; flex: 1; }
.row .r-title { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-right { font-family: var(--mono); font-size: 11px; color: var(--faint); text-align: right; white-space: nowrap; }
.thumb { width: 34px; height: 50px; border-radius: 4px; object-fit: cover; background: var(--bg-2); flex: none; }
.chip { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); color: var(--muted); }
.chip.good { color: var(--good); border-color: rgba(52,211,153,.4); }
.chip.warn { color: var(--warn); border-color: rgba(251,191,36,.4); }
.chip.bad { color: var(--bad); border-color: rgba(248,113,113,.4); }
.chip.accent { color: var(--accent); border-color: rgba(34,211,238,.4); }

.bar { height: 4px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 5px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: rgba(255,255,255,.02); }
.stat .s-num { font-family: var(--mono); font-size: 22px; font-weight: 600; color: #fff; }
.stat .s-num.accent { color: var(--accent); }
.stat .s-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); margin-top: 2px; }

/* ---- Uptime widget ---- */
.up-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.up-row .up-name { flex: 0 0 90px; font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-bar { flex: 1; height: 8px; background: rgba(255,255,255,.06); border-radius: 999px; overflow: hidden; }
.up-bar-fill { height: 100%; border-radius: 999px; transition: width .3s ease; }
.up-pct { flex: 0 0 46px; font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: right; }

/* ---- Backup list ---- */
.bk-list { display: flex; flex-direction: column; }
.bk-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.bk-name { font-family: var(--mono); font-size: 12px; color: var(--text); }

/* ---- Now playing ---- */
.np { display: flex; gap: 10px; padding: 8px 4px; align-items: center; }
.np .np-info { min-width: 0; flex: 1; }
.np .np-state { font-family: var(--mono); font-size: 10px; text-transform: uppercase; color: var(--accent); }

/* ---- Weather widget ---- */
.wx-now { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.wx-now .big { font-family: var(--mono); font-size: 40px; font-weight: 600; color: #fff; line-height: 1; }
.wx-now .wx-ico-lg { width: 52px; height: 52px; color: var(--accent); }
.wx-now .wx-desc { font-size: 13px; color: var(--text); }
.wx-now .wx-sub { font-size: 11px; color: var(--muted); }
.wx-hours { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0; }
.wx-hr { text-align: center; min-width: 52px; }
.wx-hr .h { font-size: 10px; color: var(--faint); font-family: var(--mono); }
.wx-hr .i { width: 22px; height: 22px; color: var(--accent); margin: 3px auto; }
.wx-hr .t { font-family: var(--mono); font-size: 13px; }
.wx-hr .p { font-size: 9px; color: var(--accent); }
.wx-days { display: flex; flex-direction: column; gap: 2px; }
.wx-day { display: grid; grid-template-columns: 44px 24px 1fr auto; align-items: center; gap: 8px; padding: 4px 0; font-size: 12px; }
.wx-day .d { color: var(--muted); font-family: var(--mono); }
.wx-day .i { width: 18px; height: 18px; color: var(--accent); }
.wx-day .hi { font-family: var(--mono); color: #fff; } .wx-day .lo { font-family: var(--mono); color: var(--faint); }

/* ---- Map ---- */
.map { width: 100%; height: 320px; border-radius: 8px; overflow: hidden; }
.leaflet-container { background: #0a1018; font-family: var(--sans); }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

/* ---- News ---- */
.news-item { padding: 7px 2px; border-bottom: 1px solid rgba(255,255,255,.04); }
.news-item a { color: var(--text); font-size: 13px; }
.news-item a:hover { color: var(--accent); }
.news-item .meta { font-size: 10px; color: var(--faint); font-family: var(--mono); margin-top: 2px; }

/* ---- Links / launcher ---- */
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.link-tile { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 6px; border: 1px solid var(--border);
  border-radius: 9px; background: rgba(255,255,255,.02); text-align: center; transition: .15s; }
.link-tile:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.link-tile .lt-ico { width: 26px; height: 26px; color: var(--accent); }
.link-tile .lt-name { font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---- Flights ---- */
.flt { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 6px 2px; border-bottom: 1px solid rgba(255,255,255,.04); font-size: 12px; align-items: center; }
.flt .call { font-family: var(--mono); color: #fff; }
.flt .rte { font-size: 10px; color: var(--muted); }
.flt .alt { font-family: var(--mono); color: var(--faint); text-align: right; }
.flt .dist { font-family: var(--mono); color: var(--accent); text-align: right; }

/* ============================================================
   Public landing (pre-login)
   ============================================================ */
.landing { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .landing { grid-template-columns: 1fr; } }
.hero-cam { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #000; position: relative; }
.hero-cam .cam-frame { width: 100%; aspect-ratio: 16/9; display: block; border: 0; background: #000; object-fit: cover; }
.hero-cam .cam-label { position: absolute; top: 10px; left: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; color: #fff; background: rgba(0,0,0,.5); padding: 4px 10px; border-radius: 999px; backdrop-filter: blur(4px); }
.hero-cam .cam-live { color: var(--bad); } .hero-cam .cam-live::before { content: "● "; }
.landing-side { display: flex; flex-direction: column; gap: 16px; }
.welcome { padding: 6px 2px; }
.welcome h1 { margin: 0; font-size: 22px; letter-spacing: .5px; }
.welcome p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

/* ============================================================
   Login popover
   ============================================================ */
.login-pop { position: absolute; top: calc(var(--tb-h) - 6px); right: 14px; width: 320px; z-index: 60;
  background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); padding: 18px; }
.login-pop h3 { margin: 0 0 4px; font-size: 15px; }
.login-pop .sub { color: var(--faint); font-size: 12px; margin-bottom: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: rgba(0,0,0,.35); color: var(--text); font-size: 13px; font-family: var(--sans); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.form-err { color: var(--bad); font-size: 12px; margin-bottom: 10px; min-height: 16px; }

/* ============================================================
   Settings modal
   ============================================================ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3,6,11,.7); backdrop-filter: blur(4px); z-index: 100050;
  display: grid; place-items: center; padding: 20px; }
.modal { width: min(920px, 96vw); max-height: 90vh; background: var(--panel-solid); border: 1px solid var(--border-strong);
  border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 16px; letter-spacing: .5px; }
.modal-head .btn { margin-left: auto; }
.modal-body { display: grid; grid-template-columns: 190px 1fr; min-height: 0; flex: 1; }
.set-nav { border-right: 1px solid var(--border); padding: 10px; overflow: auto; }
.set-nav button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: transparent; border: 0;
  color: var(--muted); padding: 9px 11px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.set-nav button svg { width: 15px; height: 15px; }
.set-nav button:hover { background: rgba(255,255,255,.03); color: var(--text); }
.set-nav button.active { background: var(--accent-dim); color: var(--accent); }
.set-pane { padding: 18px 20px; overflow: auto; }
.set-pane h3 { margin: 0 0 4px; font-size: 15px; }
.set-pane .pane-sub { color: var(--faint); font-size: 12px; margin-bottom: 16px; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.set-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .set-grid { grid-template-columns: 1fr; } .modal-body { grid-template-columns: 1fr; } .set-nav { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); } }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { width: 40px; height: 22px; appearance: none; background: rgba(255,255,255,.12); border-radius: 999px; position: relative; cursor: pointer; transition: .2s; }
.switch input:checked { background: var(--accent); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked::after { left: 20px; }
.test-result { font-size: 12px; font-family: var(--mono); margin-top: 8px; min-height: 16px; }
.test-result.ok { color: var(--good); } .test-result.err { color: var(--bad); }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.hint { font-size: 11px; color: var(--faint); margin-top: 4px; }
.row-inline { display: flex; gap: 10px; align-items: flex-end; }
.row-inline .btn { flex: none; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: var(--panel-solid); border: 1px solid var(--border-strong); color: var(--text);
  padding: 11px 18px; border-radius: 10px; font-size: 13px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.toast.ok { border-color: rgba(52,211,153,.5); } .toast.err { border-color: rgba(248,113,113,.5); }

.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }

/* Fix: constrain Settings header icons so the gear/X don't balloon to fill the modal */
.modal-head > svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.modal-head .btn svg { width: 16px; height: 16px; }
/* Safety net: any inline icon that slips through without a size class */
.panel-head > svg:not([class]), .set-nav svg { width: 15px; height: 15px; flex: none; }

/* Changelog viewer + statusline link */
#statusline a { color: var(--accent); text-decoration: none; }
#statusline a:hover { text-decoration: underline; }
.changelog-wrap { overflow: auto; max-height: 72vh; }
.changelog { margin: 0; padding: 18px 20px; font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--text); white-space: pre-wrap; word-break: break-word; }

/* 1.2 — access / profile / status */
.status-line { display: flex; align-items: center; gap: 8px; }
.status-led { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.status-led.up { background: var(--good); box-shadow: 0 0 8px var(--good); }
.status-led.down { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.status-led.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.status-text { font-size: 13px; color: var(--text); }
.prof-grid { display: grid; gap: 6px; }
.prof-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 13px; }
.prof-k { color: var(--faint); text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.prof-v { color: var(--text); }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; }
.perm-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.role-block { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.role-name { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.set-pane textarea { width: 100%; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--border-strong); background: rgba(0,0,0,.35); color: var(--text); font-family: var(--mono); font-size: 12px; }

/* ---- Access & Permissions ---- */
.access-note { border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; color: var(--muted); background: rgba(255,255,255,.02); }
.access-note.warn { border-color: rgba(251,191,36,.5); color: var(--text); }
.access-section { margin: 18px 0 8px; }
.access-section h4 { margin: 0; font-size: 14px; }
.access-grid { display: flex; flex-direction: column; gap: 8px; }
.access-role-row { display: flex; gap: 10px; align-items: flex-start; }
.access-role-row textarea { flex: 1; }
.role-badge { flex: 0 0 74px; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: 1px; padding: 5px 0; border-radius: 6px; text-transform: uppercase; height: fit-content; }
.role-badge.role-owner { background: rgba(34,211,238,.18); color: var(--accent); }
.role-badge.role-admin { background: rgba(248,113,113,.18); color: #f87171; }
.role-badge.role-power { background: rgba(251,191,36,.18); color: #fbbf24; }
.role-badge.role-user  { background: rgba(255,255,255,.08); color: var(--muted); }
.people-wrap { display: flex; flex-direction: column; gap: 8px; }
.person-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.person-head { display: flex; align-items: center; gap: 10px; }
.person-name { font-family: var(--mono); font-size: 13px; color: var(--text); }
.person-card select { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border-strong); background: rgba(0,0,0,.35); color: var(--text); font-size: 12px; }
.perm-tri-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px; margin-top: 10px; }
.perm-tri-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.perm-tri { flex: 0 0 auto; }

/* ---- UniFi detail ---- */
.unifi-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.unifi-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: rgba(255,255,255,.02); }
.uc-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); }
.uc-value { font-family: var(--mono); font-size: 20px; font-weight: 600; color: #fff; margin-top: 2px; }
.uc-value.accent { color: var(--accent); } .uc-value.good { color: var(--good); } .uc-value.bad { color: var(--bad); }
.uc-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.udev-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.udev-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.udev-name { font-weight: 600; color: var(--text); }
.udev-meta { color: var(--muted); font-size: 12px; }
.udev-stats { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 6px; }
.uports { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.uport { width: 26px; height: 26px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-family: var(--mono); border: 1px solid var(--border-strong); color: var(--faint); background: rgba(255,255,255,.03); }
.uport.up { border-color: rgba(52,211,153,.5); color: var(--good); background: rgba(52,211,153,.12); }
.uport.poe { box-shadow: inset 0 -3px 0 var(--warn); }
.uport.uplink { border-color: var(--accent); color: var(--accent); }
.uradios { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; }
.uradio { display: flex; flex-direction: column; }
.udev-actions { display: flex; gap: 8px; margin-top: 12px; }
.uport.poe:hover { outline: 2px solid var(--warn); outline-offset: 1px; }
.uclients { display: flex; flex-direction: column; }
.uclient { display: grid; grid-template-columns: 14px 1.4fr 1fr 1.6fr auto; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: 12px; }
.uclient .uc-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-ip, .uc-conn { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.uc-data { color: var(--faint); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.unifi-chart { border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: rgba(0,0,0,.2); }
.chart-legend { display: flex; gap: 14px; align-items: center; font-size: 11px; margin-bottom: 4px; }
.uclient:hover { background: rgba(255,255,255,.03); }
.client-detail { display: flex; flex-direction: column; }
.cd-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.cd-k { color: var(--muted); } .cd-v { color: var(--text); font-family: var(--mono); text-align: right; word-break: break-all; }

/* ---- Home Assistant control ---- */
.ha-area { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); }
.ha-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ha-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ha-card-head { min-height: 20px; }
.ha-name { font-size: 13px; color: var(--text); font-weight: 500; }
.ha-card-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ha-toggle { border: 1px solid var(--border-strong); background: rgba(255,255,255,.05); color: var(--muted); border-radius: 999px; padding: 4px 14px; cursor: pointer; font-size: 12px; font-weight: 600; }
.ha-toggle.on { background: var(--accent); color: #04121a; border-color: var(--accent); }
.ha-slider { flex: 1; min-width: 90px; accent-color: var(--accent); }
.ha-temp { font-family: var(--mono); font-size: 16px; color: var(--text); min-width: 48px; text-align: center; }
.ha-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); }
.ha-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 12px; cursor: pointer; font-size: 13px; }
.ha-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.ha-cams { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ha-cam-tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #000; }
.ha-cam { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }
.ha-cam-name { padding: 6px 10px; font-size: 12px; color: var(--muted); }

/* 1.3 — NAS file browser */
.fb-crumbs { padding: 9px 16px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.fb-crumbs a { color: var(--accent); cursor: pointer; } .fb-crumbs a:hover { text-decoration: underline; }
.fb-crumbs .sep { color: var(--faint); }
.fb-body { flex: 1; overflow: auto; min-height: 0; }
.fb-list { padding: 4px 8px; }
.fb-row { display: grid; grid-template-columns: 20px 1fr auto auto; align-items: center; gap: 10px; padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,.04); }
.fb-row:hover { background: rgba(255,255,255,.03); }
.fb-ico { width: 18px; height: 18px; color: var(--accent); flex: none; }
.fb-name { cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.fb-name.dir { color: var(--text); font-weight: 600; } .fb-name.file { color: var(--muted); }
.fb-name:hover { color: var(--accent); }
.fb-size { font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; }
.fb-ops { display: flex; gap: 2px; }
.fb-actions { display: inline-flex; gap: 8px; }

/* 1.4 — command palette */
.palette { width: min(560px, 94vw); margin-top: 12vh; background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.palette-input { width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font-size: 15px; outline: none; }
.palette-list { max-height: 320px; overflow: auto; }
.palette-item { padding: 10px 16px; font-size: 13px; color: var(--muted); cursor: pointer; }
.palette-item:hover, .palette-item.sel { background: var(--accent-dim); color: var(--accent); }

/* 1.5 — chat */
.chat-drawer { position: fixed; top: 0; right: 0; width: min(380px, 92vw); height: 100vh; background: var(--panel-solid); border-left: 1px solid var(--border-strong); z-index: 120; display: flex; flex-direction: column; box-shadow: -12px 0 44px rgba(0,0,0,.45); }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.chat-head svg { width: 18px; height: 18px; color: var(--accent); }
.chat-msgs { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 85%; align-self: flex-start; background: rgba(255,255,255,.04); border: 1px solid var(--border); padding: 7px 10px; border-radius: 10px; }
.chat-msg.me { align-self: flex-end; background: var(--accent-dim); border-color: rgba(34,211,238,.3); }
.chat-meta { font-size: 10px; color: var(--faint); margin-bottom: 2px; }
.chat-text { font-size: 13px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.chat-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-input { flex: 1; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border-strong); background: rgba(0,0,0,.35); color: var(--text); outline: none; }
.chat-badge { display: none; position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; place-items: center; }

/* 1.6 — drag/resize layout edit mode */
.span-3 { grid-column: span 3; }
@media (max-width: 1100px) { .span-3 { grid-column: span 2; } }
@media (max-width: 760px) { .span-3 { grid-column: span 1; } }
.grid.editing .panel { outline: 1px dashed var(--border-strong); }
.edit-panel { position: relative; cursor: grab; }
.edit-panel.dragging { opacity: .45; }
.edit-panel.hidden-widget { opacity: .5; }
.edit-strip { display: flex; gap: 5px; align-items: center; padding: 5px 7px; background: rgba(0,0,0,.4); border-bottom: 1px solid var(--border); }
.es-btn { font-size: 11px; font-family: var(--mono); padding: 2px 8px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text); border-radius: 6px; cursor: pointer; }
.es-btn:hover { border-color: var(--accent); }
.es-btn.on { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.es-w { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.layoutbar { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 99990; display: flex; gap: 8px; align-items: center; background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 999px; padding: 8px 12px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.layoutbar .hint { margin-right: 4px; }

/* 2.0 — Gridstack live layout */
.grid-stack { background: transparent; }
.grid-stack-item-content { inset: 0; overflow: visible; display: flex; }
.grid-stack-item-content > .panel { width: 100%; height: 100%; }
.grid-stack > .grid-stack-item > .grid-stack-item-content { color: inherit; }
.grid-stack.editing .grid-stack-item { cursor: move; }
.grid-stack.editing .panel { outline: 1px dashed var(--border-strong); }
.grid-stack .ui-resizable-handle { z-index: 6; }
/* make edge/corner handles visible while editing */
.grid-stack.editing .ui-resizable-handle::after { content: ''; }
.grid-stack.editing .ui-resizable-se, .grid-stack.editing .ui-resizable-sw,
.grid-stack.editing .ui-resizable-ne, .grid-stack.editing .ui-resizable-nw {
  width: 16px; height: 16px; border: 2px solid var(--accent); background: var(--panel-solid); border-radius: 3px; opacity: .9;
}
.grid-stack.editing .ui-resizable-nw { top: -2px; left: -2px; }
.grid-stack.editing .ui-resizable-ne { top: -2px; right: -2px; }
.grid-stack.editing .ui-resizable-sw { bottom: -2px; left: -2px; }
.grid-stack.editing .ui-resizable-se { bottom: -2px; right: -2px; }
.grid-stack-item.grid-stack-placeholder > .placeholder-content { border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--accent-dim); }
.addwidget-sel { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: rgba(0,0,0,.35); color: var(--text); font-size: 13px; }

/* 2.1 — splash grid widgets + editor */
.splash-clock { display: flex; flex-direction: column; justify-content: center; height: 100%; gap: 4px; }
.splash-clock .t { font-family: var(--mono); font-size: 38px; font-weight: 600; color: #fff; line-height: 1; }
.splash-clock .d { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; }
.splash-welcome { display: flex; flex-direction: column; justify-content: center; height: 100%; gap: 10px; }
.splash-welcome h1 { margin: 0; font-size: 22px; }
/* Webcam fills its panel edge-to-edge; container clips so iframe/zoom crops don't spill. */
.panel-body.splash-cam { padding: 0; overflow: hidden; position: relative; background: #000; max-height: none; }
.panel-body.splash-cam .cam-frame { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border: 0; display: block; }
.splash-editor { display: flex; flex-direction: column; width: 100%; height: 100%; background: var(--bg); }
.splash-edit-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--panel-solid); }
.splash-edit-top svg { width: 18px; height: 18px; color: var(--accent); }
.splash-edit-host { flex: 1; overflow: auto; padding: 14px; }

/* 2.3 — notifications + topbar badges */
.note { padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,.05); }
.note-title { font-size: 13px; color: var(--text); }
.note-body { font-size: 12px; color: var(--muted); margin-top: 2px; }
.note-meta { font-size: 10px; color: var(--faint); font-family: var(--mono); margin-top: 3px; text-transform: uppercase; letter-spacing: .5px; }
.note-error .note-title { color: var(--bad); }
.note-good .note-title { color: var(--good); }
.tb-badge { display: none; position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; place-items: center; }
.edit-interval { font-size: 11px; font-family: var(--mono); padding: 2px 4px; border-radius: 6px; border: 1px solid var(--border-strong); background: rgba(0,0,0,.35); color: var(--text); margin-top: 6px; }

/* ============================================================
   3.0 — Desktop shell: window manager, dock, snap tiling
   ============================================================ */
#main.desktop-mode { padding: 0; position: relative; overflow: hidden; }
.desktop { position: absolute; inset: 0; overflow: hidden; }
.desk-wallpaper { position: absolute; inset: 0; overflow: auto; padding: 14px 14px 96px; }
.desk-windows { position: absolute; inset: 0; pointer-events: none; }
.snap-preview { position: absolute; z-index: 99998; pointer-events: none; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 20%, transparent); border: 2px solid var(--accent);
  transition: left .12s ease, top .12s ease, width .12s ease, height .12s ease; }

/* window */
.win { position: absolute; pointer-events: auto; display: flex; flex-direction: column;
  min-width: 340px; min-height: 220px; border-radius: 12px; overflow: hidden;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  box-shadow: 0 24px 70px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.4); }
:root[data-theme="light"] .win { box-shadow: 0 24px 60px rgba(20,40,80,.22), 0 2px 8px rgba(20,40,80,.12); }
.win.active { border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong));
  box-shadow: 0 30px 90px rgba(0,0,0,.62), 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.win.maximized { border-radius: 0; }
.win.opening { animation: winIn .18s cubic-bezier(.2,.8,.3,1); }
.win.closing { animation: winOut .13s ease forwards; }
.win.minimized { animation: winMin .16s ease forwards; }
@keyframes winIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes winOut { to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes winMin { to { opacity: 0; transform: translateY(46px) scale(.88); } }

.win-titlebar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 12px; flex: 0 0 auto;
  background: var(--panel-head); border-bottom: 1px solid var(--border); cursor: grab; user-select: none; touch-action: none; }
.win-titlebar:active { cursor: grabbing; }
.win-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; }
.win-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-ico { width: 16px; height: 16px; color: var(--accent); flex: 0 0 auto; }
.win-controls { display: flex; gap: 4px; flex: 0 0 auto; }
.win-btn { width: 28px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; transition: background .12s, color .12s; }
.win-btn svg { width: 15px; height: 15px; }
.win-btn:hover { background: var(--border); color: var(--text); }
.win-btn.close:hover { background: var(--bad); color: #fff; }
.win-body { flex: 1; overflow: auto; position: relative; background: var(--panel-solid); }

/* resize handles */
.win-resize { position: absolute; z-index: 2; touch-action: none; }
.win-resize.r-n { top: -3px; left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.win-resize.r-s { bottom: -3px; left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.win-resize.r-e { right: -3px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.win-resize.r-w { left: -3px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.win-resize.r-ne { top: -3px; right: -3px; width: 15px; height: 15px; cursor: nesw-resize; }
.win-resize.r-nw { top: -3px; left: -3px; width: 15px; height: 15px; cursor: nwse-resize; }
.win-resize.r-se { bottom: -3px; right: -3px; width: 15px; height: 15px; cursor: nwse-resize; }
.win-resize.r-sw { bottom: -3px; left: -3px; width: 15px; height: 15px; cursor: nesw-resize; }

/* dock */
.desk-dock { position: absolute; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 100000;
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 18px;
  background: color-mix(in srgb, var(--panel-solid) 76%, transparent); border: 1px solid var(--border-strong);
  box-shadow: 0 12px 40px rgba(0,0,0,.45); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  max-width: calc(100% - 24px); overflow-x: auto; }
.dock-apps { display: flex; align-items: flex-end; gap: 8px; }
.dock-item { position: relative; width: 52px; height: 52px; border: 0; border-radius: 14px; cursor: pointer; flex: 0 0 auto;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text); display: grid; place-items: center;
  transition: transform .14s cubic-bezier(.2,.8,.3,1), background .14s; }
.dock-item svg { width: 26px; height: 26px; color: var(--accent); }
.dock-item:hover { transform: translateY(-8px) scale(1.08); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.dock-item.active { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.dock-dot { position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: transparent; transition: background .14s; }
.dock-item.running .dock-dot { background: var(--accent); }
@media (max-width: 640px) { .dock-item { width: 46px; height: 46px; } .desk-dock { bottom: 8px; } }

/* app-in-window chrome (shared by HA / UniFi / Files mounted into windows) */
.win-toolbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); background: var(--panel-solid); flex-wrap: wrap; }
.win-tt { font-size: 13px; font-weight: 600; color: var(--text); }
.win-scroll { padding: 14px; }
.win-body .fb-body { position: static; height: auto; }
.chat-win { display: flex; flex-direction: column; height: 100%; }
.chat-win .chat-msgs { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-win .chat-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--panel-head); }
.chat-win .chat-input { flex: 1; }

/* ============================================================
   3.1 — Windows Aero glass refresh
   Frosted translucent surfaces, glossy top sheen, glowing edges;
   blur reveals the wallpaper (and windows behind) — the Aero effect.
   ============================================================ */
:root { --glass-hi: rgba(255,255,255,.40); }
:root[data-theme="light"] { --glass-hi: rgba(255,255,255,.85); }
.aero-sheen { }

/* widget cards */
.panel {
  background: linear-gradient(to bottom, rgba(255,255,255,.12) 0%, rgba(255,255,255,.04) 44%, rgba(255,255,255,0) 45%, rgba(0,0,0,.05) 100%), color-mix(in srgb, var(--panel-solid) 56%, transparent);
  backdrop-filter: blur(18px) saturate(165%); -webkit-backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid color-mix(in srgb, #fff 20%, var(--border));
  border-radius: 14px;
  box-shadow: 0 8px 26px rgba(0,0,0,.26), inset 0 1px 0 var(--glass-hi);
}
.panel-head { background: linear-gradient(to bottom, rgba(255,255,255,.10), rgba(255,255,255,0)); border-bottom: 1px solid rgba(255,255,255,.10); }

/* top bar → glass menu bar */
#topbar {
  background: linear-gradient(to bottom, rgba(255,255,255,.12), rgba(255,255,255,.03)), color-mix(in srgb, var(--panel-solid) 52%, transparent);
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid rgba(255,255,255,.14);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 2px 14px rgba(0,0,0,.22);
}

/* buttons → glass */
.btn { background: linear-gradient(to bottom, rgba(255,255,255,.13), rgba(255,255,255,.03)); box-shadow: inset 0 1px 0 rgba(255,255,255,.26); }
.btn:hover { background: linear-gradient(to bottom, rgba(255,255,255,.20), rgba(255,255,255,.06)); }
.btn.primary { background: linear-gradient(to bottom, color-mix(in srgb, var(--accent) 76%, #fff 24%), var(--accent)); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 2px 10px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.icon.ghost:hover { background: linear-gradient(to bottom, rgba(255,255,255,.16), rgba(255,255,255,.04)); }

/* windows → Aero glass, active window glows with the accent */
.win {
  background: linear-gradient(to bottom, rgba(255,255,255,.09), rgba(255,255,255,0) 64px), color-mix(in srgb, var(--panel-solid) 72%, transparent);
  backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid color-mix(in srgb, #fff 26%, var(--border-strong));
  box-shadow: 0 30px 80px rgba(0,0,0,.5), inset 0 1px 0 var(--glass-hi);
}
.win.active {
  border-color: color-mix(in srgb, var(--accent) 55%, #fff 22%);
  box-shadow: 0 36px 100px rgba(0,0,0,.6), 0 0 26px color-mix(in srgb, var(--accent) 42%, transparent), inset 0 1px 0 var(--glass-hi);
}
.win-titlebar { background: linear-gradient(to bottom, rgba(255,255,255,.17), rgba(255,255,255,.04)); border-bottom: 1px solid rgba(255,255,255,.12); }
.win-body { background: color-mix(in srgb, var(--panel-solid) 90%, transparent); }

/* dock → chunkier Aero glass */
.desk-dock {
  background: linear-gradient(to bottom, rgba(255,255,255,.17), rgba(255,255,255,.05)), color-mix(in srgb, var(--panel-solid) 52%, transparent);
  backdrop-filter: blur(28px) saturate(170%); -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid color-mix(in srgb, #fff 26%, var(--border-strong));
  box-shadow: 0 16px 46px rgba(0,0,0,.45), inset 0 1px 0 var(--glass-hi);
}
.dock-item { background: linear-gradient(to bottom, rgba(255,255,255,.16), rgba(255,255,255,.04)); box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }
.dock-item.running { box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 0 16px color-mix(in srgb, var(--accent) 48%, transparent); }

/* modals still in use (client panels etc.) → match the glass */
.modal {
  background: linear-gradient(to bottom, rgba(255,255,255,.08), rgba(255,255,255,0) 64px), color-mix(in srgb, var(--panel-solid) 84%, transparent);
  backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid color-mix(in srgb, #fff 22%, var(--border-strong));
  box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 var(--glass-hi);
}

/* Settings, now a window */
.set-win { display: flex; flex-direction: column; height: 100%; }
.set-body { display: flex; flex: 1; min-height: 0; }
.set-body .set-nav { width: 190px; flex: 0 0 auto; }
.set-body .set-pane { flex: 1; }
.set-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); background: linear-gradient(to bottom, rgba(255,255,255,.06), rgba(255,255,255,0)); }
@media (max-width: 640px) { .set-body { flex-direction: column; } .set-body .set-nav { width: auto; display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); } }

/* ============================================================
   3.2 — Feature-rich chat
   ============================================================ */
.chat-win { display: flex; flex-direction: column; height: 100%; position: relative; }
.chat-win.drag::after { content: 'Drop files to share'; position: absolute; inset: 8px; z-index: 5; display: grid; place-items: center;
  border: 2px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; pointer-events: none; }
.chat-msgs { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.chat-day { text-align: center; margin: 12px 0 6px; }
.chat-day span { font-size: 11px; color: var(--faint); background: color-mix(in srgb, var(--panel-solid) 70%, transparent); padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); }
.cmsg { position: relative; padding: 2px 40px 2px 0; }
.cmsg:not(.grouped) { margin-top: 10px; }
.cmsg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.cmsg-avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #04222a;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent)); flex: none; }
.cmsg-name { font-size: 13px; font-weight: 700; color: var(--text); }
.cmsg-time { font-size: 10.5px; color: var(--faint); }
.cmsg-bwrap { padding-left: 34px; }
.cmsg-body { display: inline-flex; flex-direction: column; gap: 4px; max-width: 100%; }
.cmsg-text { background: color-mix(in srgb, var(--accent) 8%, var(--panel-head)); border: 1px solid var(--border); padding: 7px 11px; border-radius: 4px 12px 12px 12px; font-size: 13.5px; line-height: 1.45; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.cmsg.mine .cmsg-text { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.cmsg-edited { color: var(--faint); font-size: 10.5px; }
.cmsg-replyq { font-size: 11.5px; color: var(--muted); border-left: 2px solid var(--accent); padding: 1px 8px; margin-bottom: 2px; opacity: .85; }
.cmsg-replyq b { color: var(--text); }
.cmsg-atts { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.cmsg-imgs { display: grid; gap: 4px; max-width: 340px; }
.cmsg-imgs.n1 { grid-template-columns: 1fr; }
.cmsg-imgs.n2, .cmsg-imgs.n4 { grid-template-columns: 1fr 1fr; }
.cmsg-imgs.n3 { grid-template-columns: 1fr 1fr 1fr; }
.cmsg-imgs img { width: 100%; height: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; cursor: zoom-in; border: 1px solid var(--border); display: block; }
.cmsg-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-head); color: var(--text); max-width: 300px; }
.cmsg-file:hover { border-color: var(--accent); text-decoration: none; }
.cmsg-file svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.cmsg-file .cf-main { flex: 1; min-width: 0; }
.cf-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-size { font-size: 10.5px; color: var(--faint); }
.cmsg-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.creact { font-size: 12px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-head); color: var(--text); cursor: pointer; }
.creact.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, transparent); }
.cmsg-actions { position: absolute; top: -10px; right: 8px; display: none; gap: 2px; padding: 2px; border-radius: 8px;
  background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.cmsg:hover .cmsg-actions { display: flex; }
.ca-btn { width: 26px; height: 24px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
.ca-btn svg { width: 15px; height: 15px; }
.ca-btn:hover { background: var(--border); color: var(--text); }
.emoji-pop { position: fixed; z-index: 100001; display: flex; gap: 2px; padding: 6px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.emoji-pop button { font-size: 20px; width: 34px; height: 34px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; }
.emoji-pop button:hover { background: var(--border); transform: scale(1.15); }
.chat-typing { height: 16px; padding: 0 16px; font-size: 11.5px; color: var(--muted); font-style: italic; }
.chat-composer { border-top: 1px solid var(--border); padding: 8px 10px; background: var(--panel-head); }
.chat-reply { display: flex; align-items: center; gap: 8px; padding: 5px 8px; margin-bottom: 6px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid var(--border); font-size: 12px; }
.chat-reply svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.chat-reply .reply-info { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-reply .reply-info b { margin-right: 6px; }
.chat-tray { display: none; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chat-chip { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-solid); max-width: 180px; }
.chat-chip img { width: 30px; height: 30px; border-radius: 5px; object-fit: cover; }
.chat-chip svg { width: 18px; height: 18px; color: var(--accent); }
.chat-chip .chip-name { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 2px; }
.chip-x svg { width: 13px; height: 13px; }
.chat-inputrow { display: flex; align-items: flex-end; gap: 6px; }
.chat-ta { flex: 1; resize: none; min-height: 38px; max-height: 140px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--panel-solid); color: var(--text); font-family: var(--sans); font-size: 13.5px; line-height: 1.4; }
.chat-ta:focus { outline: none; border-color: var(--accent); }
.chat-send { align-self: stretch; }
.lightbox { position: fixed; inset: 0; z-index: 100002; background: rgba(0,0,0,.82); display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }

/* 3.7 — chat threads / mentions / search / pins */
.chat-win { position: relative; }
.chat-topbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--panel-head); flex: 0 0 auto; }
.chat-search-ico { width: 15px; height: 15px; color: var(--faint); flex: none; }
.chat-search { flex: 1; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--panel-solid); color: var(--text); font-size: 13px; }
.chat-search:focus { outline: none; border-color: var(--accent); }
.chat-topbar .btn.icon.ghost.has { color: var(--accent); }
.chat-pins { max-height: 38%; overflow: auto; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--accent) 6%, transparent); padding: 6px 10px; flex: 0 0 auto; }
.chat-pins-h { display: flex; align-items: center; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); margin-bottom: 4px; }
.chat-pins-h svg { width: 13px; height: 13px; }
.chat-pin { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-bottom: 1px solid var(--border); }
.chat-pin-main { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pin-main b { color: var(--text); }
.cmention { color: var(--accent); font-weight: 600; }
.cmention.me { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 4px; padding: 0 3px; }
.cmsg.pinged .cmsg-text { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn) 9%, var(--panel-head)); }
.cmsg-pinned { color: var(--warn); display: inline-flex; margin-left: 4px; }
.cmsg-pinned svg { width: 12px; height: 12px; }
.cmsg-thread { margin-top: 4px; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid var(--border); border-radius: 8px; padding: 3px 8px; cursor: pointer; width: fit-content; }
.cmsg-thread svg { width: 13px; height: 13px; }
.chat-thread { position: absolute; inset: 0; z-index: 6; flex-direction: column; background: var(--panel-solid); }
.chat-thread-h { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--panel-head); flex: 0 0 auto; }
.chat-thread .chat-msgs { flex: 1; }
.mention-pop { display: flex; flex-direction: column; min-width: 200px; max-width: 280px; background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.4); overflow: hidden; }
.mention-pop button { display: flex; align-items: baseline; gap: 4px; text-align: left; border: 0; background: transparent; color: var(--text); padding: 7px 11px; cursor: pointer; font-size: 13px; }
.mention-pop button:hover { background: var(--accent-dim); }

/* ============================================================
   3.2.1 — Aero scrollbars + dock polish
   ============================================================ */
/* Kill the default white scrollbars in every app window / scroll area. */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--accent) 38%, var(--border-strong)) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 34%, var(--border-strong)); border-radius: 9px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* Dock: magnify icons in place (no lift) so they stay inside the bar instead of overlapping it. */
.desk-dock { padding: 10px 13px; }
.dock-item:hover { transform: scale(1.16); }
.dock-badge { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; display: none; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.4); }

/* ============================================================
   3.3 — FlightRadar app (live radar map + full aircraft table)
   ============================================================ */
.win-body:has(.fr-body) { display: flex; flex-direction: column; overflow: hidden; }
.fr-toolbar { flex: 0 0 auto; }
.fr-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.fr-stat { font-size: 12.5px; color: var(--muted); }
.fr-stat b { color: var(--text); font-size: 14px; font-family: var(--mono); }
.fr-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.fr-map { flex: 0 0 auto; height: 300px; width: 100%; background: #0a1120; }
.fr-plane-ic { color: var(--accent); }
.fr-plane { width: 18px; height: 18px; display: grid; place-items: center; filter: drop-shadow(0 0 2px rgba(0,0,0,.7)); }
.fr-table { flex: 1; overflow: auto; min-height: 0; padding: 2px 0; }
.fr-row { display: grid; grid-template-columns: 1.4fr .9fr 1fr .8fr .7fr 1.4fr; gap: 8px; align-items: center; padding: 6px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.fr-row.fr-head { position: sticky; top: 0; background: var(--panel-solid); color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; z-index: 1; }
.fr-row:not(.fr-head):hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.fr-call b { color: var(--text); }
.fr-call small { color: var(--faint); }
.fr-row .up { color: var(--good); }
.fr-row .down { color: var(--warn); }
.fr-rte { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.splash-flt-list { margin-top: 8px; display: flex; flex-direction: column; }
@media (max-width: 720px) { .fr-row { grid-template-columns: 1.4fr .9fr .8fr 1.2fr; } .fr-row span:nth-child(2), .fr-row span:nth-child(4) { display: none; } }

/* ============================================================
   3.4 — Docker · System Monitor · Notes & Tasks
   ============================================================ */
.dk-sum { color: var(--muted); font-size: 12px; margin-left: 10px; }
.dk-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); margin: 12px 2px 6px; }
.dk-card { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; background: var(--panel-head); }
.dk-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--faint); }
.dk-dot.up { background: var(--good); box-shadow: 0 0 7px var(--good); }
.dk-dot.down { background: var(--bad); }
.dk-dot.warn { background: var(--warn); }
.dk-main { flex: 1; min-width: 0; }
.dk-name { font-size: 13px; font-weight: 600; color: var(--text); }
.dk-img { font-size: 11px; color: var(--muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-status { font-size: 11px; color: var(--faint); }
.dk-acts { display: flex; gap: 3px; flex: none; }
.dk-logs { margin: 0; padding: 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; color: var(--text); white-space: pre-wrap; word-break: break-word; }

.sm-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.sm-gauge { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--panel-head); }
.sm-g-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.sm-g-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); }
.sm-g-pct { font-size: 20px; font-weight: 700; font-family: var(--mono); color: var(--text); }
.sm-g-sub { font-size: 11px; color: var(--muted); margin-top: 6px; }
.sm-sect { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); margin: 14px 2px 2px; }
.sm-spark { border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; background: var(--panel-head); }
.sm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.sm-stat { border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; background: var(--panel-head); }
.sm-stat b { display: block; font-family: var(--mono); font-size: 15px; color: var(--text); }
.sm-stat span { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .6px; }
@media (max-width: 560px) { .sm-grid { grid-template-columns: 1fr; } }

.nt-body { padding: 2px 0; }
.nt-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.nt-note { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--panel-head); cursor: pointer; transition: border-color .12s; }
.nt-note:hover { border-color: var(--accent); }
.nt-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.nt-prev { font-size: 12px; color: var(--muted); white-space: pre-wrap; max-height: 60px; overflow: hidden; }
.nt-meta { font-size: 10.5px; color: var(--faint); margin-top: 8px; }
.nt-editor { display: flex; flex-direction: column; gap: 10px; }
.nt-input { padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--panel-solid); color: var(--text); font-size: 14px; }
.nt-input:focus { outline: none; border-color: var(--accent); }
.nt-ta { min-height: 260px; resize: vertical; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--panel-solid); color: var(--text); font-family: var(--sans); font-size: 13.5px; line-height: 1.5; }
.nt-ta:focus { outline: none; border-color: var(--accent); }
.nt-edit-foot { display: flex; gap: 8px; align-items: center; }
.nt-addrow { display: flex; gap: 8px; margin-bottom: 12px; }
.nt-addrow .nt-input { flex: 1; }
.nt-tasks { display: flex; flex-direction: column; }
.nt-task { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.nt-task.done .nt-tx { text-decoration: line-through; color: var(--faint); }
.nt-check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border-strong); background: transparent; cursor: pointer; display: grid; place-items: center; flex: none; color: #04222a; }
.nt-check.on { background: var(--accent); border-color: var(--accent); }
.nt-check svg { width: 14px; height: 14px; }
.nt-tx { flex: 1; font-size: 13.5px; color: var(--text); }
.nt-done-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); margin: 14px 2px 4px; }
@media (max-width: 560px) { .nt-notes { grid-template-columns: 1fr; } }

/* ============================================================
   3.5 — Changelog viewer · Weather radar · AD Directory
   ============================================================ */
.cl-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.cl-list { width: 180px; flex: 0 0 auto; border-right: 1px solid var(--border); overflow: auto; padding: 8px; }
.cl-ver { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; border: 0; background: transparent; color: var(--muted); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.cl-ver:hover { background: rgba(255,255,255,.04); color: var(--text); }
.cl-ver.active { background: var(--accent-dim); color: var(--accent); }
.cl-vn { font-size: 13px; font-weight: 600; }
.cl-vd { font-size: 10.5px; color: var(--faint); }
.cl-pane { flex: 1; overflow: auto; padding: 18px 22px; }
.cl-vh { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 12px; }
.cl-vh h3 { margin: 0; font-size: 20px; }
.cl-date { color: var(--faint); font-size: 12px; }
.cl-h { font-weight: 700; color: var(--accent); margin: 14px 0 6px; font-size: 13.5px; }
.cl-li { position: relative; padding-left: 16px; margin: 4px 0; font-size: 13px; color: var(--text); line-height: 1.5; }
.cl-li::before { content: '•'; position: absolute; left: 2px; color: var(--accent); }
.cl-p { font-size: 13px; color: var(--muted); margin: 4px 0; line-height: 1.5; }
.cl-sp { height: 6px; }
@media (max-width: 560px) { .cl-list { width: 130px; } }

.win-body:has(.rd-body) { display: flex; flex-direction: column; overflow: hidden; }
.rd-bar { display: flex; align-items: center; gap: 10px; width: 100%; }
.rd-ts { font-size: 12.5px; color: var(--text); font-family: var(--mono); }
.rd-body { flex: 1; min-height: 0; }
.rd-map { width: 100%; height: 100%; background: #0a1120; }

.dir-count { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; margin: 4px 2px 8px; }
.dir-row { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.dir-row:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.dir-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #04222a; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent)); flex: none; }
.dir-avatar.off { background: var(--faint); }
.dir-gi { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-dim); color: var(--accent); flex: none; }
.dir-gi svg { width: 17px; height: 17px; }
.dir-main { flex: 1; min-width: 0; }
.dir-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.dir-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-uname { font-size: 11.5px; color: var(--faint); font-family: var(--mono); flex: none; }
.dir-kv { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.dir-k { width: 110px; flex: none; color: var(--faint); font-size: 12px; }
.dir-v { color: var(--text); font-size: 13px; word-break: break-word; }
.dir-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.dir-tags .chip-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; }
.dir-tags .chip-x:hover { color: var(--bad); }
.dir-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.dir-pw { display: flex; gap: 8px; margin-top: 6px; }

/* 3.8 — AD-more (create/unlock/bulk/report), DNS + Group Policy apps */
.dir-check { width: 15px; height: 15px; flex: none; accent-color: var(--accent); cursor: pointer; }
.dir-bulkbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid var(--accent-dim); position: sticky; top: 0; z-index: 2; }
.dir-bulkbar > span:first-child { font-size: 12px; font-weight: 600; color: var(--text); margin-right: auto; }
.dir-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dir-field { display: flex; flex-direction: column; gap: 4px; }
.dir-field > span { font-size: 11.5px; color: var(--faint); }
.dir-field.full, .dir-form > .full { grid-column: 1 / -1; }

.dir-table { display: flex; flex-direction: column; margin-top: 6px; }
.dir-tr { display: grid; grid-template-columns: 2fr 1.4fr 1.2fr 1fr; gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 12.5px; }
.dir-tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.dir-th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--faint); cursor: default; position: sticky; top: 0; background: var(--panel); }
.dir-tr.stale { opacity: .72; }

/* DNS app */
/* The split apps own their own scrolling: stop the window body from scrolling the whole thing as
   one, and let each pane scroll independently (fixes both sides scrolling together). */
.win-body:has(.dns-split), .win-body:has(.gpo-split) { display: flex; flex-direction: column; overflow: hidden; }
.dns-left, .dns-right, .gpo-left, .gpo-right { overflow-y: auto; min-height: 0; }
.dns-split, .gpo-split { display: flex; flex: 1; min-height: 0; }
.dns-left { width: 240px; flex: none; border-right: 1px solid var(--border); }
.dns-right { flex: 1; min-width: 0; }
.dns-zgroup { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--faint); padding: 10px 10px 4px; }
.dns-zone { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.dns-zone:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.dns-zone.active { background: var(--accent-dim); }
.dns-zn { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-all; }
.dns-zt { font-size: 11px; color: var(--muted); }
.dns-rhead, .gpo-dhead { display: flex; align-items: center; gap: 8px; padding: 4px 2px 10px; }
.dns-table .dir-tr { grid-template-columns: 1.4fr .7fr 2fr .7fr .9fr; }
.dns-data { font-family: var(--mono); font-size: 11.5px; word-break: break-all; }

/* Group Policy app */
.gpo-left { width: 260px; flex: none; border-right: 1px solid var(--border); }
.gpo-right { flex: 1; min-width: 0; padding: 4px 12px 16px; }
.gpo-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.gpo-item:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.gpo-item.active { background: var(--accent-dim); }
.gpo-link, .gpo-regrow { display: flex; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.gpo-reg { margin-top: 8px; }

/* 3.10 — Computer fleet monitor */
.fleet-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.win-body:has(.fleet-split) { display: flex; flex-direction: column; overflow: hidden; }
.fleet-split { display: flex; flex: 1; min-height: 0; }
.fleet-left { width: 280px; flex: none; border-right: 1px solid var(--border); overflow-y: auto; min-height: 0; }
.fleet-right { flex: 1; min-width: 0; overflow-y: auto; min-height: 0; padding: 4px 14px 16px; }
.fleet-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.fleet-item:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.fleet-item.active { background: var(--accent-dim); }
.fleet-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--faint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--faint) 25%, transparent); }
.fleet-dot.on { background: var(--good, #34d399); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good, #34d399) 30%, transparent); }
.fleet-dhead { display: flex; align-items: center; padding: 4px 2px 10px; }
.fleet-token { display: block; word-break: break-all; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-family: var(--mono); font-size: 12px; color: var(--accent); }
.fleet-cfg { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 10px; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; overflow-x: auto; }
