/* ============================================================
   TAKEOUT FINDER — Design System
   ============================================================ */

/* ── 1. Tokens ─────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-deep:    #040810;
  --bg-base:    #080e1a;
  --bg-raised:  #0d1525;
  --bg-card:    #111c30;
  --bg-glass:   rgba(13, 21, 37, 0.85);

  /* Borders */
  --border:       rgba(120, 150, 210, 0.07);
  --border-soft:  rgba(120, 150, 210, 0.12);
  --border-hover: rgba(120, 150, 210, 0.22);

  /* Accent — indigo-violet */
  --accent:       #818cf8;
  --accent-dark:  #6366f1;
  --accent-dim:   rgba(129, 140, 248, 0.12);
  --accent-glow:  rgba(129, 140, 248, 0.35);

  /* Semantic */
  --green:  #34d399;
  --green-dim: rgba(52, 211, 153, 0.15);
  --amber:  #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.15);
  --red:    #f87171;
  --red-dim: rgba(248, 113, 113, 0.15);
  --blue:   #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.15);

  /* Text */
  --text-1: #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #546179;
  --text-4: #2f3a4e;

  /* Sidebar */
  --sidebar-w: 64px;
  --sidebar-bg: #050a14;

  /* Sizes */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  /* Transitions */
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Font */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow:    0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.6);
  --shadow-accent: 0 0 24px rgba(129, 140, 248, 0.25);
}

/* ── 2. Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── 3. Scroll ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-soft); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── 4. Splash ─────────────────────────────────────────────── */
#app { height: 100vh; display: flex; flex-direction: column; }

.splash {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-deep);
  z-index: 200;
  animation: splashFadeIn 0.4s ease;
}
.splash.hide {
  animation: splashFadeOut 0.4s ease forwards;
  pointer-events: none;
}
.splash-inner { text-align: center; }
.splash-icon-wrap {
  width: 160px; height: 160px; margin: 0 auto 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-accent);
  animation: iconPulse 1.4s ease infinite;
  overflow: hidden;
}
.splash-icon-wrap .logo-img {
  width: 100%; height: 100%; object-fit: contain;
  padding: 12px;
  clip-path: inset(0 round var(--radius-xl));
  mix-blend-mode: screen;
}
.splash-title { font-size: 26px; font-weight: 700; color: var(--text-1); letter-spacing: -0.5px; }
.splash-sub { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.splash-bar {
  width: 160px; height: 2px; background: var(--border);
  border-radius: 1px; margin: 20px auto 0; overflow: hidden;
}
.splash-bar-fill {
  height: 100%; width: 40%; background: var(--accent);
  border-radius: 1px;
  animation: splashSlide 1.2s ease-in-out infinite;
}
@keyframes splashFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes splashFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes iconPulse {
  0%, 100% { box-shadow: 0 0 24px rgba(129,140,248,0.25); }
  50%       { box-shadow: 0 0 40px rgba(129,140,248,0.5); }
}
@keyframes splashSlide {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(150%); }
  100% { transform: translateX(-100%); }
}

/* ── 5. App Shell ──────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── 6. Sidebar ────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 2px;
  z-index: 10;
}
.sidebar-logo {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--t-base);
  cursor: pointer;
}
.sidebar-logo:hover {
  transform: scale(1.05);
}
.sidebar-logo .favicon-img {
  width: 100%; height: 100%; object-fit: contain;
  padding: 4px;
  clip-path: inset(0 round var(--radius));
  mix-blend-mode: screen;
}
.sidebar-divider {
  width: 28px; height: 1px;
  background: var(--border);
  margin: 8px 0;
}
.sidebar-spacer { flex: 1; }
.nav-item {
  position: relative;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--text-3);
  font-size: 20px;
  transition: color var(--t-base), background var(--t-base);
  cursor: pointer;
}
.nav-item:hover:not(.nav-disabled) {
  color: var(--text-2);
  background: rgba(255,255,255,0.04);
}
.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 12px rgba(129,140,248,0.2);
}
.nav-item.nav-disabled {
  cursor: default;
  opacity: 0.35;
}
.nav-item.nav-detected:not(.nav-disabled) {
  opacity: 0.55;
}
.nav-item .nav-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}
/* Tooltip on sidebar items */
.nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-item:hover::after { opacity: 1; }

