@import url("app-grid.css");

:root {
  --font-display: "Space Grotesk", "IBM Plex Sans", "Noto Sans", "DejaVu Sans", sans-serif;
  --font-mono: "IBM Plex Mono", "DejaVu Sans Mono", monospace;

  --color-ink: #1f1b16;
  --color-muted: #6a625b;
  --color-bg: #ffffff;
  --color-topbar: #ffffff;
  --color-surface: var(--color-brand-soft);
  --color-border: #e6d9c8;
  --color-shadow: rgba(42, 31, 19, 0.12);

  /* JCT brand accent. Keep brand-facing UI colors centralized here. */
  --color-brand: #f2e600;
  --color-brand-soft: #fffbd1;
  --color-brand-ink: #1f1b16;
  --color-brand-shadow: rgba(242, 230, 0, 0.14);

  /* Backwards-compatible aliases used by the home screen. */
  --home-yellow: var(--color-brand);
  --home-yellow-soft: var(--color-brand-soft);
  --home-yellow-ink: var(--color-brand-ink);
  --home-ambient-gold: #c2ae68;

  --accent-1: #1c8e7a;
  --accent-2: #f2a640;
  --accent-3: #c9643b;
  --accent-4: #2569a5;

  --radius-lg: 12px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --page-max: 1200px;
}

* {
  box-sizing: border-box;
  touch-action: pan-y;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-display);
  color: var(--color-ink);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* main {
  margin: 0.65rem 0.9rem;
}
 */
body.osk-open {
  overflow: hidden;
}

body.cursor-hidden,
body.cursor-hidden * {
  cursor: none !important;
}

body::before {
  content: none;
}

[x-cloak] {
  display: none !important;
}

section {
  margin-bottom: 0;
}

article {
  box-shadow: none;
}

.app-shell {
  position: relative;
  width: 800px;
  height: 480px;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  margin: 0;
  padding: 5px 0 5px 10px;
  background: var(--color-bg);
}

.ajax-progress {
  position: sticky;
  top: 0;
  z-index: 11;
  height: 2px;
  background: transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease;
}

.ajax-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-4));
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 180ms ease;
}

.ajax-progress.is-active {
  opacity: 1;
}

.ajax-progress.is-active .ajax-progress-bar {
  transform: scaleX(0.82);
}

.service-starting-overlay {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 0;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(255, 249, 242, 0.96)),
    radial-gradient(52% 48% at 50% 35%, rgba(28, 142, 122, 0.14), transparent 70%);
  backdrop-filter: blur(4px);
}

.service-starting-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(25rem, 100%);
  min-height: 7rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1rem 2.5rem rgba(42, 31, 19, 0.16);
}

.service-starting-spinner {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border: 4px solid rgba(28, 142, 122, 0.16);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: service-starting-spin 900ms linear infinite;
}

.service-starting-copy {
  min-width: 0;
}

.service-starting-copy h2 {
  margin: 0 0 0.25rem 0;
  color: var(--color-ink);
  font-size: 1.35rem;
  line-height: 1.15;
}

.service-starting-copy p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.95rem;
  line-height: 1.35;
}

@keyframes service-starting-spin {
  to {
    transform: rotate(360deg);
  }
}

.app-shell>.topbar {
  grid-row: 2;
}

.app-shell>.main {
  grid-row: 3;
}

.app-shell>.numeric-keypad-host {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
  background: var(--color-topbar);
  border-bottom: 1px solid var(--color-border);
}

.topbar-inner {
  padding: 0 1rem 0.5rem 1rem;
  max-width: var(--page-max);
  margin: 0 auto;
}

.topbar-layout {
  position: relative;
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(3.7rem, 18cqmin, 5rem) minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

/* Let page titles use all space not occupied by the action tray. The regular
 * three-column layout stays in place whenever the centered navigation exists. */
.topbar-layout--without-center {
  grid-template-columns: minmax(0, 1fr) auto;
}

.topbar-layout--without-center .topbar-center {
  display: none;
}

.topbar-left {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.topbar-brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding-right: 0.6rem;
  border-right: 1px solid var(--color-border);
}

.topbar-brand-logo {
  display: block;
  width: 72px;
  height: 44px;
  object-fit: contain;
}

.topbar-title {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  overflow: hidden;
}

.topbar-home-link {
  flex: 0 0 auto;
}

.topbar-title .page-title {
  display: block;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
  padding-bottom: 0.08em;
}

/* The system model is the Home screen title; keep it compact in the narrow
 * 800x480 shell without changing the headings used by other pages. */
body[data-page="home"] .topbar-title .page-title {
  font-size: 1.35rem;
}

.topbar-title .signal-desc {
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-center {
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.topbar-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.icon-tray {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  width: 100%;
}

.topbar-fixed {
  width: auto;
  flex-wrap: nowrap;
  justify-content: center;
}

.topbar-right-tray {
  width: auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.75rem;
}

.topbar-tray-section {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.topbar-action-tray .icon-pill,
.topbar-persistent-info-tray .icon-pill {
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.topbar-action-tray .icon-pill .app-icon,
.topbar-persistent-info-tray .icon-pill .app-icon {
  font-size: 24px;
}

.topbar-info-tray .icon-pill.topbar-icon-heating,
.topbar-info-tray .icon-pill.topbar-icon-error,
.topbar-info-tray .icon-pill.topbar-icon-usb,
.topbar-info-tray .icon-pill.topbar-icon-calibration {
  background: transparent;
  border: none;
  box-shadow: none;
}

.topbar-info-tray .icon-pill.topbar-icon-heating .app-icon,
.topbar-info-tray .icon-pill.topbar-icon-error .app-icon,
.topbar-info-tray .icon-pill.topbar-icon-usb .app-icon,
.topbar-info-tray .icon-pill.topbar-icon-calibration .app-icon {
  font-size: 22px;
}

.topbar-info-tray .icon-pill.topbar-icon-heating {
  color: #b76a1c;
}

.topbar-info-tray .icon-pill.topbar-icon-error {
  color: #b42318;
}

.topbar-info-tray .icon-pill.topbar-icon-error.alert-error {
  color: #ffffff;
  background: #ad2525;
  border: 1px solid #880404;
}

.topbar-info-tray .icon-pill.topbar-icon-error.alert-error:hover,
.topbar-info-tray .icon-pill.topbar-icon-error.alert-error:focus-visible {
  color: #ffffff;
  background: #991b1b;
}

.topbar-action-tray .icon-pill.ok,
.topbar-action-tray .icon-pill.alert-error,
.topbar-action-tray .icon-pill.alert-warn,
.topbar-action-tray .icon-pill.alert-info,
.topbar-persistent-info-tray .icon-pill.ok,
.topbar-persistent-info-tray .icon-pill.alert-error,
.topbar-persistent-info-tray .icon-pill.alert-warn,
.topbar-persistent-info-tray .icon-pill.alert-info {
  background: transparent;
  border: none;
  box-shadow: none;
}

.topbar-action-tray .icon-pill.auth-service,
.topbar-persistent-info-tray .icon-pill.auth-service {
  color: #0f6b5c;
}

.topbar-action-tray .icon-pill.auth-manufacturer,
.topbar-persistent-info-tray .icon-pill.auth-manufacturer {
  color: #b42318;
}

.icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  margin: 0;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-muted);
  box-shadow: 0 10px 22px rgba(42, 31, 19, 0.08);
}

.icon-pill .app-icon {
  font-size: 18px;
  line-height: 1;
}

.screen-header-icon-pill .app-icon {
  font-size: 24px;
}

.screen-header-icon-pill {
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

button.icon-pill,
a.icon-pill {
  appearance: none;
  text-decoration: none;
  cursor: pointer;
}

button.icon-pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.topbar-nav-link {
  color: #34383b;
  border-color: transparent;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.topbar-nav-link.is-active {
  color: var(--color-brand-ink);
  border-color: transparent;
  background: var(--color-brand-soft);
  box-shadow: 0 4px 12px var(--color-brand-shadow);
}

.icon-pill.ok {
  color: #0f6b5c;
  border-color: rgba(28, 142, 122, 0.3);
  background: rgba(28, 142, 122, 0.12);
}

.icon-pill.alert-info {
  color: #2569a5;
  border-color: rgba(37, 105, 165, 0.35);
  background: rgba(37, 105, 165, 0.12);
}

.icon-pill.alert-warn {
  color: #b76a1c;
  border-color: rgba(242, 166, 64, 0.45);
  background: rgba(242, 166, 64, 0.18);
}

.icon-pill.alert-error {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.35);
  background: rgba(180, 35, 24, 0.12);
}


.main-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.2rem;
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.main-nav-link svg {
  width: 18px;
  height: 18px;
}

.main-nav-link:hover {
  color: var(--color-ink);
  text-decoration: none;
  border-bottom-color: rgba(18, 122, 58, 0.35);
}

.main-nav-link.active {
  border-bottom-color: #127a3a;
}


.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.85rem;
}

.numeric-keypad {
  position: relative;
}

.numeric-keypad.numeric-keypad-hidden {
  width: 0;
  height: 0;
  overflow: visible;
}

.numeric-keypad-host {
  position: absolute;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.numeric-keypad-trigger {
  border: 1px solid var(--color-border);
  background: #fff;
  box-shadow: 0 10px 22px rgba(42, 31, 19, 0.08);
  cursor: pointer;
}

.numeric-keypad-trigger.numeric-keypad-active {
  border-color: rgba(37, 105, 165, 0.35);
  color: var(--accent-4);
}


.numeric-keypad-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: stretch;
  background: var(--color-bg);
  z-index: 70;
  pointer-events: auto;
  padding: 0;
}

.numeric-keypad-overlay[hidden] {
  display: none;
}

.numeric-keypad-modal {
  width: 100%;
  height: 100%;
  background: var(--color-bg);
  border-radius: 0;
  border: none;
  box-shadow: none;
  padding: 1.1rem 1.6rem 0.8rem;
  display: grid;
  gap: 1rem;
  grid-template-rows: auto 1fr;
  align-content: stretch;
}

.numeric-keypad-body {
  align-self: stretch;
}

.numeric-keypad-screen-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-bg);
  padding-bottom: 0.7rem;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid var(--color-border);
}

.numeric-keypad-login {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 0.3rem;
  width: min(100%, var(--page-max));
  margin: 0 auto;
}

.numeric-keypad-display {
  display: block;
}

.numeric-keypad-input-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--pico-form-element-background-color);
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(42, 31, 19, 0.08);
}

.numeric-keypad .numeric-keypad-input-shell>.numeric-keypad-input {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  min-width: 0;
  min-height: 0;
  font: inherit;
  color: var(--color-ink);
  text-align: center;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  letter-spacing: 0.45rem;
  padding: 0.7rem 0.95rem;
  margin: 0;
  width: 100%;
  border-radius: 0.5rem 0 0 0.5rem;
  background: var(--pico-form-element-background-color);
}

.numeric-keypad-input-actions {
  display: inline-flex;
  gap: 0;
  align-items: center;
  background: transparent;
  border-radius: 0;
}

.numeric-keypad .numeric-keypad-inline-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: none;
  background: var(--pico-form-element-background-color);
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  cursor: pointer;
  margin: 0;
  border-radius: 0;
}

.numeric-keypad-inline-btn .app-icon {
  font-size: 1.15rem;
}

.numeric-keypad .numeric-keypad-grid>.numeric-keypad-key {
  appearance: none;
  -webkit-appearance: none;
}

.numeric-keypad .numeric-keypad-grid>.numeric-keypad-key.numeric-keypad-ok {
  background: #1f9d55;
  color: #fff;
  border: none;
  font-size: 1.15rem;
  padding: 0;
  min-height: 0;
}

.numeric-keypad .numeric-keypad-grid>.numeric-keypad-key.numeric-keypad-ok:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.numeric-keypad .numeric-keypad-grid {
  --pico-group-box-shadow-focus-with-button: none;
  --pico-group-box-shadow: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.5rem, 1.2vw, 0.8rem);
  box-shadow: none;
  align-content: start;
}

