/* ─── Variables ───────────────────────────────────────────────────────────── */
:root {
  --bg:         #060810;
  --surface:    #0C1018;
  --surface2:   #121820;
  --surface3:   #1A2230;
  --border:     #1C2638;
  --border2:    #243044;
  --text:       #E4EAF4;
  --text2:      #9AAABB;
  --muted:      #526070;
  --accent:     #3B82F6;
  --accent-h:   #2563EB;
  --success:    #22C55E;
  --error:      #EF4444;
  --warn:       #F59E0B;
  --radius:     10px;
  --radius-lg:  14px;
  --sidebar-w:  240px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ─── Nav ─────────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(6, 8, 16, 0.9);
  backdrop-filter: blur(14px);
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.3px;
}
.logo-icon { font-size: 18px; }
.logo-text  { color: var(--text); }

.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-email  { color: var(--muted); font-size: 12px; margin-right: 4px; }

/* Tier badge in nav */
.tier-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid;
  margin-right: 6px;
}
.tier-badge.tier-free {
  background: rgba(154, 170, 187, 0.10);
  color: var(--text2);
  border-color: var(--border2);
}
.tier-badge.tier-creator {
  background: rgba(59, 130, 246, 0.14);
  color: #93B8FF;
  border-color: rgba(59, 130, 246, 0.45);
}
.tier-badge.tier-pro {
  background: linear-gradient(135deg, rgba(59,130,246,0.22), rgba(139,92,246,0.22));
  color: #C7B6FF;
  border-color: rgba(139, 92, 246, 0.5);
}

/* Language picker (landing nav) */
.lang-picker {
  position: relative;
  margin-right: 4px;
}
.lang-picker > #lang-current {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.lang-picker > #lang-current:hover {
  border-color: var(--accent);
  color: var(--text);
}
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  min-width: 160px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
}
.lang-menu.hidden { display: none; }
.lang-menu .lang-item {
  background: transparent;
  border: 0;
  color: var(--text2);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
  font-family: inherit;
  transition: all 0.12s;
}
.lang-menu .lang-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.lang-menu .lang-item.active {
  background: rgba(51, 144, 236, 0.12);
  color: var(--accent);
}

/* RTL adjustments for landing */
html[dir="rtl"] #landing { direction: rtl; }
html[dir="rtl"] #landing .hero,
html[dir="rtl"] #landing .pricing-header { text-align: center; }
html[dir="rtl"] .lang-menu { right: auto; left: 0; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
  background: var(--accent-h);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59, 130, 246, 0.06);
}
.btn-lg    { padding: 12px 26px; font-size: 15px; border-radius: 10px; }
.btn-sm    { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; }

/* ─── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  max-width: 680px;
  margin: 0 auto;
  padding: 90px 24px 80px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 28px;
  letter-spacing: 0.3px;
}

.hero h1 {
  font-size: 56px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -2px;
  margin-bottom: 22px;
}

.gradient-text {
  background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 17px;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 40px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.hero-note { color: var(--muted); font-size: 12px; }

/* ─── Features ────────────────────────────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 920px;
  margin: 0 auto 80px;
  padding: 0 24px;
}

@media (max-width: 768px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .hero h1  { font-size: 36px; }
  .nav      { padding: 0 20px; }
}

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: border-color 0.2s, background 0.2s;
}
.feature:hover { border-color: var(--border2); background: var(--surface2); }
.feature-icon  { font-size: 22px; margin-bottom: 12px; }
.feature h4    { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.feature p     { font-size: 12px; color: var(--muted); line-height: 1.65; }

/* ─── Pricing ─────────────────────────────────────────────────────────────── */
.pricing {
  max-width: 1000px;
  margin: 0 auto 100px;
  padding: 0 24px;
}

.pricing-header {
  text-align: center;
  margin-bottom: 32px;
}
.pricing-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 16px;
}
.pricing-header h2 {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -1.8px;
  line-height: 1.1;
  color: var(--text);
}

.pricing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 48px;
}
.ptog-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
  user-select: none;
}
.ptog-label.active { color: var(--text); }
.ptog-label:hover  { color: var(--text); }
.ptog-save {
  display: inline-block;
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 100px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.2px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: stretch;
}

@media (max-width: 768px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-header h2 { font-size: 32px; }
}

/* Base card */
.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 26px 26px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s, transform 0.2s;
}
.pricing-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}

/* Featured card */
.pricing-card-featured {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.12),
    0 12px 48px rgba(99, 102, 241, 0.1),
    inset 0 1px 0 rgba(255,255,255,0.04);
  transform: translateY(-4px);
}
.pricing-card-featured:hover {
  border-color: rgba(99, 102, 241, 0.65);
  transform: translateY(-6px);
}

