/* Wayfinding system: graphite sign panels, one signal yellow, transit-line category colors. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/ahn-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/ahn-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ground: #0f1113;
  --panel: #1b1e21;
  --raised: #262a2e;
  --sunken: #141619;
  --rule: #2f3439;
  --edge: rgb(255 255 255 / 0.06);
  --ink: #ecebe6;
  --ink-2: #b0b5ba;
  --ink-3: #8a9096;
  --signal: #ffc917;
  --on-signal: #121416;
  --signal-soft: rgb(255 201 23 / 0.14);
  --focus: #ffc917;
  --up: #34b86f;
  --down: #ef5350;
  --unknown: #6d737a;
  --danger: #ff6b61;
  --shadow-panel: inset 0 1px 0 rgb(255 255 255 / 0.04), 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 28px -12px rgb(0 0 0 / 0.7);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.3), 0 18px 40px -12px rgb(0 0 0 / 0.75);
  --shadow: 0 24px 64px -16px rgb(0 0 0 / 0.8), 0 4px 12px rgb(0 0 0 / 0.35);
  --shadow-control: 0 1px 2px rgb(0 0 0 / 0.35);

  --font: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --text: 0.875rem;        /* the one size every list is set in */
  --row: 1.875rem;         /* 30px */
  --r-panel: 16px;
  --r: 12px;
  --r-control: 10px;
  --r-small: 7px;
  --gap: 0.875rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --ground: #e7e5df;
  --panel: #fdfcfa;
  --raised: #f0eee9;
  --sunken: #f4f2ee;
  --rule: #d8d5ce;
  --edge: rgb(20 22 25 / 0.07);
  --ink: #141619;
  --ink-2: #454a50;
  --ink-3: #63686e;
  --signal: #ffc917;
  --on-signal: #141619;
  --signal-soft: rgb(255 201 23 / 0.28);
  --focus: #141619;
  --up: #1f8f50;
  --down: #d23b38;
  --unknown: #8b9096;
  --danger: #c62f28;
  --shadow-panel: 0 1px 2px rgb(20 22 25 / 0.06), 0 10px 28px -14px rgb(20 22 25 / 0.22);
  --shadow-lift: 0 2px 4px rgb(20 22 25 / 0.08), 0 20px 40px -14px rgb(20 22 25 / 0.3);
  --shadow: 0 24px 64px -16px rgb(20 22 25 / 0.35), 0 4px 12px rgb(20 22 25 / 0.08);
  --shadow-control: 0 1px 2px rgb(20 22 25 / 0.1);
  color-scheme: light;
}

