/* Device Logs — main console structure (see docs/ui-styleguide.md)
 *
 * Console chrome: app bar + labeled side nav + main. Components, shell and
 * breakpoints only: every color, font, radius and shadow comes from the skin
 * loaded after this sheet (skins/ui-default.css defines the contract).
 * Quiet neutral shell, one interaction blue, semantic color only on data.
 * Borders over shadows; shadows float only.
 */

/* -------------------------------------------------------------------------- */
/* Dimensions                                                                 */
/* -------------------------------------------------------------------------- */

:root {
  --appbar: 56px;
  --side: 208px;
  --dock: 56px;
  --pad: 24px;
  --gap: 16px;
}

/* -------------------------------------------------------------------------- */
/* Base                                                                       */
/* -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  min-height: 100%;
  font: var(--type-body);
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.t-caption { font: var(--type-caption); color: var(--muted); }
.t-body { font: var(--type-body); }
.t-heading { font: var(--type-heading); }
.t-title { font: var(--type-title); letter-spacing: -0.015em; }

a.link, .link {
  color: var(--accent-active);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font-weight: 500;
}
a.link:hover, .link:hover { text-decoration: underline; text-underline-offset: 3px; color: var(--accent-active); }

.grow { flex: 1; min-width: 8px; }
.cell-muted { color: var(--muted); }

/* Layout utilities — a closed list. Everything else is a component class;
   test/views/styleguide_conformance_test.rb rejects any other bare utility. */
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.gap-s { gap: 8px; }
.gap-m { gap: 16px; }
.gap-l { gap: 24px; }
.push { margin-left: auto; }
.nowrap { white-space: nowrap; }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-narrow { max-width: 640px; }

/* -------------------------------------------------------------------------- */
/* Buttons                                                                    */
/* -------------------------------------------------------------------------- */

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: var(--radius-sm);
  font: var(--type-btn);
  white-space: nowrap;
  text-decoration: none;
  flex: none;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}
.btn-primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); border-color: var(--accent-active); }
.btn-secondary {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: #bdc3ca; }
.btn-primary:disabled { background: var(--accent-disabled); border-color: var(--accent-disabled); cursor: not-allowed; }
.btn-secondary:disabled { color: var(--faint); cursor: not-allowed; }

/* -------------------------------------------------------------------------- */
/* Fields, badges, dots, toggle                                               */
/* -------------------------------------------------------------------------- */

.field {
  display: block;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
.field:hover { border-color: #bfc5cc; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus-ring); }
.field::placeholder { color: var(--faint); }
select.field { padding-right: 28px; }
textarea.field,
input[type="file"].field { height: auto; min-height: 38px; padding: 8px 12px; line-height: 22px; }
.field-narrow { width: 14rem; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--bg);
  color: var(--muted);
}
/* A type label can be a whole sentence; the badge stays one line and clips. */
.badge.truncate { display: inline-block; max-width: 16rem; line-height: 24px; }
.badge-ok { background: var(--ok-soft); color: var(--ok-deep); }
.badge-warn { background: var(--warn-soft); color: var(--warn-deep); }
.badge-down { background: var(--down-soft); color: var(--down-deep); }
.badge-info { background: var(--accent-soft); color: var(--accent-active); }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}
.dot.warn { background: var(--warn); }
.dot.down { background: var(--down); }
.dot.idle { background: var(--faint); }

.toggle {
  width: 40px;
  height: 22px;
  border-radius: 99px;
  background: var(--line-strong);
  border: 0;
  position: relative;
  flex: none;
  transition: background-color 150ms ease-out;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 28, 40, 0.24);
  transition: transform 150ms ease-out;
}
.toggle.is-on { background: var(--accent); }
.toggle.is-on::after { transform: translateX(18px); }

input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.check {
  width: 17px;
  height: 17px;
  border: 1px solid #b7bcc4;
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  flex: none;
  background: var(--surface);
}
.check.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.check.is-on::after {
  content: "";
  width: 8px;
  height: 5px;
  border: 2px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translate(0, -1px);
}

