
/* ── Statistics dashboard (original) ──────────────────────────────────────── */

.divera-stats{ --card-bg:#fff; --gray:#6b7280; --muted:#9ca3af; --ring:#e5e7eb; --ring2:#d1d5db; --accent:#1d4ed8; --good:#10b981;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color:#111827; line-height:1.35;
}
.divera-stats .ds-header{ display:flex; gap:16px; align-items:flex-end; flex-wrap:wrap; margin-bottom:12px; }
.divera-stats h2{ margin:0; font-size:22px; }
.divera-stats .ds-toolbar{ margin-left:auto; }
.divera-stats .ds-toolbar select{ padding:6px 8px; border:1px solid var(--ring2); border-radius:8px; }

.ds-counters{ display:flex; gap:10px; flex-wrap:wrap; }
.ds-counter{ background:var(--card-bg); border:1px solid var(--ring); border-radius:12px; padding:8px 12px; min-width:140px; }
.ds-counter .lab{ font-size:12px; color:var(--muted); }
.ds-counter .val{ font-size:22px; font-weight:700; }

.ds-grid3{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:12px; margin:12px 0; }
.ds-card{ background:var(--card-bg); border:1px solid var(--ring); border-radius:14px; padding:12px; }
.ds-card h3{ margin:0 0 8px 0; font-size:16px; }

.ds-table{ width:100%; border-collapse:collapse; }
.ds-table td{ border-bottom:1px solid var(--ring); padding:6px 8px; font-size:14px; }
.ds-table td.num{ text-align:right; font-weight:700; }

.ds-list .ds-item{ display:flex; justify-content:space-between; gap:12px; padding:6px 8px; border-bottom:1px solid var(--ring); }
.ds-item-ts{ color:var(--muted); min-width:110px; font-variant-numeric: tabular-nums; }
.ds-item-title{ flex:1; font-weight:600; }

