/* ============================================================
   WYSISTAT ANALYTICS — Design System
   Light Mode | Inter font | Accent: Indigo
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  --bg:              #F4F6FB;
  --bg-alt:          #EDF0F7;
  --surface:         #FFFFFF;
  --surface-hover:   #F8F9FC;
  --border:          #E2E8F0;
  --border-light:    #EDF2F7;

  --text-primary:    #111827;
  --text-secondary:  #6B7280;
  --text-tertiary:   #9CA3AF;

  --accent:          #4F6EF7;
  --accent-hover:    #3B5BDB;
  --accent-light:    #EEF2FF;
  --accent-mid:      #C7D2FE;

  --success:         #10B981;
  --success-light:   #D1FAE5;
  --danger:          #EF4444;
  --danger-light:    #FEE2E2;
  --warning:         #F59E0B;
  --warning-light:   #FEF3C7;

  --sidebar-width:   230px;
  --topbar-height:   60px;

  --radius-sm:       6px;
  --radius:          10px;
  --radius-lg:       14px;
  --radius-xl:       20px;

  --shadow-sm:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:          0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg:       0 10px 30px rgba(0,0,0,.1), 0 4px 8px rgba(0,0,0,.05);

  --transition:      all .18s ease;
  --transition-slow: all .3s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ============================================================
   LAYOUT
   ============================================================ */

#app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
#sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition-slow);
}

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

.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #7C3AED);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79,110,247,.35);
}

.sidebar-logo-icon svg { color: white; }

.sidebar-logo-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: .3px;
}

/* Account selector */
.account-selector {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
}

.account-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}

.account-select-btn:hover { border-color: var(--accent-mid); background: var(--accent-light); }

.account-select-btn .account-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.account-name { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.account-chevron { color: var(--text-tertiary); flex-shrink: 0; }

/* Nav items */
.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-item.active svg { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---- Main content area ---- */
#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: hidden;
}

/* ---- Top bar ---- */
#topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

.topbar-spacer { flex: 1; }

/* Date presets */
.date-presets {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.preset-btn {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
  background: none;
  border: none;
  white-space: nowrap;
}

.preset-btn:hover { color: var(--text-primary); background: var(--surface); }
.preset-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Custom date range */
.date-range-custom {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-input {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
}

.date-input:focus { outline: none; border-color: var(--accent); }

/* Compare toggle */
.compare-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.compare-toggle:hover { border-color: var(--accent-mid); color: var(--text-primary); }
.compare-toggle.active { background: var(--accent-light); border-color: var(--accent-mid); color: var(--accent); }

.toggle-switch {
  width: 28px; height: 16px;
  background: var(--border);
  border-radius: 8px;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: white;
  transition: var(--transition);
}

.compare-toggle.active .toggle-switch { background: var(--accent); }
.compare-toggle.active .toggle-switch::after { transform: translateX(12px); }

/* ---- Page content ---- */
#page-content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  max-width: 100%;
}

/* ============================================================
   SCREENS
   ============================================================ */

.screen {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn .2s ease;
  min-width: 0;
  max-width: 100%;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   KPI CARDS
   ============================================================ */

.kpi-grid {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.kpi-card {
  flex: 1;
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--border);
  border-top: 3px solid transparent;
  border-radius: 0;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-width: 0;
  height: 98px;
  transition: var(--transition);
}

.kpi-card:last-child {
  border-right: none;
}

.kpi-card:hover {
  background: var(--surface-hover);
}

.kpi-card::before {
  display: none;
}

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -.75px;
}

.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  border-radius: 0;
  width: fit-content;
  background: transparent !important;
}

.kpi-badge.up   { color: var(--success); }
.kpi-badge.down { color: var(--danger); }
.kpi-badge.flat { color: var(--text-tertiary); }

/* Vertical highlight capsule */
.kpi-capsule {
  position: absolute;
  width: 28px;
  margin-left: -14px;
  background: rgba(229, 231, 235, 0.4);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
  pointer-events: none;
  z-index: 5;
}

.kpi-capsule-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1.5px solid white;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
  margin-top: -3px;
}