/* Transit-line colors; each pairs with a foreground that reads at small bold sizes. */
.line-red    { --line: #d42f24; --on-line: #fff; }
.line-orange { --line: #f39a1e; --on-line: #141619; }
.line-green  { --line: #17803f; --on-line: #fff; }
.line-blue   { --line: #1d67c9; --on-line: #fff; }
.line-teal   { --line: #16a6a1; --on-line: #141619; }
.line-brown  { --line: #86552a; --on-line: #fff; }
.line-pink   { --line: #c2336a; --on-line: #fff; }
.line-slate  { --line: #9aa2aa; --on-line: #141619; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--text)/1.4 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--signal); color: var(--on-signal); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.i {
  width: 1.125rem; height: 1.125rem; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: square; stroke-linejoin: miter;
}

/* Library icons: brands are solid shapes, Lucide keeps its rounded strokes. */
.i-brand { fill: currentColor; stroke: none; }
.i-lu { stroke-linecap: round; stroke-linejoin: round; }

/* ---- buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  height: 2.25rem; padding: 0 0.85rem;
  border: 0; border-radius: var(--r-control);
  font-weight: 700; text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms var(--ease), color 120ms var(--ease), box-shadow 160ms var(--ease), translate 160ms var(--ease);
}
.btn-signal { background: var(--signal); color: var(--on-signal); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), var(--shadow-control); }
.btn-signal:hover { background: #ffd84d; }
.btn-signal:active { translate: 0 1px; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.2); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--raised); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn.danger, .danger { color: var(--danger); }
.btn-icon { width: 2.25rem; padding: 0; }
.btn-small { height: 1.875rem; padding: 0 0.6rem; }
.btn-wide { width: 100%; height: 2.75rem; }
.btn-lang { width: 2.5rem; padding: 0; letter-spacing: 0.06em; }
.btn:disabled, .btn.htmx-request { opacity: 0.55; cursor: progress; }
.inline-form { display: contents; }

.tool {
  display: inline-grid; place-items: center;
  width: 1.625rem; height: 1.625rem; padding: 0;
  border: 0; border-radius: var(--r-small);
  background: transparent; color: var(--ink-3); cursor: pointer;
}
.tool:hover { background: var(--raised); color: var(--ink); }
.tool .i { width: 1rem; height: 1rem; }

/* ---- sign bar --------------------------------------------------------- */

.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  height: 3.75rem; padding: 0 max(1.25rem, env(safe-area-inset-right)) 0 max(1.25rem, env(safe-area-inset-left));
  /* Translucent so panels scrolling beneath read as depth, not noise. */
  background: color-mix(in srgb, var(--ground) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--edge);
}
.mark { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; flex: none; }
.mark-sign {
  display: grid; place-items: center; width: 2rem; height: 2rem;
  background: var(--signal); color: var(--on-signal); border-radius: 9px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), var(--shadow-control);
}
.mark-sign .i { width: 1.2rem; height: 1.2rem; stroke-width: 2.5; }
.mark-word { font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.bar-title { font-size: var(--text); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.bar-actions { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }

.search { flex: 1; max-width: 40rem; }
.search-field {
  display: flex; align-items: center; gap: 0.5rem;
  height: 2.5rem; padding: 0 1rem;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 999px;
  color: var(--ink-3); box-shadow: var(--shadow-control);
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease), box-shadow 180ms var(--ease);
}
.search-field:hover { border-color: var(--rule); }
.search-field:focus-within { border-color: var(--signal); background: var(--sunken); color: var(--ink); box-shadow: 0 0 0 4px var(--signal-soft); }
.search-field input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none;
  color: var(--ink);
}
.search-field input::placeholder { color: var(--ink-3); }
.search-field input::-webkit-search-cancel-button { filter: grayscale(1); }

/* ---- board ------------------------------------------------------------ */

.board-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; animation: bg-in 1.2s ease-out both; }
.board { position: relative; z-index: 1; padding: 1.25rem max(1.25rem, env(safe-area-inset-right)) 6rem max(1.25rem, env(safe-area-inset-left)); }
/* Column count follows the screen. app.js packs panels by giving each a row span over 4px
   tracks, so the grid reads left to right without holes and keeps DOM order for dragging. */
.panels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
  grid-auto-rows: 4px;
  column-gap: var(--gap);
  align-items: start;
}
.panels:not(.packed) { grid-auto-rows: auto; row-gap: var(--gap); }

.panel {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  transition: box-shadow 200ms var(--ease), opacity 140ms var(--ease);
}
.panel:hover { box-shadow: var(--shadow-lift); }
.panel-head {
  position: relative;
  display: flex; align-items: center; gap: 0.25rem;
  height: 2.875rem; padding: 0 0.5rem 0 0.75rem;
}
.panel-toggle {
  display: flex; align-items: center; gap: 0.6rem; flex: 1; min-width: 0;
  height: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: default;
}
.panel-head h2, .panel-head h3 {
  margin: 0;
  font-size: var(--text); font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.count { color: var(--ink-3); font-weight: 500; }
.chev { display: none; }
.code {
  display: inline-grid; place-items: center; flex: none;
  min-width: 2rem; height: 1.625rem; padding: 0 0.4rem;
  background: var(--line); color: var(--on-line);
  border-radius: var(--r-small);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), inset 0 -1px 0 rgb(0 0 0 / 0.12);
  font-weight: 800; font-size: 0.75rem; letter-spacing: 0.04em;
}
.panel-tools, .row-tools { display: flex; gap: 0.125rem; opacity: 0; transition: opacity 120ms var(--ease); }
.panel-head:hover .panel-tools, .panel-head:focus-within .panel-tools { opacity: 1; }

.rows { list-style: none; margin: 0; padding: 0 0.375rem 0.5rem; min-height: 0.5rem; }
.row {
  position: relative;
  display: flex; align-items: center; gap: 0.25rem;
  height: var(--row); padding: 0 0.375rem;
  border-radius: var(--r-small);
  transition: opacity 140ms var(--ease), background-color 80ms linear;
}
.row:hover, .row:focus-within { background: var(--raised); }
.row:hover .row-tools, .row:focus-within .row-tools { opacity: 1; }
.row-main {
  display: flex; align-items: center; gap: 0.6rem; flex: 1; min-width: 0; height: 100%;
  padding: 0; border: 0; background: none; text-align: left;
  color: var(--ink); text-decoration: none; cursor: pointer;
}
.row-main:focus-visible { outline-offset: -2px; }
.glyph {
  display: grid; place-items: center; flex: none;
  width: 1.375rem; height: 1.375rem;
  background: var(--raised); color: var(--ink-2); border-radius: 6px;
}
.row:hover .glyph { background: var(--panel); }
.glyph .i { width: 0.95rem; height: 0.95rem; }
.glyph img { width: 1rem; height: 1rem; object-fit: contain; }
.title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.host { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; }

.status { flex: none; width: 0.5rem; height: 0.5rem; margin: 0 0.3rem; border-radius: 2px; }
.s-up { background: var(--up); }
.s-down { background: var(--down); outline: 3px solid color-mix(in srgb, var(--down) 25%, transparent); }
.s-unknown { background: transparent; box-shadow: inset 0 0 0 2px var(--unknown); }

.row-tools .tool { width: 1.5rem; height: 1.5rem; }
.row .row-tools { position: absolute; right: 0.25rem; top: 50%; translate: 0 -50%; padding-left: 1.5rem;
  border-radius: 0 var(--r-small) var(--r-small) 0;
  background: linear-gradient(to right, transparent, var(--raised) 1.25rem); }

.row-empty {
  display: flex; align-items: center; gap: 0.5rem; width: calc(100% - 1rem);
  height: var(--row); margin: 0 0.5rem 0.625rem; padding: 0 0.5rem;
  border: 1px dashed var(--rule); border-radius: var(--r-small);
  background: none; color: var(--ink-3); cursor: pointer;
}
.row-empty:hover { color: var(--ink); border-color: var(--ink-3); }
.row-empty .i { width: 1rem; height: 1rem; }

/* Drag handles appear on touch in layout mode; with a mouse the whole row drags. */
.handle { display: none; place-items: center; width: 1.5rem; height: 1.5rem; color: var(--ink-3); cursor: grab; touch-action: none; }
.handle .i { width: 1rem; height: 1rem; }
body.layout-editing .handle { display: grid; }
body.layout-editing .row-tools, body.layout-editing .panel-tools { display: none; }
body.layout-editing .row-main { pointer-events: none; }
.sortable-ghost { opacity: 0.35; }
.sortable-chosen { background: var(--raised); }
.sortable-drag { box-shadow: var(--shadow); border-radius: var(--r-small); }
body.dragging .rows { min-height: var(--row); }

/* ---- board layout: main column + rail ---------------------------------- */

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17.5rem;
  gap: 1.5rem;
  max-width: 112rem;
  margin: 0 auto;
  align-items: start;
}
.board-main { display: grid; gap: 1.75rem; min-width: 0; }
.section { display: grid; gap: 0.75rem; }
.section-head { display: flex; align-items: baseline; gap: 0.6rem; padding: 0 0.25rem; }
.section-head h2, .rail-head h2 {
  margin: 0; font-size: 0.75rem; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}

.readonly-tag { display: inline-flex; align-items: center; gap: 0.4rem; height: 2rem; padding: 0 0.75rem; border-radius: 999px;
  background: var(--raised); color: var(--ink-2); font-weight: 600; font-size: 0.8125rem; }
.readonly-tag .i { width: 0.95rem; height: 0.95rem; }

/* ---- boards: tabs like terminal signs ------------------------------------ */

.boards { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-bottom: -0.5rem; }
.board-tab {
  display: inline-flex; align-items: center; gap: 0.35rem; height: 2.125rem; padding: 0 0.85rem;
  border: 1px solid var(--edge); border-radius: 999px; background: var(--panel); color: var(--ink-2);
  font-weight: 600; cursor: pointer; box-shadow: var(--shadow-control);
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}
button.board-tab:hover { color: var(--ink); background: var(--raised); }
.board-tab.sortable-ghost { opacity: 0.4; }
.board-tab.sortable-chosen { box-shadow: var(--shadow-lift); }
body.layout-editing .board-tab[data-board-id] { cursor: grab; outline: 1px dashed var(--ink-3); outline-offset: 2px; }
.board-tab[aria-current="page"] { background: var(--signal); color: var(--on-signal); border-color: transparent; padding-right: 0.3rem; cursor: default; }
.board-tab[aria-current="page"] .tool { color: var(--on-signal); width: 1.5rem; height: 1.5rem; border-radius: 999px; }
.board-tab[aria-current="page"] .tool:hover { background: rgb(0 0 0 / 0.12); }
.board-add { background: transparent; border-style: dashed; box-shadow: none; }
.board-all .i { width: 0.95rem; height: 0.95rem; }
.board-tab.board-all[aria-current="page"] { padding-right: 0.85rem; }
.boards-sep { width: 1px; height: 1.25rem; margin: 0 0.2rem; background: var(--rule); }
.panel-board {
  flex: none; margin-left: auto; padding: 0.05rem 0.45rem; border-radius: 999px;
  font-size: 0.6875rem; font-weight: 600; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--rule);
  white-space: nowrap; max-width: 8rem; overflow: hidden; text-overflow: ellipsis;
}
.board-add .i { width: 0.95rem; height: 0.95rem; }
.danger-zone { gap: 0.55rem; }

/* ---- most opened: the departure board's top line ------------------------ */

/* Four across or two across, so the top eight always form even rows. */
.board-main { container-type: inline-size; }
.tiles { display: grid; gap: 0.75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (min-width: 60rem) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  transition: box-shadow 200ms var(--ease), translate 200ms var(--ease), border-color 200ms var(--ease);
}
.tile:hover { translate: 0 -2px; box-shadow: var(--shadow-lift); border-color: var(--rule); }
.tile-main {
  display: flex; align-items: center; gap: 0.8rem; width: 100%;
  min-height: 4.25rem; padding: 0.8rem 2.25rem 0.8rem 0.85rem;
  border: 0; background: none; border-radius: inherit; text-align: left;
  color: var(--ink); text-decoration: none; cursor: pointer;
}
.tile-glyph {
  display: grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: var(--r-control);
  background: var(--raised); color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--edge);
}
.tile-glyph .i { width: 1.2rem; height: 1.2rem; }
/* Solid brand marks read heavier than stroked pictograms; draw them a touch smaller. */
.tile-glyph .i-brand { width: 1.05rem; height: 1.05rem; }
.glyph .i-brand { width: 0.85rem; height: 0.85rem; }
.tile-glyph img { width: 1.25rem; height: 1.25rem; object-fit: contain; }
.tile-text { display: grid; gap: 0.15rem; flex: 1; min-width: 0; }
.tile-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { display: flex; align-items: center; gap: 0.4rem; min-width: 0; color: var(--ink-3); }
.tile-sub > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-dot { flex: none; width: 0.5rem; height: 0.5rem; border-radius: 2px; background: var(--line); }
.tile .status { margin: 0; }
.tile-arrow { color: var(--ink-3); transition: color 160ms var(--ease), translate 200ms var(--ease); }
.tile:hover .tile-arrow { color: var(--signal); translate: 3px 0; }
:root[data-theme="light"] .tile:hover .tile-arrow { color: var(--ink); }
.tile-more { position: absolute; top: 0.35rem; right: 0.35rem; opacity: 0; transition: opacity 120ms var(--ease); }
.tile:hover .tile-more, .tile:focus-within .tile-more { opacity: 1; }
.tile:hover .tile-arrow, .tile:focus-within .tile-arrow { opacity: 0; }
.tiles-empty {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 1rem 1.1rem; border: 1px dashed var(--rule); border-radius: var(--r-panel);
  color: var(--ink-3);
}
.tiles-empty .i { color: var(--signal); }
:root[data-theme="light"] .tiles-empty .i { color: var(--ink); }
body.searching .section-top { display: none; }

