:root {
  color-scheme: dark;
  --bg: #030910;
  --bg-2: #071220;
  --panel: rgba(8, 20, 35, 0.75);
  --panel-2: rgba(12, 28, 48, 0.9);
  --text: #edf6ff;
  --muted: #8faac5;
  --accent: #00d2ff;
  --accent-2: #10f5a9;
  --warn: #ff9e2c;
  --danger: #ff5866;
  --border: rgba(0, 210, 255, 0.12);
  --border-focus: rgba(0, 210, 255, 0.35);
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.35), 0 0 1px rgba(0, 210, 255, 0.15);
  
  /* Modern Typography Systems */
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0.5rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at center, rgba(10, 32, 60, 0.45) 0%, rgba(3, 9, 16, 0.98) 100%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.viewport-shell {
  width: 100%;
  max-width: 1560px;
  height: 100%;
  max-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.95rem;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand nav status";
  gap: 0.85rem 1.5rem;
  align-items: center;
}

.brand-block {
  grid-area: brand;
}

.brand-block h1,
.section-head h2,
.card h2,
.page-head h2,
.launcher-card h3,
.entity-title {
  margin: 0;
}

.brand-block h1 {
  font-size: 1.45rem;
  letter-spacing: 0.02em;
}

.brand-block .subtle {
  margin: 0.12rem 0 0;
  font-size: 0.82rem;
}