.kpi-capsule-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  color: white !important;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  margin-bottom: 2px;
}

.kpi-capsule-pill.up { background: var(--success) !important; }
.kpi-capsule-pill.down { background: var(--danger) !important; }
.kpi-capsule-pill.flat { background: var(--text-tertiary) !important; }

.kpi-sparkline {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ============================================================
   CHARTS
   ============================================================ */

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Metric selector pills */
.metric-pills {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.metric-pill {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.metric-pill:hover { color: var(--text-primary); }
.metric-pill.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* Frequency selector */
.freq-select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.freq-select:focus { outline: none; border-color: var(--accent); }

/* Field selector */
.field-select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.field-select:focus { outline: none; border-color: var(--accent); }

.chart-container {
  position: relative;
  height: 280px;
}

.chart-container.tall { height: 350px; }

/* Legend */
.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.legend-item:hover { color: var(--text-primary); }

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-line {
  width: 16px; height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
}

/* ============================================================
   TWO-COLUMN LAYOUT
   ============================================================ */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.two-col.wide-left { grid-template-columns: 3fr 2fr; }
.two-col.wide-right { grid-template-columns: 2fr 3fr; }

/* ============================================================
   TABLES
   ============================================================ */

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
}

.table-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
}

/* Search input */
.search-input {
  padding: 6px 10px 6px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--bg);
  color: var(--text-primary);
  width: 180px;
  transition: var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 8px center;
}

.search-input:focus { outline: none; border-color: var(--accent); width: 220px; }

/* Data table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .6px;
  text-align: left;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.data-table thead th:hover { color: var(--text-primary); }

.data-table thead th.sorted { color: var(--accent); }

.sort-icon { display: inline-block; margin-left: 4px; opacity: .5; }
.sort-icon.asc::after  { content: ' ↑'; }
.sort-icon.desc::after { content: ' ↓'; }

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-hover); }

.data-table tbody td {
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text-primary);
}

.data-table tbody td.secondary { color: var(--text-secondary); font-size: 12px; }

/* Progress bar in table */
.progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-alt);
  border-radius: 2px;
  overflow: hidden;
  min-width: 60px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s ease;
}

.progress-value { font-size: 12px; font-weight: 500; min-width: 30px; text-align: right; }

/* Table pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
}

.pagination-info { font-size: 12px; color: var(--text-secondary); }

.pagination-controls {
  display: flex;
  gap: 4px;
}

.page-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.page-btn:hover { background: var(--surface); border-color: var(--border); }
.page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.page-btn:disabled { opacity: .4; cursor: default; }

/* ============================================================
   TABS
   ============================================================ */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}

.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 99px;
  background: var(--accent-light);
  color: var(--accent);
}

/* ============================================================
   BREADCRUMB DRILL-DOWN
   ============================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.breadcrumb-item {
  cursor: pointer;
  transition: var(--transition);
}

.breadcrumb-item:hover { color: var(--accent); }

.breadcrumb-sep { color: var(--text-tertiary); }

.breadcrumb-current { color: var(--text-primary); font-weight: 500; cursor: default; }

.breadcrumb-item.clickable { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ============================================================
   MINI STAT TABLE (compact)
   ============================================================ */

.mini-list {
  display: flex;
  flex-direction: column;
}

.mini-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
}

.mini-list-item:last-child { border-bottom: none; }
.mini-list-item:hover { background: var(--surface-hover); }

.mini-list-rank {
  width: 18px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-align: center;
  flex-shrink: 0;
}

.mini-list-label {
  flex: 1;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-list-bar { flex: 1; }

.mini-list-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 50px;
  text-align: right;
}

.mini-list-pct {
  font-size: 11px;
  color: var(--text-tertiary);
  min-width: 36px;
  text-align: right;
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  max-width: 900px;
}

.settings-sidebar { /* left menu */ }

.settings-nav { display: flex; flex-direction: column; gap: 2px; }

