/* ============================================================================
   Homeserver Wake-on-LAN Dashboard
   Cybernetic Infrastructure Console Design System (100% Self-Contained CSS)
   GPU-composited animations only (transform & opacity) — zero layout thrash
   ============================================================================ */

:root {
  --surface: #0f131c;
  --surface-container: #1c2028;
  --surface-container-high: #262a33;
  --surface-container-highest: #31353e;
  --on-surface: #dfe2ee;
  --on-surface-variant: #9ba6b5;

  --primary-container: #00f0ff;
  --secondary: #4edea3;
  --error: #ff6b6b;
  --warning: #fbbf24;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --ease-out-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --boot-pulse-duration: 1.6s;
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
  opacity: 1;
}

body.is-preload *,
body.is-preload *::before,
body.is-preload *::after {
  transition: none !important;
  animation: none !important;
}

::selection {
  background-color: var(--primary-container);
  color: var(--surface);
}

/* ----------------------------------------------------------------------------
   Ambient Radial Glow Backdrop
   Replaces heavy blur(130px) with smooth multi-stop radial gradients that
   cross-fade purely via GPU opacity — eliminates 8-bit color banding & lag.
   ---------------------------------------------------------------------------- */
.ambient-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.ambient-layer {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(760px, 140vw);
  height: min(760px, 140vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 900ms var(--ease-out-smooth);
  will-change: opacity;
}

.ambient-offline {
  background: radial-gradient(
    circle,
    rgba(255, 107, 107, 0.14) 0%,
    rgba(255, 107, 107, 0.065) 28%,
    rgba(255, 107, 107, 0.02) 54%,
    rgba(255, 107, 107, 0) 74%
  );
}

.ambient-booting {
  background: radial-gradient(
    circle,
    rgba(0, 240, 255, 0.18) 0%,
    rgba(0, 240, 255, 0.085) 28%,
    rgba(0, 240, 255, 0.025) 54%,
    rgba(0, 240, 255, 0) 74%
  );
}

.ambient-online {
  background: radial-gradient(
    circle,
    rgba(78, 222, 163, 0.17) 0%,
    rgba(78, 222, 163, 0.075) 28%,
    rgba(78, 222, 163, 0.02) 54%,
    rgba(78, 222, 163, 0) 74%
  );
}

.ambient-timeout {
  background: radial-gradient(
    circle,
    rgba(251, 191, 36, 0.17) 0%,
    rgba(251, 191, 36, 0.075) 28%,
    rgba(251, 191, 36, 0.02) 54%,
    rgba(251, 191, 36, 0) 74%
  );
}

body[data-state="OFFLINE"] .ambient-offline,
body[data-state="LOCKED"] .ambient-offline,
body[data-state="BOOTING"] .ambient-booting,
body[data-state="ONLINE"] .ambient-online,
body[data-state="TIMEOUT"] .ambient-timeout,
body[data-state="MAINTENANCE"] .ambient-timeout {
  opacity: 1;
}

/* ----------------------------------------------------------------------------
   Main Container & Typography
   ---------------------------------------------------------------------------- */
.shell {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.header {
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.title {
  margin: 0;
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--on-surface);
}

.subtitle {
  margin: 0;
  min-height: 2.75rem;
  font-size: 0.875rem;
  line-height: 1.35rem;
  color: var(--on-surface-variant);
  transition: opacity 260ms ease;
}

.subtitle.is-updating {
  opacity: 0;
}

@media (min-width: 640px) {
  .header {
    margin-bottom: 3rem;
  }
  .title {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
  .subtitle {
    min-height: 1.5rem;
    font-size: 1rem;
    line-height: 1.5rem;
  }
}

/* ----------------------------------------------------------------------------
   Central Power Button & Animated Rings
   ---------------------------------------------------------------------------- */
.button-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2.5rem;
}

/* Smooth dual-staggered sonar pulse rings (fades wrapper in/out gracefully) */
.pulse-wrapper {
  position: absolute;
  width: 13.25rem;
  height: 13.25rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 500ms var(--ease-out-smooth);
}

body[data-state="BOOTING"] .pulse-wrapper {
  opacity: 1;
}

.pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 240, 255, 0.5);
  background: radial-gradient(circle, rgba(0, 240, 255, 0.14) 0%, rgba(0, 240, 255, 0) 70%);
  opacity: 0;
  transform: scale(0.92);
  will-change: transform, opacity;
}

