/* NexOLT Web, in the look of openispbd.com: an off-white ground, near-black
   type in Inter, NexOLT's green kept for what is live or acts, round buttons.
   A bar along the top with the app's places; an OLT's own pages are tabs
   under its name. On a phone, a top bar and a bottom navigation bar. */

/* --- Tokens ------------------------------------------------------------- */
:root {
  --accent: #3b6600;            /* green as text and lines: links, focus, the on-state */
  --accent-fill: #76b900;       /* green as a fill, with ink on it */
  --accent-pressed: #8acf10;
  --on-accent: #0e100c;
  --bg: #f6f7f3;
  --surface: #ffffff;
  --raised: #eceee8;
  --divider: #e1e5db;
  --text: #0e100c;
  --text2: #545950;
  --online: #2f7d18;
  --offline: #c42b1c;
  --amber: #d97a0b;
  --online-ink: #24660f;
  --offline-ink: #a3200f;
  --amber-ink: #8a4c00;
  --sig-excellent: #2f7d18;
  --sig-good: #6c9a1d;
  --sig-warning: #d97a0b;
  --sig-critical: #c42b1c;
  --scrim: rgba(14, 16, 12, .4);
  --shadow: none;
  --shadow-pop: 0 24px 64px rgba(14, 16, 12, .18);

  --toolbar: 44px;
  --r-row: 12px; --r-card: 18px; --r-pop: 22px; --r-pill: 999px; --r-ctl: 12px; --r-tag: 6px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --appbar: 64px;
  --gutter: clamp(16px, 2.4vw, 32px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #9bd63a; --accent-fill: #76b900; --accent-pressed: #8acf10; --on-accent: #0e100c;
    --bg: #0e100c; --surface: #171a14; --raised: #22261e; --divider: #2c3127;
    --text: #eef0ea; --text2: #a2a89b; --online: #6fcf4f; --offline: #ef6a5a; --amber: #f0a43a;
    --online-ink: #8ee06f; --offline-ink: #ff8a7a; --amber-ink: #ffc06a;
    --sig-excellent: #6fcf4f; --sig-good: #b4dc5a; --sig-warning: #f0a43a; --sig-critical: #ef6a5a;
    --scrim: rgba(0, 0, 0, .6); --shadow-pop: 0 24px 64px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #9bd63a; --accent-fill: #76b900; --accent-pressed: #8acf10; --on-accent: #0e100c;
  --bg: #0e100c; --surface: #171a14; --raised: #22261e; --divider: #2c3127;
  --text: #eef0ea; --text2: #a2a89b; --online: #6fcf4f; --offline: #ef6a5a; --amber: #f0a43a;
  --online-ink: #8ee06f; --offline-ink: #ff8a7a; --amber-ink: #ffc06a;
  --sig-excellent: #6fcf4f; --sig-good: #b4dc5a; --sig-warning: #f0a43a; --sig-critical: #ef6a5a;
  --scrim: rgba(0, 0, 0, .6); --shadow-pop: 0 24px 64px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* --- Base --------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-size: 28px; font-weight: 600; margin: 0; letter-spacing: -.03em; line-height: 1.15; text-wrap: balance; }
h2 { letter-spacing: -.02em; }
a, button, select, label, .row { touch-action: manipulation; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.ic { display: block; flex: none; }
.muted, .secondary { color: var(--text2); font-size: 14px; }
::selection { background: var(--accent-fill); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

@view-transition { navigation: auto; }
.appbar { view-transition-name: appbar; }
.tabbar { view-transition-name: tabbar; }
::view-transition-old(root) { animation: fade-out .11s var(--ease) both; }
::view-transition-new(root) { animation: none; }
::view-transition-group(appbar), ::view-transition-group(tabbar) { animation-duration: 0s; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* --- Shell: one bar along the top --------------------------------------- */
.has-shell { min-height: 100%; }
.appbar {
  position: sticky; top: 0; z-index: 20; height: var(--appbar);
  display: flex; align-items: center; gap: 28px; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  border-bottom: 1px solid var(--divider);
}
.app-id { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); flex: none; }
.app-logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: var(--raised); color: var(--text2); font-weight: 700; font-size: 12px; overflow: hidden;
}
.app-logo.img { background: #fff; }
.app-logo img { width: 100%; height: 100%; object-fit: contain; }
.app-text { display: flex; flex-direction: column; min-width: 0; }
.app-text .t { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.03em; }
.app-text .s { display: none; }
.topnav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.topnav a {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px;
  color: var(--text2); font-size: 14px; font-weight: 500; white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease);
}
.topnav a:hover { color: var(--text); background: var(--raised); }
.topnav a.on { color: var(--text); background: var(--raised); font-weight: 600; }
.topnav .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--offline); color: #fff; font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }
.appbar-end { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; border: 0; background: transparent; color: var(--text2);
  display: grid; place-items: center; flex: none; transition: background-color .15s var(--ease), color .15s var(--ease), transform .09s;
}
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.avatar {
  width: 36px; height: 36px; border-radius: 18px; border: 0; margin-left: 4px;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 14px; transition: box-shadow .15s var(--ease);
}
.avatar:hover, .avatar[aria-expanded="true"] { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-fill) 45%, transparent); }

.usermenu { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 240px; padding: 6px;
  background: var(--surface); border: 1px solid var(--divider); border-radius: 16px; box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-4px) scale(.97); transform-origin: top right; pointer-events: none;
  transition: opacity .14s var(--ease), transform .14s var(--ease); z-index: 40;
}
.menu.open { opacity: 1; transform: none; pointer-events: auto; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--divider); margin-bottom: 6px; }
.menu-head .t { font-weight: 600; }
.menu-head .s { font-size: 13px; color: var(--text2); }
.menu form { margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); text-align: left; transition: background-color .12s var(--ease);
}
.menu-item:hover { background: var(--raised); }
.menu-item .ic { color: var(--text2); }
.menu-item.danger, .menu-item.danger .ic { color: var(--offline); }

/* An OLT's own pages: its name, then its tabs, under the bar. */
.ctx { display: flex; align-items: center; gap: 14px; padding: 18px var(--gutter) 0; flex-wrap: wrap; }
.ctx .app-logo { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--divider); }
.ctx .who { min-width: 0; flex: 1; }
.ctx .who .t { font-size: 24px; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; overflow-wrap: anywhere; }
.ctx .who .s { font-size: 14px; color: var(--text2); }
.ctx .crumb { font-size: 13px; color: var(--text2); display: inline-flex; align-items: center; gap: 4px; }
.ctx .crumb:hover { color: var(--text); }
.ctx-tabs { display: flex; gap: 4px; padding: 14px var(--gutter) 4px; overflow-x: auto; scrollbar-width: none; }
.ctx-tabs a {
  height: 38px; padding: 0 16px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px;
  color: var(--text2); font-size: 14px; font-weight: 500; white-space: nowrap; background: var(--raised); transition: background-color .15s, color .15s;
}
.ctx-tabs a:hover { color: var(--text); }
.ctx-tabs a.on { background: var(--text); color: var(--bg); }

