/* ── APDR Dashboard styles ── */

/* ── Black & white theme override for landing page ── */
/* Dark theme (default) for landing page */
body.landing-page {
  --red:    #c8c8c8;
  --red2:   #909090;
  --red-dim:#181818;
  --bg:     #080808;
  --bg2:    #101010;
  --bg3:    #181818;
  --border: #222222;
  --border2:#303030;
  --text:   #eeeeee;
  --muted:  #888888;
  --dim:    #404040;
}

/* Light theme override for landing page */
[data-theme="light"] body.landing-page,
[data-theme="light"].landing-page {
  --red:    #c01010;
  --red2:   #900a0a;
  --red-dim:#fde8e8;
  --bg:     #f5f5f5;
  --bg2:    #ffffff;
  --bg3:    #f0f0f0;
  --border: #dddddd;
  --border2:#f0a0a0;
  --text:   #1a0000;
  --muted:  #7a4040;
  --dim:    #b08080;
}
/* Hero */
.dash-hero {
  background: #040404;
  border-bottom: 1px solid var(--border2);
  padding: 40px 24px 30px;
}
.dash-hero-inner { max-width: 900px; margin: 0; }
.dash-hero-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 48px;
  letter-spacing: 4px;
  color: #ffffff;
  line-height: 1.05;
  margin-bottom: 8px;
}
.dash-hero-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 3px;
  margin-bottom: 12px;
}
.dash-hero-desc {
  font-size: 13px;
  color: var(--text);
  opacity: .70;
  line-height: 1.7;
  max-width: 640px;
}

