/* ═══════════════════════════════════════════════════════════════════════
   Operator Dashboard — Marine dark theme
   Target: Garmin MFD (~1280×800), tablets, desktop browsers
   WebKit 601.1 (WPE) compatible — no CSS Grid, no CSS vars, webkit prefixes

   No flexbox `gap` either (unsupported until Safari 14.1 / WebKit's
   equivalent) — spacing uses the "owl" selector instead:
     .container > * + * { margin-left/margin-top: Npx; }
   For wrapping containers, `margin-left` on a wrapped item would still
   apply at the start of its new row, so those use the negative-margin
   trick instead:
     .container { margin: -Npx 0 0 -Npx; }
     .container > * { margin: Npx 0 0 Npx; }
   ═══════════════════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@font-face {
  font-family: "Vanquish Display";
  src: url("/static/fonts/VanquishDisplay-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Antarctica";
  src: url("/static/fonts/Antarctica-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: "Antarctica";
  src: url("/static/fonts/Antarctica-Black.otf") format("opentype");
  font-weight: 900;
  font-style: normal;
}

@font-face {
  font-family: "Antarctica";
  src: url("/static/fonts/Antarctica-BlackItalic.otf") format("opentype");
  font-weight: 900;
  font-style: italic;
}

@font-face {
  font-family: "Antarctica";
  src: url("/static/fonts/Antarctica-Condensed.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-stretch: condensed;
}

/* CSS custom properties kept for supporting browsers; hardcoded values used everywhere as fallback */
:root {
  /* Brand */
  --color-red: #f1331b;
  --color-burgundy: #540f0b;

  /* Neutrals */
  --color-black: #030303;
  --color-gray-1: #202020;
  --color-gray-2: #373737;
  --color-gray-3: #96958d;
  --color-gray-4: #cccac3;
  --color-gray-5: #e5e4dc;
  --color-gray-6: #f7f7f5;
  --color-white: #ffffff;

  /* Semantic mappings */
  --bg: #030303;
  --bg-tab-content: #141414;
  --bg-card: #0d0d0d;
  --bg-card-alt: #373737;
  --bg-card-border: #222;
  --border: #1e1e1e;
  --text: #ffffff;
  --text-dim: #96958d;
  --text-dim-alt: #555;
  --accent: #f1331b;
  --accent-glow: rgba(241, 51, 27, 0.25);
  --accent-tint: rgba(241, 51, 27, 0.05);
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f1331b;
  --orange: #db6d28;
  --gauge-track: #202020;
  --gauge-fill: #f1331b;
  --font: "Antarctica", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: "Vanquish Display", system-ui, sans-serif;
  --mono: "SF Mono", "Cascadia Mono", "Consolas", monospace;
}

html {
  width: 100%;
  height: 100%;
}

body {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #030303;
  background: var(--bg);
  color: #ffffff;
  color: var(--text);
  font-family:
    "Antarctica",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

title,
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Vanquish Display", system-ui, sans-serif;
  font-family: var(--font-heading);
}

/* Top level segments */

#app {
  display: none;
}

#app.active {
  display: flex;
  flex-direction: column;
  width: 1280px;
  height: 720px;
  flex: none;
  min-height: 0;
  /* 1280x720 = 16:9, matching every target Garmin panel (1280x720,
     1920x1080, 3840x2160). ui/app.js scales this uniformly to fit the
     physical screen; transform-origin center keeps it aligned with
     body's flex centering. */
  -webkit-transform-origin: center center;
  transform-origin: center center;
}

#serviceLogin {
  display: none;
}

#serviceLogin.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* -- Service Engineer Dashboard ------------------------------------- */
#serviceDashboard {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  flex-direction: column;
  background: #0f0f0f;
  color: #fff;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  overflow: hidden;
}

#serviceDashboard.active {
  display: flex;
}

.svc-header {
  display: flex;
  align-items: center;
  padding: 0 22px;
  height: 54px;
  background: #181818;
  border-bottom: 1.5px solid #2a2a2a;
  flex-shrink: 0;
}

.svc-header > * + * {
  margin-left: 14px;
}

.svc-logo {
  height: 30px;
  width: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

.svc-title {
  font-family: "Vanquish Display", system-ui, sans-serif;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  font-weight: 700;
}

.svc-title-sep {
  color: #333;
  font-size: 16px;
  font-weight: 300;
  margin: 0 2px;
}

.svc-subtitle {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #aaa;
}

.svc-spacer {
  flex: 1;
}

.svc-logout-btn {
  padding: 7px 20px;
  background: #222;
  border: 1px solid #383838;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  color: #ccc;
  transition: all 0.15s;
}

.svc-logout-btn:hover {
  background: #2a2a2a;
  color: #fff;
}

.svc-status-badge {
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: #999;
  text-transform: uppercase;
  background: #333;
}

.svc-status-badge.connecting,
.svc-status-badge.reconnecting {
  background: #e8a020;
  color: #111;
}

.svc-status-badge.connected {
  background: #3ecf6a;
  color: #111;
}

/* Tab nav */
.svc-tabbar {
  display: flex;
  background: #141414;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  padding: 0 18px;
}

.svc-tab {
  padding: 11px 22px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
  color: #666;
}

.svc-tab:hover {
  color: #bbb;
}

.svc-tab.active {
  color: #fff;
  border-bottom-color: #e8a020;
}

/* Pages */
.svc-page {
  display: none;
}

.svc-page.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* Live monitor toolbar */
.svc-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 18px;
  background: #141414;
  border-bottom: 1px solid #202020;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin-top: -10px;
  margin-left: -10px;
}

.svc-toolbar > * {
  margin-top: 10px;
  margin-left: 10px;
}

.svc-filter-group {
  display: flex;
  align-items: center;
}

.svc-filter-group > * + * {
  margin-left: 8px;
}

.svc-filter-label {
  font-size: 10px;
  font-weight: 800;
  color: #555;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.svc-input {
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  color: #ccc;
  font-size: 12px;
  padding: 5px 10px;
  outline: none;
  font-family: inherit;
}

.svc-input--pgn {
  width: 100px;
}

.svc-input--src {
  width: 80px;
}

.svc-input--name {
  width: 120px;
}

.svc-vdivider {
  width: 1px;
  height: 22px;
  background: #252525;
  flex-shrink: 0;
}

.svc-btn {
  padding: 5px 14px;
  background: #1e1e1e;
  border: 1px solid #2e2e2e;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  color: #aaa;
  letter-spacing: 0.04em;
}

.svc-btn:hover {
  background: #262626;
}