.numeric-keypad .numeric-keypad-grid>.numeric-keypad-key {
  color: var(--color-muted);
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: var(--pico-form-element-background-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  padding: clamp(0.75rem, 2vw, 1.1rem) 0;
  box-shadow: 0 10px 20px rgba(42, 31, 19, 0.1);
  cursor: pointer;
}

.numeric-keypad-grid-spacer {
  min-height: clamp(0.75rem, 2vw, 1.1rem);
}

.numeric-keypad .numeric-keypad-grid>.numeric-keypad-key:active {
  transform: translateY(1px);
}

.numeric-keypad .numeric-keypad-grid>.numeric-keypad-key.numeric-keypad-clear {
  background: var(--pico-form-element-background-color);
  color: var(--color-ink);
  font-size: 1.15rem;
}

.numeric-keypad .numeric-keypad-grid>.numeric-keypad-key.numeric-keypad-back {
  background: var(--pico-form-element-background-color);
  color: var(--color-ink);
  font-size: 1.15rem;
}

.numeric-keypad .numeric-keypad-grid>.numeric-keypad-key.numeric-keypad-zero {
  grid-column: 2 / span 1;
}

.numeric-keypad .numeric-keypad-grid.is-alphanum {
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: clamp(0.25rem, 0.7vw, 0.5rem);
}

.numeric-keypad .numeric-keypad-grid.is-alphanum>.numeric-keypad-key {
  min-height: 0;
  padding: clamp(0.45rem, 1vw, 0.7rem) 0;
  font-size: clamp(0.85rem, 1.8vw, 1.1rem);
}

.numeric-keypad .numeric-keypad-grid.is-alphanum>.numeric-keypad-key.numeric-keypad-zero {
  grid-column: auto;
}

.numeric-keypad .numeric-keypad-grid.is-alphanum>.numeric-keypad-key:nth-last-child(1) {
  grid-column: span 4;
}

.numeric-keypad-message {
  color: var(--accent-3);
  min-height: 1.2rem;
  text-align: center;
  font-size: 0.95rem;
}


.auth-denied-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(31, 27, 22, 0.5);
  backdrop-filter: blur(6px);
  z-index: 80;
}

.auth-denied-overlay[hidden] {
  display: none;
}

.auth-denied-modal {
  width: min(92%, 420px);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 1.1rem 1.4rem;
  display: grid;
  gap: 0.8rem;
  box-shadow: 0 18px 40px var(--color-shadow);
  text-align: center;
}

.auth-denied-actions {
  display: flex;
  justify-content: center;
}

@media (max-width: 900px) {
  .numeric-keypad-modal {
    gap: 0.9rem;
    padding: 0.9rem 1rem 0.7rem;
  }

  .numeric-keypad-inline-btn {
    width: 46px;
    height: 46px;
    padding: 0;
  }
}


.main {
  max-width: var(--page-max);
  margin: 0 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

.app-shell>.main {
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.main>* {
  flex: 0 0 auto;
  min-height: 0;
  min-width: 0;
}

.main>:has(+ .osk-overlay),
.main>:has(+ .logout-overlay),
.main>:last-child:not(.osk-overlay):not(.logout-overlay) {
  flex: 1 1 auto;
  min-height: 0;
}

.shell-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.shell-content>.main-breadcrumb {
  flex: 0 0 auto;
  min-height: auto;
  margin: 0 0 0.2rem;
  justify-content: start;
}

.main-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.content-pane {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-pane>* {
  flex: 0 0 auto;
  min-height: 0;
  min-width: 0;
}

.content-pane>:has(+ .osk-overlay),
.content-pane>:has(+ .logout-overlay),
.content-pane>:last-child:not(.osk-overlay):not(.logout-overlay) {
  flex: 1 1 auto;
  min-height: 0;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex: 0 0 auto;
  min-height: auto;
  min-width: 0;
}

.page-header:empty {
  display: none;
}


.page-title {
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  margin: 0;
}

.clock {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  font-size: 1rem;
  color: var(--color-muted);
}

.signal-grid {
  display: grid;
  gap: 1.2rem;
}

.signal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.4rem;
  box-shadow: 0 14px 30px var(--color-shadow);
  display: grid;
  gap: 0.8rem;
  position: relative;
  overflow: hidden;
}

.signal-line {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr) auto;
  align-items: center;
  gap: 0.8rem;
}

.signal-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signal-reading {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  justify-self: end;
  text-align: right;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.signal-reading-value {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.35rem;
  font-size: clamp(1.6rem, 2.8vw, 2.3rem);
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}

.signal-value-text {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.signal-error-pill,
.data-table-error-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(180, 35, 24, 0.3);
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
  margin: 0;
  font-family: inherit;
}

.data-table-error-pill {
  cursor: pointer;
}

.signal-error-bang,
.data-table-error-bang {
  font-size: 0.85em;
}

.signal-error-code,
.data-table-error-code {
  letter-spacing: 0.04em;
}

.signal-card::after {
  content: "";
  position: absolute;
  inset: auto -10% -40% -10%;
  height: 70%;
  background: linear-gradient(120deg, rgba(28, 142, 122, 0.12), transparent);
  pointer-events: none;
}

.signal-card.secondary::after {
  background: linear-gradient(120deg, rgba(242, 166, 64, 0.2), transparent);
}

.signal-card.tertiary::after {
  background: linear-gradient(120deg, rgba(201, 100, 59, 0.2), transparent);
}


.signal-tag {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.icon-btn {
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 999px;
  padding: 0.3rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--color-text);
  text-decoration: none;
  margin: 0;
}

.icon-btn:hover {
  background: rgba(28, 142, 122, 0.12);
}

.icon-btn:focus-visible {
  outline: 2px solid rgba(28, 142, 122, 0.35);
  outline-offset: 2px;
}


.icon-btn-success {
  color: #0f6b5c;
}

.icon-btn-danger {
  color: #a33a2a;
}

.icon-btn-muted {
  color: var(--color-muted);
}

.icon-btn-muted:hover {
  background: rgba(31, 27, 22, 0.08);
}

.app-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.icon-btn .app-icon {
  font-size: 1.1rem;
}


.signal-desc {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.usb-header .signal-desc,
.usb-log-status {
  font-size: 1rem;
}

.usb-log-list {
  display: grid;
  gap: 0.45rem;
  overflow: auto;
  padding-inline-end: 0.65rem;
}

.usb-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 2.8rem;
  padding: 0.35rem 0.55rem 0.35rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.usb-log-file {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  margin: 0;
  color: var(--color-ink);
}

.usb-log-file input[type="checkbox"] {
  flex: 0 0 auto;
  accent-color: var(--color-brand);
}

.usb-log-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usb-error-report-archive-row {
  align-items: center;
}

.usb-error-report-archive-row .usb-log-file {
  flex: 1 1 auto;
}

.usb-error-report-month {
  flex: 0 1 16rem;
  min-width: 10rem;
}

.usb-log-view {
  flex: 0 0 auto;
  color: var(--color-brand-ink);
}

.usb-log-view:hover:not(:disabled) {
  background: var(--color-brand-soft);
  color: var(--color-brand-ink);
}

.usb-log-page .confirm-actions button.action-pill {
  min-width: 6.5rem;
  min-height: 2.5rem;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  letter-spacing: normal;
  font-size: 0.95rem;
}

.usb-log-page .confirm-actions button.action-pill.is-secondary {
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-brand-ink);
}

.usb-log-page .confirm-actions button.action-pill.is-secondary:hover:not(:disabled) {
  background: var(--color-brand-soft);
  border-color: var(--color-brand-ink);
}

.event-log-viewer-overlay {
  z-index: 85;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.9);
}

.event-log-viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.75rem;
  width: min(100%, 60rem);
  height: min(100%, 42rem);
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  box-shadow: 0 1.4rem 3rem var(--color-shadow);
}

.event-log-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.event-log-viewer-header .menu-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-log-viewer-content {
  min-height: 0;
  margin: 0;
  padding: 0.85rem;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fffef2;
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.firmware-box {
  display: grid;
  gap: 0.75rem;
}

.firmware-list {
  display: grid;
  gap: 0.45rem;
  overflow: visible;
}

.firmware-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.8rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-ink);
  text-align: left;
  box-shadow: none;
}

.firmware-list-item-body {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.firmware-list-item:hover {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
}

.firmware-list-item.is-selected {
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-brand-ink);
  box-shadow: inset 0 0 0 1px var(--color-brand-shadow);
}

.firmware-list-item:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.backup-panel {
  display: grid;
  gap: 0.8rem;
  min-height: 0;
  overflow: auto;
  padding-bottom: 0.4rem;
}

.backup-panel .form-card {
  gap: 0.65rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.backup-card-header,
.backup-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.backup-current-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.backup-create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
}

.backup-create-row>.backup-action {
  align-self: center;
  margin-top: 1.1rem;
  transform: translateY(0.95rem);
}

.backup-name-field {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.backup-name-field>label {
  color: var(--color-muted);
  font-size: 0.75rem;
}

.backup-name-field .edit-group {
  min-height: 2.4rem;
  margin: 0;
}

.backup-name-warning {
  margin: 0;
  color: var(--accent-3);
  font-weight: 600;
}

.backup-import-content,
.backup-import-selection {
  display: grid;
  gap: 0.55rem;
}

.backup-import-card .backup-list {
  max-height: 12rem;
  overflow-x: hidden;
  overflow-y: auto;
  align-content: start;
  grid-auto-rows: max-content;
  padding-right: 0.15rem;
}

.backup-import-card .backup-list-item {
  min-height: 3.6rem;
  align-items: center;
  padding-block: 0.55rem;
}

.backup-import-card .backup-list-item-body {
  gap: 0.2rem;
}

.backup-import-card .backup-list-item-label,
.backup-import-card .backup-list-item-meta {
  display: block;
  line-height: 1.2;
}

.backup-detail-view {
  display: grid;
  gap: 0.75rem;
  min-height: 0;
  overflow: auto;
}

.backup-panel .backup-action {
  border-color: rgba(242, 230, 0, 0.75);
  background: var(--color-brand);
  color: var(--color-brand-ink);
  box-shadow: 0 8px 16px var(--color-brand-shadow);
}

.backup-panel button.action-pill.backup-action {
  border-color: rgba(242, 230, 0, 0.9);
  background: var(--color-brand);
  color: var(--color-brand-ink);
}

.backup-panel .backup-action:hover:not(:disabled) {
  filter: brightness(0.97);
}

.backup-list-instructions {
  margin: -0.2rem 0 0.1rem;
}

.backup-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.backup-file-chip {
  max-width: 100%;
  padding: 0.25rem 0.5rem;
  overflow-wrap: anywhere;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.backup-list {
  display: grid;
  gap: 0.4rem;
}

.backup-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.7rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
}

.backup-list-item:hover {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
}

.backup-list-item.is-selected {
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-brand-ink);
}

.backup-list-item.is-active {
  border-color: var(--color-brand);
  box-shadow: inset 0 0 0 1px var(--color-brand-shadow);
}

.backup-list-item:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.backup-list-item-body {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.backup-list-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.backup-list-item-meta,
.backup-list-item-status {
  color: var(--color-muted);
  font-size: 0.72rem;
}

.backup-list-item-status {
  color: var(--accent-1);
  font-weight: 700;
}

.backup-list-item-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-ink);
  cursor: pointer;
}

.icon-action:hover:not(:disabled) {
  border-color: var(--accent-1);
  color: var(--accent-1);
}

.backup-panel .icon-action.backup-action,
.backup-panel .icon-action.backup-action:hover:not(:disabled) {
  border-color: transparent;
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.backup-panel .icon-action.backup-usb-action,
.backup-panel .icon-action.backup-usb-action:hover:not(:disabled) {
  border-color: transparent;
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.icon-action.is-danger {
  color: var(--accent-3);
}

.icon-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.backup-selection,
.backup-preview {
  display: grid;
  gap: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--color-border);
}

.backup-selection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.backup-selection > .menu-title {
  min-width: 0;
  flex: 1 1 auto;
}

.backup-selection > .form-actions {
  flex: 0 0 auto;
}

.backup-preview-file {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fffef2;
}

.backup-preview-file summary {
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.backup-preview-file pre {
  max-height: 14rem;
  margin: 0;
  padding: 0.6rem;
  overflow: auto;
  border-top: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.firmware-list-item-label {
  font-weight: 700;
  line-height: 1.15;
}

.firmware-list-item-meta {
  color: var(--color-muted);
  font-size: 0.8rem;
  line-height: 1.1;
}

.firmware-install-button {
  justify-self: end;
  align-self: center;
  white-space: nowrap;
}

.firmware-current-version-row {
  margin-bottom: 0.45rem;
}

.firmware-progress-shell {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.firmware-progress-track {
  position: relative;
  height: 0.82rem;
  border-radius: 999px;
  background: rgba(106, 98, 91, 0.12);
  border: 1px solid rgba(106, 98, 91, 0.18);
  overflow: hidden;
}

.firmware-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-4));
  transition: width 260ms linear;
}

.firmware-progress-track.is-indeterminate .firmware-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 32%;
  animation: firmware-indeterminate 1.25s linear infinite;
}

