/* ═══════════════════════════════════════════════════════════════════════
   Cipi Panel (CP) — Instrument Panel Design System
   Neutral zinc surfaces · one violet accent · hairline borders · flat depth
   Rules: no decorative gradients, no glow/blur, no idle motion, radii 4-8px,
          hierarchy carried by type scale + 1px borders instead of effects.
   Responsive Tiers: Desktop (>=1180px), Tablet (768-1179px), Mobile (<768px)
   ═══════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/inter-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2');
}

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  --bg-canvas: #0b0b0e;
  --bg-sidebar: #0d0d11;
  --bg-surface: #121216;
  --bg-surface-alpha: #121216;
  --bg-surface-head: #16161b;
  --bg-elevated: #1a1a20;
  --bg-hover: #212128;
  --bg-input: #0e0e12;
  --bg-terminal: #08080a;
  --bg-terminal-bar: #101014;

  --border-subtle: rgba(255, 255, 255, 0.065);
  --border-default: rgba(255, 255, 255, 0.105);
  --border-strong: rgba(255, 255, 255, 0.2);

  --text-primary: #f2f2f4;
  --text-secondary: #a5a5af;
  --text-muted: #808089;

  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --accent-border: rgba(139, 92, 246, 0.34);
  --accent-text: #b39dff;
  --accent-solid: #7c3aed;
  --accent-solid-hover: #6d28d9;
  --spotlight-glow: transparent;
  --horizon-glow: transparent;

  --status-ok: #46b86a;
  --status-ok-soft: rgba(70, 184, 106, 0.13);
  --status-ok-border: rgba(70, 184, 106, 0.32);

  --status-warn: #d8a13a;
  --status-warn-soft: rgba(216, 161, 58, 0.13);
  --status-warn-border: rgba(216, 161, 58, 0.32);

  --status-danger: #e5564f;
  --status-danger-soft: rgba(229, 86, 79, 0.13);
  --status-danger-border: rgba(229, 86, 79, 0.32);

  --chart-grid: rgba(255, 255, 255, 0.055);
  --chart-cpu: #a78bfa;
  --chart-cpu-fill: rgba(167, 139, 250, 0.16);
  --chart-mem: #46b86a;
  --chart-mem-fill: rgba(70, 184, 106, 0.14);
  --chart-loop: #d8a13a;
  --chart-loop-fill: rgba(216, 161, 58, 0.14);

  --rim-highlight: inset 0 0 0 0 rgba(0, 0, 0, 0);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  --card-shadow-hover: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-modal: 0 18px 48px rgba(0, 0, 0, 0.7);
  --grid-dot: transparent;
  --shimmer-base: rgba(255, 255, 255, 0.05);
  --shimmer-peak: rgba(255, 255, 255, 0.05);

  --logo-bg: #07060f;
  --logo-hover-border: rgba(167, 139, 250, 0.62);
  --logo-border: rgba(167, 139, 250, 0.24);
  --logo-fg: #f8fafc;
  --logo-accent: #a855f7;
}

[data-theme="light"] {
  color-scheme: light;
  --bg-canvas: #f7f7f8;
  --bg-sidebar: #f1f1f3;
  --bg-surface: #ffffff;
  --bg-surface-alpha: #ffffff;
  --bg-surface-head: #fbfbfc;
  --bg-elevated: #f4f4f5;
  --bg-hover: #ececee;
  --bg-input: #ffffff;
  --bg-terminal: #08080a;
  --bg-terminal-bar: #101014;

  --border-subtle: rgba(9, 9, 11, 0.06);
  --border-default: rgba(9, 9, 11, 0.1);
  --border-strong: rgba(9, 9, 11, 0.2);

  --text-primary: #16161a;
  --text-secondary: #52525b;
  --text-muted: #71717a;

  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.09);
  --accent-border: rgba(124, 58, 237, 0.3);
  --accent-text: #6d28d9;
  --accent-solid: #6d28d9;
  --accent-solid-hover: #5b21b6;
  --spotlight-glow: transparent;
  --horizon-glow: transparent;

  --status-ok: #0f8a4a;
  --status-ok-soft: rgba(15, 138, 74, 0.09);
  --status-ok-border: rgba(15, 138, 74, 0.26);

  --status-warn: #a9680a;
  --status-warn-soft: rgba(169, 104, 10, 0.09);
  --status-warn-border: rgba(169, 104, 10, 0.26);

  --status-danger: #c02b25;
  --status-danger-soft: rgba(192, 43, 37, 0.08);
  --status-danger-border: rgba(192, 43, 37, 0.24);

  --chart-grid: rgba(9, 9, 11, 0.07);
  --chart-cpu: #7c3aed;
  --chart-cpu-fill: rgba(124, 58, 237, 0.12);
  --chart-mem: #0f8a4a;
  --chart-mem-fill: rgba(15, 138, 74, 0.1);
  --chart-loop: #a9680a;
  --chart-loop-fill: rgba(169, 104, 10, 0.1);

  --rim-highlight: inset 0 0 0 0 rgba(0, 0, 0, 0);
  --card-shadow: 0 1px 2px rgba(9, 9, 11, 0.05);
  --card-shadow-hover: 0 1px 2px rgba(9, 9, 11, 0.05);
  --shadow-modal: 0 18px 44px rgba(9, 9, 11, 0.14);
  --grid-dot: transparent;
  --shimmer-base: rgba(9, 9, 11, 0.05);
  --shimmer-peak: rgba(9, 9, 11, 0.05);

  --logo-bg: #07060f;
  --logo-hover-border: rgba(124, 58, 237, 0.55);
  --logo-border: rgba(9, 9, 11, 0.14);
  --logo-fg: #ffffff;
  --logo-accent: #a855f7;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: 'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.48;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  transition: background-color 200ms ease, color 150ms ease;
}

::selection {
  background: rgba(59, 130, 246, 0.28);
  color: var(--text-primary);
}

body.nav-locked {
  overflow: hidden;
}

.mono,
code,
pre,
.tabular {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'Cascadia Code', Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.num {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* ─── Keyframe Choreography (60fps GPU-composited) ─── */
@keyframes cpCascadeUp {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cpModalIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cpDrawerIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes cpDrawerOut {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes cpBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes cpToastIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cpToastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(4px);
  }
}

