/* ═══════════════════════════════════════════════════════════════════
   BriumOS — Ultra-Sleek Modern Glassmorphism Stylesheet
   Gold & Blue Accents, Touch-Reactive Micro-Interactions & Depth
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Core Dark Palette */
  --clr-bg:           #07080b;
  --clr-surface:      rgba(15, 17, 23, 0.72);
  --clr-surface-2:    rgba(22, 26, 36, 0.65);
  --clr-surface-3:    rgba(30, 36, 50, 0.75);
  --clr-border:       rgba(255, 255, 255, 0.08);
  --clr-border-hover: rgba(251, 191, 36, 0.3);
  --clr-border-active:rgba(59, 130, 246, 0.5);
  
  --clr-text:         #f8fafc;
  --clr-text-muted:   #94a3b8;
  --clr-text-dim:     #64748b;

  /* Gold & Blue Accents */
  --clr-gold:         #f59e0b;
  --clr-gold-light:   #fbbf24;
  --clr-gold-dim:     rgba(245, 158, 11, 0.15);
  --clr-gold-glow:    rgba(251, 191, 36, 0.35);

  --clr-blue:         #3b82f6;
  --clr-blue-light:   #60a5fa;
  --clr-blue-dim:     rgba(59, 130, 246, 0.15);
  --clr-blue-glow:    rgba(96, 165, 250, 0.35);

  --clr-cyan:         #06b6d4;
  --clr-cyan-dim:     rgba(6, 182, 212, 0.12);
  --clr-green:        #10b981;
  --clr-green-dim:    rgba(16, 185, 129, 0.15);
  --clr-red:          #f43f5e;
  --clr-red-dim:      rgba(244, 63, 94, 0.15);
  --clr-amber:        #fbbf24;
  --clr-amber-dim:    rgba(251, 191, 36, 0.15);

  /* Gradients */
  --grad-gold-blue:       linear-gradient(135deg, #fbbf24 0%, #3b82f6 100%);
  --grad-gold-blue-hover: linear-gradient(135deg, #f59e0b 0%, #2563eb 100%);
  --grad-accent:          linear-gradient(135deg, #fbbf24 0%, #3b82f6 100%);
  --grad-accent-soft:     linear-gradient(135deg, rgba(251, 191, 36, 0.18) 0%, rgba(59, 130, 246, 0.18) 100%);
  --grad-surface:         linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
  --grad-glass-card:      linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%);
  --grad-glass-glow:      linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);

  /* Typography */
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Sizing */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  /* Shadows & Depth */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
  --shadow-lg:  0 16px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.15);
  --shadow-gold-glow: 0 0 30px rgba(245, 158, 11, 0.25);
  --shadow-blue-glow: 0 0 30px rgba(59, 130, 246, 0.25);

  /* Micro-Interaction Transitions */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-touch: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-out), border-color 0.25s var(--ease-out), background 0.25s var(--ease-out);
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  background-color: var(--clr-bg);
}

body {
  font-family: var(--font-sans);
  color: var(--clr-text);
  background: var(--clr-bg);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

::selection {
  background: rgba(251, 191, 36, 0.25);
  color: var(--clr-gold-light);
}

a {
  color: var(--clr-gold-light);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}
a:hover { color: var(--clr-blue-light); }

/* ─── Background Video & Glass Overlays ───────────────────────── */
.bg-shader-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  overflow: hidden;
}

.bg-video {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  pointer-events: none;
  opacity: 0.25;
  filter: contrast(1.1) saturate(1.2);
}

.bg-video-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at 50% 20%, rgba(15, 17, 23, 0.4) 0%, rgba(7, 8, 11, 0.92) 80%);
  pointer-events: none;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 0%, rgba(0,0,0,0.2) 80%);
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  animation: glowFloat 18s ease-in-out infinite;
}

.bg-glow--1 {
  width: 650px; height: 650px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.16) 0%, transparent 70%);
  top: -220px; left: -120px;
  animation-delay: 0s;
}
.bg-glow--2 {
  width: 580px; height: 580px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.16) 0%, transparent 70%);
  bottom: -180px; right: -120px;
  animation-delay: -6s;
}
.bg-glow--3 {
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.1) 0%, rgba(59, 130, 246, 0.08) 50%, transparent 75%);
  top: 45%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -12s;
}

@keyframes glowFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(35px, -25px) scale(1.05); }
  66% { transform: translate(-25px, 35px) scale(0.95); }
}