.search {
  display: flex;
  align-items: center;
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  gap: 8px;
  min-width: 0;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus-ring); }
.search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.search input { border: 0; background: transparent; outline: none; width: 100%; min-width: 0; }
.search input::placeholder { color: var(--faint); }

.seg {
  height: 36px;
  display: inline-flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 2px;
  flex: none;
}
.seg :is(button, a) {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0 12px;
  border-radius: 5px;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  white-space: nowrap;
  text-decoration: none;
}
.seg :is(button, a).is-on { background: var(--surface); color: var(--accent-active); box-shadow: var(--shadow-raise); }

.chips-time { display: flex; gap: 2px; flex: none; }
.chips-time button {
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
}
.chips-time button:hover { background: var(--bg-hover); color: var(--ink); }
.chips-time button.is-on { color: var(--accent-active); background: var(--accent-soft); }

.pill { display: inline-flex; gap: 2px; background: var(--bg); border-radius: var(--radius-sm); padding: 3px; }
.pill button { border: 0; background: transparent; padding: 4px 12px; border-radius: 5px; color: var(--muted); font-size: 15px; font-weight: 500; }
.pill button.is-on { background: var(--surface); color: var(--accent-active); box-shadow: var(--shadow-raise); }

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex: none;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.icon-btn:hover { background: var(--bg-hover); border-color: var(--line); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.is-on { color: var(--warn); }
.icon-btn.is-on svg { fill: currentColor; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(150deg, #16406f, #2ba0ac);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  flex: none;
}

/* -------------------------------------------------------------------------- */
/* Shell — quiet console chrome: app bar + side nav + main                    */
/* -------------------------------------------------------------------------- */

.app {
  display: grid;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}
.app[data-shell="dl"] {
  grid-template-columns: var(--side) minmax(0, 1fr);
  grid-template-rows: var(--appbar) minmax(0, 1fr);
}
.appbar {
  grid-column: 1 / -1;
  grid-row: 1;
  height: var(--appbar);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 14px 0 16px;
  gap: 8px;
  min-width: 0;
  z-index: 40;
}
.menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  place-items: center;
  flex: none;
}
.menu-btn svg { width: 20px; height: 20px; }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.04em;
  display: grid;
  place-items: center;
  flex: none;
}
.site-dd {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  flex: none;
  max-width: 16rem;
  overflow: hidden;
  white-space: nowrap;
}
.site-dd:hover { background: var(--bg-hover); }
.site-dd-name { overflow: hidden; text-overflow: ellipsis; }
.site-dd svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
[open] > .site-dd svg { transform: rotate(180deg); }
.apps {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 2px;
  min-width: 0;
  margin-left: 8px;
}
/* Product tabs: inline icon + label, blue underline on the active one. */
.app-ic {
  height: 100%;
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  padding: 0 11px;
  border-bottom: 2px solid transparent;
  font-size: 15px;
  font-weight: 500;
  flex: none;
  text-decoration: none;
}
.app-ic span { white-space: nowrap; }
.app-ic i {
  display: grid;
  place-items: center;
  color: inherit;
}
.app-ic i svg { width: 19px; height: 19px; }
.app-ic:hover { color: var(--ink); }
.app-ic.is-on { color: var(--accent-active); border-bottom-color: var(--accent); }
.app-ic.is-on i { color: var(--accent); }
/* A section with no pages yet: present in the menu, not a link. */
.app-ic.is-off, .nav-a.is-off, .menu-item.is-off { color: var(--faint); cursor: not-allowed; }
.app-ic.is-off:hover, .nav-a.is-off:hover, .menu-item.is-off:hover { background: none; border-bottom-color: transparent; color: var(--faint); }

