/* Network Monitoring System · FIBERBLAZE IMUS
   Style: professional + user-friendly + futuristic, in the FIBERBLAZE look (see CLAUDE.md):
   blue gradient bands, navy menu, orange primary actions, white pill cards, bold italic uppercase titles.
   Sizes use rem so the whole UI scales per screen type
   (Phone < 600, Tablet 600-1023, Laptop 1024-1365, PC 1366-1919, Large 1920-2559, TV >= 2560). */

/* ---------- Fonts (self-hosted Poppins, OFL) ---------- */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/poppins-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/poppins-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: italic; font-weight: 800; font-display: swap; src: url("/fonts/poppins-latin-800-italic.woff2") format("woff2"); }

/* ---------- Themes ---------- */
:root, :root[data-theme="light"] {
  --bg: #eef3fb; --surface: #ffffff; --sunk: #f4f7fc; --fg: #142247; --muted: #5b6b85; --line: #d5e0ef; --rule: #e6edf7;
  --blue: #1a5fe6; --blue2: #2f8cff; --navy: #0e1f6e; --orange: #f58220; --orange2: #ff9a3c; --on-blue: #ffffff;
  --up: #1d9a52; --warn: #d99a0b; --down: #d63b2f; --major: #e8641c;
  --shadow: 0 10px 30px rgb(14 31 110 / .10), 0 1px 3px rgb(14 31 110 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1540; --surface: #121c4a; --sunk: #0f1842; --fg: #e8eefa; --muted: #a3b1cc; --line: #2a3a74; --rule: #233164;
    --blue: #2a6cf0; --blue2: #3d93ff; --navy: #0a1444; --orange: #ff9138; --orange2: #ffad66; --on-blue: #ffffff;
    --up: #3fc77a; --warn: #f0b43a; --down: #f0655a; --major: #f58a4a;
    --shadow: 0 10px 30px rgb(0 0 0 / .35), 0 1px 3px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1540; --surface: #121c4a; --sunk: #0f1842; --fg: #e8eefa; --muted: #a3b1cc; --line: #2a3a74; --rule: #233164;
  --blue: #2a6cf0; --blue2: #3d93ff; --navy: #0a1444; --orange: #ff9138; --orange2: #ffad66; --on-blue: #ffffff;
  --up: #3fc77a; --warn: #f0b43a; --down: #f0655a; --major: #f58a4a;
  --shadow: 0 10px 30px rgb(0 0 0 / .35), 0 1px 3px rgb(0 0 0 / .3);
  color-scheme: dark;
}
:root {
  --sans: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "IBM Plex Mono", Consolas, ui-monospace, "SF Mono", monospace;
  --grad: linear-gradient(118deg, var(--blue) 0%, var(--blue2) 100%);
  --rail-w: 14.5rem; --rail-min: 4.2rem; --r-card: 18px; --r-pill: 999px;
  font-size: 15px;
}
/* Screen sizes: scale everything a little on bigger screens */
@media (min-width: 1366px) { :root { font-size: 15.5px; } }
@media (min-width: 1920px) { :root { font-size: 17px; } }
@media (min-width: 2560px) { :root { font-size: 22px; } }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: .9rem/1.5 var(--sans); -webkit-text-size-adjust: 100%; overflow-x: hidden; }
[hidden] { display: none !important; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.title { font: italic 800 1rem/1.15 var(--sans); text-transform: uppercase; letter-spacing: .01em; }

/* ---------- Buttons and inputs (pill shapes, 44 px touch targets) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.75rem; font: 600 .85rem var(--sans); color: var(--fg);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-pill); padding: .45rem 1.1rem; cursor: pointer; text-decoration: none; transition: border-color .15s, background .15s, transform .15s; }
.btn:hover { border-color: var(--blue); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; box-shadow: 0 6px 16px rgb(245 130 32 / .3); }
.btn.primary:hover { background: var(--orange2); border-color: var(--orange2); transform: translateY(-1px); }
.btn.danger { background: var(--down); border-color: var(--down); color: #fff; }
.btn.sm { min-height: 2.2rem; padding: .25rem .8rem; font-size: .78rem; }
.btn.link { background: none; border: 0; color: var(--blue); padding: .3rem 0; text-decoration: underline; min-height: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], input:not([type]), select, textarea {
  font: .9rem var(--sans); color: var(--fg); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: .55rem .8rem; min-width: 0; min-height: 2.75rem; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 14%, transparent); }
input[type="checkbox"] { width: 1.2rem; height: 1.2rem; accent-color: var(--orange); cursor: pointer; margin: 0; }
textarea { resize: vertical; min-height: 5rem; }
.select { appearance: none; padding-right: 2.2rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 55%, calc(100% - .75rem) 55%; background-size: .35rem .35rem; background-repeat: no-repeat; }
.search { width: 16rem; max-width: 100%; }
.form-error { margin: .3rem 0 0; padding: .55rem .8rem; border-radius: 12px; font-size: .82rem; color: var(--down);
  background: color-mix(in srgb, var(--down) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--down) 40%, transparent); }
@media (prefers-reduced-motion: reduce) { .btn, .btn:hover { transition: none; transform: none; } }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .7rem; border-radius: var(--r-pill); font-size: .74rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
  background: var(--sunk); color: var(--muted); border: 1px solid var(--line); }
.pill.on  { background: color-mix(in srgb, var(--up) 14%, var(--surface)); color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.pill.off { background: color-mix(in srgb, var(--muted) 12%, var(--surface)); color: var(--muted); }
.pill.warn { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.down { background: color-mix(in srgb, var(--down) 12%, var(--surface)); color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.pill.blue { background: color-mix(in srgb, var(--blue) 12%, var(--surface)); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 35%, transparent); }
.pill.orange { background: color-mix(in srgb, var(--orange) 14%, var(--surface)); color: var(--orange); border-color: color-mix(in srgb, var(--orange) 40%, transparent); }
.pill.navy { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Login (split screen; brand colors fixed in every theme) ---------- */
.lg { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); color: #142247; background: #eef3fb; color-scheme: light; }
.lg-brand { position: relative; overflow: hidden; color: #fff; display: flex; align-items: center;
  background: radial-gradient(90% 70% at 15% 10%, #3d93ff 0%, rgb(61 147 255 / 0) 60%), linear-gradient(135deg, #1a5fe6 0%, #2f8cff 60%, #4aa3ff 100%); }
.lg-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lg-brand-inner { position: relative; padding: clamp(2rem, 6vw, 6.5rem); padding-bottom: clamp(10rem, 28vh, 18rem); max-width: 42rem; }
.lg-logo { width: clamp(11rem, 18vw, 18rem); height: auto; display: block; filter: drop-shadow(0 8px 20px rgb(0 0 0 / .3)); }
.lg-title { margin: 1.6rem 0 0; font: italic 800 clamp(2.1rem, 1rem + 2.8vw, 3.8rem)/1.08 var(--sans); text-transform: uppercase; letter-spacing: -.01em; text-shadow: 0 4px 18px rgb(0 0 0 / .2); }
.lg-title span { color: #ffb366; }
.lg-tag { margin: .9rem 0 0; font-size: clamp(.95rem, .8rem + .4vw, 1.2rem); color: rgb(255 255 255 / .92); }
.lg-feats { list-style: none; display: grid; gap: .7rem; margin: 1.8rem 0 0; padding: 0; }
.lg-feats li { display: flex; align-items: center; gap: .85rem; padding: .55rem .9rem .55rem .55rem; border-radius: var(--r-pill); background: rgb(255 255 255 / .96); color: #142247; max-width: 24rem; box-shadow: 0 8px 20px rgb(0 0 0 / .12); }
.lg-pill-ico { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--grad); }
.lg-pill-ico svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lg-feats b { display: block; font-size: .9rem; text-transform: uppercase; font-style: italic; font-weight: 800; }
.lg-feats small { font-size: .76rem; color: #5b6b85; }
.lg-side { position: relative; display: grid; place-items: center; padding: 2.5rem 1.5rem; }
.lg-card { width: 100%; max-width: 30rem; display: grid; gap: 1rem; padding: clamp(1.75rem, 3vw, 3rem); background: #fff; border-radius: 24px; box-shadow: 0 24px 60px rgb(20 60 130 / .14), 0 2px 6px rgb(20 60 130 / .06); }
.lg-card h2 { font: italic 800 clamp(2rem, 1.4rem + 1.6vw, 2.8rem)/1.1 var(--sans); text-transform: uppercase; color: #0e1f6e; }
.lg-card h2 span { color: #f58220; }
.lg-sub { margin: -.6rem 0 .2rem; font-size: 1rem; color: #5b6b85; }
.lg-field { display: grid; gap: .35rem; }
.lg-field label { font-size: .82rem; font-weight: 600; }
.lg-field input { width: 100%; min-height: 3.2rem; padding: .7rem 1.1rem; font: 400 .98rem var(--sans); color: #142247; background: #fff; border: 1.5px solid #d5e0ef; border-radius: 14px; }
.lg-field input:focus { border-color: #1a5fe6; box-shadow: 0 0 0 4px rgb(26 95 230 / .12); }
.lg-pass { position: relative; }
.lg-pass input { padding-right: 3.3rem; }
.lg-eye { all: unset; position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: 50%; cursor: pointer; color: #6b7a92; }
.lg-eye:hover, .lg-eye[aria-pressed="true"] { color: #1a5fe6; }
.lg-eye:focus-visible { outline: 2px solid #1a5fe6; }
.lg-eye svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
.lg-card .form-error { margin: 0; color: #c62828; background: #fdecec; border-color: #f3b7b7; }
.lg-btn { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: .6rem; min-height: 3.4rem; border-radius: var(--r-pill);
  font: 600 1.1rem var(--sans); color: #fff; cursor: pointer; background: linear-gradient(90deg, #f58220 0%, #ff9a3c 100%); box-shadow: 0 12px 26px rgb(245 130 32 / .35); transition: filter .15s, transform .15s; }
.lg-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.lg-btn:focus-visible { outline: 3px solid #ffb366; outline-offset: 3px; }
.lg-btn:disabled { opacity: .6; cursor: wait; transform: none; }
.lg-btn svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lg-foot { margin: 0; padding-top: 1rem; border-top: 1px solid #e6edf6; text-align: center; font-size: .8rem; color: #5b6b85; }
@media (prefers-reduced-motion: reduce) { .lg-btn, .lg-btn:hover { transition: none; transform: none; } }
/* Phone and portrait tablet: brand becomes a band on top, card below */
@media (max-width: 899px) {
  .lg { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .lg-brand-inner { padding: 1.5rem 1.25rem 5.5rem; }
  .lg-logo { width: 9.5rem; }
  .lg-title { margin-top: 1rem; font-size: clamp(1.6rem, 1.2rem + 2.4vw, 2.3rem); }
  .lg-feats { margin-top: 1.1rem; gap: .45rem; }
  .lg-feats li { padding: .35rem .7rem .35rem .4rem; }
  .lg-pill-ico { width: 2rem; height: 2rem; } .lg-pill-ico svg { width: 1.05rem; height: 1.05rem; }
  .lg-feats b { font-size: .8rem; } .lg-feats small { font-size: .7rem; }
  .lg-side { place-items: start center; padding: 1.25rem 1rem 2rem; margin-top: -3rem; }
}
@media (max-width: 599px) { .lg-feats li:nth-child(n+2) { display: none; } .lg-field input { min-height: 2.9rem; } }

/* ---------- Change password ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 1.5rem 1rem; background: var(--grad); }
.auth-card { width: 100%; max-width: 24rem; display: grid; gap: .45rem; background: var(--surface); border-radius: 24px; padding: 1.8rem 1.6rem; box-shadow: var(--shadow); }
.auth-logo { width: 11rem; max-width: 70%; height: auto; justify-self: center; margin-bottom: .4rem; }
.auth-card h1 { font: italic 800 1.2rem var(--sans); text-transform: uppercase; text-align: center; color: var(--navy); }
:root[data-theme="dark"] .auth-card h1 { color: var(--fg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-card h1 { color: var(--fg); } }
.auth-card > p { margin: 0 0 .6rem; text-align: center; font-size: .85rem; }
.auth-card label { font-size: .8rem; font-weight: 600; margin-top: .35rem; }
.auth-card .btn.primary { margin-top: .8rem; }
.auth-card .btn.link { justify-self: center; }

/* ---------- App shell: navy rail + blue gradient app bar ---------- */
.app { min-height: 100%; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; gap: 2px; padding: 1rem .7rem; z-index: 20; width: var(--rail-w); transition: width .2s; }
.rail .brand { position: relative; display: grid; justify-items: center; text-align: center; gap: .35rem; padding: .2rem .5rem 1rem; margin-bottom: .5rem; border-bottom: 1px solid rgb(255 255 255 / .14); }
.rail .logo-full { width: 9.5rem; height: auto; display: block; margin: 0 auto .2rem; filter: drop-shadow(0 2px 6px rgb(0 0 0 / .3)); }
.rail .logo-icon { display: none; width: 2.6rem; height: 2.6rem; margin-inline: auto; }
.rail .brand .sys { display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #ffb366; }
.live-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: #34d27b; margin-right: .4rem; animation: live-pulse 1.8s infinite; flex: none; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgb(52 210 123 / .7); } 70% { box-shadow: 0 0 0 .45rem rgb(52 210 123 / 0); } 100% { box-shadow: 0 0 0 0 rgb(52 210 123 / 0); } }
.pin { all: unset; position: absolute; top: 0; right: 0; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 50%; cursor: pointer; color: #fff; opacity: .7; }
.pin:hover { opacity: 1; background: rgb(255 255 255 / .1); }
.pin:focus-visible { outline: 2px solid #fff; }
.pin svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.3; }
.pin[aria-pressed="true"] svg { fill: currentColor; }
.nav { display: grid; gap: .25rem; }
.rail .item { display: flex; align-items: center; gap: .7rem; min-height: 2.75rem; padding: .45rem .55rem; border-radius: var(--r-pill); font-size: .88rem; font-weight: 500; color: inherit; text-decoration: none; opacity: .8; white-space: nowrap; }
.rail .item:hover { opacity: 1; background: rgb(255 255 255 / .08); }
.rail .item.on { opacity: 1; font-weight: 600; background: rgb(255 255 255 / .12); }
.rail .item .ico { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .1); }
.rail .item.on .ico { background: var(--orange); }
.rail .item svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.rail-foot { margin-top: auto; padding: .8rem .5rem .1rem; border-top: 1px solid rgb(255 255 255 / .14); display: grid; grid-template-columns: 2rem 1fr; column-gap: .6rem; align-items: center; font-size: .82rem; }
.rail-foot #me-role { font-size: .68rem; opacity: .7; text-transform: uppercase; letter-spacing: .08em; }
.rail-foot .logout { grid-column: 1 / -1; justify-self: start; color: #fff; opacity: .85; font-size: .8rem; margin-top: .3rem; }
.avatar { grid-row: span 2; width: 2rem; height: 2rem; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font: 700 .8rem var(--sans); }

.main { min-width: 0; display: flex; flex-direction: column; }
.appbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .8rem; padding: .8rem 1.25rem; background: var(--grad); color: var(--on-blue); box-shadow: 0 6px 20px rgb(26 95 230 / .25); }
.menu-btn { all: unset; display: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; place-items: center; cursor: pointer; background: rgb(255 255 255 / .15); }
.menu-btn:focus-visible { outline: 2px solid #fff; }
.menu-btn svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.ptitle { font: italic 800 1.25rem/1.1 var(--sans); text-transform: uppercase; letter-spacing: .01em; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clock { font-variant-numeric: tabular-nums; font-size: .82rem; opacity: .95; white-space: nowrap; }
.tv-btn { all: unset; display: none; min-width: 2.75rem; height: 2.2rem; padding: 0 .7rem; border-radius: var(--r-pill); font: 700 .75rem var(--sans); text-align: center; cursor: pointer; background: rgb(255 255 255 / .18); }
.tv-btn[aria-pressed="true"] { background: var(--orange); }
@media (min-width: 1920px) { .tv-btn { display: grid; place-items: center; } }
.seg { display: inline-flex; border-radius: var(--r-pill); background: rgb(255 255 255 / .18); padding: .2rem; }
.seg button { all: unset; min-height: 1.9rem; padding: 0 .8rem; border-radius: var(--r-pill); font: 600 .74rem var(--sans); cursor: pointer; color: #fff; }
.seg button.on { background: #fff; color: var(--blue); }
.seg button:focus-visible { outline: 2px solid #fff; }
.banner { padding: .55rem 1.25rem; font-size: .85rem; font-weight: 600; }
.banner.warn { background: color-mix(in srgb, var(--warn) 18%, var(--surface)); color: var(--warn); }
.page { padding: 1.25rem; display: grid; gap: 1rem; align-content: start; }

/* Laptop and up: unpinned = collapsed icon rail that expands on hover */
@media (min-width: 1024px) {
  .app.unpinned { grid-template-columns: var(--rail-min) minmax(0, 1fr); }
  .app.unpinned .rail { width: var(--rail-min); padding-inline: .45rem; }
  .app.unpinned .rail .txt, .app.unpinned .rail .logo-full, .app.unpinned .rail .pin { display: none; }
  .app.unpinned .rail .logo-icon { display: block; }
  .app.unpinned .rail .item { justify-content: center; padding-inline: 0; }
  .app.unpinned .rail-foot { grid-template-columns: 1fr; justify-items: center; }
  .app.unpinned .rail:hover, .app.unpinned .rail:focus-within { position: fixed; left: 0; width: var(--rail-w); padding-inline: .7rem; box-shadow: 12px 0 30px rgb(0 0 0 / .25); }
  .app.unpinned .rail:hover .txt, .app.unpinned .rail:focus-within .txt, .app.unpinned .rail:hover .logo-full, .app.unpinned .rail:focus-within .logo-full, .app.unpinned .rail:hover .pin, .app.unpinned .rail:focus-within .pin { display: initial; }
  .app.unpinned .rail:hover .logo-icon, .app.unpinned .rail:focus-within .logo-icon { display: none; }
  .app.unpinned .rail:hover .item, .app.unpinned .rail:focus-within .item { justify-content: flex-start; padding-inline: .55rem; }
  .app.unpinned .rail:hover .rail-foot, .app.unpinned .rail:focus-within .rail-foot { grid-template-columns: 2rem 1fr; justify-items: start; }
}
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* Tablet: menu unpinned by default (icon rail), pin opens it over the page */
@media (min-width: 600px) and (max-width: 1023px) {
  .app { grid-template-columns: var(--rail-min) minmax(0, 1fr); }
  .rail { width: var(--rail-min); padding-inline: .45rem; }
  .rail .txt, .rail .logo-full { display: none; }
  .rail .logo-icon { display: block; }
  .rail .item { justify-content: center; padding-inline: 0; }
  .rail .pin { right: auto; left: 50%; transform: translateX(-50%); top: auto; bottom: -.1rem; }
  .rail-foot { grid-template-columns: 1fr; justify-items: center; }
  .app.pinned .rail { position: fixed; left: 0; width: var(--rail-w); padding-inline: .7rem; box-shadow: 12px 0 30px rgb(0 0 0 / .3); }
  .app.pinned .rail .txt, .app.pinned .rail .logo-full { display: initial; }
  .app.pinned .rail .logo-icon { display: none; }
  .app.pinned .rail .item { justify-content: flex-start; padding-inline: .55rem; }
  .app.pinned .rail .pin { left: auto; right: 0; top: 0; bottom: auto; transform: none; }
  .app.pinned .rail-foot { grid-template-columns: 2rem 1fr; justify-items: start; }
  .app.pinned .scrim { display: block; }
}

/* Phone: top bar + drawer; page padding smaller */
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 19; }
@media (max-width: 599px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; top: 0; left: 0; bottom: 0; height: auto; transform: translateX(-105%); transition: transform .2s; width: min(var(--rail-w), 85vw); box-shadow: 12px 0 30px rgb(0 0 0 / .3); }
  .app.drawer-open .rail { transform: none; }
  .rail .pin { display: none; }
  .menu-btn { display: grid; }
  .appbar { padding: .6rem .8rem; gap: .5rem; flex-wrap: wrap; }
  .ptitle { font-size: 1.05rem; }
  .clock { order: 5; flex-basis: 100%; font-size: .74rem; }
  .seg { order: 4; }
  .page { padding: .75rem; gap: .75rem; }
}
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* TV mode: no menu, bigger text */
body.tv { font-size: 1.1rem; }
body.tv .app { grid-template-columns: minmax(0, 1fr); }
body.tv .rail { display: none; }
body.tv .ptitle { font-size: 1.6rem; }

/* ---------- Cards, KPIs ---------- */
.card { background: var(--surface); border-radius: var(--r-card); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); min-width: 0; }
.card h3 { font: italic 800 .9rem var(--sans); text-transform: uppercase; color: var(--blue); margin-bottom: .6rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .8rem; }
.kpi { display: flex; align-items: center; gap: .9rem; background: var(--surface); border-radius: var(--r-card); padding: .9rem 1.1rem; box-shadow: var(--shadow); min-width: 0; }
.kpi-ico { flex: none; width: 2.8rem; height: 2.8rem; border-radius: 50%; background: var(--grad); display: grid; place-items: center; }
.kpi-ico svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.kpi b { display: block; font: 800 1.7rem/1 var(--sans); color: var(--orange); font-variant-numeric: tabular-nums; }
.kpi span { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.bars { display: grid; gap: .5rem; }
.bar { display: grid; grid-template-columns: 7rem minmax(0, 1fr) 3rem; align-items: center; gap: .6rem; font-size: .85rem; }
.bar i { height: .6rem; border-radius: var(--r-pill); background: var(--grad); display: block; min-width: .3rem; }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }
.plan { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; font-size: .85rem; }
.plan b { color: var(--orange); font-style: italic; }
.empty-state { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.empty-state .btn { margin-top: .8rem; }

/* ---------- Toolbar + tables ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; background: var(--surface); border-radius: var(--r-card); padding: .7rem .9rem; box-shadow: var(--shadow); }
.toolbar .count { margin-left: auto; font-size: .8rem; color: var(--muted); }
.table-wrap { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.tbl th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .8rem .9rem; border-bottom: 1px solid var(--rule); background: var(--sunk); white-space: nowrap; }
table.tbl th:first-child { border-top-left-radius: var(--r-card); } table.tbl th:last-child { border-top-right-radius: var(--r-card); }
table.tbl td { padding: .65rem .9rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover td { background: color-mix(in srgb, var(--blue) 5%, var(--surface)); }
table.tbl td.empty { text-align: center; color: var(--muted); padding: 2rem; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.mono { font-family: var(--mono); font-size: .8rem; }
table.tbl td.act { white-space: nowrap; text-align: right; }
table.tbl td.act .btn { margin-left: .3rem; }
table.tbl b.nm { font-weight: 600; }
.more { display: flex; justify-content: center; }
/* Phone: rows become cards */
@media (max-width: 599px) {
  table.tbl thead { display: none; }
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; }
  table.tbl tr { padding: .6rem .9rem; border-bottom: 1px solid var(--rule); }
  table.tbl td { padding: .2rem 0; border: 0; display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .5rem; align-items: center; }
  table.tbl td::before { content: attr(data-label); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  table.tbl td.act { display: flex; justify-content: flex-end; padding-top: .5rem; }
  table.tbl td.act::before { display: none; }
  table.tbl td.empty { display: block; }
  table.tbl td.empty::before { display: none; }
  table.tbl tbody tr:hover td { background: none; }
}

/* ---------- Management ---------- */
.mg-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; background: var(--surface); border-radius: var(--r-card); padding: .7rem .9rem; box-shadow: var(--shadow); }
.mg-head h2 { font: italic 800 1rem var(--sans); text-transform: uppercase; color: var(--blue); margin-right: auto; }
.mg-select { display: none; }
.mg-body { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.mg-nav { display: grid; gap: .3rem; background: var(--surface); border-radius: var(--r-card); padding: .6rem; box-shadow: var(--shadow); }
.mg-item { all: unset; display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2.6rem; padding: .3rem .4rem .3rem .9rem; border-radius: var(--r-pill); font-size: .85rem; font-weight: 500; cursor: pointer; }
.mg-item:hover { background: var(--sunk); }
.mg-item.on { background: var(--grad); color: #fff; font-weight: 600; }
.mg-item:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); }
.mg-count { min-width: 1.7rem; height: 1.7rem; padding: 0 .5rem; border-radius: var(--r-pill); display: grid; place-items: center; font-size: .72rem; font-weight: 700; background: var(--sunk); color: var(--muted); }
.mg-item.on .mg-count { background: var(--orange); color: #fff; }
.mg-main { display: grid; gap: .8rem; min-width: 0; }
.hint { margin: 0; font-size: .82rem; color: var(--muted); }
@media (max-width: 1023px) { .mg-body { grid-template-columns: minmax(0, 1fr); } .mg-nav { display: none; } .mg-select { display: block; } .mg-head h2 { display: none; } }
@media (max-width: 599px) { .mg-head .search { flex: 1 1 100%; width: auto; order: 3; } }

/* ---------- Dialogs ---------- */
.dlg { border: 0; border-radius: var(--r-card); padding: 0; width: min(38rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); background: var(--surface); color: var(--fg); box-shadow: 0 30px 80px rgb(0 0 0 / .35); }
.dlg.sm { width: min(26rem, calc(100vw - 2rem)); }
.dlg::backdrop { background: rgb(14 31 110 / .45); backdrop-filter: blur(2px); }
.dlg form { display: grid; max-height: calc(100dvh - 2rem); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; background: var(--grad); color: #fff; }
.dlg-head h2 { font: italic 800 1rem var(--sans); text-transform: uppercase; }
.dlg-head .x { all: unset; width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 1.4rem; background: rgb(255 255 255 / .18); }
.dlg-head .x:focus-visible { outline: 2px solid #fff; }
.dlg-body { padding: 1rem 1.25rem; overflow-y: auto; display: flex; flex-wrap: wrap; gap: .8rem; }
.dlg .form-error { margin: 0 1.25rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.25rem 1.1rem; }
.f { display: grid; gap: .3rem; flex: 1 1 100%; min-width: 0; }
.f.half { flex: 1 1 calc(50% - .4rem); }
.f.third { flex: 1 1 calc(33.33% - .6rem); }
.f > span { font-size: .78rem; font-weight: 600; }
.f > span small { font-weight: 400; color: var(--muted); }
.f .err { font-size: .76rem; color: var(--down); }
.f.bad input, .f.bad select, .f.bad textarea { border-color: var(--down); }
.f.check { flex-direction: row; display: flex; align-items: center; gap: .6rem; min-height: 2.75rem; }
.f.check span { font-weight: 500; font-size: .85rem; }
.f .chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.f .chips label { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.4rem; padding: 0 .8rem; border-radius: var(--r-pill); border: 1.5px solid var(--line); font-size: .82rem; cursor: pointer; }
.f .chips label:has(input:checked) { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, var(--surface)); }
.f .units { font-size: .76rem; color: var(--muted); }
@media (max-width: 599px) { .f.half, .f.third { flex-basis: 100%; } .dlg-actions { flex-direction: column-reverse; } .dlg-actions .btn { width: 100%; } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 4.5rem; right: 1rem; z-index: 50; display: grid; gap: .5rem; justify-items: end; }
.toast { background: var(--navy); color: #fff; padding: .7rem 1.1rem; border-radius: var(--r-pill); font-size: .85rem; font-weight: 500; box-shadow: var(--shadow); max-width: 24rem; animation: toast-in .2s ease-out; }
.toast.err { background: var(--down); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-.4rem); } to { opacity: 1; transform: none; } }
@media (max-width: 599px) { .toasts { left: .75rem; right: .75rem; top: 6.5rem; justify-items: stretch; } .toast { max-width: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---------- Docs ---------- */
.dc-body { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.dc-nav { display: grid; gap: .5rem; background: var(--surface); border-radius: var(--r-card); padding: .8rem; box-shadow: var(--shadow); position: sticky; top: 4.6rem; }
.dc-nav a { display: block; padding: .3rem .5rem; border-radius: 8px; font-size: .82rem; text-decoration: none; color: var(--fg); }
.dc-nav a.l2 { padding-left: 1.2rem; color: var(--muted); }
.dc-nav a:hover { background: var(--sunk); }
.dc-page { background: var(--surface); border-radius: var(--r-card); padding: 1.5rem 1.75rem; box-shadow: var(--shadow); max-width: 60rem; min-width: 0; line-height: 1.6; }
.dc-page h1 { font: italic 800 1.5rem var(--sans); text-transform: uppercase; color: var(--blue); margin: 0 0 .8rem; }
.dc-page h2 { font: italic 800 1.1rem var(--sans); text-transform: uppercase; margin: 1.6rem 0 .5rem; color: var(--navy); }
:root[data-theme="dark"] .dc-page h2 { color: var(--fg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dc-page h2 { color: var(--fg); } }
.dc-page h3 { font-size: .95rem; margin: 1.2rem 0 .4rem; }
.dc-page p, .dc-page ul, .dc-page ol { margin: .5rem 0; }
.dc-page code { font-family: var(--mono); font-size: .85em; background: var(--sunk); padding: .1em .35em; border-radius: 4px; }
.dc-page pre { background: var(--sunk); padding: .8rem 1rem; border-radius: 12px; overflow-x: auto; font-size: .82rem; }
.dc-page pre code { background: none; padding: 0; }
.dc-page blockquote { margin: .8rem 0; padding: .6rem 1rem; border-left: 4px solid var(--orange); background: var(--sunk); border-radius: 0 12px 12px 0; }
.dc-table { overflow-x: auto; }
.dc-page table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.dc-page th, .dc-page td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.dc-page th { background: var(--sunk); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
@media (max-width: 1023px) { .dc-body { grid-template-columns: minmax(0, 1fr); } .dc-nav { position: static; } #dc-toc { display: none; } }
@media (max-width: 599px) { .dc-page { padding: 1rem; } }

/* ---------- Racks (elevations) ---------- */
.seg-dark { background: var(--sunk); }
.seg-dark button { color: var(--fg); }
.seg-dark button.on { background: var(--grad); color: #fff; }
.rk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; align-items: start; }
.rk-card { display: grid; gap: .6rem; }
.rk-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.rk-head h3 { margin: 0; }
.rk-head .muted { font-size: .78rem; margin-left: auto; }
.rk-svg { width: 100%; height: auto; display: block; font-family: var(--sans); }
.rk-frame { fill: var(--sunk); stroke: var(--line); stroke-width: 1.5; }
.rk-line { stroke: var(--rule); stroke-width: 1; }
.rk-u { font-size: 8px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.rk-dev { cursor: pointer; }
.rk-dev rect { fill: var(--blue); stroke: color-mix(in srgb, var(--blue) 60%, #000); stroke-width: 1; transition: filter .15s; }
.rk-dev.role-core rect { fill: var(--navy); stroke: #000; }
.rk-dev.role-aggregation rect { fill: var(--blue); }
.rk-dev.role-access rect { fill: var(--up); stroke: color-mix(in srgb, var(--up) 60%, #000); }
.rk-dev.role-olt rect { fill: var(--orange); stroke: color-mix(in srgb, var(--orange) 60%, #000); }
.rk-dev.role-other rect { fill: var(--muted); stroke: color-mix(in srgb, var(--muted) 60%, #000); }
.rk-dev.half rect { stroke-dasharray: 4 2; }
.rk-dev:hover rect, .rk-dev:focus-visible rect { filter: brightness(1.15); }
.rk-dev:focus-visible { outline: none; }
.rk-dev:focus-visible rect { stroke: var(--orange); stroke-width: 2; }
.rk-name { font-size: 9px; font-weight: 600; fill: #fff; pointer-events: none; }
.rk-units { font-size: 7.5px; fill: rgb(255 255 255 / .85); pointer-events: none; font-variant-numeric: tabular-nums; }
.rk-off { fill: var(--warn); stroke: #fff; stroke-width: 1; }
.rk-unplaced { margin: 0; font-size: .78rem; color: var(--muted); }
@media (max-width: 599px) { .rk-grid { grid-template-columns: minmax(0, 1fr); } .toolbar .count { flex-basis: 100%; margin-left: 0; } }
@media (min-width: 1920px) { .rk-grid { grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .rk-dev rect { transition: none; } }

/* ---------- Device details window ---------- */
.dlg.wide { width: min(56rem, calc(100vw - 2rem)); }
.dlg-head h2 .pill { margin-left: .5rem; vertical-align: middle; background: rgb(255 255 255 / .2); color: #fff; border-color: transparent; }
.dev-body { flex-direction: column; flex-wrap: nowrap; gap: .8rem; }
.dev-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .5rem 1rem; }
.dev-row { display: grid; gap: .1rem; min-width: 0; }
.dev-row.wide { grid-column: 1 / -1; }
.dev-row span { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dev-row b { font-weight: 600; overflow-wrap: anywhere; }
.dev-h { font: italic 800 .85rem var(--sans); text-transform: uppercase; color: var(--blue); margin-top: .4rem; }
.table-wrap.plain { box-shadow: none; border: 1px solid var(--rule); }
table.tbl tr.click { cursor: pointer; }
table.tbl tr.click:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: -3px; }
.mg-head #mg-device { max-width: 18rem; }
.f.full { flex-basis: 100%; }
.f .sub { font-size: .76rem; color: var(--muted); }
