/* ================================================================
   Taori Logger Studio — Design System v4 "Mission Control"
   Shell: icon rail (left) + telemetry topbar. Dark sci-fi HUD.
   All legacy component classes are kept and restyled.
   ================================================================ */

@font-face {
  font-family: 'Chakra Petch';
  src: url('../fonts/ChakraPetch-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Chakra Petch';
  src: url('../fonts/ChakraPetch-Light.ttf') format('truetype');
  font-weight: 300; font-style: normal; font-display: swap;
}

/* ── Tokens ──────────────────────────────────────────────────── */
:root {
  --bg:          #04070d;
  --bg-raise:    #070c15;
  --panel:       rgba(10, 16, 28, 0.88);
  --panel-solid: #0a101c;
  --panel-alt:   #101828;
  --panel-hover: #15203a;
  --border:      rgba(64, 96, 128, 0.28);
  --border-hi:   rgba(96, 140, 180, 0.45);
  --accent:      #00e5b0;
  --accent-2:    #45c8ff;
  --accent-grad: linear-gradient(135deg, #00e5b0, #45c8ff);
  --accent-dim:  rgba(0, 229, 176, 0.10);
  --accent-mid:  rgba(0, 229, 176, 0.22);
  --accent-glow: rgba(0, 229, 176, 0.38);
  --amber:       #ffb547;
  --warn:        #ff4d6b;
  --warn-dim:    rgba(255, 77, 107, 0.12);
  --ok:          #00e5b0;
  --text:        #c9d6e3;
  --text-hi:     #eef6fb;
  --text-dim:    #6f8195;
  --muted:       #6f8195;
  --display:     'Chakra Petch', ui-monospace, monospace;
  --mono:        ui-monospace, 'Cascadia Mono', 'Consolas', 'Menlo', monospace;
  --sans:        system-ui, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --r-sm:        3px;
  --r-md:        6px;
  --r-lg:        8px;
  --radius:      3px;
  --shadow-sm:   0 2px 10px rgba(0,0,0,0.4);
  --shadow-md:   0 8px 28px rgba(0,0,0,0.55);
  --shadow-lg:   0 16px 48px rgba(0,0,0,0.7);
  --inset-hi:    inset 0 1px 0 rgba(255,255,255,0.04);
  --rail-w:      64px;
  --topbar-h:    58px;
  /* Legacy aliases (page-level styles still reference these) */
  --sidebar-w:   64px;
  --sidebar2-w:  0px;
  --transition:  0.16s cubic-bezier(.4,0,.2,1);
}

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

html { height: 100%; overflow: hidden; }

body {
  min-height: 100%; height: 100%;
  overflow-y: auto; overflow-x: hidden;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 55% at 15% -12%, rgba(0,229,176,0.06), transparent 60%),
    radial-gradient(ellipse 65% 45% at 105% 4%,  rgba(69,200,255,0.05), transparent 60%),
    linear-gradient(rgba(70,110,150,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70,110,150,0.05) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  margin-left: var(--rail-w);
  padding-top: var(--topbar-h);
}

@keyframes fadeUp { from { opacity:0; transform:translateY(8px);} to { opacity:1; transform:none;} }
@keyframes blink  { 0%,100% { opacity:1; } 50% { opacity:0.25; } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ── Typography ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-weight: 500; color: var(--text-hi); line-height: 1.3; }
h1 { font-size: 1.5rem; font-family: var(--display); }
h2 { font-size: 1.25rem; font-family: var(--display); }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.85rem; font-family: var(--mono); font-weight: 600;
     letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
h5 { font-size: 0.8rem; font-family: var(--mono); color: var(--text-dim); }
h6 { font-size: 0.75rem; color: var(--text-dim); font-weight: 400; }
p  { font-size: 12px; font-family: var(--sans); color: var(--text); margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

.card-body p, .card-body .card-desc {
  font-size: 12px; font-family: var(--sans);
  color: var(--text-dim); line-height: 1.6;
}
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-mid); color: var(--text-hi); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ================================================================
   ICON RAIL  (left, 64px — carries .sidebar2 class for header.js)
   ================================================================ */

.rail {
  position: fixed; top: 0; left: 0; z-index: 1100;
  width: var(--rail-w); height: 100vh;
  background: linear-gradient(180deg, rgba(0,229,176,0.05), transparent 18%), var(--panel-solid);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 0 12px;
  overflow: visible;
}
.rail::after {
  content: ''; position: absolute; top: 0; bottom: 0; right: -1px; width: 1px;
  background: linear-gradient(180deg, var(--accent-glow), transparent 30%, transparent 70%, rgba(69,200,255,0.25));
  pointer-events: none;
}

.rail-logo {
  width: 44px; height: 44px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: transparent; /* same surface as the rail behind it */
  overflow: hidden;
  transition: all var(--transition);
}
.rail-logo img { width: 68px; height: 68px; max-width: none; flex-shrink: 0; object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0,229,176,0.35)); }
.rail-logo:hover { border-color: var(--accent); box-shadow: 0 0 14px var(--accent-dim); }