@keyframes cpSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cpTopBarSweep {
  0% {
    transform: translateX(-100%) scaleX(0.35);
    opacity: 0.95;
  }
  55% {
    transform: translateX(15%) scaleX(0.75);
    opacity: 1;
  }
  100% {
    transform: translateX(115%) scaleX(0.9);
    opacity: 0;
  }
}

/* ─── Scrollbars ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ─── Icons ─── */
svg.icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

svg.icon-sm {
  width: 13px;
  height: 13px;
}

/* ─── Shimmer Skeleton Loaders ─── */
.skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 4px 0;
}

.skeleton-line {
  height: 13px;
  width: 100%;
  border-radius: 4px;
  background: var(--shimmer-base);
}

.skeleton-line.short {
  width: 64%;
}

/* ─── CP Monogram Brand ─── */
.cp-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  min-width: 0;
}

.cp-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--logo-bg);
  border: 1px solid var(--logo-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  transition: transform 200ms var(--ease-out), border-color 200ms ease, box-shadow 240ms ease;
}

.cp-brand:hover .cp-mark {
  transform: translateY(-1px);
  border-color: var(--logo-hover-border);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.42);
}

.cp-mark .cp-logo-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.cp-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.cp-brand-title {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.cp-brand-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.01em;
}

/* ─── Login Screen (Architectural Micro-Grid Gate) ─── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: var(--bg-canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  animation: cpBackdropIn 200ms ease both;
}

.auth-card {
  width: 100%;
  max-width: 406px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow-modal), var(--rim-highlight);
  animation: cpModalIn 240ms var(--ease-out) both;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-header .cp-mark {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.42);
}

.auth-header .cp-brand-title {
  font-size: 15px;
  letter-spacing: -0.025em;
}

.auth-header .cp-brand-sub {
  font-size: 11px;
}

.auth-desc {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.55;
}

.auth-error {
  margin-bottom: 12px;
  padding: 9px 11px;
  border-radius: 7px;
  background: var(--status-danger-soft);
  border: 1px solid var(--status-danger-border);
  color: var(--status-danger);
  font-size: 12px;
  animation: cpCascadeUp 160ms var(--ease-out) both;
}

.auth-field {
  margin-bottom: 13px;
}

.auth-actions {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-block {
  width: 100%;
}

/* ─── App Shell & Independent Locked Sidebar (Never Scrolls With Right Page) ─── */
.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  transition: grid-template-columns 250ms var(--ease-smooth);
}

