/* ═══════════════════════════════════════════════════════════════
   Max Tool — Premium Sci-Fi Design System
   Sleek professional interfaces with subtle neon glows and glassmorphism.
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Rajdhani:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ── CSS Variables — Premium Sci-Fi Theme ─── */
:root {
  /* Dark palette — deep space */
  --bg-body: #0B0F19;
  --bg-card: rgba(21, 27, 43, 0.7);
  --bg-card-solid: #151B2B;
  --bg-card-hover: rgba(30, 38, 56, 0.8);
  --bg-input: #0F172A;
  --bg-section: #151B2B;

  /* Borders */
  --border-color: #2A3441;
  --border-light: #374151;

  /* Accents — neon energy */
  --accent-cyan: #00E5FF;
  --gold: #FFD700;
  --gold-light: #FFEA00;
  --gold-pale: #332B00;
  --burgundy: #FF5252;
  --teal: #00D4FF;
  --navy: #38BDF8;

  /* Semantic */
  --success: #00E676;
  --error: #FF5252;
  --warning: #FF9800;

  /* Text Colors */
  --charcoal: #E2E8F0;
  --ivory: #0B0F19;
  --cream: #111827;
  --parchment: #1F2937;
  --warm-gray: #94A3B8;
  --stone: #CBD5E1;
  --bronze: #E2E8F0;
  --ink: #F8FAFC;

  /* Typography — tech fonts */
  --font-display: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Outfit', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radius — more rounded for modern feel */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Shadows — deep and glows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-glow-cyan: 0 0 15px rgba(0, 229, 255, 0.3);
  --shadow-glow-gold: 0 0 15px rgba(255, 215, 0, 0.3);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  color-scheme: dark;
}

/* ── Dynamic Sci-Fi Background ─────────────────────── */
.ki-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  opacity: 0.6;
}

/* ── Reduced Motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Reset & Base ──────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--charcoal);
  min-height: 100vh;
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ── Decorative border pattern ──────────────────── */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--gold), var(--accent-cyan));
  z-index: 100;
  box-shadow: var(--shadow-glow-cyan);
}

/* ── Container ─────────────────────────────────────── */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ────────────────────────────────────────── */
.app-header {
  text-align: center;
  padding: 40px 0 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 32px;
  position: relative;
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 1px;
  background: var(--accent-cyan);
  box-shadow: var(--shadow-glow-cyan);
}

.app-header__title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
}

.app-header__subtitle {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--stone);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.app-header__version {
  display: inline-block;
  font-size: 11px;
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
  background: rgba(0, 229, 255, 0.05);
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.15em;
  margin-top: 12px;
  font-family: var(--font-mono);
  box-shadow: inset 0 0 8px rgba(0, 229, 255, 0.1);
}

/* ── Navigation Tabs ───────────────────────────────── */
.nav-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  padding: 4px;
}

.nav-tab {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.nav-tab:hover {
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.05);
}

.nav-tab--active {
  background: var(--bg-card-solid);
  color: var(--accent-cyan);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-tab--active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent-cyan);
  box-shadow: var(--shadow-glow-cyan);
  border-radius: 2px;
}

.nav-tab__icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.nav-tab--active .nav-tab__icon {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.4));
}

/* ── Disabled / coming-soon tab ───────────────── */
.nav-tab--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
}
.nav-tab--disabled:hover {
  color: inherit;
  background: transparent;
}
.nav-tab__blocked-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 9px;
  font-weight: 900;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 3px;
  padding: 0 3px;
  line-height: 14px;
  letter-spacing: 0;
  pointer-events: none;
}
@keyframes nav-shake {
  0%  { transform: translateX(0); }
  15% { transform: translateX(-5px) rotate(-3deg); }
  30% { transform: translateX(5px)  rotate(3deg); }
  45% { transform: translateX(-4px) rotate(-2deg); }
  60% { transform: translateX(4px)  rotate(2deg); }
  75% { transform: translateX(-2px); }
  100%{ transform: translateX(0); }
}
.nav-tab--shake {
  animation: nav-shake 0.55s ease;
  color: #ef4444 !important;
}

/* ── Section Panels ────────────────────────────────── */
.panel {
  display: none;
  animation: fadeIn 0.35s ease;
}

.panel--active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ── API Usage Widget ──────────────────────────────── */
.api-usage {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 229, 255, 0.15);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-family: var(--font-mono);
  position: relative;
  cursor: default;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.api-usage__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  min-width: 90px;
}

.api-usage__label svg {
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.api-usage__count {
  color: var(--charcoal);
}

.api-usage__track {
  flex: 1;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
  min-width: 80px;
}

.api-usage__fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease;
}

.api-usage__hint {
  font-size: 11px;
  color: var(--stone);
  white-space: nowrap;
}

.api-usage[data-level="warning"] {
  border-color: rgba(255, 152, 0, 0.3);
}

.api-usage[data-level="critical"] {
  border-color: rgba(255, 82, 82, 0.3);
  background: rgba(255, 82, 82, 0.05);
}

.api-usage[data-level="critical"] .api-usage__count {
  color: var(--error);
  font-weight: 700;
}

/* ── Analysis Shimmer Loader ──────────────────────── */
.analysis-loader {
  padding: 0.5rem 0;
}

.analysis-loader__bar {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.analysis-loader__shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(0, 229, 255, 0.4),
    var(--accent-cyan),
    rgba(255, 215, 0, 0.5),
    transparent
  );
  border-radius: 2px;
  animation: shimmerSlide 1.8s ease-in-out infinite;
}

@keyframes shimmerSlide {
  0%   { left: -60%; }
  100% { left: 100%; }
}

/* ── Cards ─────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card__icon {
  width: 18px;
  height: 18px;
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 5px rgba(0, 229, 255, 0.5));
}

.card__description {
  font-size: 13px;
  color: var(--stone);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* ═══ MODULE SELECTOR (Compact Checklist) ══════════════ */
.module-selector {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ── Module Search ──────────────────────────────────── */
.module-search-wrap {
  padding: 0 0 8px;
}
.module-search-input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  background: var(--bg-input, #1e293b);
  color: var(--text-primary, #f1f5f9);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.module-search-input:focus {
  border-color: var(--accent-cyan, #22d3ee);
}
.module-search-input::placeholder {
  color: var(--stone, #64748b);
}

/* ── Category Filter Bar ───────────────────────────── */
.module-filter-bar {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bg-section);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.module-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--stone);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.module-filter-pill:hover {
  border-color: var(--gold);
  color: var(--charcoal);
  background: var(--cream);
}

.module-filter-pill--active {
  background: var(--gold);
  border-color: var(--gold);
  color: white;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(196, 151, 59, 0.25);
}

.module-filter-pill--active:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
  color: white;
}

[data-theme="dark"] .module-filter-pill--active {
  box-shadow: 0 0 10px rgba(255, 94, 0, 0.3);
}

.module-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
}

.module-item:last-child {
  border-bottom: none;
}

.module-item:hover {
  background: var(--cream);
}

.module-item--selected {
  background: var(--gold-pale);
}

.module-item--locked {
  background: var(--bg-section);
  cursor: default;
}

.module-item__checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--warm-gray);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: transparent;
  font-size: 11px;
  transform: scale(1);
}