.settings-nav-item {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-nav-item:hover { background: var(--bg); color: var(--text-primary); }
.settings-nav-item.active { background: var(--accent-light); color: var(--accent); }

/* Form */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.form-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.form-subtitle {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text-primary);
  transition: var(--transition);
}

.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,110,247,.1); }
.form-input::placeholder { color: var(--text-tertiary); }

.form-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,110,247,.3); }

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

.btn-secondary:hover { background: var(--surface-hover); border-color: var(--accent-mid); }

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

.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover { color: var(--text-primary); border-color: var(--accent-mid); }

/* Account cards in settings */
.account-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: var(--transition);
}

.account-card:hover { border-color: var(--accent-mid); }
.account-card.selected { border-color: var(--accent); background: var(--accent-light); }

.account-card-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.account-card-dot.error { background: var(--danger); }
.account-card-dot.pending { background: var(--warning); }

.account-card-info { flex: 1; }
.account-card-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.account-card-id { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }

.account-card-actions { display: flex; gap: 4px; }

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
}

.status-badge.ok      { background: var(--success-light); color: var(--success); }
.status-badge.error   { background: var(--danger-light);  color: var(--danger); }
.status-badge.testing { background: var(--warning-light); color: var(--warning); }

/* ============================================================
   LOADING STATES
   ============================================================ */

.skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border-light) 50%, var(--bg-alt) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.skeleton-kpi-card {
  height: 98px;
  flex: 1;
  border-right: 1px solid var(--border);
  border-radius: 0;
}
.skeleton-kpi-card:last-child {
  border-right: none;
}

.skeleton-chart {
  height: 280px;
  border-radius: var(--radius-lg);
}

.skeleton-row {
  height: 44px;
  margin-bottom: 2px;
  border-radius: 4px;
}

.loader-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
  backdrop-filter: blur(2px);
}

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Chart loader */
.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.8);
  border-radius: var(--radius-lg);
  z-index: 5;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state svg { opacity: .3; margin-bottom: 16px; }
.empty-state h3 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; max-width: 320px; }

/* ============================================================
   NOTIFICATIONS / TOAST
   ============================================================ */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--text-primary);
  color: white;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInRight .25s ease, fadeOut .4s ease 3s forwards;
  min-width: 280px;
  max-width: 380px;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--text-primary); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: fadeInModal .2s ease;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 480px;
  max-width: 95vw;
  box-shadow: var(--shadow-lg);
  animation: slideUpModal .25s ease;
}

@keyframes slideUpModal {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ============================================================
   WELCOME / SETUP SCREEN
   ============================================================ */

#setup-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 48px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.setup-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), #7C3AED);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 4px 16px rgba(79,110,247,.35);
}

.setup-title { font-size: 22px; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; }
.setup-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; }

.setup-card .form-group { text-align: left; }
.setup-card .btn { width: 100%; margin-top: 8px; }

/* ============================================================
   OVERVIEW SPECIFIC
   ============================================================ */

