:root {
  --bg: #0A0A0A;
  --card: #141414;
  --border: #1E1E1E;
  --text: #FFFFFF;
  --muted: #71717A;
  --muted-2: #52525B;
  --accent: #4A9FD8;
  --pos: #22C55E;
  --pos-bg: #22C55E26;
  --neg: #EF4444;
  --neg-bg: #EF444426;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}
.mono { font-family: "IBM Plex Mono", monospace; }

/* ------------------- Sidebar ------------------- */
:root {
  --sidebar-w-open: 220px;
  --sidebar-w-closed: 56px;
}
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w-open);
  background: #0D0D0D;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: width .2s ease;
}
body[data-sidebar="closed"] .sidebar {
  width: var(--sidebar-w-closed);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 16px 20px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: var(--accent);
  color: #0A0A0A;
  display: flex; align-items: center; justify-content: center;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.brand-text {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
body[data-sidebar="closed"] .brand-text { opacity: 0; pointer-events: none; }
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
}
.nav-link:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-link.active {
  background: rgba(74, 159, 216, 0.12);
  color: var(--accent);
}
.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex: none;
}
.nav-label { overflow: hidden; text-overflow: ellipsis; }
body[data-sidebar="closed"] .nav-label { opacity: 0; pointer-events: none; }
.sidebar-toggle {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  position: absolute;
  top: 32px;
  right: -14px;
  font-size: 14px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px #00000080;
  transition: transform .2s;
}
.sidebar-toggle:hover { color: var(--text); }
body[data-sidebar="closed"] .sidebar-toggle { transform: rotate(180deg); }

.main {
  padding: 32px 40px 16px;
  padding-left: calc(var(--sidebar-w-open) + 40px);
  max-width: calc(1440px + var(--sidebar-w-open));
  margin: 0 auto;
  transition: padding-left .2s ease;
}
body[data-sidebar="closed"] .main {
  padding-left: calc(var(--sidebar-w-closed) + 40px);
}

.hdr {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.brand {
  color: var(--muted-2);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}
.hdr-r { display: flex; align-items: center; gap: 16px; }
.fy-label { color: var(--muted); font-size: 13px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 1px;
}
.pill-live { background: var(--pos-bg); color: var(--pos); }
.pill-live .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 8px var(--pos);
}

