/* ==========================================================================
   Monitor STB Armbian v2: BlueWave Dark Ops Console
   Charcoal-Obsidian + Emerald Uptime + Cobalt Blue Area + Safe Power Reboot
   All color pairs mathematically verified WCAG AA via contrast-check.py
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg-ground: #0B0D10;
  --bg-sidebar: #0F1217;
  --bg-card: #11141A;
  --bg-elevated: #171B23;
  --bg-nav-active: #171D28;

  --text-primary: #F4F6FA;
  --text-muted: #9BA3B4;
  --text-meta: #8C95A8;

  --border: #1E242E;
  --border-strong: #2C3544;
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  --brand-blue: #2563EB;
  --chart-blue: #3B82F6;
  --accent-blue-text: #60A5FA;

  --ok-text: #4ADE80;
  --ok-bg: #0E2218;
  --ok-border: #1E4D36;

  --warn-text: #FBBF24;
  --warn-bg: #261E0F;
  --warn-border: #5C4315;

  --crit-text: #F87171;
  --crit-bg: #2A1215;
  --crit-border: #63222A;
  --danger-btn: #DC2626;
  --danger-btn-hover: #EF4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --bg-ground: #F2F5FA;
  --bg-sidebar: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-elevated: #EAF0F8;
  --bg-nav-active: #E8F0FE;

  --text-primary: #111827;
  --text-muted: #4B5563;
  --text-meta: #525E70;

  --border: #DCE3EE;
  --border-strong: #C5D0E0;
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.9);

  --brand-blue: #1D4ED8;
  --chart-blue: #2563EB;
  --accent-blue-text: #1D4ED8;

  --ok-text: #15803D;
  --ok-bg: #EAF8EF;
  --ok-border: #A7DFB9;

  --warn-text: #A16207;
  --warn-bg: #FEF6E4;
  --warn-border: #F2D28B;

  --crit-text: #B91C1C;
  --crit-bg: #FDECEC;
  --crit-border: #F3B7B7;
  --danger-btn: #DC2626;
  --danger-btn-hover: #B91C1C;
}

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

html {
  font-size: 16px;
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-ground);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 10px;
  background: var(--brand-blue);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  z-index: 120;
}

.skip-link:focus {
  left: 16px;
}

:focus-visible {
  outline: 2px solid var(--accent-blue-text);
  outline-offset: 2px;
}

/* ================= APP SHELL (SIDEBAR + MAIN CONSOLE) ================= */
.app-layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px;
}

.brand-square {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand-blue);
  color: #FFFFFF;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--text-meta);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-kicker {
  padding: 0 8px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--text-meta);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 150ms ease, color 150ms ease;
}

.side-link:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.side-link.active {
  background: var(--bg-nav-active);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--chart-blue);
}

.brand-svg {
  flex-shrink: 0;
  display: block;
}

.side-node-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.side-node-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.side-node-btn.active {
  background: var(--bg-nav-active);
  border-color: var(--border-strong);
  color: var(--text-primary);
  box-shadow: inset 2px 0 0 var(--chart-blue);
}

.node-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.node-copy strong {
  font-size: 0.84rem;
  font-weight: 600;
}

.node-copy small {
  font-size: 0.68rem;
  color: var(--text-meta);
  margin-top: 2px;
}

.sidebar-controls-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.side-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.side-action-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--chart-blue);
}

.ctrl-btn-icon {
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.auth-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.side-power-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--crit-border);
  background: var(--crit-bg);
  color: var(--crit-text);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.side-power-btn:hover {
  background: #3B161B;
  border-color: #EF4444;
}

/* ================= MAIN CONSOLE ================= */
.console-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.console-header {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-meta);
}

.crumb-active {
  color: var(--text-primary);
}

.host-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.host-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.live-badge.ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-text);
}

.live-badge.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text);
}

.live-badge.crit {
  background: var(--crit-bg);
  border-color: var(--crit-border);
  color: var(--crit-text);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.host-sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ctrl-select,
.ctrl-btn,
.ctrl-input {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
}

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.ctrl-btn:hover {
  background: var(--bg-elevated);
  border-color: #46536A;
}

.ctrl-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ctrl-btn-power {
  border-color: var(--crit-border);
  background: var(--crit-bg);
  color: var(--crit-text);
}

.ctrl-btn-power:hover {
  background: #3B161B;
  border-color: #EF4444;
}

/* ================= CONSOLE BODY ================= */
.console-body {
  padding: 22px 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.banner p {
  margin: 3px 0 0;
  color: var(--text-muted);
}

.banner-err {
  background: var(--crit-bg);
  border: 1px solid var(--crit-border);
  color: var(--crit-text);
}

.banner-ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok-text);
  font-weight: 600;
}

.banner-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ================= ROW 1: HERO KPI TRIO (BLUEWAVE STYLE) ================= */
.kpi-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--specular);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-uptime {
  background: linear-gradient(135deg, #0E2218 0%, #101A17 58%, #11141A 100%);
  border-color: var(--ok-border);
}

.kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-meta);
}