.subtle {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.16rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-strip {
  grid-area: nav;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.45rem;
  justify-content: center;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.status-cluster {
  grid-area: status;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.screen-layout {
  min-height: 0;
  position: relative;
}

.page-section {
  display: none;
  height: 100%;
  overflow: auto;
  gap: 0.7rem;
  padding-right: 0.15rem;
  align-content: start;
  grid-auto-rows: min-content;
}

.page-section.is-active {
  display: grid;
}

.grid,
.page-split,
.page-grid-two,
.content-panel {
  display: grid;
  gap: 0.7rem;
}

.operator-grid {
  grid-template-columns: 0.95fr 1.05fr;
}

.overview-grid {
  grid-template-columns: 1.28fr repeat(2, minmax(0, 0.9fr));
  align-items: stretch;
}

.overview-grid .trip-hero {
  grid-row: span 2;
}

.dashboard-lower-grid {
  grid-template-columns: 1fr 1fr;
}

.dashboard-wide-card {
  grid-column: 1 / -1;
}

.page-split-wide {
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
}

.page-split-map {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  min-height: 0;
}

.page-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.95rem 1.1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.compact-card,
.metric-card,
.wide-card,
.side-panel-card,
.content-panel,
.trip-hero,
.map-panel-card,
.map-info-card {
  min-height: 0;
}

.stack {
  display: grid;
  gap: 0.65rem;
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.tight-grid {
  gap: 0.65rem 0.7rem;
}

.section-head,
.page-head,
.entity-main,
.launcher-head,
.spotlight-main,
.assignment-row,
.actions {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.7rem;
}

label {
  display: grid;
  gap: 0.28rem;
}

label span,
.page-head p,
.entity-subtitle,
.launcher-card p,
.assignment-note {
  color: var(--muted);
}

input,
button,
select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 0.58rem 0.72rem;
  font: inherit;
}

input::placeholder {
  color: #6883a0;
}

input.is-locked {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-color: rgba(159, 192, 220, 0.08);
  cursor: default;
}

button {
  cursor: pointer;
  background: linear-gradient(180deg, #283b52, #172635);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 700;
  line-height: 1.1;
}

button.secondary {
  background: linear-gradient(180deg, #223447, #162433);
}

button:hover,
select:hover {
  border-color: rgba(79, 211, 255, 0.26);
}

.nav-button.is-active,
.actions button:first-child,
.single-action button {
  background: linear-gradient(180deg, var(--accent), #2da8d6);
  color: #04131f;
  border: none;
}

.compact-button {
  width: auto;
  min-width: 128px;
}

.nav-button,
.back-button {
  width: 100%;
}

.actions {
  align-items: end;
  grid-column: 1 / -1;
}

.single-action {
  max-width: 180px;
}

.assignment-row label {
  min-width: 180px;
}

.assignment-note {
  margin: 0;
  align-self: center;
  font-size: 0.84rem;
}

.pill {
  border-radius: 999px;
  padding: 0.4rem 0.66rem;
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.8rem;
}

.pill-ok {
  background: rgba(124, 242, 199, 0.16);
  color: var(--accent-2);
}

.pill-warn {
  background: rgba(255, 184, 77, 0.16);
  color: var(--warn);
}

.pill-error {
  background: rgba(255, 111, 125, 0.16);
  color: var(--danger);
}

.metrics,
.spotlight-grid,
.chip-grid,
.launcher-grid,
.mini-card-grid,
.trip-detail-grid {
  display: grid;
  gap: 0.5rem;
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  margin: 0;
}

.spotlight-grid,
.chip-grid {
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
}

.launcher-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-card-grid,
.trip-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metrics>div,
.stat-chip,
.launcher-card,
.mini-card {
  min-width: 0;
  border: 1px solid rgba(159, 192, 220, 0.1);
  background: rgba(5, 12, 22, 0.22);
  border-radius: 12px;
  padding: 0.56rem 0.62rem;
}

.metrics dt,
.stat-chip span,
.mini-card span {
  color: var(--muted);
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metrics dd,
.stat-chip strong,
.mini-card strong {
  margin: 0.18rem 0 0;
  line-height: 1.12;
  font-weight: 700;
  font-size: 0.95rem;
  word-break: break-word;
}

.spotlight {
  display: grid;
  gap: 0.65rem;
}

.spotlight-title {
  margin: 0;
  font-size: 1.18rem;
}

.spotlight-subtitle,
.spotlight-meta,
.entity-subtitle {
  margin: 0.18rem 0 0;
}

.launcher-card,
.entity-row,
.mini-card {
  display: grid;
  gap: 0.58rem;
}

.entity-list,
.subcard-list {
  display: grid;
  gap: 0.58rem;
}

.map-view {
  height: 100%;
  min-height: 520px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(6, 26, 42, 0.96), rgba(4, 12, 20, 0.98));
  border: 1px solid rgba(159, 192, 220, 0.08);
}

.leaflet-container {
  background: #0a1d2f;
  color: var(--text);
  font: inherit;
}

.leaflet-control-attribution,
.leaflet-control-scale {
  background: rgba(8, 18, 29, 0.78) !important;
  color: var(--muted) !important;
}

.map-vessel-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.map-vessel-icon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 6px rgba(79, 211, 255, 0.45));
}

.map-offline-note {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 0.9rem;
}

.segment-sections {
  display: grid;
  gap: 0.7rem;
}

.segment-card {
  display: grid;
  gap: 0.6rem;
  border: 1px solid rgba(159, 192, 220, 0.08);
  border-radius: 14px;
  background: rgba(3, 9, 18, 0.28);
  padding: 0.68rem;
}

.segment-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.7rem;
}

.segment-head h3 {
  margin: 0;
}

.segment-body {
  display: grid;
  gap: 0.58rem;
}

.subcard-list {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.entity-row {
  border: 1px solid rgba(159, 192, 220, 0.08);
  border-radius: 14px;
  background: rgba(3, 9, 18, 0.28);
  padding: 0.68rem;
}

.entity-subtitle {
  font-size: 0.84rem;
}

.micro-badge {
  flex: none;
  border-radius: 999px;
  padding: 0.22rem 0.48rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.trip-detail {
  padding: 0;
  overflow: hidden;
}

.trip-detail summary {
  display: block;
  cursor: pointer;
  list-style: none;
  padding: 0.68rem;
}

.trip-detail summary::-webkit-details-marker {
  display: none;
}

.trip-detail[open] summary {
  border-bottom: 1px solid rgba(159, 192, 220, 0.08);
}

.trip-detail-body {
  display: grid;
  gap: 0.6rem;
  padding: 0.68rem;
}

.trip-detail-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.trip-segment-panel {
  display: grid;
  gap: 0.6rem;
}

.stat-chip-accent {
  border-color: rgba(79, 211, 255, 0.22);
}

.stat-chip-ok {
  border-color: rgba(124, 242, 199, 0.22);
}

.stat-chip-warn {
  border-color: rgba(255, 182, 82, 0.22);
}

.message-line {
  min-height: 1.1rem;
  margin: 0.3rem 0 0;
}

.empty {
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   OpenCPN S-52 Operator Console Styles
   ═══════════════════════════════════════════════════════════════ */

.enc-console {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
  scrollbar-width: thin;
  scrollbar-color: rgba(79, 211, 255, 0.15) transparent;
}

.enc-header {
  margin-bottom: 0.1rem;
}

/* OpenCPN S-52 Theme Selector */
.theme-selector-group {
  margin-bottom: 0.2rem;
}

.opencpn-theme-selector {
  display: flex;
  background: rgba(5, 12, 22, 0.4);
  border: 1px solid rgba(159, 192, 220, 0.1);
  border-radius: 8px;
  padding: 2px;
  width: 100%;
}

.theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.35rem 0.5rem;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.theme-btn.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(79, 211, 255, 0.3);
}

#btn-theme-day.active {
  background: #ffb652;
  color: #06101a;
  box-shadow: 0 2px 8px rgba(255, 182, 82, 0.3);
}

#btn-theme-dusk.active {
  background: #2b5980;
  color: #fff;
  box-shadow: 0 2px 8px rgba(43, 89, 128, 0.4);
}

#btn-theme-night.active {
  background: #ff4d4d;
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 77, 77, 0.4);
}

.theme-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-dot.day {
  background: #ffd39b;
}

.theme-dot.dusk {
  background: #4a7a96;
}

.theme-dot.night {
  background: #b32d2d;
}

/* Custom Device Offline Warning Card */
.offline-banner-card {
  background: rgba(255, 109, 120, 0.04);
  border: 1px solid rgba(255, 109, 120, 0.22);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.4rem 0;
  animation: visual-blink 3s infinite;
}

.offline-alert-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #ff6d78;
  font-size: 0.82rem;
  font-weight: 700;
}