body[data-state="BOOTING"] .pulse-ring-a {
  animation: sonarPulse calc(var(--boot-pulse-duration) * 2) cubic-bezier(0.2, 0.6, 0.35, 1) infinite;
}

body[data-state="BOOTING"] .pulse-ring-b {
  animation: sonarPulse calc(var(--boot-pulse-duration) * 2) cubic-bezier(0.2, 0.6, 0.35, 1)
    calc(var(--boot-pulse-duration) * -1) infinite;
}

@keyframes sonarPulse {
  0% {
    transform: scale(0.92);
    opacity: 0;
  }
  12% {
    opacity: 0.45;
  }
  100% {
    transform: scale(1.48);
    opacity: 0;
  }
}

/* One-shot tactile click ripple */
.click-ripple {
  position: absolute;
  width: 12.25rem;
  height: 12.25rem;
  border-radius: 50%;
  border: 2px solid rgba(0, 240, 255, 0.65);
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.click-ripple.is-firing {
  animation: clickImpulse 650ms var(--ease-out-smooth) forwards;
}

@keyframes clickImpulse {
  0% {
    transform: scale(0.96);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.38);
    opacity: 0;
  }
}

/* Outer border halo — fixed geometry, no will-change layer artifacts in Firefox */
.button-halo {
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px solid rgba(255, 107, 107, 0.22);
  pointer-events: none;
  opacity: 0.9;
  transition:
    border-color 500ms var(--ease-out-smooth),
    opacity 500ms var(--ease-out-smooth);
}

body[data-state="BOOTING"] .button-halo {
  border-color: rgba(0, 240, 255, 0.38);
  animation: haloBreath var(--boot-pulse-duration) ease-in-out infinite;
}

body[data-state="ONLINE"] .button-halo {
  border-color: rgba(78, 222, 163, 0.28);
}

body[data-state="TIMEOUT"] .button-halo,
body[data-state="MAINTENANCE"] .button-halo {
  border-color: rgba(251, 191, 36, 0.32);
}

@keyframes haloBreath {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  22% {
    transform: scale(1.045);
    opacity: 1;
  }
}

/* Soft circular luminescence behind button using blur() instead of radial-gradient
   (avoids Firefox WebRender radial-gradient quadrant seam lines on hover) */
.button-glow {
  position: absolute;
  width: 11.5rem;
  height: 11.5rem;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(28px);
  opacity: 0.3;
  transition: opacity 300ms var(--ease-out-smooth);
}

body[data-state="OFFLINE"] .button-glow,
body[data-state="LOCKED"] .button-glow {
  background-color: rgba(255, 107, 107, 0.35);
  opacity: 0.22;
}

body[data-state="LOCKED"] .button-glow {
  opacity: 0.34;
}

body[data-state="OFFLINE"] .button-stage:has(.power-button:hover) .button-glow {
  opacity: 0.65;
}

body[data-state="BOOTING"] .button-glow {
  background-color: rgba(0, 240, 255, 0.42);
  animation: glowBreath var(--boot-pulse-duration) ease-in-out infinite;
}

@keyframes glowBreath {
  0%,
  100% {
    opacity: 0.45;
  }
  22% {
    opacity: 0.88;
  }
}

body[data-state="ONLINE"] .button-glow {
  background-color: rgba(78, 222, 163, 0.38);
  opacity: 0.65;
}

body[data-state="TIMEOUT"] .button-glow,
body[data-state="MAINTENANCE"] .button-glow {
  background-color: rgba(251, 191, 36, 0.4);
  opacity: 0.55;
}

body[data-state="TIMEOUT"] .button-stage:has(.power-button:hover) .button-glow {
  opacity: 0.88;
}

/* Main circular Power Button — zero transform on hover so SVG never pixel-snaps */
.power-button {
  position: relative;
  width: 12rem;
  height: 12rem;
  padding: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--surface-container-high) 0%, var(--surface-container) 100%);
  border: 2px solid rgba(255, 107, 107, 0.32);
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 280ms var(--ease-out-smooth),
    background-color 280ms var(--ease-out-smooth);
}

/* Soft internal inset luminescence (no radial-gradient) */
.button-inner-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms var(--ease-out-smooth);
}