@media (min-width: 1024px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .app-shell > .sidebar {
    position: relative;
    height: 100%;
    max-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .app-shell > .workspace {
    height: 100%;
    max-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    scroll-behavior: smooth;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 0px minmax(0, 1fr);
  }

  .app-shell.sidebar-collapsed .sidebar {
    opacity: 0;
    transform: translateX(-16px);
    pointer-events: none;
    border-right-color: transparent;
    overflow: hidden;
  }

  .sidebar-backdrop,
  .sidebar-backdrop.open {
    display: none !important;
  }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.58);
  animation: cpBackdropIn 180ms ease both;
}

.sidebar-backdrop.open {
  display: block;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  transition:
    opacity 200ms var(--ease-smooth),
    transform 250ms var(--ease-smooth),
    background-color 180ms ease,
    border-color 180ms ease;
}

.sidebar-top {
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.btn.sidebar-close-btn {
  display: none;
}

.sidebar-section-label {
  padding: 18px 16px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2.5px;
  padding: 0 10px;
}

.nav-btn {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition:
    background-color 150ms var(--ease-out),
    color 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    box-shadow 150ms var(--ease-out),
    transform 120ms var(--ease-out);
}

.nav-btn::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 7px;
  bottom: 7px;
  width: 2.5px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  opacity: 0;
  transform: scaleY(0.3);
  transition: opacity 180ms var(--ease-out), transform 200ms var(--ease-out);
}

.nav-btn-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  transition: transform 160ms var(--ease-out);
}

.nav-btn-left span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.nav-btn.active {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--card-shadow);
}

.nav-btn.active::before {
  opacity: 1;
  transform: scaleY(1);
}

.nav-btn.active svg.icon {
  color: var(--accent-text);
}

.nav-count {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.nav-btn.active .nav-count {
  border-color: var(--accent-border);
  color: var(--accent-text);
  background: var(--accent-soft);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.stream-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.stream-dot-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.node-ver-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Live Sonar Hardware LEDs ─── */
.led {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text-muted);
  display: inline-block;
  flex-shrink: 0;
  transition: background-color 180ms ease;
}

.led.ok {
  background: var(--status-ok);
  box-shadow: 0 0 0 3px var(--status-ok-soft);
}

.led.warn {
  background: var(--status-warn);
  box-shadow: 0 0 0 3px var(--status-warn-soft);
}

.led.danger {
  background: var(--status-danger);
  box-shadow: 0 0 0 3px var(--status-danger-soft);
}

/* ─── Main Workspace, Ambient Horizon & Translucent Glass Header ─── */
.workspace {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
}

.instance-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.top-activity-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  pointer-events: none;
  opacity: 0;
}

.top-activity-bar.active::before {
  content: '';
  display: block;
  width: 48%;
  height: 100%;
  background: var(--accent);
  animation: cpTopBarSweep 640ms var(--ease-out) forwards;
}

.top-activity-bar.active {
  opacity: 1;
}

.instance-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.mobile-menu-btn {
  flex-shrink: 0;
}