.frame { display: block; min-height: calc(100vh - var(--appbar)); }
.stage { display: block; }
.page { animation: page-in .26s .07s var(--ease) backwards; padding: 8px calc(var(--gutter) - 16px) 64px; max-width: 1600px; margin: 0 auto; }
.page.narrow { max-width: 860px; margin: 0 auto; padding: 8px 16px 64px; }

.tabbar { display: none; }

/* --- Phone shell -------------------------------------------------------- */
@media (max-width: 899px) {
  :root { --appbar: 58px; --toolbar: 44px; }
  .topnav { display: none; }
  .appbar { gap: 10px; padding: 0 8px 0 14px; }
  .app-logo { width: 32px; height: 32px; }
  .ctx { padding: 12px 14px 0; }
  .ctx .who .t { font-size: 20px; }
  .ctx-tabs { padding: 12px 12px 2px; }
  .page { padding: 4px 0 calc(96px + env(safe-area-inset-bottom)); }
  .page.narrow { padding: 4px 12px calc(170px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    height: calc(70px + env(safe-area-inset-bottom)); align-items: flex-start;
    padding: 8px 8px env(safe-area-inset-bottom); background: var(--surface);
    border-top: 1px solid var(--divider);
  }
  .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0;
    color: var(--text2); font-size: 12px; font-weight: 500; min-width: 0; position: relative;
  }
  .tab-ic { width: 56px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background-color .2s var(--ease), color .2s var(--ease); }
  .tab-item.on { color: var(--text); }
  .tab-item.on .tab-ic { background: var(--text); color: var(--bg); }
  .tab-label { white-space: nowrap; }
  .tab-item .badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--offline); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
}

/* --- Toolbar (DESIGN.md §2) -------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 16px 16px 12px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar .group { display: flex; align-items: center; gap: 8px; }
.page-title { display: flex; align-items: baseline; gap: 10px; padding: 18px 16px 0; }
.page-title .muted { font-size: 14px; }
@media (max-width: 1079px) {
  .toolbar .group.tools { width: 100%; }
  .toolbar .group.tools .searchbox { flex: 1; width: auto; }
}

.pill {
  height: var(--toolbar); padding: 0 16px; border-radius: var(--r-pill); border: 0;
  background: var(--raised); color: var(--text); font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; position: relative; flex: none;
  transition: background-color .18s var(--ease), color .18s var(--ease), transform .09s var(--ease);
}
.pill:hover { background: var(--divider); }
.pill:active { transform: scale(.95); }
.pill.on { background: var(--text); color: var(--bg); }
.pill.on:hover { background: color-mix(in srgb, var(--text) 85%, var(--bg)); }
.pill.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.pill .ic { margin-left: -2px; }
.count { display: inline-grid; overflow: hidden; height: 20px; line-height: 20px; font-weight: 600; min-width: .6em; }
.count > span { grid-area: 1 / 1; transition: transform .4s var(--ease), opacity .4s var(--ease); }
.count > span.leaving { transform: translateY(-100%); opacity: 0; }
.count > span.coming { transform: translateY(100%); opacity: 0; }
.pill .dot-red {
  position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 4px;
  background: var(--offline); box-shadow: 0 0 0 2px var(--raised); transform: scale(0); transition: transform .18s var(--ease);
}
.pill.active-filter .dot-red { transform: scale(1); }

.searchbox { position: relative; width: 240px; flex: none; }
.searchbox .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text2); pointer-events: none; }
.search, .field, .picker {
  height: var(--toolbar); width: 100%; border-radius: var(--r-ctl); border: 1px solid var(--divider);
  background: var(--surface); color: var(--text); padding: 0 12px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.searchbox .search { padding-left: 40px; }
.search::placeholder, .field::placeholder { color: var(--text2); opacity: .8; }
.search:focus, .field:focus, .picker:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.picker, select.field {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.picker { width: 160px; flex: none; }

.btn {
  height: var(--toolbar); padding: 0 20px; border-radius: 999px; border: 0; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; flex: none;
  transition: background-color .15s var(--ease), opacity .15s var(--ease), transform .09s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.accent { background: var(--text); color: var(--bg); }
.btn.accent:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 85%, var(--bg)); }
.btn.raised { background: var(--raised); color: var(--text); }
.btn.raised:hover:not(:disabled) { background: var(--divider); }
.btn.danger-soft { background: color-mix(in srgb, var(--offline) 14%, transparent); color: var(--offline-ink); }
.btn.danger-soft:hover { background: var(--offline); color: #fff; }
.btn.sm { height: 36px; padding: 0 14px; }
.btn.wide { width: 100%; height: 44px; }

/* Phone: icon buttons, the search pill that opens out of its icon */
.only-phone { display: none !important; }
@media (max-width: 899px) {
  .only-phone { display: inline-grid !important; }
  .only-wide { display: none !important; }
  .toolbar { padding: 12px 12px 10px; gap: 8px; }
  .icon-btn.outlined { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--divider); color: var(--text); }
  .icon-btn.tonal { width: 44px; height: 44px; border-radius: 22px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); position: relative; }
  .icon-btn.tonal .dot-red { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 4px; background: var(--offline); transform: scale(0); transition: transform .18s var(--ease); }
  .icon-btn.tonal.active-filter .dot-red { transform: scale(1); }
  .picker { width: auto; flex: 1; min-width: 0; height: 44px; border-radius: 22px; padding-left: 16px; }
  .phone-search {
    position: absolute; inset: 8px 12px auto 12px; height: 52px; border-radius: 26px; z-index: 5;
    display: flex !important; align-items: center; gap: 4px; padding: 0 6px 0 16px; background: var(--surface); border: 1px solid var(--divider); box-shadow: var(--shadow);
    clip-path: circle(0 at calc(100% - 26px) 26px); transition: clip-path .25s var(--ease); pointer-events: none;
  }
  .phone-search.open { clip-path: circle(150% at calc(100% - 26px) 26px); transition-duration: .35s; pointer-events: auto; }
  .phone-search input { flex: 1; border: 0; background: transparent; color: var(--text); height: 100%; outline: none; font-size: 15px; min-width: 0; }
  .phone-search input::placeholder { color: var(--text2); }
  .phone-search:focus-within { border-color: var(--accent); }
  .toolbar.searching > *:not(.phone-search) { opacity: 0; transition: opacity .15s; }
  .chips { gap: 8px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: none; }
  .chips .pill { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 10px; background: var(--surface); border: 1px solid var(--divider); }
  .chips .pill.on { background: var(--text); color: var(--bg); border-color: var(--text); }
}
.toolbar-wrap { position: relative; }
.phone-search { display: none; }
.chips { display: none; }
@media (max-width: 899px) { .chips { display: flex; } .only-wide-inline { display: none; } }
.toolbar h1 { padding-right: 4px; }
.page-switch { animation: page-in .24s .07s var(--ease) backwards; }
.pick-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 8px; height: 8px; border-radius: 4px; flex: none; }
.pill.on .swatch { box-shadow: 0 0 0 2px color-mix(in srgb, var(--on-accent) 70%, transparent); }