body[data-state="OFFLINE"] .button-inner-glow {
  box-shadow: inset 0 0 28px rgba(255, 107, 107, 0.22);
  opacity: 0.35;
}

body[data-state="OFFLINE"] .power-button:hover .button-inner-glow {
  opacity: 1;
}

body[data-state="BOOTING"] .button-inner-glow {
  box-shadow: inset 0 0 32px rgba(0, 240, 255, 0.24);
  opacity: 1;
}

body[data-state="ONLINE"] .button-inner-glow {
  box-shadow: inset 0 0 32px rgba(78, 222, 163, 0.22);
  opacity: 1;
}

body[data-state="TIMEOUT"] .button-inner-glow,
body[data-state="MAINTENANCE"] .button-inner-glow {
  box-shadow: inset 0 0 32px rgba(251, 191, 36, 0.26);
  opacity: 0.7;
}

body[data-state="LOCKED"] .button-inner-glow {
  box-shadow: inset 0 0 28px rgba(255, 107, 107, 0.24);
  opacity: 0.55;
}

body[data-state="TIMEOUT"] .power-button:hover .button-inner-glow {
  opacity: 1;
}

@media (min-width: 640px) {
  .power-button {
    width: 13rem;
    height: 13rem;
  }
  .button-glow {
    width: 12.5rem;
    height: 12.5rem;
  }
  .pulse-wrapper {
    width: 14.25rem;
    height: 14.25rem;
  }
  .click-ripple {
    width: 13.25rem;
    height: 13.25rem;
  }
}

/* Tactile press only on click; hover uses smooth glow & border transitions without
   moving or scaling the SVG so Firefox never pixel-snaps or tears edges. */
body[data-state="OFFLINE"] .power-button:active,
body[data-state="TIMEOUT"] .power-button:active {
  transform: translateY(1px);
}

body[data-state="OFFLINE"] .power-button:hover {
  border-color: rgba(255, 107, 107, 0.58);
}

.power-button:focus-visible {
  outline: 3px solid rgba(0, 240, 255, 0.45);
  outline-offset: 4px;
}

body[data-state="BOOTING"] .power-button {
  border-color: rgba(0, 240, 255, 0.55);
  cursor: wait;
}

body[data-state="ONLINE"] .power-button {
  border-color: rgba(78, 222, 163, 0.48);
  cursor: default;
}

body[data-state="TIMEOUT"] .power-button,
body[data-state="MAINTENANCE"] .power-button {
  border-color: rgba(251, 191, 36, 0.58);
}

body[data-state="LOCKED"] .power-button,
body[data-state="MAINTENANCE"] .power-button {
  cursor: not-allowed;
}

body[data-state="TIMEOUT"] .power-button:hover {
  border-color: rgba(251, 191, 36, 0.85);
}

body[data-state="TIMEOUT"] .power-button:focus-visible {
  outline: 3px solid rgba(251, 191, 36, 0.45);
  outline-offset: 4px;
}

/* ----------------------------------------------------------------------------
   Stacked SVG Icon Stage (crisp vectors, no filter clipping, no double scale)
   ---------------------------------------------------------------------------- */
.icon-stage {
  position: relative;
  z-index: 1;
  width: 4.85rem;
  height: 4.85rem;
  display: block;
}

@media (min-width: 640px) {
  .icon-stage {
    width: 5.35rem;
    height: 5.35rem;
  }
}

.icon-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.84);
  transition:
    opacity 320ms var(--ease-out-smooth),
    transform 360ms var(--ease-out-smooth);
  pointer-events: none;
}

.icon-svg {
  width: 100%;
  height: 100%;
  display: block;
  shape-rendering: geometricPrecision;
}

.icon-offline,
.icon-locked {
  color: var(--error);
}

.icon-booting {
  color: var(--primary-container);
}

.icon-online {
  color: var(--secondary);
}

.icon-timeout,
.icon-maintenance {
  color: var(--warning);
}

/* Show active icon layer */
body[data-state="OFFLINE"] .icon-offline,
body[data-state="BOOTING"] .icon-booting,
body[data-state="ONLINE"] .icon-online,
body[data-state="TIMEOUT"] .icon-timeout,
body[data-state="LOCKED"] .icon-locked,
body[data-state="MAINTENANCE"] .icon-maintenance {
  opacity: 1;
  transform: scale(1);
}

