/* ============================================
   RetailIQ — Design System v2.3 (modal fix definitivo)
   ============================================ */

:root {
  --brand-primary:   #6366f1;
  --brand-secondary: #a855f7;
  --brand-accent:    #ec4899;

  --bg:        #0a0a14;
  --surface-1: rgba(30, 31, 54, 0.55);
  --surface-2: rgba(40, 42, 70, 0.65);
  --surface-3: rgba(60, 64, 100, 0.45);

  --border-1:  rgba(148, 163, 184, 0.08);
  --border-2:  rgba(148, 163, 184, 0.16);
  --border-3:  rgba(148, 163, 184, 0.28);

  --text-1: #f1f5f9;
  --text-2: #cbd5e1;
  --text-3: #94a3b8;
  --text-4: #64748b;

  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.25);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg:  0 20px 50px rgba(0,0,0,0.5);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
}

* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; margin: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, rgba(99,102,241,0.15), transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 100%, rgba(168,85,247,0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  overflow-x: hidden;
}

/* Blocca scroll body quando modale aperto */
body.modal-open { overflow: hidden; }

[x-cloak] { display: none !important; }

h1, h2, h3, h4 { letter-spacing: -0.03em; font-weight: 700; }
.h-display {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  letter-spacing: -0.04em;
}
.text-gradient {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary), var(--brand-accent));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* ==================== CARD ==================== */
.card {
  background: var(--surface-1);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-hover:hover {
  transform: translateY(-2px);
  border-color: var(--border-3);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(99,102,241,0.1);
}
.card-interactive { cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.card-interactive:hover {
  transform: translateY(-3px);
  border-color: rgba(99,102,241,0.4);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(99,102,241,0.2);
}
.card-glow { position: relative; }
.card-glow::before {
  content: ''; position: absolute; inset: -1px;
  border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary), var(--brand-accent));
  -webkit-mask: linear-gradient(#000,#000) content-box, linear-gradient(#000,#000);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.card-glow:hover::before { opacity: 1; }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: var(--r-sm);
  font-weight: 600; font-size: 0.875rem; line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
  position: relative; overflow: hidden;
  flex-shrink: 0;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: #fff;
  box-shadow: 0 4px 14px -2px rgba(99,102,241,0.5);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -2px rgba(99,102,241,0.65);
  filter: brightness(1.08);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost    { background: var(--surface-2); color: var(--text-2); border-color: var(--border-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text-1); border-color: var(--border-3); }
.btn-outline  { background: transparent; color: var(--text-2); border-color: var(--border-2); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); color: var(--text-1); }
.btn-danger   { background: rgba(239,68,68,0.15); color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.25); color: #fecaca; }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 0.95rem; }
.btn-icon { padding: 0.5rem; width: 36px; height: 36px; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 0.35rem; }

/* ==================== INPUTS ==================== */
.input,
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]),
select, textarea {
  width: 100%;
  background: rgba(15, 17, 35, 0.6);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 0.625rem 0.875rem;
  color: var(--text-1);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all 0.2s;
  outline: none;
}
input:focus, select:focus, textarea:focus, .input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: rgba(15, 17, 35, 0.9);
}
input::placeholder, textarea::placeholder { color: var(--text-4); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}
select option { background: #1a1c2e; color: var(--text-1); padding: 0.5rem; }

.input-icon { position: relative; width: 100%; }
.input-icon > svg {
  position: absolute; left: 0.875rem; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-3);
  pointer-events: none; z-index: 2;
}
.input-icon input, .input-icon > input {
  padding-left: 2.5rem !important;
  width: 100%;
}

.label {
  display: block;
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}
.hint { font-size: 0.75rem; color: var(--text-4); margin-top: 0.375rem; line-height: 1.5; }
.hint code {
  background: rgba(99,102,241,0.15); color: #a5b4fc;
  padding: 1px 6px; border-radius: 4px;
  font-size: 0.7rem; font-family: 'JetBrains Mono', Monaco, monospace;
}