/* ── 7. Content Area ───────────────────────────────────────── */
.content-area {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-base);
}
.content-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: 56px;
  min-height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-base);
}
.content-header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  flex: 1;
}
.content-header-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
}
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── 8. Sessions Screen ────────────────────────────────────── */
.sessions-screen {
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-deep);
  padding: 0 0 48px;
}
.sessions-hero {
  padding: 64px 48px 40px;
  text-align: center;
}
.sessions-hero-icon {
  width: 200px; height: 200px;
  margin: 0 auto 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim);
  border: 1px solid rgba(129,140,248,0.2);
  border-radius: 40px;
  box-shadow: var(--shadow-accent);
  overflow: hidden;
}
.sessions-hero-icon .logo-img {
  width: 100%; height: 100%; object-fit: contain;
  padding: 20px;
  clip-path: inset(0 round 40px);
  mix-blend-mode: screen;
}
.sessions-hero h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text-1);
  margin-bottom: 10px;
}
.sessions-hero p {
  font-size: 15px;
  color: var(--text-2);
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.7;
}

.sessions-body {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}
.sessions-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 14px;
}
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
  position: relative;
  overflow: hidden;
}
.session-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-dim), transparent 60%);
  opacity: 0;
  transition: opacity var(--t-base);
  pointer-events: none;
}
.session-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-dim);
  transform: translateY(-2px);
}
.session-card:hover::before { opacity: 1; }
.session-card-head {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 14px;
  position: relative;
}
.session-card-icon {
  width: 40px; height: 40px; min-width: 40px;
  background: var(--accent-dim);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--accent);
}
.session-card-name { font-size: 15px; font-weight: 600; color: var(--text-1); }
.session-card-folder { font-size: 12px; color: var(--text-3); margin-top: 2px; word-break: break-all; }
.session-card-stats {
  display: flex; gap: 16px;
  font-size: 12px; color: var(--text-3);
}
.session-card-stat strong { color: var(--text-2); font-weight: 600; }
.session-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.session-card-time { font-size: 11px; color: var(--text-3); }
.session-card-actions {
  display: flex; gap: 6px;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.session-card:hover .session-card-actions { opacity: 1; }

.add-session-card {
  background: transparent;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  min-height: 130px;
  transition: border-color var(--t-base), background var(--t-base);
  color: var(--text-3);
  font-size: 14px; font-weight: 500;
}
.add-session-card:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dim);
  color: var(--accent);
}
.add-session-card i { font-size: 24px; }

/* Status badge */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px;
  border-radius: 100px;
}
.status-badge.done     { background: var(--green-dim);  color: var(--green); }
.status-badge.indexing { background: var(--blue-dim);   color: var(--blue); }
.status-badge.interrupted { background: var(--amber-dim); color: var(--amber); }
.status-badge.pending  { background: var(--border);     color: var(--text-3); }
.status-badge .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}
.status-badge.indexing .dot { animation: dotPulse 1s ease infinite; }
@keyframes dotPulse { 0%,100%{opacity:1;} 50%{opacity:0.3;} }

/* ── 9. Files View ─────────────────────────────────────────── */
.search-bar-wrap {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 20px;
}
.search-bar {
  display: flex; align-items: center; gap: 10px;
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.search-bar:focus-within {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.search-bar i { font-size: 18px; color: var(--text-3); }
.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-1); font-size: 14px; padding: 10px 0;
}
.search-bar input::placeholder { color: var(--text-3); }

.filter-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
}
.filter-chip:hover, .filter-chip.active {
  border-color: var(--accent-dark);
  color: var(--accent);
  background: var(--accent-dim);
}

.filter-chip.none-mode {
  border-color: var(--text-3);
  color: var(--text-2);
  background: rgba(47, 58, 78, 0.4);
}

.filter-chip.none-mode:hover {
  border-color: var(--text-2);
  background: rgba(47, 58, 78, 0.6);
}

.filter-row {
  display: flex; gap: 10px; flex-wrap: nowrap;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none; /* Hide scrollbar for cleaner look */
}
.filter-row::-webkit-scrollbar { display: none; }