.module-item:active .module-item__checkbox {
  transform: scale(0.85);
}

.module-item--selected .module-item__checkbox {
  background: var(--gold);
  border-color: var(--gold);
  color: white;
  box-shadow: 0 2px 6px rgba(196, 151, 59, 0.3);
}

.module-item--locked .module-item__checkbox {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.module-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.module-item__name {
  font-size: 14px;
  font-weight: 400;
  color: var(--charcoal);
  flex: 1;
}

.module-item__desc {
  font-size: 12px;
  color: var(--stone);
  text-align: right;
}

.module-item--locked .module-item__desc {
  font-style: italic;
  color: var(--success);
}

/* ── UI Upgrades: Micro-animations & Ki Energy ─────── */
[data-theme="dark"] .module-item--selected {
  background: rgba(255, 94, 0, 0.08);
  box-shadow: inset 3px 0 0 var(--gold);
}

[data-theme="dark"] .module-item--selected .module-item__checkbox {
  box-shadow: 0 0 10px rgba(255, 94, 0, 0.5);
}

@keyframes ctaPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(196, 151, 59, 0.4);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(196, 151, 59, 0);
    transform: scale(1.02);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(196, 151, 59, 0);
    transform: scale(1);
  }
}

@keyframes ctaPulseDark {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 94, 0, 0.4);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(255, 94, 0, 0);
    transform: scale(1.02);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 94, 0, 0);
    transform: scale(1);
  }
}

.btn--ready {
  animation: ctaPulse 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--gold) !important;
  color: white !important;
  border-color: var(--gold) !important;
}

[data-theme="dark"] .btn--ready {
  animation: ctaPulseDark 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Config Form ───────────────────────────────────── */
.config-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-field__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-body);
}

.config-field__input,
.config-field__select {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--charcoal);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: all var(--transition-fast);
}

.config-field__input:focus,
.config-field__select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15), inset 0 0 8px rgba(0, 229, 255, 0.1);
  background: rgba(15, 23, 42, 0.9);
}

.config-field__input::placeholder {
  color: var(--border-light);
  font-family: var(--font-body);
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s ease;
}

.btn:hover::after {
  left: 200%;
}

.btn--primary {
  background: var(--accent-cyan);
  color: var(--bg-body);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.btn--primary:hover {
  background: #00B8CC;
  border-color: #00B8CC;
  box-shadow: var(--shadow-glow-cyan);
  transform: translateY(-1px);
}

.btn--gold {
  background: var(--gold);
  color: var(--bg-body);
  border: 1px solid var(--gold);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.btn--gold:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
  box-shadow: var(--shadow-glow-gold);
  transform: translateY(-1px);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--border-color);
  color: var(--bronze);
}

.btn--ghost:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.05);
  box-shadow: inset 0 0 10px rgba(0, 229, 255, 0.1);
}

.btn--lg {
  padding: 14px 32px;
  font-size: 15px;
}

.btn__icon {
  width: 18px;
  height: 18px;
}

.btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(1);
}

/* ── Drop Zone ─────────────────────────────────────── */
.drop-zone {
  border: 1px dashed var(--warm-gray);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--bg-section);
}

.drop-zone:hover,
.drop-zone--active {
  border-color: var(--gold);
  background: var(--gold-pale);
}

.drop-zone__icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  color: var(--stone);
}

.drop-zone:hover .drop-zone__icon,
.drop-zone--active .drop-zone__icon {
  color: var(--gold);
}

.drop-zone__text {
  font-size: 14px;
  color: var(--charcoal);
  margin-bottom: 4px;
}

.drop-zone__hint {
  font-size: 12px;
  color: var(--stone);
}

.drop-zone__formats {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.format-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: 3px;
  text-transform: uppercase;
  border: 1px solid;
  font-family: var(--font-body);
}

.format-badge--xlsx {
  color: #1a6b3c;
  background: #dcf5e7;
  border-color: #b8e6ca;
}

.format-badge--xls {
  color: #1a6b3c;
  background: #e8f5ee;
  border-color: #cce8d8;
}

.format-badge--csv {
  color: #2563eb;
  background: #dbeafe;
  border-color: #bfdbfe;
}

.format-badge--ods {
  color: #7c3aed;
  background: #ede9fe;
  border-color: #ddd6fe;
}

.format-badge--docx {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #93c5fd;
}

.format-badge--pdf {
  color: #dc2626;
  background: #fee2e2;
  border-color: #fca5a5;
}

.drop-zone__file-input {
  display: none;
}

/* Action hint toggle */
.action-hint--hidden {
  display: none !important;
}

/* ── File Info ──────────────────────────────────────── */
.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(74, 124, 89, 0.08);
  border: 1px solid rgba(74, 124, 89, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 14px;
  animation: fadeIn 0.3s ease;
}

.file-info__icon {
  width: 20px;
  height: 20px;
  color: var(--success);
}

.file-info__name {
  font-size: 13px;
  font-weight: 400;
  color: var(--success);
}

.file-info__size {
  font-size: 12px;
  color: var(--stone);
}

.file-info__remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--stone);
  cursor: pointer;
  font-size: 15px;
  padding: 2px 6px;
  border-radius: 3px;
  transition: color var(--transition-fast);
}

.file-info__remove:hover {
  color: var(--error);
}

/* ── Progress/Loading — Premium Loader ─────────────── */
.progress-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.progress-overlay--active {
  display: flex;
}

/* Gradient backdrop with slow animation */
.progress-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(0, 229, 255, 0.08), transparent 60%),
              radial-gradient(ellipse at 70% 50%, rgba(255, 215, 0, 0.06), transparent 60%),
              rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: backdropShift 8s ease-in-out infinite alternate;
}

@keyframes backdropShift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

/* Glassmorphic card */
.progress-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 48px;
  background: rgba(21, 27, 43, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
              inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  min-width: 320px;
}

/* Orbital ring container */
.progress-orbital {
  position: relative;
  width: 100px;
  height: 100px;
}

.progress-orbital__svg {
  width: 100%;
  height: 100%;
}

.progress-orbital__ring {
  animation: orbitalSpin 2s linear infinite;
  transform-origin: center;
}

.progress-orbital__ring2 {
  animation: orbitalSpin 3s linear infinite reverse;
  transform-origin: center;
}

@keyframes orbitalSpin {
  to { transform: rotate(360deg); }
}

/* Glowing center dot */
.progress-orbital__dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.6),
              0 0 30px rgba(0, 229, 255, 0.3);
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% {
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.6), 0 0 30px rgba(0, 229, 255, 0.3);
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.7), 0 0 50px rgba(255, 215, 0, 0.3);
    transform: translate(-50%, -50%) scale(1.2);
    background: var(--gold);
  }
}