@keyframes firmware-indeterminate {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(360%);
  }
}

.firmware-progress-value {
  justify-self: end;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.firmware-result {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.firmware-result.is-success {
  border-color: rgba(28, 142, 122, 0.35);
  background: rgba(28, 142, 122, 0.08);
}

.firmware-result.is-error {
  border-color: rgba(201, 62, 50, 0.35);
  background: rgba(201, 62, 50, 0.08);
}

.signal-value {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
}

.signal-unit {
  font-size: 0.9rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.signal-edit {
  justify-self: end;
}

.signal-picker {
  margin-top: 0.6rem;
  padding: 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}


.signal-picker {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.signal-picker label {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.signal-picker select {
  border-radius: var(--radius-sm);
}


.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.data-table th {
  text-align: left;
  color: var(--color-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.data-table--striped tbody tr:nth-child(even) td {
  background-color: rgba(255, 196, 0, 0.04);
}

.data-table-header-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.data-table-header-cell .icon-btn {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0.2rem;
}

.data-table-header-cell .icon-btn .app-icon {
  font-size: 1rem;
}

.data-table th input[type="checkbox"],
.data-table td input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  vertical-align: middle;
}

.data-table th.data-table-check,
.data-table td.data-table-check {
  width: 2.5rem;
}

.data-table th.data-table-error-cell,
.data-table td.data-table-error-cell {
  width: 4.8rem;
  text-align: center;
}

.data-table td.data-table-check {
  text-align: center;
}

.data-table tr.is-selected td {
  background: rgba(28, 142, 122, 0.12);
}

.data-table tr.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.data-table tr.depth-1 td {
  padding-left: 1.4rem;
}

.calval-history-child td:nth-child(2),
.calval-history-error td:nth-child(2) {
  padding-left: 1.25rem;
}

.calval-history-child td:nth-child(3),
.calval-history-error td:nth-child(3) {
  color: var(--color-muted);
}

.calval-history-child td.calval-history-summary,
.calval-history-error td.calval-history-summary {
  padding-left: 1.25rem;
  color: var(--color-muted);
}

.calval-history-error {
  background: rgba(180, 35, 24, 0.04);
}

.calval-history-current td {
  font-weight: 700;
  color: var(--color-ink);
}

.calval-history-timestamp {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.calval-history-timestamp-time {
  margin-top: 0.15rem;
}

.calval-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.calval-decision-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.calval-toast-stack {
  position: absolute;
  top: 4.85rem;
  right: 0.9rem;
  z-index: 120;
  width: min(24rem, calc(100% - 1.8rem));
  display: grid;
  gap: 0.6rem;
  justify-items: end;
  pointer-events: none;
}

.calval-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 1rem 2.2rem rgba(42, 31, 19, 0.18);
  backdrop-filter: blur(6px);
  animation: calval-toast-in 180ms ease-out;
}

.calval-toast-copy {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  line-height: 1.35;
}

.calval-toast-close {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  padding: 0;
}

.calval-toast-close:hover {
  background: rgba(106, 98, 91, 0.08);
  color: var(--color-ink);
}

.calval-toast.is-success {
  border-color: rgba(28, 142, 122, 0.35);
  background: rgba(28, 142, 122, 0.1);
  color: #0f6b5c;
}

.calval-toast.is-warning {
  border-color: rgba(195, 126, 21, 0.38);
  background: rgba(242, 166, 64, 0.12);
  color: #8b5c12;
}

.calval-toast.is-error {
  border-color: rgba(180, 35, 24, 0.4);
  background: rgba(180, 35, 24, 0.1);
  color: #b42318;
}

.calval-toast.is-info {
  border-color: rgba(37, 105, 165, 0.28);
  background: rgba(37, 105, 165, 0.1);
  color: #1f5d8f;
}

@keyframes calval-toast-in {
  from {
    transform: translate3d(0, -0.35rem, 0);
    opacity: 0;
  }

  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

.calval-run-actions {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.calval-run-actions .calval-stop-btn {
  width: 100%;
}

.calval-run-actions .calval-decision-actions {
  width: 100%;
  justify-content: flex-end;
}

.calval-alert {
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.8rem;
  font-weight: 600;
}

.calval-alert.is-success {
  border: 1px solid rgba(28, 142, 122, 0.35);
  background: rgba(28, 142, 122, 0.12);
  color: #0f6b5c;
}

.calval-alert.is-error {
  border: 1px solid rgba(180, 35, 24, 0.4);
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
}

.calval-alert.is-warning {
  border: 1px solid rgba(195, 126, 21, 0.38);
  background: rgba(242, 166, 64, 0.14);
  color: #8b5c12;
}

.calval-actions-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.calval-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.calval-progress-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.calval-progress-label {
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.calval-progress-value {
  font-weight: 600;
}

.calval-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-weight: 600;
}

.calval-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-height: 0;
}

.calval-mode-shell {
  min-height: 0;
}

.calval-history-card,
.calval-edit-card {
  min-height: 0;
}

.calval-edit-summary {
  margin-top: 0.2rem;
  color: var(--color-ink);
  font-size: 0.98rem;
  font-weight: 600;
}

.calval-edit-footer {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin-top: auto;
  padding-top: 0.75rem;
}

.calval-edit-footer .calval-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.calval-edit-footer .calval-edit-actions .is-danger {
  margin-right: auto;
}

.calval-edit-body {
  gap: 0.9rem;
}

.osk-overlay.confirm-overlay {
  background: #fff;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 80;
}

.logout-overlay {
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 90;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.84), rgba(255, 249, 242, 0.92)),
    radial-gradient(55% 45% at 50% 35%, rgba(28, 142, 122, 0.16), transparent 70%);
}

.confirm-modal {
  width: min(100%, 32rem);
  display: grid;
  gap: 0.95rem;
  justify-items: center;
  text-align: center;
}

.confirm-modal .menu-title {
  margin: 0;
}

.confirm-modal .signal-desc {
  margin: 0;
}

.confirm-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
}

.confirm-actions button {
  min-width: 5.75rem;
  margin: 0;
}

.logout-modal {
  width: min(100%, 34rem);
  padding: 1.45rem 1.5rem 1.25rem;
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 1.4rem 3rem rgba(42, 31, 19, 0.18);
}

.logout-modal-icon {
  width: 3.35rem;
  height: 3.35rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(28, 142, 122, 0.12);
  color: var(--accent-1);
  font-size: 1.45rem;
}

.logout-modal .menu-title,
.logout-modal .signal-desc {
  margin: 0;
}

.logout-actions {
  flex-wrap: wrap;
}

.calval-history-info {
  color: var(--color-muted);
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
}

.calval-history-info.is-active {
  color: var(--accent-1);
}

.calval-history-info .app-icon {
  font-size: 1.3rem;
}

.calval-edit-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.calval-close {
  color: var(--color-muted);
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
}

.calval-close:hover {
  color: var(--color-text);
}

.calval-close .app-icon {
  font-size: 1.4rem;
}

.calval-icon-col {
  width: 2.6rem;
}

.calval-actions-col {
  width: 4.6rem;
}

.calval-history-edit {
  color: #8a5a2b;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calval-icon-cell {
  width: 2.6rem;
  text-align: center;
  vertical-align: middle;
}

.calval-icon-cell-actions {
  width: 4.6rem;
  text-align: right;
  padding-right: 0.25rem;
}

.calval-history-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
  width: 100%;
}

.calval-history-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
}

.calval-history-status-icon .app-icon {
  font-size: 1.25rem;
}

.calval-history-status-icon.is-success {
  color: #0f6b5c;
}

.calval-history-status-icon.is-warning {
  color: #8b5c12;
}

.calval-history-status-icon.is-error {
  color: #b42318;
}

.calval-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.calval-icon-cell-actions .calval-icon-wrap {
  width: 100%;
  justify-content: flex-end;
}

.calval-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.calval-icon {
  color: var(--color-muted);
}

.calval-icon.calval-icon-active {
  color: #0f6b5c;
}

.calval-icon.calval-icon-error {
  color: #b42318;
}

.calval-stop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(180, 35, 24, 0.4);
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
  font-weight: 600;
  box-shadow: 0 10px 22px rgba(42, 31, 19, 0.08);
}

.calval-stop-btn:hover:not(:disabled) {
  background: rgba(180, 35, 24, 0.2);
}

.calval-stop-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.calval-accept-btn,
.calval-reject-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 10px 22px rgba(42, 31, 19, 0.08);
  border: 1px solid transparent;
}

.calval-accept-btn {
  border-color: rgba(28, 142, 122, 0.35);
  background: rgba(28, 142, 122, 0.12);
  color: #0f6b5c;
}

.calval-accept-btn:hover:not(:disabled) {
  background: rgba(28, 142, 122, 0.2);
}

.calval-reject-btn {
  border-color: rgba(180, 35, 24, 0.4);
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
}

.calval-reject-btn:hover:not(:disabled) {
  background: rgba(180, 35, 24, 0.2);
}

.calval-accept-btn:disabled,
.calval-reject-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.graph-layout {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

.graph-layout.graph-layout-single {
  grid-template-columns: 1fr;
}

.graph-panel {
  /* background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border); */
  border: none;
  /* padding: 1rem; */
  /* box-shadow: 0 18px 40px var(--color-shadow); */
  display: grid;
  gap: 0;
  min-height: 0;
}

.graph-panel-main {
  display: grid;
  position: relative;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 21rem;
}

.graph-panel-main .graph-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0.25rem 3.8rem;
}

.graph-panel-main .legend.legend-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.graph-panel-main .legend-axis-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.graph-panel-main .legend-axis-right {
  justify-content: flex-end;
}

.graph-canvas {
  width: 100%;
  height: 100%;
  min-height: 320px;
  background: #ffffff;
  /* border-radius: var(--radius-md);
  border: 1px solid var(--color-border); */
  border: none;
  position: relative;
  overflow: hidden;
}

.graph-canvas>div,
.graph-canvas canvas {
  width: 100% !important;
  height: 100% !important;
}

.graph-history-section {
  margin-top: 0;
}

.graph-settings-page {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.35rem 0.75rem 1rem 0;
}

.graph-settings-content {
  width: 100%;
  max-width: 58rem;
  padding-bottom: 1rem;
}

.graph-settings-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.15rem 0.4rem;
}

.graph-settings-heading .form-section-title {
  margin: 0;
}

.graph-settings-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 0.65rem;
  padding: 0.2rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.72);
}