.offline-banner-card p {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.4;
}

.alert-icon {
  font-size: 0.95rem;
}

/* Panel Groups */
.enc-panel-group {
  border-top: 1px solid rgba(159, 192, 220, 0.08);
  padding-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.enc-panel-group h3 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.06em;
}

/* Telemetry Grid */
.telemetry-compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.tel-card {
  background: rgba(5, 12, 22, 0.22);
  border: 1px solid rgba(159, 192, 220, 0.06);
  border-radius: 8px;
  padding: 0.32rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.tel-card.wide {
  grid-column: span 2;
}

.tel-lbl {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.tel-card strong {
  font-size: 0.88rem;
  color: var(--text);
  font-family: monospace;
}

@keyframes visual-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.8;
  }
}

/* Responsive adjustment for Map console */
@media (max-width: 980px) {
  .enc-console {
    max-height: none;
  }
}

@media (max-width: 1400px) {
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand status"
      "nav nav";
    gap: 0.75rem;
  }
  .nav-strip {
    max-width: 100%;
    margin-top: 0.25rem;
  }
}

@media (max-width: 1280px) {
  body {
    padding: 0;
  }

  .viewport-shell {
    width: 100vw;
    height: 100vh;
    padding: 0.7rem;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .viewport-shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar,
  .operator-grid,
  .overview-grid,
  .dashboard-lower-grid,
  .page-split-wide,
  .page-split-map,
  .page-grid-two {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-areas:
      "brand"
      "status"
      "nav";
  }

  .status-cluster {
    justify-content: flex-start;
  }

  .nav-strip,
  .launcher-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-view {
    min-height: 380px;
  }
}

@media (max-width: 720px) {

  .nav-strip,
  .launcher-grid,
  .mini-card-grid,
  .trip-detail-grid,
  .trip-detail-sections {
    grid-template-columns: 1fr;
  }

  .section-head,
  .page-head,
  .entity-main,
  .launcher-head,
  .spotlight-main,
  .segment-head,
  .assignment-row,
  .actions {
    flex-direction: column;
  }

  .single-action,
  .assignment-row label,
  .compact-button {
    max-width: none;
    min-width: 0;
    width: 100%;
  }
}

/* Custom premium styling to hide failed map tiles cleanly */
.leaflet-tile-error {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Premium Maritime Switch Slider Toggle Controls */
.switch-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.2s ease;
}

.switch-container:hover {
  color: var(--text);
}

.switch-container input {
  display: none;
}

.switch-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: rgba(5, 12, 22, 0.5);
  border: 1px solid rgba(159, 192, 220, 0.18);
  border-radius: 999px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: var(--muted);
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-container input:checked + .switch-slider {
  background: rgba(79, 211, 255, 0.12);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(79, 211, 255, 0.22);
}

.switch-container input:checked + .switch-slider::before {
  transform: translateX(16px);
  background: var(--accent);
}

.switch-label {
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════
   Vessel Glass Cockpit Premium HMI CSS
   ═══════════════════════════════════════════════════════════════ */

/* Font Helpers */
.font-mono {
  font-family: var(--font-mono) !important;
}

h1, h2, h3, .brand-block h1, .section-head h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Glassmorphic frosted panels */
.card {
  background: linear-gradient(135deg, var(--panel), var(--panel-2)) !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px;
  box-shadow: var(--shadow) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}

.card:hover {
  border-color: var(--border-focus) !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45), 0 0 10px rgba(0, 210, 255, 0.1);
}

/* Dashboard Cockpit 3-Column Layout */
.dashboard-cockpit {
  display: grid;
  grid-template-columns: minmax(290px, 1fr) minmax(360px, 1.4fr) minmax(340px, 1.2fr);
  gap: 0.95rem;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.cockpit-column {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  min-height: 0;
  height: 100%;
}

.cockpit-column > .card {
  flex-shrink: 0;
}

.col-telemetry {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.telemetry-cockpit-card {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.telemetry-cockpit-card .section-head {
  margin-bottom: 0.5rem;
}

/* Smart Voyage Console Card styles */
.operator-voyage-card {
  padding: 0.95rem 1.1rem !important;
}

.voyage-block {
  margin-top: 0.45rem;
}

.voyage-block label {
  gap: 0.18rem;
}

.voyage-block label span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.voyage-block input {
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  background: rgba(3, 9, 16, 0.6);
  border-color: rgba(0, 210, 255, 0.15);
}

.voyage-block input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.25);
}

.voyage-block button {
  padding: 0.5rem;
  font-size: 0.85rem;
}

.voyage-block .actions {
  margin-top: 0.4rem;
  gap: 0.5rem;
}

.voyage-block .actions button {
  flex: 1;
}

/* Fuel Tanks Visual Grid */
.fuel-tanks-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.fuel-tanks-card .section-head {
  margin-bottom: 0.45rem;
}

.tanks-visual-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 0.15rem;
}

.fuel-tank-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(5, 12, 22, 0.45);
  border: 1px solid rgba(0, 210, 255, 0.08);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.fuel-tank-item:hover {
  border-color: rgba(0, 210, 255, 0.2);
  background: rgba(5, 12, 22, 0.65);
}

.tank-visual-wrapper {
  position: relative;
  width: 42px;
  height: 64px;
  flex-shrink: 0;
}

.tank-svg {
  width: 100%;
  height: 100%;
}

.tank-pct-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  pointer-events: none;
}

