/* ── App Shell & Protected Views ── */

/* ── App Shell layout ── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  overflow: hidden;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--t), color var(--t);
  cursor: pointer;
}
.sidebar-link .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: opacity var(--t);
}
.sidebar-link:hover { background: var(--surface2); color: var(--text); }
.sidebar-link.active {
  background: rgba(99,102,241,0.12);
  color: var(--indigo-h);
  font-weight: 600;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border-top: 1px solid var(--border);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signout-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color var(--t), background var(--t);
  display: flex;
  align-items: center;
}
.signout-btn:hover { color: var(--rose); background: rgba(244,63,94,0.1); }

/* ── Header ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.page-title { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; line-height: 1.2; }
.page-desc { font-size: 12px; color: var(--text-dim); }
.header-right { display: flex; align-items: center; gap: 10px; }
.theme-btn {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: color var(--t), background var(--t);
  display: flex;
  align-items: center;
}
.theme-btn:hover { color: var(--text); background: var(--surface2); }
html:not(.light) .moon-icon { display: block; }
html:not(.light) .sun-icon  { display: none; }
html.light .moon-icon { display: none; }
html.light .sun-icon  { display: block; }
.header-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--indigo);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background var(--t);
}
.header-add-btn:hover { background: var(--indigo-h); }

/* ── Mock banner ── */
.mock-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: rgba(245,158,11,0.08);
  border-bottom: 1px solid rgba(245,158,11,0.25);
  font-size: 13px;
  color: var(--amber);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.mock-banner svg { flex-shrink: 0; }
.mock-banner span { flex: 1; min-width: 200px; }
.banner-actions { display: flex; gap: 8px; }
.banner-btn {
  padding: 4px 12px;
  border-radius: 6px;
  background: var(--amber);
  color: #000;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.banner-btn.outline {
  background: transparent;
  color: var(--amber);
  border: 1px solid rgba(245,158,11,0.4);
}
.banner-close {
  background: none;
  border: none;
  color: var(--amber);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  opacity: 0.6;
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--t);
}
.card:hover { border-color: var(--border-h); }
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
}

/* ── Stat cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stat-card-label { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.stat-card-value { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.stat-card-sub { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.trend-up   { color: var(--emerald); }
.trend-down { color: var(--rose); }

/* ── Dashboard grid ── */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.dash-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.col-span-2 { grid-column: span 2; }