/* --- Phases ------------------------------------------------------------- */
.phase { animation: fade-in .22s var(--ease) both; }
.state-msg { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 72px 24px; color: var(--text2); }
.state-msg .ic { color: var(--text2); opacity: .7; }
.state-msg.error { color: var(--offline); }
.state-msg.error .ic { color: var(--offline); opacity: 1; }
.state-msg .t { font-size: 15px; font-weight: 500; color: var(--text); }
.state-msg.error .t { color: var(--offline); }
.cascade > * { animation: rise .3s var(--ease-out) backwards; }

/* --- Rows (OnuRow) ------------------------------------------------------ */
.rows { display: flex; flex-direction: column; gap: 6px; padding: 0 16px; }
.row {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 16px 10px 12px; border-radius: var(--r-row);
  background: var(--surface); color: var(--text); cursor: pointer; transition: background-color .15s var(--ease);
}
.row:hover { background: var(--raised); }
.row:focus-visible { outline-offset: 1px; }
/* A long list lays out only the rows on screen; each keeps its last real height. */
.rows[data-list] > .row { content-visibility: auto; contain-intrinsic-size: auto 64px; }
@media (max-width: 899px) { .rows[data-list] > .row { contain-intrinsic-size: auto 132px; } }
.row.down { background: color-mix(in srgb, var(--offline) 7%, var(--surface)); }
.row.down:hover { background: color-mix(in srgb, var(--offline) 7%, var(--raised)); }
.mark {
  width: 44px; height: 44px; border-radius: 10px; flex: none; position: relative;
  background: var(--raised); color: var(--text2); display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.mark.img { background: #fff; box-shadow: inset 0 0 0 1px var(--divider); padding: 3px; }
.mark.img img { border-radius: 7px; }
.mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.mark .status {
  position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 6px;
  box-shadow: 0 0 0 2px var(--surface); background: var(--text2); transition: box-shadow .15s var(--ease);
}
.row:hover .mark .status { box-shadow: 0 0 0 2px var(--raised); }
.row.down .mark .status { box-shadow: 0 0 0 2px color-mix(in srgb, var(--offline) 7%, var(--surface)); }
.mark .status.up { background: var(--online); }
.mark .status.down { background: var(--offline); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title .none { color: var(--text2); font-weight: 400; }
.row-sub { font-size: 13px; color: var(--text2); display: flex; gap: 8px; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; }
.row-sub .txt { overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 12px; line-height: 18px; padding: 0 6px; border-radius: var(--r-tag); font-weight: 500; flex: none; }
.tag.bad { color: var(--offline-ink); background: color-mix(in srgb, var(--offline) 16%, transparent); }
.tag.warn { color: var(--amber-ink); background: color-mix(in srgb, var(--amber) 16%, transparent); }
.tag.plain { color: var(--text2); background: color-mix(in srgb, var(--text2) 14%, transparent); }
.tag.ok { color: var(--online-ink); background: color-mix(in srgb, var(--online) 14%, transparent); }
.reading { width: 96px; text-align: right; flex: none; }
.reading .v { font-size: 15px; white-space: nowrap; }
.reading .l { font-size: 13px; color: var(--text2); }
.row .chev { color: var(--text2); opacity: 0; transition: opacity .15s, transform .15s var(--ease); }
.row:hover .chev { opacity: 1; transform: translateX(2px); }

/* Phone: the ONU card (item_onu.xml) - 16dp corners, a 1dp stroke, the
   middle divider grey when up and red when down. */
@media (max-width: 899px) {
  .rows { padding: 0 10px; gap: 8px; }
  .row.onu {
    display: grid; grid-template-columns: 48px 1fr auto; grid-template-areas: "mark main status" "line line line" "meta meta meta";
    gap: 10px 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--divider); min-height: 0;
  }
  .row.onu .mark { grid-area: mark; width: 48px; height: 48px; }
  .row.onu .row-main { grid-area: main; justify-content: center; }
  .row.onu .row-title { font-size: 16px; }
  .row.onu .row-sub { font-size: 12px; }
  .row.onu .st { grid-area: status; font-size: 12px; font-weight: 600; align-self: start; padding-top: 2px; }
  .row.onu .st.up { color: var(--online-ink); } .row.onu .st.down { color: var(--offline-ink); }
  .row.onu .line { grid-area: line; height: 1px; background: var(--divider); }
  .row.onu.down .line { background: color-mix(in srgb, var(--offline) 55%, transparent); }
  .row.onu .meta { grid-area: meta; display: flex; gap: 12px; font-size: 12px; color: var(--text2); align-items: center; min-width: 0; }
  .row.onu .meta b { font-weight: 500; color: var(--text); }
  .row.onu .meta .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .row.onu .reading, .row.onu .chev { display: none; }
  .row.onu:hover { background: var(--surface); }
  .row.onu.down:hover { background: color-mix(in srgb, var(--offline) 7%, var(--surface)); }
  .row.onu:active { transform: scale(.99); }
}
@media (min-width: 900px) { .row.onu .st, .row.onu .line, .row.onu .meta { display: none; } }

/* --- Skeleton ----------------------------------------------------------- */
.skel { display: block; background: var(--raised); border-radius: 4px; position: relative; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--divider) 85%, transparent), transparent);
  transform: translateX(-100%); animation: crest 1.4s ease-in-out infinite;
}
@keyframes crest { to { transform: translateX(100%); } }
.row.skeleton { cursor: default; }
.row.skeleton:hover { background: var(--surface); }
.row.skeleton .mark { background: var(--raised); }