.rail-sep {
  width: 28px; height: 1px; margin: 4px 0 10px;
  background: linear-gradient(90deg, transparent, var(--border-hi), transparent);
}

/* Nav icons */
.rail .nav-links {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; flex: 1; width: 100%; padding: 0; overflow: visible;
}
.rail .nav-links a {
  position: relative;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  border: 1px solid transparent; border-radius: var(--r-md);
  transition: all var(--transition);
  text-decoration: none;
}
.rail .nav-links a svg { width: 20px; height: 20px; stroke: currentColor; fill: none;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail .nav-links a:hover {
  color: var(--text-hi); background: var(--panel-hover); border-color: var(--border);
}
.rail .nav-links a.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(0,229,176,0.4);
  box-shadow: 0 0 16px rgba(0,229,176,0.12), var(--inset-hi);
}
.rail .nav-links a.active::before {
  content: ''; position: absolute; left: -12px; top: 22%; bottom: 22%;
  width: 3px; background: var(--accent-grad);
  border-radius: 0 2px 2px 0; box-shadow: 0 0 10px var(--accent);
}

/* Desktop: text labels become hover tooltips */
.nav-label {
  position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%);
  background: var(--panel-solid); border: 1px solid var(--border-hi);
  color: var(--text-hi);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  padding: 6px 12px; border-radius: var(--r-sm);
  white-space: nowrap; pointer-events: none;
  opacity: 0; visibility: hidden;
  box-shadow: var(--shadow-md);
  transition: opacity var(--transition);
  z-index: 1200;
}
.nav-label::before {
  content: ''; position: absolute; right: 100%; top: 50%; transform: translateY(-50%);
  border: 5px solid transparent; border-right-color: var(--border-hi);
}
.rail .nav-links a:hover .nav-label { opacity: 1; visibility: visible; }

.rail-foot {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-top: auto;
}

.sidebar-info-icon {
  width: 28px; height: 28px; line-height: 26px; text-align: center;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: var(--accent); background: var(--accent-dim);
  border-radius: 50%; border: 1px solid var(--accent); cursor: pointer;
  transition: all var(--transition);
}
.sidebar-info-icon:hover { background: var(--accent-mid); box-shadow: 0 0 12px var(--accent-glow); }

/* ================================================================
   TOPBAR  (fixed, spans from rail to right edge)
   ================================================================ */

.topbar {
  position: fixed; top: 0; left: var(--rail-w); right: 0; z-index: 1050;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px 0 20px;
  background: linear-gradient(90deg, rgba(0,229,176,0.04), transparent 40%), rgba(7,12,21,0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.topbar::after {
  content: ''; position: absolute; left: 0; bottom: -1px; width: 180px; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.tb-title { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.tb-eyebrow {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--accent); opacity: 0.75;
}
.tb-page {
  font-family: var(--display); font-size: 17px; font-weight: 400;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-hi); white-space: nowrap;
  text-shadow: 0 0 24px rgba(0,229,176,0.25);
}
.tb-page .comment { color: var(--text-dim); }

.tb-spacer { flex: 1; }

/* Logger select (lives in topbar now) */
.logger-select-row { display: flex; align-items: center; gap: 6px; }
.logger-select-row #loggerSelect {
  min-width: 190px; max-width: 260px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm); padding: 8px 10px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  color: #03100c;
  outline: none; cursor: pointer;
  box-shadow: 0 0 14px rgba(0,229,176,0.25);
  transition: all var(--transition);
}
.logger-select-row #loggerSelect:hover,
.logger-select-row #loggerSelect:focus {
  background: #2bffd0; border-color: #2bffd0;
  box-shadow: 0 0 20px var(--accent-glow);
}
.logger-select-row #loggerSelect option { background: var(--panel-solid); color: var(--text); }

#refreshLoggers {
  flex-shrink: 0;
  background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-dim);
  font-size: 14px; line-height: 1; padding: 7px 9px;
  cursor: pointer; transition: all var(--transition);
}
#refreshLoggers:hover { color: var(--accent); border-color: var(--accent); }
#refreshLoggers:disabled { opacity: 0.4; cursor: default; }
#refreshLoggers.spinning { animation: spin 0.8s linear infinite; }

.refresh-status {
  font-family: var(--mono); font-size: 10px;
  color: var(--text-dim); min-height: 0; max-width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Telemetry chip: logger name + live dot */
.tb-chip {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; color: var(--text);
  border: 1px solid var(--border); border-radius: 2px;
  background: rgba(0,0,0,0.3);
  padding: 6px 14px;
  position: relative;
  box-shadow: var(--inset-hi);
}
.tb-chip::before, .tb-chip::after {
  content: ''; position: absolute; width: 7px; height: 7px;
  border-color: var(--accent); border-style: solid; opacity: 0.8;
}
.tb-chip::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.tb-chip::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  animation: pulse-ring 2s ease-out infinite;
}
.pulse-dot.offline { background: var(--text-dim); animation: none; box-shadow: none; }