/* Strictly counter-clockwise 360->0 spin on dedicated inner SVG (0px wobble!) */
.icon-spin-ccw {
  transform-origin: 50% 50%;
  will-change: transform;
  animation: spinCounterClockwise 1.25s linear infinite;
  animation-play-state: paused;
}

body[data-state="BOOTING"] .icon-spin-ccw {
  animation-play-state: running;
}

@keyframes spinCounterClockwise {
  0% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* Checkmark smooth stroke draw-in when transitioning to ONLINE */
.check-mark {
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  transition: stroke-dashoffset 420ms var(--ease-out-smooth) 120ms;
}

body[data-state="ONLINE"] .check-mark {
  stroke-dashoffset: 0;
}

/* ----------------------------------------------------------------------------
   Status Pill Badge & Fixed Concentric LED Indicator
   ---------------------------------------------------------------------------- */
.status-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1.25rem;
  border-radius: 9999px;
  background-color: rgba(38, 42, 51, 0.9);
  border: 1px solid rgba(255, 107, 107, 0.22);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 450ms var(--ease-out-smooth);
}

body[data-state="BOOTING"] .status-badge {
  border-color: rgba(0, 240, 255, 0.34);
}

body[data-state="ONLINE"] .status-badge {
  border-color: rgba(78, 222, 163, 0.34);
}

body[data-state="TIMEOUT"] .status-badge,
body[data-state="MAINTENANCE"] .status-badge {
  border-color: rgba(251, 191, 36, 0.34);
}

/* Fixed core LED dot + separate ping ring so the core NEVER vanishes */
.status-dot-wrap {
  position: relative;
  width: 0.625rem;
  height: 0.625rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status-dot-core {
  position: relative;
  z-index: 2;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background-color: var(--error);
  transition: background-color 400ms ease, box-shadow 400ms ease;
}

.status-dot-ping {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  background-color: var(--primary-container);
  opacity: 0;
  transform: scale(1);
  pointer-events: none;
  will-change: transform, opacity;
}

body[data-state="BOOTING"] .status-dot-core {
  background-color: var(--primary-container);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.65);
}

body[data-state="BOOTING"] .status-dot-ping {
  background-color: var(--primary-container);
  animation: dotPing var(--boot-pulse-duration) cubic-bezier(0.2, 0.6, 0.35, 1) infinite;
}

body[data-state="ONLINE"] .status-dot-core {
  background-color: var(--secondary);
  box-shadow: 0 0 8px rgba(78, 222, 163, 0.6);
}

body[data-state="ONLINE"] .status-dot-ping {
  background-color: var(--secondary);
  animation: dotGlowSoft 2.8s ease-in-out infinite;
}

body[data-state="TIMEOUT"] .status-dot-core,
body[data-state="MAINTENANCE"] .status-dot-core {
  background-color: var(--warning);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.55);
}

@keyframes dotPing {
  0% {
    transform: scale(1);
    opacity: 0;
  }
  18% {
    opacity: 0.8;
  }
  85%,
  100% {
    transform: scale(2.55);
    opacity: 0;
  }
}

@keyframes dotGlowSoft {
  0%,
  100% {
    transform: scale(1.1);
    opacity: 0.32;
  }
  50% {
    transform: scale(1.85);
    opacity: 0;
  }
}

.status-text {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--on-surface);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 640px) {
  .status-text {
    font-size: 1rem;
    line-height: 1.375rem;
  }
}

.connection-notice {
  margin: 0;
  font-size: 0.75rem;
  color: var(--on-surface-variant);
  opacity: 0.85;
}

/* ----------------------------------------------------------------------------
   Optional Demo Controls (hidden unless DEMO_MODE=true)
   ---------------------------------------------------------------------------- */
.demo-bar {
  margin-top: 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.45;
  transition: opacity 250ms ease;
}

.demo-bar[hidden] {
  display: none;
}

.demo-bar:hover,
.demo-bar:focus-within {
  opacity: 1;
}

.demo-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}

.demo-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  line-height: 1rem;
  padding: 0.25rem 0.625rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background-color: var(--surface-container-high);
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.demo-btn:hover {
  background-color: var(--surface-container-highest);
  color: var(--on-surface);
  border-color: rgba(255, 255, 255, 0.14);
}