/* ── 10. Table ─────────────────────────────────────────────── */
.data-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: var(--bg-raised);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th.sortable { cursor: pointer; user-select: none; position: relative; transition: all var(--t-fast); }
.data-table th.sortable:hover { color: var(--text-1); background: rgba(255,255,255,0.03); }
.data-table th.sortable.active { color: var(--accent); background: rgba(129,140,248,0.05); }
.data-table th.sortable i { font-size: 10px; margin-left: 4px; opacity: 0; transition: opacity var(--t-fast); }
.data-table th.sortable:hover i, .data-table th.sortable.active i { opacity: 1; }
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
  cursor: pointer;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.data-table td {
  padding: 11px 16px;
  color: var(--text-2);
  vertical-align: middle;
}
.data-table td.col-name { color: var(--text-1); font-weight: 500; }
.data-table td.col-path {
  color: var(--text-3); font-size: 12px; max-width: 320px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.data-table td.col-size { color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table td.col-date { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.data-table td.col-actions { text-align: right; white-space: nowrap; }
.data-table .highlight {
  background: rgba(129,140,248,0.2);
  border-radius: 2px; color: var(--accent);
}

/* ── 11. Detail Panel (slide-in) ───────────────────────────── */
.detail-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 8, 16, 0.7);
  backdrop-filter: blur(4px);
  z-index: 50;
  animation: fadeIn var(--t-base);
}
.detail-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(600px, 90vw);
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 48px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  z-index: 51;
  animation: slideInRight var(--t-slow);
}
.detail-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}
.detail-header-title {
  flex: 1; font-size: 14px; font-weight: 600; color: var(--text-1);
  word-break: break-all;
}
.detail-body {
  flex: 1; overflow-y: auto; padding: 20px;
}
.detail-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px;
}

/* ── 12. Email view ────────────────────────────────────────── */
.email-header-grid {
  display: grid; grid-template-columns: 70px 1fr;
  gap: 6px 12px; font-size: 13px;
  margin-bottom: 20px;
}
.email-header-label { color: var(--text-2); font-weight: 500; }
.email-header-value { color: var(--text-1); word-break: break-all; }
.email-body {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  max-height: 500px;
  overflow-y: auto;
}
.email-body.loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 120px; color: var(--text-3);
}

/* ── 13. MBOX filter form ──────────────────────────────────── */
.mbox-filter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.mbox-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.mbox-filter-grid .form-field.wide {
  grid-column: 1 / -1;
}

/* ── 14. Progress / Indexing ───────────────────────────────── */
.indexing-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.indexing-bar-header {
  display: flex; align-items: center; justify-content: space-between;
}
.indexing-bar-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.indexing-bar-sub { font-size: 12px; color: var(--text-3); }
.progress-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  transition: width 0.3s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}
.progress-fill.indeterminate {
  width: 40% !important;
  animation: indeterminate 1.4s ease infinite;
}
@keyframes indeterminate {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(350%); }
}

.etr-text {
  color: var(--text-2);
  margin-left: 4px;
  font-weight: 500;
}

.deep-index-dot {
  width: 8px;
  height: 8px;
  background: var(--blue);
  border-radius: 50%;
  position: relative;
  cursor: help;
  margin-right: 4px;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}
.deep-index-dot.busy {
  opacity: 1;
}
.deep-index-dot.busy::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1px solid var(--blue);
  border-radius: 50%;
  animation: dot-pulse 2s infinite;
}

@keyframes dot-pulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ── 15. Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  transition: all var(--t-fast);
  white-space: nowrap;
  cursor: pointer;
}
.btn i { font-size: 16px; }
.btn-primary {
  background: var(--accent-dark);
  color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}