.side {
  grid-column: 1;
  grid-row: 2;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px 0 16px;
  min-height: 0;
  overflow: auto;
}
.side .search { margin: 0 10px 12px; flex: none; }
/* The server renders the active section only, so there is nothing to switch. */
.nav-block { display: flex; flex-direction: column; gap: 2px; }
.nav-g {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px 6px;
}
.nav-a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 7px 10px;
  margin: 0 8px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 15px;
  border: 0;
  background: none;
  width: auto;
  text-align: left;
  text-decoration: none;
}
.nav-a svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav-a:hover { background: var(--bg-hover); }
.nav-a.is-on {
  background: var(--accent-soft);
  color: var(--accent-active);
  font-weight: 500;
}
.nav-a.is-on svg { color: var(--accent); }
.side-foot {
  margin-top: auto;
  padding: 16px 18px 0;
  color: var(--faint);
  font-size: 13px;
  line-height: 17px;
}

.main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: 20px 24px 32px;
  isolation: isolate;
}
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(24, 32, 44, 0.28);
  z-index: 20;
}
.dock {
  display: none;
  grid-column: 1 / -1;
  height: var(--dock);
  background: var(--surface);
  border-top: 1px solid var(--line);
  align-items: stretch;
  justify-content: space-around;
  padding: 0 8px;
}
.dock > a, .dock > span {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.dock > * svg { width: 21px; height: 21px; }
.dock > .is-on { color: var(--accent); }
.dock > .is-off { color: var(--faint); }

/* -------------------------------------------------------------------------- */
/* Page header                                                                */
/* -------------------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  flex: none;
}
.page-title {
  margin: 0;
  font: var(--type-title);
  letter-spacing: -0.015em;
  white-space: nowrap;
  flex: none;
}
.page-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.page-head .search {
  width: 260px;
  height: 36px;
  flex: none;
}

/* -------------------------------------------------------------------------- */
/* KPIs, panels, tables, settings                                             */
/* -------------------------------------------------------------------------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  flex: none;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}
.kpi-label { font: var(--type-label); color: var(--muted); }
.kpi-value { font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -0.01em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 14px; color: var(--muted); margin-top: 3px; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.panel-h {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 14px 16px;
  font: var(--type-heading);
}
.panel-h > svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.panel-h .page-actions,
.panel-h .link { margin-left: auto; }
.panel-h .t-caption { font-weight: 400; }
.panel-b { padding: 0 16px 16px; }
.panel-b.pad { padding: 16px; }

.table-wrap { overflow: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 15px;
}
table.data th {
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
table.data td {
  padding: 10px 12px;
  height: 42px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.cell-sub { font-size: 13px; color: var(--muted); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data tbody tr.is-on { background: var(--accent-soft); }
table.data tbody tr.is-clickable { cursor: pointer; }
table.data .name { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }

/* Mobile fleet list: pair a .only-desktop table panel with a .only-mobile .mlist
 * panel — the table never renders below 700px. */
.mlist { display: flex; flex-direction: column; }
.mrow { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; font-size: 15px; }
.mrow:last-child { border-bottom: 0; }
.mrow:hover { background: var(--bg-hover); }
.mrow .dot { flex: none; }
.mrow-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.mrow-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .badge { flex: none; }
.only-mobile { display: none; }

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.set-row:last-child { border-bottom: 0; }
.set-lab { display: flex; align-items: center; gap: 6px; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; color: var(--muted); font-size: 15px; }
.kv b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Label-over-value pairs — what a hydrated card or detail panel fills. */
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.kv-grid-wide { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.kv-val { font-weight: 500; font-size: 15px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kv-grid .kpi-label, .kv-grid .kv-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard-map { width: 100%; height: 112px; border: 0; border-radius: var(--radius-sm); }
.net-map { width: 100%; height: auto; }

.head-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.head-card .ico {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
  font-weight: 700;
  font-size: 12px;
}
.head-card .ico svg { width: 19px; height: 19px; }
.head-card .grow { font-weight: 500; min-width: 0; }

.stack { display: flex; flex-direction: column; gap: 16px; max-width: 880px; }

/* -------------------------------------------------------------------------- */
/* Banners                                                                    */
/* -------------------------------------------------------------------------- */

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  flex: none;
}
.banner > span { flex: 1; min-width: 0; }
.banner svg { width: 18px; height: 18px; flex: none; }
.banner.is-warn { background: var(--warn-soft); border-color: #f2d391; color: var(--ink); }
.banner.is-warn svg { color: var(--warn-deep); }
.banner.is-ok { background: var(--ok-soft); border-color: #b7e2c4; color: var(--ink); }
.banner.is-ok svg { color: var(--ok-deep); }
.banner.is-down { background: var(--down-soft); border-color: #efb9be; color: var(--ink); }
.banner.is-down svg { color: var(--down-deep); }

/* -------------------------------------------------------------------------- */
/* Modal                                                                      */
/* -------------------------------------------------------------------------- */

/* margin:auto is what centers a native dialog; without it the box pins to the
   viewport's top-left corner. */
.modal {
  width: min(26rem, calc(100vw - 32px));
  margin: auto;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-hover);
}
.modal-wide { width: min(40rem, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(24, 32, 44, 0.3); }
.modal-title { font: var(--type-title); letter-spacing: -0.015em; margin: 0 0 4px; }
.modal .form-actions { margin-top: 16px; }

/* -------------------------------------------------------------------------- */
/* Account menu (details[data-menu] in the app bar)                            */
/* -------------------------------------------------------------------------- */

.menu { position: relative; flex: none; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: 16rem;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-hover);
}
.menu-head { padding: 8px 10px 10px; }
.menu-head b { display: block; font-weight: 500; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  font-size: 15px;
  text-align: left;
  text-decoration: none;
}
.menu-item svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.menu-item:hover { background: var(--bg-hover); }
.menu-item.is-on { background: var(--accent-soft); color: var(--accent-active); }
.menu-item.is-on svg { color: var(--accent); }
.menu-item-danger { color: var(--down-deep); }
.menu-item-danger svg { color: var(--down-deep); }
.menu-item-danger:hover { background: var(--down-soft); color: var(--down-deep); }
.menu-sep { margin: 6px 4px; border-top: 1px solid var(--line); }
.menu form { display: block; }
.menu-list { max-height: 15rem; overflow-y: auto; }

/* -------------------------------------------------------------------------- */
/* Placeholders: loading, empty, raw text                                      */
/* -------------------------------------------------------------------------- */

.skeleton {
  display: block;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(100deg, var(--bg) 40%, var(--line) 50%, var(--bg) 60%);
  background-size: 200% 100%;
  animation: skeleton 1.2s linear infinite;
}
.skeleton-tall { height: 150px; }
.skeleton-half { width: 60%; margin-top: 8px; }
@keyframes skeleton { to { background-position: -200% 0; } }

.empty {
  padding: 40px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  font-size: 16px;
}
.panel-b > .empty, .panel-b.pad > .empty { border: 0; padding: 24px; }

.code-block,
.log-pre {
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 10px 12px;
  font-size: 15px;
  line-height: 22px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}
.code-block { max-height: 18rem; }
.log-pre { height: 14rem; }
@media (min-width: 640px) { .log-pre { height: 18rem; } }

code {
  background: var(--bg);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
}
details > summary { cursor: pointer; }
details[open] > summary { margin-bottom: 8px; }

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg);
  font-family: inherit;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}

/* -------------------------------------------------------------------------- */
/* Auth shell (login, password reset)                                          */
/* -------------------------------------------------------------------------- */

.auth {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px 16px;
  background: var(--bg);
}
.auth-card { width: min(24rem, 100%); box-shadow: 0 10px 30px rgba(23, 33, 46, 0.08); border-radius: 12px; }
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--line);
  font: var(--type-heading);
  font-size: 18px;
}
.auth-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.auth .btn-primary { width: 100%; height: 42px; }
.auth h2 { margin: 0; }