/* ─── Header ────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 12, 18, 0.75);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  overflow: visible;
}

.header__inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0.85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__brand {
  display: flex;
  align-items: center;
  position: relative;
  height: 32px;
}

.header__title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: var(--grad-gold-blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.2));
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header__logo {
  height: 67px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.25));
  position: absolute;
  top: -8px;
  left: 0;
  z-index: 101;
  cursor: pointer;
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.35s ease;
  will-change: transform, filter;
}

.header__logo:hover,
.header__logo:active {
  transform: translateY(-6px) rotateX(12deg) rotateY(-10deg) scale(1.08);
  filter: drop-shadow(0 12px 20px rgba(245, 158, 11, 0.45)) drop-shadow(0 0 25px rgba(59, 130, 246, 0.35));
}

.header__byline {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: var(--clr-text-dim);
  background-clip: unset;
  font-family: var(--font-mono);
  opacity: 0.85;
}

.header__status {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
}

/* Health dot */
.health-dot {
  position: relative;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--clr-text-dim);
  transition: background 0.4s var(--ease-out);
}
.health-dot--ok { background: var(--clr-green); box-shadow: 0 0 10px var(--clr-green); }
.health-dot--error { background: var(--clr-red); box-shadow: 0 0 10px var(--clr-red); }
.health-dot--unknown { background: var(--clr-gold); box-shadow: 0 0 10px var(--clr-gold); }

.health-dot__ping {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  color: inherit;
  opacity: 0;
  animation: healthPing 2.2s ease-out infinite;
}

.health-dot--ok .health-dot__ping { color: var(--clr-green); }
.health-dot--error .health-dot__ping { color: var(--clr-red); }

@keyframes healthPing {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(2.4); opacity: 0; }
}

.health-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  font-family: var(--font-mono);
}

/* ─── Main Layout ───────────────────────────────────────────────── */
.main {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ─── Glassmorphism Card Component ─────────────────────────────── */
.card {
  background: var(--clr-surface);
  backdrop-filter: blur(20px) saturate(1.7);
  -webkit-backdrop-filter: blur(20px) saturate(1.7);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition-touch);
  position: relative;
}

/* Glass specular top highlight */
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 30%, rgba(251, 191, 36, 0.25) 50%, rgba(59, 130, 246, 0.25) 70%, transparent 100%);
  pointer-events: none;
  opacity: 0.8;
  transition: opacity 0.3s var(--ease-out);
}

/* Touch & Hover Glass Micro-Interaction (Moves & Glows) */
.card:hover,
.card:focus-within {
  transform: translateY(-3px) scale(1.004);
  border-color: rgba(251, 191, 36, 0.35);
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.2),
    0 12px 36px -8px rgba(0, 0, 0, 0.6),
    0 0 25px -4px rgba(245, 158, 11, 0.18),
    0 0 35px -8px rgba(59, 130, 246, 0.22);
}

.card:active {
  transform: translateY(-1px) scale(0.998);
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.25),
    0 8px 24px -4px rgba(0, 0, 0, 0.7),
    0 0 20px rgba(251, 191, 36, 0.2);
}

.card__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
}

.card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--grad-accent-soft);
  color: var(--clr-gold-light);
  border: 1px solid rgba(251, 191, 36, 0.25);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
  flex-shrink: 0;
  transition: transform 0.3s var(--ease-spring), color 0.3s;
}

.card:hover .card__icon {
  transform: scale(1.1) rotate(2deg);
  color: #ffffff;
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
}

.card__icon--error {
  background: var(--clr-red-dim);
  color: var(--clr-red);
  border-color: rgba(244, 63, 94, 0.3);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.2);
}

.card__title {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--clr-text);
  flex: 1;
}

.card__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.card__body {
  padding: 1.4rem;
}

/* ─── Buttons & Touch Interactions ────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-touch);
  white-space: nowrap;
  line-height: 1;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Primary Button (Gold-to-Blue Dual Gradient) */
.btn--primary {
  background: var(--grad-gold-blue);
  color: #080a10;
  font-weight: 700;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25), 0 0 20px rgba(59, 130, 246, 0.25);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn--primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
}

.btn--primary:hover {
  background: var(--grad-gold-blue-hover);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.35), 0 0 30px rgba(59, 130, 246, 0.4);
}

.btn--primary:hover::after {
  opacity: 1;
}

.btn--primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.2);
}

.btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: grayscale(0.5);
}

/* Outline Button (Frosted Glass) */
.btn--outline {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  color: var(--clr-text);
  border-color: rgba(255, 255, 255, 0.12);
}

.btn--outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--clr-gold-light);
  color: var(--clr-gold-light);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2);
}

.btn--outline:active {
  transform: translateY(0) scale(0.98);
}