/* User chip */
.user-box {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: linear-gradient(90deg, rgba(0,229,176,0.05), rgba(69,200,255,0.02));
  font-family: var(--mono); font-size: 11px;
  flex-shrink: 0;
}
.user-box[hidden] { display: none !important; }
.user-box-name {
  color: var(--text); letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 180px;
}
.user-box-logout {
  background: transparent; border: 1px solid var(--border-hi);
  color: var(--text-dim);
  font-family: var(--mono); font-size: 9px; padding: 3px 8px;
  border-radius: var(--r-sm); cursor: pointer;
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: all var(--transition);
}
.user-box-logout:hover { color: var(--warn); border-color: var(--warn); }

/* ================================================================
   INFO PANEL  (popup near rail bottom)
   ================================================================ */

.info-panel {
  position: fixed; left: calc(var(--rail-w) + 10px); bottom: 12px;
  width: 230px;
  background: var(--panel-solid);
  border: 1px solid var(--border-hi); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0,229,176,0.06);
  z-index: 1200; display: none; flex-direction: column; overflow: hidden;
}
.info-panel.open { display: flex; animation: fadeUp 0.2s ease both; }
.info-panel-head {
  padding: 13px 15px 10px; display: flex; flex-direction: column; gap: 3px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(0,229,176,0.08), transparent);
}
.info-panel-name {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--accent);
}
.info-panel-ver { font-family: var(--mono); font-size: 9px; color: var(--text-dim); }
.info-panel-item {
  display: flex; align-items: center; gap: 9px; padding: 10px 15px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  text-decoration: none; background: none; border: none;
  width: 100%; text-align: left; cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-bottom: 1px solid var(--border);
}
.info-panel-item:last-child { border-bottom: none; }
.info-panel-item:hover { background: var(--panel-hover); color: var(--accent); text-decoration: none; }
.info-panel-ext { margin-left: auto; font-size: 10px; color: var(--text-dim); }
.info-panel-about { display: none; padding: 11px 15px 13px;
  background: rgba(0,0,0,0.25); border-top: 1px solid var(--border); }
.info-panel-about.open { display: block; }
.info-about-line { display: flex; gap: 8px; margin-bottom: 5px;
  font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
.info-about-line:last-child { margin-bottom: 0; }
.info-about-label { color: var(--accent); min-width: 58px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

/* ================================================================
   MAIN CONTENT
   ================================================================ */

.container {
  min-height: calc(100vh - var(--topbar-h));
  padding: 26px 28px 56px;
  animation: fadeUp 0.3s ease both;
}

/* Legacy in-content page header (kept slim for any page still using it) */
.page-header-bar { display: none; }

/* Section label — sci-fi divider used by the new layouts */
.section-label {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-dim);
  margin: 26px 0 14px;
}
.section-label:first-child { margin-top: 0; }
.section-label .sl-mark { color: var(--accent); }
.section-label::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border-hi), transparent);
}

/* ================================================================
   GRID
   ================================================================ */

.dash-grid {
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: 16px; align-items: start;
}
.col-span-3  { grid-column: span 3; }
.col-span-4  { grid-column: span 4; }
.col-span-5  { grid-column: span 5; }
.col-span-6  { grid-column: span 6; }
.col-span-7  { grid-column: span 7; }
.col-span-8  { grid-column: span 8; }
.col-span-9  { grid-column: span 9; }
.col-span-12 { grid-column: span 12; }

@media (max-width: 1400px) {
  .col-span-3 { grid-column: span 4; }
  .col-span-4 { grid-column: span 6; }
}
@media (max-width: 1100px) {
  .col-span-3, .col-span-4, .col-span-5,
  .col-span-6, .col-span-7, .col-span-8, .col-span-9 { grid-column: span 12; }
}
@media (max-width: 700px) {
  .dash-grid { grid-template-columns: 1fr; gap: 12px; }
  [class*="col-span-"] { grid-column: span 1; }
}

/* ================================================================
   HUD PANEL (.card — legacy class, new look)
   ================================================================ */

.card {
  background: linear-gradient(165deg, rgba(255,255,255,0.02), transparent 40%), var(--panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  display: flex; flex-direction: column;
  overflow: visible;            /* tooltips must escape */
  position: relative;
  box-shadow: var(--shadow-sm), var(--inset-hi);
  backdrop-filter: blur(8px);
  transition: border-color var(--transition), box-shadow var(--transition);
}
/* HUD corner brackets */
.card::before, .card::after {
  content: ''; position: absolute; width: 10px; height: 10px;
  border-color: var(--accent); border-style: solid; opacity: 0.55;
  transition: opacity var(--transition);
  pointer-events: none;
}
.card::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.card::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }
.card:hover { border-color: var(--border-hi); box-shadow: var(--shadow-md), 0 0 28px rgba(0,229,176,0.05); }
.card:hover::before, .card:hover::after { opacity: 1; }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 11px 16px;
  background: linear-gradient(90deg, rgba(0,229,176,0.06), transparent 65%);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.card-title {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}