.graph-settings-tab {
  flex: 1 1 0;
  min-height: 2.35rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.graph-settings-tab.is-active {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
  color: var(--color-brand-ink);
  box-shadow: 0 3px 8px var(--color-brand-shadow);
}

.graph-settings-tab:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.graph-settings-tab-panel {
  min-width: 0;
}

.graph-settings-card-caption {
  color: var(--color-muted);
  font-size: 0.68rem;
}

.graph-settings-error {
  margin: 0 0 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(180, 35, 24, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(180, 35, 24, 0.06);
}

.graph-settings-card {
  box-sizing: border-box;
  margin-bottom: 0.65rem;
  padding: 0.7rem 0.8rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: 0 5px 14px rgba(42, 31, 19, 0.05);
}

.graph-settings-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.graph-settings-card-title {
  color: var(--color-ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.graph-settings-card-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
}

.graph-settings-card-caption {
  text-align: right;
}

.graph-live-setting-block + .graph-live-setting-block {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--color-border);
}

.graph-live-setting-block .graph-settings-card-header {
  margin-bottom: 0.4rem;
}

.graph-window-grid,
.graph-settings-card .form-grid {
  padding-bottom: 0;
}

.graph-window-control {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: min(100%, 11rem);
}

.graph-window-control text-editor {
  flex: 1 1 auto;
  min-width: 5rem;
}

.graph-window-control > span {
  color: var(--color-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.graph-settings-page .graph-live-setting-block .graph-window-grid,
.graph-settings-page .graph-live-setting-block .graph-window-control {
  min-height: 2.35rem;
  margin: 0;
}

.graph-settings-page .graph-window-control text-editor,
.graph-settings-page .graph-window-control text-editor .edit-group {
  height: 2.35rem;
  min-height: 2.35rem;
}

.graph-settings-section {
  display: grid;
  gap: 0.35rem;
}

.graph-settings-section .graph-axis-form {
  padding-bottom: 0;
}

.graph-settings-section .graph-axis-row {
  min-height: 2.55rem;
}

.graph-history-range-row {
  display: grid;
  max-width: 32rem;
  width: 100%;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-bottom: 0.2rem;
}

.graph-history-series-list {
  display: grid;
  max-width: 52rem;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.graph-history-range-warning {
  max-width: 34rem;
  margin: 0.45rem 0 0.2rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(180, 35, 24, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(180, 35, 24, 0.07);
  color: #b42318;
  font-size: 0.78rem;
  font-weight: 600;
}

.graph-history-grid {
  max-width: 52rem;
  grid-template-columns: minmax(15.2rem, 1.15fr) minmax(14.6rem, 1fr) minmax(14.6rem, 1fr);
  gap: 0.55rem 0.7rem;
}

.graph-history-grid input[type="datetime-local"] {
  min-width: 0;
  width: 100%;
}

.graph-history-grid input[type="time"] {
  min-width: 0;
  width: 100%;
}

.graph-history-field {
  grid-template-columns: minmax(5.4rem, auto) minmax(8.4rem, 1fr);
  min-width: 0;
}

.graph-settings-page .graph-history-field {
  grid-template-columns: minmax(5.5rem, 5.5rem) minmax(12rem, 1fr);
  max-width: 32rem;
}

.graph-history-field .unit {
  display: none;
}

.graph-history-field select-value,
.graph-history-field .select-value-display {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.graph-history-range-row select-value,
.graph-history-range-row .select-value-display,
.graph-history-range-row time-editor,
.graph-history-range-row time-editor .edit-group {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.graph-settings-page .graph-history-range-row .graph-history-field {
  height: 2.55rem;
  min-height: 2.55rem;
  align-items: center;
}

.graph-settings-page .graph-history-range-row select-value,
.graph-settings-page .graph-history-range-row time-editor {
  display: block;
  height: auto;
  min-height: 0;
  overflow: visible;
}

.graph-settings-page .graph-history-range-row select-value .edit-group,
.graph-settings-page .graph-history-range-row time-editor .edit-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.45rem;
  min-height: 2.45rem;
  overflow: visible;
}

.graph-settings-page .graph-history-range-row .edit-group.is-display .edit-value {
  flex: 1 1 auto;
  min-width: 0;
}

.graph-settings-page .graph-history-range-row .edit-group.is-display .icon-btn {
  flex: 0 0 1.9rem;
  width: 1.9rem;
  min-width: 1.9rem;
  height: 1.9rem;
  min-height: 1.9rem;
  margin-left: auto;
}

.graph-settings-page .graph-history-range-row .edit-value {
  min-height: 1.65rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-history-field input[type="time"] {
  box-sizing: border-box;
  width: 100%;
  min-width: 8.4rem;
  min-height: 2.4rem;
  padding: 0.45rem 0.55rem;
  color: var(--color-ink);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.graph-history-range-row time-editor .edit-group {
  min-height: 2.4rem;
}

.graph-settings-page .graph-history-series-row {
  grid-column: 1 / -1;
  position: relative;
  grid-template-columns: minmax(5.5rem, auto) minmax(16rem, 1fr) minmax(8.5rem, auto);
  align-items: center;
  min-height: 2.55rem;
  padding-top: 0.15rem;
}

.graph-settings-page .graph-history-series-row.has-color-picker {
  z-index: 4;
}

.graph-history-series-row .graph-axis-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.graph-history-series-row .tab-pill {
  min-height: 2.15rem;
  padding-inline: 0.55rem;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  text-transform: none;
}

.graph-history-series-row .unit {
  display: none;
}

.graph-history-signal-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.graph-history-signal-control select-value {
  flex: 1 1 auto;
  min-width: 0;
}

.graph-history-signal-control .select-value-display {
  width: 100%;
  min-width: 0;
}

.graph-history-signal-control .edit-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-history-axis-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  margin-bottom: 0.4rem;
}

.graph-history-axis-header .form-section-title {
  margin-bottom: 0;
}

.graph-history-color-control {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 2.4rem;
  min-width: 2.4rem;
  flex: 0 0 2.4rem;
}

.graph-history-color-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 2.15rem;
  min-width: 2.15rem;
  height: 2.15rem;
  min-height: 2.15rem;
  padding: 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: 0.55rem;
  background: #ffffff;
  cursor: pointer;
  touch-action: manipulation;
}

.graph-history-color-button:focus-visible,
.graph-history-color-choice:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.graph-history-color-swatch {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0.3rem;
}

.graph-history-color-picker {
  position: absolute;
  z-index: 10;
  top: auto;
  bottom: calc(100% + 0.3rem);
  right: 0;
  display: grid;
  grid-template-columns: repeat(8, 1.5rem);
  grid-auto-rows: 1.5rem;
  gap: 0.25rem;
  width: 14.7rem;
  min-width: 14.7rem;
  box-sizing: border-box;
  padding: 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: 0.65rem;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(42, 31, 19, 0.18);
}

.graph-history-color-choice {
  position: relative;
  width: 1.5rem;
  height: 1.5rem;
  min-width: 1.5rem;
  min-height: 1.5rem !important;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 0.4rem;
  background: var(--swatch-color);
  cursor: pointer;
  touch-action: manipulation;
}

.graph-history-color-choice.is-selected {
  border-color: var(--color-ink);
  box-shadow: inset 0 0 0 2px #ffffff;
}

.graph-history-axis-section {
  max-width: 52rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--color-border);
}

.graph-history-axis-section .form-grid {
  padding-bottom: 0;
}

.graph-history-axis-section .graph-axis-row {
  min-height: 2.45rem;
}

.graph-settings-page .graph-history-plot-button {
  margin-top: 0.75rem;
  width: min(100%, 15rem);
  min-height: 2.8rem;
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-brand-ink);
  box-shadow: 0 8px 18px var(--color-brand-shadow);
}

.graph-history-modal {
  position: absolute;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  inset: 0;
  padding: 0.75rem;
  background: #ffffff;
  color: var(--color-ink);
}

.graph-history-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex: 0 0 auto;
  min-height: 2.75rem;
  margin-bottom: 0.5rem;
}

.graph-history-modal-header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.graph-history-modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.graph-history-modal-header .signal-desc {
  margin: 0.15rem 0 0;
}

.graph-history-modal-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
}

.graph-history-modal-points {
  color: var(--color-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.graph-history-modal .graph-history-legend.legend.legend-inline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 1.6rem;
  margin-top: 0.35rem;
  overflow: hidden;
}

.graph-history-modal .graph-history-legend .legend-axis-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
  min-width: 0;
  flex: 1 1 50%;
  max-width: 50%;
  overflow: hidden;
}

.graph-history-modal .graph-history-legend .legend-axis-right {
  justify-content: flex-end;
}

.graph-history-modal .graph-history-legend.legend.legend-inline .legend-item {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  justify-content: flex-start;
  font-size: 0.72rem;
}

.graph-history-modal .graph-history-legend .legend-item > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-history-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--color-ink);
  font-size: 0.76rem;
  white-space: nowrap;
}

.graph-history-legend-item small {
  color: var(--color-muted);
  font-size: 0.68rem;
}

.graph-history-legend-swatch {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex: 0 0 auto;
}

.graph-history-modal-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.graph-history-modal-actions .graph-history-modal-close,
.graph-history-export {
  flex: 0 0 2.75rem;
  width: 2.75rem;
  min-width: 2.75rem;
  height: 2.75rem;
  min-height: 2.75rem;
}

.graph-history-export-spinner {
  animation: graph-history-export-spin 0.9s linear infinite;
}

@keyframes graph-history-export-spin {
  to { transform: rotate(360deg); }
}

.graph-history-modal-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.4rem;
  flex: 1 1 auto;
  min-height: 0;
}

.graph-history-modal-feedback {
  min-height: 0;
}

.graph-history-export-status {
  box-sizing: border-box;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
}

.graph-history-export-status.is-success {
  border-color: rgba(28, 142, 122, 0.35);
  background: rgba(28, 142, 122, 0.12);
  color: #0f6b5c;
}

.graph-history-export-status.is-error {
  border-color: rgba(180, 35, 24, 0.4);
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
}

.graph-history-export-status.is-info {
  border-color: rgba(37, 105, 165, 0.28);
  background: rgba(37, 105, 165, 0.1);
  color: #1f5d8f;
}

.graph-history-modal-canvas {
  min-height: 0;
  height: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.history-svg-plot {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  touch-action: pan-y;
}

.history-svg-label {
  fill: var(--color-muted);
  font-family: var(--font-display);
  font-size: 12px;
}

.history-svg-axis-name {
  fill: var(--color-ink);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 700px) {
  .graph-settings-page {
    padding-right: 0.35rem;
  }

  .graph-settings-heading,
  .graph-settings-card-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }

  .graph-settings-card-caption {
    text-align: left;
    white-space: normal;
  }

  .graph-settings-card-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.15rem;
  }

  .graph-history-range-row {
    grid-template-columns: 1fr;
  }

  .graph-history-grid {
    grid-template-columns: 1fr;
  }

  .graph-settings-page .graph-history-series-row {
    grid-template-columns: minmax(5.5rem, auto) minmax(0, 1fr);
  }

  .graph-settings-page .graph-history-series-row .graph-axis-toggle {
    grid-column: 2 / -1;
  }

  .graph-history-axis-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.15rem;
  }

  .graph-history-modal .graph-history-legend.legend.legend-inline {
    flex-direction: column;
    gap: 0.25rem;
  }

  .graph-history-modal .graph-history-legend .legend-axis-group {
    width: 100%;
    max-width: 100%;
  }

  .graph-history-modal .graph-history-legend .legend-axis-right {
    justify-content: flex-start;
  }

  .graph-history-modal-header h2 {
    font-size: 1.1rem;
  }
}

