/* ============================================================================
   Leuffen RMM — modernised UI
   Design tokens: dark default + light theme, tweakable accent / radius / density
   Font: Onest (UI) + JetBrains Mono (technical). Lucide-style inline SVG icons.
   ========================================================================== */

:root {
  /* --- tweakable (overwritten by Tweaks panel) --- */
  --accent: #3b82f6;
  --radius-scale: 1;          /* 0 = sharp, 1 = default, 1.6 = round */
  --density: 1;               /* 0.85 compact, 1 comfortable */

  /* --- derived radii --- */
  --r-xs: calc(4px * var(--radius-scale));
  --r-sm: calc(7px * var(--radius-scale));
  --r-md: calc(10px * var(--radius-scale));
  --r-lg: calc(14px * var(--radius-scale));
  --r-xl: calc(20px * var(--radius-scale));
  --r-pill: 999px;

  /* --- derived density --- */
  --row-py: calc(13px * var(--density));
  --cell-px: 16px;
  --gap: calc(16px * var(--density));
  --pad: calc(20px * var(--density));

  /* --- accent-derived tints (auto-update when accent changes) --- */
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-softer: color-mix(in srgb, var(--accent) 9%, transparent);
  --accent-ring: color-mix(in srgb, var(--accent) 35%, transparent);
  --accent-text: var(--accent);

  /* --- semantic --- */
  --good: #34d399; --warn: #fbbf24; --bad: #f87171;
  --good-soft: color-mix(in srgb, var(--good) 15%, transparent);
  --warn-soft: color-mix(in srgb, var(--warn) 15%, transparent);
  --bad-soft:  color-mix(in srgb, var(--bad) 15%, transparent);

  --font-sans: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* ---- DARK theme (default) ---- */
:root, [data-theme="dark"] {
  --bg: #0a0c11;
  --bg-grid: #0d1016;
  --surface: #12161e;
  --surface-2: #171c26;
  --surface-3: #1c222e;
  --surface-hover: #1a212c;
  --border: #232b37;
  --border-soft: #1b222d;
  --border-strong: #303a48;
  --text: #e9eef6;
  --text-dim: #97a3b4;
  --text-faint: #5f6b7c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 60px -16px rgba(0,0,0,.65);
  --meter-track: #0c0f15;
  --term-bg: #070a0f;
  color-scheme: dark;
}

/* ---- LIGHT theme ---- */
[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-grid: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef2f8;
  --surface-hover: #f2f5fa;
  --border: #e4e9f1;
  --border-soft: #edf1f7;
  --border-strong: #d3dbe7;
  --text: #111826;
  --text-dim: #5d6b7e;
  --text-faint: #93a0b2;
  --shadow: 0 1px 2px rgba(16,28,48,.06), 0 10px 30px -12px rgba(16,28,48,.18);
  --shadow-lg: 0 30px 70px -20px rgba(16,28,48,.30);
  --meter-track: #eaeef4;
  --term-bg: #0b0f16;
  color-scheme: light;
}

/* ---- density attribute → scalar ---- */
[data-density="compact"]     { --density: 0.62; --cell-px: 13px; }
[data-density="comfortable"] { --density: 1;    --cell-px: 16px; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--accent-softer), transparent 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  letter-spacing: -0.005em;
}
.hidden { display: none !important; }
/* sane default size for inline icons; specific charts override below */
svg { width: 16px; height: 16px; flex: none; }
.spark { width: 64px !important; height: 22px !important; }
.ring { width: 44px !important; height: 44px !important; }
.kspark { width: 74px !important; height: 30px !important; }
.mono { font-family: var(--font-mono); font-feature-settings: "ss01"; }
.muted { color: var(--text-dim); }
a { color: inherit; }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

/* ============================================================================
   App shell
   ========================================================================== */
.app { display: grid; grid-template-rows: auto 1fr; min-height: 100vh; }

/* ---- Header ---- */
header.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px; height: 60px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand .logo {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #7c3aed));
  box-shadow: 0 4px 14px -4px var(--accent-ring);
}
.brand .logo svg { width: 17px; height: 17px; }
.brand span { color: var(--text-dim); font-weight: 600; }

.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-dim); }
.crumbs a { text-decoration: none; color: var(--text-dim); padding: 4px 9px; border-radius: var(--r-sm); cursor: pointer; transition: .15s; }
.crumbs a:hover { color: var(--text); background: var(--surface-hover); }
.crumbs a.here { color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--text-faint); }

.spacer { flex: 1; }

.searchbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 7px 11px; min-width: 230px; color: var(--text-faint);
  transition: .15s;
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.searchbox svg { width: 15px; height: 15px; flex: none; }
.searchbox input { border: 0; background: none; outline: none; color: var(--text); font: inherit; font-size: 13px; width: 100%; }
.searchbox kbd { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 5px; }

.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-dim); cursor: pointer; transition: .15s; position: relative;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .ping { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--surface); }

.userchip { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: var(--r-pill); cursor: pointer; transition: .15s; }
.userchip:hover { background: var(--surface-hover); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(140deg, #f59e0b, #ef4444); }
.userchip .who { font-size: 12.5px; line-height: 1.1; }
.userchip .who small { display: block; color: var(--text-faint); font-size: 11px; }

/* ============================================================================
   Layout body
   ========================================================================== */
main { padding: 26px clamp(20px, 4vw, 40px); max-width: 1480px; margin: 0 auto; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.025em; }
.page-head p { margin: 4px 0 0; color: var(--text-dim); font-size: 13.5px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--accent); color: #fff; border: 1px solid transparent;
  border-radius: var(--r-sm); padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .15s; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 4px 14px -6px var(--accent-ring);
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 15px; height: 15px; }
.btn.ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); box-shadow: none; }
.btn.ghost:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.btn.subtle { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }
.btn.subtle:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.btn.warn { background: var(--warn); color: #1a1407; box-shadow: none; }
.btn.danger { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); box-shadow: none; }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.btn.sm { padding: 6px 10px; font-size: 12px; }

/* ============================================================================
   KPI summary band
   ========================================================================== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--gap); margin-bottom: 26px; }
.kpi {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px; position: relative; overflow: hidden;
}
.kpi .klabel { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 7px; font-weight: 500; }
.kpi .klabel .ki { width: 22px; height: 22px; border-radius: var(--r-xs); display: grid; place-items: center; }
.kpi .klabel .ki svg { width: 13px; height: 13px; }
.kpi .kval { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin-top: 10px; line-height: 1; }
.kpi .kdelta { font-size: 12px; margin-top: 7px; color: var(--text-dim); display: flex; align-items: center; gap: 5px; }
.kpi .kdelta.up { color: var(--good); }
.kpi .kdelta.down { color: var(--bad); }
.kpi .kspark { position: absolute; right: 14px; bottom: 12px; width: 74px; height: 30px; opacity: .9; }
.ki.blue { background: var(--accent-soft); color: var(--accent-text); }
.ki.green { background: var(--good-soft); color: var(--good); }
.ki.amber { background: var(--warn-soft); color: var(--warn); }
.ki.red { background: var(--bad-soft); color: var(--bad); }

/* ============================================================================
   Org cards (global view)
   ========================================================================== */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.orgcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; cursor: pointer; transition: .18s; position: relative;
}
.orgcard:hover { border-color: var(--accent-ring); transform: translateY(-2px); box-shadow: var(--shadow); }
.orgcard .oc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.orgcard .oc-mark { width: 38px; height: 38px; border-radius: var(--r-md); display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; flex: none; }
.orgcard h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.orgcard .oc-head small { color: var(--text-faint); font-size: 12px; }
.orgcard .oc-arrow { margin-left: auto; color: var(--text-faint); transition: .18s; }
.orgcard:hover .oc-arrow { color: var(--accent); transform: translateX(3px); }

.health-bar { height: 8px; border-radius: 99px; overflow: hidden; display: flex; background: var(--meter-track); margin-bottom: 14px; }
.health-bar i { display: block; height: 100%; }
.health-bar i.on { background: var(--good); }
.health-bar i.off { background: var(--text-faint); }
.health-bar i.nc { background: var(--bad); }

.oc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.oc-stats .s { text-align: left; }
.oc-stats .s b { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.oc-stats .s span { display: block; font-size: 11.5px; color: var(--text-dim); margin-top: 1px; }
.dot-led { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.dot-led.g { background: var(--good); box-shadow: 0 0 7px var(--good); }
.dot-led.r { background: var(--bad); }
.dot-led.m { background: var(--text-faint); }

/* ============================================================================
   Org layout (sidebar + content)
   ========================================================================== */
.org-layout { display: grid; grid-template-columns: 216px 1fr; gap: 26px; align-items: start; }
.sidebar { position: sticky; top: 84px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: none; border: 0; color: var(--text-dim); padding: 9px 12px; border-radius: var(--r-sm);
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: .14s;
}
.nav button svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav button:hover { color: var(--text); background: var(--surface-hover); }
.nav button.active { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.nav button.active svg { color: var(--accent); opacity: 1; }
.nav button .count { margin-left: auto; font-size: 11px; color: var(--text-faint); background: var(--surface-2); padding: 1px 7px; border-radius: 99px; }
.nav button.active .count { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-text); }

.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 600; margin: 22px 0 8px 12px; }
.groups { display: flex; flex-direction: column; gap: 2px; }
.groups button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: 0;
  color: var(--text-dim); padding: 7px 12px; border-radius: var(--r-sm); font: inherit; font-size: 13px; cursor: pointer; transition: .14s; }