/* --- Cards (PortCard) --------------------------------------------------- */
.cards { display: grid; gap: 10px; padding: 0 16px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card { background: var(--surface); border-radius: var(--r-card); padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 22px; }
.card-head .dot { width: 10px; height: 10px; border-radius: 5px; background: var(--text2); flex: none; }
.card-head .dot.up { background: var(--online); } .card-head .dot.down { background: var(--offline); } .card-head .dot.idle { background: var(--amber); }
.card-head .name { font-weight: 600; font-size: 15px; }
.card-head .st { margin-left: auto; font-weight: 500; font-size: 13px; }
.card-head .st.up { color: var(--online-ink); } .card-head .st.down { color: var(--offline-ink); } .card-head .st.idle { color: var(--amber-ink); }
.card .desc { color: var(--text2); font-size: 13px; margin: -8px 0 14px; }
.readings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; }
.readings .v { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readings .l { font-size: 13px; color: var(--text2); }
.card .warn { margin-top: 14px; font-size: 13px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.card .warn.bad { color: var(--offline-ink); } .card .warn.amber { color: var(--amber-ink); }
@media (max-width: 899px) {
  .cards { padding: 0 10px; gap: 8px; grid-template-columns: 1fr; }
  .card { border-radius: 16px; border: 1px solid var(--divider); padding: 16px; }
}

/* --- Panels, tiles ------------------------------------------------------ */
.panels { display: grid; gap: 10px; padding: 0 16px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); align-items: start; }
.panel { background: var(--surface); border-radius: var(--r-card); padding: 16px 18px; }
.panel h2, .panel h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.drow { display: flex; gap: 12px; padding: 6px 0; border-top: 1px solid color-mix(in srgb, var(--divider) 55%, transparent); }
.panel h2 + .drow, .panel h3 + .drow { border-top: 0; }
.drow .l { color: var(--text2); width: 40%; flex: none; font-size: 13px; padding-top: 1px; }
.drow .v { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; padding: 0 16px 10px; }
.tile { background: var(--surface); border-radius: var(--r-card); padding: 16px 18px; }
.tile .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.tile .l { color: var(--text2); font-size: 13px; margin-top: 2px; }
.tile .v.up { color: var(--online); } .tile .v.down { color: var(--offline); }
@media (max-width: 899px) {
  .panels { padding: 0 10px; gap: 8px; grid-template-columns: 1fr; }
  .panel { border-radius: 16px; border: 1px solid var(--divider); }
  .tiles { padding: 0 10px 8px; gap: 8px; grid-template-columns: 1fr 1fr; }
  .tile { border-radius: 16px; border: 1px solid var(--divider); padding: 14px 16px; }
  .tile .v { font-size: 22px; }
}

/* --- Popup (ModalHost) and the phone's sheet ---------------------------- */
.modal-host {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: var(--scrim); opacity: 0; transition: opacity .18s var(--ease);
}
.modal-host.open { opacity: 1; }
.modal-host.closing { opacity: 0; transition-duration: .13s; }
.modal {
  background: var(--bg); border-radius: var(--r-pop); width: 580px; max-width: 100%; height: 92vh;
  display: flex; flex-direction: column; padding: 20px; box-shadow: var(--shadow-pop);
  transform: scale(.94); transition: transform .18s var(--ease-out);
}
.modal.small { width: 460px; height: auto; max-height: 92vh; }
.modal.filters { width: 520px; height: auto; max-height: 92vh; }
.modal-host.open .modal { transform: none; }
.modal-host.closing .modal { transform: scale(.94); transition-duration: .13s; }
.modal .grip { display: none; }
.modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.modal-head .mark { width: 52px; height: 52px; }
.modal-head .mark .status { box-shadow: 0 0 0 2px var(--bg); }
.modal-head .t { font-size: 20px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; letter-spacing: -.01em; }
.modal-head .id { color: var(--text2); font-size: 13px; }
.status-pill { margin-left: auto; padding: 5px 12px; border-radius: 14px; font-weight: 600; font-size: 13px; color: var(--on-accent); background: var(--text2); flex: none; }
.status-pill.up { background: var(--online); } .status-pill.down { background: var(--offline); }
.modal-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.modal-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.modal-title { margin-bottom: 16px; }
.modal-foot { margin-top: 14px; display: flex; gap: 8px; justify-content: flex-end; }
.bar { height: 2px; margin: -6px 0 8px; overflow: hidden; border-radius: 1px; }
.bar.on::after { content: ""; display: block; height: 100%; width: 35%; background: var(--accent-fill); animation: barslide 1.1s ease-in-out infinite; }
@keyframes barslide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.tab-in { animation: rise .24s .04s var(--ease) both; }

@media (max-width: 899px) {
  .modal-host { place-items: end stretch; padding: 0; }
  .modal, .modal.small, .modal.filters {
    width: 100%; height: auto; max-height: 92vh; border-radius: 28px 28px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(100%); transition: transform .3s var(--ease-out);
  }
  .modal.tall { height: 92vh; }
  .modal-host.closing .modal { transform: translateY(100%); transition-duration: .2s; }
  .modal .grip { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--divider); margin: 4px auto 14px; flex: none; }
  .modal-body .panel { border: 0; }
}

/* --- Forms -------------------------------------------------------------- */
.page-head { display: flex; align-items: center; gap: 12px; padding: 18px 0 14px; }
.page-head .back { margin-left: -8px; }
.page-head .sub { color: var(--text2); font-size: 14px; margin-top: 2px; }
.section { background: var(--surface); border-radius: var(--r-card); padding: 20px; }
.section + .section { margin-top: 10px; }
.section h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -.02em; color: var(--text); }
.section .lead { margin: 0 0 16px; color: var(--text2); font-size: 13px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fields .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text2); font-weight: 500; }
.field { height: 44px; font-size: 14px; }
.hint { font-size: 13px; color: var(--text2); margin: 12px 0 0; line-height: 1.5; }
.checks { display: flex; flex-direction: column; margin: 0 -8px; }
.check { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; color: var(--text); cursor: pointer; transition: background-color .12s var(--ease); }
.check:hover { background: var(--raised); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.check .muted { margin-left: auto; }
.switch-row { display: flex; align-items: center; gap: 12px; padding-top: 14px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; align-items: center; }
.actions .left { margin-right: auto; }
.note { font-size: 13px; font-weight: 500; margin: 14px 0 0; display: flex; gap: 8px; align-items: center; }
.note.ok { color: var(--online-ink); } .note.bad { color: var(--offline-ink); }
.reveal { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .22s var(--ease), opacity .22s var(--ease); }
.reveal > * { overflow: hidden; min-height: 0; }
.reveal.gone { grid-template-rows: 0fr; opacity: 0; }
.reveal.gone > * { visibility: hidden; }
@media (max-width: 899px) {
  .fields { grid-template-columns: 1fr; }
  .section { border-radius: 16px; border: 1px solid var(--divider); padding: 18px 16px; }
  .page-head { padding: 10px 0 12px; }
  .actions.sticky {
    position: fixed; left: 0; right: 0; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 15; margin: 0;
    padding: 10px 12px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--divider);
  }
  .actions.sticky .btn { flex: 1; }
  .actions.sticky .left { flex: none; margin-right: 0; }
}