.legend {
  display: grid;
  gap: 0.6rem;
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.legend.legend-inline {
  display: grid;
  gap: 0.18rem;
  height: auto;
  max-height: none;
}

.legend.legend-inline .legend-item {
  flex: 0 1 auto;
  justify-content: center;
  min-width: 0;
  margin-bottom: 0;
  white-space: nowrap;
}

.graph-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.graph-legend-header .icon-btn {
  flex-shrink: 0;
}

.graph-legend-header .legend {
  flex: 1 1 auto;
  min-width: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  padding: 0;
  border-radius: 0;
  border: none;
}

.legend-item-button {
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
  text-align: left;
  font-size: 0.72rem;
  line-height: 1.05;
  box-shadow: none;
}

.legend-item-button:hover {
  background: transparent;
}

.legend-item-button.is-empty {
  opacity: 0.7;
}

.graph-series-grid .form-row {
  grid-template-columns: minmax(90px, 0.45fr) minmax(0, 1.55fr) minmax(0, 0.05fr);
  align-items: start;
}

.graph-series-grid {
  row-gap: 1rem;
  padding-top: 0.5rem;
}

.graph-series-grid .form-row:nth-child(3) {
  padding-top: 0.5rem;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(8, var(--swatch-size, 26px));
  grid-auto-rows: var(--swatch-size, 26px);
  gap: 0.35rem;
  width: 100%;
}

.color-swatch {
  position: relative;
  width: var(--swatch-size, 26px);
  height: var(--swatch-size, 26px);
  border-radius: 0.5rem;
  border: 2px solid transparent;
  background: var(--swatch-color, #1c8e7a);
  background-color: var(--swatch-color, #1c8e7a);
  cursor: pointer;
  min-width: 0;
  padding: 0;
  box-shadow: none;
  outline: none;
  appearance: none;
}

.color-swatch.is-selected {
  border-color: var(--color-ink);
  background: #ffffff;
}

.color-swatch.is-selected::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 0.35rem;
  background: var(--swatch-color, #1c8e7a);
}

.graph-axis-row label {
  font-size: 0.9rem;
  font-weight: 600;
}

.graph-axis-row .axis-spacer {
  min-height: 1px;
}

.graph-axis-limits {
  box-sizing: border-box;
  padding-left: 0.75rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.settings-grid {
  display: grid;
  gap: 0.8rem;
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-muted);
  padding: 0.35rem 0.8rem;
  min-height: 2.2rem;
  border-radius: 999px;
  line-height: 1;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.tab-pill.is-active {
  color: #0f6b5c;
  border-color: rgba(28, 142, 122, 0.35);
  background: rgba(28, 142, 122, 0.12);
}

.graph-axis-toggle .tab-pill {
  color: var(--color-muted);
  border-color: var(--color-border);
  background: var(--color-bg);
}

.graph-axis-toggle .tab-pill.is-active {
  color: var(--color-brand-ink);
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
  font-weight: 600;
}

.graph-axis-toggle .tab-pill:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.tab-pill.is-action {
  color: var(--accent-4);
  border-color: rgba(37, 105, 165, 0.35);
  background: rgba(37, 105, 165, 0.12);
}

.tab-pill.is-service {
  color: var(--accent-4);
  border-color: rgba(37, 105, 165, 0.45);
  background: rgba(37, 105, 165, 0.16);
  font-weight: 600;
}

.tab-pill.is-danger {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.35);
  background: rgba(180, 35, 24, 0.12);
}

.tab-pill.is-backup.is-active {
  color: var(--color-brand-ink);
  border-color: rgba(242, 230, 0, 0.9);
  background: var(--color-brand);
}

.settings-system-page .tab-pill {
  color: var(--color-brand-ink);
  border-color: rgba(242, 230, 0, 0.9);
  background: var(--color-brand-soft);
}

.settings-system-page .tab-pill.is-active {
  color: var(--color-brand-ink);
  border-color: rgba(242, 230, 0, 0.9);
  background: var(--color-brand);
}

.settings-system-page .tab-pill.is-service {
  color: var(--color-brand-ink);
  border-color: rgba(242, 230, 0, 0.9);
  background: var(--color-brand-soft);
  font-weight: 600;
}

.settings-system-page .system-reset-actions .action-pill.is-primary {
  border-color: rgba(242, 230, 0, 0.9);
  background: var(--color-brand);
  color: var(--color-brand-ink);
}

.logout-modal .logout-actions .action-pill.logout-cancel-button {
  border-color: rgba(242, 230, 0, 0.9);
  background: var(--color-brand);
  color: var(--color-brand-ink);
}

.action-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  background: var(--accent-4);
  color: #fff;
  padding: 0.45rem 1rem;
  min-height: 2.4rem;
  border-radius: 999px;
  line-height: 1;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: none;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(42, 31, 19, 0.08);
}

.action-pill i,
.action-pill .app-icon {
  font-size: 1rem;
}

.action-pill.is-primary {
  border-color: rgba(37, 105, 165, 0.45);
  background: var(--accent-4);
}

.action-pill.is-brand {
  border-color: rgba(242, 230, 0, 0.9);
  background: var(--color-brand);
  color: var(--color-brand-ink);
}

.action-pill.is-success {
  border-color: rgba(28, 142, 122, 0.45);
  background: #0f6b5c;
}

.action-pill.is-danger {
  border-color: rgba(180, 35, 24, 0.5);
  background: #b42318;
}

.action-pill:hover:not(:disabled) {
  filter: brightness(1.06);
}

.action-pill:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  margin-bottom: 0;
}

.main-content.vert-centered {
  justify-content: center;
}

.main-content>* {
  flex: 0 0 auto;
  min-height: 0;
  min-width: 0;
}

.main-content>:has(+ .osk-overlay),
.main-content>:has(+ .logout-overlay),
.main-content>:last-child:not(.osk-overlay):not(.logout-overlay) {
  flex: 1 1 auto;
  min-height: 0;
}

.form-card {
  background-color: var(--pico-background-color);
  /* border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px var(--color-shadow); */
  border: none;
  display: grid;
  align-content: start;
  gap: 1rem;
  margin: 0;
}

.content-card {
  grid-template-rows: auto 1fr;
  gap: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
  /* padding: 0.65rem 0.9rem; */
  margin-bottom: 0;
  border: none;
}

.content-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.content-card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.content-card-title-spacer {
  flex: 1;
}

.content-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.content-card-actions .icon-btn {
  width: 2.1rem;
  height: 2.1rem;
}

.content-card-actions .icon-btn .app-icon {
  font-size: 1.1rem;
}

.content-card-body {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  overflow: auto;
  min-width: 0;
  min-height: 0;
}

.content-card-body>.data-table {
  margin: 0;
}


.gas-editor-panel {
  min-height: 0;
}

.gas-editor-card {
  min-height: 0;
  gap: 0;
}

.gas-editor-header {
  align-items: flex-start;
  padding: 0.8rem 1rem 0.5rem;
}

.gas-editor-heading {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.gas-editor-body {
  padding: 0 1rem 0.8rem;
  gap: 0.7rem;
}

.gas-editor-grid {
  gap: 0.5rem;
}

.gas-editor-grid .form-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 0.35fr);
  gap: 0.4rem;
}

.gas-editor-grid .form-row label {
  font-size: 0.85rem;
}

.field-value {
  margin: 0;
  padding: 0.35rem 0.1rem;
  color: var(--color-text);
}

.gas-editor-table th,
.gas-editor-table td {
  padding: 0.45rem 0.4rem;
}

.gas-editor-table th {
  font-size: 0.65rem;
}

.gas-editor-table td {
  font-size: 0.9rem;
}

.gas-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.calibration-valves-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.1rem 0 0.45rem;
}

body[data-page="calibration-valves"] .data-table td,
body[data-page="calibration-valves"] .data-table th {
  vertical-align: middle;
}

body[data-page="calibration-valves"] .data-table td:last-child {
  text-align: right;
}

body[data-page="calibration-valves"] .valve-toggle {
  vertical-align: middle;
}

.form-grid {
  display: grid;
  gap: 0;
  align-content: start;
  padding-bottom: 1rem;
}

.form-section-title {
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 0.5fr);
  gap: 0.6rem;
  align-items: center;
}

.form-row label {
  font-size: 0.9rem;
  font-weight: 600;
}

.form-row.adc-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 0.6fr) auto;
}

.form-row.adc-row .icon-btn {
  justify-self: end;
}

.form-row.form-row-header {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-muted);
}



.form-row select {
  width: 100%;
}

.outputs-ma420-page .form-row > text-editor,
.outputs-ma420-page .form-row > text-editor .edit-group {
  width: 100%;
}

.edit-group {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 0.6rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  overflow: hidden;
}

.edit-group input {
  border: none;
  box-shadow: none;
  background: transparent;
  margin: 0;
  padding: 0.35rem 0.6rem;
  min-height: 2.2rem;
}

.edit-group.is-display {
  border: 1px solid transparent;
  background: transparent;
}

.edit-group.is-display input {
  padding: 0.1rem 0;
  min-height: auto;
  font-weight: 400;
  color: var(--color-text);
}

.edit-group.is-display .icon-btn {
  border-left: none;
}

.edit-group.is-display {
  background: var(--color-brand-soft);
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0.05rem 0.3rem;
  justify-content: space-between;
}

.edit-group.is-display .edit-value {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.05rem 0;
  font-weight: 400;
  color: var(--color-text);
}

.select-value-display {
  width: 100%;
  justify-content: space-between;
}

.select-value-display .edit-value {
  flex: 1 1 auto;
  min-width: 0;
}


.edit-group .icon-btn {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0.15rem;
}

.edit-group .icon-btn {
  border-left: 1px solid var(--color-border);
  border-radius: 0;
  width: 1.9rem;
  height: 1.9rem;
}

.edit-group.is-display .icon-btn {
  margin-left: auto;
  flex: 0 0 auto;
}

text-editor {
  display: block;
}

.channel-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.channel-badges.compact {
  flex-wrap: nowrap;
  gap: 0.25rem;
}

.channel-badges.compact .channel-badge {
  padding: 0.25rem 0.55rem;
  min-width: 2rem;
}

.channel-badge {
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-weight: 600;
  min-width: 2.2rem;
  text-align: center;
  color: var(--color-muted);
}

.channel-badge.active {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
  color: var(--color-brand-ink);
}

.channel-badge:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.form-row .unit {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.range-toggle {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 0.6rem;
}

.range-toggle-label {
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.mode-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.mode-option input[type="radio"] {
  --pico-primary-background: var(--color-brand);
  --pico-primary-border: var(--color-brand);
  --pico-form-element-focus-color: var(--color-brand-shadow);
  accent-color: var(--color-brand);
}

.range-channel {
  display: grid;
  gap: 0.4rem;
}

.range-channel-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.range-channel-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.range-values {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.range-values p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}


.pmag-inline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pmag-inline-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 0;
  min-width: 0;
}

.pmag-inline-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.pmag-inline text-editor,
.pmag-inline select-value {
  min-width: 0;
}

.pmag-inline-item text-editor {
  display: block;
  width: 100%;
  min-width: 0;
}

.pmag-inline-item .edit-group {
  width: 100%;
  min-width: 0;
}

.pmag-inline-item .edit-group .edit-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmag-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.pmag-unit {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.pmag-toggle-label {
  font-weight: 600;
  color: var(--color-text);
}

.pmag-toggle-muted {
  color: var(--color-muted);
  font-weight: 500;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1rem;
}

.slot-column {
  display: grid;
  gap: 0.3rem;
}

.slot-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 1.5fr) minmax(0, 0.25fr);
  gap: 0.6rem;
  align-items: center;
}

.osk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.35);
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  z-index: 60;
}

.osk-modal {
  width: 100%;
  height: 100%;
  background: var(--color-bg);
  border-radius: 0;
  border: 1px solid var(--color-border);
  padding: 1.1rem 1.6rem 0.6rem;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 1rem;
  box-shadow: none;
}

.select-picker-modal {
  width: 100%;
  height: 100%;
  background: var(--color-bg);
  border-radius: 0;
  border: 1px solid var(--color-border);
  padding: 1.1rem 1.6rem 0.8rem;
  overflow: auto;
}

.select-picker-modal screen-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-bg);
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
}

.select-picker-modal .picker-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 1rem;
  min-height: 0;
}

.select-picker-modal .menu-grid {
  align-content: start;
}

.osk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.time-editor-modal {
  width: 100%;
  height: 100%;
  background: var(--color-bg);
  border-radius: 0;
  border: 1px solid var(--color-border);
  padding: 1.1rem 1.6rem 0.8rem;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 1rem;
}

.time-editor-body {
  display: grid;
  align-content: center;
}

.time-editor-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  justify-items: center;
  align-items: center;
}

.time-wheel {
  width: min(200px, 100%);
  height: 240px;
  overflow-y: auto;
  border-radius: 1rem;
  border: 1px solid var(--color-border);
  background: var(--color-brand-soft);
  padding: 100px 0;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.time-wheel-item {
  scroll-snap-align: center;
  height: 40px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--color-muted);
  font-size: 1.05rem;
  font-weight: 500;
}

.time-wheel-item.is-active {
  color: var(--color-text);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.8);
}

.osk-input {
  width: 100%;
}

.osk-keyboard-slot {
  display: flex;
  align-items: flex-end;
  height: 280px;
  margin-top: -0.4rem;
}

.osk-keyboard {
  width: 100%;
  height: 100%;
  background: #e7e7e7;
  border-radius: 0.8rem;
  padding: 0.6rem;
  display: grid;
  gap: 0.4rem;
}

.osk-row {
  display: grid;
  gap: 0.4rem;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}