.groups button:hover { color: var(--text); background: var(--surface-hover); }
.groups button.active { color: var(--text); background: var(--surface-2); }
.groups button .gdot { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.groups button .count { margin-left: auto; font-size: 11px; color: var(--text-faint); }

/* ---- content panel ---- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; font-size: 14.5px; font-weight: 650; }
.panel-head .sub { color: var(--text-dim); font-size: 12.5px; }
.panel-head .spacer { flex: 1; }
.seg { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; }
.seg button { background: none; border: 0; color: var(--text-dim); font: inherit; font-size: 12px; padding: 5px 11px; border-radius: calc(var(--r-sm) - 2px); cursor: pointer; transition: .14s; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow); }

/* ============================================================================
   Tables
   ========================================================================== */
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid thead th {
  text-align: left; padding: 11px var(--cell-px); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint);
  border-bottom: 1px solid var(--border); background: var(--surface);
}
table.grid tbody td { padding: var(--row-py) var(--cell-px); border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.grid tbody tr { cursor: pointer; transition: background .12s; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover td { background: var(--surface-hover); }
.empty { padding: 56px 20px; text-align: center; color: var(--text-dim); }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .4; }

.host { display: flex; align-items: center; gap: 11px; }
.os-ico { width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); flex: none; color: var(--text-dim); }
.os-ico svg { width: 16px; height: 16px; }
.host .h-name { font-weight: 600; font-size: 13px; }
.host .h-sub { font-size: 11.5px; color: var(--text-faint); }

/* status pill */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: var(--r-pill); }
.status .led { width: 7px; height: 7px; border-radius: 50%; }
.status.on { background: var(--good-soft); color: var(--good); } .status.on .led { background: var(--good); box-shadow: 0 0 7px var(--good); }
.status.off { background: color-mix(in srgb, var(--text-faint) 16%, transparent); color: var(--text-dim); } .status.off .led { background: var(--text-faint); }

/* meter */
.meter { display: flex; align-items: center; gap: 9px; }
.meter .track { position: relative; height: 6px; width: 78px; background: var(--meter-track); border-radius: 99px; overflow: hidden; }
.meter .track i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--accent); }
.meter.warn .track i { background: var(--warn); } .meter.crit .track i { background: var(--bad); }
.meter .pct { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-dim); min-width: 30px; }
.meter.warn .pct { color: var(--warn); } .meter.crit .pct { color: var(--bad); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; }
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.na { background: color-mix(in srgb, var(--text-faint) 14%, transparent); color: var(--text-faint); }

.spark { width: 64px; height: 22px; display: block; }
[data-dataviz="off"] .spark, [data-dataviz="off"] .kpi .kspark { display: none; }

/* node + download cards */
.tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; }
.node-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); }
.code {
  background: var(--term-bg); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 13px 15px; font-family: var(--font-mono); font-size: 12.5px; color: #cde3ff; overflow-x: auto; position: relative;
}
.code .copy { position: absolute; top: 9px; right: 9px; }
.dl-block { margin-bottom: 18px; }
.dl-block .lab { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; display: flex; align-items: center; gap: 7px; }
.dl-block .lab svg { width: 14px; height: 14px; }

.subnet-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-3); border-radius: var(--r-sm); font-family: var(--font-mono); font-size: 12.5px; margin-bottom: 6px; }
.subnet-row .x { margin-left: auto; color: var(--text-faint); cursor: pointer; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; }
.subnet-row .x:hover { background: var(--bad-soft); color: var(--bad); }

/* ============================================================================
   Drawer
   ========================================================================== */