.overview-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Stat number large */
.stat-number {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   LOCATION
   ============================================================ */

.location-map {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.location-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.loc-bar-item {
  display: grid;
  grid-template-columns: 130px 1fr 60px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.loc-bar-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.loc-bar-fill { background: var(--bg-alt); border-radius: 3px; height: 6px; overflow: hidden; }
.loc-bar-inner { height: 100%; background: var(--accent); border-radius: 3px; transition: width .5s ease; }

.loc-bar-value { text-align: right; font-weight: 600; color: var(--text-primary); }

/* Flag emoji */
.flag { font-size: 14px; flex-shrink: 0; }

/* ============================================================
   UTILITY
   ============================================================ */

.text-accent   { color: var(--accent); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-muted    { color: var(--text-secondary); }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.text-sm       { font-size: 12px; }
.text-xs       { font-size: 11px; }
.font-bold     { font-weight: 700; }
.font-semibold { font-weight: 600; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.mt-8          { margin-top: 8px; }
.mt-12         { margin-top: 12px; }
.mb-12         { margin-bottom: 12px; }
.hidden        { display: none !important; }

/* ============================================================
   VISUALIZATIONS: FUNNEL & SUNBURST
   ============================================================ */

.visualizations-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 980px) {
  .visualizations-grid {
    grid-template-columns: 1fr;
  }
}

/* Funnel Chart */
.funnel-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px;
  justify-content: center;
}

.funnel-step-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.funnel-step {
  display: grid;
  grid-template-columns: 140px 1fr 100px;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.funnel-step:hover {
  border-color: var(--accent);
  background: var(--bg-alt);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.funnel-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel-bar-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  height: 18px;
  position: relative;
}

.funnel-bar-bg {
  width: 100%;
  height: 100%;
  background: var(--bg-alt);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.funnel-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(79, 110, 247, 0.75) 100%);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.funnel-values {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.funnel-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.funnel-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.funnel-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 800;
  user-select: none;
}

/* Sunburst Chart */
.sunburst-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 320px;
  padding: 10px;
}

.sunburst-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sunburst-container svg {
  max-width: 100%;
  max-height: 100%;
}

.sunburst-slice {
  stroke: var(--surface);
  stroke-width: 1.5px;
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.sunburst-slice:hover {
  filter: brightness(1.15) contrast(1.05);
}

.sunburst-slice.fade {
  opacity: 0.25;
}

.sunburst-slice.root {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1px;
}

.sunburst-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.08);
}

.sunburst-tooltip-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.sunburst-tooltip-val {
  color: rgba(255,255,255,0.85);
}

/* ============================================================
   MULTI-ACCOUNTS PAGE STYLES
   ============================================================ */

.multi-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.multi-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.multi-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.multi-subtitle {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.multi-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Account checkboxes */
.multi-accounts-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.multi-account-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.multi-account-checkbox:hover {
  border-color: var(--accent-mid);
  color: var(--text-primary);
}

.multi-account-checkbox.checked {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-hover);
  font-weight: 600;
}

.multi-account-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.multi-acc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.multi-acc-name {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multi-acc-id {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: normal;
}

/* Periods banner */
.multi-periods-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  flex-wrap: wrap;
}

.period-badge-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.period-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.period-dot.current { background: var(--accent); }
.period-dot.compare { background: var(--text-tertiary); }

.period-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.period-days-badge {
  background: var(--bg-alt);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.period-sep {
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-size: 10px;
}

/* Multi table cells */
.multi-metric-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-cell-val {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.metric-cell-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.metric-prev {
  color: var(--text-tertiary);
  font-weight: 400;
}

.multi-table tfoot td {
  border-top: 2px solid var(--border);
  padding: 12px 14px;
}

/* Ascenseur horizontal propre et toujours visible pour le grand tableau multi-comptes */
.multi-table-scroll-container {
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
  scrollbar-color: #94A3B8 #F1F5F9;
}

.multi-table-scroll-container::-webkit-scrollbar {
  height: 12px;
}

.multi-table-scroll-container::-webkit-scrollbar-track {
  background: #F1F5F9;
  border-radius: 6px;
}

.multi-table-scroll-container::-webkit-scrollbar-thumb {
  background: #94A3B8;
  border-radius: 6px;
  border: 2px solid #F1F5F9;
}

.multi-table-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.multi-table {
  min-width: max-content;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.multi-table th,
.multi-table td {
  white-space: nowrap;
  min-width: 125px;
  padding: 10px 14px;
}

/* Colonne compte figée sur la gauche lors du scroll horizontal */
.multi-table th:first-child,
.multi-table td:first-child {
  min-width: 220px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.08);
}

.multi-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 25;
  background: var(--bg);
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.08);
}

/* Multi-Table Summary Top Row */
.multi-summary-row td {
  background: #F1F5F9 !important;
  border-bottom: 2px solid var(--accent) !important;
  padding: 12px 14px !important;
}

.multi-summary-row td:first-child {
  position: sticky;
  left: 0;
  z-index: 20; /* Supérieur aux cellules sticky standard (z-index: 2) pour que le tooltip passe au-dessus */
  background: #F1F5F9 !important;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.08);
}

.multi-summary-row:hover td:first-child,
.multi-summary-row:focus-within td:first-child,
.multi-table td:has(.info-picto-wrap:hover),
.multi-table th:has(.info-picto-wrap:hover) {
  z-index: 60 !important;
}

.multi-summary-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 12.5px;
}

.multi-summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-light);
  color: var(--accent-hover);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--accent-mid);
}