.instance-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.breadcrumb-muted {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.instance-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.meta-divider {
  width: 1px;
  height: 16px;
  background: var(--border-default);
  flex-shrink: 0;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8.5px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.meta-pill-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 7px;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  font-size: 12px;
  color: var(--text-primary);
  word-break: break-word;
  animation: cpCascadeUp 180ms var(--ease-out) both;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7.5px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.025em;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.badge.ok {
  background: var(--status-ok-soft);
  border-color: var(--status-ok-border);
  color: var(--status-ok);
}

.badge.warn {
  background: var(--status-warn-soft);
  border-color: var(--status-warn-border);
  color: var(--status-warn);
}

.badge.danger {
  background: var(--status-danger-soft);
  border-color: var(--status-danger-border);
  color: var(--status-danger);
}

.badge.accent {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

.badge-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cmd-palette-trigger {
  gap: 7px;
  padding: 0 9px;
  background: var(--bg-input);
  border-color: var(--border-default);
  color: var(--text-secondary);
}

.cmd-palette-trigger:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.kbd-hint {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}

.power-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.22);
}

/* ─── Mobile & Tablet Quick-Switch Navigation Strip (<1024px) ─── */
.view-tabs-bar {
  display: none;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: 6px 14px;
  gap: 5px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.view-tabs-bar::-webkit-scrollbar {
  display: none;
}

.view-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 31px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    transform 90ms ease;
}

.view-tab-pill:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.view-tab-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 600;
}

.view-tab-pill svg.icon {
  width: 13.5px;
  height: 13.5px;
}

/* ─── Buttons & Inputs (Tactile Hardware Micro-Physics) ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  touch-action: manipulation;
  box-shadow: var(--rim-highlight);
  transition:
    background-color 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    box-shadow 140ms var(--ease-out),
    transform 90ms var(--ease-out);
}

.btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn:active:not(:disabled) {
  background: var(--bg-surface-head);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 1px var(--accent);
}

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

.btn-primary {
  background: var(--accent-solid);
  border-color: var(--accent-solid);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-solid-hover);
  border-color: var(--accent-solid-hover);
}

.btn-success {
  background: var(--status-ok-soft);
  border-color: var(--status-ok-border);
  color: var(--status-ok);
}

.btn-success:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.5);
}

.btn-warn {
  background: var(--status-warn-soft);
  border-color: var(--status-warn-border);
  color: var(--status-warn);
}

.btn-warn:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.5);
}

.btn-danger {
  background: var(--status-danger-soft);
  border-color: var(--status-danger-border);
  color: var(--status-danger);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.5);
}

.btn-icon {
  width: 32px;
  padding: 0;
}

.btn-sm {
  height: 28px;
  padding: 0 9.5px;
  font-size: 11.5px;
  border-radius: 6px;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 34px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--border-default);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  transition:
    border-color 140ms var(--ease-out),
    box-shadow 140ms var(--ease-out),
    background-color 140ms ease;
}

.input:hover:not(:focus),
.select:hover:not(:focus),
.textarea:hover:not(:focus) {
  border-color: var(--border-strong);
}

.input-compact,
.select-compact {
  height: 30px;
}

.textarea {
  height: auto;
  min-height: 94px;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.5;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.field-counter {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 500;
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: none;
}

/* ─── Content Container, Staggered Cascade & Pointer Spotlight Cards ─── */
.content-body {
  padding: 16px 20px calc(32px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1620px;
  width: 100%;
  margin: 0 auto;
}

.view-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.view-section:not(.hidden) > * {
  animation: cpCascadeUp 150ms var(--ease-out) both;
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metrics-strip > .metric-card {
  animation: cpCascadeUp 150ms var(--ease-out) both;
}

.metric-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 7px;
  padding: 12px 14px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  transition: border-color 140ms var(--ease-out);
}

.metric-card:hover,
.chart-box:hover {
  border-color: var(--border-strong);
}

.metric-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  min-width: 0;
}

.metric-head > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-label-short {
  display: none;
}

.metric-icon-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    transform 180ms var(--ease-out);
}

.metric-card:hover .metric-icon-box {
  color: var(--accent-text);
  border-color: var(--accent-border);
}