/* Status text */
.progress-text {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: #f0f0f0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Progress track bar */
.progress-track {
  width: 260px;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

.progress-track__fill {
  width: 0%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--gold), var(--accent-cyan));
  background-size: 200% 100%;
  animation: trackShimmer 2s linear infinite;
  transition: width 0.5s ease;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

@keyframes trackShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Fun rotating messages */
.progress-msg {
  font-size: 13px;
  color: rgba(148, 163, 184, 0.8);
  font-style: italic;
  min-height: 20px;
  animation: msgFadeUp 0.5s ease;
}

@keyframes msgFadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Timer */
.progress-timer {
  font-size: 11px;
  font-family: var(--font-mono);
  color: rgba(148, 163, 184, 0.6);
  letter-spacing: 0.1em;
}




/* Legacy spinner (keep for compatibility) */
.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-color);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Upload Module Section ─────────────────────────── */
.upload-module-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* ── Custom Module List ────────────────────────────── */
.custom-modules-list {
  margin-top: 12px;
}

.custom-module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-section);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border: 1px solid var(--border-light);
}

.custom-module-item__name {
  font-size: 13px;
  color: var(--charcoal);
  flex: 1;
}

.custom-module-item__delete {
  background: none;
  border: none;
  color: var(--stone);
  cursor: pointer;
  font-size: 14px;
  transition: color var(--transition-fast);
}

.custom-module-item__delete:hover {
  color: var(--error);
}

/* ── Restyler Options ──────────────────────────────── */
.restyler-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.option-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-section);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.option-toggle:hover {
  border-color: var(--warm-gray);
}

.option-toggle input[type="checkbox"] {
  accent-color: var(--gold);
  width: 14px;
  height: 14px;
}

.option-toggle__label {
  font-size: 12px;
  color: var(--charcoal);
}

/* ── Action Bar ────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* ── Toast Notification ────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1100;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 380px;
}

.toast--success {
  border-left: 3px solid var(--success);
}

.toast--error {
  border-left: 3px solid var(--error);
}

.toast__icon {
  width: 18px;
  height: 18px;
}

.toast__text {
  font-size: 13px;
  color: var(--charcoal);
  flex: 1;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Footer ────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 28px 0;
  color: var(--stone);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-top: 1px solid var(--border-color);
  margin-top: 40px;
  position: relative;
}

.app-footer::before {
  content: '◆';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-body);
  padding: 0 12px;
  color: var(--gold);
  font-size: 12px;
}

/* ── Section counter ───────────────────────────────── */
.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--gold);
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .app-container {
    padding: 0 16px;
  }

  .config-group {
    grid-template-columns: 1fr;
  }

  .restyler-options {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 18px;
  }

  .drop-zone {
    padding: 28px 18px;
  }

  .action-bar {
    flex-direction: column;
  }

  .action-bar .btn {
    width: 100%;
  }

  .module-item__desc {
    display: none;
  }
}

@media (max-width: 480px) {
  .app-header__title {
    font-size: 22px;
  }

  .nav-tab {
    font-size: 11px;
    padding: 10px 12px;
  }
}

/* ── Step Badge ────────────────────────────────────── */
.step-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  background: var(--cream);
  color: var(--stone);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  font-family: var(--font-body);
}

/* ── Card Header Right (multiple items) ─────────── */
.card__header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Config field wide ─────────────────────────────── */
.config-field--wide {
  grid-column: 1 / -1;
}

/* ── Config field full-width ─────────────────────────── */
.config-field--full {
  grid-column: 1 / -1;
}

/* ── Language pill toggle ────────────────────────────── */
.lang-toggle {
  display: flex;
  gap: 4px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
}

.lang-toggle__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 12px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.lang-toggle__btn:hover:not(.lang-toggle__btn--active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.lang-toggle__btn--active {
  background: var(--accent-cyan);
  color: #0a0f1e;
  box-shadow: 0 1px 6px rgba(0, 229, 255, 0.3);
}

.lang-toggle__flag {
  font-size: 14px;
  line-height: 1;
}

/* ── Toggle switch (pmslink.cloud) ───────────────────── */
.toggle-switch-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.4);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.toggle-switch-row:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.04);
}

.toggle-switch-row__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-switch-row__track {
  flex-shrink: 0;
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border-color);
  border-radius: 10px;
  transition: background 0.2s;
}

.toggle-switch-row__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle-switch-row__input:checked ~ .toggle-switch-row__track {
  background: var(--accent-cyan);
}

.toggle-switch-row__input:checked ~ .toggle-switch-row__track .toggle-switch-row__thumb {
  transform: translateX(16px);
  background: #0a0f1e;
}

.toggle-switch-row__label {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.3;
}

.toggle-switch-row__hint {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  font-style: normal;
  margin-top: 1px;
}

/* ── Config hint tooltip ──────────────────────────── */
.config-field__hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--cream);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  font-size: 10px;
  color: var(--stone);
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Summary Card ──────────────────────────────────── */
.card--summary {
  border-left: 3px solid var(--gold);
}

.summary-content {
  font-size: 13px;
  color: var(--charcoal);
  line-height: 1.8;
}

.summary-content .summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.summary-content .summary-item__icon {
  font-size: 14px;
  flex-shrink: 0;
}

.summary-content .summary-item__text {
  flex: 1;
}

.summary-content .summary-meta {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--stone);
}

/* ── Preview Panel ─────────────────────────────────── */
.preview-content {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-section);
}

.preview-tab-bar {
  display: flex;
  gap: 0;
  background: var(--cream);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.preview-tab-btn {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--stone);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.preview-tab-btn:hover {
  color: var(--charcoal);
}

.preview-tab-btn--active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  font-weight: 700;
}

.preview-table-container {
  padding: 12px;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--font-body);
}

.preview-table th {
  background: var(--ink);
  color: var(--cream);
  padding: 6px 10px;
  text-align: left;
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preview-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--charcoal);
}

.preview-table tr:nth-child(even) td {
  background: var(--cream);
}

.preview-table td:empty::after {
  content: '—';
  color: var(--warm-gray);
}

/* ── Action Hint ───────────────────────────────────── */
.action-hint {
  font-size: 12px;
  color: var(--stone);
  font-style: italic;
  text-align: right;
  width: 100%;
  margin-top: 4px;
}

.action-hint--hidden {
  display: none;
}

/* ── Small Button ──────────────────────────────────── */
.btn--sm {
  padding: 6px 14px;
  font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════
   EXCEL PREVIEW (from excel-preview.js)
   ═══════════════════════════════════════════════════════════ */

.preview-container {
  margin-top: 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  overflow: hidden;
  animation: fadeIn 0.35s ease;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--cream);
  border-bottom: 1px solid var(--border-light);
}

.preview-header__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.preview-wrapper {
  overflow: hidden;
}

/* Sheet tabs */
.preview-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-section);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.preview-tab {
  padding: 8px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--stone);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.preview-tab:hover {
  color: var(--charcoal);
  background: var(--cream);
}

.preview-tab--active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  font-weight: 700;
}

/* Sheet panels */
.preview-sheet {
  display: none;
}

.preview-sheet--active {
  display: block;
}

/* Table scroll wrapper */
.preview-table-scroll {
  max-height: 420px;
  overflow: auto;
  padding: 12px;
}

/* Preview table */
.preview-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-family: var(--font-body);
}

.preview-row--section td {
  background: var(--ink);
  color: var(--cream);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px;
}

.preview-row--header td {
  background: var(--charcoal);
  color: var(--cream);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 10px;
}