/* --- OLT list ----------------------------------------------------------- */
.olt-grid { display: grid; gap: 10px; padding: 0 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.olt-card {
  display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: var(--r-card); background: var(--surface); color: var(--text);
  transition: background-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.olt-card:hover { background: var(--raised); }
.olt-card:active { transform: scale(.99); }
.olt-card .top { display: flex; gap: 14px; align-items: center; min-width: 0; }
.olt-card .mark { width: 56px; height: 56px; border-radius: 12px; }
.olt-card .name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.olt-card .kind { font-size: 13px; color: var(--text2); }
.olt-card .chev { margin-left: auto; color: var(--text2); transition: transform .15s var(--ease); }
.olt-card:hover .chev { transform: translateX(3px); color: var(--text); }
.olt-card .facts { display: flex; gap: 8px; flex-wrap: wrap; }
.fact { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); background: var(--bg); border-radius: 6px; padding: 4px 8px; max-width: 100%; }
.olt-card:hover .fact { background: var(--surface); }
.fact .ic { width: 14px; height: 14px; }
@media (max-width: 899px) {
  .olt-grid { padding: 0 10px; gap: 8px; grid-template-columns: 1fr; }
  .olt-card { border-radius: 16px; border: 1px solid var(--divider); }
  .olt-card:hover { background: var(--surface); }
}

/* --- Sign-in ------------------------------------------------------------ */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin .box { width: 400px; max-width: 100%; background: var(--surface); border-radius: 16px; padding: 32px 28px 28px; box-shadow: var(--shadow); animation: page-in .3s var(--ease) both; }
.signin .head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 24px; }
.signin .head img { width: 64px; height: 64px; border-radius: 16px; }
.signin .head .t { font-size: 20px; font-weight: 600; }
.signin .head .s { color: var(--text2); font-size: 14px; }
.signin label.f { margin-bottom: 14px; }
.signin .foot { text-align: center; color: var(--text2); font-size: 12px; margin-top: 20px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- Small pieces ------------------------------------------------------- */
@media (min-width: 900px) { .appbar .back { display: none; } }
.only-phone-block { display: none; }
@media (max-width: 899px) { .only-phone-block { display: block; } }
.mark.avatar-mark { border-radius: 22px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); font-size: 16px; }
.mark.avatar-mark.big { width: 56px; height: 56px; border-radius: 28px; font-size: 22px; }
.mark.icon-mark { color: var(--text2); }
.row.static { cursor: default; }
.row.static:hover { background: var(--surface); }
.section + .reveal > div > .section:first-child, .reveal + .section { margin-top: 10px; }
.bare .page.narrow { padding-top: 24px; }
@media (max-width: 899px) {
  /* Every list on the phone is cards, as the ONU list is. */
  .rows .row { border-radius: 16px; border: 1px solid var(--divider); padding: 12px 14px; }
  .rows .row .chev { display: none; }
  .row .reading { width: auto; min-width: 64px; }
}

/* --- ONU actions (edit description, reboot, delete) --------------------- */
.row .acts { display: flex; gap: 4px; flex: none; margin-left: 4px; }
.act {
  height: 36px; min-width: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--text2); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), transform .09s var(--ease);
}
.act span { display: none; }
.act:hover { background: var(--surface); color: var(--text); border-color: var(--divider); }
.row.down .act:hover { background: var(--surface); }
.act.danger:hover { color: var(--offline); border-color: color-mix(in srgb, var(--offline) 40%, transparent); background: color-mix(in srgb, var(--offline) 8%, var(--surface)); }
.act:active { transform: scale(.94); }
@media (max-width: 899px) {
  .row.onu.has-acts { grid-template-areas: "mark main status" "line line line" "meta meta meta" "acts acts acts"; }
  .row.onu .acts { grid-area: acts; display: flex; gap: 8px; margin: 2px 0 0; }
  .row.onu .acts .act { flex: 1; justify-content: center; height: 38px; border: 1px solid var(--divider); border-radius: 19px; background: var(--surface); color: var(--text); }
  .row.onu .acts .act span { display: inline; }
  .row.onu .acts .act.danger { color: var(--offline-ink); border-color: color-mix(in srgb, var(--offline) 35%, var(--divider)); }
  .row.onu.down .acts .act { background: color-mix(in srgb, var(--offline) 4%, var(--surface)); }
}
.row.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); } }
.row.leaving { opacity: 0; transform: translateX(16px); margin-top: -6px; padding-top: 0; padding-bottom: 0; overflow: hidden;
  transition: opacity .2s var(--ease), transform .2s var(--ease), height .24s var(--ease), margin .24s var(--ease), padding .24s var(--ease); }

.btn.danger { background: var(--offline); color: #fff; }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--offline) 85%, #000); }
.modal.small .lead { color: var(--text2); margin: -8px 0 16px; line-height: 1.5; }
.modal.small label.f { margin-bottom: 4px; }
.counter { font-size: 12px; color: var(--text2); text-align: right; margin-top: 6px; }
.act-row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; margin: 0 -6px; width: calc(100% + 12px);
  border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; transition: background-color .12s var(--ease);
}
.act-row:hover { background: var(--raised); }
.act-row > span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.act-row .muted { font-size: 13px; }
.act-row > .ic { color: var(--text2); }
.act-row.danger > .ic:first-child, .act-row.danger b { color: var(--offline-ink); }
.tab-slide { animation: tabIn .22s .04s var(--ease) backwards; }
@keyframes tabIn { from { opacity: 0; transform: translateX(var(--from, 8%)); } }

/* --- All ONUs: progress, OLTs that could not be read, the long tail ------ */
.progress { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 0; overflow: hidden; transition: height .2s var(--ease); }
.progress.on { height: 26px; }
.progress .bar { width: 120px; margin: 0; height: 3px; background: var(--raised); flex: none; }
.problems { display: flex; flex-direction: column; gap: 6px; padding: 0 16px 10px; }
.problem {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: var(--r-row); animation: rise .25s var(--ease) backwards;
  background: color-mix(in srgb, var(--offline) 8%, var(--surface)); color: var(--text); font-size: 13px;
}
.problem > .ic { color: var(--offline); }
.problem > span { flex: 1; min-width: 0; }
.more-box { display: flex; justify-content: center; padding: 14px; }
@media (max-width: 899px) {
  .progress, .problems { padding-left: 12px; padding-right: 12px; }
  .problem { border-radius: 14px; }
}
@media (min-width: 900px) {
  /* The same width whichever two actions a row has, so the columns line up. */
  .row .acts { width: 76px; justify-content: flex-end; }
}