.metric-value-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.metric-value {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(15.5px, 1.32vw, 19.5px);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.metric-sub {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ─── Liquid Shimmering Telemetry Meters ─── */
.meter-track {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
}

.meter-fill {
  position: relative;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  overflow: hidden;
  transition: width 460ms var(--ease-smooth), background-color 220ms ease;
}

.meter-fill.ok {
  background: var(--status-ok);
}

.meter-fill.warn {
  background: var(--status-warn);
}

.meter-fill.danger {
  background: var(--status-danger);
}

/* ─── Panels, Grids & Responsive Forms ─── */
.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 7px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  min-width: 0;
  transition: border-color 180ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.panel-card:hover {
  border-color: var(--border-strong);
}

.panel-head {
  padding: 11px 15px;
  background: var(--bg-surface-head);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 7.5px;
  min-width: 0;
  flex-wrap: wrap;
}

.panel-title svg.icon {
  color: var(--accent);
}

.panel-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.panel-body {
  padding: 15px;
}

.panel-body-stack {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.section-divider-top {
  border-top: 1px solid var(--border-subtle);
  padding-top: 13px;
}

.console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.charts-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.chart-box {
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 7px;
  padding: 12px 14px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 200ms var(--ease-out),
    transform 200ms var(--ease-out);
}

.chart-canvas-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 108px;
  cursor: crosshair;
}

.chart-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.switch-grid .btn {
  justify-content: space-between;
  padding: 0 11px;
  height: 34px;
}

.wings-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.inline-form {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.inline-form .input {
  flex: 1 1 auto;
  min-width: 0;
}

.user-register-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-search {
  width: 220px;
}

.toolbar-select {
  width: 175px;
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.rcon-output {
  margin: 10px 0 0;
  padding: 11px 13px;
  border-radius: 7px;
  background: var(--bg-terminal);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: #e4e4e7;
  font-size: 11.5px;
  min-height: 58px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.form-footer-end {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

/* ─── Terminal Bezel Chrome & Segmented Controls ─── */
.terminal-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 456px;
}

.vps-terminal-card {
  height: auto;
  min-height: 0;
}

.term-bezel-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 3px;
}

.term-bezel-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  opacity: 0.55;
  transition: opacity 180ms ease, transform 180ms var(--ease-out);
}

.term-bezel-dots span:nth-child(1) {
  background: #ef4444;
}
.term-bezel-dots span:nth-child(2) {
  background: #f59e0b;
}
.term-bezel-dots span:nth-child(3) {
  background: #10b981;
}

.terminal-card:hover .term-bezel-dots span {
  opacity: 0.92;
}

.console-head-tools {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.filter-pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 7px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.pill-btn {
  height: 24px;
  padding: 0 9px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    border-color 140ms var(--ease-out);
}

.pill-btn:hover {
  color: var(--text-primary);
}

.pill-btn.active {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.terminal-viewport {
  flex: 1;
  background: var(--bg-terminal);
  color: #e4e4e7;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.8px;
  line-height: 1.56;
  padding: 12px 14px;
  overflow-y: auto;
  max-height: 398px;
  min-height: 334px;
}

.log-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 5px;
  margin: 0 -5px;
  border-radius: 4px;
  word-break: break-word;
  transition: background-color 100ms ease;
}

.log-line:hover {
  background: rgba(255, 255, 255, 0.035);
}

.log-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  flex-shrink: 0;
}

.log-ts {
  color: #6b7280;
  flex-shrink: 0;
}

.log-lvl {
  flex-shrink: 0;
  font-weight: 600;
  min-width: 44px;
  text-transform: uppercase;
}

.log-lvl.info,
.log-lvl.INFO {
  color: var(--accent-text);
}

.log-lvl.warn,
.log-lvl.WARN {
  color: #fbbf24;
}

.log-lvl.error,
.log-lvl.ERROR {
  color: #f87171;
}

.log-lvl.debug,
.log-lvl.DEBUG {
  color: #a78bfa;
}

.log-lvl.cmd,
.log-lvl.CMD {
  color: #34d399;
}

.log-scope {
  color: #9ca3af;
  flex-shrink: 0;
}

.log-msg {
  color: #f3f4f6;
  min-width: 0;
  flex: 1 1 auto;
}

.terminal-quick-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-terminal-bar);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.terminal-quick-bar::-webkit-scrollbar {
  display: none;
}

.terminal-quick-label {
  font-size: 10.5px;
  color: #7c879c;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.terminal-chip {
  height: 24px;
  padding: 0 8.5px;
  border-radius: 5px;
  border: 1px solid #252d3f;
  background: #131926;
  color: #aeb7ca;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background-color 130ms ease,
    border-color 130ms ease,
    color 130ms ease,
    transform 80ms ease;
}

.terminal-chip:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-border);
  color: var(--text-primary);
}