.asof-band {
  margin: -12px 0 20px;
  color: var(--muted);
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
}
.asof-text { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.asof-primary { color: var(--text); letter-spacing: 1px; }
.asof-sep { color: var(--muted-2); }
.asof-muted { color: var(--muted-2); font-style: italic; letter-spacing: 0; }
.asof-progress {
  margin-top: 8px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.asof-progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(74, 159, 216, 0.5);
}

.insights {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px 14px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px #00000040;
}
.insights-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted-2);
  margin-bottom: 10px;
}
.insights-list { list-style: none; padding: 0; margin: 0; }
.insight {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 5px 0;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.45;
}
.insight-mark {
  flex: none;
  width: 3px; height: 16px;
  border-radius: 2px;
  margin-top: 3px;
  background: var(--muted);
}
.insight-pos .insight-mark { background: var(--pos); }
.insight-neg .insight-mark { background: var(--neg); }
.insight-warn .insight-mark { background: #F5A524; }

.banner-warn {
  background: #2A1A00;
  border: 1px solid #7C5A00;
  color: #F5A524;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}
.banner-warn code { background: #0A0A0A; padding: 2px 6px; border-radius: 3px; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  box-shadow: 0 8px 24px #00000040;
}
.kpi-accent {
  height: 2px;
  background: var(--accent);
}
.kpi-accent-warn { background: #F5A524; }
.kpi-label, .kpi-value, .kpi-delta { padding-left: 24px; padding-right: 24px; }
.kpi-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kpi-tag {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted-2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 3px;
}
.spark {
  display: block;
  width: calc(100% - 48px);
  height: 28px;
  margin: 6px 24px 4px;
}
.spark path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.85;
}
.kpi-value {
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
  margin-top: 12px;
  margin-bottom: 4px;
  font-feature-settings: "tnum" 1;
}
.kpi-delta {
  font-size: 13px;
  padding-bottom: 20px;
}
.delta-up { color: var(--pos); }
.delta-down { color: var(--neg); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 8px 24px #00000040;
}
.card-hdr {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}
.card-hdr h2 {
  margin: 0; font-size: 16px; font-weight: 600; color: var(--text);
}
.card-hdr .sub {
  margin: 2px 0 0 0; font-size: 11px; color: var(--muted);
}

.chart-card { margin-bottom: 24px; }
.legend { display: flex; gap: 16px; align-items: center; font-size: 11px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw-cfy { background: var(--accent); }
.sw-pfy { background: #3F3F46; }

.bar-plot {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
  align-items: end;
  height: 240px;
  padding-top: 8px;
}
.bar-group {
  display: flex; flex-direction: column; align-items: center;
  height: 100%;
  position: relative;
  border-radius: 4px;
  padding-top: 4px;
  transition: background .15s;
}
.bar-group-peak {
  background: linear-gradient(180deg, rgba(245, 165, 36, 0.02) 0%, rgba(245, 165, 36, 0.08) 100%);
  border-bottom: 2px solid rgba(245, 165, 36, 0.35);
  margin-bottom: -2px;
}
.chart-footnote {
  margin: 14px 0 0;
  font-size: 10px;
  color: var(--muted-2);
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.5px;
}
.bars {
  flex: 1;
  display: flex; align-items: flex-end; gap: 3px;
  width: 100%;
  justify-content: center;
}
.bar {
  width: 14px;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: filter .15s;
}
.bar-cfy { background: var(--accent); }
.bar-pfy { background: #3F3F46; }
.bar:hover { filter: brightness(1.3); }
.bar-label {
  font-size: 10px; color: var(--muted); margin-top: 8px;
}

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

.split-row { margin: 14px 0; }
.split-col-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted-2);
  margin-bottom: 6px;
}
.stack-bar {
  display: flex;
  height: 18px;
  width: 100%;
  border-radius: 3px;
  overflow: hidden;
  background: #1E1E1E;
}
.stack-seg {
  height: 100%;
  transition: filter .15s;
}
.stack-seg:hover { filter: brightness(1.3); }
.stack-seg-1 { background: #1E3A5F; }
.stack-seg-2 { background: #2F6FB0; }
.stack-seg-3 { background: #4A9FD8; }
.stack-seg-4 { background: #93C9F0; }
.stack-sw {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  vertical-align: middle;
}
.stack-sw-1 { background: #1E3A5F; }
.stack-sw-2 { background: #2F6FB0; }
.stack-sw-3 { background: #4A9FD8; }
.stack-sw-4 { background: #93C9F0; }
.split-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 12.5px;
}
.split-table th {
  text-align: left; font-family: "IBM Plex Mono", monospace;
  font-size: 10px; letter-spacing: 1px; color: var(--muted);
  font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--border);
}
.split-table th:not(:nth-child(-n+2)),
.split-table td:not(:nth-child(-n+2)) { text-align: right; }
.split-table td {
  padding: 8px 4px; border-bottom: 1px solid var(--border);
}
.split-table tr:last-child td { border-bottom: none; }
.split-table .num { font-family: "IBM Plex Mono", monospace; font-feature-settings: "tnum" 1; }
.split-table .muted { color: var(--muted); }

.split-footer {
  margin-top: 14px;
  padding: 10px 14px;
  background: #0F1A26;
  border: 1px solid #1E3A5F;
  border-radius: 6px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.split-stat-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.split-stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}
.split-stat-detail {
  font-size: 12px;
  color: var(--muted);
}

.dumbbell { width: 100%; height: auto; display: block; }
.dumbbell .db-name {
  fill: var(--text);
  font-size: 12px;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}
.dumbbell .db-link {
  stroke: var(--muted-2);
  stroke-width: 1.5;
  opacity: 0.5;
}
.dumbbell .db-pfy { fill: #52525B; }
.dumbbell .db-cfy { fill: var(--accent); }
.dumbbell .db-cfy-val {
  fill: var(--text);
  font-size: 11.5px;
  font-family: "IBM Plex Mono", monospace;
  font-feature-settings: "tnum" 1;
}
.dumbbell .db-delta {
  font-size: 11.5px;
  font-family: "IBM Plex Mono", monospace;
}
.dumbbell .delta-up { fill: var(--pos); }
.dumbbell .delta-down { fill: var(--neg); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-cfy { background: var(--accent); }
.dot-pfy { background: #52525B; }

.trend-chart { width: 100%; height: auto; display: block; }
.trend-chart .grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.trend-chart .axis-y, .trend-chart .axis-x {
  fill: var(--muted-2);
  font-size: 10px;
  font-family: "IBM Plex Mono", monospace;
}
.trend-chart .trend-area { fill: rgba(74, 159, 216, 0.12); }
.trend-chart .trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.trend-chart .trend-dot {
  fill: var(--accent);
  stroke: var(--card);
  stroke-width: 1.5;
}
.trend-latest {
  font-size: 18px;
  color: var(--accent);
  font-weight: 600;
}
.trend-chart-warn .trend-line,
.trend-line-warn { stroke: #F5A524 !important; }
.trend-chart-warn .trend-area,
.trend-area-warn { fill: rgba(245, 165, 36, 0.12) !important; }
.trend-chart-warn .trend-dot,
.trend-dot-warn { fill: #F5A524 !important; }

.events-area {
  fill: rgba(245, 165, 36, 0.2);
}
.events-line {
  fill: none;
  stroke: #F5A524;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Hundi page — flag pills, top-txn table, anomaly legend */
.flag {
  display: inline-block;
  padding: 2px 8px;
  margin: 0 3px 3px 0;
  border-radius: 3px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: filter .15s;
}
.flag:hover { filter: brightness(1.2); }
/* Hundi direction markers share a single muted amber palette — they describe
   direction, not judgement. */
.flag-HIGH,
.flag-MIX,
.flag-SOLO,
.flag-SPIKE,
.flag-GAP,
.flag-RISE {
  background: rgba(245, 165, 36, 0.12);
  color: #F5A524;
  border-color: rgba(245, 165, 36, 0.35);
}
/* Event-type tags — two distinct hues so they read as categories, not ranks. */
.flag-MEGA {
  background: rgba(245, 165, 36, 0.14);
  color: #F5A524;
  border-color: rgba(245, 165, 36, 0.4);
}
.flag-REGULAR {
  background: rgba(74, 159, 216, 0.12);
  color: var(--accent);
  border-color: rgba(74, 159, 216, 0.35);
}
.flag-cell { white-space: nowrap; }

.flag-legend { list-style: none; padding: 0; margin: 0; }
.flag-legend li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.flag-legend li:last-child { border-bottom: none; }
.flag-legend .flag { flex: none; min-width: 56px; text-align: center; }
.flag-legend .flag-desc { color: var(--muted); }
.flag-legend .flag-desc b { color: var(--text); font-weight: 600; }

.top-txn-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.top-txn-table th {
  text-align: left; font-size: 10px; font-family: "IBM Plex Mono", monospace;
  letter-spacing: 1px; color: var(--muted); font-weight: 600;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.top-txn-table th.num, .top-txn-table td.num { text-align: right; }
.top-txn-table td {
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.top-txn-table tr:last-child td { border-bottom: none; }
.top-txn-table .num { font-family: "IBM Plex Mono", monospace; font-feature-settings: "tnum" 1; }
.top-txn-table .muted { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 11px; }

.footer {
  display: flex; justify-content: space-between;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--muted-2);
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* ---------------- Prayer Towers page ---------------- */
.pt-table-wrap { overflow: visible; width: 100%; }
.dataTables_wrapper { width: 100%; box-sizing: border-box; }
table.dataTable.pt-table { width: 100% !important; font-size: 12.5px; }
.pt-table thead th {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 1px;
  font-weight: 600;
  border-bottom: 1px solid var(--border) !important;
  padding: 10px 8px !important;
  background: transparent;
}
.pt-table tbody td {
  padding: 9px 8px !important;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.pt-table tbody tr:hover td { background: rgba(74, 159, 216, 0.04); }
.pt-table .num, .pt-table td.dt-body-right {
  font-family: "IBM Plex Mono", monospace;
  font-feature-settings: "tnum" 1;
  text-align: right;
}
.pt-table td.muted { color: var(--muted); }
.pt-toggle-col { width: 28px; }
.pt-toggle-cell {
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  text-align: center;
  width: 28px;
}
.pt-toggle-cell:hover { color: var(--accent); }
.pt-toggle {
  display: inline-block;
  transition: transform .15s ease;
  font-size: 11px;
}
tr.pt-group-row.shown .pt-toggle { transform: rotate(90deg); color: var(--accent); }
tr.pt-group-row.shown td { background: rgba(74, 159, 216, 0.06); }
tr.pt-detail-wrap td {
  padding: 0 !important;
  background: #0F1217;
  border-bottom: 1px solid var(--border);
}
.pt-detail {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 12px;
}
.pt-detail thead th {
  background: #0D1118;
  color: var(--muted-2);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.8px;
  font-weight: 600;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.pt-detail thead th.num { text-align: right; }
.pt-detail tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(30, 30, 30, 0.6);
  color: var(--text);
}
.pt-detail tbody tr:last-child td { border-bottom: none; }
.pt-detail tbody tr:hover td { background: rgba(74, 159, 216, 0.04); }
.pt-detail .num {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-feature-settings: "tnum" 1;
}
.pt-detail .muted { color: var(--muted); }
.pt-detail .delta-up { color: var(--pos); }
.pt-detail .delta-down { color: var(--neg); }
.pt-group-name { font-weight: 500; }

.pt-col-select {
  margin-top: 4px;
  width: 100%;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 4px;
  font-size: 10.5px;
  font-family: "IBM Plex Mono", monospace;
}
.pt-col-select:focus { outline: 1px solid var(--accent); }

/* DataTables controls — dark theme overrides */
.dataTables_wrapper {
  color: var(--muted);
  font-size: 12px;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 12px;
}
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  margin-left: 6px;
}
.dataTables_wrapper .dataTables_info {
  color: var(--muted);
  padding-top: 12px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--muted) !important;
  border: 1px solid transparent !important;
  padding: 4px 10px;
  border-radius: 3px;
  margin: 0 2px;
  background: transparent !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  color: var(--text) !important;
  background: rgba(255,255,255,0.04) !important;
  border-color: var(--border) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: rgba(74, 159, 216, 0.15) !important;
  color: var(--accent) !important;
  border-color: rgba(74, 159, 216, 0.4) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  color: var(--muted-2) !important;
  background: transparent !important;
}
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
  color: var(--muted-2) !important;
  opacity: 0.6;
}
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
  color: var(--accent) !important;
  opacity: 1;
}