/* --- 2.0: reading state, linked tiles, export, OLT health --------------- */
/* The line under the toolbar that moves while the OLT is being read. */
.readbar { height: 2px; margin: -2px 16px 0; overflow: hidden; border-radius: 1px; }
.readbar.on::after { content: ""; display: block; height: 100%; width: 30%; background: var(--accent-fill); animation: barslide 1.1s ease-in-out infinite; }
.stale {
  display: flex; align-items: center; gap: 8px; margin: 8px 16px 2px; padding: 8px 12px; border-radius: var(--r-row);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface)); color: var(--text2); font-size: 13px; animation: fade-in .2s var(--ease) both;
}
.stale .ic { color: var(--accent); animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#note .problem { margin: 8px 16px 2px; }
#note:empty { display: none; }
.toolbar .fresh { font-size: 13px; white-space: nowrap; }
.toolbar .spacer .fresh { display: block; text-align: right; padding-right: 4px; }

.tile.link { display: block; color: var(--text); transition: background-color .15s var(--ease), transform .09s var(--ease); }
.tile.link:hover { background: var(--raised); }
.tile.link:active { transform: scale(.98); }
.tile .l { display: flex; align-items: center; gap: 2px; }
.tile.link .l .ic { opacity: .55; transition: transform .15s var(--ease), opacity .15s var(--ease); }
.tile.link:hover .l .ic { opacity: 1; transform: translateX(2px); }

.icon-btn.boxed { width: var(--toolbar); height: var(--toolbar); border-radius: var(--r-ctl); background: var(--raised); color: var(--text); }
.icon-btn.boxed:hover { background: var(--divider); }

/* OLT list: how each one stood when it was last read. */
.summary { padding: 0 16px 10px; }
.summary .tiles { padding: 0; }
.summary .caption { font-size: 12px; color: var(--text2); margin: 8px 6px 4px; }
.olt-card .health { display: flex; flex-direction: column; gap: 8px; }
.olt-card .counts { display: flex; align-items: baseline; gap: 14px; font-size: 13px; color: var(--text2); flex-wrap: wrap; }
.olt-card .counts b { font-size: 20px; font-weight: 600; color: var(--text); letter-spacing: -.01em; margin-right: 4px; }
.olt-card .counts .up b { color: var(--online); }
.olt-card .counts .down b { color: var(--offline); }
.split { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--raised); gap: 2px; }
.split .up { background: var(--online); }
.split .down { background: var(--offline); }
.olt-card:hover .split { background: var(--surface); }
.olt-card .when { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 6px; min-width: 0; }
.olt-card .when.bad { color: var(--offline-ink); }
.olt-card .when span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.olt-card.unread .health { color: var(--text2); font-size: 13px; }
@media (max-width: 899px) {
  .readbar { margin: -2px 12px 0; }
  .stale, #note .problem { margin: 6px 10px 2px; }
  .summary { padding: 0 10px 8px; }
}

/* Activity: a day at a time. */
.day { margin: 14px 16px 8px; font-size: 13px; font-weight: 600; color: var(--text2); animation: rise .3s var(--ease-out) backwards; }
.day:first-child { margin-top: 2px; }
.row.event { align-items: flex-start; min-height: 0; }
.row.event .mark { width: 36px; height: 36px; border-radius: 9px; }
.row.event .row-title { font-size: 14px; }
.row-detail { font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.row.event .at { font-size: 13px; color: var(--text2); flex: none; padding-top: 2px; }
.mark.icon-mark.ok { color: var(--online-ink); background: color-mix(in srgb, var(--online) 12%, var(--surface)); }
.mark.icon-mark.warn { color: var(--amber-ink); background: color-mix(in srgb, var(--amber) 14%, var(--surface)); }
.mark.icon-mark.bad { color: var(--offline-ink); background: color-mix(in srgb, var(--offline) 11%, var(--surface)); }
.end-note { text-align: center; color: var(--text2); font-size: 13px; padding: 14px; }
a.pill { color: var(--text); }
a.pill.on { color: var(--bg); }
@media (max-width: 899px) {
  .day { margin: 12px 12px 6px; }
  .rows .row.event { padding: 10px 12px; }
  .chips a.pill.on { color: var(--bg); }
}

/* OLT form: Test connection. */
.test-row { display: flex; align-items: center; gap: 16px; }
.test-row > div { flex: 1; min-width: 0; }
.test-box #testNote .note { margin-top: 12px; }
.btn.spinning .ic { animation: spin 1s linear infinite; }
@media (max-width: 899px) { .test-row { flex-direction: column; align-items: stretch; } }
/* A day of Activity is one card, its events divided by hairlines: a log reads faster dense. */
.events { margin: 0 16px; background: var(--surface); border-radius: var(--r-card); overflow: hidden; }
.events .row.event { border-radius: 0; padding: 10px 16px 10px 12px; gap: 12px; animation: rise .3s var(--ease-out) backwards; }
.events .row.event + .row.event { box-shadow: inset 0 1px 0 color-mix(in srgb, var(--divider) 60%, transparent); }
.events .row.event .mark { width: 32px; height: 32px; border-radius: 8px; }
.events .row.event .mark .ic { width: 18px; height: 18px; }
@media (max-width: 899px) {
  .events { margin: 0 10px; border: 1px solid var(--divider); border-radius: 16px; }
  .events .row.event { padding: 10px 12px; }
}

/* --- 2.1: Settings, segmented choices, OLT and PON access --------------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--raised); flex: none; }
.seg > button, .seg > label {
  height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text2);
  display: inline-flex; align-items: center; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.seg > button.on, .seg > label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg > label:has(input:disabled) { opacity: .45; cursor: default; }
.seg > label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.events .row.set-row { align-items: center; min-height: 60px; gap: 14px; }
.events .row.set-row .mark { width: 36px; height: 36px; border-radius: 9px; }
.events a.row.set-row:hover, .events button.row.set-row:hover { background: var(--raised); }
.events .set-row .chev { opacity: 1; }
.row-form { margin: 0; }
.row-form + .row-form, .row + .row-form, .row-form + .row { box-shadow: inset 0 1px 0 color-mix(in srgb, var(--divider) 60%, transparent); }
button.row.set-row { width: 100%; border: 0; text-align: left; font: inherit; }
.set-row.danger .row-title { color: var(--offline-ink); }
.events .mark.img { padding: 2px; }
.page.narrow > .day { margin-left: 2px; margin-right: 2px; }
.page.narrow > .events { margin: 0; }

.check.feature { align-items: flex-start; }
.check.feature > span, .access .check > span:not(.scope-note) { display: flex; flex-direction: column; gap: 1px; }
.check.feature .muted, .access .check .muted { margin-left: 0; }
.check.feature input { margin-top: 2px; }
.olt-access { display: flex; flex-direction: column; gap: 8px; }
.access { border: 1px solid var(--divider); border-radius: 10px; padding: 4px 8px; transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.access.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--divider)); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.access .check { margin: 0 -4px; }
.access .scope-note { margin-left: auto; white-space: nowrap; }
.scope { padding: 4px 8px 12px 38px; }
.pick-row.pons { margin-top: 10px; transition: opacity .15s var(--ease); }
.pick-row.pons.off { opacity: .4; pointer-events: none; }
.pon-pick { cursor: pointer; }
.pon-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pon-pick.on { background: var(--accent-fill); color: var(--on-accent); }
.pon-pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 899px) {
  .scope { padding-left: 8px; }
  .page.narrow > .events { border-radius: 16px; }
}

/* The ONU's picture travels inside this file: drawn with the first row, it never
   waits behind the OLT reads for a request of its own (PHP's own server answers one at a time). */
.mark.onu-pic { background: #fff url("data:image/webp;base64,UklGRs4RAABXRUJQVlA4WAoAAAAQAAAAfwAAfwAAQUxQSHEEAAABoEZtexlBe5N0bdu2bfOzbdu2bdu2bdvG2vYE7zmZJO20ef/uiQgIbttIkmxNI432Hl2VPucHsDVKM0ZXIuFcCFsIgmPNheDM+9Ha5YKTyibeTk664KkXzjnxm7nvbg8ANGAicae4Ro+dJ/e/HX2bdy/vAiL6rBDORIu2U8989o/NiBKNVNbaKEScPwKSiJvMy0KT0cc9+v1qLFvbtdBClXD5eEiibrKGQw+47aPF3l4qbdAYDFvhil1AsDizVbvuePlb893dc7IZrVEdBzwWGPf6u0rLcSc//ssmNyuVl82MwctsGVGTtZp8+lM/rXR3yWYNVm6j8GpbRjHTjYceceeXK4NN5jgfzi0M5mdr9tn3hg8XpWfz5MoCYDxxZ7papx0uePFPmdrf+XOdpZAzyrTTn/p1XaC/3W1FcaMl3yarO/TA6z9Y7Pe3Nli0JV4DnOfVZNX773fD2/+bUJPFYYW3A1SAf5dQpduOZz/zu99kystGwwPVK4HbtZEnP/nzRjdb0XAX+gOv1AWR/VPj8C/dJnOykVriW5nh0KtcZcxGtvGDZlnpPAelRsex82W7bPAnsYQ0LPHPnpnou9E9p9Eo5/SDJF2jJBqkw/+DMzB0sxUhFo1MZ0TJihKrZqQyQpISatywTdovG62saLF+WgpjNSISY/Oe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set 0 0 0 1px var(--divider); }
.row.onu .mark.onu-pic, .modal-head .mark.onu-pic { background-size: 82%; }

/* The OLTs card: how many, and how many answered their last read. */
.olts-tile .olt-states { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--text2); }
.olts-tile .olt-states span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.olts-tile .olt-states i { width: 7px; height: 7px; border-radius: 4px; background: var(--text2); opacity: .5; }
.olts-tile .olt-states .up i { background: var(--online); opacity: 1; }
.olts-tile .olt-states .down { color: var(--offline-ink); }
.olts-tile .olt-states .down i { background: var(--offline); opacity: 1; }
.summary .tiles { align-items: stretch; }
.pon-pick.on:hover { background: var(--accent-pressed); }
/* The reading line may take two lines on a phone: it grows rather than running into the list. */
.progress.on { height: auto; min-height: 26px; padding-top: 2px; padding-bottom: 6px; }
.progress .muted { line-height: 1.35; }
.events .set-row .row-sub { white-space: normal; }
.events .set-row .row-sub .txt { overflow: visible; text-overflow: clip; }

/* --- Overview: the fleet as it stood at each OLT's last read ------------ */
.ovw { padding: 0 16px; }
.ovw-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 24px 0 20px; }
.ovw-head > div:first-child { flex: 1; min-width: 260px; }
.ovw-head .muted { margin-top: 4px; }
.ovw-acts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--divider); border: 1px solid var(--divider); border-radius: var(--r-card); overflow: hidden; }
.kpi { background: var(--surface); padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); min-width: 0; transition: background-color .15s var(--ease); }
a.kpi:hover { background: color-mix(in srgb, var(--raised) 60%, var(--surface)); }
.kpi .l { font-size: 13px; color: var(--text2); font-weight: 500; }
.kpi .v { font-size: 32px; font-weight: 600; letter-spacing: -.035em; line-height: 1.15; white-space: nowrap; }
.kpi .v small { font-size: 18px; font-weight: 500; color: var(--text2); letter-spacing: -.01em; }
.kpi .v.down { color: var(--offline); } .kpi .v.amber { color: var(--amber); }
.kpi .s { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s b { font-weight: 600; } .kpi .s .up { color: var(--online-ink); } .kpi .s .down { color: var(--offline-ink); } .kpi .s .amber { color: var(--amber-ink); }

.attention { margin-top: 12px; display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 18px; border-radius: var(--r-card);
  background: color-mix(in srgb, var(--offline) 9%, var(--surface)); color: var(--text); }
.attention.warning { background: color-mix(in srgb, var(--amber) 11%, var(--surface)); }
.attention .dot { width: 10px; height: 10px; border-radius: 5px; background: var(--offline); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--offline) 18%, transparent); }
.attention.warning .dot { background: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 20%, transparent); }
.attention .txt { flex: 1; min-width: 0; color: var(--text); display: flex; gap: 4px 12px; flex-wrap: wrap; align-items: baseline; }
.attention .txt b { font-weight: 600; }
.attention .txt span { color: var(--text2); font-size: 14px; }
.attention .more { flex: none; display: inline-flex; align-items: center; gap: 2px; font-size: 14px; font-weight: 600; color: var(--text); padding: 8px 14px; border-radius: 999px; background: var(--surface); }
.attention .more:hover { background: var(--raised); }