.osk-key {
  margin: 1px;
  border: none;
  border-radius: 0.7rem;
  background: #f9f9f9;
  color: #5a5a5a;
  font-size: 16px;
  font-weight: 600;
  min-height: 48px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.osk-key:active {
  transform: translateY(1px);
}

.osk-key-ok {
  background: rgba(15, 107, 92, 0.18);
  color: #0f6b5c;
}

.osk-key-back {
  background: rgba(160, 60, 44, 0.15);
  color: #a33a2a;
}

.osk-key-space {
  grid-column: span 3;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.system-reset-actions {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.system-reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}


.menu-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.menu-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.8rem;
  /* box-shadow: 0 18px 40px var(--color-shadow); */
  display: grid;
  gap: 1rem;
  margin: 0;
}

.menu-card-link {
  cursor: pointer;
}


.valve-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  width: 42px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  vertical-align: middle;
  overflow: hidden;
}

.valve-toggle>input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: inherit;
}

.valve-toggle.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.valve-toggle-track {
  position: relative;
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.35);
  border: 1px solid rgba(107, 114, 128, 0.35);
}

.valve-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

.valve-toggle[aria-checked="true"] .valve-toggle-track,
.valve-toggle>input:checked+.valve-toggle-track {
  background: rgba(18, 122, 58, 0.75);
  border-color: rgba(18, 122, 58, 0.75);
}

.valve-toggle[aria-checked="true"] .valve-toggle-track::after,
.valve-toggle>input:checked+.valve-toggle-track::after {
  transform: translateX(20px);
}

.menu-card-head {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}

.menu-card-body {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  flex: 1 1 auto;
  min-width: 0;
}

.menu-card-actions {
  display: inline-flex;
  align-items: flex-start;
  margin-left: auto;
}

.menu-card-edit {
  flex: 0 0 auto;
}

.menu-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.settings-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.settings-breadcrumb-separator {
  opacity: 0.65;
}

.settings-crumb {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--color-ink);
  text-decoration: none;
  appearance: none;
  margin: 0;
}

.settings-crumb:not(.settings-crumb-link) {
  font-weight: 600;
}

.settings-crumb-link {
  cursor: pointer;
  color: inherit;
  text-decoration: underline;
}

.settings-crumb-link:hover {
  color: var(--color-ink);
}

.settings-crumb:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-brand) 65%, transparent);
  outline-offset: 2px;
}

.settings-menu-card {
  min-height: 104px;
}

.settings-menu-card:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.settings-menu-shell {
  grid-template-rows: auto 1fr;
}

.settings-menu-header {
  align-items: flex-start;
}

.settings-menu-body {
  overflow: auto;
  align-content: start;
}

.settings-menu-body .settings-breadcrumb {
  margin-bottom: 0;
}

.gas-editor-card .menu-title-row {
  margin-bottom: 0.6rem;
}

.menu-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}


.error-report {
  display: grid;
  grid-template-rows: 1.6rem auto;
  gap: 0.35rem;
  margin: 0 0.45rem;
}

.error-report-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  border-bottom: 2px solid var(--color-brand-soft);
}

.error-report-tab {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--color-muted);
  padding: 0;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.15;
  width: 100%;
  min-width: 0;
  text-align: center;
  height: 1.6rem;
}

.error-report-tab:hover,
.error-report-tab.is-active {
  background: var(--color-brand-soft);
  border-bottom-color: var(--color-brand);
  color: var(--color-brand-ink);
}

.error-report-tab:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.error-report-panel {
  display: grid;
  gap: 0.4rem;
  min-height: auto;
  overflow: visible;
}

.error-archive-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: nowrap;
  min-height: 1.8rem;
}

.error-archive-toolbar label {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}

.error-archive-toolbar select {
  min-width: 9rem;
  min-height: 1.8rem;
  height: 1.8rem;
  padding: 0.1rem 0.55rem;
  font-size: 0.95rem;
  line-height: 1.2;
  border-radius: var(--radius-sm);
}

.error-clear-history-button {
  margin-left: auto;
  min-height: 1.8rem;
  height: 1.8rem;
  padding: 0.1rem 0.55rem;
  font-size: 0.95rem;
  line-height: 1.2;
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-brand-ink);
  white-space: nowrap;
}

.error-clear-history-button:hover:not(:disabled) {
  border-color: var(--color-brand-ink);
  background: var(--color-brand-soft);
}

.error-history-table tr {
  cursor: default;
}

.error-report-table th {
  font-weight: 800;
  color: var(--color-ink);
}

.error-report-table th,
.error-report-table td {
  padding-block: 0.4rem;
  height: auto;
  line-height: 1.4;
  vertical-align: middle;
}


.error-detail-card {
  display: grid;
  gap: 1rem;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1rem 1.2rem;
}

.error-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.error-detail-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.error-detail-actions button:not(.icon-btn) {
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-weight: 600;
}

.error-detail-actions .error-clear-fault-button {
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-brand-ink);
}

.error-detail-actions .error-clear-fault-button:hover:not(:disabled) {
  border-color: var(--color-brand-ink);
  background: var(--color-brand-soft);
}

.error-close-icon {
  color: var(--color-muted);
}

.error-close-icon:hover {
  color: var(--color-ink);
  background: rgba(0, 0, 0, 0.08);
}

.error-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.error-detail-field {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.6rem;
  align-items: baseline;
}

.error-detail-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-muted);
}

.error-detail-value {
  font-size: 1rem;
  font-weight: 500;
}

@media (max-width: 720px) {
  .error-detail-grid {
    grid-template-columns: 1fr;
  }

  .error-detail-field {
    grid-template-columns: 130px 1fr;
  }
}

.error-report-table tr {
  cursor: pointer;
}

.error-text {
  color: #b42318;
}


.menu-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--color-brand-soft);
  color: var(--color-brand-ink);
  /* box-shadow: 0 14px 26px rgba(28, 142, 122, 0.25); */
  flex: 0 0 auto;
}

.menu-icon .app-icon {
  font-size: 22px;
}

.menu-title {
  margin: 0.1rem 0 0.2rem;
  font-size: 1.1rem;
}


.series-row {
  display: grid;
  gap: 0.4rem;
}

.series-row select {
  border-radius: var(--radius-sm);
}

@media (max-width: 750px) {
  .graph-layout {
    grid-template-columns: 1fr;
  }

  .topbar-layout {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "left right"
      "center center";
    row-gap: 0.6rem;
  }

  .topbar-left {
    grid-area: left;
  }

  .topbar-center {
    grid-area: center;
  }

  .topbar-right {
    grid-area: right;
  }
}

@media (max-width: 600px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .signal-card {
    padding: 1rem;
  }
}

body[data-page="home"] .home-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding-top: 0.65rem;
  padding-right: 0.65rem;
}

body[data-page="home"] .home-grid {
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.65rem;
  display: grid;
  align-content: stretch;
  grid-auto-rows: minmax(8rem, 1fr);
}

body[data-page="home"] .home-grid.tiles-1 {
  grid-template-columns: minmax(0, 1fr);
  --home-tile-value-base: clamp(3rem, 32cqmin, 7.5rem);
}

body[data-page="home"] .home-grid.layout-columns,
body[data-page="home"] .home-grid.tiles-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  --home-tile-value-base: clamp(2.4rem, 25cqmin, 5rem);
}

body[data-page="home"] .home-grid.layout-rows {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  --home-tile-value-base: clamp(2.4rem, 10.5cqi, 5rem);
}

body[data-page="home"] .home-grid.layout-top,
body[data-page="home"] .home-grid.layout-left {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  --home-tile-value-base: clamp(2.2rem, 18cqi, 4.25rem);
}

body[data-page="home"] .home-grid.layout-top-double {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: clamp(4.5rem, 14vh, 5.25rem) clamp(4.5rem, 14vh, 5.25rem) minmax(8rem, 1fr);
  gap: 0.65rem;
  --home-tile-value-base: clamp(2rem, 20cqi, 4.4rem);
}

/* Production default: one large process card on the left, two compact
   measurements on the right, and two process cards along the bottom. */
body[data-page="home"] .home-grid.layout-main {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
  --home-tile-value-base: clamp(2rem, 18cqi, 4.25rem);
}

body[data-page="home"] .home-grid.layout-main .home-tile.slot-primary {
  grid-column: 1 / span 4;
  grid-row: 1 / span 2;
}

body[data-page="home"] .home-grid.layout-main .home-tile.slot-secondary {
  grid-column: 5 / -1;
  grid-row: 1;
}

body[data-page="home"] .home-grid.layout-main .home-tile.slot-tertiary {
  grid-column: 5 / -1;
  grid-row: 2;
}

body[data-page="home"] .home-grid.layout-main .home-tile.slot-quaternary {
  grid-column: 1 / span 3;
  grid-row: 3;
}

body[data-page="home"] .home-grid.layout-main .home-tile.slot-quinary {
  grid-column: 4 / span 3;
  grid-row: 3;
}

body[data-page="home"] .home-grid.layout-main .home-tile.slot-secondary,
body[data-page="home"] .home-grid.layout-main .home-tile.slot-tertiary {
  min-height: 0;
}

/* Multigas repeats the main process composition for H2 and O2: one large
   gas card with two compact, freely assignable measurements beside it. */
body[data-page="home"] .home-grid.layout-multigas {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  --home-tile-value-base: clamp(1.7rem, 8.8cqi, 2.7rem);
}

body[data-page="home"] .home-grid.layout-multigas .home-tile {
  min-height: 0;
}

body[data-page="home"] .home-grid.layout-multigas .home-tile.slot-primary {
  grid-column: 1 / span 4;
  grid-row: 1 / span 2;
}

body[data-page="home"] .home-grid.layout-multigas .home-tile.slot-secondary {
  grid-column: 5 / -1;
  grid-row: 1;
}

body[data-page="home"] .home-grid.layout-multigas .home-tile.slot-tertiary {
  grid-column: 5 / -1;
  grid-row: 2;
}

body[data-page="home"] .home-grid.layout-multigas .home-tile.slot-quaternary {
  grid-column: 1 / span 4;
  grid-row: 3 / span 2;
}

body[data-page="home"] .home-grid.layout-multigas .home-tile.slot-quinary {
  grid-column: 5 / -1;
  grid-row: 3;
}

body[data-page="home"] .home-grid.layout-multigas .home-tile.slot-senary {
  grid-column: 5 / -1;
  grid-row: 4;
}

body[data-page="home"] .home-grid.layout-top-double .home-tile.slot-primary,
body[data-page="home"] .home-grid.layout-top-double .home-tile.slot-secondary {
  grid-column: 1 / -1;
}

body[data-page="home"] .home-grid.layout-top-double .home-tile.slot-primary {
  grid-row: 1;
}

body[data-page="home"] .home-grid.layout-top-double .home-tile.slot-secondary {
  grid-row: 2;
}

body[data-page="home"] .home-grid.layout-top-double .home-tile.slot-primary,
body[data-page="home"] .home-grid.layout-top-double .home-tile.slot-secondary {
  min-height: 0;
}

body[data-page="home"] .home-grid.layout-top-double .home-tile.slot-tertiary {
  grid-column: 1;
  grid-row: 3;
}

body[data-page="home"] .home-grid.layout-top-double .home-tile.slot-quaternary {
  grid-column: 2;
  grid-row: 3;
}

body[data-page="home"] .home-grid.layout-top .home-tile.slot-primary {
  grid-column: 1 / -1;
  --home-tile-value-base: clamp(2.4rem, 10.5cqi, 5rem);
}

body[data-page="home"] .home-grid.layout-left .home-tile.slot-primary {
  grid-row: 1 / -1;
  --home-tile-value-base: clamp(2.4rem, 20cqi, 4.75rem);
}

body[data-page="home"] .home-grid.tiles-4 {
  --home-tile-value-base: clamp(2rem, 24cqmin, 4.25rem);
}

body[data-page="home"] .home-tile {
  background: #fff;
  border: 1px solid #e8dfd3;
  border-radius: var(--radius-lg);
  padding: 0;
  margin: 0;
  box-shadow: 0 0.45rem 1.2rem rgba(42, 31, 19, 0.09);
  position: relative;
  overflow: hidden;
  min-height: 8rem;
  container-type: size;
}