/* Badge */
.plan-badge {
  position: absolute;
  top: -12px;
  left: 24px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text2);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* Plan name */
.plan-name {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 18px;
}

/* Price row */
.plan-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}
.plan-amount {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -3px;
  color: var(--text);
  line-height: 1;
}
.plan-period {
  font-size: 14px;
  color: var(--muted);
}

/* Description */
.plan-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  min-height: 18px;
  margin-bottom: 20px;
}

/* Buttons */
.plan-btn {
  width: 100%;
  padding: 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  margin-bottom: 0;
}
.plan-btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
}
.plan-btn-ghost:hover {
  border-color: var(--text2);
  color: var(--text);
}
.plan-btn-primary {
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
}
.plan-btn-primary:hover {
  background: #fff;
}

/* Divider */
.plan-divider {
  height: 1px;
  background: var(--border);
  margin: 22px 0 20px;
}

/* Feature list */
.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.plan-features li {
  font-size: 13px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.3;
}
.pf-dim { color: var(--muted) !important; }

.pf-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--success);
}
.pf-x { color: var(--muted); }

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 28px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ─── Auth ────────────────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 0%, rgba(59,130,246,0.05) 0%, transparent 70%);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.auth-logo {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
}

.auth-card h2 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: -0.4px;
}
.auth-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 22px;
}

.google-btn-wrap { display: flex; justify-content: center; margin-bottom: 4px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-card input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.15s;
}
.auth-card input:focus { border-color: var(--accent); }
.auth-card input::placeholder { color: var(--muted); }
.auth-card .btn-block { margin-top: 6px; padding: 11px; font-size: 14px; }

.auth-switch {
  margin-top: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ─── Shared components ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-wide { grid-column: 1 / -1; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-header h3 { font-size: 13px; font-weight: 600; }

.muted  { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

/* ─── Status dots ─────────────────────────────────────────────────────────── */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green { background: var(--success); }
.dot-red   { background: var(--error); }
.dot-gray  { background: var(--border2); }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  60%       { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
}
.dot-green { animation: pulse-green 2.5s infinite; }

/* ─── API Key ─────────────────────────────────────────────────────────────── */
.apikey-row { margin-top: 12px; }
.apikey-row code {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-family: "SF Mono", "Fira Mono", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text2);
}
.apikey-full {
  display: block;
  background: var(--bg);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-family: "SF Mono", "Fira Mono", monospace;
  word-break: break-all;
  margin-top: 10px;
  color: var(--accent);
}

/* Link code */
.big-code {
  display: block;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: "SF Mono", "Fira Mono", monospace;
  color: var(--accent);
  flex: 1;
  user-select: all;
  word-break: break-all;
}
.code-copy-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.code-copy-row .btn { white-space: nowrap; padding: 0 14px; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ─── Table ───────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }

.status-done    { color: var(--success); font-weight: 500; }
.status-error   { color: var(--error);   font-weight: 500; }
.status-running { color: var(--warn);    font-weight: 500; }
.status-pending { color: var(--muted); }

/* ─── Messages ────────────────────────────────────────────────────────────── */
.msg-error {
  background: rgba(239, 68, 68, 0.07);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
}
.msg-success {
  background: rgba(34, 197, 94, 0.07);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #4ade80;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}
.msg-warn { color: var(--warn); font-size: 12px; margin-bottom: 4px; }

#new-apikey-box {
  margin-top: 14px;
  padding: 14px;
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 10px;
}

/* ─── Field label ─────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ─── Input / Select ──────────────────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--muted); }

/* ─── Toggle switch ───────────────────────────────────────────────────────── */
.mode-toggle-wrap { display: flex; align-items: center; gap: 8px; }
.mode-label { font-size: 13px; color: var(--muted); min-width: 46px; text-align: right; }

.toggle-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.toggle-label { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.toggle-desc  { font-size: 12px; color: var(--muted); line-height: 1.65; max-width: 340px; }

.toggle-switch {
  flex-shrink: 0;
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  margin-top: 2px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.toggle-track::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(18px); background: #fff; }

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 340px;
  max-width: 90vw;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.modal h3    { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.modal .muted { font-size: 13px; margin-bottom: 16px; }

/* ─── Offline banners ─────────────────────────────────────────────────────── */
.offline-banner {
  background: rgba(245, 158, 11, 0.08);
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  font-size: 13px;
  padding: 9px 24px;
  text-align: center;
}
.back-online-banner {
  background: rgba(16, 185, 129, 0.08);
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
  color: #34d399;
  font-size: 13px;
  padding: 9px 24px;
  text-align: center;
}
.back-online-banner a { color: #34d399; font-weight: 600; }

/* Link */
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }


/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════════════════════ */

#dashboard {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.dash-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.dash-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  padding: 16px 0 20px;
  overflow-y: auto;
  min-height: 0;
}

.sb-section { padding: 0 12px; }

/* Push the last .sb-section (download) to the bottom */
.dash-sidebar > .sb-section:last-child { margin-top: auto; }

.sb-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  padding: 0 4px;
}

.sb-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* Status items */
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: 8px;
  transition: background 0.15s;
  cursor: default;
}
.sb-item:hover { background: var(--surface2); }

.sb-dot-wrap {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  flex-shrink: 0;
}

.sb-item-body { flex: 1; min-width: 0; }

.sb-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.sb-item-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Sidebar nav */
.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 8px;
}

.sb-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  width: 100%;
  position: relative;
}
.sb-nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.sb-nav-item.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sb-nav-icon { font-size: 14px; flex-shrink: 0; }