.preview-row--label-value td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border-light);
}

.preview-cell--label {
  background: var(--bg-section);
  font-weight: 600;
  color: var(--charcoal);
  text-align: right;
  padding-right: 12px !important;
}

.preview-cell--value {
  background: var(--bg-card);
  color: var(--charcoal);
}

.preview-row--data td {
  padding: 4px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--charcoal);
}

.preview-row--alt td {
  background: var(--cream);
}

.preview-cell--number,
.preview-cell--currency,
.preview-cell--percentage {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}

.preview-cell--date {
  color: var(--teal);
}

.preview-cell--email,
.preview-cell--url {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-color: rgba(30, 58, 95, 0.2);
}

.preview-cell--boolean {
  text-align: center;
  color: var(--success);
}

.preview-cell--empty::after {
  content: '—';
  color: var(--warm-gray);
}

.preview-row--content td {
  padding: 4px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--stone);
  font-style: italic;
}

/* Stats bar */
.preview-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--bg-section);
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--stone);
  flex-wrap: wrap;
}

.preview-stat strong {
  color: var(--charcoal);
  font-weight: 600;
}

.preview-stat--num {
  color: var(--navy);
}

.preview-stat--date {
  color: var(--teal);
}

.preview-stat--text {
  color: var(--stone);
}

/* Loading state */
.preview-loading::after {
  content: 'Analizando archivo...';
  display: block;
  padding: 40px;
  text-align: center;
  color: var(--stone);
  font-style: italic;
}

.preview-empty {
  padding: 32px;
  text-align: center;
  color: var(--stone);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
   THEME SELECTOR
   ═══════════════════════════════════════════════════════════ */

.theme-selector {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.theme-selector__title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
}

.theme-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.theme-card:hover {
  border-color: var(--warm-gray);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.theme-card--active {
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
  background: var(--gold-pale);
}

.theme-card__colors {
  display: flex;
  gap: 3px;
  border-radius: 4px;
  overflow: hidden;
}

.theme-card__colors span {
  width: 20px;
  height: 20px;
  display: block;
}

.theme-card__name {
  font-size: 11px;
  font-weight: 600;
  color: var(--charcoal);
  letter-spacing: 0.02em;
}

@media (max-width: 480px) {
  .theme-cards {
    grid-template-columns: 1fr;
  }
}


/* ═══════════════════════════════════════════════════════════
   LOGIN OVERLAY
   ═══════════════════════════════════════════════════════════ */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, transparent 0%, rgba(11, 15, 25, 0.4) 100%);
  backdrop-filter: none;
}

.login-card {
  background: rgba(12, 10, 22, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 215, 0, 0.18);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(100, 180, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: loginSlideIn 0.5s ease;
}

@keyframes loginSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-card__header {
  text-align: center;
  margin-bottom: 28px;
}

.login-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 50%;
  color: #ffd700;
  margin-bottom: 14px;
}

.login-card__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: #f0e8d0;
  letter-spacing: 0.04em;
  margin: 0 0 4px;
}

.login-card__subtitle {
  font-size: 13px;
  color: rgba(200, 185, 150, 0.7);
  margin: 0;
  letter-spacing: 0.02em;
}

.login-card__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field__label {
  font-size: 11px;
  font-weight: 400;
  color: rgba(200, 185, 150, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-field__input {
  background: rgba(5, 5, 18, 0.55);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #f0e8d0;
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.login-field__input::placeholder { color: rgba(200, 185, 150, 0.35); }

.login-field__input:focus {
  outline: none;
  border-color: rgba(100, 180, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(100, 180, 255, 0.12);
}

.login-error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #DC2626;
  animation: fadeIn 0.3s ease;
}

.login-btn {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.login-card__footer {
  text-align: center;
  font-size: 11px;
  color: rgba(200, 185, 150, 0.45);
  margin-top: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-8px);
  }

  40% {
    transform: translateX(8px);
  }

  60% {
    transform: translateX(-6px);
  }

  80% {
    transform: translateX(6px);
  }
}

.shake {
  animation: shake 0.4s ease;
}


/* ═══════════════════════════════════════════════════════════
   LOGOUT BUTTON
   ═══════════════════════════════════════════════════════════ */

.btn-logout {
  position: absolute;
  top: 12px;
  right: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--stone);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-logout:hover {
  border-color: var(--error);
  color: var(--error);
  background: rgba(220, 38, 38, 0.05);
}


/* ═══════════════════════════════════════════════════════════
   ADMIN PANEL
   ═══════════════════════════════════════════════════════════ */

/* Admin sub-tabs */
.admin-nav {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
}

.admin-nav__tab {
  flex: 1;
  padding: 10px 16px;
  background: none;
  border: none;
  border-right: 1px solid var(--border-color);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--stone);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-nav__tab:last-child {
  border-right: none;
}

.admin-nav__tab:hover {
  background: var(--bg-section);
  color: var(--charcoal);
}

.admin-nav__tab--active {
  background: var(--gold-pale);
  color: var(--gold);
  border-bottom: 2px solid var(--gold);
}

/* Admin sub-panels */
.admin-subpanel {
  display: none;
}

.admin-subpanel--active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.admin-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 20px;
  color: var(--stone);
  font-size: 13px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  text-align: center;
  transition: box-shadow var(--transition-base);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--charcoal);
  line-height: 1.1;
}

.stat-card__label {
  font-size: 11px;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

.stat-card--warning .stat-card__value {
  color: #F59E0B;
}

.stat-card--success .stat-card__value {
  color: var(--success);
}

.stat-card--error .stat-card__value {
  color: var(--error);
}

/* Admin tables */
.admin-table-wrap {
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-family: var(--font-body);
}

.admin-table thead th {
  position: sticky;
  top: 0;
  background: var(--charcoal);
  color: var(--cream);
  padding: 8px 12px;
  text-align: left;
  font-weight: 400;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  z-index: 1;
}

.admin-table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--charcoal);
  vertical-align: middle;
}

.admin-table tbody tr:nth-child(even) td {
  background: var(--cream);
}

.admin-table tbody tr:hover td {
  background: var(--gold-pale);
}

.admin-table code {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 11px;
  background: var(--bg-section);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--charcoal);
}

.ua-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--stone);
}

.details-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--stone);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--success {
  background: rgba(5, 150, 105, 0.12);
  color: #059669;
}

.badge--error {
  background: rgba(220, 38, 38, 0.1);
  color: #DC2626;
}

.badge--warning {
  background: rgba(245, 158, 11, 0.12);
  color: #D97706;
}

.badge--info {
  background: rgba(59, 130, 246, 0.1);
  color: #2563EB;
}

.badge--default {
  background: var(--bg-section);
  color: var(--stone);
}

/* Responsive admin */
@media (max-width: 768px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .admin-stats {
    grid-template-columns: 1fr;
  }

  .login-card {
    margin: 16px;
    padding: 28px 24px;
  }
}

/* ═══ TOOLS PANEL ══════════════════════════════════════ */

/* Module delete button in selector grid */
.module-item__delete {
  background: none;
  border: none;
  color: var(--warm-gray);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all var(--transition-fast);
  opacity: 0;
  flex-shrink: 0;
  line-height: 1;
}