.multi-chart-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border-light);
}

.multi-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Multi-chart permanent KPI badges */
.multi-chart-kpis {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  border: 1px solid var(--border-light);
}

.chart-kpi-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.chart-kpi-label {
  font-weight: 600;
  color: var(--text-primary);
}

.account-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
}

.account-refresh-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(90deg);
}

/* Multi charts grid */
.multi-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 14px;
}

.multi-chart-card {
  margin-bottom: 0;
}

.multi-summary-chart-card {
  border: 1.5px solid var(--accent);
  background: linear-gradient(180deg, var(--surface) 0%, rgba(79, 110, 247, 0.02) 100%);
  grid-column: 1 / -1;
}

@media (max-width: 1200px) {
  .multi-charts-grid { grid-template-columns: 1fr; }
}

/* Source Badges */
.badge-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 6px;
  vertical-align: middle;
}

.badge-source.profile {
  background: #EEF2FF;
  color: #4F6EF7;
  border: 1px solid #C7D2FE;
}

.badge-source.individual {
  background: #FEF3C7;
  color: #D97706;
  border: 1px solid #FDE68A;
}

/* ============================================================
   THEMES & BULK ACTIONS STYLES
   ============================================================ */

/* Theme Pills on cards and tables */
.theme-pills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1.5px 7px;
  border-radius: 10px;
  background: var(--surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  line-height: 1.3;
}

.theme-pill.theme-presse   { background: #EFF6FF; color: #2563EB; border-color: #BFDBFE; }
.theme-pill.theme-sante    { background: #ECFDF5; color: #059669; border-color: #A7F3D0; }
.theme-pill.theme-sport    { background: #FFFBEB; color: #D97706; border-color: #FDE68A; }
.theme-pill.theme-meteo    { background: #F0FDF4; color: #0284C7; border-color: #BAE6FD; }
.theme-pill.theme-cuisine  { background: #FFF1F2; color: #E11D48; border-color: #FECDD3; }
.theme-pill.theme-custom   { background: #F5F3FF; color: #7C3AED; border-color: #DDD6FE; }

/* Theme Selector Chips (clickable in forms and modals) */
.theme-selector-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.theme-chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.theme-chip.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-hover);
  font-weight: 600;
}

.theme-chip.active::after {
  content: '✓';
  font-size: 11px;
}

/* Bulk Toolbar in Settings */
.bulk-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
  border-radius: var(--radius-sm);
  color: var(--accent-hover);
}

/* Multi-Themes Filter Bar in Multi-Accounts Page */
.multi-themes-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.themes-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.themes-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.theme-filter-chip {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.theme-filter-chip:hover {
  border-color: var(--accent-mid);
  color: var(--text-primary);
}

.theme-filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.themes-quick-actions {
  display: flex;
  gap: 6px;
}

/* Account card with mass select checkbox */
.account-card-cb {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: var(--accent);
  margin-right: 4px;
}

/* Themes Manager in Settings */
.theme-manager-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  gap: 12px;
}

.theme-manager-row:hover {
  border-color: var(--accent-mid);
  background: var(--surface-hover);
}

.theme-manager-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.theme-manager-count {
  font-size: 11.5px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.theme-manager-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* CSV Dropzone & Batch Import */
.csv-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.csv-dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.csv-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: scale(1.01);
}


/* ============================================================
   RESPONSIVE (tablet)
   ============================================================ */

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 60px; }

  .sidebar-logo-text, .sidebar-logo-sub,
  .nav-item span, .nav-section-label,
  .account-name, .account-chevron { display: none; }

  .account-select-btn { padding: 8px; justify-content: center; }
  .account-dot { margin: 0; }

  .nav-item { justify-content: center; padding: 10px; }
  .nav-item::before { display: none; }

  .sidebar-footer .nav-item span { display: none; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .two-col.wide-left, .two-col.wide-right { grid-template-columns: 1fr; }

  #topbar { padding: 0 14px; gap: 8px; }
  .topbar-title { display: none; }
  .date-presets .preset-btn:nth-child(n+4) { display: none; }
  #page-content { padding: 14px; }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .overview-bottom { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* Observatoire Dé-saisonnalisé Styles */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.macro-dist-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.macro-dist-row {
  display: grid;
  grid-template-columns: 140px 1fr 90px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.macro-dist-label {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.macro-dist-track {
  background: var(--bg-alt);
  border-radius: 4px;
  height: 14px;
  overflow: hidden;
  position: relative;
}

.macro-dist-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.macro-dist-val {
  text-align: right;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* ============================================================
   MULTI-ACCOUNTS TABLE COLUMNS SELECTOR DROPDOWN
   ============================================================ */

.multi-columns-badge {
  background: var(--accent);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.2;
}

.multi-columns-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1050;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  width: 290px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
}

.multi-columns-dropdown-menu.hidden {
  display: none !important;
}

.multi-col-group-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-top: 6px;
  margin-bottom: 4px;
  padding-bottom: 2px;
  border-bottom: 1px dashed var(--border);
}

.multi-col-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.multi-col-item:hover {
  background: var(--bg);
}

.multi-col-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent);
}

.multi-col-quick-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  gap: 6px;
}