/* ---- rail: clock and watched links ------------------------------------- */

.rail { display: grid; gap: 0.75rem; }
.rail-card {
  background: var(--panel); border: 1px solid var(--edge);
  border-radius: var(--r-panel); box-shadow: var(--shadow-panel);
  padding: 0.9rem 1rem;
}
.clock-card { display: grid; gap: 0.2rem; }
.clock { font-size: 2.25rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.clock-seconds { color: var(--ink-3); font-weight: 600; font-size: 1.25rem; margin-left: 0.15rem; }
.clock-date { color: var(--ink-3); font-weight: 500; }
.clock-date::first-letter { text-transform: uppercase; }
.weather:empty { display: none; }
.weather { display: grid; gap: 0.5rem; margin-top: 0.7rem; padding-top: 0.75rem; border-top: 1px solid var(--edge); }
.weather-now { display: flex; align-items: center; gap: 0.6rem; }
.weather-icon .i { width: 2rem; height: 2rem; stroke-width: 1.75; color: var(--signal); }
:root[data-theme="light"] .weather-icon .i { color: var(--ink); }
.weather-temp { font-size: 1.75rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.weather-desc { display: grid; min-width: 0; }
.weather-desc strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weather-desc span { font-size: 0.75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.weather-meta { margin: 0; font-size: 0.75rem; color: var(--ink-3); }
.weather-days { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; }
.weather-days li { display: grid; justify-items: center; gap: 0.2rem; padding: 0.45rem 0.25rem; border-radius: var(--r-small); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--edge); }
.weather-days .i { width: 1.15rem; height: 1.15rem; color: var(--ink-2); }
.weather-day { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.weather-range { font-size: 0.8125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.weather-range span { color: var(--ink-3); font-weight: 500; }
.weather-error { margin: 0; font-size: 0.75rem; color: var(--ink-3); }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.status-list { list-style: none; margin: 0 -0.4rem; padding: 0; }
.status-list li { display: flex; align-items: center; gap: 0.55rem; height: 1.875rem; padding: 0 0.4rem; border-radius: var(--r-small); }
.status-list li:hover { background: var(--raised); }
.status-list .status { margin: 0; }
.status-name { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-text { flex: none; font-size: 0.75rem; font-weight: 700; color: var(--ink-3); }
.status-text.st-up { color: var(--up); }
.status-text.st-down { color: var(--down); }
.rail-empty { color: var(--ink-3); }

/* ---- widgets ---------------------------------------------------------- */

.widgets { display: grid; gap: 0.75rem; }
.widgets:empty { display: none; }
.widget { display: grid; gap: 0.55rem; }
.widget .rail-head { margin-bottom: 0; }
.widget-link { text-decoration: none; }
.widget-link:hover { color: var(--ink); }
.widget-error { color: var(--down); font-weight: 600; }
.meter { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.5rem; align-items: baseline; }
.meter-label { color: var(--ink-3); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.meter-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.meter-track { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--ink-2);
  transform-origin: left; transform: scaleX(0); transition: transform 600ms var(--ease); }
.meter-fill.warm { background: var(--signal); }
.meter-fill.hot { background: var(--down); }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.5rem; margin: 0.2rem 0 0; font-size: 0.8125rem; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.node { display: grid; gap: 0.45rem; }
.node + .node { padding-top: 0.6rem; border-top: 1px solid var(--edge); }
.node-name { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-weight: 700; }
.node-name .status { margin: 0; }
.node-guests { margin-left: auto; font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.node-uptime { margin: 0; font-size: 0.75rem; color: var(--ink-3); }
.jira-list { list-style: none; margin: 0 -0.4rem; padding: 0; }
.jira-list a { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; height: 2rem; padding: 0 0.4rem;
  border-radius: var(--r-small); color: var(--ink); text-decoration: none; }
.jira-list a:hover { background: var(--raised); }
.jira-list span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jira-list strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
textarea {
  width: 100%; padding: 0.55rem 0.7rem; resize: vertical; font: inherit; font-size: 0.8125rem;
  background: var(--sunken); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-control); outline: none;
}
textarea:focus { border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }

@media (max-width: 72rem) {
  .board-layout { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); align-items: start; }
}

/* Environment plates: production reads as a warning, the rest stay quiet. */
.env {
  flex: none; display: inline-grid; place-items: center; height: 1.05rem; padding: 0 0.3rem; margin-left: 0.4rem;
  border-radius: 4px; font-size: 0.625rem; font-weight: 800; letter-spacing: 0.06em; line-height: 1;
  color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule);
}
.env-prd { color: #fff; background: var(--down); box-shadow: none; }
.env-uat { color: var(--on-signal); background: var(--signal); box-shadow: none; }
.tile-title { display: flex; align-items: center; min-width: 0; }
.tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .title { flex: 0 1 auto; }
.row .env + .status, .row .env { margin-right: auto; }
.status-ms { flex: none; font-size: 0.75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.stat { display: grid; gap: 0.1rem; padding: 0.6rem 0.7rem; background: var(--sunken); border-radius: var(--r-small); box-shadow: inset 0 0 0 1px var(--edge); }
.stat-value { font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.75rem; color: var(--ink-3); }
.outages { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.outages li { display: flex; align-items: center; gap: 0.6rem; font-variant-numeric: tabular-nums; min-width: 0; }
.outages li::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border-radius: 2px; background: var(--down); }
.outages li > span:first-child { flex: none; white-space: nowrap; }
.outages li > .hint { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.subhead { margin: 0.25rem 0 0; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.actions-line.gap { gap: 0.4rem; }
.actions-line.start { justify-content: flex-start; }
.bookmarklet { cursor: grab; }
.share-link { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.share-link input { flex: 1 1 18rem; font-size: 0.8125rem; }
.share-cats { gap: 0.5rem; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.45rem 1rem; }
.share-grid .check { font-weight: 500; }
.share-grid .code { min-width: 1.75rem; height: 1.35rem; font-size: 0.6875rem; }
code { font-size: 0.8125rem; padding: 0.05rem 0.3rem; border-radius: 4px; background: var(--sunken); overflow-wrap: anywhere; }

/* ---- search: the destination lights up -------------------------------- */

body.searching .row.miss { opacity: 0.2; }
body.searching .panel.miss { opacity: 0.45; box-shadow: none; }
body.searching .row.first { background: var(--signal); box-shadow: var(--shadow-control); }
body.searching .row.first .row-main, body.searching .row.first .host { color: var(--on-signal); }
body.searching .row.first .glyph { background: rgb(0 0 0 / 0.12); color: var(--on-signal); }
body.searching .row.first::after {
  content: ""; flex: none; width: 1rem; height: 1rem; margin-right: 0.2rem;
  background: currentColor; color: var(--on-signal);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='square'%3E%3Cpath d='M4 12h15M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
body.searching .row.first .row-tools { display: none; }
.search-empty { text-align: center; color: var(--ink-3); padding: 1rem; }

.first-sign {
  display: grid; justify-items: start; gap: 0.75rem;
  max-width: 34rem; margin: 0.5rem 0 0; padding: 1.75rem;
  background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r-panel); box-shadow: var(--shadow-panel);
}
.first-sign-mark { display: grid; place-items: center; width: 3rem; height: 3rem; background: var(--signal); color: var(--on-signal); border-radius: var(--r); }
.first-sign-mark .i { width: 2rem; height: 2rem; stroke-width: 2.5; }
.first-sign h1 { font-size: 1.25rem; font-weight: 800; }
.first-sign p { color: var(--ink-2); max-width: 60ch; }

/* ---- dialogs ---------------------------------------------------------- */

dialog {
  padding: 0; border: 1px solid var(--edge); color: var(--ink);
  background: var(--panel); border-radius: 20px;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgb(8 9 10 / 0.55); backdrop-filter: blur(3px); }
.sheet-dialog { width: min(34rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); }
dialog[open] { animation: rise 180ms var(--ease); }
@keyframes rise { from { opacity: 0; translate: 0 0.5rem; scale: 0.985; } }

.sheet { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0.875rem 0.25rem 1.25rem; }
.sheet-head h2 { font-size: var(--text); font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.sheet-body { display: grid; gap: 1rem; padding: 0.75rem 1.25rem 1.25rem; overflow-y: auto; }
.sheet-foot {
  display: flex; align-items: center; gap: 0.375rem; flex-wrap: wrap;
  padding: 0.875rem 1.25rem; background: var(--sunken); border-top: 1px solid var(--edge);
}
.spacer { flex: 1; }

.menu-dialog { width: 15rem; margin: 0; border-radius: var(--r); z-index: 60; }
.menu-head { padding: 0.6rem 0.75rem 0.35rem; }
.menu-title { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-items { display: grid; padding: 0 0.375rem 0.375rem; }
.menu-items button {
  display: flex; align-items: center; gap: 0.6rem; height: 2.25rem; padding: 0 0.5rem;
  border: 0; border-radius: var(--r-small); background: none; text-align: left; cursor: pointer;
}
.menu-items button:hover, .menu-items button:focus-visible { background: var(--raised); }

/* ---- forms ------------------------------------------------------------ */

.field { display: grid; gap: 0.35rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > label, .field legend { font-weight: 700; color: var(--ink-2); padding: 0; }
.field-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.field-row > .field { flex: 0 0 auto; }
.field-row > .grow { flex: 1 1 12rem; }
.optional { font-weight: 400; color: var(--ink-3); }
input[type="text"], input[type="password"], input[type="search"]:not(.search-field input), select {
  width: 100%; height: 2.375rem; padding: 0 0.7rem;
  background: var(--sunken); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--r-control);
  outline: none;
  transition: border-color 120ms var(--ease), box-shadow 160ms var(--ease);
}
select { appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a9096' stroke-width='2' stroke-linecap='square'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.55rem center; background-size: 1rem; }
input:focus, select:focus { border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }
:root[data-theme="light"] input:focus, :root[data-theme="light"] select:focus { border-color: var(--ink); box-shadow: 0 0 0 2px var(--signal); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
input::placeholder { color: var(--ink-3); }
input.is-loading {
  background-image: linear-gradient(90deg, transparent 0%, var(--signal-soft) 50%, transparent 100%);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: scan 1.1s linear infinite;
}
@keyframes scan { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.input-code { width: 5rem !important; text-transform: uppercase; font-weight: 800; letter-spacing: 0.06em; }
.field-error { color: var(--danger); font-weight: 600; }
.hint { color: var(--ink-3); }
.hint:empty { display: none; }
.hint-note { color: var(--ink-2); }
.lead { display: flex; align-items: center; gap: 0.6rem; }

.input-glyph { position: relative; }
.input-glyph .glyph { position: absolute; left: 0.45rem; top: 50%; translate: 0 -50%; pointer-events: none; }
.input-glyph input { padding-left: 2.35rem; }

.check { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; font-weight: 600; color: var(--ink); }
.check input {
  appearance: none; flex: none; margin: 0;
  width: 1.125rem; height: 1.125rem;
  border: 2px solid var(--ink-3); border-radius: 5px; background: var(--sunken);
  display: grid; place-items: center; cursor: pointer;
}
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--signal); border-color: var(--signal); }
.check input[type="checkbox"]:checked::after {
  content: ""; width: 0.7rem; height: 0.7rem; background: var(--on-signal);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='square'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.check input[type="radio"]:checked::after { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--on-signal); }
:root[data-theme="light"] .check input:checked { border-color: var(--ink); }

.warn {
  display: flex; gap: 0.6rem; padding: 0.8rem 0.9rem;
  background: var(--signal-soft); border-radius: var(--r-control);
}
.warn > .i { color: var(--signal); margin-top: 0.1rem; }
:root[data-theme="light"] .warn > .i { color: var(--ink); }
.warn > div { display: grid; gap: 0.5rem; }

.field-label { font-weight: 700; color: var(--ink-2); }
.icon-current { display: flex; align-items: center; gap: 0.6rem; min-height: 2.5rem; }
.glyph-lg { width: 2.5rem; height: 2.5rem; border-radius: var(--r-control); box-shadow: inset 0 0 0 1px var(--edge); }
.glyph-lg .i { width: 1.25rem; height: 1.25rem; }
.glyph-lg img { width: 1.25rem; height: 1.25rem; }
.icon-name { font-weight: 600; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-current .btn .i { width: 1rem; height: 1rem; }
.icon-picker {
  display: grid; gap: 0.6rem; padding: 0.75rem;
  background: var(--sunken); border: 1px solid var(--edge); border-radius: var(--r-control);
}
.icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr)); gap: 0.35rem;
  max-height: 13.5rem; overflow-y: auto; padding: 0.15rem;
}
.icon-option {
  display: grid; place-items: center; aspect-ratio: 1;
  border: 0; border-radius: var(--r-small); background: var(--panel); color: var(--ink-2); cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--edge);
  transition: background-color 100ms linear, color 100ms linear, translate 120ms var(--ease);
}
.icon-option .i { width: 1.2rem; height: 1.2rem; }
.icon-option:hover { background: var(--raised); color: var(--ink); translate: 0 -1px; }
.icon-option[aria-selected="true"] { background: var(--signal); color: var(--on-signal); }
.icon-empty { grid-column: 1 / -1; color: var(--ink-3); padding: 0.5rem; }
.icon-type-btn { justify-self: start; }

.monitor-field { gap: 0.6rem; }
.port { display: flex; align-items: center; gap: 0.6rem; }
.port label { font-weight: 700; color: var(--ink-2); }
.port input { width: 6rem; }

.choice { display: grid; gap: 0.45rem; padding: 0.8rem 0.9rem; background: var(--sunken); border-radius: var(--r-control); }

.swatches { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.swatch {
  position: relative; display: grid; place-items: center;
  width: 2.25rem; height: 2.25rem; border-radius: var(--r-control);
  background: var(--line); color: var(--on-line); cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), var(--shadow-control);
  transition: translate 140ms var(--ease);
}
.swatch:hover { translate: 0 -1px; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch .i { opacity: 0; stroke-width: 3; }
.swatch:has(input:checked) .i { opacity: 1; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- toasts ----------------------------------------------------------- */

.toasts {
  position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); translate: -50% 0; z-index: 50;
  display: grid; gap: 0.5rem; width: min(28rem, calc(100vw - 2rem));
}
.toast {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; padding: 0.5rem 0.5rem 0.5rem 0.9rem;
  background: var(--ink); color: var(--ground); border-radius: var(--r);
  box-shadow: var(--shadow); font-weight: 600;
  animation: rise 180ms var(--ease);
}
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast button {
  height: 1.875rem; padding: 0 0.7rem; border: 0; border-radius: var(--r-small);
  background: var(--signal); color: var(--on-signal); font-weight: 800; cursor: pointer;
}
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--signal); transform-origin: left; }
.toast.leaving { opacity: 0; translate: 0 0.5rem; transition: opacity 160ms, translate 160ms; }

/* ---- login: a split-flap departure board ----------------------------- */

.login-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; animation: bg-in 1.2s ease-out both; }
@keyframes bg-in { from { opacity: 0; } }
.login { position: relative; z-index: 1; display: grid; place-content: center; justify-items: center; gap: 1.75rem; min-height: 100dvh; padding: 1rem; }
.login-board { display: grid; justify-items: start; gap: 0.75rem; }
.login-sign { display: flex; align-items: center; gap: 0.6rem; }
.login-arrow {
  display: grid; place-items: center; width: 4rem; height: 4rem;
  background: var(--signal); color: var(--on-signal); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), var(--shadow-panel);
  animation: sign-in 620ms var(--ease) both;
}
.login-arrow .i { width: 2.5rem; height: 2.5rem; stroke-width: 2.5; animation: arrow-nudge 700ms var(--ease) 620ms both; }
@keyframes sign-in { from { clip-path: inset(0 100% 0 0 round 14px); translate: -0.75rem 0; } }
@keyframes arrow-nudge { 40% { translate: 0.3rem 0; } }

/* Flaps stay dark in both themes: the board is a physical object, not a surface. */
.flaps { display: inline-flex; gap: 0.3rem; }
.flap {
  position: relative; display: grid; place-items: center;
  width: 3.1rem; height: 4rem; border-radius: 9px; overflow: hidden;
  background: linear-gradient(#2a2e33 0 50%, #22262a 50% 100%);
  color: #f3f1ea; font-size: 2.35rem; font-weight: 800; line-height: 1;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.07), 0 1px 2px rgb(0 0 0 / 0.45), 0 10px 22px -12px rgb(0 0 0 / 0.8);
  perspective: 240px;
}
.flap::after {
  content: ""; position: absolute; inset: 50% 0 auto; height: 2px; translate: 0 -1px;
  background: rgb(0 0 0 / 0.55); box-shadow: 0 1px 0 rgb(255 255 255 / 0.04);
}
.flap > span { display: block; transform-origin: 50% 50%; backface-visibility: hidden; }
.flap.flip > span { animation: flap 80ms linear; }
.flap.settle > span { animation: flap-settle 220ms var(--ease); }
@keyframes flap { from { transform: rotateX(-88deg); filter: brightness(0.6); } }
@keyframes flap-settle { 0% { transform: rotateX(-88deg); } 70% { transform: rotateX(6deg); } }
.flaps-small .flap { width: 1.7rem; height: 2.2rem; border-radius: 6px; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.flaps-small .flap-sep { width: 0.9rem; background: none; box-shadow: none; color: var(--ink-3); }
.flaps-small .flap-sep::after { display: none; }
.login-clock { padding-left: 4.6rem; }

.login-panel {
  display: grid; gap: 1rem; width: min(24rem, calc(100vw - 2rem)); padding: 1.5rem;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 20px; box-shadow: var(--shadow-lift);
  animation: panel-in 520ms var(--ease) 380ms both;
}
@keyframes panel-in { from { opacity: 0; translate: 0 0.75rem; } }
.login-panel h2 { margin: 0; font-size: var(--text); font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-2); }
.login-panel.has-error { animation: panel-in 1ms both, refuse 360ms var(--ease) 60ms; }
@keyframes refuse { 20% { translate: -0.5rem 0; } 45% { translate: 0.4rem 0; } 70% { translate: -0.2rem 0; } }
.login-go .i { width: 1.1rem; transition: translate 200ms var(--ease); }
.login-go:hover .i { translate: 0.2rem 0; }
.login-go.going .i { animation: go 700ms var(--ease) infinite; }
@keyframes go { 0% { translate: 0 0; opacity: 1; } 60% { translate: 0.6rem 0; opacity: 0; } 61% { translate: -0.4rem 0; opacity: 0; } 100% { translate: 0 0; opacity: 1; } }
.cmd { margin: 0; padding: 0.75rem; background: var(--sunken); border-radius: var(--r-control); overflow-x: auto; font-size: 0.8125rem; }

@media (max-width: 30rem) {
  .login-arrow { width: 3.1rem; height: 3.1rem; }
  .login-arrow .i { width: 2rem; height: 2rem; }
  .flap { width: 2.45rem; height: 3.1rem; font-size: 1.8rem; }
  .login-clock { padding-left: 3.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .login-arrow, .login-arrow .i, .login-panel, .login-panel.has-error { animation: none; }
  .flap.flip > span, .flap.settle > span { animation: none; }
}

/* ---- settings --------------------------------------------------------- */

.settings { display: grid; gap: var(--gap); max-width: 44rem; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.settings-panel { margin: 0; overflow: visible; }
.settings-panel .panel-head { padding-left: 1.25rem; }
.settings-panel:hover { box-shadow: var(--shadow-panel); }
.settings-body { display: grid; gap: 0.9rem; padding: 0.25rem 1.25rem 1.25rem; }
.setting-line { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-weight: 700; }
.actions-line { display: flex; justify-content: flex-end; }
.segmented { display: inline-flex; padding: 0.2rem; gap: 0.2rem; background: var(--sunken); border-radius: var(--r-control); box-shadow: inset 0 0 0 1px var(--edge); }
.segmented button {
  display: inline-flex; align-items: center; gap: 0.4rem; height: 1.875rem; padding: 0 0.7rem;
  border: 0; border-radius: var(--r-small); background: none; color: var(--ink-2); font-weight: 700; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--signal); color: var(--on-signal); box-shadow: var(--shadow-control); }
.segmented .i { width: 1rem; height: 1rem; }
.segmented-small { padding: 0.15rem; align-self: center; }
.segmented-small button { height: 1.5rem; padding: 0 0.55rem; font-size: 0.75rem; }
.devices { list-style: none; margin: 0; padding: 0 0.5rem 0.5rem; }
.device { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.5rem 0.5rem 0.75rem; border-radius: var(--r-control); }
.device:hover { background: var(--raised); }
.device-main { display: grid; flex: 1; min-width: 0; }
.device .host { white-space: normal; }
.tag { display: inline-block; padding: 0 0.35rem; margin-left: 0.3rem; background: var(--signal); color: var(--on-signal); border-radius: 5px; font-weight: 800; font-size: 0.75rem; }
.notice { display: flex; align-items: center; gap: 0.5rem; padding: 0.8rem 1.1rem; background: var(--signal-soft); border-radius: var(--r); font-weight: 700; }

/* ---- theme-dependent icons, touch, narrow ----------------------------- */

:root:not([data-theme="light"]) .when-light, :root[data-theme="light"] .when-dark { display: none; }
.only-touch { display: none; }
.fab {
  position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 30;
  width: 3.5rem; height: 3.5rem; border: 0; border-radius: 18px;
  background: var(--signal); color: var(--on-signal); cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), 0 12px 28px -8px rgb(0 0 0 / 0.55), 0 2px 6px rgb(0 0 0 / 0.25);
}
.fab:active { scale: 0.96; }
.fab .i { width: 1.6rem; height: 1.6rem; stroke-width: 2.5; }
.layout-banner {
  position: sticky; top: 3.75rem; z-index: 19;
  align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.5rem 1rem; background: var(--signal); color: var(--on-signal); font-weight: 700;
}
.layout-banner .btn { background: var(--on-signal); color: var(--signal); }

@media (hover: none) {
  .only-touch { display: inline-flex; }
  .layout-banner:not([hidden]) { display: flex; }
  .row-tools, .panel-tools { display: none; }
  .row { height: 2.5rem; }
  .bar-actions .btn-signal { display: none; }
  /* 16px keeps iOS from zooming into focused fields. */
  input[type="text"], input[type="password"], .search-field input, select { font-size: 1rem; }
}

@media (max-width: 40rem) {
  .board-main { gap: 1.25rem; }
  .rail { grid-template-columns: 1fr; }
  .clock-card { grid-template-columns: auto auto; justify-content: space-between; align-items: baseline; }
  .clock-card .weather { grid-column: 1 / -1; }
  .clock { font-size: 1.75rem; }
  .tiles { gap: 0.5rem; }
  .tile { border-radius: var(--r); }
  .tile-main { gap: 0.6rem; min-height: 3.5rem; padding: 0.55rem 0.7rem 0.55rem 0.55rem; }
  .tile-glyph { width: 2.125rem; height: 2.125rem; }
  .tile-arrow, .tile-more { display: none; }
  .bar { flex-wrap: wrap; height: auto; padding-top: 0.5rem; padding-bottom: 0.5rem; row-gap: 0.5rem; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .hide-narrow { display: none; }
  .bar-actions .btn-signal span { display: none; }
  .bar-actions .btn-signal { width: 2.25rem; padding: 0; }
  .layout-banner { top: 6.25rem; }
  .board { padding: 0.75rem 0.75rem 6rem; }
  .panel-toggle { cursor: pointer; }
  .chev { display: block; color: var(--ink-3); transition: rotate 160ms var(--ease); }
  .panel.collapsed .chev { rotate: -90deg; }
  .panel.collapsed .rows, .panel.collapsed .row-empty { display: none; }
  .panel.collapsed .panel-head { height: 2.75rem; }
  .sheet-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92dvh; }
  .sheet { max-height: 92dvh; }
  .menu-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0 !important; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .menu-items button { height: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