/* -------------------------------------------------------------------------- */
/* Charts                                                                     */
/* -------------------------------------------------------------------------- */

.metric { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.metric small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 5px; }

/* Standard readings chart: grey raw bars + accent line over a flat area,
 * horizontal gridlines with y labels, end dot + last-value chip.
 * Grid/labels/dot/chip are HTML overlays because the svg stretches (preserveAspectRatio none). */
.chart-area { position: relative; padding: 12px 4px 0; }
.chart-area svg { width: 100%; height: 150px; display: block; }
.c-bars { fill: var(--line); }
.c-area { fill: var(--accent); opacity: .12; }
.c-line { stroke: var(--accent); fill: none; stroke-width: 1.8; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.xlabels { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 6px 4px 2px; font-variant-numeric: tabular-nums; }
.ylab { position: absolute; left: 6px; margin-top: -16px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.enddot { position: absolute; right: 2px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.endchip { position: absolute; right: 14px; margin-top: -28px; font-size: 14px; font-weight: 600; color: var(--accent-active); background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------------------- */
/* Sensor cards                                                               */
/* -------------------------------------------------------------------------- */

.scard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); }

/* Feature card: blue line icon inline with a bold title, grey text.
 * For docs/help pages, empty states and feature grids — not for live device data. */
.fcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.fcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.fcard-h { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.fcard-h svg { width: 19px; height: 19px; color: var(--accent); flex: none; }
.fcard p { margin: 0; color: var(--muted); font-size: 15px; line-height: 21px; }
.scard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.scard:hover { border-color: var(--line-strong); box-shadow: var(--shadow-raise); }
.scard-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
/* The name owns the row; the type label gives way to it. */
.scard-h > :first-child { flex: 1; min-width: 0; }
.scard-h .badge { max-width: 9rem; }
.scard-name { font-weight: 500; font-size: 16px; }
.scard-val { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.scard-val small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.spark { width: 100%; height: 36px; }
.spark polygon { fill: var(--accent); opacity: .12; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.scard-mm { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scard-f { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.scard-f .name { display: inline-flex; align-items: center; gap: 6px; }

.prof2 { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.prof2 .col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.prof-card { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }
.prof-name { font-weight: 600; font-size: 18px; }
.prof-mail { color: var(--muted); font-size: 15px; }
.prof-kv { width: 100%; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 4px; text-align: left; }
.danger-strip { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-weight: 500; }
.link-danger { color: var(--down-deep); }
.link-danger:hover { color: var(--down-deep); }

/* -------------------------------------------------------------------------- */
/* Breakpoints                                                                */
/* -------------------------------------------------------------------------- */

@media (max-width: 1200px) {
  .kpis, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .app-ic span { display: none; }
  .app-ic { padding: 0 10px; }
}

@media (max-width: 900px) {
  .app[data-shell="dl"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--appbar) minmax(0, 1fr) var(--dock);
  }
  .app[data-shell="dl"] .side { display: none; }
  .app[data-shell="dl"] .main {
    grid-column: 1;
    grid-row: 2;
    padding: 16px 16px 24px;
  }
  .app[data-shell="dl"] .menu-btn { display: grid; }
  .app[data-shell="dl"] .apps { display: none; }
  .app[data-shell="dl"] .dock { display: flex; grid-row: 3; }
  .split, .form-grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .page-head { flex-wrap: wrap; }
  .page-head .search { width: 100%; }
  .page-actions { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .app[data-shell="dl"].is-nav .side {
    display: flex;
    position: fixed;
    top: var(--appbar);
    left: 0;
    bottom: var(--dock);
    width: min(var(--side), 86vw);
    z-index: 30;
    grid-column: auto;
    grid-row: auto;
  }
  .app[data-shell="dl"].is-nav .scrim { display: block; }
  .prof2 { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .only-desktop { display: none; }
  .only-mobile { display: block; }
}

@media (max-width: 600px) {
  .xlabels span:nth-child(even) { display: none; }
  .kpi-value { font-size: 24px; line-height: 30px; }
  .page-head .chips-time { margin-left: auto; }
}

/* Turbo Drive visit progress (the bar appears after 500 ms of a pending visit) */
.turbo-progress-bar { height: 2px; background: var(--accent); }