.spread { margin-top: 12px; background: var(--surface); border: 1px solid var(--divider); border-radius: var(--r-card); padding: 18px 20px; }
.spread-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.spread-head h2 { font-size: 18px; font-weight: 600; margin: 0; }
.spread-head .link { margin-left: auto; font-weight: 600; font-size: 14px; }
.spread-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--raised); }
.spread-bar .excellent, .spread-legend .excellent, .ponchips .ok { --c: var(--sig-excellent); }
.spread-bar .good, .spread-legend .good { --c: var(--sig-good); }
.spread-bar .warning, .spread-legend .warning, .ponchips .weak { --c: var(--sig-warning); }
.spread-bar .critical, .spread-legend .critical { --c: var(--sig-critical); }
.spread-bar i { background: var(--c); }
.spread-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.spread-legend a { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; color: var(--text); padding: 8px 10px; border-radius: 12px; font-size: 14px; transition: background-color .15s; }
.spread-legend a:hover { background: var(--raised); }
.spread-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; align-self: center; }
.spread-legend b { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.spread-legend span { color: var(--text2); font-size: 13px; width: 100%; padding-left: 18px; }

.fleet { margin-top: 28px; }
.fleet-bar { padding: 0 0 12px; }
.fleet-bar h2 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.03em; }
.fleet-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.fcard { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--divider); color: var(--text);
  transition: border-color .15s var(--ease), transform .15s var(--ease); }