.liquid-fill {
  transition: y 0.8s cubic-bezier(0.4, 0, 0.2, 1), height 0.8s cubic-bezier(0.4, 0, 0.2, 1), fill 0.8s ease;
}

.tank-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.tank-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.tank-value {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--accent);
}

.tank-value .unit {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 400;
}

.tank-subtitle {
  font-size: 0.64rem;
  color: var(--muted);
  text-transform: uppercase;
}

/* Engine Propulsion Dashboard Grid */
.engine-cluster-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 0.15rem;
}

.engine-bar-item {
  background: rgba(5, 12, 22, 0.45);
  border: 1px solid rgba(0, 210, 255, 0.08);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s ease;
}

.engine-bar-item:hover {
  border-color: rgba(0, 210, 255, 0.2);
}

.engine-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.engine-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.engine-pos-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  font-size: 0.55rem;
  font-weight: 800;
  color: #030910;
  text-shadow: none;
}

.engine-pos-badge.pos-starboard {
  background: var(--accent);
}

.engine-pos-badge.pos-port {
  background: var(--warn);
}

.engine-pos-badge.pos-central {
  background: var(--accent-2);
}

.engine-pos-badge.pos-unassigned {
  background: var(--muted);
}

.engine-bar-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.engine-bar-status {
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.4rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.03);
}

.engine-bar-status.status-active {
  color: var(--accent-2);
  background: rgba(16, 245, 169, 0.08);
}

