/* ==========================================================================
   NETVIA Control Center — design system
   Modern NOC / datacenter control center. Dense, technical, calm.
   Tokens → base → layout (shell) → components → modules → responsive.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-mono: "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;

  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-base: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 26px;
  --lh: 1.45;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --r-sm: 3px; --r: 4px; --r-lg: 6px;
  --row-h: 36px; --ctl-h: 32px;
  --sidebar-w: 236px; --rail-w: 60px; --header-h: 52px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 140ms;

  --brand: #087CF9; --brand-deep: #0B1F3A; --brand-navy: #111827;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080d16;
  --bg-grid: rgba(120, 150, 190, .045);
  --surface: #0e1522;
  --surface-2: #121b2b;
  --surface-3: #172236;
  --surface-hover: #182338;
  --border: #1d2940;
  --border-strong: #2a3a57;
  --text: #e4eaf3;
  --text-2: #9aa8bd;
  --text-3: #66758d;
  --accent: #2f8dff;
  --accent-strong: #5aa6ff;
  --accent-soft: rgba(47, 141, 255, .14);
  --accent-contrast: #ffffff;
  --focus: #5aa6ff;
  --ok: #2fc57a; --ok-soft: rgba(47, 197, 122, .13);
  --warn: #f2b33d; --warn-soft: rgba(242, 179, 61, .14);
  --crit: #ff5a57; --crit-soft: rgba(255, 90, 87, .14);
  --info: #4aa8ff; --info-soft: rgba(74, 168, 255, .13);
  --maint: #b18cff; --maint-soft: rgba(177, 140, 255, .14);
  --pend: #8fa0ba; --pend-soft: rgba(143, 160, 186, .14);
  --off: #5b6881; --off-soft: rgba(91, 104, 129, .16);
  --shadow: 0 1px 0 rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
  --scrim: rgba(3, 6, 12, .66);
  --sidebar-bg: #0a111d;
  --code-bg: #0a101b;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f5;
  --bg-grid: rgba(11, 31, 58, .035);
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #edf1f6;
  --surface-hover: #f1f5fa;
  --border: #dde3eb;
  --border-strong: #c7d0dc;
  --text: #0f1a2b;
  --text-2: #4b5a70;
  --text-3: #7a8799;
  --accent: #087CF9;
  --accent-strong: #0063d1;
  --accent-soft: rgba(8, 124, 249, .10);
  --accent-contrast: #ffffff;
  --focus: #087CF9;
  --ok: #138a4f; --ok-soft: rgba(19, 138, 79, .10);
  --warn: #a86a00; --warn-soft: rgba(214, 142, 0, .13);
  --crit: #cf2b28; --crit-soft: rgba(207, 43, 40, .10);
  --info: #0a6fd8; --info-soft: rgba(10, 111, 216, .10);
  --maint: #7248d6; --maint-soft: rgba(114, 72, 214, .10);
  --pend: #5c6b82; --pend-soft: rgba(92, 107, 130, .12);
  --off: #8391a5; --off-soft: rgba(131, 145, 165, .14);
  --shadow: 0 1px 0 rgba(15, 26, 43, .04), 0 6px 18px rgba(15, 26, 43, .08);
  --shadow-lg: 0 18px 50px rgba(15, 26, 43, .18);
  --scrim: rgba(15, 26, 43, .42);
  --sidebar-bg: #0B1F3A;
  --code-bg: #f3f6fa;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: var(--fs-base)/var(--lh) var(--font-sans);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
p { margin: 0 0 var(--sp-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--sp-5); }
.hidden { display: none !important; }
.noscript { padding: 24px; }

.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

/* boot */
.boot-screen { min-height: 100vh; display: grid; place-content: center; gap: 14px; justify-items: center; color: var(--text-3); font-size: var(--fs-sm); letter-spacing: .24em; }
.boot-mark { width: 28px; height: 28px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: var(--header-h) minmax(0, 1fr); min-height: 100vh; }
.shell__sidebar { grid-row: 1 / span 2; position: sticky; top: 0; height: 100vh; background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 30; color: #c9d4e4; }
:root[data-theme="light"] .shell__sidebar { border-right-color: transparent; }
.shell__header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-5); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); min-width: 0; }
.shell__main { min-width: 0; padding: var(--sp-5) var(--sp-6) var(--sp-8); background-image: linear-gradient(var(--bg-grid) 1px, transparent 1px), linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px); background-size: 32px 32px; background-position: -1px -1px; }
.shell__main:focus { outline: none; }
.shell__footer { margin-top: var(--sp-8); padding-top: var(--sp-4); border-top: 1px solid var(--border); color: var(--text-3); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: var(--sp-4); justify-content: space-between; }
.skip-link { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--accent); color: #fff; padding: 6px 10px; border-radius: var(--r); }
.skip-link:focus { top: 8px; }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; height: var(--header-h); padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,.06); color: #fff; text-decoration: none; flex: none; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 26px; height: 26px; flex: none; }
.brand__logo { max-height: 26px; max-width: 150px; object-fit: contain; }
.brand__text { display: flex; flex-direction: column; gap: 3px; line-height: 1.1; min-width: 0; }
.brand__name { font-weight: 700; letter-spacing: .14em; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__sub { font-size: 10px; letter-spacing: .22em; color: #7f92ad; }

/* nav */
.nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; scrollbar-width: thin; }
.nav__section { margin: 14px 10px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: #5f7291; }
.nav__item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r); color: #b5c2d6; text-decoration: none; font-size: var(--fs-md); position: relative; white-space: nowrap; }
.nav__item:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav__item[aria-current="page"] { background: rgba(47,141,255,.16); color: #fff; }
.nav__item[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 2px 2px 0; background: var(--accent); }
.nav__item .icon { color: #7f92ad; }
.nav__item[aria-current="page"] .icon, .nav__item:hover .icon { color: #d6e4ff; }
.nav__label { overflow: hidden; text-overflow: ellipsis; }
.nav__badge { margin-left: auto; font-size: 10.5px; padding: 0 6px; border-radius: 9px; background: rgba(255,255,255,.08); color: #c9d4e4; }
.nav__foot { border-top: 1px solid rgba(255,255,255,.06); padding: 10px 12px; font-size: 11px; color: #5f7291; display: flex; align-items: center; gap: 8px; }
.nav__foot .live-dot { margin-left: auto; }

/* header parts */
.shell__header .header__menu-btn { display: none; }
.header__crumbs { min-width: 0; flex: 1 1 auto; }
.header__actions { display: flex; align-items: center; gap: 4px; flex: none; }
.search-trigger { display: flex; align-items: center; gap: 8px; height: 32px; min-width: 220px; padding: 0 8px 0 10px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text-3); cursor: pointer; }
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-trigger kbd { margin-left: auto; }
kbd { font: 11px var(--font-mono); padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 3px; color: var(--text-2); background: var(--surface-2); }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; letter-spacing: .12em; font-weight: 600; color: var(--text-3); }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--off); }
.live-dot[data-state="live"] { color: var(--ok); }
.live-dot[data-state="live"]::before { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2.4s infinite; }
.live-dot[data-state="polling"]::before { background: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }

.bell { position: relative; }
.bell__count { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--crit); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; border: 2px solid var(--bg); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #1b3a66, #087CF9); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; flex: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 2px 6px 2px 2px; border-radius: 16px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--text); max-width: 220px; }
.user-chip:hover { border-color: var(--border); background: var(--surface); }
.user-chip__text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; min-width: 0; }
.user-chip__name { font-size: var(--fs-md); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.user-chip__role { font-size: 10.5px; color: var(--text-3); letter-spacing: .06em; }

/* breadcrumbs */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-md); color: var(--text-3); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs ol { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.crumbs li + li::before { content: "/"; color: var(--border-strong); }
.crumbs a { color: var(--text-2); }
.crumbs [aria-current] { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

/* ----------------------------------------------------------- page chrome */
.page { display: flex; flex-direction: column; gap: var(--sp-5); max-width: 1680px; margin: 0 auto; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: var(--sp-4); flex-wrap: wrap; }
.page-head__titles { flex: 1 1 320px; min-width: 0; }
.page-head__eyebrow { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.page-head h1 { font-size: var(--fs-2xl); }
.page-head__desc { margin: 6px 0 0; color: var(--text-2); max-width: 760px; }
.page-head__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.panel__head { display: flex; align-items: center; gap: var(--sp-3); padding: 12px 16px; border-bottom: 1px solid var(--border); min-height: 46px; }
.panel__title { font-size: var(--fs-md); font-weight: 600; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.panel__title .icon { color: var(--text-3); }
.panel__tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.panel__body { padding: 16px; }
.panel__body--flush { padding: 0; }
.panel__foot { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: var(--sp-2); align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.panel--accent { border-top: 2px solid var(--accent); }

.grid { display: grid; gap: var(--sp-4); }
.grid-kpi { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-2 { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-main-side { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr) 360px; }

/* KPI tile */
.kpi { position: relative; padding: 14px 16px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; min-width: 0; }
.kpi::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--kpi-color, var(--border-strong)); }
.kpi__label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi__value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-top: 6px; line-height: 1.1; }
.kpi__value small { font-size: 13px; color: var(--text-3); font-weight: 500; margin-left: 4px; }
.kpi__meta { font-size: var(--fs-sm); color: var(--text-2); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; }
.kpi--ok { --kpi-color: var(--ok); } .kpi--warn { --kpi-color: var(--warn); } .kpi--crit { --kpi-color: var(--crit); } .kpi--info { --kpi-color: var(--info); }

/* meter (capacity) */
.meter { display: flex; flex-direction: column; gap: 4px; }
.meter__bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: flex; }
.meter__fill { height: 100%; background: var(--accent); }
.meter__fill--ok { background: var(--ok); } .meter__fill--warn { background: var(--warn); } .meter__fill--crit { background: var(--crit); } .meter__fill--off { background: var(--off); }
.meter__legend { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-3); }

/* ------------------------------------------------------------ controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--ctl-h); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface-2); color: var(--text); font-size: var(--fs-md); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); user-select: none; }
.btn:hover { background: var(--surface-hover); border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-3)); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn--danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn--danger:hover { background: color-mix(in srgb, var(--crit) 85%, #000); }
.btn--danger-ghost { color: var(--crit); background: transparent; border-color: color-mix(in srgb, var(--crit) 45%, transparent); }
.btn--danger-ghost:hover { background: var(--crit-soft); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--text); border-color: transparent; }
.btn--icon { width: var(--ctl-h); padding: 0; }
.btn .icon { max-width: none; }
.btn--sm { height: 26px; padding: 0 8px; font-size: var(--fs-sm); }
.btn--sm.btn--icon { width: 26px; padding: 0; }
.btn--block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); }
.btn-group .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); position: relative; z-index: 1; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.field__label .req { color: var(--crit); }
.field__hint { font-size: var(--fs-sm); color: var(--text-3); }
.field__error { font-size: var(--fs-sm); color: var(--crit); display: flex; gap: 5px; align-items: center; }
.input, .select, .textarea { width: 100%; height: var(--ctl-h); padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface-2); color: var(--text); font-size: var(--fs-md); transition: border-color var(--dur), box-shadow var(--dur); }
.textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 50%, var(--text-3)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--crit); }
.input[readonly], .input[disabled], .select[disabled] { opacity: .7; cursor: not-allowed; }
.input--mono { font-family: var(--font-mono); letter-spacing: .02em; }
.input-group { display: flex; }
.input-group .input { border-radius: var(--r) 0 0 var(--r); }
.input-group .btn { border-radius: 0 var(--r) var(--r) 0; margin-left: -1px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 30px; }
.form-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap; }
.otp-input { font: 600 22px var(--font-mono); letter-spacing: .5em; text-align: center; height: 48px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--fs-md); user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; cursor: pointer; }
.check input:disabled { cursor: not-allowed; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-md); }
.switch input { position: absolute; opacity: 0; width: 34px; height: 20px; margin: 0; cursor: pointer; }
.switch__track { width: 34px; height: 20px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background var(--dur); flex: none; }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-3); transition: transform var(--dur) var(--ease), background var(--dur); }
.switch input:checked + .switch__track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(14px); background: #fff; }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch__track { opacity: .45; }

/* combobox */
.combo { position: relative; }
.combo__list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 4px; margin: 0; list-style: none; }
.combo__option { padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-md); }
.combo__option[aria-selected="true"], .combo__option:hover { background: var(--accent-soft); }
.combo__option small { color: var(--text-3); }
.combo__empty { padding: 8px; color: var(--text-3); font-size: var(--fs-sm); }