.kpi-uptime .kpi-label {
  color: var(--ok-text);
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.kpi-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* ================= ROW 2: 3-CARD VISUAL INSTRUMENTS ================= */
.viz-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ops-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--specular);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-top-wrap {
  flex-wrap: wrap;
}

.card-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.card-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.card-sub {
  margin: 3px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-foot {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-meta);
}

.pill-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.pill-chip.ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-text);
}

.pill-chip.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text);
}

.pill-chip.crit {
  background: var(--crit-bg);
  border-color: var(--crit-border);
  color: var(--crit-text);
}

.dual-stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stat-k {
  display: block;
  font-size: 0.74rem;
  color: var(--text-meta);
}

.stat-v {
  font-size: 1.25rem;
  font-weight: 700;
}

.bars-wrap,
.gauge-wrap,
.area-chart-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bars-svg,
.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.gauge-svg {
  width: min(230px, 100%);
  height: auto;
  display: block;
}

.gauge-arc {
  transition: stroke-dashoffset 400ms var(--ease), stroke 240ms ease;
}

.chart-placeholder {
  margin: 20px 0;
  font-size: 0.82rem;
  color: var(--text-meta);
  text-align: center;
}

/* Storage & Swap Bars */
.storage-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.storage-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.storage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
}

.storage-name {
  font-weight: 600;
}

.storage-mount {
  color: var(--text-meta);
  font-size: 0.74rem;
  margin-left: 5px;
}

.bar-track {
  height: 9px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 300ms var(--ease);
}

.bar-fill.ok {
  background: #22C55E;
}

.bar-fill.warn {
  background: #F59E0B;
}

.bar-fill.crit {
  background: #EF4444;
}

.storage-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-meta);
}

/* Area Chart Legend */
.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 5px;
}

.swatch-blue {
  background: var(--chart-blue);
}

.swatch-green {
  background: #22C55E;
}

.sample-tag {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-meta);
}

/* ================= PROCESS TABLE ================= */
.proc-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.proc-tools .ctrl-input {
  width: min(260px, 100%);
}

.seg-group {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-ground);
  border: 1px solid var(--border);
}

.seg-btn {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--brand-blue);
  color: #FFFFFF;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.ops-table th {
  text-align: left;
  padding: 9px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-meta);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.ops-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.ops-table tbody tr:hover {
  background: var(--bg-elevated);
}

.num {
  text-align: right;
  white-space: nowrap;
}

.proc-name {
  font-weight: 600;
}

.proc-cmd {
  max-width: 340px;
  font-size: 0.74rem;
  color: var(--text-meta);
}

.proc-cmd summary {
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  list-style: none;
}

.proc-cmd details[open] summary {
  white-space: normal;
  word-break: break-all;
  color: var(--text-primary);
}

.table-empty {
  text-align: center;
  color: var(--text-meta);
  padding: 20px;
}

.empty-state {
  text-align: center;
  padding: 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

/* ================= INFRA GRID ================= */
.infra-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.meta-count {
  font-size: 0.74rem;
  color: var(--text-meta);
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-ground);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.row-sub {
  font-size: 0.73rem;
  color: var(--text-meta);
  margin-top: 2px;
}

.sub-section {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.sub-label {
  margin: 0 0 8px;
  font-size: 0.7rem;
  color: var(--text-meta);
  letter-spacing: 0.08em;
}

.client-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-ground);
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

.muted-text {
  color: var(--text-meta);
  font-size: 0.8rem;
}

.service-link {
  color: var(--accent-blue-text);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.78rem;
}

.service-link:hover {
  text-decoration: underline;
}

.skeleton-bar {
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

/* ================= FOOTER ================= */
.console-footer {
  margin-top: auto;
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--text-meta);
}

/* ================= SAFE POWER REBOOT MODAL ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 8, 12, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: min(440px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.power-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--crit-bg);
  border: 1px solid var(--crit-border);
  color: var(--crit-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.modal-desc {
  margin: 5px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-error {
  margin: 0;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--crit-bg);
  border: 1px solid var(--crit-border);
  color: var(--crit-text);
  font-size: 0.8rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.btn-danger {
  min-height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid #EF4444;
  background: var(--danger-btn);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger:hover {
  background: var(--danger-btn-hover);
}

.btn-danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid #3B82F6;
  background: var(--brand-blue);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms var(--ease);
}

.btn-primary:hover:not(:disabled) {
  background: #1D4ED8;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lock-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: var(--accent-blue-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ================= PASSWORD AUTH GATE ================= */
.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: var(--bg-ground);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72), var(--specular);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.auth-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-desc {
  margin: 5px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.input-action-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-action-row .ctrl-input {
  flex: 1 1 auto;
  min-width: 0;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1120px) {
  .viz-trio {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
  }

  .sidebar-bottom {
    margin-top: 0;
    padding-top: 10px;
  }

  .side-nav,
  .sidebar-controls-stack {
    flex-direction: row;
    gap: 6px;
    flex-wrap: wrap;
  }

  .side-node-btn,
  .side-action-btn,
  .side-power-btn {
    width: auto;
    flex: 1 1 135px;
  }

  .console-header,
  .console-body,
  .console-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .kpi-trio,
  .viz-trio,
  .infra-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}