.scrim { position: fixed; inset: 0; background: rgba(3,5,9,.5); backdrop-filter: blur(2px); z-index: 60; opacity: 0; animation: fade .2s forwards; }
@keyframes fade { to { opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; width: 560px; max-width: 96vw; height: 100vh;
  background: var(--surface); border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; z-index: 61;
  transform: translateX(100%); transition: transform .28s cubic-bezier(.22,.61,.36,1);
}
.drawer.open { transform: translateX(0); }
.drawer.hidden { display: flex !important; transform: translateX(100%); pointer-events: none; }
.drawer-head { padding: 20px 22px 0; }
.drawer-head .top { display: flex; align-items: flex-start; gap: 13px; }
.drawer-head .os-ico { width: 42px; height: 42px; border-radius: var(--r-md); }
.drawer-head .os-ico svg { width: 22px; height: 22px; }
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.drawer-head .meta { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.drawer-head .meta span { display: inline-flex; align-items: center; gap: 5px; }
.drawer-close { margin-left: auto; }
.dtabs { display: flex; gap: 4px; margin: 18px 0 0; }
.dtabs button { background: none; border: 0; color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 500; padding: 9px 4px; margin-right: 16px; cursor: pointer; position: relative; }
.dtabs button.active { color: var(--text); font-weight: 600; }
.dtabs button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.drawer-head .dtabs { border-bottom: 1px solid var(--border); }
.drawer-body { padding: 22px; overflow-y: auto; flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.stat-grid .sg {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 15px;
}
.stat-grid .sg .l { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; }
.stat-grid .sg .v { font-size: 18px; font-weight: 700; margin-top: 5px; }
.stat-grid .sg .v small { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.stat-grid .sg.wide { grid-column: 1 / -1; }
.ring { width: 44px; height: 44px; flex: none; }

dl.inv { display: grid; grid-template-columns: 130px 1fr; gap: 0; font-size: 13px; margin: 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
dl.inv dt { color: var(--text-dim); padding: 9px 14px; border-bottom: 1px solid var(--border-soft); }
dl.inv dd { margin: 0; padding: 9px 14px; border-bottom: 1px solid var(--border-soft); word-break: break-word; }
dl.inv dt:last-of-type, dl.inv dd:last-of-type { border-bottom: 0; }
.sec-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 600; margin: 22px 0 10px; }

/* terminal */
.terminal { background: var(--term-bg); border: 1px solid var(--border-strong); border-radius: var(--r-md); overflow: hidden; }
.terminal .tbar { display: flex; align-items: center; gap: 7px; padding: 9px 13px; border-bottom: 1px solid #18202b; background: #0b0f16; }
.terminal .tbar .d { width: 11px; height: 11px; border-radius: 50%; }
.terminal .tbar .d.r { background: #ff5f57; } .terminal .tbar .d.y { background: #febc2e; } .terminal .tbar .d.g { background: #28c840; }
.terminal .tbar .t { margin-left: 8px; font-family: var(--font-mono); font-size: 11.5px; color: #6b7c90; }
.terminal pre { margin: 0; padding: 14px; height: 320px; overflow-y: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; color: #d4e7ff; }
.terminal pre .p { color: var(--good); }
.term-form { display: flex; align-items: center; gap: 8px; margin-top: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px 4px 4px 13px; }
.term-form .chev { color: var(--accent); font-family: var(--font-mono); }
.term-form input { flex: 1; border: 0; background: none; outline: none; color: var(--text); font-family: var(--font-mono); font-size: 13px; padding: 8px 0; }

.actions-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.action {
  display: flex; align-items: center; gap: 11px; text-align: left; padding: 13px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text); cursor: pointer; transition: .14s; font: inherit;
}
.action:hover { border-color: var(--border-strong); background: var(--surface-hover); transform: translateY(-1px); }
.action .ai { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; background: var(--surface-3); }
.action .ai svg { width: 16px; height: 16px; }
.action .at { font-size: 13px; font-weight: 600; }
.action .ad { font-size: 11.5px; color: var(--text-faint); }
.action.danger .ai { background: var(--bad-soft); color: var(--bad); }
.action.warn .ai { background: var(--warn-soft); color: var(--warn); }
.action.go .ai { background: var(--accent-soft); color: var(--accent); }

.field { display: flex; gap: 8px; margin-top: 10px; }
.field input { flex: 1; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: var(--r-sm); padding: 9px 12px; font: inherit; font-family: var(--font-mono); font-size: 12.5px; outline: none; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text);
  padding: 11px 18px; border-radius: var(--r-md); font-size: 13px; z-index: 200; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 9px; opacity: 0; pointer-events: none; transition: .22s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 16px; height: 16px; color: var(--good); }

@media (max-width: 900px) {
  .org-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .nav { flex-direction: row; overflow-x: auto; }
  .side-label, .groups { display: none; }
  .searchbox { display: none; }
}