.card-title::before {
  content: '▮'; font-size: 9px; color: var(--accent);
  animation: blink 3s ease-in-out infinite;
}
.card-body { flex: 1; padding: 16px; display: flex; flex-direction: column; }
.card-desc {
  font-size: 12px; font-family: var(--sans); font-weight: 400;
  color: var(--text-dim); line-height: 1.6; margin-bottom: 14px;
}
.card-desc:last-child { margin-bottom: 0; }
.card-footer {
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.22);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}

/* ================================================================
   BADGES
   ================================================================ */

.badge {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.14em; padding: 3px 10px; border-radius: 2px;
  border: 1px solid var(--border); color: var(--text-dim);
  text-transform: uppercase; background: rgba(0,0,0,0.25);
}
.badge.ok   { border-color: var(--ok); color: var(--ok);
              background: rgba(0,229,176,0.08); box-shadow: 0 0 10px rgba(0,229,176,0.12); }
.badge.err  { border-color: var(--warn); color: var(--warn); background: var(--warn-dim);
              box-shadow: 0 0 10px rgba(255,77,107,0.12); }
.badge.idle { border-color: var(--border-hi); color: var(--text-dim); }

/* ================================================================
   FORMS
   ================================================================ */

.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-field:last-child { margin-bottom: 0; }
.form-field label, label.field-label {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
  display: block;
}
label {
  display: block; font-size: 12px; font-family: var(--sans);
  font-weight: 400; color: var(--text); line-height: 1.5;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="datetime-local"], input[type="number"],
textarea, select {
  width: 100%; padding: 8px 11px;
  background: rgba(0,0,0,0.35); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  font-family: var(--mono); font-size: 13px;
  outline: none; height: 36px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:hover, select:hover, textarea:hover { border-color: var(--border-hi); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim), 0 0 12px var(--accent-dim);
}
input::placeholder { color: var(--text-dim); opacity: 0.55; }
input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(0.5); cursor: pointer; }
select option { background: var(--panel-solid); color: var(--text); }

.form-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; text-align: left; }
.form-group label {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin: 0;
}

/* ================================================================
   BUTTONS — angular, bracketed
   ================================================================ */

.submit-button, .btn-primary {
  background: var(--accent); color: #03100c;
  border: none; border-radius: 2px;
  padding: 8px 18px; min-height: 34px;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.submit-button:hover, .btn-primary:hover {
  background: #2bffd0; box-shadow: 0 0 18px var(--accent-glow);
  transform: translateY(-1px);
}
.submit-button:active { transform: translateY(0); }
.submit-button:disabled {
  background: var(--panel-alt); color: var(--text-dim);
  cursor: not-allowed; box-shadow: none; transform: none;
}

.btn-secondary {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-hi); border-radius: 2px;
  padding: 8px 16px; min-height: 34px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-dim); box-shadow: 0 0 10px var(--accent-dim);
}
.btn-danger { border-color: var(--warn); color: var(--warn); }
.btn-danger:hover { background: var(--warn-dim); color: var(--warn); border-color: var(--warn); }

/* Tabs — segmented HUD switcher */
.tabs {
  display: inline-flex; gap: 0; margin-bottom: 18px;
  border: 1px solid var(--border); border-radius: 2px;
  background: rgba(0,0,0,0.3); padding: 3px;
}
.tab-button {
  background: transparent; color: var(--text-dim);
  border: none; border-radius: 2px;
  padding: 7px 20px; font-family: var(--mono); font-size: 11px;
  font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; transition: all var(--transition);
}
.tab-button:hover { color: var(--text-hi); }
.tab-button.active {
  background: var(--accent); color: #03100c;
  box-shadow: 0 0 14px var(--accent-glow);
}

