/* ==========================================================================
   Meta Quest XR AI Coach — xsDesignSystems (v2.1.0) Integration Stylesheet
   Governed by: xsDesignSystems Master Token Substrate & Cognitive Visual Rubric
   Invariants: APCA Lc >= 75, Spot Color <= 3.0%, Fitts >= 44px, CPL 45-75ch
   ========================================================================== */

@import '/static/xs-design-system.css';

:root {
  /* xsDesignSystems Bridge Tokens */
  --xs-font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --xs-font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Theme Defaults (TechDark / Haegyung Slate Default) */
  --bg-main: var(--xs-bg-canvas, #0e121a);
  --bg-card: var(--xs-bg-surface, #161c28);
  --bg-card-subtle: var(--xs-bg-subtle, #1a2232);
  --bg-input: var(--xs-bg-active, #111622);
  --border-color: var(--xs-border-subtle, #232d42);
  --border-focus: var(--xs-accent-navy, #0082fb);

  --text-primary: var(--xs-ink-primary, #f8fafc);
  --text-secondary: var(--xs-ink-secondary, #94a3b8);
  --text-muted: var(--xs-ink-muted, #64748b);

  /* Spot Color Economics: Spot accent restricted to <= 3% of viewport */
  --spot-primary: var(--xs-spot-accent, #0082fb);
  --spot-accent-soft: rgba(0, 130, 251, 0.12);
  --spot-cyan: #06b6d4;
  --spot-purple: #8b5cf6;
  --spot-green: #10b981;
  --spot-amber: #f59e0b;
  --spot-danger: #ef4444;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --min-touch-target: 44px;
}

/* Light / Swiss Paper Mode Support */
[data-xs-theme="chat-workspace-paper"],
[data-xs-theme="standard-canvas"] {
  --bg-main: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f3f5;
  --bg-input: #f8f9fa;
  --border-color: #e5e7eb;
  --border-focus: #006ed6;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --spot-primary: #006ed6;
  --spot-accent-soft: rgba(0, 110, 214, 0.08);
}

/* Haegyung HDLS (닥종이/먹) Mode Support */
[data-xs-theme="haegyung-hdls"] {
  --bg-main: #141416;
  --bg-card: #1c1d21;
  --bg-card-subtle: #24252a;
  --bg-input: #121315;
  --border-color: #2f3037;
  --border-focus: #5b8bf5;
  --text-primary: #f2f3f5;
  --text-secondary: #a3a5ad;
  --text-muted: #6e7078;
  --spot-primary: #5b8bf5;
  --spot-accent-soft: rgba(91, 139, 245, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--xs-font-sans);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header & Sovereign System Bar
   ========================================================================== */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.9rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-icon {
  font-size: 1.8rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.system-badge-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  background: var(--spot-accent-soft);
  color: var(--spot-primary);
  border: 1px solid var(--spot-primary);
  text-transform: uppercase;
}

.logo-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* Theme Switcher Widget */
.theme-picker-widget {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.theme-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
}

.theme-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.project-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.select-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  outline: none;
  min-width: 200px;
  height: 36px;
}

.select-input:focus {
  border-color: var(--border-focus);
}

/* ==========================================================================
   Hero Anchor & Project Status Bar (VibeNotes Core Anchor 1)
   ========================================================================== */
.project-summary-bar {
  background: var(--bg-card-subtle);
  border-bottom: 1px solid var(--border-color);
  padding: 0.9rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.summary-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.current-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.summary-progress {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 250px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-fill {
  height: 100%;
  background: var(--spot-primary);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* ==========================================================================
   Navigation Tabs (Fitts >= 44px & Micro-deliberation)
   ========================================================================== */
.tab-navigation {
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  gap: 0.4rem;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0 1.2rem;
  height: var(--min-touch-target);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--spot-accent-soft);
}

.nav-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--spot-primary);
  font-weight: 600;
}

/* ==========================================================================
   Main Content Layout & Typography (CPL 45-75ch)
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1360px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: xsFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.section-intro {
  margin-bottom: 1.5rem;
  max-width: 75ch; /* Rayner Saccade Invariant */
}

.section-intro h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.section-intro p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Grids */
.grid-2-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

@media (max-width: 1024px) {
  .grid-2-col, .grid-3-col {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Cards (Carbon Substrate & Glass Edge)
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.card-header {
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card-subtle);
}

.card-header h4 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 1.4rem;
}

.subheading {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.9rem;
  color: var(--text-primary);
}

.subheading-sm {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Form Controls (Fitts >= 44px Target Size)
   ========================================================================== */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  min-height: 40px;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--border-focus);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.custom-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--text-primary);
  min-height: 28px;
}

.custom-checkbox input[type="checkbox"] {
  margin-top: 0.25rem;
  cursor: pointer;
  accent-color: var(--spot-primary);
  width: 16px;
  height: 16px;
}

.input-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.unit-span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Buttons (Sovereign Button Contract)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  min-height: 38px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  min-height: 32px;
}

.btn-xs {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  min-height: 24px;
}

.btn-block {
  width: 100%;
}

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

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg-card-subtle);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--spot-accent-soft);
  border-color: var(--border-focus);
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-row.right {
  justify-content: flex-end;
}

/* ==========================================================================
   3-Stratum Chips (xsDesignSystems Chip Architecture)
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-meta {
  background: var(--spot-accent-soft);
  color: var(--spot-primary);
  border: 1px solid var(--spot-primary);
}

.tag {
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
}

.tag-accent {
  background: rgba(139, 92, 246, 0.12);
  color: #c084fc;
  border-color: rgba(139, 92, 246, 0.3);
}

.tag-success {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.tag-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   RCT 3-Axis Cards
   ========================================================================== */
.rct-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.rct-badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-xs);
  margin-bottom: 0.8rem;
  border-left: 3px solid transparent;
}

.content-badge {
  background: rgba(0, 130, 251, 0.1);
  color: #60a5fa;
  border-left-color: var(--spot-primary);
}

.instructor-badge {
  background: rgba(139, 92, 246, 0.1);
  color: #c084fc;
  border-left-color: var(--spot-purple);
}

.learner-badge {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border-left-color: var(--spot-green);
}

.rct-questions {
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-bottom: 0.8rem;
}

.rct-questions ul {
  padding-left: 1.1rem;
  margin: 0.4rem 0;
  color: var(--text-secondary);
}

.goal-text {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   VRISE Badges & VAC Gauge (50:50 Deliberation Archetype)
   ========================================================================== */
.vrise-badges-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.vrise-pill {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.vac-result-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.gauge-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.status-badge {
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 700;
}

.status-badge.optimal {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid #10b981;
}

.status-badge.comfort {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid #06b6d4;
}

.status-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid #f59e0b;
}

.status-badge.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid #ef4444;
}

.diopter-display {
  font-family: var(--xs-font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.vac-scale-wrapper {
  margin: 1rem 0;
}

.vac-scale-bar {
  display: flex;
  height: 24px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
}

.scale-section {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
}

.scale-section.danger { width: 25%; background: #451a1a; color: #fecaca; }
.scale-section.optimal { width: 30%; background: #064e3b; color: #a7f3d0; }
.scale-section.comfort { width: 25%; background: #083344; color: #bae6fd; }
.scale-section.warning { width: 20%; background: #451a03; color: #fde68a; }

.vac-pointer {
  position: absolute;
  top: -9px;
  font-size: 0.95rem;
  color: #ffffff;
  transform: translateX(-50%);
  transition: left 0.15s ease;
  text-shadow: 0 1px 3px #000;
}

.vac-message-area {
  font-size: 0.82rem;
}

.vac-msg {
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.vac-rec {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.slider {
  width: 100%;
  accent-color: var(--spot-primary);
  height: 6px;
  cursor: pointer;
}

/* ==========================================================================
   Presets Grid & Code Boxes
   ========================================================================== */
.preset-buttons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1.2rem;
}

@media (max-width: 900px) {
  .preset-buttons-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.preset-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
  color: inherit;
  min-height: var(--min-touch-target);
}

.preset-btn:hover {
  background: var(--bg-card-subtle);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.preset-icon {
  font-size: 1.6rem;
}

.preset-btn strong {
  display: block;
  font-size: 0.86rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.preset-btn p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.code-box-wrapper {
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  max-height: 280px;
  overflow-y: auto;
}

.code-box-wrapper.tall {
  max-height: 480px;
}

.code-box-wrapper pre {
  margin: 0;
}

.code-box-wrapper code {
  font-family: var(--xs-font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-all;
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.history-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

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

/* ==========================================================================
   4-Gate Loop Diagram
   ========================================================================== */
.loop-diagram-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.loop-step {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  flex: 1;
  min-width: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--spot-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.3rem;
}

.loop-step strong {
  font-size: 0.84rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.loop-step small {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.loop-arrow {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 1.1rem;
}

/* ==========================================================================
   Milestones Checklist & Table
   ========================================================================== */
.milestone-tabs {
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.6rem;
}

.m-tab {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  height: var(--min-touch-target);
  transition: all 0.15s ease;
}

.m-tab.active {
  background: var(--spot-primary);
  color: #fff;
  border-color: var(--spot-primary);
}

.table-responsive {
  overflow-x: auto;
}

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

.milestone-table th, .milestone-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.milestone-table th {
  background: var(--bg-card-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.76rem;
}

.milestone-table td {
  color: var(--text-primary);
}

.cat-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-xs);
  font-weight: 600;
}

.cat-ergonomics {
  background: rgba(6, 182, 212, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.cat-instructional {
  background: rgba(139, 92, 246, 0.12);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.cat-code_quality {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   Auth Gate Overlay (Haegyung Sovereign Gateway)
   ========================================================================== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 14, 22, 0.85);
  backdrop-filter: blur(12px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.auth-overlay.active {
  display: flex;
  opacity: 1;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 440px;
  overflow: hidden;
  animation: xsScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes xsScaleUp {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.auth-header {
  padding: 1.6rem 1.6rem 1.1rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
}

.auth-brand-icon {
  font-size: 2.2rem;
  margin-bottom: 0.4rem;
}

.auth-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.auth-header p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.auth-body {
  padding: 1.5rem;
}

.preconfigured-box {
  background: var(--bg-input);
  border: 1px dashed var(--border-color);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
}

.preconfigured-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.preconfigured-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hint-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.76rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-xs);
  text-align: left;
  cursor: pointer;
  min-height: 32px;
  transition: border-color 0.15s ease;
}

.hint-chip:hover {
  border-color: var(--border-focus);
}

/* User Session Badge */
.user-session-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
}

.user-display-name {
  color: var(--text-primary);
  font-weight: 600;
}

/* Modals */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card-subtle);
}

.modal-header h4 {
  color: var(--text-primary);
  font-size: 1rem;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.4rem;
}

.modal-footer {
  padding: 0.9rem 1.4rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-color);
  padding: 1.1rem 2rem;
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  background: var(--bg-card);
}

.alert {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.font-bold { font-weight: 700; }
.text-accent { color: var(--spot-primary); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--spot-danger); }
.text-sm { font-size: 0.82rem; color: var(--text-secondary); }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1.2rem; }
.mb-4 { margin-bottom: 1.2rem; }