.btn-secondary {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
}
.btn-secondary:hover {
  border-color: var(--border-hover);
  color: var(--text-1);
  background: var(--bg-card);
}
.btn-ghost {
  color: var(--text-3);
  padding: 6px 10px;
}
.btn-ghost:hover { color: var(--text-1); background: rgba(255,255,255,0.05); }
.btn-danger {
  background: var(--red-dim);
  border: 1px solid var(--red);
  color: var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-danger-ghost:hover {
  background: var(--red-dim);
  color: var(--red);
}
.btn-warning-ghost {
  color: var(--text-3);
}
.btn-warning-ghost:hover {
  background: var(--amber-dim);
  color: var(--amber);
}
.btn-warning-ghost.active {
  color: var(--amber);
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── 16. Form Fields ───────────────────────────────────────── */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 12px; font-weight: 500;
  color: var(--text-2); letter-spacing: 0.02em;
}
.form-input {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-1); font-size: 13px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-input:focus {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-4); }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23546179'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* ── 17. Modal ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 8, 16, 0.8);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-backdrop.hidden { display: none; }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--t-slow);
}
.modal-title {
  font-size: 17px; font-weight: 700; color: var(--text-1);
  margin-bottom: 8px;
}
.modal-sub {
  font-size: 13px; color: var(--text-2); margin-bottom: 20px; line-height: 1.6;
}
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;
}
@keyframes modalIn {
  from { opacity:0; transform:scale(0.96) translateY(8px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}

/* ── 18. Toasts ────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 300; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 280px; max-width: 400px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn 0.3s ease;
  font-size: 13px;
}
.toast.removing { animation: toastOut 0.25s ease forwards; }
.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; color: var(--text-1); }
.toast-msg { color: var(--text-2); font-size: 12px; margin-top: 1px; }
.toast.success .toast-icon { color: var(--green); }
.toast.error   .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--amber); }

/* ── 19. Tooltips ─────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text-1);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast), transform var(--t-fast);
  z-index: 1000;
  box-shadow: var(--shadow);
}
[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(-12px); }

/* Source icon indicator */
.source-indicator {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  font-size: 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-3);
  transition: all var(--t-fast);
}
.source-indicator:hover {
  background: var(--bg-card);
  border-color: var(--border-hover);
  color: var(--text-2);
}
.source-indicator.zip { color: var(--amber); background: var(--amber-dim); }
.source-indicator.direct { color: var(--blue); background: var(--blue-dim); }
.toast.info    .toast-icon { color: var(--blue); }
@keyframes toastIn  { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { to   { opacity:0; transform:translateX(20px); } }

/* ── 19. Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--text-3);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; color: var(--text-2); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; max-width: 340px; margin: 0 auto; }

/* ── 20. Breadcrumb ────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-3); flex-wrap: wrap;
}
.breadcrumb-sep { opacity: 0.4; }
.breadcrumb-item { cursor: pointer; }
.breadcrumb-item:hover { color: var(--text-1); }
.breadcrumb-item.active { color: var(--text-2); cursor: default; }

/* ── 21. Icon badge / file type ─────────────────────────────── */
.file-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 18px; flex-shrink: 0;
}
.file-icon.icon-zip  { background:rgba(251,191,36,0.15);  color:var(--amber); }
.file-icon.icon-mbox { background:var(--accent-dim);      color:var(--accent); }
.file-icon.icon-img  { background:var(--green-dim);       color:var(--green); }
.file-icon.icon-doc  { background:var(--blue-dim);        color:var(--blue); }
.file-icon.icon-json { background:rgba(251,191,36,0.15);  color:var(--amber); }
.file-icon.icon-other{ background:var(--border);          color:var(--text-3); }

/* ── 22. Stats row ─────────────────────────────────────────── */
.stats-row {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.stat-card {
  flex: 1; min-width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label { font-size: 11px; color: var(--text-2); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-1); margin-top: 4px; }
.stat-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── 23. Permission banner ─────────────────────────────────── */
.permission-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--amber-dim);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}
.permission-banner i { color: var(--amber); font-size: 20px; flex-shrink: 0; }
.permission-banner-text { flex: 1; color: var(--text-1); }
.permission-banner-text small { display: block; color: var(--text-2); font-size: 12px; }

/* ── 24. Result count / pagination ─────────────────────────── */
.results-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-3);
  margin-bottom: 10px;
}
.results-meta strong { color: var(--text-2); }

.badge-cap {
  display: inline-flex; align-items: center;
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 100px;
  font-size: 10px; font-weight: 600;
  padding: 1px 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: middle;
}

.load-more-wrap {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 0 6px;
  justify-content: center;
}
.load-more-hint {
  font-size: 12px; color: var(--text-3);
}
.load-more-end {
  font-size: 12px; color: var(--text-3);
  display: flex; align-items: center; gap: 8px;
}
.load-more-end i { color: var(--green); }

/* ── 25. Spinner ───────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner.lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 26. Compat warning ────────────────────────────────────── */
.compat-screen {
  height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-deep);
  padding: 24px;
}
.compat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 480px; width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.compat-box i { font-size: 48px; color: var(--amber); margin-bottom: 20px; }
.compat-box h2 { font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.compat-box p { color: var(--text-2); line-height: 1.7; }

/* ── 27. Utility ───────────────────────────────────────────── */
.hidden     { display: none !important; }
.flex-1     { flex: 1; }
.text-muted { color: var(--text-3); }
.text-accent{ color: var(--accent); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-red   { color: var(--red); }
.font-mono  { font-family: var(--font-mono); font-size: 12px; }
.truncate   { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.mt-1 { margin-top: 6px; }
.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; }

/* ── 28. Animations ────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slideInUp {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.anim-fade-in { animation: fadeIn var(--t-base); }
.anim-slide-up { animation: slideInUp 0.3s ease; }

/* ── 29. Compat — no dark preference override (already dark) ─ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