.button {
  background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: 2px; color: var(--text);
  padding: 10px 16px; min-height: 42px; min-width: 120px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
  transition: all var(--transition);
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; text-align: center; user-select: none;
}
.button:hover {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow); transform: translateY(-1px);
}
.button.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; transform: none; }
.buttons { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.download-button-container { display: flex; justify-content: flex-end; margin-top: 8px; }

.logger-button {
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 2px;
  padding: 6px 14px; font-family: var(--mono); font-size: 11px;
  font-weight: 600; cursor: pointer; transition: all var(--transition);
  text-decoration: none; text-align: center;
}
.logger-button:hover { background: var(--accent); color: #03100c; }
.logger-button:not(.active) {
  background: var(--panel-alt); color: var(--text-dim); border-color: var(--border);
}
.button-group { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.button-container { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#buttonContainer { max-width: 360px; display: flex; flex-wrap: wrap; gap: 8px; }

/* ================================================================
   TABLES — telemetry readout
   ================================================================ */

table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; }
th {
  background: rgba(0,0,0,0.35); color: var(--text-dim);
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; padding: 9px 12px; text-align: left;
  border-bottom: 1px solid var(--border-hi);
  white-space: nowrap; position: sticky; top: 0;
}
td {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
td:first-child { color: var(--accent); font-weight: 600; }
tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
tr:hover td { background: var(--accent-dim); transition: background 0.12s; }
td.status-inactive { color: var(--text-dim); }

/* ================================================================
   LEGACY .box SUPPORT
   ================================================================ */

.content-wrapper {
  display: flex; flex-wrap: wrap; gap: 16px;
  align-items: flex-start; align-content: flex-start; width: 100%;
}
.box {
  background: linear-gradient(165deg, rgba(255,255,255,0.02), transparent 40%), var(--panel);
  border: 1px solid var(--border); border-radius: 2px; overflow: hidden;
  flex: 0 0 calc(25% - 12px); width: calc(25% - 12px);
  min-height: 160px; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm), var(--inset-hi);
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
}
.box:hover { border-color: var(--border-hi); box-shadow: var(--shadow-md); }
.box > h4 {
  padding: 11px 16px 10px;
  background: linear-gradient(90deg, rgba(0,229,176,0.06), transparent 65%);
  border-bottom: 1px solid var(--border);
  margin: 0; text-align: left; display: flex; align-items: center; gap: 7px;
}
.box > *:not(h4) { padding: 14px 16px; }
.box-wide { flex: 0 0 calc(70% - 8px); width: calc(70% - 8px); max-width: 1000px; }
.bigbox {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 2px; width: 100%; max-width: 960px;
  display: flex; flex-direction: column; overflow: hidden;
}
@media (max-width: 1500px) { .box { flex: 0 0 calc(33.33% - 11px); width: calc(33.33% - 11px); } }
@media (max-width: 1100px) {
  .box, .box-wide { flex: 0 0 calc(50% - 8px); width: calc(50% - 8px); max-width: 100%; }
  .form-container { grid-template-columns: 1fr; }
}
@media (max-width: 750px) {
  .box, .box-wide, .bigbox { flex: 0 0 100%; width: 100%; }
  .buttons { grid-template-columns: 1fr; }
}

/* ================================================================
   PORT MATRIX
   ================================================================ */

.portbox {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: 2px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--text-dim); cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  transition: all var(--transition);
}
.portbox:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.portbox.active {
  background: var(--accent-mid); border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 12px rgba(0,229,176,0.15);
  text-shadow: 0 0 8px var(--accent-glow);
}
.box-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px; margin-bottom: 12px; width: 100%;
}

/* ================================================================
   STATUS ELEMENTS
   ================================================================ */

.logger-status { font-family: var(--mono); font-size: 12px; color: var(--text-dim); line-height: 1.7; }
.status-container { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.status-item { display: flex; align-items: center; gap: 10px; }
.status-dot.Active {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  animation: pulse-ring 2s ease-out infinite;
}
.status-dot.Inactive {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--text-dim); background: transparent;
}
.status-label {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); width: 130px; flex-shrink: 0;
}
.status-value { font-family: var(--mono); font-size: 13px; color: var(--text-hi); flex: 1; }

.tab-boxes { display: flex; flex-wrap: wrap; gap: 16px; }
.tab-content { display: none; }
.tab-content.active { display: block; width: 100%; animation: fadeUp 0.22s ease both; }

/* ================================================================
   TOGGLE SWITCH
   ================================================================ */

.toggle-container { display: flex; align-items: center; gap: 10px; }
.toggle-switch { position: relative; width: 42px; height: 22px; display: inline-block; }
.toggle-switch input { display: none; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: 2px; transition: 0.25s;
}
.slider:before {
  content: ''; position: absolute; width: 14px; height: 14px;
  left: 3px; bottom: 3px; background: var(--text-dim);
  border-radius: 1px; transition: 0.25s;
}
input:checked + .slider { background: var(--accent-dim); border-color: var(--accent); }
input:checked + .slider:before {
  transform: translateX(20px); background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ================================================================
   INFO ICON / TOOLTIPS
   ================================================================ */

.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  color: var(--text-dim); background: var(--panel-alt);
  border: 1px solid var(--border); cursor: pointer;
  margin-left: 5px; position: relative; transition: all var(--transition);
  text-transform: lowercase; font-style: italic;
}
.info-icon:hover { border-color: var(--accent); color: var(--accent); }
.info-icon::after {
  content: attr(data-tooltip); position: absolute;
  bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--panel-alt); color: var(--text); border: 1px solid var(--border-hi);
  padding: 8px 12px; border-radius: var(--r-sm); font-size: 11px; line-height: 1.5;
  font-family: var(--mono); white-space: normal; min-width: 220px; max-width: 320px;
  box-shadow: var(--shadow-lg); z-index: 9999;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--transition);
}
.info-icon:hover::after { opacity: 1; visibility: visible; }