/* Ghost Button */
.btn--ghost {
  background: transparent;
  color: var(--clr-text-muted);
  border: 1px solid transparent;
  padding: 0.45rem 0.8rem;
}

.btn--ghost:hover {
  color: var(--clr-gold-light);
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
}

.btn--sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn--danger {
  color: var(--clr-text-muted);
}
.btn--danger:hover {
  color: var(--clr-red);
  border-color: rgba(244, 63, 94, 0.4);
  background: var(--clr-red-dim);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.25);
}

/* Icon Buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--clr-text-muted);
  cursor: pointer;
  transition: var(--transition-touch);
}

.btn-icon:hover {
  color: var(--clr-gold-light);
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.btn-icon:active {
  transform: scale(0.95);
}

.btn-icon--sm {
  width: 30px; height: 30px;
  border: none;
}

/* ─── Form Elements ─────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.form-label--sm { font-size: 0.74rem; }

.form-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--clr-text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: var(--transition-touch);
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Touch hit-area expansion for mobile taps */
.form-hint::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}

/* Subtle, non-eyesore hover/focus state */
.form-hint:hover,
.form-hint:focus {
  color: var(--clr-gold-light);
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}

/* Active state when explicitly CLICKED or TAPPED */
.form-hint.active {
  color: #ffffff;
  background: rgba(251, 191, 36, 0.25);
  border-color: var(--clr-gold);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

/* Custom Tooltip Bubble (ONLY displayed when explicitly clicked via .active) */
.form-hint[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: min(250px, 75vw);
  padding: 0.55rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  color: #f8fafc;
  background: rgba(12, 14, 20, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 16px rgba(245, 158, 11, 0.2);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), visibility 0.2s;
  z-index: 1000;
  white-space: normal;
  text-align: left;
}

/* Show Tooltip ONLY when CLICKED (.active) */
.form-hint[data-tooltip].active::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* On rightmost columns, shift tooltip slightly left so it never overflows card boundary */
.form-group:last-child .form-hint[data-tooltip]::after {
  left: auto;
  right: -8px;
  transform: translateY(4px);
}
.form-group:last-child .form-hint[data-tooltip].active::after {
  transform: translateY(0);
}

.form-input {
  width: 100%;
  padding: 0.62rem 0.88rem;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  color: var(--clr-text);
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition-touch);
  backdrop-filter: blur(8px);
}

.form-input:hover {
  border-color: rgba(251, 191, 36, 0.35);
  background: var(--clr-surface-3);
}

.form-input:focus {
  border-color: var(--clr-gold-light);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2), 0 0 15px rgba(59, 130, 246, 0.25);
  background: rgba(25, 30, 42, 0.85);
  transform: translateY(-1px);
}

.form-input::placeholder {
  color: var(--clr-text-dim);
}

.form-input--sm {
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  width: 76px;
  text-align: center;
}

.form-textarea {
  width: 100%;
  padding: 0.85rem 1.1rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--clr-text);
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  transition: var(--transition-touch);
  line-height: 1.5;
}

.form-textarea:focus {
  border-color: var(--clr-blue-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25), 0 0 15px rgba(251, 191, 36, 0.2);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .form-input {
  padding-right: 44px;
}

.input-with-icon .btn-icon {
  position: absolute;
  right: 5px;
  border: none;
  width: 32px; height: 32px;
  background: transparent;
}

/* Checkbox Styling */
.form-group--checkbox {
  flex-direction: row;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.84rem;
  color: var(--clr-text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.checkbox-custom {
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: var(--clr-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-touch);
  flex-shrink: 0;
}

.checkbox-label:hover .checkbox-custom {
  border-color: var(--clr-gold-light);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.25);
}

.checkbox-label input:checked + .checkbox-custom {
  background: var(--grad-gold-blue);
  border-color: transparent;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

.checkbox-label input:checked + .checkbox-custom::after {
  content: '';
  width: 5px; height: 10px;
  border: solid #080a10;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* ─── Tab Bar (Glass Segmented Control) ────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  background: rgba(15, 18, 26, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(12px);
}

.tab {
  flex: 1;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--clr-text-dim);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-touch);
}

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

.tab--active {
  background: var(--grad-gold-blue);
  color: #080a10;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25), 0 0 15px rgba(59, 130, 246, 0.2);
}

.tab-panel { display: none; }
.tab-panel--active { display: block; }

/* ─── Matrix Grid ───────────────────────────────────────────────── */
.matrix-controls {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.matrix-dim {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.matrix-dim__sep {
  color: var(--clr-gold-light);
  font-size: 1.1rem;
  font-weight: 700;
  padding-bottom: 0.35rem;
}

.matrix-grid-wrapper {
  overflow-x: auto;
  padding: 0.5rem 0.2rem 0.8rem;
}

.matrix-grid {
  display: inline-grid;
  gap: 6px;
  min-width: min-content;
}

.matrix-grid input {
  width: 68px;
  padding: 0.5rem 0.6rem;
  font-size: 0.86rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--clr-text);
  background: rgba(20, 24, 34, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  text-align: center;
  outline: none;
  transition: var(--transition-touch);
  backdrop-filter: blur(8px);
}

.matrix-grid input:hover {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(28, 34, 48, 0.85);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 10px rgba(251, 191, 36, 0.2);
}

.matrix-grid input:focus {
  border-color: var(--clr-gold-light);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.4), 0 0 16px rgba(59, 130, 246, 0.35);
  background: rgba(32, 40, 58, 0.95);
  transform: translateY(-2px) scale(1.06);
  z-index: 10;
}

/* ─── Solver Parameters Grid ───────────────────────────────────── */
.params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1.25rem;
  align-items: end;
}

/* ─── Actions Section & State Badge ────────────────────────────── */
.card--actions {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
}

.card--actions::before { display: none; }

.card--actions:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

.actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
}