.module-item:hover .module-item__delete {
  opacity: 1;
}

.module-item__delete:hover {
  color: var(--error);
  background: rgba(139, 47, 58, 0.1);
}

/* Tool upload zones */
.tool-upload-zone {
  border: 1.5px dashed var(--warm-gray);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--bg-section);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.tool-upload-zone:hover,
.tool-upload-zone--active {
  border-color: var(--gold);
  background: var(--gold-pale);
}

.tool-upload-zone--sm {
  padding: 16px 12px;
}

.tool-upload-zone--has-file {
  border-color: var(--success);
  border-style: solid;
  background: rgba(74, 124, 89, 0.08);
}

.tool-upload-zone--has-file span {
  color: var(--success) !important;
  font-weight: 500;
}

/* Tool file info */
.tool-file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(74, 124, 89, 0.08);
  border: 1px solid rgba(74, 124, 89, 0.2);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  font-size: 13px;
  color: var(--success);
}

.tool-file-remove {
  background: none;
  border: none;
  color: var(--stone);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  transition: color var(--transition-fast);
}

.tool-file-remove:hover {
  color: var(--error);
}

/* Generator buttons */
.tool-gen-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  font-size: 12px;
  min-height: 70px;
}

.tool-gen-btn .btn__icon {
  width: 22px;
  height: 22px;
  color: var(--gold);
}

.tool-gen-btn:hover .btn__icon {
  color: var(--gold-light);
}

/* Diff / Validation report styles */
.diff-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-section);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.diff-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.diff-stat__num {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.diff-stat__label {
  font-size: 11px;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.diff-sheet {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.diff-sheet summary {
  padding: 0.6rem 0.75rem;
  background: var(--bg-section);
  cursor: pointer;
  font-size: 13px;
  color: var(--charcoal);
}

.diff-sheet summary:hover {
  background: var(--cream);
}

.diff-table-wrap {
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}

.diff-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.diff-table th {
  background: var(--ink);
  color: var(--cream);
  padding: 6px 10px;
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
}

.diff-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diff-table tr:nth-child(even) {
  background: var(--bg-section);
}

.diff-cell {
  font-family: 'Consolas', monospace;
  font-weight: 600;
  color: var(--bronze);
}

.diff-old {
  color: #DC2626;
  background: rgba(220, 38, 38, 0.06);
}

.diff-new {
  color: #059669;
  background: rgba(5, 150, 105, 0.06);
}

/* ═══════════════════════════════════════════════════════════
   HUB PORTAL
   ═══════════════════════════════════════════════════════════ */

.hub {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

/* Hub Header */
.hub__header {
  text-align: center;
  padding: 2rem 0 0.5rem;
  position: relative;
  width: 100%;
}

.hub__title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink);
}

.hub__subtitle {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--stone);
  letter-spacing: 0.2em;
  margin-top: 0.25rem;
}

/* ── User Avatar Pill ───────────────────────────────── */
.user-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem 0.3rem 0.4rem;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  cursor: default;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  transition: background 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
}
.user-pill:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.user-pill__avatar {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}
.user-pill__name {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
[data-theme="dark"] .user-pill {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.1);
}
/* Work module header pill — slightly smaller */
.user-pill--header {
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem 0.25rem 0.35rem;
  max-width: 130px;
}

.hub__header-actions {
  position: absolute;
  top: 2rem;
  right: 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Profile Card */
.hub__profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color 0.3s ease;
  animation: hubCardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.hub__profile-avatar {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--bg-input);
  border-radius: 50%;
  border: 2px solid var(--border-color);
  flex-shrink: 0;
}

.hub__profile-info {
  flex: 1;
  min-width: 0;
}

.hub__profile-alias {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.hub__profile-meta {
  font-size: 0.78rem;
  color: var(--stone);
  margin-top: 2px;
}

.hub__profile-edit {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--stone);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.hub__profile-edit:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* Portal Cards Container */
.hub__portals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  width: 100%;
}

/* Individual Portal Card */
.hub__portal-card {
  position: relative;
  padding: 3rem 2rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  overflow: hidden;
  min-height: 280px;
  animation: hubCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hub__portal-card:nth-child(1) { 
  animation-delay: 0.1s; 
}
.hub__portal-card:nth-child(2) { 
  animation-delay: 0.2s; 
}
.hub__portal-card:nth-child(3) { 
  animation-delay: 0.3s; 
}

@keyframes hubCardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hub__portal-card:hover {
  transform: translateY(-4px);
}

.hub__portal-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.hub__portal-card:hover .hub__portal-glow {
  opacity: 1;
}

.hub__portal-icon {
  color: #CBD5E1;
  margin-bottom: 1.25rem;
  transition: color 0.3s ease, filter 0.3s ease;
}

.hub__portal-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin: 0;
}

.hub__title--dbz {
  font-family: 'Bangers', cursive, sans-serif;
  color: #FFEA00;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 
    -2px -2px 0 #D32F2F,
     2px -2px 0 #D32F2F,
    -2px  2px 0 #D32F2F,
     2px  2px 0 #D32F2F,
     0px  3px 0 #B71C1C,
     0px  6px 15px rgba(0,0,0,0.8);
}

.hub__portal-divider {
  width: 50px;
  height: 2px;
  background: var(--gold);
  margin: 0.75rem 0;
  border-radius: 2px;
}

.hub__portal-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
  color: #CBD5E1;
  line-height: 2;
}

.hub__portal-features li::before {
  content: '·  ';
  color: #A0AEC0;
}

.hub__portal-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: auto;
}

/* Admin Card */
.hub__admin-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.hub__admin-card:hover {
  border-color: var(--gold);
}

.hub__admin-icon {
  color: #CBD5E1;
  flex-shrink: 0;
}

.hub__admin-info {
  flex: 1;
}

.hub__admin-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.06em;
}

.hub__admin-desc {
  font-size: 0.72rem;
  color: #CBD5E1;
  margin-top: 2px;
}

.hub__admin-arrow {
  color: #CBD5E1;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.hub__admin-card:hover .hub__admin-arrow {
  transform: translateX(4px);
}

/* Hub Footer */
.hub__footer {
  font-size: 0.7rem;
  color: var(--warm-gray);
  letter-spacing: 0.15em;
  padding-top: 1rem;
  margin-top: auto;
}

/* Back to Hub button in app header */
.app-header__back {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--stone);
  cursor: pointer;
  transition: all 0.2s ease;
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.app-header__back:hover {
  color: var(--gold);
  border-color: var(--gold);
}

@media (max-width: 640px) {
  .hub__portals {
    grid-template-columns: 1fr;
  }

  .hub__portal-card {
    padding: 1.5rem 1rem 1rem;
  }

  .hub__header-actions {
    position: static;
    justify-content: center;
    margin-top: 0.75rem;
  }

  .app-header__back {
    position: static;
    transform: none;
    margin-right: 0.75rem;
  }
}

/* ═══ GAMES MODE — Hide work header & nav ═══ */
.app-container--games-mode>.app-header .app-header__title,
.app-container--games-mode>.app-header .app-header__subtitle,
.app-container--games-mode>.app-header .app-header__version,
.app-container--games-mode>.app-header .theme-toggle {
  display: none !important;
}