/* Popup forms (sensor config) */
#analogFormContainer, #analogFormContainer2,
#pulseFormContainer, #pulseFormContainer2,
#SDI12FormContainer, #SDI12FormContainer2 {
  display: none; position: fixed; top: 20%; left: 50%; margin-left: -170px;
  background: var(--panel-solid); border: 1px solid var(--border-hi);
  border-radius: 2px; padding: 22px; z-index: 1000;
  width: 340px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,229,176,0.08);
}

.go-back-arrow {
  position: absolute; top: 10px; left: 15px;
  font-size: 24px; color: var(--text-dim); text-decoration: none;
  z-index: 10; transition: color var(--transition);
}
.go-back-arrow:hover { color: var(--accent); }
#logger_response { display: flex; flex-wrap: wrap; gap: 8px; }

/* ================================================================
   MOBILE  (≤650px) — rail hidden, injected topbar + dropdown nav
   ================================================================ */

.mobile-topbar { display: none; }

@media (max-width: 900px) {
  .tb-page { font-size: 14px; }
  .refresh-status { display: none; }
  .user-box-name { max-width: 90px; }
}

@media (max-width: 650px) {
  :root { --rail-w: 0px; --sidebar-w: 0px; --mtb-h: 54px; }

  body { margin-left: 0; padding-top: calc(var(--mtb-h) + var(--topbar-h)); }

  /* Injected mobile bar on top */
  .mobile-topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--mtb-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px;
    background: var(--panel-solid);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    z-index: 1150;
  }
  .mobile-topbar-logo { display: flex; align-items: center; }
  .mobile-topbar-logo img { height: 28px; width: auto; object-fit: contain; }

  .mobile-menu-toggle {
    width: 40px; height: 40px;
    background: var(--accent-dim); border: 1px solid var(--accent);
    border-radius: 2px; color: var(--accent); cursor: pointer;
    display: flex; align-items: center; justify-content: center; padding: 0;
    transition: background var(--transition), box-shadow var(--transition);
  }
  .mobile-menu-toggle:hover { background: var(--accent-mid); box-shadow: 0 0 12px var(--accent-glow); }
  .mobile-menu-icon { position: relative; display: block; width: 18px; height: 2px;
    background: var(--accent); transition: background var(--transition); }
  .mobile-menu-icon::before, .mobile-menu-icon::after {
    content: ''; position: absolute; left: 0; width: 18px; height: 2px;
    background: var(--accent);
    transition: transform var(--transition), top var(--transition), bottom var(--transition);
  }
  .mobile-menu-icon::before { top: -6px; }
  .mobile-menu-icon::after  { bottom: -6px; }
  .mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon { background: transparent; }
  .mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon::before { top: 0; transform: rotate(45deg); }
  .mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon::after  { bottom: 0; transform: rotate(-45deg); }

  /* Topbar slides below the mobile bar */
  .topbar { top: var(--mtb-h); left: 0; padding: 0 14px; gap: 8px; }
  .tb-title { display: none; }
  .tb-chip { display: none; }
  .logger-select-row { flex: 1; }
  .logger-select-row #loggerSelect { min-width: 0; max-width: none; flex: 1; }

  /* The rail (carries .sidebar2) becomes a dropdown menu */
  .rail {
    top: var(--mtb-h); left: 0; width: 100%; height: auto;
    max-height: 0; overflow: hidden;
    flex-direction: column; align-items: stretch; padding: 0;
    border-right: none; border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: max-height 0.28s ease;
    z-index: 1140;
  }
  .rail::after { display: none; }
  .rail.open { max-height: calc(100vh - var(--mtb-h)); overflow-y: auto; }
  .rail-logo, .rail-sep { display: none; }
  .rail .nav-links { flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 10px; }
  .rail .nav-links a {
    width: auto; height: auto; justify-content: flex-start; gap: 12px;
    padding: 12px 12px; font-size: 13px; font-family: var(--mono);
  }
  .rail .nav-links a.active::before { left: 0; }
  .nav-label {
    position: static; transform: none; opacity: 1; visibility: visible;
    background: none; border: none; box-shadow: none; padding: 0;
    pointer-events: auto; color: inherit; font-size: 13px;
  }
  .nav-label::before { display: none; }
  .rail-foot { margin: 6px 10px 12px; align-items: flex-start; }

  body.mobile-menu-open .container { filter: brightness(0.8); }
  .info-panel { left: 8px; bottom: 8px; }
  .dash-grid { min-width: 0; }
  .card { min-width: 0; max-width: 100%; }
}

@media (max-width: 480px) {
  .container { padding: 16px 12px 36px; }
  .dash-grid { gap: 12px; }
}