.engine-bar-status.status-idle {
  color: var(--muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.status-active .status-dot {
  background: var(--accent-2);
  box-shadow: 0 0 6px var(--accent-2);
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.engine-gauge-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.engine-numerical {
  display: flex;
  align-items: baseline;
  gap: 0.15rem;
  width: 58px;
  flex-shrink: 0;
}

.engine-numerical .lbl {
  font-size: 0.58rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.engine-numerical .val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.engine-bar-container {
  flex-grow: 1;
  height: 8px;
  background: rgba(5, 12, 22, 0.8);
  border: 1px solid rgba(0, 210, 255, 0.1);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.engine-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.engine-threshold-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--danger);
  opacity: 0.7;
}

.engine-bar-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.1rem;
}

.engine-substats {
  display: flex;
  gap: 0.6rem;
  font-size: 0.68rem;
  color: var(--muted);
}

.engine-substats strong {
  color: var(--text);
}

.di-pins-matrix {
  display: flex;
  gap: 0.22rem;
}

.di-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 0.55rem;
  font-weight: 800;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.di-pin.active {
  background: rgba(16, 245, 169, 0.12);
  border-color: var(--accent-2);
  color: var(--accent-2);
  box-shadow: 0 0 4px rgba(16, 245, 169, 0.35);
}

/* Flowmeter Fuel Dashboard Grid */
.flowmeter-cluster-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 0.15rem;
}

.flowmeter-compact-item {
  background: rgba(5, 12, 22, 0.45);
  border: 1px solid rgba(0, 210, 255, 0.08);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s ease;
}

.flowmeter-compact-item:hover {
  border-color: rgba(0, 210, 255, 0.2);
}

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

.fm-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.fm-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.fm-rotor {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fm-rotor svg {
  transition: transform 0.2s ease;
}

.rotor-spinning svg {
  animation: spin-rotor 2.2s linear infinite;
  filter: drop-shadow(0 0 3px var(--accent));
}

@keyframes spin-rotor {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fm-grid-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.fm-metric {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.fm-metric.wide {
  grid-column: span 2;
}

.fm-metric .lbl {
  font-size: 0.58rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.fm-metric .val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.fm-metric .val.accent-glowing {
  color: var(--accent);
  text-shadow: 0 0 6px rgba(0, 210, 255, 0.25);
}

.fm-metric .unit {
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 400;
}

/* Quick Telemetry Summary Row */
.quick-telemetry-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.95rem;
  margin-top: 0.1rem;
}

.mini-tel-card {
  padding: 0.65rem 0.95rem !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.mini-tel-card h3 {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.big-tel-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  margin: 0.1rem 0;
}

.big-tel-val .unit {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
}

.subtle-meta {
  font-size: 0.66rem;
  color: var(--muted);
  font-weight: 600;
}

/* Tactical Map Deck Styles */
.map-cockpit-card {
  padding: 0.95rem 1.1rem !important;
  display: flex;
  flex-direction: column;
}

.map-cockpit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}

.map-quick-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(3, 9, 16, 0.5);
  border: 1px solid rgba(0, 210, 255, 0.15);
  border-radius: 6px;
  padding: 1px;
}

.map-toggle-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.18rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 800;
  border-radius: 4px;
  cursor: pointer;
  width: auto;
  line-height: 1.2;
}

.map-toggle-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.map-toggle-btn.active {
  background: var(--accent);
  color: #030910;
  box-shadow: 0 1px 4px rgba(0, 210, 255, 0.25);
}

.map-lock-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0 0.25rem;
}

.map-lock-checkbox input {
  display: none;
}

.lock-indicator {
  display: inline-block;
  width: 14px;
  height: 14px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%238faac5" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.map-lock-checkbox input:checked + .lock-indicator {
  filter: drop-shadow(0 0 2px var(--accent-2));
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2310f5a9" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>');
}

.map-view-container {
  position: relative;
  flex-grow: 1;
  min-height: 220px;
}

.map-view-cockpit {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #02070e;
  border: 1px solid rgba(0, 210, 255, 0.15);
}

.map-compact-telemetry {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.map-tel-item {
  background: rgba(5, 12, 22, 0.3);
  border: 1px solid rgba(0, 210, 255, 0.06);
  border-radius: 8px;
  padding: 0.25rem 0.45rem;
  display: flex;
  flex-direction: column;
}

.map-tel-item.wide {
  grid-column: span 2;
}

.map-tel-item .lbl {
  font-size: 0.52rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.map-tel-item strong {
  font-size: 0.78rem;
  color: var(--text);
}

/* Diagnostic stations Card launchers */
.quick-launchers-card {
  padding: 0.65rem 0.85rem !important;
}

.quick-launchers-card h3 {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.dash-launcher-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.dash-launcher-grid button {
  padding: 0.4rem 0.5rem;
  font-size: 0.74rem;
  border-radius: 8px;
  border-color: rgba(0, 210, 255, 0.08);
}

/* ═══════════════════════════════════════════════════════════════
   Advanced Responsive Media Breakpoints for HMI
   ═══════════════════════════════════════════════════════════════ */

/* Large screens and Widescreen displays */
@media (min-width: 1024px) {
  /* Maintain fixed glass-cockpit view on desktop/widescreen */
  .viewport-shell {
    height: calc(100vh - 1rem);
    padding: 0.5rem;
  }
}

/* Tablet & Mid-size viewports (768px - 1023px) */
@media (max-width: 1024px) {
  body {
    overflow: auto;
    height: auto;
    align-items: flex-start;
    padding: 0.5rem;
  }

  .viewport-shell {
    height: auto;
    max-height: none;
    gap: 0.75rem;
  }

  .dashboard-cockpit {
    grid-template-columns: 1fr 1fr;
    height: auto;
    overflow: visible;
  }

  .cockpit-column {
    height: auto;
    min-height: 0;
  }

  .col-navigation {
    grid-column: span 2;
  }

  .map-view-container {
    height: 280px;
    min-height: 280px;
  }

  .telemetry-cockpit-card {
    height: 380px;
    max-height: 380px;
  }
}

/* Mobile & Touchscreen viewports (< 768px) */
@media (max-width: 768px) {
  .dashboard-cockpit {
    grid-template-columns: 1fr;
  }

  .col-navigation {
    grid-column: span 1;
  }

  /* Optimize navigation topbar for mobile wrap */
  .topbar {
    grid-template-areas:
      "brand"
      "status"
      "nav" !important;
  }

  .nav-strip {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  .map-view-container {
    height: 240px;
    min-height: 240px;
  }

  .telemetry-cockpit-card {
    height: 340px;
    max-height: 340px;
  }

  .fuel-tanks-card {
    height: auto;
  }

  /* Increase buttons target sizes */
  button, input, select {
    min-height: 40px;
  }
}

/* High-fidelity custom scrollbar support */
.tanks-visual-grid::-webkit-scrollbar,
.engine-cluster-grid::-webkit-scrollbar,
.flowmeter-cluster-grid::-webkit-scrollbar {
  width: 4px;
}

.tanks-visual-grid::-webkit-scrollbar-thumb,
.engine-cluster-grid::-webkit-scrollbar-thumb,
.flowmeter-cluster-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

.tanks-visual-grid::-webkit-scrollbar-thumb:hover,
.engine-cluster-grid::-webkit-scrollbar-thumb:hover,
.flowmeter-cluster-grid::-webkit-scrollbar-thumb:hover {
  background: var(--border-focus);
}

/* Unified Engine RPM Mapping & Consolidated DIN Styles */
.engine-split-viewport {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.engine-rpm-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow-y: auto;
  flex-grow: 1;
}

.engine-din-board {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.din-consolidated-card {
  background: rgba(5, 12, 22, 0.45);
  border: 1px solid rgba(0, 210, 255, 0.1);
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.din-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 210, 255, 0.08);
  padding-bottom: 0.25rem;
}

.din-modules-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.din-module-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.din-module-name {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Consolidated Flowmeter Net Consumption Styles */
.flowmeter-split-viewport {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.flowmeter-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow-y: auto;
  flex-grow: 1;
}

.flowmeter-net-board {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.net-consolidated-card {
  background: rgba(5, 12, 22, 0.45);
  border: 1px solid rgba(0, 210, 255, 0.1);
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.net-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.net-side-block {
  background: rgba(5, 12, 22, 0.35);
  border: 1px solid rgba(0, 210, 255, 0.06);
  border-radius: 10px;
  padding: 0.4rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.net-side-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding-bottom: 0.15rem;
}

.net-side-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
}

.net-metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.net-metric-item {
  display: flex;
  flex-direction: column;
}

.net-metric-item .lbl {
  font-size: 0.54rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.net-metric-item .val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.net-metric-item .val.highlight-glowing {
  color: var(--accent-2);
  text-shadow: 0 0 5px rgba(16, 245, 169, 0.3);
}

/* Adjust split layouts for smaller viewports */
@media (max-width: 768px) {
  .net-row-grid {
    grid-template-columns: 1fr;
  }
}

/* Flowmeter dual axis assignments */
.flowmeter-assignment-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.flowmeter-assignment-controls .assignment-control {
  flex: 1;
  min-width: 160px;
  transition: opacity 0.25s ease;
}

.direction-control-wrapper {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.direction-control-wrapper[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

.select-premium {
  background: rgba(20, 32, 48, 0.6);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select-premium:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.2);
}

@media (max-width: 576px) {
  .flowmeter-assignment-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .flowmeter-assignment-controls .assignment-control {
    width: 100%;
    min-width: 0;
  }
}

/* Sidebar panel vertical wrapper */
.side-panel-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* Unified AIO digital inputs on AIO page */
.aio-digital-inputs-unified-section {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1rem;
}

.section-title-premium {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 0;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
}

.aio-modules-din-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.aio-module-din-card {
  background: rgba(20, 32, 48, 0.4);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem !important;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0 !important;
}

.aio-module-din-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.4rem;
}

.aio-module-din-header .title-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.aio-module-din-header h3 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.din-grid-aio-page {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.din-grid-aio-page .stat-chip {
  padding: 0.3rem 0.25rem;
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 6px;
  min-height: 42px;
}

.din-grid-aio-page .stat-chip span {
  font-size: 0.55rem;
  text-transform: uppercase;
  margin-bottom: 0.1rem;
}

.din-grid-aio-page .stat-chip strong {
  font-size: 0.7rem;
}

/* Pulsing state indicators */
.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.pulse-success {
  background-color: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

.pulse-error {
  background-color: var(--warn);
  box-shadow: 0 0 8px var(--warn);
}

@media (max-width: 768px) {
  .din-grid-aio-page {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 576px) {
  .din-grid-aio-page {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Header Browser Fullscreen Toggle button */
.fullscreen-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.fullscreen-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent);
  border-color: rgba(0, 210, 255, 0.25);
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.15);
}

.fullscreen-btn svg {
  transition: transform 0.2s ease;
}

.fullscreen-btn:active svg {
  transform: scale(0.85);
}

/* ═══════════════════════════════════════════════════════════════
   HMI Configuration & Settings Page Styles
   ═══════════════════════════════════════════════════════════════ */

/* Lock Screen Overlay */
.settings-lock-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 480px;
  padding: 1.5rem;
}

.lock-card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.lock-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 8px var(--accent));
}

.lock-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text);
  font-family: var(--font-heading);
}

.lock-card p {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1.5rem;
  line-height: 1.4;
}

.passcode-input-group {
  margin-bottom: 1.25rem;
}

.passcode-input-group input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.5em;
  padding: 0.6rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--accent);
  width: 100%;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.keypad-btn {
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.75rem 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: auto;
  line-height: 1.2;
}

.keypad-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-focus);
}

.keypad-btn:active {
  transform: scale(0.95);
  background: rgba(0, 210, 255, 0.12);
}

.keypad-btn.clear {
  color: var(--danger);
  font-size: 0.9rem;
}

.keypad-btn.enter {
  background: linear-gradient(180deg, var(--accent), #2da8d6);
  color: #04131f;
  border: none;
  font-size: 0.9rem;
}

.lock-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 0.5rem;
  min-height: 1.2rem;
}

/* Settings Workspace */
.settings-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  gap: 1rem;
  min-height: 0;
}

.settings-tabs-strip {
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px solid rgba(0, 210, 255, 0.1);
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.settings-tabs-strip::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 8px 8px 0 0;
  width: auto;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--accent);
  background: rgba(0, 210, 255, 0.06);
  border: 1px solid rgba(0, 210, 255, 0.12);
  border-bottom: 2px solid var(--accent);
}

