/* TEMPORARY dashboard pages (see DashboardController). */
:root {
  --bg: #ececec;
  --panel: #fff;
  --text: #333;
  --muted: #666;
  --line: #d8d8d8;
  --accent: #337ab7;
  --sidebar: #f5f5f5;
  --sidebar-active: #e8e8e8;
  --live: #1e7b3a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }

/* App shell: sidebar + main */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 0 0 24px;
}
.sidebar-brand {
  padding: 16px 18px;
  font-size: 15px;
  font-weight: 650;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}
.sidebar-nav { padding: 8px 0; }
.sidebar-link {
  display: block;
  padding: 8px 18px 8px 28px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.sidebar-link:hover { background: #eee; }
.sidebar-link.active { background: var(--sidebar-active); font-weight: 600; }
.sidebar-hint {
  display: block;
  padding: 6px 18px 6px 28px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}
.sidebar-group { margin: 4px 0; }
.sidebar-group summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  user-select: none;
}
.sidebar-group summary::-webkit-details-marker { display: none; }
.sidebar-group summary::before {
  content: "▸";
  display: inline-block;
  width: 1em;
  margin-right: 4px;
  color: var(--muted);
  transition: transform 0.15s;
}
.sidebar-group[open] summary::before { transform: rotate(90deg); }
.sidebar-group .sidebar-link { padding-left: 36px; font-weight: 400; }
.sidebar-group .sidebar-link.active { font-weight: 600; }

.main-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}
.app-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}
.breadcrumb { margin: 0; font-size: 13px; color: var(--muted); flex: 1; min-width: 160px; }
.topbar-pickers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.region-picker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 4px 12px;
  border: 1px solid #c4c4c4;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.region-picker-label {
  font-size: 12px;
  font-weight: 600;
  color: #545b64;
  white-space: nowrap;
}
.region-select {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #16191f;
  border: none;
  background: transparent;
  padding: 6px 28px 6px 8px;
  min-width: 200px;
  max-width: min(360px, 50vw);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.region-select:focus {
  outline: 2px solid #0972d3;
  outline-offset: 1px;
  border-radius: 4px;
}
.region-picker:focus-within {
  border-color: #0972d3;
  box-shadow: 0 0 0 2px rgba(9, 114, 211, 0.2);
}
.region-picker--muted { opacity: 0.85; }
.region-select:disabled {
  cursor: not-allowed;
  color: #879596;
}

main { padding: 20px 24px 32px; flex: 1; max-width: 1300px; width: 100%; }
main.wide { max-width: none; }
main.chooser { max-width: 900px; }

h2 { font-size: 16px; margin: 24px 0 10px; }
h2:first-child { margin-top: 0; }
.status { color: var(--muted); font-size: 13px; margin-top: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--live); margin-right: 6px; }
.dot.off { background: #b42318; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 26px; font-weight: 650; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Today dashboard */
.dashboard-today { max-width: none; }
.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.dash-title { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.dash-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.dash-meta { margin: 0 0 20px; }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e8f5ec;
  color: #1a5c2e;
  font-size: 13px;
  font-weight: 600;
}
.section-title {
  margin: 28px 0 14px;
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.section-title:first-of-type { margin-top: 8px; }
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.kpi-card {
  position: relative;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.kpi-card:hover {
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.08), 0 12px 24px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}
.kpi-card-accent {
  height: 4px;
  width: 100%;
}
.kpi-card--revenue .kpi-card-accent { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.kpi-card--rgb .kpi-card-accent { background: linear-gradient(90deg, #0d9488, #14b8a6); }
.kpi-card--active .kpi-card-accent { background: linear-gradient(90deg, #7c3aed, #8b5cf6); }
.kpi-card--flow .kpi-card-accent { background: linear-gradient(90deg, #059669, #10b981); }
.kpi-card--risk .kpi-card-accent { background: linear-gradient(90deg, #d97706, #f59e0b); }
.kpi-card-inner { padding: 18px 20px 20px; }
.kpi-card-label {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.3;
}
.kpi-card-value {
  margin: 10px 0 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}
.kpi-card-value--pair { font-size: 28px; }
.kpi-sep { font-weight: 500; color: #94a3b8; margin: 0 0.15em; }
.kpi-card-foot {
  margin: 12px 0 0;
  font-size: 12px;
  color: #94a3b8;
}
.kpi-card-foot strong { color: #475569; font-weight: 600; }
.kpi-card-meta {
  list-style: none;
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: #64748b;
}
.kpi-card-meta strong {
  color: #334155;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { background: #f9f9f9; color: var(--muted); font-weight: 600; }
th:first-child, td:first-child, th.left, td.left { text-align: left; }
tfoot td { font-weight: 650; background: #f8fafc; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #e6f4ea; color: var(--live); }
.badge.final { background: #eef2f7; color: var(--muted); }
.scroll { overflow-x: auto; }
.note { color: var(--muted); font-size: 12px; margin-top: 6px; }
.error { color: #b42318; font-size: 13px; margin: 8px 0; }
.pager { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.step { color: var(--accent); font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
a.card { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 18px 16px; text-decoration: none; color: var(--text); }
a.card:hover { border-color: var(--accent); box-shadow: 0 0 0 2px #337ab722; }
a.card strong { font-size: 16px; }
a.card span { color: var(--muted); font-size: 13px; }

form.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 18px 0 6px; }
form.filters label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
form.filters input, form.filters select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; background: #fff; }
form.filters input:disabled { background: #f3f4f6; color: var(--muted); }
.button { display: inline-block; padding: 7px 14px; border-radius: 4px; border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none; font: inherit; cursor: pointer; }
.button.secondary { background: #fff; color: var(--accent); }
tr.no-data td { color: var(--muted); }
main.wide th { white-space: normal; vertical-align: bottom; min-width: 80px; }

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--line); }
}
.button.danger { background: #fff; color: #b42318; border-color: #b42318; }
.country-actions { white-space: nowrap; }
.country-actions .button { padding: 3px 10px; font-size: 12px; }
.inline-form { display: inline; margin: 0; }
.retention-switch { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
.days-input { width: 80px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; text-align: right; }