/* ── Status message classes (Dom.status) ─────────────────────── */
.status-ok    { color: var(--ok); font-family: var(--mono); font-size: 12px; }
.status-info  { color: var(--text); font-family: var(--mono); font-size: 12px; }
.status-warn  { color: var(--amber); font-family: var(--mono); font-size: 12px; font-weight: 500; }
.status-error { color: var(--warn); font-family: var(--mono); font-size: 12px; font-weight: 600; }

/* ── Per-field info icons (Validate.hydrateInfoIcons) ────────── */
.field-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 6px; border-radius: 50%;
  background: var(--panel-alt); border: 1px solid var(--border);
  color: var(--accent); font-family: var(--mono); font-size: 9px; font-weight: 700;
  line-height: 1; cursor: help; position: relative; user-select: none;
  transition: background .15s, color .15s, border-color .15s;
  vertical-align: middle; text-transform: none; letter-spacing: 0;
}
.field-info:hover, .field-info:focus-visible {
  background: var(--accent); color: #03100c; border-color: var(--accent); outline: none;
}
.field-info-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 240px; padding: 7px 10px;
  background: var(--panel-alt); color: var(--text);
  border: 1px solid var(--accent); border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  font-family: var(--mono); font-size: 10px; font-weight: 400; line-height: 1.5;
  letter-spacing: 0; text-transform: none; text-align: left; white-space: normal;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .15s, visibility .15s; z-index: 1000;
}
.field-info-tip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--accent);
}
.field-info:hover .field-info-tip,
.field-info:focus-visible .field-info-tip,
.field-info.show-tip .field-info-tip { opacity: 1; visibility: visible; }

.field-info-tip-fixed {
  position: fixed; width: max-content; max-width: 240px; padding: 7px 10px;
  background: var(--panel-alt); color: var(--text);
  border: 1px solid var(--accent); border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  font-family: var(--mono); font-size: 10px; font-weight: 400; line-height: 1.5;
  letter-spacing: 0; text-transform: none; text-align: left; white-space: normal;
  z-index: 99999; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s;
}
.field-info-tip-fixed.visible { opacity: 1; visibility: visible; }

/* ── Sensor config popup fields ──────────────────────────────── */
.sc-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.sc-field label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
  display: inline-flex; align-items: center;
}
.sc-field input, .sc-field select {
  background: rgba(0,0,0,0.35); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 10px;
  font-family: var(--mono); font-size: 11px; color: var(--text);
  width: 100%; box-sizing: border-box; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.sc-field input:focus, .sc-field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim);
}

/* ── Inline field notice ─────────────────────────────────────── */
.field-notice {
  font-family: var(--mono); font-size: 10px; line-height: 1.4;
  margin-top: 4px; min-height: 14px; letter-spacing: 0; text-transform: none;
}
.field-notice.info  { color: var(--text-dim); }
.field-notice.ok    { color: var(--ok); }
.field-notice.warn  { color: var(--amber); }
.field-notice.error { color: var(--warn); font-weight: 600; }

/* ── Nav-disabled (admin link for non-admins) ────────────────── */
.nav-links a.nav-disabled {
  color: var(--text-dim); opacity: 0.35; pointer-events: none;
  cursor: not-allowed; font-style: italic;
}
.nav-links a.nav-disabled::before { content: none; }

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Hidden nav entries (admin link before auth resolves) must stay hidden
   even though .rail .nav-links a sets display:flex. */
.nav-links a[hidden] { display: none !important; }

/* Status pill (Data Explorer topbar) — global so it styles inside .topbar */
.status-pill {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  padding: 3px 10px; border-radius: 2px;
  border: 1px solid var(--border); color: var(--text-dim);
  letter-spacing: 0.12em; text-transform: uppercase;
  background: rgba(0,0,0,0.25); flex-shrink: 0;
}
.status-pill.ok  { border-color: var(--accent); color: var(--accent); background: rgba(0,229,176,0.07); }
.status-pill.err { border-color: var(--warn);   color: var(--warn); }
.status-pill.loading { border-color: var(--text-dim); color: var(--text-dim); animation: blink 1.2s infinite; }

/* ================================================================
   THEME TOGGLE BUTTON (topbar)
   ================================================================ */