/* ------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: var(--r-sm); font-size: 11px; font-weight: 600; letter-spacing: .03em; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.badge--accent { background: var(--accent-soft); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.badge--mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0; }
.badge--type-SUPER_ADMIN { background: var(--crit-soft); color: var(--crit); border-color: transparent; }
.badge--type-NETWORK_ADMIN { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge--type-CLIENT { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge--type-SUB_CLIENT { background: var(--maint-soft); color: var(--maint); border-color: transparent; }

/* status indicator: colour + shape + text (never colour alone) */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--st, var(--text-2)); white-space: nowrap; }
.status__shape { width: 14px; height: 14px; flex: none; }
.status--pill { height: 22px; padding: 0 8px 0 6px; border-radius: 11px; background: var(--st-soft, var(--surface-3)); }
.status--ok { --st: var(--ok); --st-soft: var(--ok-soft); }
.status--warning { --st: var(--warn); --st-soft: var(--warn-soft); }
.status--error { --st: var(--crit); --st-soft: var(--crit-soft); }
.status--info { --st: var(--info); --st-soft: var(--info-soft); }
.status--disabled { --st: var(--off); --st-soft: var(--off-soft); }
.status--pending { --st: var(--pend); --st-soft: var(--pend-soft); }
.status--maintenance { --st: var(--maint); --st-soft: var(--maint-soft); }
.status--pending .status__shape { animation: spin 2.4s linear infinite; }

/* ------------------------------------------------------------- tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.table th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); padding: 0 12px; height: 34px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th button.sort { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.table th button.sort:focus-visible { outline: 2px solid var(--focus); }
.table td { padding: 0 12px; height: var(--row-h); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td.wrap { white-space: normal; padding-top: 8px; padding-bottom: 8px; }
.table tbody tr { transition: background var(--dur); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-clickable { cursor: pointer; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table .cell-title { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: var(--fs-sm); color: var(--text-3); }
.table .cell-stack, .timeline .cell-stack { display: flex; flex-direction: column; line-height: 1.25; padding: 6px 0; }
.table--compact td { height: 30px; }
.table caption { text-align: left; }

/* matrix */
.matrix-wrap { overflow: auto; max-height: calc(100vh - 260px); border-top: 1px solid var(--border); }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-md); }
.matrix th, .matrix td { border-bottom: 1px solid var(--border); padding: 0 10px; height: 34px; }
.matrix thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); font-size: 11px; text-align: center; min-width: 118px; vertical-align: bottom; padding-top: 8px; padding-bottom: 8px; height: auto; }
.matrix thead th:first-child, .matrix tbody th { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; min-width: 280px; font-weight: 500; }
.matrix thead th:first-child { z-index: 4; background: var(--surface-2); }
.matrix tbody tr.matrix__group th { background: var(--surface-2); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.matrix tbody tr.matrix__group td { background: var(--surface-2); }
.matrix td { text-align: center; }
.matrix td.is-changed { background: var(--warn-soft); }
.matrix__perm-code { font: 11px var(--font-mono); color: var(--text-3); display: block; }
.matrix__na { color: var(--text-3); }
.matrix__lock { display: inline-flex; vertical-align: -2px; margin-left: 4px; color: var(--text-3); }
.matrix__sens { display: inline-flex; vertical-align: -2px; margin-left: 6px; color: var(--warn); }
.matrix__role-name { display: block; font-size: 12px; letter-spacing: .02em; text-transform: none; color: var(--text); font-weight: 600; }

/* text-style button (keeps semantics of <button>, looks like a link) */
.link-btn { all: unset; box-sizing: border-box; cursor: pointer; color: var(--accent-strong); font-weight: 600; text-align: left; border-radius: var(--r-sm); }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* data-table toolbar & pagination */
.toolbar { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.toolbar .input-icon { flex: 1 1 240px; max-width: 360px; }
.toolbar .select { width: auto; min-width: 140px; }
.toolbar .input[type="date"] { width: auto; flex: 0 0 auto; }
.pager { display: flex; align-items: center; gap: var(--sp-3); padding: 8px 12px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); flex-wrap: wrap; }
.pager__info { margin-right: auto; }
.pager__pages { display: flex; gap: 4px; align-items: center; }

/* key/value */
.kv { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 0; font-size: var(--fs-md); margin: 0; }
.kv dt { color: var(--text-3); padding: 8px 0; border-bottom: 1px dashed var(--border); }
.kv dd { margin: 0; padding: 8px 0 8px 12px; border-bottom: 1px dashed var(--border); word-break: break-word; min-width: 0; }
.kv > :nth-last-child(-n+2) { border-bottom: 0; }

/* diff (audit old vs new) */
.diff { width: 100%; border-collapse: collapse; font-size: var(--fs-md); table-layout: fixed; }
.diff th { text-align: left; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.diff td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; word-break: break-word; font-family: var(--font-mono); font-size: 12px; }
.diff td.diff__key { font-family: var(--font-sans); font-weight: 600; color: var(--text-2); font-size: var(--fs-md); }
.diff__old { background: var(--crit-soft); color: var(--text); }
.diff__new { background: var(--ok-soft); color: var(--text); }
.diff__old::before { content: "− "; color: var(--crit); font-weight: 700; }
.diff__new::before { content: "+ "; color: var(--ok); font-weight: 700; }
.diff__null { color: var(--text-3); font-style: italic; }

pre.code { margin: 0; padding: 10px 12px; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r); font: 12px/1.5 var(--font-mono); overflow: auto; max-height: 320px; white-space: pre-wrap; word-break: break-word; }