/* KPI strip */
.kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border2);
}
.kpi-card {
  flex: 1 1 80px;
  background: var(--bg2);
  padding: 10px 12px;
  text-align: center;
}
.kpi-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  font-weight: 500;
  color: #dddddd;
  margin-bottom: 2px;
}
.kpi-lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}
/* grayscale KPI accent tiers */
.kpi-lo  .kpi-val { color: #c8c8c8; }
.kpi-mid .kpi-val { color: #999999; }
.kpi-hi  .kpi-val { color: #e0e0e0; }
.kpi-top .kpi-val { color: #ffffff; font-weight: 700; }

/* ── Three-column layout: left panel | center | right panel ── */
.dashboard-layout {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  align-items: start;
  border-top: 1px solid var(--border);
  padding: 12px 16px 24px;
  gap: 12px;
}

/* Side panels — full height, sticky scroll */
.side-panel {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
  border: 1px solid var(--border2);
  border-radius: 6px;
  overflow: hidden;
}
.side-panel { overflow-y: auto; }
.side-panel::-webkit-scrollbar { width: 4px; }
.side-panel::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* Center panel */
.center-panel {
  min-width: 0;
  padding: 0 14px 24px;
}

/* ── Panel chart cards (side panels) ── */
.panel-chart-card {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-chart-card:last-child { border-bottom: none; }

.panel-chart-hdr {
  padding: 7px 10px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.panel-chart-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: #f0f0f0;
}
.panel-chart-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  color: var(--dim);
  margin-top: 1px;
}
.panel-chart-body {
  padding: 8px;
  position: relative;
  height: 220px;
}
.panel-chart-body-lg { height: 380px; }
.panel-chart-body-md { height: 170px; }
.panel-chart-body-sm { height: 140px; }

/* ── Center: filter bar ── */
.center-filter {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.filter-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-right: 4px;
}
.filter-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.filter-btn:hover  { border-color: #aaaaaa; color: #cccccc; }
.filter-btn.active { background: #555555; border-color: #888888; color: #fff; }
.filter-search-wrap { margin-left: auto; }

/* ── Table section (inside center-panel) ── */
.table-hdr {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0 8px;
}
.table-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px;
  letter-spacing: 2px;
  color: #f0f0f0;
}
.table-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--muted);
}

/* Table search */
.table-search {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  outline: none;
  width: 180px;
  transition: border-color .15s;
}
.table-search:focus { border-color: #888888; }
.table-search::placeholder { color: var(--dim); }

.table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
  border: 1px solid var(--border2);
  border-radius: 4px;
}
.table-wrap::-webkit-scrollbar { height: 4px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── Data table ── */
.data-table { border-collapse: collapse; width: 100%; }
.data-table td, .data-table th { padding: 4px 7px; white-space: nowrap; }
.data-table td { font-size: 11px; border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: var(--bg3); }

/* Grouped header rows */
.hdr-group-row th, .hdr-sub-row th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  padding: 5px 7px;
  cursor: default;
  background: var(--bg3);
  border-bottom: 1px solid var(--border2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.sort-th { cursor: pointer !important; user-select: none; }
.sort-th:hover { color: #ffffff; }
.sort-th.asc::after  { content: ' ▲'; font-size: 7px; }
.sort-th.desc::after { content: ' ▼'; font-size: 7px; }

/* Column group headers — grayscale borders */
.col-group-hdr {
  text-align: center;
  font-size: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: none !important;
}
.col-rel  { color: #b0b0b0; border-top: 2px solid #b0b0b0 !important; }
.col-adj  { color: #888888; border-top: 2px solid #888888 !important; }
.col-del  { color: #ffffff; border-top: 2px solid #ffffff !important; }

/* Column tinting — subtle white tint */
.adj-col { background: rgba(255,255,255,.03) !important; }
.del-col { background: rgba(255,255,255,.06) !important; }

/* Utility */
.num-col  { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.mono-col { text-align: center; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.bold-col { font-weight: 600; }

/* Religion column shades (b&w) */
.col-hindu  { color: #d8d8d8 !important; }
.col-muslim { color: #888888 !important; }

.warn   { color: #c8c8c8 !important; }
.danger { color: #ffffff !important; }
.muted  { color: var(--muted) !important; }

.cat-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--muted);
  white-space: nowrap;
}

/* Footer */
.dash-footer {
  text-align: center;
  padding: 20px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--dim);
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 1200px) {
  .dashboard-layout { grid-template-columns: 240px 1fr 240px; }
}
@media (max-width: 900px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .side-panel {
    position: static;
    height: auto;
    overflow-y: visible;
    border-right: none;
    border-left: none;
    border-bottom: 1px solid var(--border2);
  }
  .side-panel:last-child { border-bottom: none; }
}
@media (max-width: 600px) {
  .kpi-card { flex: 1 1 44%; }
  .dash-hero-title { font-size: 32px; }
}
/* Light theme hardcoded overrides */
[data-theme="light"] .dash-hero {
  background: #fff0f0;
}
[data-theme="light"] .dash-hero-title { color: #1a0000; }
[data-theme="light"] .panel-chart-title { color: #1a0000; }
[data-theme="light"] .table-title { color: #1a0000; }
[data-theme="light"] .kpi-val { color: #1a0000; }
[data-theme="light"] .kpi-lo  .kpi-val { color: #c01010; }
[data-theme="light"] .kpi-mid .kpi-val { color: #7a4040; }
[data-theme="light"] .kpi-hi  .kpi-val { color: #900a0a; }
[data-theme="light"] .kpi-top .kpi-val { color: #000000; }
[data-theme="light"] .col-hindu  { color: #333333 !important; }
[data-theme="light"] .col-muslim { color: #c01010 !important; }
[data-theme="light"] .col-rel  { color: #333333; border-top-color: #333333 !important; }
[data-theme="light"] .col-adj  { color: #7a4040; border-top-color: #7a4040 !important; }
[data-theme="light"] .col-del  { color: #000000; border-top-color: #000000 !important; }
[data-theme="light"] .adj-col { background: rgba(0,0,0,.03) !important; }
[data-theme="light"] .del-col { background: rgba(0,0,0,.06) !important; }
[data-theme="light"] .filter-btn.active { background: #c01010; border-color: #900a0a; color: #fff; }
[data-theme="light"] .sort-th:hover { color: #000000; }