/* ==================== COMBOBOX ==================== */
.combo { position: relative; width: 100%; }
.combo-btn {
  width: 100%;
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(15, 17, 35, 0.6);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 0.625rem 0.875rem;
  color: var(--text-1);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.18s;
  text-align: left;
  min-height: 40px;
  font-family: inherit;
}
.combo-btn:hover:not(:disabled) { border-color: var(--border-3); background: rgba(15, 17, 35, 0.8); }
.combo-btn.open {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: rgba(15, 17, 35, 0.9);
}
.combo-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.combo-icon { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.combo-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-value-empty { color: var(--text-4); }
.combo-chevron { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; transition: transform 0.2s; }
.combo-btn.open .combo-chevron { transform: rotate(180deg); }

/* 🔥 FIX CRITICO: z-index ALTISSIMO per stare sopra modal-overlay (9999) */
.combo-dropdown {
  position: fixed;
  background: rgba(20, 22, 40, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(99,102,241,0.4);
  border-radius: var(--r-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(99,102,241,0.1);
  z-index: 99998; /* sopra modal-overlay (9999), sotto toast (99999) */
  max-height: 340px;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: comboSlide 0.15s ease-out;
}
@keyframes comboSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.combo-search { padding: 0.5rem; border-bottom: 1px solid var(--border-1); flex-shrink: 0; position: relative; }
.combo-search > svg {
  position: absolute; left: 1rem; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-3);
  pointer-events: none;
}
.combo-search input {
  width: 100% !important;
  background: rgba(15, 17, 35, 0.7) !important;
  border: 1px solid var(--border-2) !important;
  border-radius: 6px !important;
  padding: 0.4rem 0.7rem 0.4rem 2rem !important;
  color: var(--text-1) !important;
  font-size: 0.8rem !important;
}
.combo-list { flex: 1; overflow-y: auto; padding: 0.25rem; }
.combo-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-2);
  transition: background 0.1s;
  border: none; background: transparent;
  width: 100%; text-align: left;
  font-family: inherit;
}
.combo-item:hover { background: rgba(99,102,241,0.15); color: var(--text-1); }
.combo-item.selected {
  background: linear-gradient(90deg, rgba(99,102,241,0.25), rgba(168,85,247,0.15));
  color: #fff;
}
.combo-item-icon { flex-shrink: 0; color: var(--text-3); width: 16px; height: 16px; }
.combo-item.selected .combo-item-icon { color: #a5b4fc; }
.combo-item-body { flex: 1; min-width: 0; }
.combo-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.combo-item-meta { font-size: 0.7rem; color: var(--text-4); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-empty { text-align: center; padding: 2rem 0.5rem; color: var(--text-4); font-size: 0.8rem; }
.combo-check { width: 14px; height: 14px; color: #a5b4fc; flex-shrink: 0; opacity: 0; }
.combo-item.selected .combo-check { opacity: 1; }

/* Skeleton loader per caricamento istantaneo percepito */
.skeleton {
  background: linear-gradient(90deg, rgba(99,102,241,0.05) 0%, rgba(99,102,241,0.12) 50%, rgba(99,102,241,0.05) 100%);
  background-size: 200% 100%;
  animation: skeletonWave 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
}
@keyframes skeletonWave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin: 6px 0; }
.skeleton-card { height: 140px; }

/* ==================== SIDEBAR ==================== */
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.875rem;
  border-radius: var(--r-sm);
  color: var(--text-3);
  text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  transition: all 0.2s;
  position: relative;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--surface-2); color: var(--text-1); }
.sidebar-link.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(168,85,247,0.12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.25);
}
.sidebar-link.active::before {
  content: ''; position: absolute;
  left: -0.75rem; top: 20%; bottom: 20%;
  width: 3px;
  background: linear-gradient(180deg, var(--brand-primary), var(--brand-secondary));
  border-radius: 0 3px 3px 0;
}

/* ==================== BADGES ==================== */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100%;
}
.badge > span { overflow: hidden; text-overflow: ellipsis; }
.badge-success { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.badge-info    { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }
.badge-accent  { background: rgba(236,72,153,0.15); color: #f9a8d4; border: 1px solid rgba(236,72,153,0.3); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-2); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-pulse { animation: dotPulse 2s ease-in-out infinite; box-shadow: 0 0 0 0 currentColor; }
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; }
  50%      { box-shadow: 0 0 0 6px transparent; }
}

/* ==================== ICONS ==================== */
.icon-box, .icon-box-lg {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  flex-shrink: 0; flex-grow: 0;
  aspect-ratio: 1 / 1;
}
.icon-box    { width: 40px; height: 40px; min-width: 40px; }
.icon-box-lg { width: 48px; height: 48px; min-width: 48px; }
.icon-box svg    { width: 20px; height: 20px; }
.icon-box-lg svg { width: 24px; height: 24px; }