.demo-btn:focus-visible {
  outline: 2px solid var(--primary-container);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------------------
   Accessibility: Respect prefers-reduced-motion
   ---------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .pulse-ring,
  .button-halo,
  .button-glow,
  .status-dot-ping,
  .click-ripple,
  .icon-spin-ccw {
    animation: none !important;
  }

  .ambient-layer,
  .power-button,
  .icon-layer,
  .check-mark,
  .status-badge,
  .subtitle {
    transition-duration: 0.01ms !important;
  }

  body[data-state="BOOTING"] .pulse-wrapper {
    opacity: 0;
  }
}

/* ----------------------------------------------------------------------------
   Local-Network Admin Toolbar & Modals
   ---------------------------------------------------------------------------- */
.admin-toolbar {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 30;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: calc(100vw - 2rem);
}

.admin-toolbar[hidden] {
  display: none;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.45rem 0.78rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(28, 32, 40, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--on-surface-variant);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.admin-btn:hover {
  color: var(--on-surface);
  border-color: rgba(255, 255, 255, 0.22);
  background-color: rgba(38, 42, 51, 0.95);
}

.admin-btn:focus-visible {
  outline: 2px solid var(--primary-container);
  outline-offset: 2px;
}

.admin-btn.is-lock-active {
  color: var(--error);
  border-color: rgba(255, 107, 107, 0.5);
  background-color: rgba(255, 107, 107, 0.12);
}

.admin-btn.is-maint-active {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.5);
  background-color: rgba(251, 191, 36, 0.12);
}

.admin-icon {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
}

@media (max-width: 440px) {
  .admin-label-hide-xs {
    display: none;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(9, 12, 18, 0.76);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background-color: var(--surface-container);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.875rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  text-align: left;
  user-select: text;
  -webkit-user-select: text;
}

.modal-card-sm {
  max-width: 26rem;
}

.modal-card-lg {
  max-width: 42rem;
}

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

.modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--on-surface);
}

.modal-close {
  background: transparent;
  border: 0;
  color: var(--on-surface-variant);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  border-radius: 0.375rem;
}

.modal-close:hover {
  color: var(--on-surface);
  background-color: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 1.15rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-desc {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--on-surface-variant);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.preset-chip {
  padding: 0.35rem 0.72rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: var(--surface-container-high);
  color: var(--on-surface-variant);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  cursor: pointer;
}

.preset-chip:hover {
  color: var(--on-surface);
  border-color: rgba(255, 255, 255, 0.25);
}

.preset-chip.is-selected {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.55);
  background-color: rgba(251, 191, 36, 0.14);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.section-heading {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary-container);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 520px) {
  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .field-span-2 {
    grid-column: span 2;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

.field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  padding-top: 1.15rem;
}

.field-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--on-surface-variant);
}

.field input[type="text"],
.field input[type="number"],
.field input[type="time"],
.field select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary-container);
}

.readonly-info {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--on-surface-variant);
  opacity: 0.85;
}

.modal-error {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(255, 107, 107, 0.4);
  background-color: rgba(255, 107, 107, 0.12);
  color: var(--error);
  font-size: 0.82rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
  padding-top: 0.35rem;
}

.modal-footer-split {
  justify-content: space-between;
  flex-wrap: wrap;
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
}

.btn-primary,
.btn-secondary,
.btn-danger-ghost {
  padding: 0.5rem 0.95rem;
  border-radius: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background-color: rgba(0, 240, 255, 0.16);
  border-color: rgba(0, 240, 255, 0.45);
  color: var(--primary-container);
}

.btn-primary:hover {
  background-color: rgba(0, 240, 255, 0.24);
}

.btn-warning {
  background-color: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.5);
  color: var(--warning);
}

.btn-warning:hover {
  background-color: rgba(251, 191, 36, 0.25);
}

.btn-secondary {
  background-color: var(--surface-container-high);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--on-surface-variant);
}

.btn-secondary:hover {
  color: var(--on-surface);
}

.btn-danger-ghost {
  background: transparent;
  border-color: rgba(255, 107, 107, 0.35);
  color: var(--error);
}

.btn-danger-ghost:hover:not(:disabled) {
  background-color: rgba(255, 107, 107, 0.12);
}

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