/* GlueStream — documentation UI: navy sidebar, light content, optional dark mode */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface2: #f7f9fc;
  --line: #e4e9f0;
  --text: #1a2330;
  --muted: #64748b;
  --faint: #94a3b8;
  --accent: #0c9d63;
  --accent-hover: #0b8a57;
  --accent-weak: rgba(12, 157, 99, .11);
  --accent-contrast: #ffffff;
  --brand: #1ce783;
  --danger: #d92d3f;
  --danger-weak: #fdecee;
  --warn: #b45309;
  --warn-weak: #fdf3e0;
  --ok: #0c7d52;
  --ok-weak: #e2f7ec;
  --sb-bg: #0f1a2b;
  --sb-bg2: #0b1420;
  --sb-text: #93a5be;
  --sb-line: rgba(255, 255, 255, .07);
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 18px 50px rgba(16, 24, 40, .22);
  --code-bg: #f1f5f9;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --sb-w: 236px;
}

:root[data-theme="dark"] {
  --bg: #0f141c;
  --surface: #161d28;
  --surface2: #1b2431;
  --line: #263141;
  --text: #edf2f8;
  --muted: #91a1b6;
  --faint: #64748b;
  --accent: #1ce783;
  --accent-hover: #3cec95;
  --accent-weak: rgba(28, 231, 131, .13);
  --accent-contrast: #052b18;
  --danger: #ff5c6e;
  --danger-weak: rgba(255, 92, 110, .14);
  --warn: #ffb347;
  --warn-weak: rgba(255, 179, 71, .13);
  --ok: #34d399;
  --ok-weak: rgba(52, 211, 153, .13);
  --sb-bg: #0b1220;
  --sb-bg2: #081020;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
  --code-bg: #10171f;
}

html { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  min-height: 100vh;
}
::selection { background: rgba(28, 231, 131, .3); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; font-size: inherit; }
/* A default size for bare icons. Anything that wants another size sets it via a
   class rule, which outranks this selector — this only catches an icon dropped
   somewhere that forgot to size it, which would otherwise fill the page. */
svg { display: block; width: 16px; height: 16px; flex: 0 0 auto; }
use, g { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#i-star-fill { fill: currentColor; stroke: currentColor; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3ccd9; border-radius: 8px; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #334052; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

/* ------------------------------------------------------------------ shell */
#app-shell { min-height: 100vh; }
#sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 45;
  background: var(--sb-bg); display: flex; flex-direction: column;
}
#main-col { margin-left: var(--sb-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
#view { flex: 1; padding: 26px 30px 56px; max-width: 1240px; width: 100%; }
#foot { padding: 18px 30px 26px; color: var(--faint); font-size: 12px; border-top: 1px solid var(--line); }

body.auth-mode #sidebar, body.auth-mode #topbar, body.auth-mode #foot { display: none; }
body.auth-mode #main-col { margin-left: 0; }

/* ------------------------------------------------------------------ sidebar */
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid var(--sb-line); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; }
.brand-word { font-size: 18.5px; font-weight: 800; letter-spacing: -.3px; color: #fff; }
.brand-word em { font-style: normal; color: var(--brand); }

#sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
#sidebar-nav::-webkit-scrollbar-thumb { background: #2a3850; }
.nav-label {
  font-size: 10px; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase;
  color: #55677f; padding: 16px 10px 6px;
}
#sidebar-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--sb-text); font-size: 13.5px; font-weight: 600;
  transition: background .12s, color .12s;
}
#sidebar-nav a svg { width: 17px; height: 17px; flex: 0 0 auto; }
#sidebar-nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
#sidebar-nav a.active { background: var(--accent-weak); color: #fff; }
#sidebar-nav a.active svg { color: var(--brand); }

/* expandable documentation sections */
.nav-group .nav-row { display: flex; align-items: center; }
.nav-group .nav-row a { flex: 1; min-width: 0; }
.nav-toggle {
  width: 26px; height: 30px; display: grid; place-items: center; flex: 0 0 auto;
  color: #55677f; border-radius: 7px; transition: color .12s, background .12s;
}
.nav-toggle:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.nav-toggle svg { width: 13px; height: 13px; transition: transform .16s ease; }
.nav-group.open .nav-toggle svg { transform: rotate(90deg); }
.nav-subs { display: none; margin: 1px 0 4px 0; }
.nav-group.open .nav-subs { display: block; }
#sidebar-nav a.nav-sub {
  padding: 6px 10px 6px 38px; font-size: 12.5px; font-weight: 500;
  color: #7c8ca4; display: flex; align-items: center; gap: 8px; position: relative;
}
#sidebar-nav a.nav-sub::before {
  content: ""; position: absolute; left: 24px; top: 0; bottom: 0; width: 1px; background: var(--sb-line);
}
#sidebar-nav a.nav-sub:hover { color: #fff; }
#sidebar-nav a.nav-sub.active { color: #fff; background: var(--accent-weak); }
#sidebar-nav a.nav-sub span:first-child { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count { font-size: 11px; font-weight: 700; color: #55677f; flex: 0 0 auto; }
#sidebar-nav a.nav-sub.active .nav-count { color: var(--brand); }

#sidebar-user { border-top: 1px solid var(--sb-line); padding: 10px; position: relative; }
.user-block {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 9px; text-align: left;
  transition: background .12s;
}
.user-block:hover { background: rgba(255, 255, 255, .07); }
.user-block .ub-text { flex: 1; min-width: 0; }
.user-block .ub-text b { display: block; color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-block .ub-text small { color: #55677f; font-size: 11.5px; }
.user-block > svg { width: 14px; height: 14px; color: #55677f; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center;
  font-weight: 800; font-size: 14px; color: #fff; flex: 0 0 auto;
}

.user-menu {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% + 6px); z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; box-shadow: var(--shadow-lg);
}
.um-head { padding: 9px 11px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.um-head .um-name { font-weight: 800; font-size: 14px; }
.um-head small { color: var(--muted); font-size: 11.5px; }
.um-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 11px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  transition: background .12s, color .12s;
}
.um-item:hover { background: var(--surface2); color: var(--text); }
.um-item svg { width: 15px; height: 15px; }
.um-item.danger:hover { color: var(--danger); background: var(--danger-weak); }

/* ------------------------------------------------------------------ topbar */
/* Three tracks so the middle one is centred on the page rather than on
   whatever is left over after the buttons — the sides can differ in width
   without dragging the search box off-centre. */
#topbar {
  position: sticky; top: 0; z-index: 35; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 12px; padding: 0 22px;
}
#topbar .tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
#topbar .tb-mid { display: flex; align-items: center; gap: 10px; justify-self: center; }
#topbar .tb-right { display: flex; align-items: center; gap: 10px; justify-self: end; }
#topbar .spacer { flex: 1; }

/* Which organization everything is showing. Sits with the search because both
   answer the same question: what am I looking at right now. */