.fcard:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--divider)); }
.fcard:active { transform: scale(.995); }
.fcard.down { border-color: color-mix(in srgb, var(--offline) 45%, var(--divider)); }
.fcard-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fcard-top .mark { width: 44px; height: 44px; }
.fcard-top .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fcard-top .who b { font-size: 16px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard-top .who span { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard .state { flex: none; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--raised); color: var(--text2); }
.fcard .state.up { background: color-mix(in srgb, var(--online) 13%, var(--surface)); color: var(--online-ink); }
.fcard .state.down { background: color-mix(in srgb, var(--offline) 13%, var(--surface)); color: var(--offline-ink); }
.fcard-onus { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: var(--text2); }
.fcard-onus b { font-size: 24px; font-weight: 600; color: var(--text); letter-spacing: -.03em; }
.fcard-onus .pct { margin-left: auto; font-weight: 600; color: var(--text); }
.fcard .split { height: 6px; }
.ponchips { display: flex; flex-wrap: wrap; gap: 4px; }
.ponchips i { --c: var(--text2); font-style: normal; font-size: 11px; font-weight: 600; min-width: 28px; height: 22px; padding: 0 6px; border-radius: 6px; display: inline-grid; place-items: center;
  color: color-mix(in srgb, var(--c) 80%, var(--text)); background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.ponchips .some { --c: var(--amber); }
.ponchips .bad { --c: var(--offline); background: var(--offline); color: #fff; }
.fcard-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.fcard-facts em { font-style: normal; color: var(--text2); margin-right: 5px; }
.fcard-downs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; font-weight: 600; }
.fcard-downs span { padding: 3px 9px; border-radius: 999px; background: var(--raised); color: var(--text2); }
.fcard-downs .power { background: color-mix(in srgb, var(--amber) 14%, var(--surface)); color: var(--amber-ink); }
.fcard-downs .fibre { background: color-mix(in srgb, var(--offline) 12%, var(--surface)); color: var(--offline-ink); }
.fcard-downs .weak { background: color-mix(in srgb, var(--sig-warning) 14%, var(--surface)); color: var(--amber-ink); }
.fcard-foot { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 4px; font-size: 13px; color: var(--text2); }
.fcard-foot .when { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard-foot .when.bad { color: var(--offline-ink); }
.fcard-foot .open { display: inline-flex; align-items: center; color: var(--text); font-weight: 600; transition: transform .15s var(--ease); }
.fcard:hover .fcard-foot .open { transform: translateX(3px); }

@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 899px) {
  .ovw { padding: 0 12px; }
  .ovw-head { padding: 14px 0 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px 14px 12px; }
  .kpi .v { font-size: 26px; }
  .spread-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fleet-grid { grid-template-columns: 1fr; }
  .fleet-bar .group.tools { width: 100%; }
  .fleet-bar .group[role="group"] { width: 100%; overflow-x: auto; }
  .attention { flex-wrap: wrap; }
}

/* Figures that line up in columns; Inter's tabular minus sits wide, so only where columns need it. */
.reading .v, .kpi .v, .readings .v, .fcard-onus, .sig-table td.num { font-variant-numeric: tabular-nums; }
/* What to do about an ONU, after its tags. */
.todo { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo::before { content: "→ "; color: var(--text2); }

/* --- Signal: the spread as filters, then a table worst first ------------ */
.spread-legend button { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; color: var(--text); padding: 8px 10px; border-radius: 12px; font-size: 14px; text-align: left;
  border: 1px solid transparent; background: none; transition: background-color .15s, border-color .15s; }
.spread-legend button:hover { background: var(--raised); }
.spread-legend button.on { background: var(--raised); border-color: color-mix(in srgb, var(--text) 35%, var(--divider)); }
.spread-legend button i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; align-self: center; }
.spread-legend button b { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.spread-legend button span { color: var(--text2); font-size: 13px; width: 100%; padding-left: 18px; }
.sig-note { margin-top: 10px; font-size: 13px; }
.sig-note:empty { display: none; }
.sig-bar { padding: 16px 0 10px; }
.sig-wrap { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--r-card); overflow-x: auto; }
.sig-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sig-table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--text2); padding: 12px 14px; border-bottom: 1px solid var(--divider); white-space: nowrap; }
.sig-table td { padding: 11px 14px; border-bottom: 1px solid var(--divider); vertical-align: middle; white-space: nowrap; }
.sig-table tbody tr:last-child td { border-bottom: 0; }
.sig-table tbody tr:hover td { background: color-mix(in srgb, var(--raised) 55%, var(--surface)); }
.sig-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.sig-table a { color: var(--text); text-decoration: underline; text-decoration-color: var(--divider); text-underline-offset: 3px; }
.sig-table a:hover { text-decoration-color: var(--text); }
.sig-tier { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.sig-tier i { width: 8px; height: 8px; border-radius: 4px; background: var(--c); }
.sig-tier.excellent, .sig-rx.excellent { --c: var(--sig-excellent); }
.sig-tier.good, .sig-rx.good { --c: var(--sig-good); }
.sig-tier.warning, .sig-rx.warning { --c: var(--sig-warning); }
.sig-tier.critical, .sig-rx.critical { --c: var(--sig-critical); }
.sig-rx { font-weight: 600; color: color-mix(in srgb, var(--c) 85%, var(--text)); }
.sig-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.sig-mac { color: var(--text2); }
.sig-todo { white-space: normal; min-width: 220px; }
.sig-none { text-align: center; padding: 40px 14px !important; }
@media (max-width: 899px) {
  .sig-bar { flex-wrap: wrap; }
  .sig-bar .searchbox { flex: 1 1 100%; width: auto; }
  .sig-bar .picker { flex: 1; }
  .sig-table { font-size: 13px; }
  .sig-table th, .sig-table td { padding: 10px; }
}

/* --- Alarms: what needs someone, worst first ----------------------------- */
.alarms { display: grid; gap: 8px; }
.alarm { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--divider); color: var(--text); transition: border-color .15s; }
.alarm:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--divider)); }
.alarm .lvl { flex: none; width: 10px; height: 10px; border-radius: 5px; margin-top: 7px; background: var(--text2); }
.alarm.critical .lvl { background: var(--offline); box-shadow: 0 0 0 4px color-mix(in srgb, var(--offline) 16%, transparent); }
.alarm.warning .lvl { background: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 18%, transparent); }
.alarm .body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.alarm .body b { font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.alarm .body span { color: var(--text2); font-size: 14px; }
.alarm .side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; color: var(--text2); }
.alarm .side .kind { font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--raised); color: var(--text2); }
.alarm.critical .side .kind { background: color-mix(in srgb, var(--offline) 13%, var(--surface)); color: var(--offline-ink); }
.alarm.warning .side .kind { background: color-mix(in srgb, var(--amber) 14%, var(--surface)); color: var(--amber-ink); }
.alarm-groups { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 0 14px; }
@media (max-width: 899px) { .alarm { flex-wrap: wrap; } .alarm .side { flex-direction: row; width: 100%; padding-left: 24px; justify-content: space-between; } }

/* Add several OLTs: the pasted lines, and how each one checked. */
.batch-lines { height: auto; min-height: 220px; padding: 12px; font: 13px/1.6 "Cascadia Mono", Consolas, ui-monospace, monospace; resize: vertical; }
.batch-check { margin-top: 10px; }
.batch-check .sig-wrap { border-radius: 12px; }
#readNote:empty { display: none; }
