/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light;            /* native controls (select/scrollbar) render light */
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface2: #eef1f6;
  --surface-hover: #eef1f6;
  --border: #e3e8f0;
  --accent: #4f6ef0;
  --accent-dim: #e6ecfe;
  --accent-glow: rgba(79, 110, 240, 0.10);
  --text: #1a2030;
  --text-dim: #5a6473;
  --text-muted: #9aa4b2;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --danger-dim: #fde2e2;
  --monitor: #7c3aed;
  --font: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(16,24,40,0.08), 0 1px 2px rgba(16,24,40,0.06);
  --sidebar-w: 220px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 24px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo-icon {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.logo-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: var(--text);
}

.nav-links { list-style: none; padding: 0 10px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active { background: var(--accent-glow); color: var(--accent); }
.nav-icon { font-size: 16px; line-height: 1; }

/* ── Main ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  padding: 20px 32px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* ── Stat Grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #3f5ce0; }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger-dim);
}
.btn-danger:hover { background: var(--danger-dim); }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #15803d; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Form Elements ── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  padding: 9px 12px;
  transition: border-color 0.15s;
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { resize: vertical; min-height: 80px; }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-zone input[type="file"] { display: none; }
.upload-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.upload-text { color: var(--text-dim); font-size: 13px; }
.upload-hint { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* ── Keyword Negation toolbar (compact horizontal layout) ── */
.kw-toolbar {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.kw-upload-mini {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  min-width: 150px;
}
.kw-upload-mini:hover, .kw-upload-mini.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.kw-upload-icon {
  font-size: 18px;
  opacity: 0.7;
}
.kw-upload-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.kw-upload-hint {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.2;
  margin-top: 2px;
}

.kw-tool-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  min-width: 180px;
}
.kw-tool-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}
.kw-tool-hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

.kw-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.kw-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.kw-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.kw-toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: background 0.2s;
}
.kw-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.2s, background 0.2s;
}

.kw-analyses-select {
  width: 100%;
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.kw-analyses-select:focus {
  border-color: var(--accent);
}

/* ── Provider cards (Settings page) ── */
.provider-card {
  padding: 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.provider-card:hover {
  border-color: var(--accent);
}

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  background: var(--surface);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,0,0,0.03); }

.td-mono { font-family: var(--mono); font-size: 12px; }
.td-dim { color: var(--text-dim); }
.td-truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Keyword results: sticky search-term column ── */
#results-table {
  min-width: 1800px;          /* force horizontal scroll so columns aren't crushed */
}
#results-table thead th:first-child,
#results-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 220px;
  max-width: 280px;
  box-shadow: 1px 0 0 var(--border);
}
#results-table thead th:first-child {
  z-index: 3;                 /* header above body during scroll */
}
#results-table tbody tr:hover td:first-child {
  background: rgba(91,124,250,0.06);
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.badge-negate { background: rgba(252,129,129,0.15); color: var(--danger); }
.badge-keep { background: rgba(72,187,120,0.15); color: var(--success); }
.badge-monitor { background: rgba(159,122,234,0.15); color: var(--monitor); }
.badge-pending { background: rgba(246,173,85,0.15); color: var(--warning); }
.badge-no-match { background: rgba(74,85,104,0.3); color: var(--text-muted); }