.icon-indigo  { background: linear-gradient(135deg, #6366f1, #818cf8); color: #fff; }
.icon-purple  { background: linear-gradient(135deg, #a855f7, #c084fc); color: #fff; }
.icon-pink    { background: linear-gradient(135deg, #ec4899, #f472b6); color: #fff; }
.icon-emerald { background: linear-gradient(135deg, #10b981, #34d399); color: #fff; }
.icon-amber   { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; }
.icon-rose    { background: linear-gradient(135deg, #f43f5e, #fb7185); color: #fff; }
.icon-cyan    { background: linear-gradient(135deg, #06b6d4, #22d3ee); color: #fff; }
.icon-sky     { background: linear-gradient(135deg, #0ea5e9, #38bdf8); color: #fff; }

/* ==================== MODAL — BULLETPROOF (teleport a body) ==================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 6, 15, 0.75);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

.modal-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 2rem);
  min-height: 0;
  background: linear-gradient(180deg, rgba(30,32,55,0.97), rgba(20,22,40,0.97));
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalSlideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Modal a tutta altezza (per explorer) */
.modal-tall { height: calc(100vh - 2rem); }

.modal-header {
  flex: 0 0 auto;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center; justify-content: space-between;
  gap: 1rem;
  background: rgba(15, 17, 35, 0.4);
}
.modal-tabs {
  flex: 0 0 auto;
  padding: 0.75rem 1.5rem 0;
  border-bottom: 1px solid var(--border-1);
  background: rgba(15, 17, 35, 0.2);
}
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem;
}
.modal-footer {
  flex: 0 0 auto;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-1);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

@media (max-width: 640px) {
  .modal-overlay { padding: 0.5rem; }
  .modal-content { max-height: calc(100vh - 1rem); }
  .modal-tall    { height: calc(100vh - 1rem); }
  .modal-header, .modal-footer { padding: 1rem; }
  .modal-body { padding: 1rem; }
  .modal-tabs { padding: 0.5rem 1rem 0; }
}

@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideUp {
  from { transform: translateY(20px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ==================== SPLIT VIEW ==================== */
.split-view {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
@media (min-width: 768px) { .split-view { flex-direction: row; } }

.split-sidebar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-1);
  display: flex; flex-direction: column;
  min-height: 0;
  max-height: 40vh;
}
@media (min-width: 768px) {
  .split-sidebar {
    width: 300px;
    max-height: none;
    border-bottom: none;
    border-right: 1px solid var(--border-1);
  }
}
.split-main {
  flex: 1 1 auto;
  min-width: 0; min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ==================== TABLE ==================== */
.table-modern { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-modern th {
  text-align: left;
  font-size: 0.7rem; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.875rem 1rem;
  background: rgba(15,17,35,0.9);
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.table-modern td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-1);
  color: var(--text-2);
  font-size: 0.875rem;
  vertical-align: middle;
}
.table-modern tr:hover td { background: rgba(99,102,241,0.04); }
.table-modern tr:last-child td { border-bottom: none; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ==================== TABS ==================== */
.tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border-1);
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  padding: 0.5rem 1rem;
  border-radius: calc(var(--r-md) - 4px);
  font-size: 0.85rem; font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.2s;
  border: none; background: transparent;
  display: inline-flex;
  align-items: center; gap: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}
.tab:hover { color: var(--text-1); }
.tab.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(168,85,247,0.2));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.3);
}

/* ==================== CHIP ==================== */
.chip-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8rem; font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 0.4rem;
  flex-shrink: 0;
  font-family: inherit;
}
.chip:hover { border-color: var(--border-3); color: var(--text-1); }
.chip.active {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px -2px rgba(99,102,241,0.4);
}

.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 999px;
}
.stat {
  padding: 1.25rem;
  background: var(--surface-1);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: ''; position: absolute;
  top: 0; right: 0; width: 100px; height: 100px;
  background: radial-gradient(circle, rgba(99,102,241,0.2), transparent 70%);
  transform: translate(30%, -30%);
  pointer-events: none;
}
.stat-label { font-size: 0.75rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-value { font-size: 2rem; font-weight: 800; color: #fff; letter-spacing: -0.03em; margin-top: 0.5rem; line-height: 1; }

/* ==================== EMPTY STATE ==================== */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; }
.empty-state-icon {
  width: 72px; height: 72px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(168,85,247,0.15));
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(99,102,241,0.3);
  animation: float 4s ease-in-out infinite;
}
.empty-state-icon svg { width: 32px; height: 32px; color: #a5b4fc; }
.empty-state-title { font-size: 1.15rem; font-weight: 700; color: var(--text-1); margin: 0.5rem 0; }
.empty-state-text { color: var(--text-3); font-size: 0.875rem; max-width: 380px; margin: 0 auto 1.25rem; line-height: 1.6; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ==================== HINT BOX ==================== */
.hint-box {
  padding: 0.875rem 1rem;
  border-radius: var(--r-md);
  display: flex; gap: 0.75rem;
  font-size: 0.85rem; line-height: 1.55;
  border: 1px solid;
}
.hint-box-info    { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.25); color: #bfdbfe; }
.hint-box-warning { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.25); color: #fde68a; }
.hint-box-success { background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.25); color: #a7f3d0; }
.hint-box-tip     { background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(168,85,247,0.06)); border-color: rgba(99,102,241,0.25); color: #c7d2fe; }
.hint-box > svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.hint-box strong { color: #fff; font-weight: 700; }

.steps { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.step { flex: 1; height: 4px; border-radius: 999px; background: var(--surface-3); transition: background 0.3s; }
.step.done, .step.active { background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary)); }
.step.active { box-shadow: 0 0 10px rgba(99,102,241,0.5); }

/* ==================== TOAST ==================== */
#toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 99999;
  display: flex; flex-direction: column;
  gap: 0.5rem;
  max-width: calc(100vw - 3rem);
}
.toast {
  padding: 0.875rem 1.125rem;
  border-radius: var(--r-md);
  font-size: 0.875rem;
  backdrop-filter: blur(16px);
  border: 1px solid;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex; align-items: center; gap: 0.65rem;
}
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast-success { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.4); color: #a7f3d0; }
.toast-error   { background: rgba(239,68,68,0.15);  border-color: rgba(239,68,68,0.4);  color: #fecaca; }
.toast-info    { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.4); color: #c7d2fe; }
.toast-warning { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.4); color: #fde68a; }
@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(99,102,241,0.2);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #475569; background-clip: padding-box; border: 2px solid transparent; }

.prose-ai { color: var(--text-2); font-size: 0.9rem; line-height: 1.7; word-wrap: break-word; }
.prose-ai h1, .prose-ai h2, .prose-ai h3 { color: #fff; margin: 1.2em 0 0.5em; font-weight: 700; letter-spacing: -0.02em; }
.prose-ai h1 { font-size: 1.35rem; }
.prose-ai h2 { font-size: 1.15rem; }
.prose-ai h3 { font-size: 1rem; }
.prose-ai p  { margin: 0.6em 0; }
.prose-ai ul, .prose-ai ol { margin: 0.6em 0 0.6em 1.5em; }
.prose-ai li { margin: 0.35em 0; }
.prose-ai strong { color: #fff; font-weight: 700; }
.prose-ai em { color: #c7d2fe; }
.prose-ai code {
  background: rgba(99,102,241,0.15); color: #c7d2fe;
  padding: 0.1em 0.45em; border-radius: 5px;
  font-family: 'JetBrains Mono', Monaco, monospace;
  font-size: 0.85em; word-break: break-word;
}
.prose-ai pre {
  background: rgba(5,6,15,0.7);
  padding: 1em; border-radius: var(--r-md);
  overflow-x: auto;
  border: 1px solid var(--border-2);
  margin: 0.8em 0;
}
.prose-ai blockquote {
  border-left: 3px solid var(--brand-primary);
  padding-left: 1em; margin: 1em 0;
  color: var(--text-3); font-style: italic;
}
.prose-ai a { color: #a5b4fc; text-decoration: underline; word-break: break-all; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fadeIn { animation: fadeIn 0.4s ease-out both; }

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.gradient-animated {
  background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899, #6366f1);
  background-size: 300% 300%;
  animation: gradientShift 12s ease infinite;
}

@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -40px) scale(1.08); }
  66%      { transform: translate(-30px, 30px) scale(0.95); }
}
.blob { animation: floatBlob 20s ease-in-out infinite; }

.hover-glow:hover { box-shadow: 0 0 30px -5px rgba(99,102,241,0.6); }
.kbd {
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  color: var(--text-2);
}
.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 768px) {
  aside.desktop-sidebar { display: none; }
  main { padding: 1rem !important; }
}
.list-item {
  display: block; width: 100%; text-align: left;
  padding: 0.75rem 0.875rem;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
  font-family: inherit;
}
.list-item:hover { background: rgba(255,255,255,0.06); border-color: var(--border-2); }
.list-item.active {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.4);
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.2);
}