/* ── Insight cards ── */
.insight-list { display: flex; flex-direction: column; gap: 10px; }
.insight-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.insight-emoji { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.insight-body { flex: 1; }
.insight-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.insight-desc { font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* ── Chart containers ── */
.chart-wrap { width: 100%; overflow: hidden; }
.chart-empty { font-size: 13px; color: var(--text-dim); padding: 32px; text-align: center; }

/* ── Donut legend ── */
.donut-layout { display: flex; align-items: center; gap: 20px; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-name { flex: 1; }
.legend-pct { font-weight: 600; color: var(--text); }
.legend-amt { color: var(--text-dim); font-size: 11px; }

/* ── Big purchases list ── */
.purchases-list { display: flex; flex-direction: column; gap: 8px; }
.purchase-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.purchase-row:last-child { border-bottom: none; }
.purchase-rank { font-size: 12px; font-weight: 700; color: var(--text-dim); width: 18px; text-align: right; }
.purchase-info { flex: 1; min-width: 0; }
.purchase-merchant { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.purchase-date { font-size: 11px; color: var(--text-dim); }
.purchase-area-badge {
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.purchase-amount { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── Expenses page ── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input-wrap { position: relative; flex: 1; min-width: 180px; }
.search-input-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.search-input-wrap .form-input { padding-left: 34px; }
.filter-select { min-width: 130px; }
.btn-sm {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t), color var(--t);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-sm:hover { background: var(--surface2); color: var(--text); }
.btn-sm.primary {
  background: var(--indigo);
  color: #fff;
  border-color: transparent;
}
.btn-sm.primary:hover { background: var(--indigo-h); }
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.data-table th:hover { color: var(--text-2); }
.data-table td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.td-merchant { font-weight: 600; color: var(--text); max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-amount { font-weight: 700; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.area-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.actions-cell { display: flex; gap: 6px; opacity: 0; transition: opacity var(--t); }
tr:hover .actions-cell { opacity: 1; }
.action-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color var(--t), background var(--t);
  display: flex;
  align-items: center;
}
.action-btn:hover { background: var(--surface3); color: var(--text); }
.action-btn.danger:hover { color: var(--rose); background: rgba(244,63,94,0.1); }
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}
.pagination-btns { display: flex; gap: 6px; }
.page-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t);
}
.page-btn:hover:not(:disabled) { border-color: var(--border-h); color: var(--text); }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-btn.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }

/* ── Categories page ── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.category-card:hover {
  border-color: var(--border-h);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  transform: translateY(-2px);
}
.cat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cat-emoji { font-size: 22px; }
.cat-count { font-size: 11px; color: var(--text-dim); }
.cat-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.cat-total { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 10px; letter-spacing: 0; }
.progress-bar { height: 4px; background: var(--surface3); border-radius: 100px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 100px; transition: width 0.8s var(--ease); }
.cat-pct { font-size: 11px; color: var(--text-dim); margin-top: 5px; }

/* Category drilldown */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
  transition: color var(--t);
}
.back-btn:hover { color: var(--text); }
.drilldown-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.drilldown-emoji { font-size: 36px; }
.drilldown-total { font-size: 32px; font-weight: 700; letter-spacing: 0; }
.merchant-bars { display: flex; flex-direction: column; gap: 8px; }
.merchant-bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.merchant-bar-name { width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: 500; }
.merchant-bar-track { flex: 1; height: 6px; background: var(--surface3); border-radius: 100px; overflow: hidden; }
.merchant-bar-fill { height: 100%; border-radius: 100px; }
.merchant-bar-pct { width: 40px; text-align: right; font-weight: 600; color: var(--text-2); }

/* ── Insights ── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; padding: 4px; background: var(--surface2); border-radius: 10px; border: 1px solid var(--border); width: fit-content; }
.tab-btn {
  padding: 7px 18px;
  border-radius: 7px;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
}
.tab-btn.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.insight-cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 20px; }
.recurring-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.recurring-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.recurring-merchant { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recurring-months { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.recurring-avg { font-size: 18px; font-weight: 700; color: var(--indigo-h); letter-spacing: 0; }
.anomaly-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.anomaly-card {
  background: rgba(244,63,94,0.06);
  border: 1px solid rgba(244,63,94,0.25);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.anomaly-merchant { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anomaly-date { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.anomaly-amount { font-size: 18px; font-weight: 700; color: var(--rose); }
.anomaly-avg { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Time machine */
.time-machine-selectors { display: flex; gap: 20px; align-items: flex-end; margin-bottom: 24px; flex-wrap: wrap; }
.tm-select-group { display: flex; flex-direction: column; gap: 6px; }
.tm-label { font-size: 12px; font-weight: 500; color: var(--text-dim); }
.tm-selects { display: flex; gap: 6px; }
.tm-vs { display: flex; align-items: flex-end; padding-bottom: 9px; color: var(--text-dim); font-size: 13px; font-weight: 500; }
.tm-table { width: 100%; border-collapse: collapse; }
.tm-table th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.8px; border-bottom: 1px solid var(--border); }
.tm-table td { padding: 10px 12px; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--border); }
.tm-table tr:last-child td { border-bottom: none; }
.tm-area { display: flex; align-items: center; gap: 8px; }
.tm-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.delta-up   { color: var(--rose); font-weight: 600; }
.delta-down { color: var(--emerald); font-weight: 600; }
.section-label { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }

/* ── Ask AI ── */
.ask-layout { display: flex; flex-direction: column; height: calc(100vh - 60px - 64px); max-height: 720px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 0; display: flex; flex-direction: column; gap: 16px; }
.message { display: flex; gap: 10px; animation: slideIn 0.2s var(--ease); }
.message.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  align-self: flex-start;
}
.message.user .msg-avatar { background: var(--indigo); color: #fff; }
.msg-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: pre-wrap;
}
.message.user .msg-bubble {
  background: var(--indigo);
  color: #fff;
  border-color: transparent;
}
.msg-bold { font-weight: 700; }
.msg-supporting { margin-top: 12px; }
.msg-supporting-title { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.msg-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.msg-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.msg-table tr:last-child td { border-bottom: none; }
.msg-table td:last-child { font-weight: 700; color: var(--text); text-align: right; }
.typing-indicator { display: flex; gap: 4px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: fit-content; }
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); animation: spinDot 1.2s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
.example-chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--border); }
.chip {
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
}
.chip:hover { border-color: var(--indigo); color: var(--indigo-h); background: rgba(99,102,241,0.06); }
.chat-input-row { display: flex; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.chat-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.chat-input:focus { border-color: var(--border-s); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.chat-send-btn {
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--indigo);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background var(--t);
  white-space: nowrap;
}
.chat-send-btn:hover { background: var(--indigo-h); }
.chat-send-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Import wizard ── */
.wizard-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; flex-wrap: wrap; }
.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
}
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.step-num.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.step-num.done { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.step-label { font-size: 12px; color: var(--text-dim); }
.step-label.active { color: var(--text); font-weight: 500; }
.step-sep { width: 24px; height: 1px; background: var(--border); }
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 64px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--indigo);
  background: rgba(99,102,241,0.04);
}
.dropzone-icon { font-size: 48px; margin-bottom: 16px; }
.dropzone-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.dropzone-sub { font-size: 13px; color: var(--text-2); }
.mapping-grid { display: flex; flex-direction: column; gap: 12px; }
.mapping-row { display: grid; grid-template-columns: 140px 32px 1fr; align-items: center; gap: 10px; }
.mapping-label { font-size: 13px; font-weight: 500; color: var(--text); }
.mapping-arrow { color: var(--text-dim); text-align: center; }
.required-star { color: var(--rose); }
.preview-notice { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.ai-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(99,102,241,0.15);
  color: var(--indigo);
  border: 1px solid rgba(99,102,241,0.3);
}
.import-done {
  text-align: center;
  padding: 48px 24px;
}
.done-icon { font-size: 56px; margin-bottom: 16px; }
.done-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.done-sub { font-size: 14px; color: var(--text-2); margin-bottom: 28px; line-height: 1.6; }
.done-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.format-guide {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12px;
  font-family: monospace;
  color: var(--text-2);
  line-height: 1.8;
  margin-top: 16px;
  white-space: pre;
  overflow-x: auto;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-h);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s var(--ease);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal.sm { max-width: 380px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  transition: color var(--t);
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-text { font-size: 14px; color: var(--text-2); line-height: 1.6; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 0 20px 20px;
}

/* ── Mobile nav ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  transition: color var(--t);
  cursor: pointer;
}
.mobile-nav-item svg { width: 20px; height: 20px; }
.mobile-nav-item.active { color: var(--indigo-h); }
.mobile-nav-item:hover { color: var(--text-2); }

/* ── Responsive app ── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .mobile-menu-btn { display: flex; }
  .mobile-nav { display: flex; }
  .page-content { padding: 16px; padding-bottom: 80px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: auto; }
  .insight-cards-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .tm-selects { flex-direction: column; }
  .data-table .hide-sm { display: none; }
}

/* ── Sidebar mobile overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  backdrop-filter: blur(4px);
}
.sidebar.mobile-open {
  display: flex;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 95;
  animation: slideIn 0.25s var(--ease);
}

/* ── YoY chart section ── */
.yoy-section { margin-bottom: 16px; }
.yoy-legend { display: flex; gap: 16px; margin-top: 8px; }
.yoy-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.yoy-legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* ── Growth ranking ── */
.growth-list { display: flex; flex-direction: column; gap: 8px; }
.growth-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.growth-row:last-child { border-bottom: none; }
.growth-rank { font-size: 12px; font-weight: 700; color: var(--text-dim); width: 20px; }
.growth-area { display: flex; align-items: center; gap: 8px; flex: 1; }
.growth-name { font-size: 13px; font-weight: 600; color: var(--text); }
.growth-pct { font-size: 13px; font-weight: 700; }
.growth-positive { color: var(--rose); }
.growth-negative { color: var(--emerald); }