.app-container--games-mode>.nav-tabs {
  display: none !important;
}

.app-container--games-mode>.app-header {
  justify-content: flex-start;
  padding: 0.5rem 1rem;
  min-height: auto;
}

.app-container--games-mode>.app-header::after {
  display: none;
}

.app-container--games-mode>.app-footer {
  display: none !important;
}

/* ═══ AMADEO LLADOS SOUNDBOARD ═══════════════════════ */

/* Sound Toggle Button (mirrors .theme-toggle) */
.sound-toggle {
  position: absolute;
  right: 80px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--charcoal);
  transition: all var(--transition-fast);
}

.sound-toggle:hover {
  background: var(--gold-pale);
  border-color: var(--gold);
}

.sound-toggle--muted {
  opacity: 0.5;
}

/* Llados Phrase Toast */
.llados-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  border-radius: 12px;
  border: 1px solid rgba(255, 94, 0, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 94, 0, 0.1);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  z-index: 10000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.llados-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.llados-toast__emoji {
  font-size: 1.4rem;
  animation: llamadaShake 0.6s ease-in-out 3;
}

.llados-toast__text {
  background: linear-gradient(90deg, #ff5e00, #ffc107);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes llamadaShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

/* Hide sound toggle in games mode */
.app-container--games-mode .sound-toggle {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   TIME TRACKER — Component Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Sub-navigation ── */
.tracker-sub-nav {
  display: flex;
  gap: 4px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 24px;
}

.tracker-sub-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: #A0AEC0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.tracker-sub-tab:hover { color: #F1F5F9; background: rgba(255,255,255,0.06); }

.tracker-sub-tab--active {
  background: var(--bg-card-solid);
  color: #FF5E00;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ── Timer Section ── */
.tracker-timer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px 16px;
}

.tracker-timer-display {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: 0.08em;
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
  line-height: 1;
}

.tracker-timer-controls {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 700px;
  align-items: center;
}

.tracker-timer-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, #8B5CF6, #7C3AED);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 12px rgba(139, 92, 246, 0.3);
  white-space: nowrap;
}

.tracker-timer-btn svg { width: 18px; height: 18px; }

.tracker-timer-btn:hover {
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
}

.tracker-timer-btn--active {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3);
  animation: tracker-pulse 2s ease-in-out infinite;
}

.tracker-timer-btn--active:hover {
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
}

@keyframes tracker-pulse {
  0%, 100% { box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 2px 20px rgba(239, 68, 68, 0.5), 0 0 30px rgba(239, 68, 68, 0.2); }
}

/* ── Inputs & Selects ── */
.tracker-select, .tracker-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--charcoal);
  font-family: var(--font-body);
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
  flex: 1;
  min-width: 0;
}

.tracker-select:focus, .tracker-input:focus {
  outline: none;
  border-color: #8B5CF6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.tracker-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

/* ── Manual Entry Grid ── */
.tracker-manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* ── Today Entries ── */
.tracker-today-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-top: 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--stone);
  font-weight: 500;
}

.tracker-today-total {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: #8B5CF6;
}

.tracker-entries { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

.tracker-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.tracker-entry:hover { border-color: var(--border-light); background: var(--bg-card-hover); }

.tracker-entry--active {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.05);
  animation: tracker-entry-glow 3s ease-in-out infinite;
}

@keyframes tracker-entry-glow {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 12px rgba(139, 92, 246, 0.1); }
}

.tracker-entry-color {
  width: 4px;
  height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tracker-entry-body { flex: 1; min-width: 0; }

.tracker-entry-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tracker-entry-cat {
  font-size: 13px;
  font-weight: 500;
  color: var(--charcoal);
}

.tracker-entry-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--stone);
  white-space: nowrap;
}

.tracker-entry-comment {
  font-size: 12px;
  color: var(--warm-gray);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracker-entry-duration {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--charcoal);
  white-space: nowrap;
}

.tracker-entry-delete {
  background: none;
  border: none;
  color: var(--warm-gray);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.2s ease;
}

.tracker-entry:hover .tracker-entry-delete { opacity: 1; }
.tracker-entry-delete:hover { color: var(--error); background: rgba(239, 68, 68, 0.1); }

.tracker-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--warm-gray);
  font-size: 14px;
}

.tracker-loading {
  text-align: center;
  padding: 40px 16px;
  color: var(--stone);
  font-size: 13px;
}