.ds-map{ width:100%; height:420px; border-radius:12px; overflow:hidden; }
.ds-map-note{ margin-top:6px; font-size:12px; color:#92400e; background:#fef3c7; border:1px solid #fcd34d; padding:6px 8px; border-radius:8px; }
.ds-legend{ display:flex; align-items:center; gap:8px; margin-top:6px; font-size:12px; color:var(--gray); }
.ds-grad{ width:120px; height:10px; background:linear-gradient(90deg, #e0e7ff, #818cf8, #1d4ed8, #1e40af); border-radius:999px; }

.chart-block{ height:260px; }

.ds-heatgrid{ overflow:auto; border:1px solid var(--ring); border-radius:12px; }
.hg-wrap{ display:flex; flex-direction:column; min-width:560px; }
.hg-row{ display:grid; grid-template-columns: 80px repeat(7, 1fr); }
.hg-head{ position:sticky; top:0; background:#fafafa; z-index:1; }
.hg-cell{ padding:6px; border-bottom:1px solid var(--ring); border-right:1px solid var(--ring); font-size:12px; text-align:center; }
.hg-empty{ background:#fafafa; }
.hg-h, .hg-hh{ font-weight:600; color:#374151; }

#ds-lead .ds-item, #ds-lead .ds-item-ts, #ds-lead .ds-item-title { font-size: 14px; }


/* ── Live Dashboard ────────────────────────────────────────────────────────── */

.divera-live {
  --dl-bg:       #0f172a;
  --dl-surface:  #ffffff;
  --dl-border:   #e5e7eb;
  --dl-calm:     #10b981;
  --dl-mid:      #3b82f6;
  --dl-high:     #f59e0b;
  --dl-crit:     #ef4444;
  --dl-muted:    #9ca3af;
  --dl-subtle:   #6b7280;
  --dl-text:     #111827;
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--dl-text);
  line-height: 1.4;
}

/* ── Header bar ─────────────────────────────────────────────── */
.dl-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  background: var(--dl-bg);
  border-radius: 14px 14px 0 0;
  flex-wrap: wrap;
}

.dl-live-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: #f87171;
  text-transform: uppercase;
}

.dl-pulse-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(239,68,68,0.6);
  animation: dl-pulse 1.6s ease-in-out infinite;
}
@keyframes dl-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  70%  { box-shadow: 0 0 0 7px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

.dl-ts-wrap {
  font-size: 12px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}
.dl-ts { color: #cbd5e1; font-weight: 600; }

.dl-ctdn-wrap {
  font-size: 12px;
  color: #64748b;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.dl-ctdn { color: #94a3b8; }

/* ── Layout ─────────────────────────────────────────────────── */
.dl-top-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  border: 1px solid var(--dl-border);
  border-top: none;
  border-radius: 0;
}

.dl-panel {
  background: var(--dl-surface);
  padding: 16px 18px;
  border-bottom: 1px solid var(--dl-border);
}
.dl-panel + .dl-panel {
  border-left: 1px solid var(--dl-border);
}

.dl-panel-stations,
.dl-panel-spark {
  border: 1px solid var(--dl-border);
  border-top: none;
}
.dl-panel-spark {
  border-radius: 0 0 14px 14px;
}

.dl-panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dl-subtle);
  margin-bottom: 12px;
}
.dl-spark-subtitle {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--dl-muted);
}

/* ── Total counters ─────────────────────────────────────────── */
.dl-time-strip {
  display: flex;
  gap: 8px;
}
.dl-tc {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  border: 1px solid var(--dl-border);
  border-radius: 10px;
  background: #fafafa;
}
.dl-tc-label {
  font-size: 10px;
  color: var(--dl-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  font-weight: 600;
}
.dl-val-xl {
  font-size: 32px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ── Vehicle type table ─────────────────────────────────────── */
.dl-type-table {
  width: 100%;
  border-collapse: collapse;
}
.dl-th-left { text-align: left; }
.dl-type-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dl-muted);
  padding: 0 8px 8px 8px;
  text-align: right;
  border-bottom: 1px solid var(--dl-border);
}
.dl-type-table td {
  padding: 9px 8px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
}
.dl-type-table tr:last-child td { border-bottom: none; }
.dl-type-name { text-align: left; }
.dl-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 16px;
}
.dl-dim  { font-weight: 500; color: #374151; }
.dl-dim2 { font-weight: 400; color: var(--dl-muted); }

.dl-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.dl-badge-nef { background: #fef9c3; color: #854d0e; }
.dl-badge-rtw { background: #dbeafe; color: #1e40af; }
.dl-badge-ktw { background: #dcfce7; color: #166534; }

/* ── Station table ──────────────────────────────────────────── */
.dl-station-table {
  width: 100%;
  border-collapse: collapse;
}
.dl-th-sta { text-align: left; }
.dl-th-num { text-align: right; }
.dl-th-resp { text-align: right; }
.dl-station-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dl-muted);
  padding: 0 10px 8px 10px;
  border-bottom: 2px solid var(--dl-border);
}
.dl-station-table td {
  padding: 10px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
}
.dl-station-table tr:last-child td { border-bottom: none; }
.dl-sta-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #1e293b;
}
.dl-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.4s;
}
.dl-resp-cell { text-align: right; font-size: 13px; }
.dl-resp-val  { font-weight: 600; color: #374151; font-variant-numeric: tabular-nums; }
.dl-resp-meta { color: var(--dl-muted); font-size: 11px; }
.dl-resp-nodata { color: var(--dl-muted); }

.dl-hint-cell {
  text-align: center;
  font-size: 12px;
  color: var(--dl-muted);
  padding: 8px !important;
  background: #fafafa;
}
.dl-hint-box {
  font-size: 13px;
  color: var(--dl-subtle);
  padding: 8px 0;
  margin: 0;
}

/* ── Sparkline ──────────────────────────────────────────────── */
.dl-spark-wrap {
  height: 90px;
  position: relative;
}

/* ── Activity colour system ─────────────────────────────────── */
.dl-act-calm { color: var(--dl-calm); }
.dl-act-mid  { color: var(--dl-mid); }
.dl-act-high { color: var(--dl-high); }
.dl-act-crit { color: var(--dl-crit); }

.dl-indicator.dl-act-calm { background: var(--dl-calm); }
.dl-indicator.dl-act-mid  { background: var(--dl-mid); }
.dl-indicator.dl-act-high { background: var(--dl-high); }
.dl-indicator.dl-act-crit {
  background: var(--dl-crit);
  animation: dl-pulse 1.4s ease-in-out infinite;
}

/* Row tinting */
.dl-sta-row.dl-act-high td:first-child { background: #fffbeb; }
.dl-sta-row.dl-act-crit td:first-child { background: #fff1f2; }

/* placeholder text */
.dl-placeholder {
  color: var(--dl-muted);
  font-size: 13px;
  padding: 6px 0;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .dl-top-row {
    grid-template-columns: 1fr;
  }
  .dl-panel + .dl-panel {
    border-left: none;
    border-top: 1px solid var(--dl-border);
  }
  .dl-header { border-radius: 12px 12px 0 0; }
  .dl-panel-spark { border-radius: 0 0 12px 12px; }
  .dl-val-xl { font-size: 26px; }
}