/* --------------------------------------------------------- tabs / menus */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; height: 38px; font-size: var(--fs-md); color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tab-panel:focus { outline: none; }

.menu { position: fixed; z-index: 70; min-width: 200px; max-width: 320px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 4px; animation: pop .12s var(--ease); }
.menu__item { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r); font-size: var(--fs-md); cursor: pointer; color: var(--text); }
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-hover); }
.menu__item--danger { color: var(--crit); }
.menu__item[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.menu__sep { height: 1px; background: var(--border); margin: 4px 2px; }
.menu__head { padding: 8px 10px 6px; font-size: var(--fs-sm); color: var(--text-3); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* tooltip */
.tooltip { position: fixed; z-index: 90; max-width: 280px; padding: 6px 9px; background: #0b1220; color: #e4eaf3; font-size: var(--fs-sm); border-radius: var(--r); box-shadow: var(--shadow); pointer-events: none; border: 1px solid #25324a; }

/* ------------------------------------------------------ dialogs / drawers */
.overlay { position: fixed; inset: 0; z-index: 80; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .14s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: pop .16s var(--ease); }
.dialog--wide { width: min(820px, 100%); }
.dialog__head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 12px; }
.dialog__title { font-size: var(--fs-lg); font-weight: 600; }
.dialog__body { padding: 0 18px 16px; overflow: auto; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); flex-wrap: wrap; }
.dialog__close { margin-left: auto; }
.dialog--danger { border-top: 3px solid var(--crit); }
.dialog__icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--crit-soft); color: var(--crit); flex: none; }
.dialog__icon .icon { width: 18px; height: 18px; }
.consequences { margin: 0; padding: 10px 12px 10px 28px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); font-size: var(--fs-md); }
.consequences li + li { margin-top: 4px; }
.phrase-box { font: 600 13px var(--font-mono); padding: 6px 10px; background: var(--code-bg); border: 1px dashed var(--crit); border-radius: var(--r); color: var(--crit); display: inline-block; user-select: all; }

.drawer-overlay { justify-content: flex-end; align-items: stretch; padding: 0; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide-in .2s var(--ease); }
.drawer--wide { width: min(760px, 100%); }
.drawer__head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.drawer__title { font-size: var(--fs-lg); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer__body { flex: 1; overflow: auto; padding: 16px 18px; }
.drawer__foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); flex-wrap: wrap; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }

/* -------------------------------------------------------------- toasts */
.toasts { position: fixed; z-index: 95; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border-strong); border-left: 3px solid var(--st, var(--accent)); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: pop .16s var(--ease); font-size: var(--fs-md); }
.toast__body { flex: 1; min-width: 0; }
.toast__title { font-weight: 600; }
.toast__text { color: var(--text-2); margin-top: 2px; word-break: break-word; }
.toast__ref { font: 11px var(--font-mono); color: var(--text-3); margin-top: 4px; }

/* ------------------------------------------------ empty / loading states */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 20px; color: var(--text-2); }
.empty__icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); margin-bottom: 4px; }
.empty__icon .icon { width: 20px; height: 20px; }
.empty__title { font-weight: 600; color: var(--text); }
.empty__text { max-width: 420px; font-size: var(--fs-md); }
.empty--error .empty__icon { background: var(--crit-soft); color: var(--crit); }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-hover) 40%, var(--surface-3) 80%); background-size: 300% 100%; animation: shimmer 1.3s ease-in-out infinite; border-radius: var(--r-sm); min-height: 12px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.skeleton-rows { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.alert { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--st, var(--info)) 40%, transparent); background: var(--st-soft, var(--info-soft)); font-size: var(--fs-md); align-items: flex-start; }
.alert .icon { color: var(--st, var(--info)); margin-top: 1px; }
.alert--warning { --st: var(--warn); --st-soft: var(--warn-soft); }
.alert--error { --st: var(--crit); --st-soft: var(--crit-soft); }
.alert--ok { --st: var(--ok); --st-soft: var(--ok-soft); }