/* ── Reports ── */
.tracker-period-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.tracker-period-btn {
  padding: 8px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--stone);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tracker-period-btn:hover { border-color: #8B5CF6; color: var(--charcoal); }

.tracker-period-btn--active {
  background: rgba(139, 92, 246, 0.15);
  border-color: #8B5CF6;
  color: #8B5CF6;
  font-weight: 600;
}

.tracker-custom-range {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.tracker-custom-range span { color: var(--stone); font-size: 14px; }

.tracker-report-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.tracker-report-stat {
  text-align: center;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.tracker-report-stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: #8B5CF6;
  line-height: 1;
  margin-bottom: 4px;
}

.tracker-report-stat-label {
  font-size: 11px;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tracker-report-chart-container {
  margin-bottom: 20px;
  height: 220px;
  position: relative;
}

.tracker-report-table {
  margin-bottom: 16px;
}

.tracker-report-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tracker-report-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-color);
}

.tracker-report-table td {
  padding: 10px;
  color: var(--charcoal);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.tracker-pct-bar {
  width: 80px;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.tracker-pct-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.tracker-report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Category Management ── */
.tracker-cat-section { margin-bottom: 16px; }

.tracker-cat-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.tracker-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.tracker-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.tracker-cat-delete {
  background: none;
  border: none;
  color: var(--warm-gray);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.tracker-cat-delete:hover { color: var(--error); background: rgba(239, 68, 68, 0.1); }

/* ── Modal ── */
.tracker-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.tracker-modal-content {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.tracker-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.tracker-modal-header h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--charcoal);
  letter-spacing: 0.05em;
}

.tracker-modal-close {
  background: none;
  border: none;
  color: var(--stone);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.tracker-modal-close:hover { color: var(--error); background: rgba(239, 68, 68, 0.1); }

.tracker-modal-body { padding: 20px; }

/* ── Toast ── */
.tracker-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #8B5CF6;
  color: #FFFFFF;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tracker-toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .tracker-timer-display { font-size: 36px; }
  .tracker-timer-controls { flex-direction: column; }
  .tracker-report-summary { grid-template-columns: 1fr; }
  .tracker-manual-grid { grid-template-columns: 1fr 1fr; }
  .tracker-entry-time { display: none; }
  .tracker-sub-nav { flex-wrap: wrap; }
}

/* Tracker Mini-timer */
.tracker-mini-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
}
.tracker-mini-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  overflow: hidden;
}
.tracker-mini-cat {
  font-weight: 600;
  color: #6366F1;
  font-size: 0.85rem;
  white-space: nowrap;
}
.tracker-mini-comment {
  color: var(--stone);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tracker-mini-timer {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  color: var(--charcoal);
  font-size: 1.1rem;
  margin: 0 1rem;
}
.tracker-mini-stop {
  background: rgba(239, 68, 68, 0.05);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tracker-mini-stop:hover {
  background: rgba(239, 68, 68, 0.15);
}
.dark-extreme .tracker-mini-timer {
  color: #fff;
}
.dark-extreme .tracker-mini-comment {
  color: #aaa;
}

/* ═══ HUB VIDEO BACKGROUND ═══ */
.hub-video-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -2;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}

/* ═══ LOGIN UNIVERSE BACKGROUND — Deep Space ═══ */
.login-universe-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: #020010;
  background-image:
    /* Nebula clouds — Dragon Ball purple/blue */
    radial-gradient(ellipse at 15% 45%, rgba(120, 40, 200, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 25%, rgba(30, 60, 180, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 85%, rgba(200, 50, 30, 0.08) 0%, transparent 45%),
    radial-gradient(ellipse at 65% 15%, rgba(0, 180, 255, 0.06) 0%, transparent 40%),
    /* Star field layers */
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.8) 50%, transparent 100%),
    radial-gradient(1px 1px at 25% 55%, rgba(255,255,255,0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 40% 15%, rgba(200,220,255,0.7) 50%, transparent 100%),
    radial-gradient(1px 1px at 55% 70%, rgba(255,255,255,0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 70% 35%, rgba(255,230,200,0.7) 50%, transparent 100%),
    radial-gradient(1px 1px at 85% 80%, rgba(255,255,255,0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 5% 90%, rgba(200,200,255,0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 92% 10%, rgba(255,255,255,0.7) 50%, transparent 100%),
    radial-gradient(1px 1px at 30% 85%, rgba(255,200,150,0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 60% 45%, rgba(255,255,255,0.4) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 18% 72%, rgba(255,255,255,0.9) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 78% 58%, rgba(200,220,255,0.8) 50%, transparent 100%),
    radial-gradient(1px 1px at 48% 32%, rgba(255,255,255,0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 3% 48%, rgba(255,220,180,0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 95% 62%, rgba(255,255,255,0.7) 50%, transparent 100%);
  transition: opacity 0.6s ease;
  overflow: hidden;
}

/* Animated star layers using pseudo-elements */
.login-universe-bg::before,
.login-universe-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-universe-bg::before {
  background-image:
    radial-gradient(1px 1px at 12% 38%, rgba(255,255,255,0.9) 50%, transparent 100%),
    radial-gradient(1px 1px at 33% 12%, rgba(255,255,255,0.7) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 57% 88%, rgba(200,220,255,0.8) 50%, transparent 100%),
    radial-gradient(1px 1px at 76% 42%, rgba(255,240,200,0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 88% 72%, rgba(255,255,255,0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 44% 58%, rgba(255,255,255,0.7) 50%, transparent 100%),
    radial-gradient(2px 2px at 22% 15%, rgba(200,200,255,0.9) 50%, transparent 100%),
    radial-gradient(1px 1px at 65% 28%, rgba(255,255,255,0.6) 50%, transparent 100%);
  animation: starTwinkle1 4s ease-in-out infinite alternate;
}

.login-universe-bg::after {
  background-image:
    radial-gradient(1px 1px at 8% 65%, rgba(255,255,255,0.6) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 42% 22%, rgba(255,240,200,0.8) 50%, transparent 100%),
    radial-gradient(1px 1px at 68% 78%, rgba(255,255,255,0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 90% 35%, rgba(200,220,255,0.7) 50%, transparent 100%),
    radial-gradient(2px 2px at 52% 52%, rgba(255,200,100,1) 50%, transparent 100%),
    radial-gradient(1px 1px at 15% 82%, rgba(255,255,255,0.6) 50%, transparent 100%);
  animation: starTwinkle2 5s ease-in-out 1s infinite alternate;
}

@keyframes starTwinkle1 {
  0%   { opacity: 0.6; }
  100% { opacity: 1; }
}

@keyframes starTwinkle2 {
  0%   { opacity: 1; }
  100% { opacity: 0.5; }
}

/* ═══════════════════════════════════════════════════════════
   AI CODING ASSISTANT
═══════════════════════════════════════════════════════════ */
.ai-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
    gap: 1rem;
}

.ai-panel__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border, #334155);
}

.ai-panel__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
}

.ai-panel__model {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    background: var(--surface-2, #1e293b);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

#ai-chat-log {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0;
    min-height: 300px;
    max-height: calc(100vh - 320px);
}

.ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.ai-msg--user { align-self: flex-end; }
.ai-msg--assistant { align-self: flex-start; }

.ai-msg__bubble {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary, #f1f5f9);
    word-break: break-word;
}

.ai-msg--user .ai-msg__bubble {
    background: var(--accent, #3B82F6);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-msg--assistant .ai-msg__bubble {
    background: var(--surface-2, #1e293b);
    border: 1px solid var(--border, #334155);
    border-bottom-left-radius: 4px;
}

.ai-code {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-size: 0.82rem;
    position: relative;
}

.ai-code code {
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    color: #e2e8f0;
    white-space: pre;
}

.ai-inline {
    background: #1e293b;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85em;
    color: #93c5fd;
}

.ai-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #334155;
    color: #94a3b8;
    border: none;
    border-radius: 4px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}
.ai-copy-btn:hover { background: #475569; color: #f1f5f9; }

.ai-cursor {
    display: inline-block;
    animation: ai-blink 0.8s step-end infinite;
    color: var(--accent, #3B82F6);
}
@keyframes ai-blink { 0%,100%{opacity:1} 50%{opacity:0} }

.ai-chat-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

#ai-chat-input {
    flex: 1;
    background: var(--surface-2, #1e293b);
    border: 1px solid var(--border, #334155);
    border-radius: 10px;
    color: var(--text-primary, #f1f5f9);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    resize: none;
    min-height: 44px;
    max-height: 150px;
    font-family: inherit;
    transition: border-color 0.2s;
}
#ai-chat-input:focus {
    outline: none;
    border-color: var(--accent, #3B82F6);
}

#ai-chat-send {
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    background: var(--accent, #3B82F6);
    color: #fff;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    white-space: nowrap;
}
#ai-chat-send:hover { background: #2563eb; }
#ai-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

#ai-chat-clear {
    padding: 0.75rem;
    border-radius: 10px;
    background: var(--surface-2, #1e293b);
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border, #334155);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}
#ai-chat-clear:hover { color: #f87171; border-color: #f87171; }

.ai-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted, #64748b);
    font-size: 0.9rem;
    text-align: center;
}
.ai-empty__icon { font-size: 2.5rem; }

/* ── Attach buttons (📎 📁) ─────────────────────────── */
.ai-attach-btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border, #334155);
    background: var(--surface-2, #1e293b);
    color: var(--text-muted, #94a3b8);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s, transform 0.1s;
    padding: 0;
}
.ai-attach-btn:hover {
    border-color: #3B82F6;
    background: rgba(59,130,246,0.12);
    transform: scale(1.08);
}
.ai-attach-btn:active { transform: scale(0.95); }

/* ── Attached-files pill bar ─────────────────────────── */
.ai-attach-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 0.25rem 0.1rem;
}

.ai-file-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 2rem;
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.35);
    color: #93c5fd;
    font-size: 0.78rem;
    font-weight: 500;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-file-pill__remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.1rem;
    transition: color 0.15s;
}
.ai-file-pill__remove:hover { color: #f87171; }

/* ── Directory picker modal ──────────────────────────── */
.ai-dir-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ai-dir-modal__box {
    background: #151B2B;
    border: 1px solid #2A3441;
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
    overflow: hidden;
}

.ai-dir-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid #2A3441;
    font-weight: 600;
    color: #e2e8f0;
    font-size: 0.9rem;
}
.ai-dir-modal__header button {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.ai-dir-modal__header button:hover { color: #f87171; background: rgba(248,113,113,0.1); }

.ai-dir-modal__info {
    padding: 0.55rem 1.1rem;
    font-size: 0.8rem;
    color: #64748b;
    border-bottom: 1px solid #1a2233;
}

.ai-dir-modal__actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-bottom: 1px solid #1a2233;
}
.ai-dir-modal__actions button {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.78rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}
.ai-dir-modal__actions button:hover { border-color: #3B82F6; color: #93c5fd; }

.ai-dir-list {
    list-style: none;
    margin: 0;
    padding: 0.4rem 0;
    overflow-y: auto;
    flex: 1;
}
.ai-dir-list li label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 1.1rem;
    cursor: pointer;
    transition: background 0.15s;
}
.ai-dir-list li label:hover { background: rgba(59,130,246,0.07); }
.ai-dir-list input[type=checkbox] { accent-color: #3B82F6; flex-shrink: 0; }

.ai-dir-path {
    flex: 1;
    font-size: 0.8rem;
    color: #cbd5e1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

.ai-dir-size {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: #64748b;
}

.ai-dir-modal__footer {
    padding: 0.75rem 1.1rem;
    border-top: 1px solid #2A3441;
}

.ai-dir-load-btn {
    width: 100%;
    padding: 0.65rem;
    border-radius: 8px;
    background: #3B82F6;
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}
.ai-dir-load-btn:hover { background: #2563eb; }
.ai-dir-load-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Image thumbnails in attach bar ─────────────────────── */
.ai-img-thumb {
    position: relative;
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    overflow: visible;
    border: 1px solid rgba(59,130,246,0.35);
}
.ai-img-thumb__preview {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 7px;
    display: block;
}
.ai-img-thumb .ai-file-pill__remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1e293b;
    border: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    line-height: 1;
    padding: 0;
}

/* ── Images inside message bubbles ──────────────────────── */
.ai-msg__imgs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}
.ai-msg__img {
    max-width: 260px;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid #334155;
    cursor: zoom-in;
    transition: opacity 0.2s;
}
.ai-msg__img:hover { opacity: 0.9; }

/* ── Model selector ─────────────────────────────────────── */
.ai-model-select {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    margin-left: 0.5rem;
    outline: none;
    transition: border-color 0.2s;
}
.ai-model-select:hover, .ai-model-select:focus { border-color: #3B82F6; color: #e2e8f0; }

/* ── Header icon buttons ─────────────────────────────────── */
.ai-head-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    line-height: 1;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.ai-head-btn:hover { color: #e2e8f0; border-color: #334155; background: rgba(255,255,255,0.05); }

/* ── Token bar ───────────────────────────────────────────── */
.ai-token-bar {
    position: relative;
    height: 4px;
    background: #1e293b;
    overflow: hidden;
    flex-shrink: 0;
}
.ai-token-bar__fill {
    height: 100%;
    width: 0%;
    background: #3B82F6;
    transition: width 0.4s ease, background 0.4s ease;
    border-radius: 0 2px 2px 0;
}
.ai-token-label {
    position: absolute;
    right: 0.5rem;
    top: 6px;
    font-size: 0.68rem;
    color: #475569;
    pointer-events: none;
    white-space: nowrap;
}

/* ── System prompt panel ─────────────────────────────────── */
.ai-system-panel {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #1e293b;
    background: #0b1120;
}
.ai-system-panel__label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475569;
    margin-bottom: 0.4rem;
}
.ai-system-input {
    width: 100%;
    box-sizing: border-box;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #cbd5e1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    padding: 0.6rem 0.75rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}
.ai-system-input:focus { border-color: #3B82F6; }
.ai-system-panel__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.ai-system-btn {
    padding: 0.35rem 0.9rem;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}
.ai-system-btn:hover { border-color: #3B82F6; color: #e2e8f0; }
.ai-system-btn--primary { background: #3B82F6; border-color: #3B82F6; color: #fff; }
.ai-system-btn--primary:hover { background: #2563eb; border-color: #2563eb; }

/* ── Markdown extras ─────────────────────────────────────── */
.ai-msg__bubble h1.ai-h1,
.ai-msg__bubble h2.ai-h2,
.ai-msg__bubble h3.ai-h3 {
    margin: 0.6rem 0 0.3rem;
    font-weight: 700;
    line-height: 1.3;
}
.ai-msg__bubble h1.ai-h1 { font-size: 1.15rem; color: #e2e8f0; }
.ai-msg__bubble h2.ai-h2 { font-size: 1rem;    color: #cbd5e1; }
.ai-msg__bubble h3.ai-h3 { font-size: 0.9rem;  color: #94a3b8; }
.ai-msg__bubble hr.ai-hr {
    border: none;
    border-top: 1px solid #334155;
    margin: 0.6rem 0;
}
.ai-msg__bubble ul.ai-ul,
.ai-msg__bubble ol.ai-ol {
    margin: 0.3rem 0 0.3rem 1.25rem;
    padding: 0;
}
.ai-msg__bubble ul.ai-ul li,
.ai-msg__bubble ol.ai-ol li { margin: 0.15rem 0; line-height: 1.5; }
.ai-msg__bubble table.ai-table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
    font-size: 0.82rem;
}
.ai-msg__bubble table.ai-table td,
.ai-msg__bubble table.ai-table th {
    border: 1px solid #334155;
    padding: 0.3rem 0.6rem;
    text-align: left;
}
.ai-msg__bubble table.ai-table tr:nth-child(even) td { background: rgba(255,255,255,0.03); }

/* ── Chat history modal items ────────────────────────────── */
.ai-history-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.1rem;
    border-bottom: 1px solid #1a2233;
    transition: background 0.15s;
}
.ai-history-item:hover { background: rgba(59,130,246,0.06); }
.ai-history-item__info { flex: 1; overflow: hidden; }
.ai-history-item__name {
    font-size: 0.85rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-history-item__meta { font-size: 0.72rem; color: #64748b; margin-top: 0.1rem; }
.ai-history-load {
    flex-shrink: 0;
    background: #1e3a5f;
    border: 1px solid #3B82F6;
    border-radius: 6px;
    color: #93c5fd;
    font-size: 0.75rem;
    padding: 0.25rem 0.65rem;
    cursor: pointer;
    transition: background 0.2s;
}
.ai-history-load:hover { background: #3B82F6; color: #fff; }
.ai-history-del {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
    transition: color 0.2s;
}
.ai-history-del:hover { color: #f87171; }