.actions-bar__right {
  display: flex;
  gap: 0.75rem;
}

/* State badge */
.state-badge {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  transition: var(--transition-touch);
}

.state-badge__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.state-badge--idle {
  background: rgba(255, 255, 255, 0.03);
  color: var(--clr-text-dim);
}
.state-badge--idle .state-badge__dot { background: var(--clr-text-dim); }

.state-badge--validating {
  background: rgba(251, 191, 36, 0.15);
  color: var(--clr-gold-light);
  border-color: rgba(251, 191, 36, 0.3);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
}
.state-badge--validating .state-badge__dot {
  background: var(--clr-gold-light);
  animation: pulse 1s ease-in-out infinite;
}

.state-badge--computing {
  background: rgba(59, 130, 246, 0.15);
  color: var(--clr-blue-light);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.25);
}
.state-badge--computing .state-badge__dot {
  background: var(--clr-blue-light);
  animation: pulse 0.8s ease-in-out infinite;
}

.state-badge--done {
  background: rgba(16, 185, 129, 0.15);
  color: var(--clr-green);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}
.state-badge--done .state-badge__dot { background: var(--clr-green); }

.state-badge--error {
  background: rgba(244, 63, 94, 0.15);
  color: var(--clr-red);
  border-color: rgba(244, 63, 94, 0.3);
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.2);
}
.state-badge--error .state-badge__dot { background: var(--clr-red); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

/* ─── Metrics Row ───────────────────────────────────────────────── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.95rem;
  background: rgba(20, 25, 36, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  transition: var(--transition-touch);
  backdrop-filter: blur(10px);
}

.metric-card:hover {
  border-color: rgba(251, 191, 36, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(59, 130, 246, 0.15);
}

.metric-card__label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--clr-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-card__value {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--clr-gold-light);
  letter-spacing: -0.02em;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

/* ─── Basin Chart Canvas & Container ───────────────────────────── */
.basin-chart-container {
  margin-bottom: 1.75rem;
}

.basin-chart__title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--clr-text-muted);
  margin-bottom: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#basin-chart {
  width: 100%;
  height: auto;
  max-height: 320px;
  border-radius: var(--radius-md);
  background: rgba(12, 15, 22, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

/* ─── Basin Table ───────────────────────────────────────────────── */
.basin-table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.basin-table th,
.basin-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.basin-table th {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--clr-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(18, 22, 32, 0.8);
}

.basin-table td {
  font-family: var(--font-mono);
  color: var(--clr-text-muted);
}

.basin-table tr:hover td {
  background: rgba(251, 191, 36, 0.04);
}

.basin-bar-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.basin-bar {
  height: 9px;
  border-radius: 999px;
  background: var(--grad-gold-blue);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
  transition: width 0.7s var(--ease-out);
  min-width: 3px;
}

.basin-bar-pct {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--clr-gold-light);
  white-space: nowrap;
}

/* ─── Validation Section ────────────────────────────────────────── */
.validation-result {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.validation-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 0.95rem;
}
.validation-status--valid { color: var(--clr-green); text-shadow: 0 0 10px rgba(16, 185, 129, 0.3); }
.validation-status--invalid { color: var(--clr-red); text-shadow: 0 0 10px rgba(244, 63, 94, 0.3); }