/* Settings Panes */
.settings-panes {
  flex: 1;
  min-height: 0;
}

.settings-pane {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding-bottom: 2rem;
}

.settings-pane.active {
  display: block;
}

/* General Forms */
.settings-form {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.5rem;
  max-width: 560px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-form h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
  color: var(--text);
  font-family: var(--font-heading);
}

.form-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: center;
  gap: 1rem;
}

.form-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row select {
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.form-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: var(--accent);
}

.form-sub-info {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.save-btn {
  margin-top: 0.5rem;
  width: 100%;
  background: linear-gradient(180deg, var(--accent), #2da8d6);
  color: #04131f;
  border: none;
  font-weight: 700;
}

/* Device Manager layout */
.device-manager {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  height: 100%;
}

.device-list-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(12, 28, 48, 0.4);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  min-height: 480px;
}

.device-list-column h3,
.comm-sidebar h3,
.comm-workspace h3 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.devices-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
}

.device-item-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.device-item-card:hover {
  background: rgba(0, 210, 255, 0.05);
  border-color: var(--border-focus);
}

.device-item-card.active {
  background: rgba(0, 210, 255, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.15);
}

.device-item-card .dev-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.device-item-card .dev-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.device-item-card .dev-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.device-item-card .dev-status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.device-item-card.active-enabled .dev-status-indicator {
  background: var(--accent-2);
  box-shadow: 0 0 6px var(--accent-2);
}