/* --------------------------------------------------- notification center */
.nc { position: fixed; z-index: 75; top: calc(var(--header-h) + 6px); right: 12px; width: min(400px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 80px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: pop .14s var(--ease); }
.nc__head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.nc__list { overflow: auto; flex: 1; }
.nc__item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; }
.nc__item:hover { background: var(--surface-hover); }
.nc__item.is-unread::after { content: ""; position: absolute; right: 12px; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.nc__title { font-weight: 600; font-size: var(--fs-md); padding-right: 14px; }
.nc__text { color: var(--text-2); font-size: var(--fs-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nc__time { color: var(--text-3); font-size: var(--fs-xs); margin-top: 3px; }
.nc__foot { padding: 8px 12px; text-align: center; font-size: var(--fs-sm); }

/* ------------------------------------------------------- search palette */
.palette-overlay { align-items: flex-start; padding-top: 10vh; }
.palette { width: min(680px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .14s var(--ease); }
.palette__input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.palette__input input { flex: 1; height: 52px; border: 0; background: transparent; font-size: var(--fs-lg); outline: none; min-width: 0; }
.palette__results { max-height: 420px; overflow: auto; padding: 6px; }
.palette__group { padding: 8px 10px 4px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.palette__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); cursor: pointer; }
.palette__item[aria-selected="true"] { background: var(--accent-soft); }
.palette__item-title { font-weight: 600; }
.palette__item-sub { color: var(--text-3); font-size: var(--fs-sm); }
.palette__hint { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); background: var(--surface-2); flex-wrap: wrap; }

/* ------------------------------------------------------------- auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 520px); }
.auth__visual { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 20% 10%, rgba(8,124,249,.28), transparent 60%), linear-gradient(160deg, #081427 0%, #0B1F3A 55%, #0a1426 100%); color: #d8e3f3; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth__visual::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(140,180,230,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(140,180,230,.07) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(180deg, #000 30%, transparent 95%); }
.auth__visual > * { position: relative; }
.auth__headline { font-size: 34px; line-height: 1.12; font-weight: 600; letter-spacing: -.02em; color: #fff; max-width: 560px; }
.auth__lede { color: #9fb2cc; max-width: 520px; margin-top: 14px; font-size: 15px; }
.auth__racks { display: flex; gap: 10px; align-items: flex-end; margin-top: 36px; }
.rack-glyph { width: 46px; border: 1px solid rgba(160,190,230,.25); border-radius: 3px; padding: 4px; display: flex; flex-direction: column; gap: 3px; background: rgba(8,20,39,.6); }
.rack-glyph span { height: 6px; border-radius: 1px; background: rgba(120,150,190,.25); position: relative; }
.rack-glyph span.on::after { content: ""; position: absolute; right: 3px; top: 2px; width: 3px; height: 2px; background: #2fc57a; box-shadow: 0 0 4px #2fc57a; }
.rack-glyph span.warn::after { content: ""; position: absolute; right: 3px; top: 2px; width: 3px; height: 2px; background: #f2b33d; }
.auth__stats { display: flex; gap: 28px; font-size: 12px; color: #8ea3bf; letter-spacing: .08em; text-transform: uppercase; flex-wrap: wrap; }
.auth__stats strong { display: block; font: 600 18px var(--font-mono); color: #fff; letter-spacing: 0; text-transform: none; }
.auth__panel { background: var(--surface); display: flex; flex-direction: column; justify-content: center; padding: 40px 48px; border-left: 1px solid var(--border); }
.auth__form { width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.auth__title { font-size: 22px; }
.auth__sub { color: var(--text-2); margin: 6px 0 0; }
.auth__foot { margin-top: 24px; display: flex; justify-content: space-between; align-items: center; color: var(--text-3); font-size: var(--fs-sm); gap: 8px; flex-wrap: wrap; }
.method-list { display: flex; flex-direction: column; gap: 6px; }
.method-option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--r); cursor: pointer; background: var(--surface-2); text-align: left; width: 100%; color: var(--text); }
.method-option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* restricted / setup screens */
.setup { max-width: 640px; margin: 5vh auto; padding: 0 16px; }
.qr { background: #fff; padding: 12px; border-radius: var(--r); width: max-content; border: 1px solid var(--border); }
.qr svg { width: 232px; height: 232px; display: block; }
.totp-manual .secret { font-size: 15px; letter-spacing: .06em; word-break: break-all; user-select: all; }
.totp-meta { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 4px 0 0; font-size: 12px; }
.totp-meta dt { font-weight: 600; } .totp-meta dd { margin: 0; overflow-wrap: anywhere; }
@media (hover: hover) and (pointer: fine) { .totp-open { display: none; } }
@media (max-width: 420px) { .qr svg { width: 200px; height: 200px; } }
.secret { font: 600 15px var(--font-mono); letter-spacing: .12em; padding: 8px 10px; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r); word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; font: 600 14px var(--font-mono); }
.codes span { padding: 6px 8px; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r); text-align: center; }

/* ---------------------------------------------------------- modules */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1px; background: var(--border); }
.health-cell { background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.health-cell__name { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.health-cell__detail { font-size: var(--fs-sm); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.activity-chart { width: 100%; height: 120px; }
.activity-chart .bar-ok { fill: var(--accent); opacity: .85; }
.activity-chart .bar-fail { fill: var(--warn); }
.activity-chart .bar-deny { fill: var(--crit); }
.activity-chart .axis { stroke: var(--border); }
.activity-chart text { fill: var(--text-3); font-size: 10px; font-family: var(--font-mono); }
.legend { display: flex; gap: 14px; font-size: var(--fs-sm); color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 64px 14px minmax(0, 1fr); gap: 10px; padding: 7px 16px; font-size: var(--fs-md); align-items: start; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline__time { font: 11.5px var(--font-mono); color: var(--text-3); padding-top: 1px; }
.timeline__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 5px; }
.timeline__dot--failure { background: var(--warn); border-radius: 1px; transform: rotate(45deg); }
.timeline__dot--denied { background: var(--crit); border-radius: 1px; }
.timeline__body { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.qa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-3); padding: 14px; }
.qa-card { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); position: relative; min-width: 0; transition: border-color var(--dur), transform var(--dur); }
.qa-card:hover { border-color: var(--accent); }
.qa-card.is-inactive { opacity: .55; border-style: dashed; }
.qa-card__icon { width: 38px; height: 38px; border-radius: var(--r); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.qa-card__icon .icon { width: 19px; height: 19px; }
.qa-card__body { min-width: 0; flex: 1; }
.qa-card__name { font-weight: 600; display: flex; gap: 6px; align-items: center; color: var(--text); }
.qa-card__name:hover { text-decoration: none; color: var(--accent-strong); }
.qa-card__host { font: 11.5px var(--font-mono); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-card__tools { display: flex; gap: 2px; }
.qa-card[draggable="true"] { cursor: grab; }
.qa-card.is-dragging { opacity: .4; }
.qa-card.is-drop-target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--sp-3); }
.role-card { padding: 14px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.role-card__head { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.role-card__meta { display: flex; gap: 12px; font-size: var(--fs-sm); color: var(--text-2); }

.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.settings-nav { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; gap: 2px; }
.settings-nav button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); font-size: var(--fs-md); color: var(--text-2); cursor: pointer; }
.settings-nav button:hover { background: var(--surface-hover); color: var(--text); }
.settings-nav button[aria-current="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.settings-nav button:focus-visible { outline: 2px solid var(--focus); }
.brand-preview { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.brand-preview__box { width: 160px; height: 64px; border: 1px dashed var(--border-strong); border-radius: var(--r); display: grid; place-items: center; background: var(--sidebar-bg); }
.brand-preview__box img { max-height: 40px; max-width: 140px; }

/* ============================================================ responsive */

/* Laptop / tablet landscape: icon rail sidebar */
@media (max-width: 1199px) {
  .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .shell__sidebar .brand__text, .shell__sidebar .nav__label, .shell__sidebar .nav__section, .shell__sidebar .nav__badge, .shell__sidebar .nav__foot-text { display: none; }
  .shell__sidebar .brand { justify-content: center; padding: 0; }
  .shell__sidebar .nav__item { justify-content: center; padding: 0; height: 40px; }
  .shell__sidebar .nav__foot { justify-content: center; }
  .shell__sidebar .nav__foot .live-dot { margin: 0; font-size: 0; gap: 0; }
  .shell__sidebar .nav__item[aria-current="page"]::before { left: -8px; }
  .shell.is-rail-open .shell__sidebar { width: var(--sidebar-w); box-shadow: var(--shadow-lg); }
  .shell.is-rail-open .shell__sidebar .brand__text, .shell.is-rail-open .shell__sidebar .nav__label, .shell.is-rail-open .shell__sidebar .nav__section { display: revert; }
  .shell.is-rail-open .shell__sidebar .nav__item { justify-content: flex-start; padding: 0 10px; }
  .shell.is-rail-open .shell__sidebar .brand { justify-content: flex-start; padding: 0 16px; }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  .search-trigger { min-width: 0; }
  .search-trigger__label, .search-trigger kbd { display: none; }
  .user-chip__text { display: none; }
  .auth { grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); }
  .auth__visual { padding: 32px; }
}

/* Tablet portrait & below */
@media (max-width: 991px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
  .settings-nav button { white-space: nowrap; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__visual { display: none; }
  .auth__panel { border-left: 0; min-height: 100vh; }
}

/* Mobile */
@media (max-width: 767px) {
  :root { --header-h: 54px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell__sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s var(--ease); box-shadow: var(--shadow-lg); }
  .shell__sidebar .brand__text, .shell__sidebar .nav__label, .shell__sidebar .nav__section, .shell__sidebar .nav__badge, .shell__sidebar .nav__foot-text { display: revert; }
  .shell__sidebar .brand { justify-content: flex-start; padding: 0 16px; }
  .shell__sidebar .nav__item { justify-content: flex-start; padding: 0 12px; height: 44px; font-size: var(--fs-base); }
  .shell__sidebar .nav__foot .live-dot { font-size: 10.5px; gap: 6px; margin-left: auto; }
  .shell.is-nav-open .shell__sidebar { transform: none; }
  .nav-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 25; }
  .shell__header { padding: 0 8px 0 4px; gap: 6px; }
  .shell__header .header__menu-btn { display: inline-flex; }
  .shell__main { padding: var(--sp-4) var(--sp-4) var(--sp-8); }
  .page-head h1 { font-size: var(--fs-xl); }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1 1 auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .kpi__value { font-size: 22px; }
  .toolbar { padding: 8px; }
  .toolbar .input-icon { max-width: none; flex-basis: 100%; }
  .toolbar .select { flex: 1 1 40%; min-width: 0; }
  .toolbar .input[type="date"] { flex: 1 1 40%; min-width: 0; }
  .header__crumbs .crumbs li:not(:last-child) { display: none; }
  .header__crumbs .crumbs li:last-child::before { display: none; }

  /* comfortable touch targets */
  .btn { height: 40px; }
  .btn--sm { height: 34px; }
  .btn--icon { width: 40px; }
  .btn--sm.btn--icon { width: 34px; }
  .input, .select { height: 42px; font-size: 16px; }
  .textarea { font-size: 16px; }
  .check input { width: 20px; height: 20px; }
  .link-btn { min-height: 34px; display: inline-flex; align-items: center; }

  /* tables become stacked cards */
  .table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .table--cards tbody tr:hover { background: transparent; }
  .table--cards td { height: auto; padding: 3px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; min-width: 0; }
  .table--cards td::before { content: attr(data-label); color: var(--text-3); font-size: var(--fs-sm); text-align: left; flex: none; max-width: 45%; }
  .table--cards td.cell-primary { display: block; text-align: left; font-size: var(--fs-base); padding-bottom: 6px; }
  .table--cards td.cell-primary::before { display: none; }
  .table--cards td.col-actions { justify-content: flex-end; padding-top: 8px; }
  .table--cards td.col-actions::before { display: none; }
  .table--cards td > * { min-width: 0; }

  /* dialogs become bottom sheets */
  .overlay:not(.drawer-overlay):not(.palette-overlay) { align-items: flex-end; padding: 0; }
  .overlay:not(.drawer-overlay):not(.palette-overlay) .dialog { width: 100%; max-height: 92vh; border-radius: 12px 12px 0 0; animation: sheet-up .22s var(--ease); }
  .overlay:not(.drawer-overlay):not(.palette-overlay) .dialog::before { content: ""; width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 8px auto 0; }
  .dialog__foot { border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .dialog__foot .btn { flex: 1 1 auto; }
  .drawer { width: 100%; border-left: 0; }
  .drawer__foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .drawer__foot .btn { flex: 1 1 auto; }
  .palette-overlay { padding: 0; }
  .palette { width: 100%; height: 100%; border-radius: 0; display: flex; flex-direction: column; }
  .palette__results { max-height: none; flex: 1; }
  .nc { left: 8px; right: 8px; width: auto; top: calc(var(--header-h) + 4px); }
  .toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; }
  .auth__panel { padding: 28px 20px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { border-bottom: 0; padding-bottom: 0; font-size: var(--fs-sm); }
  .kv dd { padding-left: 0; padding-top: 2px; }
  .qa-grid { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .codes { grid-template-columns: minmax(0, 1fr); }
  .timeline li { grid-template-columns: 52px 12px minmax(0, 1fr); padding: 7px 12px; }
  .shell__footer { flex-direction: column; gap: 4px; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }

@media (pointer: coarse) {
  .nav__item { min-height: 44px; }
  .menu__item { padding: 12px; }
  .tab { height: 44px; }
}

@media print {
  .shell__sidebar, .shell__header, .toasts { display: none !important; }
  .shell { display: block; }
}

/* ==========================================================================
   Phase 2 — infrastructure: rack visualisation, cabinets, IPAM, timelines
   ========================================================================== */

/* ---------- generic bits */
.segmented { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.segmented__item { height: 26px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); font: inherit; font-size: var(--fs-md); font-weight: 600; cursor: pointer; }
.segmented__item:hover { color: var(--text); }
.segmented__item[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong); }
.segmented__item:disabled { opacity: .45; cursor: not-allowed; }
.subnav { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.subnav__item { padding: 8px 14px; color: var(--text-2); font-weight: 600; font-size: var(--fs-md); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav__item:hover { color: var(--text); }
.subnav__item[aria-current="page"] { color: var(--accent-strong); border-bottom-color: var(--accent); }
.form-section { grid-column: 1 / -1; margin: 6px 0 -4px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.move-subject { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.col-meter { min-width: 170px; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }

/* ---------- rack page layout */
.rack-layout { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.rack-stage { position: relative; z-index: 0; isolation: isolate; display: flex; justify-content: center; perspective: 1800px; padding: 4px 0 8px; }
.rack-hint { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.rack-legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; font-size: var(--fs-sm); color: var(--text-2); }
.rack-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.rack-legend__swatch { width: 12px; height: 12px; border-radius: 2px; border: 1px solid rgba(255,255,255,.2); }
.sw-ok { background: #2fc57a; } .sw-warn { background: #f2b33d; } .sw-crit { background: #ff5a57; }
.sw-masked { background: repeating-linear-gradient(45deg, #39414f 0 3px, #262c36 3px 6px); }
.sw-free { background: #0d1117; }
.sw-net { background: #3b8cff; } .sw-power { background: #f2b33d; } .sw-other { background: #9aa8bd; }

/* ---------- the rack (dark metal in both themes, like the real thing) */
.rack {
  --u-h: 20px;
  --rail-w: 34px;
  position: relative; width: 100%; max-width: 560px;
  padding: 0 12px; border-radius: 8px;
  background: linear-gradient(90deg, #11151c, #1d232d 12%, #1a2029 88%, #0f1319);
  border: 1px solid #2c3441; box-shadow: 0 18px 40px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.03);
  color: #dfe6f0; user-select: none; transform-style: preserve-3d;
}
.rack__cap { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 28px; padding: 0 8px; }
.rack__cap--top { border-bottom: 1px solid #2c3441; }
.rack__cap--bottom { height: 18px; border-top: 1px solid #2c3441; }
.rack__brand { font-size: 10px; letter-spacing: .12em; color: #7d8aa0; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rack__cap-vents { flex: 1 1 auto; max-width: 55%; height: 8px; background: repeating-linear-gradient(90deg, #0b0e13 0 6px, transparent 6px 10px); border-radius: 2px; opacity: .9; }
.rack__feet { width: 34px; height: 6px; border-radius: 0 0 3px 3px; background: #0b0e13; }
.rack__body { position: relative; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--rail-w); padding: 6px 0; }
.rack__rail { display: grid; grid-template-rows: repeat(42, var(--u-h)); background: linear-gradient(90deg, #232a35, #151a22); border: 1px solid #2c3441; }
.rack__rail-u { display: flex; align-items: center; justify-content: center; gap: 3px; font: 9.5px/1 var(--font-mono); color: #74829a; border-bottom: 1px solid rgba(0,0,0,.35); position: relative; }
.rack__rail--l .rack__rail-u::after, .rack__rail--r .rack__rail-u::before { content: ""; width: 4px; height: 4px; background: #0a0d12; border-radius: 1px; box-shadow: 0 0 0 1px #3a4557; }
.rack__bay { position: relative; display: grid; grid-template-rows: repeat(42, var(--u-h)); grid-template-columns: minmax(0, 1fr); background: #0b0f15 repeating-linear-gradient(180deg, transparent 0 calc(var(--u-h) - 1px), rgba(255,255,255,.035) calc(var(--u-h) - 1px) var(--u-h)); border-top: 1px solid #2c3441; border-bottom: 1px solid #2c3441; }
.rack-slot { grid-column: 1; position: relative; display: flex; align-items: center; justify-content: center; }
.rack-slot__add { opacity: 0; width: 100%; height: 100%; border: 0; background: transparent; color: #8fb8ff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.rack-slot.is-actionable:hover .rack-slot__add, .rack-slot__add:focus-visible { opacity: 1; background: rgba(47,141,255,.12); outline: 1px dashed rgba(90,166,255,.6); outline-offset: -2px; }
.rack[data-door="closed"] .rack-slot__add, .rack[data-door="opening"] .rack-slot__add { pointer-events: none; }

/* ---------- devices (front) */
.rack-dev {
  grid-column: 1; position: relative; z-index: 1; margin: 1px 2px; min-width: 0;
  display: flex; align-items: center; gap: 8px; padding: 0 6px;
  border-radius: 2px; border: 1px solid #3a4557;
  background: linear-gradient(180deg, #313b4b, #222a36 55%, #1b212b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 1px 0 rgba(0,0,0,.5);
  font-size: 11px; line-height: 1.15; cursor: pointer; overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur);
}
.rack-dev:hover, .rack-dev:focus-visible { border-color: #5aa6ff; box-shadow: 0 0 0 1px #5aa6ff, 0 4px 12px rgba(0,0,0,.45); z-index: 2; outline: none; }
.rack-dev.is-movable { cursor: grab; }
.rack.is-dragging .rack-dev { cursor: grabbing; }
.rack-dev.is-dragging { opacity: .3; }
.rack-dev.is-saving { outline: 2px dashed #5aa6ff; outline-offset: -2px; }
.rack-dev__ear { flex: 0 0 5px; align-self: stretch; margin: 2px 0; border-radius: 1px; background: linear-gradient(180deg, #4a5568, #2d3542); }
.rack-dev__led { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #6b778a; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
.rack-dev__led--ok { background: #2fc57a; box-shadow: 0 0 6px #2fc57a; }
.rack-dev__led--warning { background: #f2b33d; box-shadow: 0 0 6px #f2b33d; }
.rack-dev__led--error { background: #ff5a57; box-shadow: 0 0 6px #ff5a57; }
.rack-dev__led--maintenance { background: #b18cff; box-shadow: 0 0 6px #b18cff; }
.rack-dev__led--pending, .rack-dev__led--info { background: #4aa8ff; }
.rack-dev__label { display: flex; flex-direction: column; min-width: 0; flex: 0 1 auto; max-width: 48%; }
.rack-dev__code { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: #f1f5fb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rack-dev__code .icon { width: 12px; height: 12px; opacity: .75; flex: none; }
.rack-dev__name { color: #9fb0c8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.rack-dev__face { flex: 1 1 auto; align-self: stretch; margin: 3px 0; border-radius: 1px; background: repeating-linear-gradient(90deg, rgba(0,0,0,.55) 0 2px, rgba(255,255,255,.05) 2px 4px); opacity: .8; min-width: 12px; }
.rack-dev--switch .rack-dev__face, .rack-dev--router .rack-dev__face { background: radial-gradient(circle at 50% 50%, #0b0e13 38%, transparent 40%) 0 0 / 9px 8px, #1a2029; opacity: 1; }
.rack-dev--patch_panel .rack-dev__face { background: radial-gradient(circle, #0b0e13 34%, transparent 36%) 0 0 / 8px 100%, #262d38; opacity: 1; }
.rack-dev--storage .rack-dev__face { background: repeating-linear-gradient(90deg, #11151c 0 14px, #3a4557 14px 15px); opacity: 1; }
.rack-dev--firewall { border-color: #6b4a4a; }
.rack-dev--pdu .rack-dev__face { background: repeating-linear-gradient(90deg, #0b0e13 0 6px, #f2b33d33 6px 8px); opacity: 1; }
.rack-dev__u { flex: none; font-size: 9.5px; color: #8391a5; padding: 1px 4px; border-radius: 2px; background: rgba(0,0,0,.35); }
.rack-dev--h1 .rack-dev__u { display: none; }
.rack-dev--masked { cursor: default; justify-content: space-between; border-style: dashed; border-color: #4a5568; background: repeating-linear-gradient(45deg, #2a313d 0 5px, #1d232c 5px 10px); }
.rack-dev--masked:hover { border-color: #4a5568; box-shadow: none; }
.rack-dev__masked { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #8391a5; }
.rack-ghost { position: fixed; z-index: 400; pointer-events: none; opacity: .92; box-shadow: 0 16px 36px rgba(0,0,0,.5), 0 0 0 1px #5aa6ff; transform: rotate(-.6deg); }
.rack-drop { grid-column: 1; position: relative; z-index: 3; margin: 0 1px; border-radius: 3px; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.rack-drop.is-ok { background: rgba(47,197,122,.18); outline: 2px solid #2fc57a; }
.rack-drop.is-bad { background: rgba(255,90,87,.16); outline: 2px solid #ff5a57; }
.rack-drop__label { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 3px; background: rgba(0,0,0,.65); color: #fff; }

/* ---------- rear view */
.rack[data-view="rear"] .rack__bay::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 14px; background: repeating-linear-gradient(180deg, #151a22 0 10px, #232a35 10px 12px); border-left: 1px solid #2c3441; z-index: 0; }
.rack[data-view="rear"] .rack-dev { margin-right: 16px; background: linear-gradient(180deg, #232a35, #171c24); cursor: default; }
.rack-dev--rear:hover { border-color: #3a4557; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.rack-dev__psus { display: flex; flex-direction: column; gap: 2px; flex: none; }
.rack-dev__psu { width: 18px; height: 7px; border-radius: 1px; background: linear-gradient(90deg, #2c3441, #3a4557); box-shadow: inset 0 0 0 1px #0b0e13; }
.rack-dev__rear-label { flex: none; border: 0; background: transparent; color: #cfd8e6; font-size: 10.5px; font-weight: 600; cursor: pointer; padding: 0 2px; }
.rack-dev__rear-label:hover { color: #fff; text-decoration: underline; }
.rack-ports { flex: 1 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: center; gap: 3px; min-width: 0; overflow: hidden; }
.rack-ports__none { font-size: 10px; color: #66758d; }
.rack-port { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 16px; padding: 0 5px 0 3px; border: 1px solid #3a4557; border-radius: 2px; background: #0f1319; color: #cfd8e6; font-size: 9.5px; cursor: pointer; }
.rack-port:hover, .rack-port:focus-visible { border-color: currentColor; outline: none; box-shadow: 0 0 0 1px currentColor; }
.rack-port__jack { width: 8px; height: 7px; border-radius: 1px; background: currentColor; box-shadow: inset 0 -2px 0 rgba(0,0,0,.5); }
.rack-port__name { color: #cfd8e6; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rack-port__cable { position: absolute; left: 100%; top: 50%; width: 6px; height: 2px; background: currentColor; }
.rack-port--network { color: #3b8cff; } .rack-port--power { color: #f2b33d; } .rack-port--other { color: #9aa8bd; }
.rack-port.is-static { cursor: default; padding: 0 3px; }
.rack-dev--h1 .rack-port__name { display: none; }

/* ---------- glass door (front) */
.rack-door {
  position: absolute; inset: 0 -6px; z-index: 5; display: block; padding: 0; margin: 0;
  border: 7px solid #2a313d; border-radius: 4px; cursor: pointer; color: #cfe3ff;
  background: linear-gradient(115deg, rgba(150,190,255,.20) 0%, rgba(255,255,255,.05) 38%, rgba(150,190,255,.14) 60%, rgba(255,255,255,.03) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), inset 0 0 40px rgba(90,166,255,.12), 0 10px 30px rgba(0,0,0,.35);
  backdrop-filter: blur(1.2px) saturate(.9); -webkit-backdrop-filter: blur(1.2px) saturate(.9);
  transform-origin: left center; transform: rotateY(0deg);
  transition: transform 700ms var(--ease), opacity 700ms var(--ease), box-shadow 700ms var(--ease);
}
.rack-door__glass { position: absolute; inset: 0; background: radial-gradient(circle, rgba(255,255,255,.07) 1px, transparent 1.5px) 0 0 / 7px 7px; pointer-events: none; }
.rack-door__handle { position: absolute; right: 8px; top: 50%; width: 6px; height: 64px; margin-top: -32px; border-radius: 3px; background: linear-gradient(90deg, #4a5568, #9aa8bd, #4a5568); box-shadow: 0 0 0 1px #11151c; }
.rack-door__hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(8,13,22,.72); font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid rgba(255,255,255,.12); }
.rack-door:hover .rack-door__hint, .rack-door:focus-visible .rack-door__hint { background: rgba(8,124,249,.85); }
.rack-door:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rack[data-door="opening"] .rack-door, .rack[data-door="open"] .rack-door { transform: rotateY(-104deg); opacity: .55; box-shadow: none; }
.rack[data-door="open"] .rack-door { visibility: hidden; pointer-events: none; }
.rack[data-door="closing"] .rack-door { transform: rotateY(0deg); }
.rack[data-door="opening"] .rack-door__hint, .rack[data-door="closing"] .rack-door__hint { opacity: 0; }
.rack[data-view="rear"] .rack-door { display: none; }
@media (prefers-reduced-motion: reduce) { .rack-door { transition: none; } }

/* ---------- capacity side panel */
.cap-figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin-bottom: 12px; }
.cap-figure { background: var(--surface); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.cap-figure__label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.cap-figure__value { font-size: 18px; font-weight: 600; }
.cap-strip { display: grid; grid-template-columns: repeat(42, minmax(0, 1fr)); gap: 1px; margin-top: 10px; height: 10px; }
.cap-strip span { background: var(--surface-3); border-radius: 1px; }
.cap-strip .is-used { background: var(--accent); }
.cap-strip .is-masked { background: var(--off); }

/* ---------- datacenter cabinet cards */
.cab-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.cab-card { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); color: inherit; text-decoration: none; }
.cab-card:hover { border-color: var(--accent); background: var(--surface-hover); }
.cab-card__head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.cab-card__code { font-weight: 700; }
.cab-card__meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); min-height: 18px; }
.cab-card__mini { display: grid; grid-template-rows: repeat(14, 3px); gap: 1px; padding: 4px; background: #11151c; border-radius: 3px; }
.cab-card__mini span { background: #232a35; border-radius: 1px; }
.cab-card__mini .is-used { background: #3b8cff; }

/* ---------- connections */
.conn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.conn-list__item { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); color: inherit; font: inherit; font-size: var(--fs-md); cursor: pointer; text-align: left; }
.conn-list__item:hover { border-color: var(--accent); }
.conn-list .rack-port { background: transparent; border: 0; }
.conn-diagram { display: grid; grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr); align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.conn-diagram__end { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: center; }
.conn-diagram__end strong { overflow-wrap: anywhere; }
.conn-diagram__role { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.conn-diagram__port { display: inline-block; align-self: center; padding: 1px 6px; border-radius: 3px; background: var(--surface-3); font-size: var(--fs-sm); }
.conn-diagram__cable { position: relative; height: 3px; border-radius: 2px; background: #3b8cff; display: flex; justify-content: center; }
.conn-diagram__cable span { position: absolute; top: -18px; font-size: 11px; color: var(--text-2); }
.conn-diagram__cable--power { background: #f2b33d; } .conn-diagram__cable--other { background: var(--off); }

/* ---------- movement timeline */
.mv-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.mv-timeline__item { display: grid; grid-template-columns: 86px 16px minmax(0, 1fr); gap: 10px; padding: 8px 0; position: relative; }
.mv-timeline__item + .mv-timeline__item { border-top: 1px dashed var(--border); }
.mv-timeline__date { display: flex; flex-direction: column; font-size: var(--fs-sm); }
.mv-timeline__dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mv-timeline__item--receive .mv-timeline__dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.mv-timeline__item--dispose .mv-timeline__dot { background: var(--crit); border-radius: 2px; box-shadow: 0 0 0 3px var(--crit-soft); }
.mv-timeline__body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mv-timeline__route { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; overflow-wrap: anywhere; }
.mv-timeline__meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: var(--fs-sm); color: var(--text-2); }
.mv-timeline__notes { font-size: var(--fs-sm); color: var(--text-2); white-space: pre-line; }

/* ---------- images */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gallery__item { position: relative; margin: 0; aspect-ratio: 4 / 3; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery__remove { position: absolute; top: 4px; right: 4px; background: var(--surface); }

/* ---------- IPAM */
.ip-status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .06em; white-space: nowrap; }
.ip-status__dot { width: 8px; height: 8px; border-radius: 50%; }
.ip-status--in_use { background: var(--ok-soft); color: var(--ok); }
.ip-status--in_use .ip-status__dot { background: var(--ok); }
.ip-status--free { background: var(--surface-3); color: var(--text-2); border: 1px dashed var(--border-strong); }
.ip-status--free .ip-status__dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-3); }
.ip-table tr.is-free td { color: var(--text-2); }
.ip-table tr.is-free .cell-title { color: var(--text-2); font-weight: 500; }
.ip-table tr.is-focus td { background: var(--accent-soft); }
.ip-check { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r); font-size: var(--fs-md); }
.ip-check--ok { background: var(--ok-soft); color: var(--ok); }
.ip-check--bad { background: var(--crit-soft); color: var(--text); }
.ip-check--bad > .icon { color: var(--crit); margin-top: 2px; }
.ip-recs { display: flex; flex-wrap: wrap; gap: 6px; }
.ip-recs__meta { width: 100%; font-size: var(--fs-sm); }
.ip-rec { height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); color: var(--text); font: inherit; font-size: var(--fs-md); cursor: pointer; }
.ip-rec:hover { border-color: var(--accent); }
.ip-rec[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); box-shadow: 0 0 0 1px var(--accent); }
.ip-unavail { font-size: var(--fs-sm); color: var(--text-2); }
.ip-unavail__title { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; margin-top: 4px; }
.ip-unavail ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- responsive */
@media (max-width: 1199px) {
  .rack-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 991px) {
  .rack-layout { grid-template-columns: minmax(0, 1fr); }
  .rack { --u-h: 20px; }
}
@media (max-width: 767px) {
  .rack { --u-h: 17px; --rail-w: 24px; padding: 0 6px; }
  .rack__rail-u { font-size: 8px; }
  .rack__rail--l .rack__rail-u::after, .rack__rail--r .rack__rail-u::before { display: none; }
  .rack-dev { gap: 5px; padding: 0 3px; font-size: 10px; }
  .rack-dev__face { display: none; }
  .rack-dev__label { max-width: none; flex: 1 1 auto; }
  .rack-dev__u { font-size: 8.5px; }
  .rack-port__name { display: none; }
  .rack-door__hint { font-size: 11px; padding: 5px 10px; }
  .cap-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mv-timeline__item { grid-template-columns: 70px 14px minmax(0, 1fr); gap: 8px; }
  .conn-diagram { grid-template-columns: minmax(0, 1fr); }
  .conn-diagram__cable { width: 3px; height: 28px; justify-self: center; }
  .conn-diagram__cable span { top: 6px; left: 10px; }
  .segmented { width: 100%; }
  .segmented__item { flex: 1 1 0; height: 34px; }
}
@media (pointer: coarse) {
  .rack[data-door="open"] .rack-slot__add { opacity: .35; }
  .rack-port { height: 20px; }
}
@media print {
  .rack-door { display: none; }
}
.kv .cell-stack { display: flex; flex-direction: column; line-height: 1.3; }
.kv .cell-sub { font-size: var(--fs-sm); color: var(--text-3); }
@media (max-width: 767px) {
  .panel__head { flex-wrap: wrap; row-gap: 8px; }
  .panel__tools { flex-wrap: wrap; margin-left: 0; width: 100%; }
  .panel__tools .segmented { width: auto; flex: 1 1 100%; }
}

/* ================================================================ Phase 3 */
.pre { white-space: pre-line; }
.strong { font-weight: 700; }
.txt-ok { color: var(--ok); } .txt-warn { color: var(--warn); } .txt-crit { color: var(--crit); }
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.badge--danger { background: color-mix(in srgb, var(--crit) 16%, transparent); color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.kpi-link { display: block; color: inherit; text-decoration: none; border-radius: var(--r-lg); }
.kpi-link:hover .kpi { border-color: var(--border-strong); background: var(--surface-hover); }
.kpi-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check-list li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: start; color: var(--text-2); }
.check-list .icon { color: var(--ok); margin-top: 2px; }

/* ---- uptime bar: state = colour + glyph/pattern + text label (never colour only) */
.ub { display: grid; gap: 8px; }
.ub__bar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; height: 34px; }
.ub--compact .ub__bar { height: 18px; }
.ub__seg { position: relative; display: grid; place-items: center; min-width: 0; padding: 0; border: 0; border-radius: 2px; background: var(--surface-3); color: #fff; font: 700 11px/1 var(--font-mono); cursor: default; }
button.ub__seg { cursor: pointer; }
button.ub__seg:hover { filter: brightness(1.12); transform: scaleY(1.08); }
button.ub__seg:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; z-index: 1; }
.ub__seg--up { background: var(--ok); }
.ub__seg--down { background: var(--crit); }
.ub__seg--maintenance { background: repeating-linear-gradient(45deg, var(--warn) 0 4px, color-mix(in srgb, var(--warn) 70%, #000) 4px 6px); color: #1a1300; }
.ub__seg--none { background: var(--surface-3); }
.ub__seg--future { background: transparent; border: 1px dashed var(--border); }
.ub__glyph { pointer-events: none; font-size: 10px; }
.ub__axis { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); color: var(--text-3); }
.ub__pct { color: var(--text-2); }
.ub__legend i.ub__swatch { width: 14px; height: 10px; display: inline-grid; place-items: center; border-radius: 2px; font-style: normal; font-size: 8px; color: #fff; }
@media (max-width: 767px) { .ub__bar { height: 40px; gap: 1px; } .ub__glyph { display: none; } }

.mon-card { border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 10px; background: var(--surface); }
.mon-card--down { border-left-color: var(--crit); }
.mon-card--maint { border-left-color: var(--warn); }
.mon-card__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- tags & groups */
.tag-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tag-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; font: 600 11px/1 var(--font-mono); border: 1px solid var(--tc, var(--border-strong)); color: var(--tc, var(--text-2)); background: color-mix(in srgb, var(--tc, var(--text-3)) 10%, transparent); }
.tag-chip--blue { --tc: var(--info); } .tag-chip--green { --tc: var(--ok); } .tag-chip--amber { --tc: var(--warn); } .tag-chip--red { --tc: var(--crit); } .tag-chip--violet { --tc: #8b5cf6; } .tag-chip--slate { --tc: var(--text-3); }
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 0; }
.mgr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mgr-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.mgr-item.is-inactive { opacity: .6; }
.group-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--gc, var(--info)); flex: none; }
.group-dot--green { --gc: var(--ok); } .group-dot--amber { --gc: var(--warn); } .group-dot--red { --gc: var(--crit); } .group-dot--violet { --gc: #8b5cf6; } .group-dot--slate { --gc: var(--text-3); }

/* ---- tasks */
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.prio__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.prio__bars i { width: 3px; background: var(--surface-3); border-radius: 1px; }
.prio__bars i:nth-child(1) { height: 4px; } .prio__bars i:nth-child(2) { height: 7px; } .prio__bars i:nth-child(3) { height: 10px; } .prio__bars i:nth-child(4) { height: 12px; }
.prio--low .on { background: var(--text-3); } .prio--normal .on { background: var(--info); } .prio--high .on { background: var(--warn); } .prio--critical .on { background: var(--crit); }
.prio--critical { color: var(--crit); }
.task-title { margin: 0; font-size: 18px; }
.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity__item { display: grid; grid-template-columns: 14px 1fr; gap: 10px; position: relative; padding-bottom: 12px; }
.activity__item::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.activity__item:last-child::before { display: none; }
.activity__dot { width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); }
.activity__item--completed .activity__dot { background: var(--ok); border-color: var(--ok); }
.activity__item--overdue .activity__dot, .activity__item--cancelled .activity__dot { background: var(--crit); border-color: var(--crit); }
.activity__item--assigned .activity__dot, .activity__item--created .activity__dot { border-color: var(--accent); }
.activity__time { display: block; font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.activity__quote { margin: 6px 0 0; padding: 8px 10px; border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: var(--r-sm); white-space: pre-line; }

/* ---- hash tool */
.hash-out { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--code-bg); word-break: break-all; font-size: 13px; user-select: all; }
textarea.is-masked { -webkit-text-security: disc; font-family: var(--font-mono); }

/* ---- quick access info */
.qa-info { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; }
.qa-info__title { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.qa-info__text { margin: 0; white-space: pre-line; }
.kpi-text .kpi__value { font-size: 22px; overflow-wrap: anywhere; }
.kpi-text { min-width: 0; }
.kpi-text > .kpi { height: 100%; }

/* ================================================================ Phase 4 */
/* portal nav accent: customers see a distinct, calmer shell */
.nav--portal .nav__section:first-child { color: var(--accent); }

.dash-section { display: flex; align-items: center; gap: 8px; margin: 8px 0 -4px; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.dash-section .icon { color: var(--accent); }

/* activity timeline */
.act-list { list-style: none; margin: 0; padding: 0; display: grid; }
.act { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.act:last-child { border-bottom: 0; }
.act__icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.act__body { min-width: 0; }
.act__text { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
a.act__text:hover { text-decoration: underline; }
.act__meta { display: flex; gap: 8px; align-items: center; margin-top: 3px; font-size: var(--fs-xs); color: var(--text-3); }
.act--fresh { animation: act-in 1.6s var(--ease, ease-out); }
@keyframes act-in { from { background: color-mix(in srgb, var(--accent) 16%, transparent); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .act--fresh { animation: none; } }
.act-list--compact .act { padding: 8px 12px; }

/* delegation */
.deleg-legend { gap: 16px; font-size: var(--fs-sm); color: var(--text-2); }
.deleg-legend span { display: inline-flex; gap: 6px; align-items: center; }
.deleg-module { display: grid; gap: 6px; }
.deleg-row { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; background: var(--surface); display: grid; gap: 8px; }
.deleg-row.is-disabled { opacity: .62; background: var(--surface-2); }
.deleg-row__head { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: start; cursor: pointer; }
.deleg-row.is-disabled .deleg-row__head { cursor: not-allowed; }
.deleg-row__head input { margin-top: 3px; width: 16px; height: 16px; }
.deleg-row__text { display: grid; gap: 2px; min-width: 0; }
.deleg-row__code { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.deleg-row__state { font-size: var(--fs-sm); white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }
.deleg-scopes { display: grid; gap: 8px; padding-left: 28px; }
.deleg-scope-type { display: grid; gap: 4px; }
.deleg-scope-type__label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--fs-sm); cursor: pointer; }
.chip-check:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.chip-check--wide { font-weight: 600; }
@media (max-width: 767px) {
  .deleg-row__head { grid-template-columns: 18px minmax(0, 1fr); }
  .deleg-row__state { grid-column: 2; }
  .deleg-scopes { padding-left: 0; }
  .chip-check { min-height: 40px; }
}

/* chips (recipient picker) */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-sm); }
.chip__x { border: 0; background: transparent; color: var(--text-3); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.chip__x:hover { background: var(--surface-3); color: var(--text); }

/* portal organisation access list */
.perm-groups { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.perm-group { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); }

/* grouped settings navigation */
.settings-nav__section { margin: 12px 0 4px; padding: 0 10px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.settings-nav__section:first-child { margin-top: 0; }
@media (max-width: 767px) { .settings-nav__section { display: none; } }

/* ======================================================= Phase 6 — services, remote, traffic, maintenance, security */
/* "WHAT WILL HAPPEN?" preview */
.wwh { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r); background: var(--surface-2); padding: 10px 12px; }
.wwh__title { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.wwh__list { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: var(--fs-md); }
.wwh__list dt { color: var(--text-2); }
.wwh__list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.wwh__v--ok { color: var(--ok); } .wwh__v--warn { color: var(--warn); font-weight: 600; } .wwh__v--crit { color: var(--crit); font-weight: 600; }
@media (max-width: 767px) { .wwh__list { grid-template-columns: 1fr; } .wwh__list dd { margin-bottom: 6px; } }

/* generic dependency graph (layered columns) */
.dep-legend .chip { padding-right: 10px; }
.dep-graph { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.dep-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dep-col__head { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 0 2px; }
.dep-node { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px 8px; padding: 8px 10px; border: 1px solid var(--border); border-left: 3px solid var(--info, var(--accent)); border-radius: var(--r); background: var(--surface); color: inherit; text-decoration: none; font-size: var(--fs-md); }
.dep-node > .status { grid-column: 2; font-size: var(--fs-sm); }
a.dep-node:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.dep-node--ok { border-left-color: var(--ok); } .dep-node--warn { border-left-color: var(--warn); } .dep-node--crit { border-left-color: var(--crit); } .dep-node--muted, .dep-node--hidden { border-left-color: var(--border-strong); opacity: .8; }
.dep-node__icon { color: var(--text-3); padding-top: 1px; }
.dep-node__body { display: flex; flex-direction: column; min-width: 0; }
.dep-node__type { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.dep-node__rel { text-transform: none; letter-spacing: 0; }
.dep-node__label { font-weight: 600; overflow-wrap: anywhere; }
.dep-node__sub { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .dep-graph { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; }
  .dep-col { padding-left: 10px; border-left: 2px solid var(--border); }
}

/* traffic */
.traffic-graph { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); min-height: 90px; display: grid; place-items: center; overflow: hidden; }
.traffic-graph__img { display: block; width: 100%; height: auto; }
.traffic-graph__fallback { display: flex; gap: 8px; align-items: center; color: var(--text-3); font-size: var(--fs-sm); padding: 24px; }
.traffic-port { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.traffic-port:last-child { border-bottom: 0; padding-bottom: 0; }
.traffic-trend { width: 100%; height: 170px; display: block; }
.traffic-trend .axis { stroke: var(--border-strong); }
.traffic-trend text { fill: var(--text-3); font-size: 10px; }
.traffic-trend__in { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.traffic-trend__in-area { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.traffic-trend__out { fill: none; stroke: var(--ok); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.legend-swatch { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }
.legend-swatch--in { background: var(--accent); } .legend-swatch--out { background: var(--ok); }
.segmented--sm .segmented__item { height: 22px; padding: 0 8px; font-size: var(--fs-sm); }

/* remote management */
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 767px) { .power-row .btn { flex: 1 1 calc(50% - 6px); height: 40px; } }

/* maintenance */
.maint-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.maint-item { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r); }
.maint-item--live { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); background: var(--warn-soft); }
.target-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.target-picker { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; }
@media (max-width: 767px) { .target-picker { grid-template-columns: 1fr; } }

/* reverse DNS */
.rdns-list { display: flex; flex-direction: column; gap: 6px; }
.rdns-row { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) auto minmax(90px, auto); gap: 8px; align-items: center; }
.rdns-row__ip { font-size: var(--fs-md); }
.rdns-row__msg { grid-column: 1 / -1; }
.rdns-row__msg:empty { display: none; }
@media (max-width: 767px) { .rdns-row { grid-template-columns: 1fr auto; padding: 8px 0; border-bottom: 1px solid var(--border); } .rdns-row__ip { grid-column: 1 / -1; } }

/* API tokens / misc */
.token-secret { display: block; font-size: 13px; letter-spacing: .02em; user-select: all; }
.code-block { margin: 0; padding: 10px 12px; font: 12px/1.5 var(--font-mono); background: var(--code-bg, var(--surface-2)); border: 1px solid var(--border); border-radius: var(--r); overflow-x: auto; white-space: pre; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-md); }
.sev--critical .status { font-weight: 700; }
@media (max-width: 767px) {
  .segmented--sm .segmented__item { height: 34px; padding: 0 10px; }
  .traffic-port .btn--icon, #remote .panel__tools .btn { min-width: 36px; height: 36px; }
}

/* ------------------------------------------------ Phase 7: diagnostics, ranges, reverse DNS */
.input-group__addon { display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--r) 0 0 var(--r); color: var(--text-3); background: var(--surface-2, transparent); }
.input-group__addon + .input { border-radius: 0; }
.diag { display: grid; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r); }
.diag--ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.diag--fail { border-color: color-mix(in srgb, var(--crit) 45%, var(--border)); }
.diag__head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.diag__reason { color: var(--text-2, inherit); overflow-wrap: anywhere; }
.diag-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.diag-step { display: grid; grid-template-columns: 1.4em minmax(8em, max-content) 1fr; gap: 8px; align-items: baseline; font-size: var(--fs-sm); }
.diag-step__mark { font-weight: 700; text-align: center; }
.diag-step--ok .diag-step__mark { color: var(--ok); }
.diag-step--fail .diag-step__mark { color: var(--crit); }
.diag-step--skip { color: var(--text-3); }
.diag-step__detail { color: var(--text-3); overflow-wrap: anywhere; min-width: 0; }
.diag-preview { max-width: 100%; border-radius: var(--r); border: 1px solid var(--border); }
.range-control { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.range-control__custom { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.range-control__custom .input { width: auto; min-width: 9.5em; }
.owner-cell { display: grid; gap: 2px; }
.owner-cell__subs { color: var(--text-3); font-size: var(--fs-sm); }
.access-list { display: grid; gap: 6px; }
@media (max-width: 640px) {
  .diag-step { grid-template-columns: 1.4em 1fr; }
  .diag-step__detail { grid-column: 2; }
}