body[data-page="home"] .home-tile-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(0.35rem, 3cqmin, 0.7rem);
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(0.7rem, 4cqmin, 1.15rem) clamp(0.8rem, 4cqmin, 1.25rem);
  text-align: center;
}

/* Fixed production widget for the primary card in the main layout. The
   content remains above the animated surface so the background never competes
   with the gas name, reading, or status. */
body[data-page="home"] .home-tile.widget-main-gas .home-tile-content {
  padding: 0;
  text-align: left;
}

body[data-page="home"] .home-main-gas-widget {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background: #fff;
}

body[data-page="home"] .home-main-gas-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(0.9rem, 4cqmin, 1.35rem) clamp(1rem, 4cqmin, 1.5rem);
}

body[data-page="home"] .home-main-gas-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(0.7rem, 4cqi, 1.5rem);
  min-width: 0;
  transform: translateY(0.65rem);
}

body[data-page="home"] .home-main-gas-label {
  min-width: 0;
  overflow: hidden;
  color: var(--color-ink);
  font-size: clamp(3.4rem, 12cqi, 6rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
}

body[data-page="home"] .home-main-gas-reading {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(0.3rem, 2cqi, 0.8rem);
  padding-top: 0;
  font-family: var(--font-display);
  white-space: nowrap;
}

body[data-page="home"] .home-main-gas-value {
  color: var(--color-text);
  font-size: clamp(3.4rem, 12cqi, 6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

body[data-page="home"] .home-main-gas-unit {
  align-self: center;
  padding: 0;
  color: var(--color-muted);
  font-size: clamp(2.2rem, 7.5cqi, 3.5rem);
  font-weight: 500;
  line-height: 1;
}

body[data-page="home"] .home-main-gas-status-row {
  display: flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.55rem;
  transform: translateY(0.28rem);
  min-height: 1.35rem;
  color: var(--color-muted);
  font-size: clamp(0.78rem, 3cqi, 1rem);
  font-weight: 700;
  font-family: var(--font-display);
}

body[data-page="home"] .home-main-gas-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: auto;
}

body[data-page="home"] .home-main-gas-range-row {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  color: var(--color-muted);
  font-family: var(--font-display);
  font-size: clamp(0.82rem, 3.1cqi, 1.05rem);
  font-weight: 700;
}

body[data-page="home"] .home-main-gas-range-row strong {
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}

body[data-page="home"] .home-main-gas-ok,
body[data-page="home"] .home-main-gas-range {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

body[data-page="home"] .home-main-gas-led {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: #42c879;
  box-shadow: 0 0 0 0.18rem rgba(66, 200, 121, 0.14), 0 0 0.55rem rgba(66, 200, 121, 0.55);
}

body[data-page="home"] .home-main-gas-range strong {
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}

body[data-page="home"] .home-main-gas-error {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.5rem;
  margin: 0;
  border: 1px solid rgba(180, 35, 24, 0.25);
  border-radius: 999px;
  background: rgba(180, 35, 24, 0.08);
  color: #b42318;
  box-shadow: none;
  font: inherit;
  cursor: pointer;
}

body[data-page="home"] .home-main-gas-error-inline {
  flex: 0 0 auto;
  justify-content: center;
  width: clamp(2rem, 7cqi, 3.1rem);
  height: clamp(2rem, 7cqi, 3.1rem);
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 0.18rem 0.55rem rgba(180, 35, 24, 0.16);
  font-size: clamp(1rem, 3.2cqi, 1.45rem);
}

body[data-page="home"] .home-main-gas-error-inline .app-icon {
  display: block;
  line-height: 1;
}

body[data-page="home"] .home-main-gas-error-text {
  font-size: clamp(0.68rem, 3.4cqi, 0.9rem);
}

body[data-page="home"] .home-main-gas-error-text .signal-error-code {
  letter-spacing: 0.04em;
}

body[data-page="home"] .home-main-gas-ambient {
  position: absolute;
  z-index: 0;
  right: 0;
  bottom: 0;
  left: 0;
  height: 46%;
  overflow: hidden;
  opacity: 1;
  pointer-events: none;
}

body[data-page="home"] .home-main-gas-waves {
  display: block;
  width: 100%;
  height: 100%;
  transform: translateY(0.45rem);
}

body[data-page="home"] .home-main-gas-wave-back {
  opacity: 0.43;
}

body[data-page="home"] .home-main-gas-wave-middle {
  opacity: 0.37;
}

body[data-page="home"] .home-main-gas-wave-front {
  opacity: 0.36;
}

body[data-page="home"] .home-tile-header {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

body[data-page="home"] .home-tile-label {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-ink);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

body[data-page="home"] .home-tile-header .home-tile-label {
  flex: 0 1 auto;
  width: auto;
}

body[data-page="home"] .home-tile.widget-range-circular .home-tile-header {
  display: none;
}

body[data-page="home"] .home-tile.widget-range-circular .home-tile-content {
  padding: clamp(0.45rem, 2.5cqmin, 0.8rem) clamp(0.65rem, 3.5cqi, 1.1rem);
}

body[data-page="home"] .home-tile.widget-trend .home-tile-header {
  display: none;
}

body[data-page="home"] .home-tile.widget-trend .home-tile-content {
  padding: clamp(0.45rem, 2.5cqmin, 0.8rem) clamp(0.65rem, 3.5cqi, 1.1rem);
}

body[data-page="home"] .home-value-widget {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.35rem, 3cqmin, 0.7rem);
  width: 100%;
}

body[data-page="home"] .home-tile.widget-value .home-tile-content {
  justify-content: center;
}

body[data-page="home"] .home-tile.is-horizontal-value.widget-value .home-tile-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: clamp(0.45rem, 3cqmin, 0.9rem);
}

body[data-page="home"] .home-tile.is-horizontal-value.widget-value .home-tile-header,
body[data-page="home"] .home-tile.is-horizontal-value.widget-value .home-value-widget {
  display: contents;
}

body[data-page="home"] .home-tile.is-horizontal-value.widget-value .home-tile-label {
  grid-column: 1;
  grid-row: 1;
  width: auto;
  text-align: left;
  font-size: 1.6rem;
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1;
}

body[data-page="home"] .home-tile.is-horizontal-value.widget-value .home-tile-value {
  grid-column: 2;
  grid-row: 1;
}

body[data-page="home"] .home-tile.is-horizontal-value.widget-value .home-tile-meta {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  justify-content: flex-end;
}

body[data-page="home"] .home-tile.widget-value .home-value-widget {
  flex: 0 1 auto;
}

body[data-page="home"] .home-tile-unit {
  color: var(--color-muted);
  font-weight: 600;
  line-height: 1.1;
}

body[data-page="home"] .home-tile-meta {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
}

body[data-page="home"] .home-tile-unit {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-muted);
  font-size: clamp(0.82rem, 4.5cqmin, 1.1rem);
  font-weight: 600;
  line-height: 1.1;
}

body[data-page="home"] .home-tile.is-horizontal-value .home-tile-unit {
  color: var(--color-ink);
  font-size: 1.6rem;
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1;
  text-align: right;
}

body[data-page="home"] .home-tile-error {
  display: inline-flex;
  justify-content: center;
  align-items: baseline;
  flex: 0 0 auto;
}

body[data-page="home"] .home-tile.is-horizontal-value .home-tile-error {
  align-self: center;
}

body[data-page="home"] .home-tile-error-pill {
  font-size: clamp(0.68rem, 3.4cqmin, 0.9rem);
  line-height: 1.1;
  cursor: pointer;
  font-family: inherit;
}

body[data-page="home"] .home-tile-error-pill:active {
  transform: scale(0.96);
}

/* Compact process measurements stay as value cards. Keep the signal label
   readable and use the selected unit to identify the metric. */
body[data-page="home"] .home-tile.is-compact-metric.widget-value .home-tile-content {
  display: flex;
  justify-content: space-between;
  gap: clamp(0.3rem, 2cqmin, 0.55rem);
  padding: clamp(0.62rem, 3cqmin, 0.85rem) clamp(0.72rem, 3.2cqmin, 1rem);
  text-align: left;
}

body[data-page="home"] .home-tile.is-compact-metric.widget-value .home-tile-header {
  display: flex;
  justify-content: flex-start;
}

body[data-page="home"] .home-tile.is-compact-metric.widget-value .home-tile-header {
  position: relative;
}

body[data-page="home"] .home-tile.is-compact-metric.widget-value .home-tile-label {
  width: 100%;
  color: var(--color-muted);
  font-family: var(--font-display);
  font-size: clamp(0.92rem, 3.9cqi, 1.15rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: left;
}

body[data-page="home"] .home-tile.is-compact-metric.widget-value .home-value-widget {
  display: grid;
  position: relative;
  grid-template-columns: auto minmax(0, auto) auto minmax(0, 1fr);
  flex: 1 1 auto;
  align-items: center;
  gap: clamp(0.35rem, 2.5cqi, 0.7rem);
}

body[data-page="home"] .home-compact-metric-icon {
  grid-column: 1;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: clamp(2.35rem, 10cqi, 3.2rem);
  height: clamp(2.35rem, 10cqi, 3.2rem);
  color: var(--home-ambient-gold);
  font-size: clamp(1.55rem, 6cqi, 2rem);
}

body[data-page="home"] .home-compact-metric-icon .app-icon {
  line-height: 1;
}

body[data-page="home"] .home-tile.is-compact-metric.widget-value .home-tile-value {
  grid-column: 2;
  justify-self: end;
  font-size: clamp(1.7rem, 8.8cqi, 2.7rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  text-align: right;
}

body[data-page="home"] .home-tile.is-compact-metric.widget-value .home-tile-meta {
  display: inline-flex;
  grid-column: 3;
  justify-self: start;
  width: auto;
  gap: 0.3rem;
}

body[data-page="home"] .home-tile.is-compact-metric.widget-value .home-tile-error-compact {
  position: absolute;
  top: 0;
  right: 0;
  align-items: flex-start;
  justify-content: flex-end;
  z-index: 2;
}

body[data-page="home"] .home-tile.is-compact-metric.widget-value .home-tile-unit {
  color: var(--color-muted);
  font-size: clamp(0.95rem, 4.2cqi, 1.3rem);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.home-error-overlay {
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(20, 16, 14, 0.42);
  backdrop-filter: blur(3px);
  z-index: 85;
}

.home-error-modal {
  position: relative;
  width: min(100%, 31rem);
  padding: 1.6rem 1.7rem 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-brand-soft);
  box-shadow: 0 20px 55px rgba(20, 16, 14, 0.22);
  text-align: center;
}

.home-error-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
}

.home-error-code {
  display: inline-flex;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.05em;
}

.home-error-title {
  margin: 0.75rem 2rem 0;
  font-size: clamp(1.35rem, 4vw, 1.8rem);
}

.home-error-signal {
  margin: 0.35rem 0 0;
  color: var(--color-muted);
  font-weight: 600;
}

.home-error-description {
  margin: 1rem auto;
  max-width: 26rem;
  line-height: 1.45;
}

.home-error-reading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-muted);
}

.home-error-reading strong {
  color: var(--color-text);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}


body[data-page="home"] .home-tile-value {
  justify-self: center;
  width: fit-content;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-text);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1;
  text-align: center;
  font-size: calc(var(--home-tile-value-base, 1.35rem) * var(--home-tile-value-scale, 1));
}

body[data-page="home"] .home-tile-value span {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="home"] .home-tile-value:disabled {
  opacity: 1;
  cursor: default;
}

body[data-page="home"] .home-tile-value.is-editable {
  cursor: pointer;
}

body[data-page="home"] .home-tile.is-unassigned .home-tile-value {
  /* font-size: clamp(0.9rem, 10cqmin, 2.25rem); */
  font-size: 20cqmin;
}

body[data-page="home"] .home-tile.is-picker-open {
  border-color: var(--home-yellow);
}

body[data-page="home"] .home-tile.is-edit-mode {
  cursor: pointer;
}

body[data-page="home"] .home-range-widget {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.35rem, 3cqmin, 0.65rem);
}

body[data-page="home"] .home-range-widget.is-editable {
  cursor: pointer;
}

body[data-page="home"] .home-range-reading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 0;
}

body[data-page="home"] .home-range-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(1.8rem, 18cqmin, 3.7rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1;
}