.svc-msg-count {
  font-size: 10px;
  color: #3a3a3a;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Sub-header */
.svc-subheader {
  display: flex;
  align-items: center;
  padding: 5px 18px;
  background: #111;
  border-bottom: 1px solid #1c1c1c;
  flex-shrink: 0;
}

.svc-subheader > * + * {
  margin-left: 10px;
}

.svc-subheader-label {
  font-size: 10px;
  font-weight: 800;
  color: #aaa;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.svc-subheader-label--push {
  margin-right: auto;
}

.svc-pgn-count {
  font-size: 10px;
  color: #383838;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
}

.svc-mini-divider {
  width: 1px;
  height: 16px;
  background: #222;
  margin-left: 4px;
}

.svc-mini-btn {
  padding: 3px 10px;
  background: #181818;
  border: 1px solid #222;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  color: #555;
  letter-spacing: 0.04em;
}

.svc-mini-btn:hover {
  background: #1e1e1e;
}

/* Split panel */
.svc-split {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.svc-table-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1c1c1c;
  overflow: hidden;
}

/* Live data table — real <table> markup (mirrors the engineer dashboard's
   .data-table exactly) so columns are sized by the browser's table layout
   instead of a hand-tuned CSS-grid that drifted out of sync with the
   header. table-layout: fixed + explicit per-column widths keep header
   and body cells aligned; the Fields column is the only unconstrained
   one, so it absorbs the remaining width instead of overflowing. */
.svc-table-body {
  flex: 1;
  background: #090909;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
  font-family: var(--mono);
  font-size: 11px;
}

.data-table th:nth-child(1),
.data-table td:nth-child(1) {
  width: 70px;
}

/* PGN */
.data-table th:nth-child(2),
.data-table td:nth-child(2) {
  width: 22%;
}

/* Name */
.data-table th:nth-child(3),
.data-table td:nth-child(3) {
  width: 60px;
}

/* Rate */
.data-table th:nth-child(4),
.data-table td:nth-child(4) {
  width: 55px;
}

/* Src */
.data-table th:nth-child(5),
.data-table td:nth-child(5) {
  width: 75px;
}

/* Instance */
.data-table th:nth-child(6),
.data-table td:nth-child(6) {
  width: auto;
}

/* Fields — flexible */
.data-table th:nth-child(7),
.data-table td:nth-child(7) {
  width: 110px;
}

/* Last Seen */

.data-table thead th {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  padding: 7px 10px;
  background: #0d0d0d;
  border-bottom: 1px solid #1c1c1c;
  font-size: 9px;
  font-weight: 800;
  color: #383838;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 6px 10px;
  font-size: 11px;
  color: #ccc;
  border-bottom: 1px solid #141414;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table tbody tr.stale-row td {
  opacity: 0.35;
}

.data-table .empty-state {
  text-align: center;
  padding: 40px 0 !important;
  font-size: 11px;
  font-style: normal;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Device Registry table — same .data-table markup as the Live Monitor
   PGN table, but a plainer/lighter look: sans-serif instead of mono,
   bolder header row, zebra-striped body rows, evenly-split fixed columns.
   .device-body is the scrolling viewport (bus can list 50+ devices) —
   the table itself sizes to its rows instead of stretching to fill it. */

.device-body {
  flex: 1;
  background: #060606;
  overflow-y: auto;
  min-height: 0;
}

.empty-state--registry {
  text-align: center;
  padding: 40px 0 !important;
  font-size: 11px;
  font-style: normal;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.data-table--registry {
  table-layout: fixed;
  font-family:
    "Antarctica",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-family: var(--font);
  font-size: 12px;
  text-align: left;
  width: 100%;
}

/* 8 even columns — Name gets a little extra room, Address a little less */
.data-table--registry th,
.data-table--registry td {
  width: 12.5%;
}

.data-table--registry th:nth-child(1),
.data-table--registry td:nth-child(1) {
  width: 5%;
}

.data-table--registry th:nth-child(2),
.data-table--registry td:nth-child(2) {
  width: 20%;
}

.data-table--registry thead th {
  padding: 6px 10px;
  background: #141414;
  font-size: 10px;
  font-weight: 800;
  color: #96958d;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.data-table--registry tbody td {
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table--registry tbody tr:nth-child(even) td {
  background: #0d0d0d;
}

.data-table--registry tbody tr:nth-child(odd) td {
  background: #060606;
}

/* Message log — same structure/classes as the engineer dashboard's
   .msg-log, restyled to match the dark svc theme. */
.msg-log {
  width: 420px;
  flex-shrink: 0;
  overflow-y: auto;
  background: #090909;
  padding: 4px 10px;
  font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
}

.msg-log.hidden {
  display: none;
}

.msg-log .log-entry {
  padding: 3px 0;
  border-bottom: 1px solid #141414;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-log .log-ts {
  color: #555;
  margin-right: 6px;
}

.msg-log .log-pgn {
  color: #e8a020;
  font-weight: 600;
  margin-right: 6px;
}

.msg-log .log-name {
  color: #ccc;
  margin-right: 6px;
}

.msg-log .log-src {
  color: #555;
  margin-right: 6px;
}

.msg-log .log-fields {
  color: #ccc;
}

/* Settings page — vessel configuration editor */
.svc-settings-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 18px;
  background: #141414;
  border-bottom: 1px solid #202020;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin-top: -10px;
  margin-left: -10px;
}

.svc-settings-toolbar > * {
  margin-top: 10px;
  margin-left: 10px;
}

.svc-settings-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ccc;
}

.svc-btn--accent {
  background: #f1331b;
  border-color: #f1331b;
  color: #fff;
}

.svc-btn--accent:hover {
  background: #d42912;
}

.svc-settings-status {
  padding: 6px 18px;
  font-size: 11px;
  font-weight: 700;
  color: #444;
  flex-shrink: 0;
  min-height: 15px;
}

.svc-settings-status.loading {
  color: #e8a020;
}

.svc-settings-status.success {
  color: #3ecf6a;
}

.svc-settings-status.error {
  color: #f1331b;
}

.svc-settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.svc-settings-body > * + * {
  margin-top: 16px;
}

.svc-settings-card {
  background: #111;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  padding: 14px 16px;
  flex-shrink: 0;
}

.svc-settings-card-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 12px;
}

.svc-settings-field-row {
  display: flex;
  margin-bottom: 8px;
}

.svc-settings-field-row > * + * {
  margin-left: 24px;
}

.svc-settings-field-row:last-child {
  margin-bottom: 0;
}

.svc-settings-field {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.svc-settings-field > * + * {
  margin-left: 12px;
}

.svc-settings-field label {
  width: 110px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #777;
  letter-spacing: 0.04em;
}

.svc-input--wide {
  flex: 1;
  width: 100%;
}

/* No CSS Grid on this target: repeat(5, 1fr) approximated with
   flex-wrap + the negative-margin trick (see file header). */
.svc-settings-pages {
  display: flex;
  flex-wrap: wrap;
  margin-top: -8px;
  margin-left: -8px;
}

.svc-settings-pages > * {
  width: calc(20% - 8px);
  margin-top: 8px;
  margin-left: 8px;
}

.svc-page-toggle {
  display: flex;
  flex-direction: column;
  background: #0d0d0d;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  padding: 12px;
}

.svc-page-toggle > * + * {
  margin-top: 10px;
}

.svc-page-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.svc-page-toggle-header > * + * {
  margin-left: 10px;
}

.svc-page-toggle-key {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: #777;
  font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.svc-page-toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
}

.svc-page-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.svc-page-toggle-slider {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #2a2a2a;
  border-radius: 18px;
  transition: background 0.15s;
  cursor: pointer;
}

.svc-page-toggle-slider::before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 2px;
  top: 2px;
  background: #888;
  border-radius: 50%;
  transition:
    transform 0.15s,
    background 0.15s;
}

.svc-page-toggle-switch input:checked + .svc-page-toggle-slider {
  background: #2d5a34;
}

.svc-page-toggle-switch input:checked + .svc-page-toggle-slider::before {
  transform: translateX(16px);
  background: #3ecf6a;
}

.svc-settings-images {
  display: flex;
  flex-wrap: wrap;
  margin-top: -12px;
  margin-left: -12px;
}

.svc-settings-images > * {
  margin-top: 12px;
  margin-left: 12px;
}

.svc-image-card {
  width: 140px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #0d0d0d;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  padding: 8px;
}

.svc-image-card > * + * {
  margin-top: 6px;
}

.svc-image-thumb {
  width: 100%;
  height: 84px;
  flex-shrink: 0;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.svc-image-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.svc-image-thumb--broken .svc-image-thumb-img {
  display: none;
}

.svc-image-thumb--broken::after {
  content: "Broken";
  font-size: 10px;
  color: #f1331b;
}

.svc-image-thumb-empty {
  font-size: 10px;
  color: #555;
  letter-spacing: 0.04em;
}

.svc-image-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.svc-image-info > * + * {
  margin-top: 2px;
}

.svc-image-key {
  font-size: 11px;
  color: #999;
  font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
  font-family: var(--mono);
}

.svc-image-path {
  font-size: 10px;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.svc-image-actions {
  display: flex;
}

.svc-image-actions > * + * {
  margin-left: 6px;
}

.svc-image-actions .svc-mini-btn {
  flex: 1;
  text-align: center;
}

.svc-settings-colors {
  display: flex;
  flex-wrap: wrap;
  margin-top: -12px;
  margin-left: -12px;
}

.svc-settings-colors > * {
  margin-top: 12px;
  margin-left: 12px;
}

.svc-color-card {
  width: 84px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0d0d0d;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  padding: 8px;
}

.svc-color-card > * + * {
  margin-top: 6px;
}

.svc-color-card--active {
  border-color: var(--accent, #f1331b);
}

.svc-color-swatch {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
  cursor: pointer;
  position: relative;
}

.svc-color-check {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.svc-color-card--active .svc-color-check {
  display: flex;
}

.svc-color-label {
  font-size: 10px;
  color: #777;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
  font-family: var(--mono);
}

.svc-color-hex {
  width: 100%;
  text-align: center;
  font-size: 10px;
  padding: 4px 2px;
  text-transform: lowercase;
}

/* Stub pages */
.svc-stub {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.svc-stub > * + * {
  margin-top: 10px;
}

.svc-stub-title {
  font-size: 12px;
  color: #2a2a2a;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}

.svc-stub-sub {
  font-size: 11px;
  color: #1e1e1e;
}

/* Stats page */
.svc-stats-busload {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
  font-family: var(--mono);
}

.svc-stats-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.svc-stats-summary:empty::before {
  content: "No summary data";
  color: #555;
  font-size: 12px;
}

.svc-stat-tile {
  display: flex;
  flex-direction: column;
  background: #171717;
  border: 1px solid #232323;
  border-radius: 6px;
  padding: 8px 12px;
  min-width: 100px;
}

.svc-stat-tile-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #777;
}

.svc-stat-tile-value {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
  font-family: var(--mono);
}

.data-table--stats {
  width: 100%;
  border-collapse: collapse;
}

.data-table--stats th,
.data-table--stats td {
  text-align: left;
  padding: 6px 10px;
  font-size: 12px;
  border-bottom: 1px solid #1e1e1e;
}

.data-table--stats thead th {
  color: #777;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

/* -- Basic stylings ------------------------------------------------------- */
.text-center {
  -webkit-justify-content: center;
  justify-content: center;
}

.divider {
  height: 32px;
  flex-shrink: 0;
  background: #1e1e1e;
  background: var(--border);
  width: 1px;
}

.spacer {
  flex: 1;
}

/* -- Layout - Header - Branding ------------------------------------- */
header {
  display: flex;
  align-items: center;
  padding: 0 28px;
  height: 58px;
  background: #0d0d0d;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

header > * + * {
  margin-left: 20px;
}

.brand_mark {
  display: flex;
  align-items: center;
}

.brand_mark > * + * {
  margin-left: 10px;
}

.brand_mark img {
  height: 36px;
  width: 36px;
  object-fit: contain;
  flex-shrink: 0;
  cursor: pointer;
  touch-action: none;
}

.vessel_name {
  font-family: "Vanquish Display", system-ui, sans-serif;
  font-size: 18px;
  color: var(--text, #fff);
  letter-spacing: 0.06em;
}

.vessel_subtitle {
  font-family: "Vanquish Display", system-ui, sans-serif;
  font-size: 18px;
  color: var(--text-dim-alt, #555);
  letter-spacing: 0.06em;
  border-left: 1px solid var(--border, #2a2a2a);
  border-style: none;
}

/* -- Layout - Header - audio controls -------------------------------------------- */
.audio_controls {
  display: flex;
  align-items: center;
  background: #161616;
  border: 1px solid #222;
  border-radius: 20px;
  padding: 4px 8px;
}

.audio_controls > * + * {
  margin-left: 4px;
}

.prev_button,
.next_button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #555;
}

.volume_up_button,
.volume_down_button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mute_button {
  height: 28px;
  padding: 0 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #202020;
  background: var(--color-gray-1);
  border: 1px solid var(--mute-border, #555);
  transition: all 0.15s;
}

.mute_button > * + * {
  margin-left: 5px;
}

.mute_button:hover {
  background: var(--color-gray-2, #2a2a2a);
  border-color: var(--mute-hover-border, #777);
}

.mute_label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim, #96958d);
}

.volume_bar {
  width: 64px;
  height: 4px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
  margin: 0 4px;
}

.volume_bar_fill {
  height: 100%;
  background: #96958d;
  border-radius: 2px;
  transition: width 0.15s;
}

/* -- Layout - Header - Clock ----------------------------------------- */
.clock {
  text-align: center;
}

.clock_time {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  line-height: 1;
}

.clock_date {
  font-size: 10px;
  color: #96958d;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* -- Layout - Header - Wiper controls -------------------------------- */
.wiper_controls {
  display: flex;
  align-items: center;
}

.wiper_controls > * + * {
  margin-left: 10px;
}

.washer_button {
  height: 28px;
  padding: 0 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #202020;
  background: var(--color-gray-1);
  border: 1px solid var(--washer-border, #555);
  color: #555;
  transition: all 0.15s;
}

.washer_button > * + * {
  margin-left: 5px;
}

.washer_button:hover {
  background: var(--color-gray-2, #2a2a2a);
  border-color: var(--washer-hover-border, #777);
}

.washer_label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.wiper_mode_selector {
  display: flex;
  background: #161616;
  border: 1px solid #2a2a2a;
  border-radius: 18px;
  padding: 3px;
}

.wiper_mode_selector > * + * {
  margin-left: 1px;
}

.wiper_mode_button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 13px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  color: #555;
  cursor: pointer;
  letter-spacing: 0.05em;
  border: 2px solid transparent;
  transition: all 0.15s;
}

.wiper_mode_button.active {
  border-color: var(--accent, #f1331b);
  color: var(--accent, #f1331b);
  opacity: 0.8;
}

/* -- Layout - Main - General ----------------------------------------- */

main {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* -- Layout - Main - Content pages ----------------------------------------- */

.content_page {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 588px;
  overflow: hidden;
  padding: 18px 24px 20px;
}

.content_page > * + * {
  margin-top: 14px;
}

.content_page.active {
  display: flex;
}

/* -- Layout - Main - Main Switch ----------------------------------------- */

.main_content > .top_section {
  width: 1232px;
  height: 435px;
  flex-shrink: 0;
  display: flex;
}

.main_content > .top_section > * + * {
  margin-left: 16px;
}

.image_main {
  width: 916px;
  height: 435px;
  flex-shrink: 0;
  background: #0d0d0d;
  background: var(--bg-card);
  border: 1px solid #1e1e1e;
  border: 1px solid var(--border);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vessel_image {
  max-width: 95%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.right_panel {
  width: 300px;
  height: 435px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.right_panel > * + * {
  margin-top: 12px;
}

.system_state {
  flex-shrink: 0;
  background: #0d0d0d;
  background: var(--bg-card);
  border: 1px solid #1e1e1e;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.battery_status {
  height: 304px;
  flex-shrink: 0;
  background: #0d0d0d;
  background: var(--bg-card);
  border: 1px solid #1e1e1e;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.right_panel .label {
  font-size: 10px;
  color: #555;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 12px;
}

.system_state .state_items {
  display: flex;
  flex-direction: column;
}

.system_state .state_items > * + * {
  margin-top: 9px;
}

.system_state .state_items .state_item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.state_item_label {
  font-size: 13px;
  color: var(--text-dim, #96958d);
}

.state_item_value {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 8px;
}

.state_item_value.ok {
  color: var(--green, #3fb950);
  background: rgba(63, 185, 80, 0.1);
}

.state_item_value.notok {
  color: var(--red, #f1331b);
  background: rgba(255, 59, 33, 0.301);
}

.battery_items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  align-content: start;
}

.battery_item {
  min-width: 0;
}

.battery_item_header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.battery_item_name {
  font-size: 12px;
  color: #96958d;
}

.battery_item_pct {
  font-size: 12px;
  font-weight: 700;
  color: #3fb950;
}

.battery_item_bar {
  height: 5px;
  background: #373737;
  border-radius: 3px;
  overflow: hidden;
}

.battery_item_bar_fill {
  height: 100%;
  background: #3fb950;
  border-radius: 3px;
}

.battery_item_meta {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  font-size: 12px;
}

.battery_item_voltage {
  color: #555;
  white-space: nowrap;
}

.battery_item_amperage {
  color: #555;
  white-space: nowrap;
}

.battery_item_temperature {
  color: #555;
  white-space: nowrap;
}

/* -- Layout - Main - Action buttons ----------------------------------------- */

.action_buttons_row {
  display: flex;
  width: 1232px;
  height: 101px;
  flex-shrink: 0;
}

.action_buttons_row > * + * {
  margin-left: 10px;
}

.action_button {
  width: 197px;
  flex-shrink: 0;
  background: #141414;
  border: 1.5px solid #222;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #555;
  transition: all 0.15s;
}

.action_button > * + * {
  margin-top: 7px;
}

.action_button:active,
.action_button.active {
  background: var(--accent-tint, rgba(241, 51, 27, 0.05));
  border-color: var(--accent, #f1331b);
  color: var(--accent, #f1331b);
}

.action_button_label {
  font-size: 11px;
  font-weight: 700;
  color: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.action_button_sublabel {
  font-size: 10px;
  color: #555;
}

/* -- Layout - Lights - main ----------------------------------------- */
.lights_content > .top_section {
  width: 1232px;
  height: 35px;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}

.lights_content > .top_section > * + * {
  margin-left: 6px;
}

.lights_content > .mid_section {
  width: 1232px;
  height: 501px;
  flex-shrink: 0;
  display: flex;
}

/* ui/lights.js builds one .buttons panel per zone inside this wrapper —
   display: contents lets those panels lay out as direct flex children of
   .mid_section (next to .lights_vessel), same as before this was dynamic. */
.lights_zone_panels {
  display: contents;
}

/* .lights_content>.mid_section>*+* {
  margin-left: 14px;
} */

.lights_vessel {
  width: 948px;
  height: 501px;
  flex-shrink: 0;
  background: #0d0d0d;
  background: var(--bg-card);
  border: 1px solid #1e1e1e;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lights_vessel_image {
  max-width: 90%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.top_section ul {
  display: flex;
  list-style: none;
}

.top_section ul > * + * {
  margin-left: 22px;
}

.top_section ul li {
  padding: 8px 22px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: #141414;
  border: 1.5px solid #222;
  transition: all 0.15s;
}

.top_section ul li:active,
.top_section ul li.active {
  background: var(--accent-tint, rgba(241, 51, 27, 0.05));
  border-color: var(--accent, #f1331b);
  color: var(--accent, #f1331b);
}

.buttons {
  width: 270px;
  background: #141414;
  border: 1.5px solid #222;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.buttons .toggle_row:last-child {
  border-bottom: none;
}

/* Lights: one .buttons container per zone; the data-zone sub-tabs pick one */
.lights_content .buttons {
  display: none;
}

.lights_content .buttons.active {
  display: flex;
}

/* Equipment: zone heading above its toggle rows */
.buttons .zone_label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #96958d;
  margin: 10px 0 4px;
}

/* -- Layout - equipment - main ----------------------------------------- */
/* -- Layout - tanks - main ----------------------------------------- */

.tanks_content {
  flex-direction: row;
}

.tanks_content > * + * {
  margin-top: 0;
  margin-left: 14px;
}

.tanks_content .label {
  font-size: 10px;
  color: #555;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 10px;
}

/* -- Layout - tanks - pumps ----------------------------------------- */

/* Panel box + row styling come from the shared .buttons component */
.pumps_panel {
  flex-shrink: 0;
}

/* Segmented mode selector (bilge pump Off/Auto/On, generator autostart
   Manual/Auto, ...) — JS moves .active between the buttons */
.segment_selector {
  display: flex;
  background: #0d0d0d;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 2px;
}

.segment_selector > * + * {
  margin-left: 1px;
}

.segment_button {
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
}

.segment_button.active {
  background: var(--accent, #f1331b);
  color: #fff;
}

/* Read-only mode indicators (bilge pump Off/Auto/On lamps) — status only,
   the toggle_switch button in the same row sends the actual command */
.indicator_lamps {
  display: flex;
  background: #0d0d0d;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 2px;
}

.indicator_lamps > * + * {
  margin-left: 1px;
}

.indicator_lamp {
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
  color: #555;
  transition: all 0.15s;
}

.indicator_lamp.active {
  background: var(--accent, #f1331b);
  color: #fff;
}

.indicator_row {
  align-items: center;
}

.indicator_row > * + * {
  margin-left: 8px;
}

/* Cycle button (bilge pump mode advance) — round push-button, distinct
   from the on/off .toggle_switch slider. The device advances its own
   Off/Auto/On state, so this only flashes to confirm the press was sent;
   the indicator lamps show the actual mode. */
.cycle_button {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #373737;
  border-radius: 50%;
  background: #1a1a1a;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.cycle_button::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.15s;
}

.cycle_button:active::after,
.cycle_button.pressed::after {
  background: var(--accent, #f1331b);
}

/* -- Layout - tanks - levels ----------------------------------------- */

.tanks_right {
  width: 948px;
  height: 550px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.tanks_right > * + * {
  margin-top: 14px;
}

.tank_levels {
  height: 268px;
  flex-shrink: 0;
  background: #141414;
  border: 1.5px solid #222;
  border-radius: 12px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tank_rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.tank_row {
  display: flex;
  flex-direction: column;
}

.tank_row > * + * {
  margin-top: 6px;
}

.tank_row_header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tank_name {
  font-size: 13px;
  color: #ccc;
  font-weight: 600;
}

.tank_row_status {
  display: flex;
  align-items: center;
}

.tank_row_status > * + * {
  margin-left: 10px;
}

/* Status badge — JS swaps ok/low/high per tank thresholds,
   e.g. fresh water <30% → low, waste water >80% → high */
.tank_badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 9px;
  border-radius: 8px;
  /* neutral until live data arrives; ok/low/high override */
  color: #555;
  background: #1a1a1a;
}

.tank_badge.ok {
  color: #3fb950;
  background: rgba(63, 185, 80, 0.1);
}

.tank_badge.low {
  color: #d29922;
  background: rgba(210, 153, 34, 0.12);
}

.tank_badge.high {
  color: #e5534b;
  background: rgba(229, 83, 75, 0.12);
}

.tank_pct {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  width: 52px;
  text-align: right;
}

.tank_pct_unit {
  font-size: 12px;
  color: #555;
  font-weight: 400;
  margin-left: 2px;
}

.tank_bar {
  height: 26px;
  background: #0d0d0d;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.tank_bar_fill {
  height: 100%;
  border-radius: 5px;
}

.tank_bar_note {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #555;
}

/* Per-tank fill and note colors */
.tank_row.fresh .tank_bar_fill {
  background: linear-gradient(90deg, #1249a0, #2a6fdb);
}

.tank_row.fresh .tank_bar_note {
  color: #2a6fdb;
}

.tank_row.waste .tank_bar_fill {
  background: linear-gradient(90deg, #1e3a1e, #2d5a2d);
}

.tank_row.fuel .tank_bar_fill {
  background: linear-gradient(90deg, #7a4200, #e8a020);
}

.tank_row.fuel .tank_bar_note {
  color: #e8a020;
}

.tank_divider {
  height: 1px;
  flex-shrink: 0;
  background: #1a1a1a;
}

/* -- Layout - tanks - vessel view ----------------------------------------- */

.tanks_vessel {
  width: 948px;
  height: 268px;
  flex-shrink: 0;
  background: #0a0a0a;
  border: 1px solid #1e1e1e;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tanks_vessel_label {
  position: absolute;
  top: 12px;
  left: 16px;
  font-size: 10px;
  color: #333;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.tanks_vessel_image {
  max-width: 92%;
  max-height: 88%;
  object-fit: contain;
}

/* -- Layout - moving - main ----------------------------------------- */
/* -- Layout - hvac - main ----------------------------------------- */
/* -- Layout - alarms - main (AMS-style alert list) ------------------ */
.content_page .alarms_container {
  width: 1232px;
  height: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.alarms_container > * + * {
  /* margin-top: 12px; */
}

/* Summary strip — active/silenced/ack/total tiles */
.alert_summary_strip {
  display: flex;
  flex-shrink: 0;
}

.alert_summary_strip > * + * {
  margin-left: 10px;
}

.alert_summary_tile {
  flex: 1;
  background: #141414;
  border: 1.5px solid #222;
  border-radius: 12px;
  padding: 12px 16px;
}

.alert_summary_value {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.alert_summary_label {
  font-size: 10px;
  color: #555;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 6px;
}

.alert_summary_tile.tile_active .alert_summary_value {
  color: var(--red, #f1331b);
}

.alert_summary_tile.tile_silenced .alert_summary_value {
  color: var(--yellow, #d29922);
}

.alert_summary_tile.tile_ack .alert_summary_value {
  color: var(--green, #3fb950);
}

/* Table panel */
.alarms_table_panel {
  flex: 1;
  min-height: 0;
  background: var(--bg-tab-content, #0d0d0d);
  border: 1.5px solid var(--border, #222);
  border-radius: 12px;
  overflow-y: auto;
  margin-top: 14px;
}

.alert_table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

/* Severity */
.alert_table th:nth-child(1),
.alert_table td:nth-child(1) {
  width: 135px;
}

/* ID */
.alert_table th:nth-child(2),
.alert_table td:nth-child(2) {
  width: 46px;
}

/* Description — flexible */
.alert_table th:nth-child(3),
.alert_table td:nth-child(3) {
  width: auto;
}

/* Location */
.alert_table th:nth-child(4),
.alert_table td:nth-child(4) {
  width: 130px;
}

/* Category */
.alert_table th:nth-child(5),
.alert_table td:nth-child(5) {
  width: 120px;
}

/* State */
.alert_table th:nth-child(6),
.alert_table td:nth-child(6) {
  width: 130px;
}

/* Actions */
.alert_table th:nth-child(7),
.alert_table td:nth-child(7) {
  width: 90px;
}

.alert_table thead th {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  padding: 10px 14px;
  background: #141414;
  border-bottom: 1px solid #222;
  font-size: 10px;
  font-weight: 800;
  color: #555;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.alert_table tbody td {
  padding: 9px 14px;
  color: #ccc;
  border-bottom: 1px solid #1a1a1a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert_table tbody tr:hover td {
  background: #131313;
}

.alert_table .empty-state {
  text-align: center;
  padding: 40px 0 !important;
  font-size: 11px;
  color: var(--text-dim, #96958d);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Severity cell — colored dot + label, left border strip on the row
   signals severity at a glance, AMS-style. Flex layout is scoped to the
   body cell only — applying it to the sticky th breaks its stickiness. */
.alert_table tbody td.alert_severity_cell {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.alert_severity_dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 8px;
  background: #555;
}

.alert_row.sev_emergency td.alert_severity_cell {
  border-left: 3px solid var(--red, #f1331b);
}

.alert_row.sev_emergency .alert_severity_dot {
  background: var(--red, #f1331b);
  box-shadow: 0 0 6px rgba(241, 51, 27, 0.7);
}

.alert_row.sev_alarm td.alert_severity_cell {
  border-left: 3px solid var(--red, #f1331b);
}

.alert_row.sev_alarm .alert_severity_dot {
  background: var(--red, #f1331b);
}

.alert_row.sev_warning td.alert_severity_cell {
  border-left: 3px solid var(--yellow, #d29922);
}

.alert_row.sev_warning .alert_severity_dot {
  background: var(--yellow, #d29922);
}

.alert_row.sev_caution td.alert_severity_cell {
  border-left: 3px solid #4a90d9;
}

.alert_row.sev_caution .alert_severity_dot {
  background: #4a90d9;
}

.alert_row.sev_other td.alert_severity_cell {
  border-left: 3px solid #373737;
}

.alert_id_cell {
  color: #555;
  font-variant-numeric: tabular-nums;
}

.alert_desc_cell {
  color: #fff;
  font-weight: 600;
}

.alert_location_cell,
.alert_category_cell {
  color: #96958d;
}

.alert_time_cell {
  color: #555;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

/* State pill */
.alert_state_pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #999;
  background: #1a1a1a;
}

.alert_state_pill.state_active {
  color: var(--red, #f1331b);
  background: rgba(241, 51, 27, 0.12);
}

.alert_state_pill.state_silenced {
  color: var(--yellow, #d29922);
  background: rgba(210, 153, 34, 0.12);
}

.alert_state_pill.state_ack {
  color: var(--green, #3fb950);
  background: rgba(63, 185, 80, 0.1);
}

.alert_state_pill.state_normal,
.alert_state_pill.state_disabled {
  color: #555;
  background: #161616;
}

.alert_state_pill.state_stale {
  color: #96958d;
  background: #1a1a1a;
  margin-left: 6px;
}

.alert_ack_cell {
  color: #96958d;
  font-size: 11px;
}

.alert_actions_cell {
  white-space: nowrap;
}

.alert_action_btn {
  display: inline-block;
  margin-right: 6px;
  padding: 4px 10px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #1a1a1a;
  color: #ccc;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.alert_action_btn:active {
  background: #262626;
}

.alert_action_btn:disabled,
.alert_action_btn.pending {
  color: #666;
  border-color: #262626;
  background: #141414;
}

.alert_action_btn.err {
  border-color: var(--red, #f1331b);
  color: var(--red, #f1331b);
}

/* -- Layout - power - main ----------------------------------------- */
.power_content {
  flex-direction: column;
}

/* top row — full width automatically */
.power-flow {
  width: 1232px;
  height: 346px;
  flex-shrink: 0;
  background: #141414;
  border: 1.5px solid #222;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.power-input,
.power-output {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.power-input > * + *,
.power-output > * + * {
  margin-top: 4px;
}

.power-output {
  align-items: flex-end;
  text-align: right;
}

.power_flow_label {
  font-size: 10px;
  color: #555;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 8px;
}

.power_flow_source_label {
  font-size: 12px;
  color: #555;
}

.power_flow_source_value {
  font-size: 16px;
  font-weight: 700;
  color: #ccc;
  margin-bottom: 6px;
}

.power_flow_metric_label {
  font-size: 11px;
  color: #555;
  margin-top: 6px;
  margin-bottom: 2px;
}

.power_flow_metric_value {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.power_flow_unit {
  font-size: 18px;
  font-weight: 400;
  color: #555;
  margin-left: 4px;
}

.power_flow_charger,
.power_flow_inverter {
  flex: 1;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
}

.power_flow_charger.present,
.power_flow_inverter.present {
  visibility: visible;
}

.power_flow_icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.power_flow_icon svg {
  display: block;
  max-width: 100%;
}

/* Charger/inverter center box */
.power-charger {
  display: flex;
  flex-direction: column;
  background: #141414;
  width: 370px;
  height: 300px;
  flex-shrink: 0;
  border: 1.5px solid #222;
  border-radius: 12px;
  padding: 20px 22px;
}

.power_ci_row {
  display: flex;
  flex: 1;
  min-height: 0;
}

.power_ci_row > * + * {
  margin-left: 24px;
  padding-left: 24px;
  border-left: 1px solid #222;
}

.power_ci_col {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.power_ci_title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-transform: capitalize;
  margin-bottom: 14px;
}

.power_ci_items {
  display: flex;
  flex-direction: column;
}

.power_ci_items > * + * {
  margin-top: 14px;
}

.power_ci_item {
  display: flex;
  align-items: center;
}

.power_ci_dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3a3a3a;
  flex-shrink: 0;
  margin-right: 10px;
}

.power_ci_item.active .power_ci_dot {
  background: var(--green, #3fb950);
  box-shadow: 0 0 6px rgba(63, 185, 80, 0.6);
}

.power_ci_item.alert .power_ci_dot {
  background: var(--red, #f1331b);
  box-shadow: 0 0 6px rgba(241, 51, 27, 0.6);
}

.power_ci_label {
  font-size: 13px;
  color: #96958d;
}

.power_ci_col .time_remaining_label {
  font-size: 11px;
  color: #555;
  margin-top: auto;
  padding-top: 14px;
}

.power_ci_col .time_remaining_value {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-left: 0;
}

.power_ci_col .time_remaining_value.dimmed {
  color: #555;
}

/* House battery charge/discharge indicator — bottom strip of power-charger */
.power_battery_flow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #222;
}

.power_battery_flow_icon {
  display: flex;
  align-items: center;
}

.power_battery_flow_icon svg {
  display: block;
}

.power_battery_flow.discharging .power_battery_flow_icon svg {
  transform: scaleY(-1);
}

.power_battery_flow .power_flow_dot {
  visibility: hidden;
}

.power_battery_flow.charging .power_flow_dot {
  visibility: visible;
  fill: var(--green, #3fb950);
}

.power_battery_flow.discharging .power_flow_dot {
  visibility: visible;
  fill: var(--yellow, #d29922);
}

/* bottom row — two columns side by side */
.power-bottom {
  display: flex;
  flex-direction: row;
  width: 1232px;
  height: 190px;
  flex-shrink: 0;
}

.power-bottom > * + * {
  margin-left: 14px;
}

.power-buttons {
  width: 270px;
  flex-shrink: 0;
}

.power-batteries {
  flex: 1 1 auto;
  min-width: 0;
  height: 190px;
  background: #141414;
  border: 1.5px solid #222;
  border-radius: 12px;
  padding: 14px 16px;
  overflow-y: auto;
}

/* -- Layout - Service - main ----------------------------------------- */
.service_login_overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  background: #030303;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.service_login_overlay > * + * {
  margin: 36px 0;
}

.service_brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.service_brand > * + * {
  margin-top: 14px;
}

.service_brand_logo {
  height: 80px;
  width: 80px;
  object-fit: contain;
  opacity: 0.95;
}

.service_brand_label {
  font-family: "Vanquish Display", system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0.22em;
  color: #444;
  text-transform: uppercase;
}

.pin_dots {
  display: flex;
}

.pin_dots > * + * {
  margin-left: 22px;
}

.pin_dot {
  width: 16px;
  height: 16px;
  border-radius: 8px;
  border-width: 1.5px;
  border-style: solid;
  background: transparent;
  border-color: #333;
  transition: all 0.12s;
}

.pin_dot.filled {
  background: var(--red, #f1331b);
  border-color: var(--border, #f1331b);
}

.pin_error_label {
  display: none;
}

.pin_error_label.active {
  display: block;
  font-size: 11px;
  color: #f1331b;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: -24px;
}

/* No CSS Grid on this target: repeat(3, 88px) approximated with
   flex-wrap + an explicit container width so wrapping lands every
   3 keys (see file header for the negative-margin technique). */
.pin_numpad {
  display: flex;
  flex-wrap: wrap;
  width: 294px;
  margin-top: -10px;
  margin-left: -10px;
}

.pin_numpad > * {
  width: 88px;
  margin-top: 10px;
  margin-left: 10px;
}

.pinKey {
  height: 70px;
  background: #141414;
  border: 1px solid #242424;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 26px;
  font-weight: 400;
  color: #fff;
}

.pinKey:hover {
  background: #1e1e1e;
}

.cancelKey {
  height: 70px;
  background: #0d0d0d;
  border: 1px solid #1e1e1e;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  color: #3a3a3a;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cancelKey:hover {
  color: #666;
}

.backspaceKey {
  height: 70px;
  background: #0d0d0d;
  border: 1px solid #1e1e1e;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.backspaceKey:hover {
  background: #161616;
}

/* -- Layout - Footer - Tab navigation -------------------------------- */
footer {
  flex-shrink: 0;
}

.tab_bar {
  display: flex;
  background: #0a0a0a;
  border-top: 1px solid #1a1a1a;
  height: 74px;
  flex-shrink: 0;
}

.tab_button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-top: 2px solid transparent;
  background: transparent;
  color: #555;
  transition: all 0.15s;
  position: relative;
}

.tab_button > * + * {
  margin-top: 4px;
}

/* Tab disabled via config.pages[key].active = false */
.tab_button.disabled {
  display: none;
}

.tab_button:active,
.tab_button.active {
  border-top-color: var(--accent, #f1331b);
  background: var(--accent-tint, rgba(241, 51, 27, 0.05));
  color: var(--accent, #f1331b);
}

.tab_label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* -- Component - Toggle row / switch ---------------------------------- */

.toggle_row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid #1a1a1a;
}

.toggle_row > * + * {
  margin-left: 6px;
}

.toggle_row label {
  font-size: 13px;
  color: #ccc;
  font-weight: 500;
  white-space: nowrap;
}

.toggle_switch {
  width: 44px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: #373737;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.toggle_switch::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.toggle_switch.active {
  background: var(--accent, #f1331b);
}

.toggle_switch.active::after {
  left: 23px;
}

/* usage

<div class="toggle_row">
  <label>Bathroom</label>
    <button onClick="toggleBath(this)" class="toggle_switch {{ bathActiveClass }}"></button>
    </div>

*/
/* ═══════════════════════════════════════════════════════════════════════
   Engine page — instrument cluster (ui/engine.js)
   Compass rose (heading) in the center with an open boat-overlay slot,
   arc gauges for RPM / oil temp / tank level down each side.
   ═══════════════════════════════════════════════════════════════════════ */

.engine_content {
  align-items: stretch;
  justify-content: stretch;
}

/* 16 × 10 grid that fills the content page (.content_page is a fixed box;
   this just takes what's left after its padding). Every tile is placed
   from the ENGINE_LAYOUT table in engine.js via grid-column / grid-row —
   col/row are 1-based grid lines, w/h are spans in cells. Moving,
   resizing or adding a gauge is a one-line edit to that table; nothing
   here changes. */
.engine_layout {
  display: -webkit-grid;
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  grid-template-rows: repeat(11, 1fr);
  grid-gap: 8px; /* old WebKit/WPE: `grid-gap`, not `gap` */
  gap: 8px;
  flex: 1;
  width: 100%;
  min-height: 0;
}

/* One grid cell. Centers whatever gauge / compass / readout engine.js
   drops in. The gauge SVG is width:100% of its mount, so the mount — not
   the grid span — sets the gauge's drawn size: 210px normally, 150px
   with the engine_gauge_sm modifier (added for a size:"sm" layout
   entry). The grid span just reserves the surrounding space. Compass and
   GPS have no width cap and fill their span. */
.engine_cell,
.engine_cell.engine_gauge_sm {
  display: -webkit-flex;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* fill the grid area — the .engine_gauge_sm base rule further down also
     sets `width`, so override it here to keep the grid span in charge */
  width: auto;
  min-width: 0;
  min-height: 0;
}

/* The gauge SVG has a square viewBox and preserveAspectRatio "meet"
   (default), so it scales to fit inside whatever box we give it. Fill the
   cell in both axes, capped so it doesn't get huge on a large span. */
.engine_cell > .engine_gauge_svg {
  width: 100%;
  height: 100%;
  max-width: 210px;
  max-height: 210px;
}

.engine_cell.engine_gauge_sm > .engine_gauge_svg {
  max-width: 160px;
  max-height: 160px;
}

/* The tanks cell is a host: engine.js renderTanks() appends one
   .engine_gauge per configured FUEL tank into it, side by side. */
.engine_cell[data-engine-gauge="tanks"] {
  -webkit-flex-direction: row;
  flex-direction: row;
  overflow-x: auto;
}

.engine_cell[data-engine-gauge="tanks"] > * + * {
  margin-left: 12px;
}

/* GPS coordinate strip — built by engine.js buildGps() into its grid
   cell; the grid gap handles spacing, so no outer margin here. */
.engine_gps {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  border-radius: 8px;
  background: var(--bg, rgba(3, 3, 3, 0.72));
  border: 1px solid #1e1e1e;
  border: 1px solid var(--border, #1e1e1e);
  font-variant-numeric: tabular-nums;
}

/* old WebKit/WPE has no flex `gap` — space the strip's items by margin */
.engine_gps > * + * {
  margin-left: 8px;
}

.engine_gps_icon,
.depth_icon {
  display: inline-flex;
  align-items: center;
  color: #f1331b;
  color: var(--accent, #f1331b);
}

.engine_gps_icon svg,
.depth_icon svg {
  width: 14px;
  height: 14px;
}

.engine_gps_lat,
.engine_gps_lon,
.depth {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  color: var(--text, #ffffff);
  letter-spacing: 0.02em;
}

.engine_gps_sep,
.engine_gps_div,
.depth_unit {
  color: #96958d;
  color: var(--text-dim, #96958d);
}

.depth_unit {
  font-size: 12px;
}

/* ── digital gauge (boxed readout, e.g. Total Flow) ──────────────────
   Framed box mirroring .engine_gps: big value, dim unit sub-label. */

.engine_digital {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--bg, rgba(3, 3, 3, 0.72));
  border: 1px solid #1e1e1e;
  border: 1px solid var(--border, #1e1e1e);
  font-variant-numeric: tabular-nums;
}

.engine_digital_title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #96958d;
  color: var(--text-dim, #96958d);
  text-transform: uppercase;
}

.engine_digital_value {
  font-size: 34px;
  font-weight: 800;
  color: #ffffff;
  color: var(--text, #ffffff);
  letter-spacing: 0.02em;
}

.engine_digital_unit {
  font-size: 12px;
  color: #96958d;
  color: var(--text-dim, #96958d);
}

/* ── gear indicator (N / R / D, PGN 127493) ───────────────────────────
   Vertical stack, one cell per gear; the engaged gear lights up. */

.engine_gear {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 60%;
}

.engine_gear_title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #96958d;
  color: var(--text-dim, #96958d);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.engine_gear_cell {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 6px;
  background: var(--bg, rgba(3, 3, 3, 0.72));
  border: 1px solid #1e1e1e;
  border: 1px solid var(--border, #1e1e1e);
  color: #96958d;
  color: var(--text-dim, #96958d);
  font-size: 14px;
  font-weight: 800;
}

.engine_gear_cell.active {
  color: #ffffff;
  color: var(--text, #ffffff);
  background: var(--accent, #f1331b);
  border-color: var(--accent, #f1331b);
}

/* ── arc gauge ─────────────────────────────────────────────────────── */

.engine_gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 210px;
}

.engine_gauge_sm {
  width: 150px;
}

.engine_gauge_title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #96958d;
  color: var(--text-dim, #96958d);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.engine_gauge_svg {
  width: 100%;
  height: auto;
  display: block;
}

.engine_gauge_track {
  stroke: #202020;
  stroke: var(--gauge-track, #202020);
  stroke-width: 10;
  stroke-linecap: round;
}

/* Dim base band — the zone's full extent, always visible */
.engine_gauge_zone_base {
  stroke-width: 10;
  stroke-linecap: butt;
  opacity: 0.22;
}

.engine_gauge_zone_base.zone_lo {
  stroke: #1f6feb;
}

.engine_gauge_zone_base.zone_hi {
  stroke: #f1331b;
  stroke: var(--red, #f1331b);
}

/* Bright band — only the part the needle has swept past (grows with value) */
.engine_gauge_zone {
  stroke-width: 10;
  stroke-linecap: butt;
  opacity: 1;
  transition: none;
}

.engine_gauge_zone.zone_lo {
  stroke: #2a7fff;
}

.engine_gauge_zone.zone_hi {
  stroke: #f1331b;
  stroke: var(--red, #f1331b);
}

.engine_gauge_value_arc {
  stroke: #cccac3;
  stroke: var(--color-gray-4, #cccac3);
  stroke-width: 4;
  stroke-linecap: round;
}

.engine_gauge_tick {
  stroke: #96958d;
  stroke: var(--text-dim, #96958d);
  stroke-width: 1.5;
  opacity: 0.5;
}

.engine_gauge_tick_label {
  fill: #96958d;
  fill: var(--text-dim, #96958d);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.engine_gauge_needle {
  stroke: #f1331b;
  stroke: var(--accent, #f1331b);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: transform 0.25s ease-out;
}

.engine_gauge_hub {
  fill: #cccac3;
  fill: var(--color-gray-4, #cccac3);
}

.engine_gauge_value {
  fill: #ffffff;
  fill: var(--text, #ffffff);
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* RPM runs to 4 digits — pull it in a touch */
.engine_gauge_value[data-kind="rpm"] {
  font-size: 22px;
}

.engine_gauge_value.warn {
  fill: #f1331b;
  fill: var(--red, #f1331b);
}

.engine_gauge_sub {
  fill: #96958d;
  fill: var(--text-dim, #96958d);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* In-dial label for the compact gauges — the external .engine_gauge_title
   strip does not fit under a 150px gauge, so the name rides inside the
   arc instead (see buildArcGauge, isSmall branch). */
.engine_gauge_title_in {
  fill: #96958d;
  fill: var(--text-dim, #96958d);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  /* dark halo so the label stays legible where the needle crosses it */
  stroke: #000;
  stroke: var(--bg, #000);
  stroke-width: 3px;
  paint-order: stroke fill;
}

/* smaller center readout on the compact gauges */
.engine_gauge_sm .engine_gauge_value {
  font-size: 22px;
}

/* ── compass rose ─────────────────────────────────────────────────────
   The boat overlay slot (.engine_compass_boat) sits above the SVG,
   centered, empty by default. Drop an <img> in there later. */

.engine_compass {
  position: relative;
  width: 320px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.engine_compass_svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.engine_compass_bezel {
  fill: #0d0d0d;
  fill: var(--bg-card, #0d0d0d);
  stroke: #373737;
  stroke: var(--color-gray-2, #373737);
  stroke-width: 2;
}

.engine_compass_face {
  fill: #030303;
  fill: var(--bg, #030303);
  stroke: #1e1e1e;
  stroke: var(--border, #1e1e1e);
  stroke-width: 1;
}

.engine_compass_card {
  transition: transform 0.3s ease-out;
}

.engine_compass_tick {
  stroke: #96958d;
  stroke: var(--text-dim, #96958d);
  stroke-width: 1.5;
  opacity: 0.45;
}

.engine_compass_tick.major {
  stroke-width: 2.5;
  opacity: 0.8;
}

.engine_compass_deg {
  fill: #96958d;
  fill: var(--text-dim, #96958d);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.engine_compass_deg.cardinal {
  fill: #ffffff;
  fill: var(--text, #ffffff);
  font-size: 17px;
  font-weight: 800;
}

.engine_compass_lubber {
  fill: #f1331b;
  fill: var(--accent, #f1331b);
}

/* boat overlay slot — kept empty; centered above the rose */
.engine_compass_boat {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 200px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.engine_compass_boat_img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform: rotate(-90deg);
}

/* Heading readout pill, fixed just under the top lubber line so it
   never collides with the (future) boat overlay in the center. */
.engine_compass_readout {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  padding: 3px 12px;
  border-radius: 8px;
  background: rgba(3, 3, 3, 0.72);
  border: 1px solid #1e1e1e;
  border: 1px solid var(--border, #1e1e1e);
  color: #ffffff;
  color: var(--text, #ffffff);
}

.engine_compass_hdg {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.engine_compass_hdg_unit {
  font-size: 12px;
  font-weight: 600;
  color: #96958d;
  color: var(--text-dim, #96958d);
  margin-left: 1px;
}

/* -- Layout - HVAC ---------------------------------------------------
   Config-driven from config/hvac.json (see ui/hvac.js). Zone cards show
   live current temp + setpoint (PGN 130312/130316, keyed by instance +
   temperature source); fan/chiller selectors and the Cool/Heat toggle
   are visual-only placeholders (no outgoing commands yet). */

.hvac_content {
  flex-direction: column;
  padding-bottom: 0;
}

.hvac_zone_grid {
  display: -webkit-grid;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  grid-gap: 10px;
  gap: 10px;
  height: 300px;
  flex-shrink: 0;
}

.hvac_zone_card {
  background: var(--bg-card, #0d0d0d);
  border: 1px solid var(--border, #1e1e1e);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hvac_zone_card > * + * {
  margin-top: 8px;
}

.hvac_zone_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hvac_zone_title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.hvac_zone_icon {
  display: inline-flex;
  color: #555;
  width: 16px;
  height: 16px;
}

.hvac_stat_row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hvac_stat_label {
  font-size: 9px;
  color: #555;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}

.hvac_stat_value {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.hvac_stepper {
  display: flex;
  align-items: center;
}

.hvac_stepper > * + * {
  margin-left: 8px;
}

.hvac_stepper_btn {
  color: #555;
  font-size: 11px;
  line-height: 1;
}

/* Cool/Heat toggle uses the shared .segment_selector/.segment_button
   component (see pumps_panel), just tinted per side. */
.hvac_mode_cool.active {
  background: #1f6feb;
  color: #fff;
}

.hvac_mode_heat.active {
  background: #d29922;
  color: #fff;
}

.hvac_equipment_row {
  display: flex;
  flex-direction: row;
  height: 140px;
  flex-shrink: 0;
}

.hvac_equipment_row > * + * {
  margin-left: 10px;
}

.hvac_equipment_card {
  flex: 1;
  background: var(--bg-card, #0d0d0d);
  border: 1px solid var(--border, #1e1e1e);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hvac_equipment_title {
  font-size: 10px;
  color: #555;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 10px;
}

.hvac_equipment_sublabel {
  font-size: 9px;
  color: #555;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 6px;
}

.hvac_fan_speeds {
  align-self: flex-start;
}

.hvac_chiller_row {
  display: flex;
  flex-direction: row;
  flex: 1;
}

.hvac_chiller_row > * + * {
  margin-left: 16px;
}

.hvac_chiller_col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.hvac_chiller_mode .segment_button:nth-child(2).active {
  background: #1f6feb;
}

.hvac_chiller_mode .segment_button:nth-child(3).active {
  background: #d29922;
}

.hvac_chiller_operating .segment_button:nth-child(2).active {
  background: #3fb950;
}

.hvac_sensor_row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  height: 64px;
  flex-shrink: 0;
  margin-top: auto;
  background: var(--bg-card, #0d0d0d);
  border: 1px solid var(--border, #1e1e1e);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.hvac_sensor_pill {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  border-left: 1px solid var(--border, #1e1e1e);
}

.hvac_sensor_pill:first-child {
  border-left: none;
}

.hvac_sensor_pill > * + * {
  margin-left: 8px;
}

.hvac_sensor_label {
  font-size: 10px;
  color: #96958d;
  color: var(--text-dim, #96958d);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.hvac_sensor_value {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