.device-item-card.active-disabled .dev-status-indicator {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

.device-form-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.device-form-column .delete-btn {
  background: linear-gradient(180deg, var(--danger), #c82c37);
  border: none;
  margin-top: 0.25rem;
}

/* Commissioning layout */
.commissioning-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  height: 100%;
}

.comm-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(12, 28, 48, 0.4);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  min-height: 480px;
}

.comm-devices-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
}

.comm-workspace {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}

.comm-sub-info {
  margin: -0.25rem 0 1rem 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.comm-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.comm-group-card {
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(5, 12, 22, 0.15);
  border-radius: 10px;
  padding: 1rem;
}

.comm-group-card h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 0.4rem;
}

.comm-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.comm-field-box {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.comm-field-box label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.comm-field-box input {
  padding: 0.4rem;
  font-size: 0.9rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
}

.comm-write-btn {
  width: 100%;
  padding: 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 0.25rem;
  background: linear-gradient(180deg, #10f5a9, #0ca875);
  color: #04131f;
  border: none;
}

.comm-write-btn.destructive {
  background: linear-gradient(180deg, var(--danger), #cc3b47);
  color: #fff;
}

.comm-write-result {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 0.25rem;
  border-radius: 4px;
  text-align: center;
  min-height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.25rem;
}

.comm-write-result.success {
  background: rgba(16, 245, 169, 0.08);
  color: var(--accent-2);
}

.comm-write-result.error {
  background: rgba(255, 88, 102, 0.08);
  color: var(--danger);
}

/* Raw TOML Textarea */
.raw-toml-form {
  max-width: 900px;
  height: 100%;
}

.raw-toml-area {
  width: 100%;
  height: 480px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: #010408;
  color: #b9d1ea;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  resize: vertical;
}

.raw-toml-area:focus {
  border-color: var(--border-focus);
  outline: none;
}

/* Footer unsaved changes reboot banner */
.settings-actions-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(0, 210, 255, 0.1);
  padding-top: 0.8rem;
  margin-top: 1rem;
}

.unsaved-banner {
  background: rgba(255, 158, 44, 0.1);
  border: 1px solid var(--warn);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--warn);
}

.reboot-action-btn {
  width: auto;
  padding: 0.35rem 0.8rem;
  font-size: 0.76rem;
  background: linear-gradient(180deg, var(--danger), #c82c37);
  color: #fff;
  border: none;
}

.lock-btn {
  width: auto;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
}

/* Responsive details for form columns */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .device-manager {
    grid-template-columns: 1fr;
  }
  .commissioning-layout {
    grid-template-columns: 1fr;
  }
}

/* Glassmorphism custom styles for Leaflet Waypoint Popups */
.custom-wp-popup .leaflet-popup-content-wrapper {
  background: rgba(8, 18, 29, 0.95) !important;
  color: #ecf5ff !important;
  border: 1px solid rgba(79, 211, 255, 0.45) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(8px) !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
}

.custom-wp-popup .leaflet-popup-tip {
  background: rgba(8, 18, 29, 0.95) !important;
  border: 1px solid rgba(79, 211, 255, 0.45) !important;
}

/* Navigation HUD overlay stylesheet */
.nav-hud-overlay {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  z-index: 1000;
  background: rgba(8, 18, 29, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(79, 211, 255, 0.4);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
}

.nav-hud-overlay.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(79, 211, 255, 0.2);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.hud-title-group h3 {
  margin: 0;
  color: #ecf5ff;
  font-size: 1.1rem;
  font-weight: 600;
}

.hud-status-badge {
  background: rgba(79, 211, 255, 0.15);
  color: #4fd3ff;
  border: 1px solid rgba(79, 211, 255, 0.6);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hud-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.hud-stat-box {
  background: rgba(14, 28, 44, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 6px 8px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.hud-label {
  font-size: 0.6rem;
  color: #8da1b9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.hud-value {
  font-size: 1rem;
  font-weight: 700;
  color: #ecf5ff;
}

.hud-xte-container {
  background: rgba(14, 28, 44, 0.4);
  border: 1px solid rgba(79, 211, 255, 0.1);
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 10px;
}

.hud-xte-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  font-weight: bold;
  color: #8da1b9;
  margin-bottom: 4px;
}

.hud-xte-gauge {
  position: relative;
  height: 12px;
  background: rgba(8, 18, 29, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  margin-bottom: 4px;
  overflow: hidden;
}

.hud-xte-track-line {
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
}

.hud-xte-center-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(79, 211, 255, 0.5);
  transform: translateX(-50%);
}

.hud-xte-indicator {
  position: absolute;
  top: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffb652;
  border: 1px solid #ffffff;
  transform: translateX(-50%);
  transition: left 0.2s ease;
  box-shadow: 0 0 6px #ffb652;
}

.hud-xte-value-text {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffb652;
}

.hud-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.hud-actions button {
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  margin: 0;
  width: auto;
}