/* Score bar */
.score-cell { display: flex; align-items: center; gap: 8px; }
.score-bar-bg {
  flex: 1;
  height: 4px;
  background: var(--surface2);
  border-radius: 4px;
  max-width: 80px;
}
.score-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--danger);
  transition: width 0.3s;
}
.score-bar-fill.mid { background: var(--warning); }
.score-bar-fill.high { background: var(--success); }
.score-num { font-weight: 700; font-size: 13px; min-width: 20px; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar .search-input {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

/* ── Tab Bar ── */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 8px 18px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  border-radius: 4px 4px 0 0;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Tag (campaign labels in product table) ── */
.tag {
  display: inline-block;
  background: rgba(99,125,230,0.15);
  color: var(--accent);
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 7px;
  margin: 2px 2px 2px 0;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* ── Campaign Manager Cards ── */
.campaign-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}
.campaign-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.campaign-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.campaign-card-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.campaign-card-body {
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.campaign-product-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.campaign-product-chip .chip-sku {
  font-weight: 600;
  color: var(--text);
}
.campaign-product-chip .chip-title {
  color: var(--text-dim);
  margin-top: 1px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Progress / Status ── */
.progress-bar-wrap {
  background: var(--surface2);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.5s;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.status-processing { background: rgba(246,173,85,0.15); color: var(--warning); }
.status-completed { background: rgba(72,187,120,0.15); color: var(--success); }
.status-failed { background: rgba(252,129,129,0.15); color: var(--danger); }
.status-pending { background: rgba(74,85,104,0.2); color: var(--text-dim); }

/* ── Alert / Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slide-in 0.2s ease;
  max-width: 340px;
}
.toast-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.toast-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.toast-info { background: #e0ecff; color: #1e40af; border: 1px solid #bfdbfe; }

@keyframes slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-text { font-size: 14px; }

/* ── Misc ── */
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.text-dim { color: var(--text-dim); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-sm { font-size: 12px; }
.fw-bold { font-weight: 700; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.12);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Dashboard ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  display: block;
  transition: all 0.2s;
}
.module-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(91,124,250,0.15);
}
.module-icon { font-size: 32px; margin-bottom: 12px; }
.module-name { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.module-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* Duplicate resolution list */
.dup-list { max-height: 280px; overflow-y: auto; }
.dup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.dup-item:last-child { border-bottom: none; }
.dup-sku { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.dup-title { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.dup-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── P&L Report Module ── */

/* Upload grid */
.pl-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.pl-upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: border-color 0.2s;
}

.pl-upload-icon { font-size: 28px; opacity: 0.7; }
.pl-upload-label { font-size: 13px; font-weight: 600; color: var(--text); }
.pl-upload-hint { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.pl-upload-status { font-size: 12px; color: var(--text-muted); }

/* Drag-and-drop: the whole card is a drop target (see pl.js setup). */
.pl-upload-card::after {
  content: "or drag & drop a file here";
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.75;
}
.pl-upload-card.drag-over {
  border-color: var(--accent);
  border-style: dashed;
  background: var(--accent-glow);
}
.pl-upload-card.drag-over::after { color: var(--accent); opacity: 1; }

/* ── P&L Summary Layout ── */
.pl-summary-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ── Waterfall P&L Table ── */
.pl-waterfall-card { overflow: hidden; }

.pl-wf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pl-wf-table th {
  padding: 8px 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.pl-wf-table td {
  padding: 8px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.035);
  color: var(--text);
  vertical-align: middle;
}

.pl-wf-table tr:last-child td { border-bottom: none; }
.pl-wf-table tr:hover td { background: rgba(0,0,0,0.025); }

/* Revenue header row */
.pl-wf-header td {
  font-weight: 600;
  background: rgba(91,124,250,0.05);
  border-bottom: 1px solid var(--border) !important;
}

/* Subtotal rows (Pre-Ads P/L, Net Profit) */
.pl-wf-subtotal td {
  background: rgba(91,124,250,0.07);
  border-top: 2px solid var(--border) !important;
  border-bottom: 2px solid var(--border) !important;
  font-size: 13.5px;
}

/* Settlement transfer separator */
.pl-wf-sep td {
  border-top: 2px dashed var(--border) !important;
  color: var(--text-dim);
}

/* ── KPI Panel ── */
.pl-kpi-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-width: 240px;
  width: 260px;
  flex-shrink: 0;
}

.pl-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.pl-kpi-card.accent-red  { border-left-color: var(--danger); }
.pl-kpi-card.accent-warn { border-left-color: var(--warning); }
.pl-kpi-card.accent-green { border-left-color: var(--success); }

.pl-kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pl-kpi-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ── P&L Table shared ── */
.num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  white-space: nowrap;
}
.pos { color: var(--success) !important; }
.neg { color: var(--danger)  !important; }
.dim { color: var(--text-dim) !important; }
.zero-val { color: var(--text-muted); }

/* Sticky thead for tall P&L tables */
#category-table thead th,
#asin-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}

/* Sticky first column so you always know which row you're reading */
#category-table thead th:first-child,
#category-table tbody td:first-child,
#asin-table thead th:first-child,
#asin-table tbody td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 3;
}
#category-table thead th:first-child,
#asin-table thead th:first-child {
  z-index: 4;
}
/* Right-side shadow to indicate the column is pinned */
#category-table thead th:first-child::after,
#category-table tbody td:first-child::after,
#asin-table thead th:first-child::after,
#asin-table tbody td:first-child::after {
  content: '';
  position: absolute;
  top: 0; right: -6px; bottom: 0;
  width: 6px;
  background: linear-gradient(to right, rgba(0,0,0,0.06), transparent);
  pointer-events: none;
}
/* Keep hover backgrounds visible on the sticky cell — theme-aware (the old
   hardcoded #1e2230 fallback turned the P&L light table dark on hover). */
#category-table tr:hover td:first-child,
#asin-table tr:hover td:first-child {
  background: var(--surface2);
}
.pl-total-row td:first-child {
  background: rgba(91,124,250,0.06) !important;
}

/* Sortable column headers */
.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sortable:hover {
  color: var(--text);
  background: rgba(0,0,0,0.035);
}
.sortable::after {
  content: ' ⇅';
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.5;
}
.sortable.sort-asc::after {
  content: ' ▲';
  color: var(--accent);
  opacity: 1;
}
.sortable.sort-desc::after {
  content: ' ▼';
  color: var(--accent);
  opacity: 1;
}

/* Total row */
.pl-total-row td {
  background: rgba(91,124,250,0.06);
  font-weight: 600;
  border-top: 2px solid var(--border);
}

/* Net profit column emphasis */
.pl-profit-cell { font-size: 13px !important; }

/* Category label cell */
.pl-cat-label {
  font-size: 13px;
  max-width: 220px;
}
/* Expandable category rows → child SKUs */
.pl-cat-row .pl-cat-label { cursor: pointer; user-select: none; }
.pl-cat-row:hover .pl-cat-label { color: var(--text); }
.pl-twirl { display: inline-block; width: 14px; color: var(--text-muted); }
.pl-cat-count { font-size: 10px; color: var(--text-muted); font-weight: 400; margin-left: 4px; }
.pl-child-row td { background: rgba(127,127,127,0.035); font-size: 12px; }
.pl-child-row td.num { color: var(--text-dim); }
.pl-child-label { padding-left: 26px !important; }

/* SKU monospace code */
.sku-code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}

/* Category badge in SKU table */
.pl-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(91,124,250,0.1);
  color: var(--accent);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* Category badge (existing global .badge override for keywords) */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  background: var(--surface2);
  color: var(--text-dim);
  white-space: nowrap;
}

/* ── Filter bar ── */
.pl-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.pl-filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-right: 4px;
}

/* Utility */
.mt-8 { margin-top: 8px; }

/* ── Auth pages (login / signup) ────────────────────────────────────── */
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.auth-shell {
  width: 100%;
  max-width: 420px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: 0 24px 48px rgba(16,24,40,0.18);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--accent);
  font-weight: 600;
}
.auth-brand-logo {
  font-size: 20px;
}
.auth-brand-name {
  font-size: 14px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.auth-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 22px;
}
.auth-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.auth-google:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}
.auth-google:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-field label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}
.auth-field input {
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.auth-field input:focus {
  border-color: var(--accent);
}
.auth-hint {
  font-size: 11px;
  color: var(--text-muted);
}
.auth-error {
  background: rgba(252,129,129,0.1);
  border: 1px solid rgba(252,129,129,0.3);
  color: #fc8181;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.auth-submit {
  padding: 11px 14px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}
.auth-submit:hover { background: #4a6ce8; }
.auth-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.auth-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.auth-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.auth-footer a:hover { text-decoration: underline; }

/* ── Sidebar user block + sign-out ──────────────────────────────────── */
.sidebar-user {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
}
.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}
.sidebar-user-avatar-fallback {
  background: var(--accent-glow);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}
.sidebar-user-meta {
  min-width: 0;
  flex: 1;
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout {
  width: 100%;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.sidebar-logout:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--text-muted);
}

/* Make sidebar a column so user-block sticks to bottom */
.sidebar {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}
.sidebar-user { text-decoration: none; color: inherit; }

/* ── Nav grouping (Step 6.5 — presentation only) ── */
.nav-group { margin-bottom: 6px; }
.nav-group-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-muted); padding: 8px 24px 4px;
}