.org-scope {
  display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 9px;
  /* Lighter than the bar it sits on, so it reads as a control rather than a
     label — the bar itself is --surface. */
  background: var(--surface2); color: var(--text);
  font: inherit; font-size: 13.5px; cursor: pointer;
  max-width: 230px; transition: border-color .12s, background .12s;
}
.org-scope:hover { border-color: var(--accent); }
.org-scope svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 auto; }
/* This says what you are currently looking at, so it carries the same weight as
   the other controls on the bar rather than reading as a caption. A native
   select also does not inherit font weight — it has to be set here. */
.org-scope select {
  border: 0; background: none; color: var(--text); cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  max-width: 165px; text-overflow: ellipsis; padding: 0; outline: none;
}
/* The open list is drawn by the platform, which does not inherit the page
   theme — set both halves so it is legible in dark mode too. */
.org-scope select option { background: var(--surface); color: var(--text); font-weight: 500; }
.org-scope:focus-within { border-color: var(--accent); }
/* Narrowed to one organization: say so plainly, so a short list is never
   mistaken for an empty system. */
.org-scope.on { border-color: var(--accent); background: var(--accent-weak); }
.org-scope.on svg { color: var(--accent); }
.org-scope.on select { color: var(--accent); font-weight: 700; }
.org-scope.on select option { color: var(--text); font-weight: 500; }
.scope-note {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  padding: 8px 12px; border-radius: 9px;
  background: var(--accent-weak); border: 1px solid var(--line);
  color: var(--text); font-size: 12.5px;
}
.scope-note svg { width: 15px; height: 15px; color: var(--accent); flex: 0 0 auto; }
.scope-note button {
  margin-left: auto; background: none; border: 0; color: var(--accent);
  font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline;
}
@media (max-width: 900px) {
  #topbar { grid-template-columns: auto 1fr auto; padding: 0 12px; }
  #topbar .tb-mid { justify-self: stretch; }
  .org-scope { max-width: 132px; }
  .org-scope select { max-width: 92px; }
}
#nav-burger { display: none; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
  color: var(--muted); transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.search-fake {
  display: flex; align-items: center; gap: 9px;
  width: min(420px, 50vw); padding: 8px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
  color: var(--faint); font-size: 13.5px; text-align: left;
  transition: border-color .15s, background .15s;
}
.search-fake:hover { border-color: #c9d3e0; }
.search-fake svg { width: 15px; height: 15px; flex: 0 0 auto; }
.search-fake span { flex: 1; }
.search-fake kbd {
  font-family: inherit; font-size: 11px; font-weight: 700; color: var(--faint);
  border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; background: var(--surface);
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 13.5px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  transition: background .12s, border-color .12s, transform .08s, filter .12s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface2); border-color: #c9d3e0; }
:root[data-theme="dark"] .btn:hover { border-color: #35435a; }
.btn:active { transform: scale(.98); }
.btn svg { width: 15px; height: 15px; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger-weak); border-color: transparent; color: var(--danger); box-shadow: none; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface2); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.on { color: var(--accent); border-color: var(--accent); }

.mini-btn {
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
  color: var(--muted); background: var(--surface2); border: 1px solid var(--line); flex: 0 0 auto;
}
.mini-btn:hover { color: var(--text); background: var(--line); }
.mini-btn svg { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ page & panels */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.page-head .count {
  color: var(--muted); font-size: 12.5px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
}
.page-head .spacer { flex: 1; }
.page-sub { color: var(--muted); margin: -10px 0 18px; max-width: 760px; font-size: 13.5px; }
.page-sub svg, .note-line svg { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 13px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.panel-head .spacer { flex: 1; }
.panel-head a { color: var(--accent); font-size: 12.5px; font-weight: 700; }
.panel-head a:hover { text-decoration: underline; }
.panel-pad { padding: 14px 16px; }

/* list rows */
.lrow {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer; min-width: 0;
  transition: background .1s;
}
.lrow + .lrow { border-top: 1px solid var(--line); }
.lrow:hover { background: var(--surface2); }
.lr-chip {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  color: rgba(255, 255, 255, .92); flex: 0 0 auto;
}
.lr-chip svg { width: 16px; height: 16px; }
.lr-chip.xl { width: 46px; height: 46px; border-radius: 12px; }
.lr-chip.xl svg { width: 22px; height: 22px; }
.lr-chip .lr-init { font-weight: 800; font-size: 13px; }
.lr-main { flex: 1; min-width: 0; }
.lr-main b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-main small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-time { color: var(--faint); font-size: 12px; flex: 0 0 auto; }
.lr-fav {
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
  color: var(--faint); opacity: 0; transition: opacity .12s, color .12s, background .12s; flex: 0 0 auto;
}
.lrow:hover .lr-fav { opacity: 1; }
.lr-fav:hover { background: var(--line); color: var(--text); }
.lr-fav.on { opacity: 1; color: var(--accent); }
.lr-fav svg { width: 15px; height: 15px; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 800; padding: 2.5px 9px;
  border-radius: 999px; white-space: nowrap; flex: 0 0 auto;
}
.badge.tone-warn { background: var(--warn-weak); color: var(--warn); }
.badge.tone-danger { background: var(--danger-weak); color: var(--danger); }
.badge.tone-ok { background: var(--ok-weak); color: var(--ok); }
.badge.tone-plain { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.inline-badge { font-size: 10.5px; font-weight: 800; padding: 1.5px 7px; border-radius: 999px; margin-left: 7px; vertical-align: 1px; }
.inline-badge.warn { background: var(--warn-weak); color: var(--warn); }
.inline-badge.danger { background: var(--danger-weak); color: var(--danger); }

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-sm); transition: border-color .12s, transform .1s;
}
a.stat-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.stat-card .sc-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-weak); color: var(--accent); flex: 0 0 auto;
}
.stat-card.warn .sc-icon { background: var(--warn-weak); color: var(--warn); }
.stat-card .sc-icon svg { width: 18px; height: 18px; }
/* The number and its label were inline siblings, so they ran together as
   "5ORGANIZATIONS". Stack them with real breathing room. */