body[data-page="home"] .home-range-unit {
  color: var(--color-muted);
  font-size: 1.05rem;
  font-weight: 600;
}

body[data-page="home"] .home-range-meta {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
}

body[data-page="home"] .home-range-meter {
  position: relative;
  width: 100%;
  height: clamp(0.85rem, 6cqmin, 1.25rem);
  padding: 0.15rem 0;
}

body[data-page="home"] .home-range-track {
  position: absolute;
  inset: 0.2rem 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #d6453d 0%, #efb63f 18%, #45a96f 32%, #45a96f 68%, #efb63f 82%, #d6453d 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}

body[data-page="home"] .home-range-marker {
  position: absolute;
  top: 50%;
  left: var(--home-range-position, 50%);
  width: clamp(0.7rem, 5cqmin, 1rem);
  height: clamp(0.7rem, 5cqmin, 1rem);
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--color-ink);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%);
}

body[data-page="home"] .home-tile.range-low .home-range-marker,
body[data-page="home"] .home-tile.range-high .home-range-marker {
  background: #a32920;
}

body[data-page="home"] .home-range-limits {
  display: flex;
  width: 100%;
  justify-content: space-between;
  color: var(--color-muted);
  font-size: clamp(0.66rem, 3.5cqmin, 0.82rem);
}

body[data-page="home"] .home-range-limits span {
  display: flex;
  gap: 0.3rem;
}

body[data-page="home"] .home-range-limits small {
  font-size: inherit;
}

body[data-page="home"] .home-range-limits strong {
  color: var(--color-ink);
}

body[data-page="home"] .home-circular-range-widget {
  flex: 1 1 auto;
  position: relative;
  height: 100%;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  row-gap: clamp(0.25rem, 1.5cqmin, 0.45rem);
}

body[data-page="home"] .home-circular-range-widget.is-editable {
  cursor: pointer;
}

body[data-page="home"] .home-circular-range-widget.is-editable:hover,
body[data-page="home"] .home-circular-range-widget.is-editable:focus,
body[data-page="home"] .home-circular-range-widget.is-editable:active {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-ink);
}

body[data-page="home"] .home-circular-range-widget.is-editable:focus-visible {
  outline: 2px solid rgba(244, 196, 48, 0.65);
  outline-offset: 0.2rem;
}

body[data-page="home"] .home-circular-gauge {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  width: auto;
  height: min(100%, clamp(8rem, 88cqmin, 12rem));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1.72;
  align-self: center;
  transform: translateY(+1.1rem) scale(1.18);
  transform-origin: 50% 77%;
}

body[data-page="home"] .home-circular-arc {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

body[data-page="home"] .home-circular-track-base,
body[data-page="home"] .home-circular-track {
  fill: none;
  stroke-linecap: round;
  stroke-width: 10;
  vector-effect: non-scaling-stroke;
}

body[data-page="home"] .home-circular-track-base {
  stroke: #e9eee9;
}

body[data-page="home"] .home-circular-track {
  filter: drop-shadow(0 0.2rem 0.28rem rgba(42, 31, 19, 0.16));
}

body[data-page="home"] .home-circular-needle {
  background: var(--color-ink);
  fill: var(--color-ink);
  stroke: #fff;
  stroke-width: 3;
  filter: drop-shadow(0 0.12rem 0.24rem rgba(42, 31, 19, 0.34));
}

body[data-page="home"] .home-tile.range-low .home-circular-needle,
body[data-page="home"] .home-tile.range-high .home-circular-needle {
  fill: #b8322a;
  stroke: #fff;
}

body[data-page="home"] .home-circular-reading {
  position: absolute;
  z-index: 1;
  inset: 32% 22% 17%;
  transform: translateY(-0.15rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

body[data-page="home"] .home-circular-value {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(1.65rem, 8.2cqi, 3.05rem);
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1;
}

body[data-page="home"] .home-circular-unit,
body[data-page="home"] .home-circular-limits {
  color: var(--color-muted);
  font-size: clamp(0.58rem, 3cqmin, 0.72rem);
}

body[data-page="home"] .home-circular-unit {
  margin-top: 0.15rem;
  font-size: clamp(0.85rem, 3.3cqi, 1.05rem);
  font-weight: 600;
}

body[data-page="home"] .home-circular-footer {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: clamp(1.4rem, 7cqmin, 2rem);
}

body[data-page="home"] .home-circular-limits {
  display: contents;
}

body[data-page="home"] .home-circular-limits span {
  grid-row: 1;
  display: grid;
  gap: 0.14rem;
  text-align: center;
  white-space: nowrap;
  line-height: 1.05;
}

body[data-page="home"] .home-circular-limits span:first-child {
  grid-column: 1;
  justify-self: start;
}

body[data-page="home"] .home-circular-limits span:last-child {
  grid-column: 3;
  justify-self: end;
}

body[data-page="home"] .home-circular-label {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-ink);
  font-size: clamp(1rem, 4.5cqi, 1.35rem);
  font-weight: 750;
  line-height: 1.1;
}

body[data-page="home"] .home-circular-range-widget > .home-tile-error {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  justify-self: end;
  z-index: 2;
}

body[data-page="home"] .home-circular-limits small {
  font-size: clamp(0.64rem, 2cqmin, 0.78rem);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body[data-page="home"] .home-circular-limits strong {
  color: var(--color-ink);
  margin: 0;
  font-size: clamp(0.7rem, 2.35cqi, 0.92rem);
  font-variant-numeric: tabular-nums;
}

body[data-page="home"] .home-trend-widget {
  flex: 1 1 auto;
  position: relative;
  height: 100%;
  min-height: 0;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(0.2rem, 1.5cqmin, 0.4rem);
}

body[data-page="home"] .home-trend-widget.is-editable {
  cursor: pointer;
}

body[data-page="home"] .home-trend-widget.is-editable:focus-visible {
  outline: 2px solid rgba(244, 196, 48, 0.65);
  outline-offset: 0.2rem;
}

body[data-page="home"] .home-trend-plot {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: clamp(0.25rem, 1.5cqmin, 0.45rem);
}

body[data-page="home"] .home-trend-y-labels {
  padding-block: 0.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--color-muted);
  font-size: clamp(0.56rem, 2.6cqmin, 0.7rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
}

body[data-page="home"] .home-trend-chart {
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: visible;
}

body[data-page="home"] .home-trend-chart-area {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(0.15rem, 1cqmin, 0.3rem);
}

body[data-page="home"] .home-trend-x-labels {
  display: flex;
  justify-content: space-between;
  color: var(--color-muted);
  font-size: clamp(0.58rem, 2.6cqmin, 0.72rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

body[data-page="home"] .home-trend-gridline {
  fill: none;
  stroke: #e8dfd3;
  stroke-width: 0.8;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}

body[data-page="home"] .home-trend-axis {
  fill: none;
  stroke: var(--color-muted);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

body[data-page="home"] .home-trend-line {
  fill: none;
  stroke: var(--home-ambient-gold);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

body[data-page="home"] .home-trend-footer {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

body[data-page="home"] .home-trend-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-ink);
  font-size: clamp(0.9rem, 3.8cqi, 1.15rem);
  font-weight: 750;
  line-height: 1.1;
}

body[data-page="home"] .home-trend-unit {
  flex: 0 0 auto;
  color: var(--color-muted);
  font-size: clamp(0.75rem, 2.6cqi, 0.9rem);
  font-weight: 600;
  line-height: 1.1;
}

body[data-page="home"] .home-trend-widget > .home-tile-error {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  justify-self: end;
  z-index: 2;
}

body[data-page="home"] .home-clock {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.15rem 0 0.1rem;
}

body[data-page="home"] .home-edit-tray {
  position: fixed;
  left: 50%;
  bottom: 0.55rem;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  width: calc(100vw - 1rem);
  max-width: 780px;
  transform: translateX(-50%);
  pointer-events: none;
}

body[data-page="home"] .home-edit-tray-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgba(255, 249, 242, 0.96);
  box-shadow: 0 0.8rem 1.8rem rgba(42, 31, 19, 0.14);
  pointer-events: auto;
}

body[data-page="home"] .home-edit-tray-button {
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  box-shadow: none;
  display: grid;
  place-items: center;
}

body[data-page="home"] .home-edit-tray-button:hover:not(:disabled) {
  background: var(--home-yellow-soft);
  border-color: rgba(244, 196, 48, 0.55);
  color: var(--home-yellow-ink);
}

body[data-page="home"] .home-edit-tray-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

body[data-page="home"] .home-edit-tray-button:focus-visible {
  outline: 2px solid rgba(244, 196, 48, 0.65);
  outline-offset: 2px;
}

body[data-page="home"] .home-edit-tray-button.is-active {
  background: var(--home-yellow-soft);
  border-color: var(--home-yellow);
  color: var(--home-yellow-ink);
}

body[data-page="home"] .home-edit-tray-button .app-icon {
  font-size: 1.05rem;
}

body[data-page="home"] .home-clock-value {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  font-size: 1rem;
  color: var(--color-muted);
}

body[data-page="home"] .home-widget-editor-overlay {
  padding: 0;
  background: rgba(31, 27, 22, 0.42);
}

body[data-page="home"] .home-widget-editor {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0.85rem 1.25rem;
  background: #fffdfa;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.65rem;
}

body[data-page="home"] .home-widget-editor-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-content: start;
  gap: 0.8rem;
}

body[data-page="home"] .home-widget-section {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid #e8dfd3;
  border-radius: var(--radius-md);
  background: #fff;
}

body[data-page="home"] .home-widget-section:first-child {
  grid-row: span 2;
}

body[data-page="home"] .home-widget-section h3 {
  margin: 0 0 0.6rem;
  color: var(--color-ink);
  font-size: 0.95rem;
}

body[data-page="home"] .home-widget-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

body[data-page="home"] .home-widget-type-card {
  min-height: 7.5rem;
  margin: 0;
  padding: 0.8rem;
  border: 2px solid #e8dfd3;
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--color-ink);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  text-align: left;
}

body[data-page="home"] .home-widget-type-card.is-active {
  border-color: #e2b20f;
  background: var(--home-yellow-soft);
  color: var(--home-yellow-ink);
}

body[data-page="home"] .home-widget-type-card > .app-icon {
  font-size: 1.65rem;
}

body[data-page="home"] .home-widget-type-card span {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 0.22rem;
}

body[data-page="home"] .home-widget-type-card strong {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

body[data-page="home"] .home-widget-type-card small {
  color: var(--color-muted);
  font-size: 0.75rem;
  line-height: 1.3;
}

/* The embedded display exposes an 800 CSS-pixel viewport. Keep enough usable
   width inside the editor for long labels even with wider fallback fonts. */
@media (max-width: 820px) {
  body[data-page="home"] .home-widget-editor {
    padding-inline: 0.65rem;
  }

  body[data-page="home"] .home-widget-editor-body {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 0.65rem;
  }

  body[data-page="home"] .home-widget-section,
  body[data-page="home"] .home-widget-type-card {
    padding: 0.65rem;
  }

  body[data-page="home"] .home-widget-type-grid {
    gap: 0.5rem;
  }
}

body[data-page="home"] .home-widget-signal-button {
  width: 100%;
  min-height: 2.8rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-ink);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  text-align: left;
}

body[data-page="home"] .home-widget-signal-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="home"] .home-widget-signal-button .app-icon {
  transform: rotate(180deg);
}

body[data-page="home"] .home-widget-limit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

body[data-page="home"] .home-widget-limit-grid label {
  min-width: 0;
  margin: 0;
  color: var(--color-muted);
  font-size: 0.76rem;
}

body[data-page="home"] .home-widget-limit-grid text-editor {
  margin-top: 0.25rem;
}

body[data-page="home"] .home-widget-limit-grid .edit-group {
  min-height: 2.65rem;
  margin: 0;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
}

body[data-page="home"] .home-widget-hint {
  margin: 0.55rem 0 0;
  color: var(--color-muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

body[data-page="calibration-valves"] {
  overflow: hidden;
}

body[data-page="settings-general"] {
  overflow: hidden;
}

body {
  background: #000;
}

body::before {
  content: none;
}

.topbar {
  backdrop-filter: none;
}

* {
  animation: none !important;
  text-shadow: none !important;
  transition: none !important;
}