.terminal-chip:active {
  transform: translateY(1px);
}

.terminal-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-terminal-bar);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.terminal-prompt {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent-text);
  font-weight: 600;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.terminal-prompt-short {
  display: none;
}

.terminal-cmd-input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fafafa;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
}

.terminal-cmd-input::placeholder {
  color: #647087;
}

/* ─── Tables & Key-Value Lists ─── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.2px;
}

.data-table th {
  padding: 9.5px 13px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
  transition: background-color 120ms ease;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

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

.data-table tbody tr.clickable {
  cursor: pointer;
}

.cell-nowrap {
  white-space: nowrap;
}

.cell-desc {
  min-width: 210px;
  color: var(--text-secondary);
}

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

.kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 7.5px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.2px;
}

.kv-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.kv-key {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.kv-val {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ─── Slide-Over Drawer, Confirmation Modal & Command Palette (Ctrl+K) ─── */
.drawer-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: flex-end;
  animation: cpBackdropIn 180ms ease both;
}

.modal-backdrop {
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.drawer-panel {
  width: 100%;
  max-width: 432px;
  height: 100%;
  height: 100dvh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: cpDrawerIn 240ms var(--ease-out) both;
}

.drawer-backdrop.closing .drawer-panel {
  animation: cpDrawerOut 170ms ease-in forwards;
}

.drawer-panel > .panel-head {
  position: sticky;
  top: 0;
  z-index: 5;
}

.drawer-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.drawer-dual-btns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.modal-card {
  width: 100%;
  max-width: 404px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow-modal), var(--rim-highlight);
  animation: cpModalIn 190ms var(--ease-out) both;
}

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

/* ─── Operator Command Palette (Ctrl+K) ─── */
.cmd-palette-backdrop {
  align-items: flex-start;
  padding-top: min(13vh, 110px);
  z-index: 85;
}

.cmd-palette-card {
  width: 100%;
  max-width: 540px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-modal), var(--rim-highlight);
  overflow: hidden;
  animation: cpModalIn 180ms var(--ease-out) both;
}

.cmd-palette-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-head);
}

.cmd-palette-search svg.icon {
  color: var(--accent);
}

.cmd-palette-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
}

.cmd-palette-input::placeholder {
  color: var(--text-muted);
}

.cmd-palette-list {
  max-height: 330px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmd-palette-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8.5px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color 110ms ease, border-color 110ms ease;
}

.cmd-palette-item:hover,
.cmd-palette-item.selected {
  background: var(--bg-elevated);
  border-color: var(--border-default);
}

.cmd-palette-item.selected .cmd-palette-title {
  color: var(--accent);
}

.cmd-palette-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.cmd-palette-title {
  font-weight: 500;
  color: var(--text-primary);
}

.cmd-palette-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.cmd-palette-tag {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.cmd-palette-foot {
  padding: 7px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-head);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  color: var(--text-muted);
}

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(350px, calc(100vw - 32px));
}

.toast {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 12px;
  box-shadow: var(--shadow-modal), var(--rim-highlight);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: cpToastIn 210ms var(--ease-out) both;
}

.toast.leaving {
  animation: cpToastOut 170ms ease-in forwards;
}

.toast.ok {
  border-left: 3px solid var(--status-ok);
}

.toast.warn {
  border-left: 3px solid var(--status-warn);
}

.toast.error {
  border-left: 3px solid var(--status-danger);
}

/* ─── VPS Host Control & Full Interactive PTY Terminal Module ─── */
.vps-xterm-stage {
  position: relative;
  background: #06080c;
}

.vps-pty-status-banner {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(15, 20, 32, 0.92);
  border: 1px solid var(--accent-border);
  color: var(--text-primary);
  font-size: 11px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms var(--ease-out);
}

.vps-pty-status-banner.ready-hidden {
  opacity: 0;
  transform: translateY(-4px);
}

.pty-spinner {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 1.8px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: cpSpin 0.75s linear infinite;
}