.theme-toggle {
  width: 34px; height: 34px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-dim);
  cursor: pointer; padding: 0;
  transition: all var(--transition);
}
.theme-toggle:hover {
  color: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-dim);
}
.theme-toggle svg {
  width: 17px; height: 17px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.theme-toggle.floating {
  position: fixed; top: 14px; right: 14px; z-index: 50;
}

/* ================================================================
   LIGHT THEME — "Field Mode" (high contrast for outdoor use)
   Activated via <html data-theme="light">, persisted by theme.js.
   ================================================================ */

html[data-theme="light"] {
  --bg:          #eef1f4;
  --bg-raise:    #ffffff;
  --panel:       #ffffff;
  --panel-solid: #ffffff;
  --panel-alt:   #e6ebf1;
  --panel-hover: #dbe3eb;
  --border:      rgba(15, 35, 55, 0.20);
  --border-hi:   rgba(15, 35, 55, 0.40);
  --accent:      #00e5b0;
  --accent-2:    #45c8ff;
  --accent-grad: linear-gradient(135deg, #00e5b0, #45c8ff);
  --accent-dim:  rgba(0, 229, 176, 0.14);
  --accent-mid:  rgba(0, 229, 176, 0.30);
  --accent-glow: rgba(0, 229, 176, 0.40);
  --amber:       #995b00;
  --warn:        #c81e45;
  --warn-dim:    rgba(200, 30, 69, 0.10);
  --ok:          #00bf93;
  --text:        #15212e;
  --text-hi:     #02080f;
  --text-dim:    #4f6172;
  --muted:       #4f6172;
  --shadow-sm:   0 2px 8px rgba(15, 35, 55, 0.10);
  --shadow-md:   0 6px 20px rgba(15, 35, 55, 0.14);
  --shadow-lg:   0 12px 36px rgba(15, 35, 55, 0.18);
  --inset-hi:    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Surfaces with hard-coded dark values */
html[data-theme="light"] body {
  /* No grid pattern in light mode — just soft, modern color washes. */
  background-image:
    radial-gradient(ellipse 90% 60% at 12% -15%, rgba(0, 229, 176, 0.10), transparent 55%),
    radial-gradient(ellipse 70% 50% at 108% 0%,  rgba(69, 200, 255, 0.08), transparent 55%),
    linear-gradient(180deg, #f7f9fb 0%, #edf1f5 60%, #e8eef3 100%);
  background-size: 100% 100%, 100% 100%, 100% 100%;
}
html[data-theme="light"] .rail {
  background: linear-gradient(180deg, rgba(0, 229, 176, 0.07), transparent 18%), var(--panel-solid);
}
html[data-theme="light"] .topbar {
  background: linear-gradient(90deg, rgba(0, 229, 176, 0.06), transparent 40%), rgba(255, 255, 255, 0.94);
}
html[data-theme="light"] .tb-page { text-shadow: none; }
html[data-theme="light"] .card-title { text-shadow: none; }
html[data-theme="light"] .box > h4 { text-shadow: none; }
html[data-theme="light"] .rail-logo img { filter: none; }
html[data-theme="light"] .login-logo img { filter: none; }

html[data-theme="light"] .tb-chip,
html[data-theme="light"] .badge,
html[data-theme="light"] .status-pill,
html[data-theme="light"] .tabs { background: rgba(15, 35, 55, 0.05); }

html[data-theme="light"] .card-footer { background: rgba(15, 35, 55, 0.04); }
html[data-theme="light"] .info-panel-about { background: rgba(15, 35, 55, 0.04); }

html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="email"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="datetime-local"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] textarea,
html[data-theme="light"] select,
html[data-theme="light"] .sc-field input,
html[data-theme="light"] .sc-field select { background: #ffffff; }
html[data-theme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: none; }

html[data-theme="light"] .portbox,
html[data-theme="light"] .button { background: #ffffff; }

html[data-theme="light"] th { background: rgba(15, 35, 55, 0.06); }
html[data-theme="light"] tr:nth-child(even) td { background: rgba(15, 35, 55, 0.025); }

/* Buttons keep the dark-theme look: near-black text on turquoise */
html[data-theme="light"] .logger-select-row #loggerSelect option { background: #ffffff; color: var(--text); }
html[data-theme="light"] .submit-button:disabled { color: var(--text-dim); }

/* ================================================================
   POWER-SAVING TILES (rendered by powersaving.js)
   Telemetry readout style — matches the HUD panels.
   ================================================================ */

.ps-tile-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 700px) { .ps-tile-grid { grid-template-columns: 1fr; } }

.ps-tile {
  position: relative;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  padding: 14px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.ps-tile::after {
  content: ''; position: absolute; bottom: -1px; right: -1px;
  width: 9px; height: 9px;
  border-right: 1px solid var(--accent); border-bottom: 1px solid var(--accent);
  opacity: 0.55;
}
.ps-tile:hover {
  border-color: var(--border-hi); border-left-color: var(--accent);
  box-shadow: 0 0 16px rgba(0,229,176,0.08);
}
.ps-tile-label {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 8px;
}
.ps-tile-value {
  font-family: var(--display); font-size: 19px; font-weight: 400;
  letter-spacing: 0.04em; color: var(--accent); line-height: 1.1;
  margin-bottom: 4px;
  text-shadow: 0 0 18px var(--accent-glow);
}
.ps-tile-sub {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
}

html[data-theme="light"] .ps-tile { background: rgba(15,35,55,0.04); }
html[data-theme="light"] .ps-tile-value { text-shadow: none; }