.multi-col-quick-actions button {
  font-size: 10.5px;
  padding: 2px 6px;
}

/* ============================================================
   COLLAPSIBLE MULTI SELECTOR & ERGONOMIE MULTI / SINGLE
   ============================================================ */

.multi-selector-collapsible {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: var(--transition);
}

.multi-selector-collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.multi-selector-collapsible-header:hover {
  background: var(--bg-alt);
}

.multi-collapse-icon {
  display: inline-block;
  font-size: 10px;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.multi-selector-collapsible.collapsed .multi-collapse-icon {
  transform: rotate(-90deg);
}

.multi-selector-collapsible.collapsed .multi-selector-collapsible-body {
  display: none;
}

.multi-selector-collapsible-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border);
}

/* Tooltips & Pictos d'aide */
.info-picto-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
  cursor: help;
  vertical-align: middle;
  margin-left: 4px;
}

.info-picto-wrap:hover,
.info-picto-wrap:focus-within {
  z-index: 100;
}

.info-picto {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.info-picto-wrap:hover .info-picto {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-mid);
}

.info-tooltip-content {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  max-width: 90vw;
  background: #0F172A;
  color: #F8FAFC;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  line-height: 1.45;
  font-weight: 400;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: normal;
  border: 1px solid rgba(255,255,255,0.1);
}

.info-picto-wrap:hover .info-tooltip-content {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(2px);
}

/* Graph Account Header Link & Themes */
.chart-account-title-link {
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-account-title-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chart-account-themes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

/* Trends zones badges */
.trend-zone-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.trend-zone-badge.up {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.25);
}

.trend-zone-badge.down {
  background: rgba(239, 68, 68, 0.12);
  color: #DC2626;
  border-color: rgba(239, 68, 68, 0.25);
}

.trend-zone-badge.stable {
  background: rgba(107, 114, 128, 0.12);
  color: #4B5563;
  border-color: rgba(107, 114, 128, 0.25);
}

/* ============================================================
   STYLES D'IMPRESSION & EXPORT PDF (FICHE COMPTE)
   ============================================================ */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .sidebar,
  .topbar,
  .multi-actions,
  #single-api-inspector-card,
  #single-account-id-badge,
  #single-account-selector-row,
  .single-account-selector-row,
  #toast-container,
  .modal-overlay,
  .account-refresh-btn,
  #single-columns-toggle-btn,
  .metric-switch {
    display: none !important;
  }
  .app-container {
    display: block !important;
  }
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .screen {
    display: none !important;
  }
  #screen-single.active,
  #screen-single {
    display: block !important;
  }
  .chart-card,
  .table-card,
  .multi-header-card {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}