.vps-xterm-mount {
  height: 368px;
  background: #06080c;
  padding: 8px 10px 6px 12px;
  overflow: hidden;
  position: relative;
  transition: height 250ms var(--ease-smooth);
}

.vps-terminal-card.tall .vps-xterm-mount {
  height: 620px;
}

.vps-xterm-mount .xterm {
  height: 100%;
  width: 100%;
}

.vps-xterm-mount .xterm-viewport {
  background-color: #06080c !important;
  scrollbar-width: thin;
  scrollbar-color: #2b3346 #06080c;
}

.vps-key-btn {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  letter-spacing: 0.01em;
  min-width: 35px;
  text-align: center;
  background: #161d2c;
  border-color: #2e3850;
  box-shadow: 0 1.5px 0 rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.vps-key-btn:active {
  transform: translateY(1.5px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.65);
}

.vps-disks-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vps-disk-item {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  border-radius: 6px;
  padding: 11px 13px;
  transition: border-color 160ms ease;
}

.vps-disk-item:hover {
  border-color: var(--border-default);
}

.vps-disk-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 12.5px;
}

.vps-disk-mount {
  font-weight: 600;
  color: var(--text-primary);
}

.vps-disk-fs {
  color: var(--text-muted);
  font-size: 11.5px;
  margin-left: 6px;
}