.sb-download-btn {
  display: block;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.sb-download-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}

/* ─── Main content ────────────────────────────────────────────────────────── */
.dash-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--bg);
}

/* ─── Tab panels ──────────────────────────────────────────────────────────── */
.tab-panel { max-width: 820px; }
.tab-panel.hidden { display: none; }

.tab-header { margin-bottom: 24px; }
.tab-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.tab-sub { font-size: 13px; color: var(--muted); }

/* ─── Setup steps ─────────────────────────────────────────────────────────── */
.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.setup-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.25s, background 0.25s;
}
.setup-step.done {
  border-color: rgba(34, 197, 94, 0.2);
  background: rgba(34, 197, 94, 0.025);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.setup-step.done .step-num {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.step-body  { flex: 1; }
.step-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.step-desc  { font-size: 12px; color: var(--muted); line-height: 1.65; margin-bottom: 10px; }
.step-desc:last-child { margin-bottom: 0; }
.step-desc strong { color: var(--text2); }
.step-desc em     { color: var(--text2); font-style: normal; }
.step-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-hint    { font-size: 11px; color: var(--muted); }
.step-hint code {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
}

.step-check { font-size: 18px; flex-shrink: 0; margin-top: 3px; }

/* ─── API Key box ─────────────────────────────────────────────────────────── */
.setup-apikey-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.setup-apikey-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

/* ─── Drive selector ──────────────────────────────────────────────────────── */
.drive-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 6px;
  transition: border-color 0.15s, background 0.15s;
}
.drive-item:hover { background: var(--surface2); border-color: var(--border2); }
.drive-item.selected {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.07);
}
.drive-icon { font-size: 18px; flex-shrink: 0; }
.drive-name { font-size: 13px; font-weight: 500; }
.drive-path { font-size: 11px; color: var(--muted); }

/* ─── Files layout ────────────────────────────────────────────────────────── */
.files-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.files-col-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.files-col-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 2px;
}

.browser-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.browser-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  min-height: 40px;
  background: var(--surface2);
}

.fs-breadcrumb {
  font-size: 11px;
  color: var(--muted);
  font-family: "SF Mono", "Fira Mono", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.fs-entries {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}

.fs-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  transition: background 0.1s;
}
.fs-entry.is-dir { cursor: pointer; }
.fs-entry.is-dir:hover { background: var(--surface2); }
.fs-icon { font-size: 14px; flex-shrink: 0; }
.fs-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Settings tab ────────────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

/* ─── Mobile dashboard layout ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  .dash-main { padding: 16px 12px; }
  .tab-panel { max-width: 100%; }

  /* Sidebar becomes a sticky bottom bar on mobile so main content fills the viewport. */
  .dash-layout { flex-direction: column; }
  .dash-sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 12px;
    border-right: none;
    border-top: 1px solid var(--border);
    order: 2;                       /* push sidebar below the main pane */
    position: sticky;
    bottom: 0;
    z-index: 20;
  }
  .dash-sidebar .sb-section { padding: 0; }
  .dash-sidebar .sb-section:first-of-type,
  .dash-sidebar .sb-divider { display: none; }   /* hide status/dividers on mobile */
  .dash-sidebar .sb-nav { display: flex; gap: 4px; flex-direction: row; }
  .dash-sidebar > .sb-section:last-child { margin-top: 0; }
  .sb-nav-item {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 100px;
    font-size: 13px;
    white-space: nowrap;
  }

  /* Files: stack the two columns on mobile, drop the column rule that splits */
  .files-layout { grid-template-columns: 1fr !important; gap: 14px; }

  /* Sub-tabs scroll horizontally if needed */
  .files-subtabs { overflow-x: auto; }
}