/* ── Org header / switcher ── */
.sidebar-org { padding: 0 20px 14px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.sidebar-org-label { display: block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 4px; }
.sidebar-org-name { font-size: 13px; font-weight: 600; color: var(--text); }
.sidebar-org-select { width: 100%; font-size: 13px; padding: 6px 8px; }

/* ── Mobile hamburger + off-canvas drawer (Step 6.5) ── */
.sidebar-toggle {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 60;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 18px; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.sidebar-backdrop { display: none; }
@media (max-width: 768px) {
  .sidebar-toggle { display: block; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 70;
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow);
  }
  .sidebar--open { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, 0.35); }
  .main-content { width: 100%; }
  .topbar { padding-left: 60px; }
}

/* ── GST reconciliation results ── */
.gst-recon-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}
@media (max-width: 1100px) { .gst-recon-grid { grid-template-columns: 1fr; } }
.gst-recon-right { position: sticky; top: 8px; }
.gst-alert-row {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: box-shadow 0.12s, transform 0.12s;
}
.gst-alert-row:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* Disclosure triangle that rotates when the <details> is open (files list, channels) */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary > span:first-child { display: inline-block; transition: transform 0.12s; }
details[open] > summary > span:first-child { transform: rotate(90deg); }

/* ── First-run onboarding checklist (SaaS Phase 5, Step 5.6) ─────────────────── */
#onboarding-checklist { position: fixed; right: 20px; bottom: 20px; z-index: 60; max-width: 340px; }
.onb-pill {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 9px 16px; font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.onb-pill:hover { background: var(--surface-hover); }
.onb-pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.onb-card {
  width: 340px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,0.16); padding: 16px; overflow: hidden;
}
.onb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.onb-title { font-weight: 700; font-size: 14px; color: var(--text); }
.onb-x { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 20px; line-height: 1; padding: 0 4px; }
.onb-x:hover { color: var(--text); }
.onb-bar { height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.onb-bar-fill { height: 100%; background: var(--accent); transition: width 0.25s ease; }
.onb-sub { font-size: 12px; color: var(--text-dim); margin: 8px 0 4px; }
.onb-req { color: var(--warning); font-weight: 600; }
.onb-list { list-style: none; padding: 0; margin: 6px 0 0; max-height: 46vh; overflow-y: auto; }
.onb-item { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.onb-ic { flex: 0 0 18px; text-align: center; font-weight: 700; color: var(--text-muted); }
.onb-done .onb-ic { color: var(--success); }
.onb-body { flex: 1; min-width: 0; }
.onb-step-title { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.onb-done .onb-step-title { color: var(--text-dim); text-decoration: line-through; }
.onb-dismissed .onb-step-title { color: var(--text-muted); text-decoration: line-through; }
.onb-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--warning); background: var(--accent-dim); border-radius: 4px; padding: 1px 5px; }
.onb-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.onb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; align-items: center; }
.onb-go { font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; }
.onb-go:hover { text-decoration: underline; }
.onb-link { background: none; border: none; cursor: pointer; font-size: 12px; color: var(--text-dim); padding: 0; }
.onb-link:hover { color: var(--text); text-decoration: underline; }
.onb-link.onb-mute { color: var(--text-muted); }