.validation-meta {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.validation-meta__item {
  font-size: 0.8rem;
  color: var(--clr-text-dim);
  font-family: var(--font-mono);
}
.validation-meta__item strong {
  color: var(--clr-gold-light);
}

.validation-issues {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.validation-issues li {
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  color: var(--clr-red);
  background: var(--clr-red-dim);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--clr-red);
}

/* ─── Error Section ─────────────────────────────────────────────── */
.card--error {
  border-color: rgba(244, 63, 94, 0.4);
  box-shadow: 0 0 25px rgba(244, 63, 94, 0.15);
}

.error-message {
  font-size: 0.88rem;
  color: var(--clr-red);
  font-weight: 600;
}

.error-details {
  margin-top: 0.85rem;
  padding: 0.85rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--clr-text-dim);
  background: rgba(12, 14, 20, 0.85);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

/* ─── Activity Log Section ─────────────────────────────────────── */
.log-entries {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  padding-right: 4px;
}

.log-entry {
  display: flex;
  gap: 0.85rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  animation: logSlide 0.35s var(--ease-out);
}

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

.log-entry:hover { background: rgba(255, 255, 255, 0.03); }

.log-entry__time {
  color: var(--clr-text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.log-entry__msg {
  color: var(--clr-text-muted);
  word-break: break-word;
}

.log-entry--info .log-entry__msg { color: var(--clr-text-muted); }
.log-entry--success .log-entry__msg { color: var(--clr-green); }
.log-entry--warn .log-entry__msg { color: var(--clr-gold-light); }
.log-entry--error .log-entry__msg { color: var(--clr-red); }

/* Request ID tag */
.request-id-tag {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--clr-gold-light);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  user-select: all;
}

/* ─── Footer ────────────────────────────────────────────────────── */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.5rem 1rem;
  font-size: 0.78rem;
  color: var(--clr-text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.footer__logo {
  height: 54px;
  width: auto;
  display: block;
  object-fit: contain;
  opacity: 0.55;
  filter: grayscale(0.3) drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  cursor: pointer;
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease, filter 0.35s ease;
  will-change: transform, filter, opacity;
}

.footer__logo:hover,
.footer__logo:active {
  opacity: 0.95;
  filter: grayscale(0) drop-shadow(0 6px 14px rgba(245, 158, 11, 0.4));
  transform: translateY(-4px) rotateX(10deg) rotateY(8deg) scale(1.15);
}

.footer__sep { color: var(--clr-gold); opacity: 0.5; }

/* ─── Loading Spinner ──────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(8, 10, 16, 0.3);
  border-top-color: #080a10;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ─── Card Entrance Stagger Animations ────────────────────────── */
.card {
  animation: cardReveal 0.6s var(--ease-out) both;
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card--config   { animation-delay: 0.05s; }
.card--matrix   { animation-delay: 0.10s; }
.card--params   { animation-delay: 0.15s; }
.card--actions  { animation-delay: 0.20s; }
.card--log      { animation-delay: 0.25s; }

/* ─── Responsive Adjustments ───────────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 14.5px; }

  .main { padding: 1.5rem 1rem; gap: 1.25rem; }
  .header__inner { padding: 0.75rem 1rem; }

  /* iOS input auto-zoom prevention */
  .form-input, .form-textarea {
    font-size: 16px !important;
  }

  .params-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
  }

  .metrics-row {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
  }
}

@media (max-width: 640px) {
  html { font-size: 14px; }

  .main { padding: 1.25rem 0.85rem; gap: 1.15rem; }

  .card__header { padding: 0.9rem 1.1rem; }
  .card__body { padding: 1.1rem; }

  .header__inner {
    padding: 0.7rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header__title {
    font-size: 1.2rem;
  }

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

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

  .actions-bar {
    flex-direction: column;
    gap: 0.85rem;
    align-items: stretch;
  }
  .actions-bar__right {
    justify-content: stretch;
    width: 100%;
  }
  .actions-bar__right .btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }

  .matrix-controls {
    gap: 0.5rem;
  }

  .matrix-grid input {
    width: 56px;
    height: 42px;
    font-size: 0.88rem;
  }

  .matrix-grid-wrapper {
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .params-grid {
    grid-template-columns: 1fr;
  }

  .metrics-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .header__logo {
    height: 52px;
    top: -4px;
  }

  .header__brand {
    height: 28px;
  }

  .header__status {
    margin-left: auto;
    padding: 0.25rem 0.65rem;
    font-size: 0.7rem;
  }
}

/* ─── Custom Glass Scrollbars ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(251, 191, 36, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(251, 191, 36, 0.4);
}