.stat-card > span:last-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sc-num { font-size: 22px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.stat-card.warn .sc-num { color: var(--warn); }
.sc-label {
  font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--muted); line-height: 1.25;
}

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
/* grid items default to min-width:auto, so a long one-line row would widen the column past the screen */
.dash-cols > * { min-width: 0; }
@media (max-width: 1000px) { .dash-cols { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ chips */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.chips .spacer { flex: 1; }
.chip {
  padding: 5.5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: var(--surface); color: var(--muted); border: 1px solid var(--line);
  transition: all .12s;
}
.chip:hover { color: var(--text); border-color: #c9d3e0; }
:root[data-theme="dark"] .chip:hover { border-color: #35435a; }
.chip.on { background: var(--accent-weak); color: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------------ org tiles & header */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.org-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color .12s, transform .1s, box-shadow .12s;
  display: flex; flex-direction: column; gap: 10px; position: relative;
}
.org-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.org-tile .ot-head { display: flex; align-items: center; gap: 12px; }
.org-tile h3 { font-size: 15px; font-weight: 800; letter-spacing: -.2px; }
.org-tile .ot-tag { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.org-tile .ot-counts { color: var(--faint); font-size: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.org-tile .lr-fav { position: absolute; top: 12px; right: 12px; }

.org-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.org-head .oh-text { flex: 1; min-width: 220px; }
.org-head h1 { font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.org-head .tagline { color: var(--muted); font-size: 13.5px; }
.oh-stats { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.stat-pill {
  background: var(--surface2); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 11px; font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.stat-pill b { color: var(--accent); }
.oh-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.org-desc { color: var(--muted); max-width: 800px; margin: 0 0 16px; font-size: 13.5px; }

/* magic dash */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 18px; }
.dash-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; display: block; box-shadow: var(--shadow-sm); transition: border-color .12s, transform .1s;
}
a.dash-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.dash-card.warn { border-color: rgba(180, 83, 9, .35); }
.dc-num { font-size: 24px; font-weight: 800; letter-spacing: -.6px; line-height: 1.1; }
.dash-card.warn .dc-num { color: var(--warn); }
.dc-label { font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-top: 1px; }
.dash-activity { grid-column: span 2; }
.dash-act { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-top: 6px; min-width: 0; }
.dash-act b { flex: 0 0 auto; }
.da-detail { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.da-time { color: var(--faint); font-size: 11px; flex: 0 0 auto; }
@media (max-width: 900px) { .dash-activity { grid-column: 1 / -1; } }

/* gradient identity chips */
.g0 { background: linear-gradient(135deg, #14795c, #0b6e4f); }
.g1 { background: linear-gradient(135deg, #2b4a9e, #274690); }
.g2 { background: linear-gradient(135deg, #6d3d94, #7b2d8b); }
.g3 { background: linear-gradient(135deg, #9a5a32, #96502b); }
.g4 { background: linear-gradient(135deg, #1f6f95, #1c7ea8); }
.g5 { background: linear-gradient(135deg, #8a4a6a, #8a3d62); }
.g6 { background: linear-gradient(135deg, #257382, #1c6e7d); }
.g7 { background: linear-gradient(135deg, #8a7326, #8a6d1d); }
.g8 { background: linear-gradient(135deg, #5f47a8, #5b3ba8); }
.g9 { background: linear-gradient(135deg, #23825d, #177a52); }

/* ------------------------------------------------------------------ tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table { display: table; }
.data-table th {
  text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface2);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.data-table .muted { color: var(--muted); font-size: 12.5px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.role-badge {
  display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  padding: 2.5px 9px; border-radius: 999px; background: var(--surface2); color: var(--muted); border: 1px solid var(--line);
}
.role-badge.admin { background: var(--accent-weak); color: var(--accent); border-color: transparent; }
.mini-avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center;
  font-weight: 800; font-size: 12px; color: #fff; vertical-align: middle;
}
.action-badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
  background: var(--surface2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.action-badge.accent { background: var(--accent-weak); color: var(--accent); border-color: transparent; }
.action-badge.warn { background: var(--warn-weak); color: var(--warn); border-color: transparent; }
.action-badge.danger { background: var(--danger-weak); color: var(--danger); border-color: transparent; }

/* ------------------------------------------------------------------ empty state */
.empty { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 38px; height: 38px; margin: 0 auto 12px; opacity: .45; }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* ------------------------------------------------------------------ overlays & modals */
.overlay {
  position: fixed; inset: 0; z-index: 70; overflow-y: auto;
  background: rgba(15, 23, 42, .48); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 20px 60px; animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative; width: min(860px, 100%);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  color: var(--muted); background: var(--surface2); border: 1px solid var(--line);
}
.modal-close:hover { background: var(--line); color: var(--text); }
.modal-close svg { width: 15px; height: 15px; }

.detail-head { display: flex; align-items: center; gap: 14px; padding: 22px 26px 18px; border-bottom: 1px solid var(--line); background: var(--surface2); }
.dh-text { min-width: 0; flex: 1; padding-right: 40px; }
.dh-kind { display: flex; align-items: center; gap: 8px; font-size: 10.5px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.detail-head h2 { font-size: 19px; font-weight: 800; letter-spacing: -.3px; line-height: 1.25; }
.dh-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.dh-meta a { color: var(--accent); font-weight: 700; }
.dh-meta a:hover { text-decoration: underline; }

.modal-body { padding: 20px 26px 26px; }
.modal-actions { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }

.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 18px; }
.fitem { background: var(--surface2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; min-width: 0; }
.fitem label { display: block; font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.fitem .val { font-size: 13.5px; font-weight: 600; word-break: break-word; }
.fitem .val a { color: var(--accent); }
.fitem .val a:hover { text-decoration: underline; }
.fitem.wide { grid-column: 1 / -1; }
.fitem .hint { display: block; margin-top: 4px; font-size: 11px; color: var(--faint); }
.byline { color: var(--faint); }

.secret-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.secret-val { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13.5px; letter-spacing: .5px; flex: 1; word-break: break-all; min-width: 120px; }
.otp-code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 20px; font-weight: 700; letter-spacing: 3px; color: var(--accent); min-width: 108px; }
.otp-timer { color: var(--muted); font-size: 12px; font-weight: 700; min-width: 32px; }

.section-label { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 6px 0 10px; }
.timestamps { color: var(--faint); font-size: 12px; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.cb-progress { font-size: 11px; font-weight: 800; letter-spacing: .5px; margin-left: 8px; color: var(--warn); text-transform: none; }
.cb-progress.all-done { color: var(--ok); }

/* related rows */
.rel-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.rel-list .lrow { background: var(--surface); }
.rel-list .lrow:hover { background: var(--surface2); }
.rel-unlink {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  color: var(--faint); opacity: 0; transition: opacity .12s, background .12s, color .12s; flex: 0 0 auto;
}
.lrow:hover .rel-unlink { opacity: 1; }
.rel-unlink:hover { background: var(--danger-weak); color: var(--danger); }
.rel-unlink svg { width: 13px; height: 13px; }
.related-empty { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

/* markdown */
.md { color: var(--text); font-size: 14px; margin-bottom: 16px; }
.md h1 { font-size: 20px; margin: 16px 0 8px; letter-spacing: -.3px; }
.md h2 { font-size: 16.5px; margin: 16px 0 7px; }
.md h3, .md h4 { font-size: 14.5px; margin: 12px 0 5px; }
.md h1:first-child, .md h2:first-child { margin-top: 0; }
.md p { margin: 7px 0; }
.md ul, .md ol { margin: 7px 0 7px 22px; }
.md li { margin: 3px 0; }
.md code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }
.md pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; overflow-x: auto; margin: 10px 0; }
.md pre code { background: none; border: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--accent); padding: 3px 13px; margin: 9px 0; color: var(--muted); }
.md a { color: var(--accent); }
.md a:hover { text-decoration: underline; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

/* checklists */
.md ul.cb-list { list-style: none; margin-left: 2px; }
.cb-item { margin: 5px 0; }
.cb-item label { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.cb-item input[type="checkbox"] {
  appearance: none; width: 17px; height: 17px; flex: 0 0 auto; margin-top: 2px;
  border: 2px solid #b6c2d2; border-radius: 5px; cursor: pointer; position: relative;
  transition: background .12s, border-color .12s; background: var(--surface);
}
:root[data-theme="dark"] .cb-item input[type="checkbox"] { border-color: #3a4a5f; }
.cb-item input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.cb-item input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 3.5px; top: 0px; width: 5px; height: 9px;
  border: solid var(--accent-contrast); border-width: 0 2.5px 2.5px 0; transform: rotate(43deg);
}
.cb-item span.done { color: var(--faint); text-decoration: line-through; }

/* ------------------------------------------------------------------ forms */
.form-title { font-size: 17px; font-weight: 800; letter-spacing: -.3px; padding: 22px 26px 0; }
.form-sub { color: var(--muted); font-size: 12.5px; padding: 3px 26px 0; }
.form-modal .modal-body { padding-top: 18px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; min-width: 0; }
.field label { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 8.5px 11px; font-size: 13.5px; font-family: inherit;
  outline: none; transition: border-color .12s, box-shadow .12s; width: 100%;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field textarea.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak);
}
.field .with-btn { display: flex; gap: 8px; align-items: center; }
.field .with-btn input, .field .with-btn select { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 6px; }
.setup-start { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.setup-start legend { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; padding: 0; }
.setup-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.setup-opt:hover { border-color: var(--accent); }
.setup-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); }
.setup-opt input { margin-top: 3px; accent-color: var(--accent); }
.setup-opt b { display: block; font-size: 13px; }
.setup-opt small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.auth-err { color: var(--danger); font-size: 13px; font-weight: 600; margin: -3px 0 10px; min-height: 17px; }

/* kind picker */
.picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 20px 26px 26px; }
.pick-tile {
  border: 1px solid var(--line); border-radius: 11px; padding: 18px 12px 15px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--surface); transition: all .12s; text-align: center;
}
.pick-tile:hover { border-color: var(--accent); background: var(--accent-weak); transform: translateY(-2px); }
.pick-tile svg { width: 26px; height: 26px; color: var(--accent); }
.pick-tile span { font-weight: 700; font-size: 13px; }
.pick-tile small { color: var(--muted); font-size: 11.5px; }
.pick-tile.pick-new { border-style: dashed; }
.pick-tile.pick-new svg { color: var(--muted); }
.pick-tile.pick-new:hover svg { color: var(--accent); }

/* layout editor */
.lf-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 7px;
  background: var(--surface2);
}
.lf-row input, .lf-row select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  color: var(--text); padding: 6px 9px; font-size: 12.5px; font-family: inherit; outline: none;
}
.lf-row input:focus, .lf-row select:focus { border-color: var(--accent); }
.lf-label { flex: 1 1 150px; min-width: 130px; }
.lf-type { flex: 0 0 auto; }
.lf-options { flex: 1 1 160px; }
.lf-badge { width: 86px; }
.lf-expwrap { display: flex; align-items: center; gap: 8px; }
.lf-flag { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.lf-flag input { accent-color: var(--accent); width: auto; }
.lf-moves { display: flex; gap: 4px; margin-left: auto; }
.lf-moves .mini-btn svg { width: 12px; height: 12px; }
/* second line of a field row: validation and presentation options */
.lf-more {
  flex: 1 1 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-top: 9px; margin-top: 2px; border-top: 1px dashed var(--line);
}
.lf-more[hidden] { display: none; }
.lf-hint { flex: 1 1 190px; min-width: 150px; }
.lf-placeholder, .lf-default { flex: 1 1 130px; min-width: 110px; }
.lf-span { flex: 0 0 auto; }
/* Headings and dividers carry no value, so validation options don't apply. */
.lf-more.lf-structural .lf-required,
.lf-more.lf-structural .lf-placeholder,
.lf-more.lf-structural .lf-default,
.lf-more.lf-structural .lf-span { display: none; }
.lf-more.lf-structural .lf-flag { display: none; }

/* ---- menu editor ---- */
.menu-panel .panel-pad { padding-top: 10px; padding-bottom: 10px; }
.menu-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px;
  margin-bottom: 6px; background: var(--surface2);
}
.menu-row.is-hidden { opacity: .5; }
.menu-row.is-hidden .menu-label { text-decoration: line-through; }
.menu-icon { color: var(--muted); display: flex; flex: 0 0 auto; }
.menu-icon svg { width: 15px; height: 15px; }
.menu-label { flex: 1 1 160px; min-width: 120px; }
.menu-row input, .menu-row select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  color: var(--text); padding: 6px 9px; font-size: 12.5px; font-family: inherit; outline: none;
}
.menu-row input:focus, .menu-row select:focus { border-color: var(--accent); }
.menu-section { flex: 0 0 auto; }
.menu-row .mini-btn.on { color: var(--accent); border-color: var(--accent); }
.menu-row .mini-btn[disabled] { opacity: .3; cursor: not-allowed; }
.menu-empty { color: var(--muted); font-size: 12.5px; padding: 6px 2px; }
.ml-label { flex: 1 1 140px; }
.ml-url { flex: 2 1 220px; }

/* ---- branding ---- */
.brand-logo-row { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.brand-logo-prev {
  width: 62px; height: 62px; border-radius: 14px; flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--surface2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.brand-logo-prev img, .brand-logo-prev svg { width: 100%; height: 100%; object-fit: contain; }
#brand-accent-pick {
  width: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); cursor: pointer; height: 32px;
}
.accent-chip { display: inline-flex; align-items: center; gap: 6px; }
.accent-chip .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.brand-preview {
  display: flex; gap: 0; margin-top: 16px; border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; background: var(--surface2); max-width: 560px;
}
.bp-side { width: 168px; flex: 0 0 auto; padding: 12px 10px; background: var(--surface); border-right: 1px solid var(--line); }
.bp-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; }
.bp-mark { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); flex: 0 0 auto; }
.bp-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 7px; font-size: 12px; color: var(--muted); margin-bottom: 2px;
}
.bp-item svg { width: 14px; height: 14px; }
.bp-item.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.bp-main { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.bp-row { display: flex; align-items: center; gap: 9px; }
.bp-btn { pointer-events: none; font-size: 12px; padding: 5px 11px; }
.bp-line { height: 8px; border-radius: 4px; background: var(--line); }
.bp-line.short { width: 55%; }

/* ---- sso ---- */
.btn-sso { width: 100%; justify-content: center; margin-bottom: 4px; }
.auth-or {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 10px;
  color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
}
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.sso-ok, .sso-bad {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 12px;
  padding: 10px 12px; border-radius: 9px; font-size: 12.5px; border: 1px solid var(--line);
}
.sso-ok { color: var(--ok, #1ce783); border-color: color-mix(in srgb, var(--ok, #1ce783) 40%, var(--line)); }
.sso-bad { color: var(--danger, #ef4444); border-color: color-mix(in srgb, var(--danger, #ef4444) 40%, var(--line)); }
.sso-ok svg, .sso-bad svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.sso-ok small, .sso-bad small { display: block; color: var(--muted); margin-top: 2px; }

#layout-icon-preview { color: var(--accent); cursor: default; }
#layout-icon-preview svg { width: 16px; height: 16px; }

/* link picker */
.link-results { max-height: 380px; overflow-y: auto; margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.link-row {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px;
  cursor: pointer; transition: background .1s; text-align: left; width: 100%;
}
.link-row:hover { background: var(--surface2); }
.link-row .lr-icon {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto;
  color: rgba(255, 255, 255, .92);
}
.link-row .lr-icon svg { width: 16px; height: 16px; }
.link-row .lr-text { min-width: 0; }
.link-row .lr-text b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-row .lr-text small { color: var(--muted); font-size: 11.5px; }

/* credentials box */
.cred-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; margin-bottom: 9px;
}
.cred-box code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 14px; letter-spacing: .4px; }
.cred-box small { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1.1px; font-weight: 800; margin-bottom: 1px; }

/* ------------------------------------------------------------------ version history */
.history-box { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.hrow {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--surface); transition: background .1s; flex-wrap: wrap;
}
.hrow + .hrow { border-top: 1px solid var(--line); }
.hrow:hover { background: var(--surface2); }
.hrow.current { background: var(--accent-weak); }
.hrow.current:hover { background: var(--accent-weak); }
.hv {
  font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; font-weight: 700;
  color: var(--muted); background: var(--surface2); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 8px; flex: 0 0 auto; min-width: 40px; text-align: center;
}
.hrow.current .hv { color: var(--accent); border-color: var(--accent); background: transparent; }
.hmain { flex: 1; min-width: 140px; }
.hmain b { display: block; font-size: 13px; font-weight: 600; }
.hmain small { display: block; color: var(--muted); font-size: 11.5px; }

.diff-list { margin-bottom: 16px; }
.diff-row {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px;
  margin-bottom: 6px; background: var(--surface2); font-size: 13px;
}
.diff-row svg { width: 13px; height: 13px; color: var(--faint); flex: 0 0 auto; }
.diff-label { font-weight: 700; min-width: 110px; flex: 0 0 auto; }
.diff-from, .diff-to { padding: 2px 8px; border-radius: 6px; word-break: break-word; max-width: 100%; }
.diff-from { background: var(--danger-weak); color: var(--danger); text-decoration: line-through; text-decoration-color: rgba(217,45,63,.45); }
.diff-to { background: var(--ok-weak); color: var(--ok); }
.diff-from i, .diff-to i { opacity: .65; font-size: 12px; }

/* recycle bin */
.trash-row .lr-main b { color: var(--muted); }
.trash-row .lr-chip { opacity: .6; }
.trash-row:hover .lr-chip { opacity: 1; }
.trash-row:hover .lr-main b { color: var(--text); }

/* ------------------------------------------------------------------ permissions editor */
.perm-admin-note {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--accent-weak); border: 1px solid var(--accent); border-radius: 10px;
  padding: 11px 14px; margin: 4px 0 14px; font-size: 12.5px; color: var(--text);
}
.perm-admin-note svg { width: 16px; height: 16px; color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.perm-dimmed { opacity: .45; pointer-events: none; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-bottom: 6px; }
.perm-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface2); }
.perm-group-title {
  font-size: 10px; font-weight: 800; letter-spacing: 1.3px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.perm-row { display: flex; align-items: flex-start; gap: 9px; padding: 5px 0; cursor: pointer; }
.perm-row input[type="checkbox"] {
  appearance: none; width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px;
  border: 2px solid #b6c2d2; border-radius: 5px; cursor: pointer; position: relative;
  transition: background .12s, border-color .12s; background: var(--surface);
}
:root[data-theme="dark"] .perm-row input[type="checkbox"] { border-color: #3a4a5f; }
.perm-row input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.perm-row input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 3.5px; top: 0px; width: 5px; height: 9px;
  border: solid var(--accent-contrast); border-width: 0 2.5px 2.5px 0; transform: rotate(43deg);
}
.perm-row span { min-width: 0; }
.perm-row b { display: block; font-size: 13px; font-weight: 700; }
.perm-row small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; }

.scope-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 4px; }
.scope-chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--line); color: var(--muted);
  transition: all .12s;
}
.scope-chip:hover { border-color: #c9d3e0; color: var(--text); }
:root[data-theme="dark"] .scope-chip:hover { border-color: #35435a; }
.scope-chip:has(input:checked) { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.scope-chip input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }

/* per-organization section limits */
.ol-row {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  margin-bottom: 7px; background: var(--surface2);
}
.ol-row .scope-list { margin: 6px 0 2px 26px; }

/* sub-section chip row on browse pages */
.subsection-chips { margin-bottom: 10px; }
.chip-count {
  font-size: 10.5px; font-weight: 800; opacity: .7; margin-left: 3px;
  padding: 0 5px; border-radius: 999px; background: rgba(127, 140, 160, .18);
}
.chip.on .chip-count { background: rgba(0, 0, 0, .12); opacity: .9; }
:root[data-theme="dark"] .chip.on .chip-count { background: rgba(255, 255, 255, .14); }
.page-head .crumb { color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------------ search overlay */
.search-overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(3px); overflow-y: auto; padding: 8vh 20px 60px; animation: fadein .12s ease;
}
.search-box {
  max-width: 680px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  overflow: hidden; animation: pop .15s ease;
}
.search-input-wrap { position: relative; border-bottom: 1px solid var(--line); }
.search-input-wrap svg.si { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
#search-input {
  width: 100%; background: transparent; border: none;
  padding: 15px 18px 15px 44px; font-size: 15.5px; color: var(--text); outline: none; font-family: inherit;
}
.search-results { max-height: 60vh; overflow-y: auto; padding: 6px 0 10px; }
.sr-group h2 {
  font-size: 10.5px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); padding: 12px 16px 4px;
}
.search-hint { text-align: center; color: var(--faint); font-size: 12.5px; padding: 26px 16px; }

/* ------------------------------------------------------------------ auth */
.auth-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 10; }
.auth-bg { position: absolute; inset: 0; background: var(--sb-bg); }
.auth-bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(800px 500px at 50% 18%, rgba(28, 231, 131, .12), transparent 60%);
}
.auth-card {
  position: relative; z-index: 2; width: min(420px, 100%);
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 34px 32px 30px; box-shadow: var(--shadow-lg); animation: pop .2s ease;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-brand svg { width: 34px; height: 34px; border-radius: 9px; }
.auth-brand .brand-word { font-size: 21px; color: var(--text); }
.auth-brand .brand-word em { color: var(--accent); }
.auth-card h1 { font-size: 18px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 3px; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14px; margin-top: 4px; }
.auth-foot { margin-top: 16px; color: var(--faint); font-size: 11.5px; text-align: center; }

/* ------------------------------------------------------------------ toast */
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: toast-in .2s ease;
  display: flex; align-items: center; gap: 9px; max-width: 90vw;
}
.toast.error { border-left-color: var(--danger); }
.toast svg { width: 15px; height: 15px; color: var(--accent); flex: 0 0 auto; }
.toast.error svg { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast.bye { opacity: 0; transform: translateY(6px); transition: all .22s ease; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  #sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  body.sb-open #sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .4); }
  #main-col { margin-left: 0; }
  #nav-burger { display: grid; }
  #view { padding: 18px 16px 44px; }
  .form-grid { grid-template-columns: 1fr; }
  .picker-grid { grid-template-columns: repeat(2, 1fr); }
  .search-fake span { display: none; }
  .search-fake { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ configuration */
.stabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin: 0 0 18px;
}
.stab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s, border-color .12s;
}
.stab:hover { color: var(--text); }
.stab.on { color: var(--accent); border-bottom-color: var(--accent); }
.stab svg { width: 15px; height: 15px; }

.panel-pad { padding: 14px 16px 4px; }
.panel-pad .form-grid { margin-bottom: 0; }

.lv-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.lv-row .lv-val {
  flex: 1; background: var(--surface2); border: 1px solid var(--line); border-radius: 7px;
  color: var(--text); padding: 8px 11px; font-size: 13.5px; font-family: inherit; outline: none;
}
.lv-row .lv-val:focus { border-color: var(--accent); }
.lv-row .lf-moves { margin-left: 0; }

.data-table td .badge + .badge { margin-left: 3px; }

/* ------------------------------------------------------------------ extended field types */
.form-divider { border-top: 1px solid var(--line); margin: 10px 0 4px; height: 0; }
.fitem.form-divider { background: none; border: none; border-top: 1px solid var(--line); padding: 0; border-radius: 0; }
.cb-field { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 0; }
.cb-field input[type="checkbox"] {
  appearance: none; width: 18px; height: 18px; flex: 0 0 auto;
  border: 2px solid #b6c2d2; border-radius: 5px; cursor: pointer; position: relative; background: var(--surface);
}
:root[data-theme="dark"] .cb-field input[type="checkbox"] { border-color: #3a4a5f; }
.cb-field input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.cb-field input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 4px; top: 0.5px; width: 5px; height: 9px;
  border: solid var(--accent-contrast); border-width: 0 2.5px 2.5px 0; transform: rotate(43deg);
}
.cb-field span { font-size: 14px; font-weight: 600; }
.ms-field { margin: 2px 0 0; }
.asset-link {
  display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-weight: 600;
}
.asset-link:hover { text-decoration: underline; }
.asset-link svg { width: 15px; height: 15px; flex: 0 0 auto; }
.lf-unit { width: 80px; }
.lf-target { max-width: 150px; }
.fitem .md { margin-top: 2px; }
.fitem .md p:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ attachments */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.att-thumb {
  position: relative; display: block; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: var(--surface2); transition: border-color .12s;
}
.att-thumb:hover { border-color: var(--accent); }
.att-thumb img { width: 100%; height: 104px; object-fit: cover; display: block; }
.att-cap {
  display: block; padding: 6px 9px; font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.att-del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(8, 12, 18, .72); color: #fff;
  opacity: 0; transition: opacity .12s, background .12s;
}
.att-thumb:hover .att-del { opacity: 1; }
.att-del:hover { background: var(--danger); }
.att-del svg { width: 12px; height: 12px; }
.att-list { margin-bottom: 12px; }
.att-row {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: var(--surface);
}
.att-row .lr-main { flex: 1; min-width: 0; }
.att-row .lr-main b { display: block; font-size: 13.5px; }
.att-row .lr-main small { color: var(--muted); font-size: 11.5px; }

.meter { height: 4px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.um-item .badge { margin-left: auto; }

/* ------------------------------------------------------------------ IPAM */
.ip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 5px; }
.ip-cell {
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; text-align: left;
  background: var(--surface2); transition: border-color .12s, transform .08s; min-width: 0;
}
.ip-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
.ip-cell.inferred { border-style: dashed; }
.ip-cell .ip-n { display: block; font-weight: 700; font-size: 13px; font-family: Consolas, monospace; }
.ip-cell .ip-l {
  display: block; font-size: 10.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 14px;
}
.ip-cell.tone-ok { background: var(--ok-weak); border-color: rgba(12,125,82,.3); }
.ip-cell.tone-ok .ip-n { color: var(--ok); }
.ip-cell.tone-warn { background: var(--warn-weak); border-color: rgba(180,83,9,.3); }
.ip-cell.tone-warn .ip-n { color: var(--warn); }
.ip-cell.tone-accent { background: var(--accent-weak); border-color: var(--accent); }
.ip-cell.tone-accent .ip-n { color: var(--accent); }
.ip-legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }

/* ------------------------------------------------------------------ racks */
.rack { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-width: 620px; }
.ru { display: flex; align-items: center; gap: 10px; padding: 0 10px; min-height: 30px; border-bottom: 1px solid var(--line); }
.ru:last-child { border-bottom: none; }
.ru-n {
  width: 26px; flex: 0 0 auto; text-align: right; font-family: Consolas, monospace;
  font-size: 11px; color: var(--faint);
}
.ru-body { flex: 1; min-width: 0; }
.ru-body b { display: block; font-size: 13px; }
.ru-body small { color: var(--muted); font-size: 11px; }
.ru.filled { background: var(--surface2); min-height: calc(var(--h, 1) * 30px); }
.ru.empty { cursor: pointer; }
.ru.empty:hover { background: var(--accent-weak); }
.ru.empty .ru-body { font-size: 11.5px; }

/* ------------------------------------------------------------------ import */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; margin-bottom: 14px; }
.map-row { display: flex; align-items: center; gap: 8px; }
.map-row svg { width: 13px; height: 13px; color: var(--faint); flex: 0 0 auto; }
.map-src {
  flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface2); font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-target {
  flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 7px; color: var(--text); padding: 7px 9px; font-size: 12.5px; font-family: inherit;
}
.link-btn { color: var(--accent); font-weight: 600; text-decoration: underline; padding: 0; }
img.brand-mark { object-fit: contain; background: transparent; }

/* ---------------------------------------------------------------- maps */
.map-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
}
.map-wrap {
  position: relative; height: min(64vh, 640px); min-height: 380px;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 24px 24px,
    var(--surface2);
}
.map-svg {
  width: 100%; height: 100%; display: block; cursor: grab; touch-action: none;
  /* Glyphs come from outlines rather than hinted bitmaps, so they stay clean
     when the canvas is scaled. */
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}
/* The global icon rule (`use, g`) paints every <g> with a 2px stroke so the
   sprite renders as line art. <text> inherits that, and each glyph ends up
   outlined in its own fill colour — which reads as smeared, not sharp. Labels
   are filled shapes, never stroked. */
.map-svg text { stroke: none; }
.map-svg:active { cursor: grabbing; }

/* nodes */
.map-node { cursor: move; }
.mn-rect {
  fill: var(--surface); stroke: var(--line); stroke-width: 1.5;
  transition: stroke .12s, filter .12s;
}
.map-node.sel .mn-rect { stroke: var(--accent); stroke-width: 2.5; }
.map-node.connecting .mn-rect { stroke: var(--accent); stroke-dasharray: 6 4; }
.map-node.bad .mn-rect { stroke: var(--warn, #f59e0b); stroke-dasharray: 5 4; }
.mn-title { fill: var(--text); font: 600 12.5px var(--font, inherit); pointer-events: none; }
.mn-sub { fill: var(--muted); font: 400 10.5px var(--font, inherit); pointer-events: none; }
.mn-flag { fill: var(--warn, #f59e0b); font: 600 9px var(--font, inherit); pointer-events: none; }
.mn-icon { color: var(--muted); pointer-events: none; }
.mn-icon svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* zones sit behind everything as backdrops */
.map-zone { cursor: move; }
.mz-rect { fill: currentColor; fill-opacity: .07; stroke: currentColor; stroke-opacity: .35; stroke-width: 1.5; stroke-dasharray: 7 5; }
.map-zone.sel .mz-rect { stroke-opacity: .9; stroke-dasharray: none; }
.mz-label { fill: var(--muted); font: 600 11px var(--font, inherit); pointer-events: none; text-transform: uppercase; letter-spacing: .06em; }

/* node + zone palette */
.c-slate  { color: #64748b; } .mn-rect.c-slate  { stroke: #64748b; }
.c-blue   { color: #3b82f6; } .mn-rect.c-blue   { stroke: #3b82f6; }
.c-green  { color: #10b981; } .mn-rect.c-green  { stroke: #10b981; }
.c-amber  { color: #f59e0b; } .mn-rect.c-amber  { stroke: #f59e0b; }
.c-red    { color: #ef4444; } .mn-rect.c-red    { stroke: #ef4444; }
.c-violet { color: #8b5cf6; } .mn-rect.c-violet { stroke: #8b5cf6; }
.c-cyan   { color: #06b6d4; } .mn-rect.c-cyan   { stroke: #06b6d4; }
.c-pink   { color: #ec4899; } .mn-rect.c-pink   { stroke: #ec4899; }

/* edges — a fat invisible line makes them clickable without being fiddly */
.map-edge { cursor: pointer; }
.me-hit { stroke: transparent; stroke-width: 14; fill: none; }
.me-line { stroke: var(--muted); stroke-width: 2; fill: none; stroke-linecap: round; }
.map-edge.sel .me-line { stroke: var(--accent); stroke-width: 3; }
.me-label { fill: var(--muted); font: 500 10.5px var(--font, inherit); pointer-events: none; }
.me-line.ek-fiber    { stroke: #f59e0b; }
.me-line.ek-copper   { stroke: #10b981; }
.me-line.ek-wireless { stroke: #06b6d4; }
.me-line.ek-power    { stroke: #ef4444; }
.me-line.ek-uplink   { stroke: #3b82f6; stroke-width: 3; }
.me-line.ek-logical  { stroke: #8b5cf6; }

/* inspector */
.map-inspector {
  margin-top: 10px; padding: 12px 14px; min-height: 58px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
}
.mi-empty { color: var(--muted); font-size: 12.5px; }
.mi-head {
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px;
}
.mi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.mi-bound { margin-top: 10px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.mi-bound svg { width: 14px; height: 14px; flex: none; }
.mi-bound.warn { color: var(--warn, #f59e0b); }
.mi-colors { display: flex; gap: 6px; margin-top: 12px; }
.mi-color {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent;
  background: currentColor; cursor: pointer; padding: 0;
}
.mi-color.on { border-color: var(--text); }
.mi-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* backdrop image */
.map-bg { pointer-events: none; }
.map-bg.movable { pointer-events: auto; cursor: move; }
.mb-preview {
  display: flex; align-items: center; gap: 12px; margin: 12px 0;
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2);
}
.mb-preview img {
  max-width: 180px; max-height: 110px; border-radius: 6px; display: block;
  background: repeating-conic-gradient(var(--line) 0% 25%, transparent 0% 50%) 50% / 14px 14px;
}
#mb-controls.hidden { display: none; }
#mb-controls input[type="range"] { width: 100%; accent-color: var(--accent); }

/* confirm dialog */
.confirm-modal .form-title { margin-bottom: 6px; }
.confirm-modal .form-sub { margin-bottom: 4px; }
.confirm-modal .form-foot { margin-top: 18px; }
.confirm-modal .btn-danger[disabled],
.confirm-modal .btn-accent[disabled] { opacity: .45; cursor: not-allowed; }

/* keyboard shortcuts */
.sc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px; }
.sc-group .perm-group-title { margin-bottom: 10px; }
.sc-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; color: var(--muted); }
.sc-row kbd {
  flex: 0 0 auto; min-width: 30px; text-align: center;
  background: var(--surface2); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: 3px 7px; font: 500 11.5px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
}

/* private items */
.privacy-row {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 16px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface2); cursor: pointer; transition: border-color .12s, background .12s;
}
.privacy-row:hover { border-color: var(--muted); }
.privacy-row.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface2)); }
.privacy-row input { accent-color: var(--accent); margin-top: 2px; flex: 0 0 auto; }
.privacy-row > span { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 13px; }
.privacy-row svg { width: 14px; height: 14px; color: var(--accent); }
.privacy-row small { flex: 1 1 100%; color: var(--muted); font-size: 12px; line-height: 1.45; }
.privacy-note {
  display: flex; gap: 10px; align-items: flex-start; margin: 0 0 18px;
  padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; background: var(--surface2); font-size: 12.5px; color: var(--muted); line-height: 1.5;
}
.privacy-note svg { width: 15px; height: 15px; color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.privacy-note b { color: var(--text); }
.badge.tone-priv {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.badge.tone-priv svg { width: 11px; height: 11px; }

/* browser extension */
.ext-origin {
  display: flex; gap: 9px; align-items: flex-start; margin-bottom: 6px;
  padding: 11px 13px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; background: var(--surface2); font-size: 12.5px; color: var(--muted); line-height: 1.5;
}
.ext-origin svg { width: 14px; height: 14px; color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.ext-origin b { color: var(--text); word-break: break-all; }
.ext-steps { margin: 12px 0 4px; padding-left: 20px; color: var(--muted); font-size: 12.8px; line-height: 1.6; }
.ext-steps li { margin-bottom: 5px; }
.ext-steps code { background: var(--surface2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 12px; }
.ext-note { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.ext-code { display: flex; align-items: center; gap: 10px; }
.ext-code code {
  font: 700 22px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em;
  background: var(--surface2); border: 1px solid var(--accent); border-radius: 10px;
  padding: 13px 18px; color: var(--accent);
}
.ext-count { color: var(--muted); font-size: 12.5px; margin-top: 9px; }

/* screenshots inside a document body */
.md-shot {
  display: block; max-width: 100%; height: auto; margin: 10px 0;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface2);
}
.md-shot:hover { border-color: var(--accent); }

/* table view */
.table-panel { padding: 0; overflow: hidden; }
.table-tools { display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }
.asset-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.asset-table th {
  position: sticky; top: 0; z-index: 1; text-align: left; white-space: nowrap; cursor: pointer;
  padding: 10px 14px; background: var(--surface2); border-bottom: 1px solid var(--line);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700;
  user-select: none;
}
.asset-table th:hover { color: var(--text); }
.asset-table th.sorted { color: var(--accent); }
.th-arrow { margin-left: 4px; font-size: 10px; }
.asset-table td { padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.asset-table tbody tr { cursor: pointer; }
.asset-table tbody tr:hover { background: var(--surface2); }
.asset-table tbody tr:last-child td { border-bottom: 0; }
.asset-table .t-name { color: var(--text); }
.asset-table .t-name b { font-weight: 600; }

/* column picker in the layout editor */
.col-pick { display: flex; flex-wrap: wrap; gap: 7px; }
.col-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 12.5px;
  background: var(--surface2);
}
.col-chip.on { border-color: var(--accent); color: var(--text); }
.col-chip input { accent-color: var(--accent); }

/* ------------------------------------------------------------------ checklists */
/* A run row: what it is, how far through, at a glance. */
.run-row { cursor: pointer; }
.run-meter {
  flex: 0 0 90px; height: 6px; border-radius: 999px;
  background: var(--surface2); overflow: hidden; border: 1px solid var(--line);
}
.run-meter span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.run-meter.big { flex: 1; height: 9px; }
.run-pct { font-size: 12px; color: var(--muted); min-width: 34px; text-align: right; }
.run-progress { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.run-progress b { font-size: 13px; white-space: nowrap; }

.run-steps { padding: 6px; }
.run-step {
  display: flex; gap: 11px; align-items: flex-start; padding: 11px 12px;
  border-radius: 9px; cursor: pointer; transition: background .12s;
}
.run-step:hover { background: var(--surface2); }
/* The next unticked step is where the eye should land when you come back to a
   list you left an hour ago. */
.run-step.next { background: var(--accent-weak); }
.run-step input { margin-top: 2px; flex: 0 0 auto; width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.run-step .rs-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.run-step .rs-text { font-size: 13.5px; }
.run-step .rs-hint, .run-step .rs-when { font-size: 11.5px; color: var(--muted); }
.run-step.done .rs-text { text-decoration: line-through; color: var(--muted); }
.run-step.done.next { background: none; }

.run-preview { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.run-preview .muted { list-style: none; margin-left: -18px; }

/* Editing the procedure itself. */
.cl-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  margin-bottom: 7px; background: var(--surface2);
}
.cl-grip { color: var(--muted); display: flex; flex: 0 0 auto; }
.cl-grip svg { width: 14px; height: 14px; }
.cl-fields { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cl-fields input {
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  color: var(--text); padding: 6px 9px; font-size: 12.5px; font-family: inherit; outline: none; width: 100%;
}
.cl-fields input:focus { border-color: var(--accent); }
.cl-fields .cl-hint { font-size: 11.5px; color: var(--muted); }
.cl-btns { display: flex; gap: 3px; flex: 0 0 auto; }
/* Panel body that needs ordinary padding — panels are otherwise flush so rows
   can run edge to edge. */
.pad { padding: 14px 16px; }
.pad .field { margin: 0; }

/* ------------------------------------------------------------------ SNMP */
.supplies { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.supply { display: flex; align-items: center; gap: 11px; }
.sp-name { flex: 0 0 190px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-track {
  flex: 1; height: 10px; border-radius: 999px; background: var(--surface2);
  border: 1px solid var(--line); overflow: hidden;
}
.sp-fill { display: block; height: 100%; background: var(--accent); transition: width .25s; }
/* A cartridge that reports nothing gets a flat hatched bar rather than a full
   one — an unknown level must never read as a full level. */
.sp-fill.unknown {
  background: repeating-linear-gradient(135deg, var(--surface2) 0 6px, var(--line) 6px 12px);
}
/* Black toner is drawn in a neutral grey rather than literal black: on a dark
   theme an actual black bar is invisible against the track, which would read
   as an empty cartridge. */
.sp-fill.tint-k { background: linear-gradient(90deg, #aab2c0, #6b7280); }
.sp-fill.tint-c { background: #22d3ee; }
.sp-fill.tint-m { background: #e879f9; }
.sp-fill.tint-y { background: #facc15; }
.sp-fill.low { background: var(--warn); }
.sp-fill.crit { background: var(--danger); }
.sp-pct { flex: 0 0 52px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.sp-pct.low { color: var(--warn); }
.sp-pct.crit { color: var(--danger); font-weight: 700; }
.snmp-facts { border-top: 1px solid var(--line); }
.scope-note.tone-bad { background: var(--danger-weak, rgba(248,113,113,.12)); }
.scope-note.tone-bad svg { color: var(--danger); }

/* A folded-away extra section on a form — settings most items will never need,
   present without crowding the ones that do. */
.form-extra {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface2); margin-top: 12px;
}
.form-extra > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 13px; font-size: 13px; font-weight: 600; list-style: none;
}
.form-extra > summary::-webkit-details-marker { display: none; }
.form-extra > summary::after {
  content: ''; margin-left: auto; width: 7px; height: 7px;
  border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-2px); transition: transform .15s;
}
.form-extra[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.form-extra > summary small { font-weight: 400; color: var(--muted); font-size: 12px; }
.form-extra > summary svg { width: 15px; height: 15px; color: var(--muted); }
.form-extra .form-grid { padding: 0 13px 13px; }