.vps-disk-stats {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 7px;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE TIER 1: Tablet Landscape & Compact Laptop (<= 1179px)
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1179px) {
  .app-shell {
    grid-template-columns: 226px minmax(0, 1fr);
  }

  .breadcrumb-muted,
  .meta-pill-endpoint,
  .cmd-palette-trigger .kbd-hint {
    display: none;
  }

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

  .console-grid {
    grid-template-columns: 1fr;
  }

  .charts-stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .terminal-card {
    min-height: 390px;
  }

  .vps-terminal-card {
    min-height: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE TIER 2: Tablet Portrait & Split-View (< 1024px)
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    transition: none;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 276px;
    max-width: 84vw;
    height: 100vh;
    height: 100dvh;
    z-index: 75;
    transform: translateX(-104%);
    transition: transform 230ms var(--ease-smooth);
    box-shadow: var(--shadow-modal);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .btn.sidebar-close-btn {
    display: inline-flex;
  }

  .btn.mobile-menu-btn {
    display: inline-flex;
  }

  .view-tabs-bar {
    display: flex;
    position: sticky;
    top: 56px;
    z-index: 28;
  }

  .instance-header {
    padding: 8px 16px;
  }

  .content-body {
    padding: 14px 16px calc(28px + env(safe-area-inset-bottom, 0px));
    gap: 14px;
  }

  .metric-value {
    font-size: 17.5px;
  }

  .vps-key-btn {
    height: 28px;
    min-width: 38px;
    font-size: 11px;
  }

  .charts-stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .two-col-grid,
  .charts-stack {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE TIER 3: Mobile Smartphones (< 768px)
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .input,
  .select,
  .textarea,
  .terminal-cmd-input,
  .cmd-palette-input {
    font-size: 16px;
  }

  .input,
  .select {
    height: 38px;
  }

  .instance-header {
    position: sticky;
    top: 0;
    padding: 8px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
  }

  .instance-meta {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .instance-title-group {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
  }

  .instance-name {
    font-size: 13px;
    max-width: 145px;
  }

  .meta-divider,
  #modeBadge {
    display: none;
  }

  .meta-pill-uptime {
    padding: 2px 7px;
    font-size: 10.5px;
  }

  .meta-pill-uptime svg.icon {
    display: none;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .cmd-palette-trigger {
    width: 34px;
    height: 34px;
    padding: 0;
    flex-shrink: 0;
  }

  .cmd-trigger-label {
    display: none;
  }

  .power-group {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .power-group .btn {
    width: 100%;
    height: 30px;
    padding: 0 6px;
    font-size: 11.5px;
  }

  #themeToggleBtn {
    height: 32px;
    padding: 0 9px;
  }

  .cmd-palette-trigger {
    width: 32px;
    height: 32px;
  }

  .view-tabs-bar {
    position: static;
    padding: 6px 12px;
  }

  .content-body {
    padding: 12px 12px calc(24px + env(safe-area-inset-bottom, 0px));
    gap: 12px;
  }

  .metrics-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric-card {
    padding: 10px 11px;
    gap: 6px;
    border-radius: 8px;
  }

  .metric-label-full {
    display: none;
  }

  .metric-label-short {
    display: inline;
  }

  .metric-icon-box {
    width: 20px;
    height: 20px;
  }

  .metric-value-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .metric-value {
    font-size: 14.8px;
  }

  .metric-sub {
    font-size: 10px;
    max-width: 100%;
  }

  .data-table th,
  .data-table td {
    padding: 8.5px 10px;
  }

  .vps-key-btn {
    height: 30px;
    min-width: 38px;
    padding: 0 9px;
    font-size: 11px;
  }

  .panel-head {
    padding: 10px 12px;
    gap: 8px;
  }

  .panel-body {
    padding: 12px;
  }

  .toolbar-row,
  .toolbar-controls {
    width: 100%;
  }

  .toolbar-search,
  .toolbar-select {
    width: 100%;
    flex: 1 1 100%;
  }

  .filter-pills {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filter-pills::-webkit-scrollbar {
    display: none;
  }

  .terminal-card {
    min-height: 0;
  }

  .console-head-tools {
    width: 100%;
    justify-content: space-between;
  }

  .terminal-viewport {
    min-height: 250px;
    max-height: 320px;
    padding: 10px 11px;
    font-size: 11.2px;
  }

  .log-line {
    flex-direction: column;
    gap: 2px;
    padding: 4px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  }

  .log-line:last-child {
    border-bottom: none;
  }

  .terminal-prompt-full {
    display: none;
  }

  .terminal-prompt-short {
    display: inline;
  }

  .inline-form {
    flex-direction: column;
  }

  .inline-form .btn {
    width: 100%;
    height: 36px;
  }

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

  .user-register-form .btn {
    width: 100%;
    height: 36px;
  }

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

  .form-footer-end .btn {
    width: 100%;
    height: 36px;
  }

  .panel-head-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-head-actions .btn {
    width: 100%;
  }

  .kv-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .kv-val {
    text-align: left;
  }

  .drawer-panel {
    max-width: 100%;
    border-left: none;
  }

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

  .drawer-action-row .input {
    grid-column: 1 / -1;
  }

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

  .cmd-palette-backdrop {
    padding: 12px;
    padding-top: 24px;
  }

  .cmd-palette-foot {
    display: none;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    max-width: none;
  }

  .vps-xterm-mount {
    height: 310px;
    padding: 6px 6px 4px 8px;
  }

  .vps-terminal-card.tall .vps-xterm-mount {
    height: 490px;
  }

  .vps-disk-top,
  .vps-disk-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

/* Compact Brand Mark (Mobile) */
@media (max-width: 480px) {
  .cp-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .auth-header .cp-mark {
    width: 42px;
    height: 42px;
    border-radius: 11px;
  }
}

/* Ultra-Small Phones (< 350px) */
@media (max-width: 349px) {
  .metrics-strip,
  .switch-grid {
    grid-template-columns: 1fr;
  }

  #themeModeLabel {
    display: none;
  }
}

/* Accessibility: Reduced Motion */
/* ─── Gelombang 4: Health Check, Statistik Command, Cloud Backup & Anti-Raid ─── */
.command-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 108px;
  padding: 6px 2px 0;
}

.command-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  min-width: 0;
  height: 100%;
}

.command-bar {
  width: 100%;
  border-radius: 6px 6px 2px 2px;
  background: var(--accent, #8b5cf6);
  opacity: 0.85;
  min-height: 3px;
  transition: height 0.25s ease;
}

.command-bar-label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  color: var(--text-muted, #8b8b99);
  line-height: 1;
}

.empty-cell {
  text-align: center;
  color: var(--text-muted, #8b8b99);
  font-size: 12px;
  padding: 14px 6px;
}

.ellipsis {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#doctorList .kv-val,
#moderationSummaryKv .kv-val,
#raidGuardKv .kv-val {
  text-align: right;
  word-break: break-word;
}

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