/* ══ P&L Report (/pl) — scoped light theme + module styles ══════════════════ */
/* P&L light theme — scoped, mirrors the Ads Optimisation module. */
.pl-light{
  --bg:#f5f7fa; --surface:#ffffff; --surface2:#f2f4f8; --border:#e6e9ef;
  --accent:#4f6ef2; --accent-dim:#c9d4fb; --accent-glow:rgba(79,110,242,0.10);
  --text:#1b2435; --text-dim:#69727e; --text-muted:#98a0ac;
  --success:#15a05a; --warning:#cf8400; --danger:#e0493a;
  --shadow:0 1px 2px rgba(16,24,40,.04),0 1px 3px rgba(16,24,40,.07);
  color:var(--text);
}
.pl-light.page-body{background:var(--bg)}
.pl-light .toast-success{background:#e7f6ec;color:#15803d;border:1px solid #bbe6c8}
.pl-light .toast-error{background:#fdeceb;color:#c0392b;border:1px solid #f3c3bd}
.pl-light .toast-info{background:#eef2fe;color:#3a52c0;border:1px solid #c9d4fb}
.pl-light .card,.pl-light .stat-card{box-shadow:var(--shadow)}
.pl-light .page-title{font-size:20px;letter-spacing:-.2px}
.pl-light .stat-card{padding:15px 18px}
.pl-light .stat-value{color:var(--text);font-size:23px;letter-spacing:-.4px}
.pl-light .stat-label{font-size:10.5px;letter-spacing:.6px}
.pl-light table th{background:var(--surface2)}
.pl-sec-title{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:var(--text-dim);margin:22px 0 10px}
.pl-card-head{padding:14px 18px 12px;border-bottom:1px solid var(--border);font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.7px;color:var(--text-dim)}

/* Action cards */
/* Action insight rows (added 2026-06-21) — each issue spans the FULL width: a fixed left label
   block (tag + count + headline) and the product chips flowing in the open space to its right.
   Full width means the chips never clip; rows stack at their natural height (no narrow columns,
   no uneven whitespace). A coloured left rule encodes severity. This replaced a 4-column card
   grid that clipped chip text and left large gaps. Collapses to one stacked column on narrow screens. */
.pl-action-grid{display:flex;flex-direction:column;gap:8px;margin:14px 0 4px}
.pl-insight{display:grid;grid-template-columns:minmax(255px,330px) 1fr;gap:10px 18px;align-items:center;background:var(--surface);border:1px solid var(--border);border-left:3px solid var(--border);border-radius:8px;box-shadow:var(--shadow);padding:11px 16px}
.pl-insight-scale{border-left-color:var(--success)}
.pl-insight-fix{border-left-color:var(--warning)}
.pl-insight-urgent{border-left-color:var(--danger)}
.pl-insight-outlier{border-left-color:var(--accent)}
.pl-insight-main{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.pl-insight-tag{font-size:10px;padding:1px 9px;border-radius:10px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;white-space:nowrap}
.pl-insight-scale .pl-insight-tag{color:var(--success);background:rgba(21,160,90,.12)}
.pl-insight-fix .pl-insight-tag{color:var(--warning);background:rgba(207,132,0,.13)}
.pl-insight-urgent .pl-insight-tag{color:var(--danger);background:rgba(224,73,58,.12)}
.pl-insight-outlier .pl-insight-tag{color:var(--accent);background:var(--accent-glow)}
.pl-insight-text{font-size:13px;color:var(--text);line-height:1.4}
.pl-insight-text b{font-size:15px;font-weight:700}
.pl-insight-sub{color:var(--text-muted);font-size:11.5px}
.pl-insight-chips{display:flex;flex-wrap:wrap;gap:5px;align-items:center}
.pl-insight-none{font-size:12px;color:var(--text-muted)}
.pl-chip{font-size:11px;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:2px 7px;color:var(--text-dim);white-space:nowrap}
.pl-chip b{color:var(--text);font-weight:600}
.pl-chip-name{display:inline-block;max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}
@media (max-width:760px){.pl-insight{grid-template-columns:1fr;gap:8px}}

/* Dashboards */
.pl-dash-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(330px,1fr));gap:14px;margin:14px 0 4px}
.pl-dash-card{background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow);overflow:hidden}
.pl-mini{width:100%;border-collapse:collapse;font-size:12.5px}
.pl-mini td{padding:7px 14px;border-bottom:1px solid var(--border)}
.pl-mini tr:last-child td{border-bottom:none}
.pl-mini td.num{text-align:right;font-variant-numeric:tabular-nums}
.pl-mini .sku-code{font-size:11.5px}
.pl-pos{color:var(--success);font-weight:600}
.pl-neg{color:var(--danger);font-weight:600}
.pl-split-row{display:flex;align-items:center;gap:12px;padding:11px 16px;border-bottom:1px solid var(--border)}
.pl-split-row:last-child{border-bottom:none}
.pl-split-lbl{flex:0 0 64px;font-weight:600;font-size:13px}
.pl-split-bar{flex:1;height:8px;border-radius:5px;background:var(--surface2);overflow:hidden}
.pl-split-fill{height:100%;border-radius:5px}
.pl-split-val{flex:0 0 auto;text-align:right;font-size:12px;color:var(--text-dim);min-width:150px}
.pl-split-val b{color:var(--text);font-weight:600}
.pl-dash-hint{font-size:12px;color:var(--text-muted);padding:16px}
.pl-dash-name{display:inline-block;max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}
.pl-light .pl-cat-label{max-width:260px}
.pl-asin-title{display:block;color:var(--text-dim);font-size:11.5px;font-weight:400;max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:1px}
/* the now-frozen first column on child/total rows must stay opaque + light */
.pl-light .pl-child-row td:first-child{background:#fafbfd}
.pl-light .pl-total-row td:first-child{background:#eef2fe !important}
.pl-twirl-empty{visibility:hidden}
/* Column selector */
.pl-col-menu{display:inline-block}
.pl-col-panel{position:absolute;right:0;top:calc(100% + 6px);z-index:60;background:var(--surface);border:1px solid var(--border);border-radius:8px;box-shadow:var(--shadow);padding:10px;width:230px;max-height:60vh;overflow:auto}
.pl-col-panel .pl-col-actions{display:flex;gap:14px;margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid var(--border)}
.pl-col-panel .pl-col-actions a{font-size:11px;font-weight:600;color:var(--accent);cursor:pointer;text-transform:uppercase;letter-spacing:.4px}
.pl-col-panel label{display:flex;align-items:center;gap:8px;padding:4px 4px;font-size:12.5px;border-radius:5px;cursor:pointer;color:var(--text)}
.pl-col-panel label:hover{background:var(--surface2)}
.pl-col-panel input[type=checkbox]{cursor:pointer;margin:0}

/* Page-scoped: P&L structural classes (moved out of the page template, Phase 6). */
.pl-session-select{width:220px}
.pl-filter-sel{width:auto;min-width:140px;flex:none}
.pl-col-menu-end{margin-left:auto;position:relative}
.pl-modal{max-width:460px}
.pl-period-box{margin-bottom:12px;padding:12px 14px;background:var(--surface2);border-radius:var(--radius-sm);border:1px solid var(--border)}
.pl-period-label{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:0.6px;color:var(--text-dim);margin-bottom:10px}
.pl-period-label-sub{font-weight:400;text-transform:none;letter-spacing:0}
.pl-modal-hint{font-size:11px;color:var(--text-muted);margin-bottom:16px}


/* ══ Ads Optimisation (/ads) — scoped light theme + module styles ═══════════ */
/* ── Light theme scoped to the Ads module (matches the reference dashboard) ── */
.ads-light{
  --bg:#f5f7fa; --surface:#ffffff; --surface2:#f2f4f8; --border:#e6e9ef;
  --accent:#4f6ef2; --accent-dim:#c9d4fb; --accent-glow:rgba(79,110,242,0.10);
  --text:#1b2435; --text-dim:#69727e; --text-muted:#98a0ac;
  --success:#15a05a; --warning:#cf8400; --danger:#e0493a;
  --shadow:0 1px 2px rgba(16,24,40,.04),0 1px 3px rgba(16,24,40,.07);
  color:var(--text);
}
.ads-light.page-body{background:var(--bg)}
/* Toasts: the dark-theme variants are unreadable on the light module — re-tint. */
.ads-light .toast-success{background:#e7f6ec;color:#15803d;border:1px solid #bbe6c8}
.ads-light .toast-error{background:#fdeceb;color:#c0392b;border:1px solid #f3c3bd}
.ads-light .toast-info{background:#eef2fe;color:#3a52c0;border:1px solid #c9d4fb}
.ads-light .card,.ads-light .stat-card{box-shadow:var(--shadow)}
.ads-light .stat-card{padding:16px 18px}
.ads-light .stat-value{color:var(--text);font-size:26px;letter-spacing:-.4px}
.ads-light .stat-label{font-size:10.5px;letter-spacing:.6px}
.ads-light .page-title{font-size:20px;letter-spacing:-.2px}
.ads-light .opt-grp td{background:#f8fafc}
.ads-light .card-title{letter-spacing:.6px}
.ads-kpi-sub{font-size:11px;font-weight:600;margin-top:5px}
/* ── Tighter / denser layout (reference is information-dense) ── */
.ads-light .topbar{padding:14px 32px 12px}
.ads-light .card{padding:15px 16px;margin-bottom:14px}
.ads-light .card-title{margin-bottom:10px;font-size:12px}
.ads-light .stat-grid{gap:12px;margin-bottom:14px;grid-template-columns:repeat(auto-fill,minmax(156px,1fr))}
.ads-light .stat-card{padding:12px 14px}
.ads-light .stat-label{margin-bottom:5px;font-size:10px}
.ads-light .stat-value{font-size:22px}
.ads-light .ads-kpi{margin-top:10px}
.ads-light .ads-tbl td{height:30px;line-height:30px}
.ads-light .ads-tbl th{padding:5px 9px}
.ads-light .ads-mini td{padding:5px 8px}
.ads-light .ads-mini th{padding:4px 8px}
.ads-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:10px 0}
/* The global .table-wrap sets overflow-x:auto, which (per CSS) forces overflow-y to
   auto and makes the wrap a scroll container — that traps position:sticky so the
   header pins to the (scrolling-away) table top instead of the page. Opt these
   tables out so the sticky column header + campaign rows pin to the page scroll. */
#ads-tbl-bids,#ads-tbl-placements,#ads-tbl-negation{overflow:visible}
.ads-tbl{width:100%;border-collapse:collapse;font-size:12px;table-layout:auto}
.ads-tbl th{position:sticky;top:0;z-index:3;background:var(--surface2);text-align:left;padding:7px 10px;font-size:10.5px;text-transform:uppercase;letter-spacing:.4px;color:var(--text-dim);white-space:nowrap;border-bottom:1px solid var(--border);cursor:pointer;user-select:none}
.ads-tbl th.num{text-align:right}
.ads-tbl td{padding:0 10px;height:34px;line-height:34px;border-bottom:1px solid var(--border);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:300px}
.ads-tbl td.num{text-align:right;font-variant-numeric:tabular-nums}
.ads-tbl tr:hover td{background:rgba(127,127,127,0.05)}
.ads-tbl input,.ads-tbl select{height:26px;padding:1px 6px;font-size:12px;box-sizing:border-box;background:var(--surface2);border:1px solid var(--border);border-radius:5px;color:var(--text)}
.ads-tbl select{min-width:96px}
/* Group rows are opt-grp*, NOT ads-grp* (2026-06-21): the class name ads-grp matches an EasyList
   cosmetic filter, so ad blockers (uBlock/AdBlock/Brave) hide these rows with display:none
   !important — the campaign rows flash on render then vanish on every tab switch. Renaming off
   the ads- prefix dodges the false positive. Do NOT rename these back to the ads- prefix. */
.opt-grp td{font-weight:600;background:var(--surface);cursor:pointer;position:sticky;top:var(--ads-thh,30px);z-index:2}
.opt-grp:hover td{background:var(--surface2)}
.opt-grp2 td{font-weight:500;background:rgba(127,127,127,0.03);cursor:pointer}
.opt-grp2:hover td{background:rgba(127,127,127,0.08)}
.ads-twirl{display:inline-block;width:16px;color:var(--text-dim)}
.opt-grpsum{color:var(--text-dim);font-weight:400}
.ads-prodtag{display:inline-block;font-size:9.5px;font-weight:700;letter-spacing:.3px;padding:1px 5px;margin-right:6px;border-radius:4px;background:var(--surface2);color:var(--text-dim);border:1px solid var(--border)}
.ads-rec{display:inline-block;font-size:10.5px;font-weight:700;color:var(--danger);background:rgba(220,70,70,.12);padding:1px 7px;border-radius:10px;margin-left:6px}
.ads-hot td:first-child{box-shadow:inset 3px 0 0 var(--danger)}
.ads-cb{vertical-align:middle;margin-right:7px;cursor:pointer}
.ads-tag{display:inline-block;font-size:11px;font-weight:600;padding:1px 7px;border-radius:4px}
.ads-act-inc{color:var(--success);background:rgba(60,170,90,.12)}
.ads-act-dec{color:var(--danger);background:rgba(220,70,70,.12)}
.ads-act-pause{color:var(--warning);background:rgba(220,160,40,.14)}
.ads-act-none{color:var(--text-dim)}
.ads-th-filter{padding:3px 6px!important}
.ads-hdr-filter{height:24px;font-size:11px;padding:0 4px;background:var(--surface);border:1px solid var(--border);border-radius:5px;color:var(--text);text-transform:none;letter-spacing:0;cursor:pointer}
.ads-detailrow td{background:var(--surface2);padding:0}
.ads-bidpanel{display:flex;flex-wrap:wrap;align-items:center;gap:22px;padding:12px 16px 12px 40px}
.ads-bidfield{display:flex;flex-direction:column;gap:3px}
.ads-bidfield label,.ads-bidreason label{font-size:9.5px;text-transform:uppercase;letter-spacing:.4px;color:var(--text-dim)}
.ads-bidfield span{font-size:13px;font-weight:600}
.ads-bidreason{flex:1;min-width:200px;display:flex;flex-direction:column;gap:3px}
.ads-bidreason span{font-size:12px;color:var(--text-dim);white-space:normal}
.ads-selbar{display:flex;align-items:center;gap:12px;margin:0 0 10px;padding:9px 14px;background:rgba(90,130,220,.10);border:1px solid var(--border);border-radius:8px}
.ads-selcount{font-size:12px;font-weight:600}
.tab-btn.locked{opacity:.55;cursor:not-allowed}
.ads-lock{font-size:11px}
.ads-prog{min-width:230px}
.ads-prog-top{display:flex;justify-content:space-between;gap:14px;font-size:12px;font-weight:600;color:var(--text);margin-bottom:5px}
.ads-prog-track{height:7px;border-radius:4px;background:var(--surface2);overflow:hidden}
.ads-prog-fill{height:100%;border-radius:4px;background:linear-gradient(90deg,var(--accent),#7aa2ff);transition:width .4s ease}
.ads-tbl td.ads-reason-cell{white-space:normal;line-height:1.45;height:auto;max-width:520px;overflow:visible;text-overflow:clip;padding:8px 10px;color:var(--text-dim);vertical-align:middle}
.ads-upload-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 20px;cursor:pointer;user-select:none}
.ads-upload-head:hover{background:var(--surface2)}
.ads-hdr-info{opacity:.6;font-size:10px;cursor:help}
.ads-negexport{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 10px}
.ads-rel{display:inline-block;min-width:22px;text-align:center;font-weight:700;font-size:11px;padding:1px 6px;border-radius:10px}
.ads-rel-hi{color:var(--success);background:rgba(60,170,90,.14)}
.ads-rel-mid{color:var(--warning);background:rgba(220,160,40,.16)}
.ads-rel-lo{color:var(--danger);background:rgba(220,70,70,.14)}
.ads-tbl td.ads-name{white-space:nowrap;max-width:none;overflow:visible}
.ads-name-txt{display:inline-block;max-width:230px;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}
/* Overview dashboard + per-tab KPI headers */
.ads-kpi{margin-top:14px}
/* Clickable Overview KPI cards (drill into the relevant tab) */
.stat-card.ads-kpi-click{cursor:pointer;transition:border-color .12s,box-shadow .12s,transform .08s}
.ads-light .stat-card.ads-kpi-click:hover{border-color:var(--accent);box-shadow:0 2px 10px rgba(79,110,242,.14)}
.stat-card.ads-kpi-click:active{transform:translateY(1px)}
.ads-kpi-go{float:right;color:var(--text-muted);font-size:14px;line-height:1}
/* Filter bar (Campaign / Ad Group / Type / Action) */
.ads-filters{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 0}
.ads-fsel{width:auto;height:30px;font-size:12px;padding:0 26px 0 9px;max-width:230px}
.ads-osel{width:auto;height:26px;font-size:11.5px;padding:0 22px 0 8px;max-width:170px}
.ads-savtag{color:var(--success);font-weight:600;text-transform:none;letter-spacing:0;font-size:11px}
.ads-note-line{font-size:11.5px;color:var(--text-dim);margin:-4px 0 8px}
.ads-mini{width:100%;border-collapse:collapse;font-size:12px}
.ads-mini th{text-align:left;color:var(--text-dim);font-size:10px;text-transform:uppercase;letter-spacing:.4px;padding:5px 8px;border-bottom:1px solid var(--border)}
.ads-mini th.num,.ads-mini td.num{text-align:right;font-variant-numeric:tabular-nums}
.ads-mini td{padding:6px 8px;border-bottom:1px solid var(--border)}
.ads-pill{display:inline-block;font-size:10px;font-weight:700;padding:1px 8px;border-radius:10px}
.ads-pill-scale{color:var(--success);background:rgba(60,170,90,.14)}
.ads-pill-neutral{color:var(--text-dim);background:rgba(127,127,127,.12)}
.ads-sev-low{color:var(--text-dim);background:rgba(127,127,127,.12)}
.ads-sev-med{color:var(--warning);background:rgba(220,160,40,.16)}
.ads-sev-high{color:#d9670b;background:rgba(217,103,11,.14)}
.ads-sev-crit{color:var(--danger);background:rgba(220,70,70,.16)}
.ads-leak-row{cursor:pointer}
.ads-leak-row:hover td{background:rgba(127,127,127,.05)}
.ads-leak-tbl td{vertical-align:middle}
.ads-negchk{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;cursor:pointer;color:var(--danger);font-weight:600}
.ads-negchk input{cursor:pointer;margin:0}
.ads-oppname{max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ads-sub-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:var(--text-dim);margin-bottom:8px}
.ads-dl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(216px,1fr));gap:12px}
.ads-dl-card{border:1px solid var(--border);border-radius:8px;padding:14px;background:var(--surface2);display:flex;flex-direction:column}
.ads-dl-title{font-weight:600;font-size:13px;margin-bottom:3px}
.ads-dl-sub{font-size:11.5px;color:var(--text-dim);margin-bottom:12px;flex:1}
.ads-dl-card .btn{text-decoration:none;align-self:flex-start}
.ads-chgtag{display:inline-block;font-size:10.5px;font-weight:700;color:var(--accent);background:rgba(91,124,250,.14);padding:1px 7px;border-radius:8px;white-space:nowrap}
.ads-dash{color:var(--text-dim)}
.ads-showmore{font-size:12px;font-weight:600;color:var(--accent);background:none;border:none;cursor:pointer;padding:2px 0}
.ads-showmore:hover{text-decoration:underline}
.ads-sortable{cursor:pointer;user-select:none;white-space:nowrap}
.ads-sortable:hover{color:var(--accent)}
.ads-leak-prod{font-size:12.5px;margin:2px 0 9px;padding:6px 10px;background:var(--surface2);border-radius:6px}
.ads-route-sub{font-size:11px;color:var(--text-dim);margin-top:1px}
.ads-leak-winner{font-weight:600}
.ads-sec-title{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:var(--text-dim);margin:18px 0 8px}
.ads-sec-title:first-child{margin-top:2px}
.ads-perf-tbl{width:100%;border-collapse:collapse}
.ads-perf-tbl th,.ads-perf-tbl td{padding:7px 10px;font-size:12.5px;border-bottom:1px solid var(--border);white-space:nowrap}
.ads-perf-tbl thead th{font-size:11px;text-transform:uppercase;letter-spacing:.4px;color:var(--text-dim);font-weight:600}
.ads-perf-tbl tbody tr:last-child td{border-bottom:none}
.ads-perf-tbl td .text-dim{font-size:11.5px}
.ads-typedot{display:inline-block;width:9px;height:9px;border-radius:2px;margin-right:6px;vertical-align:middle}
.ads-mix-row{display:flex;gap:24px;align-items:center;flex-wrap:wrap}
.ads-mix-pie{flex:0 0 140px;display:flex;flex-direction:column;align-items:center;gap:6px}
.ads-mix-tbl{flex:1 1 0;min-width:0;overflow-x:auto}
.ads-pie-cap{font-size:10.5px;color:var(--text-dim);text-transform:uppercase;letter-spacing:.4px}
.ads-problems{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:8px}
.ads-prob{display:flex;align-items:flex-start;gap:10px;font-size:13px;padding:9px 11px;border-radius:7px;background:var(--surface2);border-left:3px solid var(--text-dim)}
.ads-prob-n{flex:0 0 18px;height:18px;border-radius:50%;background:var(--surface);font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;color:var(--text-dim)}
.ads-prob-crit{border-left-color:var(--danger)}
.ads-prob-warn{border-left-color:var(--warning)}
.ads-prob-info{border-left-color:var(--accent)}

/* Page-scoped: Ads Optimisation structural classes (moved out of the template, Phase 6). */
.ads-q-input{width:240px}
.ads-check-label{font-size:12px;color:var(--text-dim);display:flex;align-items:center;gap:5px;cursor:pointer}
.ads-title-14{font-weight:600;font-size:14px}
.ads-subtext{font-size:12px;color:var(--text-dim);margin-top:2px}
.ads-upload-progress{margin-top:14px;font-size:13px;color:var(--text-dim)}
.ads-runs-head{padding:16px 20px;border-bottom:1px solid var(--border)}
.ads-runs-list{max-height:360px;overflow-y:auto}
.ads-modal{max-width:440px}
.ads-modal-text{color:var(--text-dim);font-size:13px;margin:0 0 16px}


/* ══ GST Reconciliation (/gst) — page-scoped structural classes (Phase 6) ═══════ */
.gst-month-select{width:240px}
.gst-locknote{margin-bottom:20px;border:1px solid var(--success);background:rgba(22,163,74,.08);font-size:13px}
.gst-guide-summary{padding:14px 18px;cursor:pointer;font-size:13px;font-weight:700;color:var(--text);list-style:none;display:flex;align-items:center;gap:8px}
.gst-guide-hint{font-size:11px;font-weight:500;color:var(--text-muted)}
.gst-guide-body{padding:4px 18px 18px;border-top:1px solid var(--border)}
.gst-caret{font-size:11px}
.gst-smartcard{margin-bottom:20px;border:1px solid var(--primary,#2563eb);background:var(--surface)}
.gst-flexhead{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.gst-flexgrow{flex:1;min-width:260px}
.gst-head-title{font-size:14px;font-weight:700;color:var(--text)}
.gst-head-desc{font-size:12px;color:var(--text-dim);margin-top:4px}
.gst-smart-status{margin-top:12px;font-size:12px;color:var(--text-dim)}
.gst-computed-at{font-size:11px;color:var(--text-muted);margin-top:6px}
.gst-files-summary{padding:14px 18px;cursor:pointer;font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:0.6px;color:var(--text-dim);list-style:none;display:flex;align-items:center;gap:8px}
.gst-files-count{color:var(--text-muted);font-weight:600}
.gst-files-body{border-top:1px solid var(--border)}
.gst-modal-420{max-width:420px}
.gst-modal-460{max-width:460px}
.gst-modal-720{max-width:720px;width:90%}
.gst-modal-note{font-size:11px;color:var(--text-muted);margin:12px 0 16px}
.gst-channel-note{font-size:11px;color:var(--warning);margin-bottom:12px}
.gst-alert-body{max-height:60vh;overflow-y:auto;font-size:13px}


/* ══ Shipping Label Tool (/shipping) — module + page-scoped classes ═════════ */
.filter-tab{padding:6px 14px;border-radius:6px;border:1px solid var(--border);background:transparent;color:var(--text-dim);font-size:12px;font-weight:600;cursor:pointer;transition:all 0.15s;white-space:nowrap;}
.active-tab{border-color:var(--accent);background:var(--accent-glow);color:var(--accent);}
.stat-label-sm{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.6px;color:var(--text-dim);margin-bottom:4px;white-space:nowrap;}
.stat-val{font-size:22px;font-weight:700;}
/* Page-scoped: Shipping structural classes (moved out of the template, Phase 6). */
.mt-14{margin-top:14px}
.ship-list-head{font-size:12px;font-weight:600;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.6px;margin-bottom:8px}
.ship-list-items{display:flex;flex-direction:column;gap:6px;max-height:180px;overflow-y:auto}
.ship-bar-init{width:30%}
.ship-inline-label{font-size:13px;font-weight:600;color:var(--text-dim);margin-bottom:0;text-transform:none;letter-spacing:0}
.ship-sel-240{width:240px}
.ship-summary-grid{display:grid;grid-template-columns:repeat(5,1fr)}
.ship-sb-cell{padding:16px 20px;border-right:1px solid var(--border)}
.ship-sb-action{padding:16px 20px;display:flex;align-items:center;justify-content:center}
.ship-stamp-btn{font-size:14px;padding:10px 24px}
.ship-download-box{background:rgba(72,187,120,0.1);border:1px solid var(--success);border-radius:var(--radius);padding:18px 24px;display:flex;align-items:center;justify-content:space-between}
.ship-dl-title{font-size:14px;font-weight:600;color:var(--success);margin-bottom:2px}
.ship-filter-row{display:flex;gap:8px;margin-bottom:14px;flex-wrap:wrap;align-items:center}
.ship-search{width:220px;margin-right:4px}
.ship-panel-head{padding:12px 20px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.ship-panel-head2{padding:16px 20px;border-bottom:1px solid var(--border)}
.ship-title-2{margin-bottom:2px}
.ship-dismiss-btn{font-size:11px;padding:4px 12px}
.ship-log-body{max-height:480px;overflow-y:auto}
.ship-history-list{max-height:360px;overflow-y:auto}


/* ══ Product Manager (/products) — page-scoped structural classes (Phase 6) ═════ */
.mt-6{margin-top:6px}
.mb-14{margin-bottom:14px}
.prod-bulk-bar{align-items:center;gap:12px;padding:10px 14px;margin-bottom:12px;background:var(--surface2);border:1px solid var(--border);border-radius:8px}
.prod-check-th{width:32px;text-align:center}
.prod-selall-label{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--text-dim);cursor:pointer}
.prod-card-sm{padding:12px 14px}
.prod-warn-title{font-weight:600;font-size:13px;color:var(--warning)}
.prod-chip-wrap{display:flex;flex-wrap:wrap;gap:8px}
.prod-modal-440{max-width:440px}
.prod-modal-380{max-width:380px}
.prod-modal-480{max-width:480px}
.prod-modal-660{max-width:660px}
.prod-search-row{display:flex;gap:6px;align-items:stretch}
.prod-grow0{flex:1;min-width:0}
.prod-add-btn{flex-shrink:0;padding:0 16px;font-size:20px;font-weight:600;line-height:1}
.prod-results{max-height:200px;overflow-y:auto;border:1px solid var(--border);border-radius:6px;margin-top:4px}
.prod-form-error{color:var(--danger);font-size:13px;margin-bottom:8px}
.prod-pm-error{color:var(--danger);font-size:12px;margin-top:8px}
.prod-master-group{display:flex;align-items:center;gap:10px;padding-top:22px}
.prod-checkbox{width:16px;height:16px;cursor:pointer;accent-color:var(--accent)}
.prod-check-label{margin:0;font-size:13px;font-weight:500;color:var(--text);text-transform:none;letter-spacing:0;cursor:pointer}
.prod-sub-block{font-weight:400;display:block}
.prod-bullets{display:flex;flex-direction:column;gap:6px}
.prod-bullet-ta{min-height:56px}
.prod-hint{padding:8px 0;margin-bottom:4px;color:var(--text-dim);font-size:12px}
.prod-p{margin:0 0 16px}
.prod-import-list{display:flex;flex-direction:column;gap:10px}
.prod-import-card{padding:12px 14px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.prod-btn-row{display:flex;gap:6px;flex-shrink:0}
.prod-import-results{margin-top:14px;display:flex;flex-direction:column;gap:2px}
.prod-plat-p1{color:var(--text-dim);font-size:12px;margin:0 0 4px}
.prod-plat-p2{color:var(--text-muted);font-size:12px;margin:0 0 16px}
.prod-master-code{color:var(--text);font-family:var(--mono)}
.prod-plat-list{margin-bottom:16px;display:flex;flex-direction:column;gap:6px}
.prod-hr{border:none;border-top:1px solid var(--border);margin:0 0 14px}
.prod-section-label{font-size:12px;font-weight:600;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.6px;margin-bottom:10px}
.prod-pm-row{display:flex;gap:8px;align-items:flex-end}
.prod-pm-plat{flex:0 0 140px}
.prod-mini-label{font-size:11px}
.prod-pm-select{padding:7px 10px}
.prod-pm-add{padding:8px 14px;flex-shrink:0}


/* ══ Keyword Negation (/keywords) — page-scoped structural classes (Phase 6) ═══ */
.kw-past{flex:1;min-width:240px}
.kw-empty-card{text-align:center;padding:60px 20px}
.kw-empty-icon{font-size:40px;opacity:0.2;margin-bottom:12px}

/* ══ Tax Tie-Out (/tax-tie-out) — page-scoped structural classes (Phase 6) ═════ */
.tto-toolbar{gap:12px;margin-bottom:16px;align-items:flex-end}
.tto-field{display:flex;flex-direction:column;gap:4px}
.tto-field-label{font-size:11px;color:var(--text-dim)}
.tto-sel-pl{min-width:300px}
.tto-sel-gst{min-width:180px}


/* ══ Responsive polish (Step 6.6) — fixed-column grids collapse on small screens.
   (Tables already scroll via .table-wrap overflow-x; stat grids are auto-fill.) ══ */
@media (max-width: 720px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .ship-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .ship-summary-grid .ship-sb-action { grid-column: 1 / -1; }
  .ship-download-box { flex-direction: column; align-items: flex-start; gap: 12px; }
  .db-controls { gap: 8px; }
}
@media (max-width: 440px) {
  .kpi-strip { grid-template-columns: 1fr; }
}


/* == Dashboard (/) -- page-scoped structural classes (Phase 6) ============= */
.db-controls { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:24px; }
.platform-tabs { display:flex; gap:4px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:4px; }
.platform-tab { padding:6px 14px; border-radius:4px; font-size:13px; font-weight:500; cursor:pointer; border:none; background:transparent; color:var(--text-dim); transition:all 0.15s; font-family:var(--font); }
.platform-tab.active { background:var(--accent); color:#fff; }
.platform-tab:hover:not(.active):not(:disabled) { background:var(--surface2); color:var(--text); }
.platform-tab:disabled { opacity:0.35; cursor:not-allowed; }
.db-sep { color:var(--border); font-size:20px; }
.db-select-wrap { display:flex; flex-direction:column; gap:3px; min-width:220px; }
.db-select-label { font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:0.6px; color:var(--text-muted); }
.db-select { width:100%; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text); font-family:var(--font); font-size:13px; padding:7px 10px; outline:none; }
.db-select:focus { border-color:var(--accent); }
.kpi-strip { display:grid; grid-template-columns:repeat(5,1fr); gap:12px; margin-bottom:24px; }
.kpi-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px; display:flex; flex-direction:column; gap:4px; min-width:0; }
.kpi-label { font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:0.7px; color:var(--text-muted); }
.kpi-value { font-size:22px; font-weight:700; color:var(--text); line-height:1.1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.kpi-delta { font-size:11px; font-weight:600; display:flex; align-items:center; gap:4px; }
.kpi-delta.pos { color:var(--success); } .kpi-delta.neg { color:var(--danger); } .kpi-delta.neu { color:var(--text-muted); }
.kpi-sub { font-size:11px; color:var(--text-dim); margin-top:2px; }
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.section-title { font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:0.8px; color:var(--text-dim); }
.db-table-wrap { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.db-table { width:100%; border-collapse:collapse; font-size:13px; }
.db-table th { padding:10px 14px; font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:0.6px; color:var(--text-muted); border-bottom:1px solid var(--border); white-space:nowrap; text-align:right; background:var(--surface); }
.db-table th:first-child { text-align:left; }
.db-table td { padding:11px 14px; border-bottom:1px solid var(--border); color:var(--text); text-align:right; white-space:nowrap; }
.db-table td:first-child { text-align:left; }
.db-table tr:last-child td { border-bottom:none; }
.db-table tbody tr.cat-row { cursor:pointer; transition:background 0.1s; }
.db-table tbody tr.cat-row:hover { background:var(--surface2); }
.db-table tbody tr.cat-row.expanded { background:var(--accent-glow); }
.cat-name { display:flex; align-items:center; gap:8px; font-weight:500; }
.cat-chevron { font-size:10px; color:var(--text-muted); transition:transform 0.2s; flex-shrink:0; }
.cat-row.expanded .cat-chevron { transform:rotate(90deg); }
.sku-row td { background:var(--bg); font-size:12px; color:var(--text-dim); padding:8px 14px; }
.sku-row td:first-child { padding-left:40px; }
.sku-row:last-of-type td { border-bottom:1px solid var(--border); }
.sku-loading td { text-align:center !important; color:var(--text-muted); font-style:italic; }
.total-row td { font-weight:600; color:var(--text); border-top:2px solid var(--border); background:var(--surface2); }
.num-pos { color:var(--success); } .num-neg { color:var(--danger); }
.tbl-delta { font-size:10px; padding:1px 5px; border-radius:3px; margin-left:4px; font-weight:600; }
.tbl-delta.pos { background:rgba(72,187,120,0.15); color:var(--success); }
.tbl-delta.neg { background:rgba(252,129,129,0.15); color:var(--danger); }
.db-placeholder { text-align:center; padding:60px 24px; color:var(--text-muted); }
.db-placeholder-icon { font-size:36px; margin-bottom:12px; opacity:0.4; }
.db-placeholder p { font-size:13px; }
.db-loading { display:flex; align-items:center; justify-content:center; gap:10px; padding:40px; color:var(--text-dim); font-size:13px; }
