:root {
  --bg: #161217;
  --bg2: #1d181e;
  --card: #241f26;
  --line: #3a323c;
  --ink: #f6efe8;
  --muted: #b7ada4;
  --dim: #8a8078;
  --crimson: #c42336;
  --crimson-d: #8e1a28;
  --gold: #e2b56a;
  --green: #3ea36f;
  --blue: #6ea0d4;
  --orange: #d9844a;
  --chip: #322b34;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
  max-width: 100%; overflow-x: hidden; }
body { min-height: 100%; }
.banner {
  background: #c42336;
  color: #fff;
  text-align: center;
  font-weight: 700;
  letter-spacing: .08em;
  font-size: 11px;
  text-transform: uppercase;
  padding: 8px 12px;
}
.banner span { opacity: .85; font-weight: 600; letter-spacing: .04em; }
header.top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #1f191f, #161217);
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand .mark {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px; letter-spacing: .02em; font-weight: 700;
}
.brand .mark em { font-style: italic; color: var(--gold); font-weight: 600; }
.brand .sub { color: var(--muted); font-size: 12px; }
.meta { text-align: right; color: var(--muted); font-size: 12px; }
.meta strong { display: block; color: var(--ink); font-size: 13px; font-weight: 650; }
.wrap { padding: 16px 20px 40px; max-width: 1240px; width: 100%; margin: 0 auto; min-width: 0; overflow-x: hidden; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; min-width: 0; }
.kpis.four { grid-template-columns: repeat(2, 1fr); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi .n { font-family: Georgia, serif; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.kpi .l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.kpi .d { color: var(--green); font-size: 11px; margin-top: 4px; }
.kpi .d.flat { color: var(--muted); }
.kpi .d.warn { color: var(--orange); }
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; min-width: 0; width: 100%; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; min-width: 0; max-width: 100%; overflow-x: auto; }
.card h2 { margin: 0 0 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.note { color: var(--dim); font-size: 11px; margin: -4px 0 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 0; }
.table-scroll { overflow-x: auto; margin: 0; max-width: 100%; }
.table-scroll table { min-width: 0; width: 100%; }
.table-scroll.wide table { min-width: 520px; }
th { text-align: left; color: var(--dim); font-weight: 600; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 0 8px 6px 0; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px 7px 0; border-bottom: 1px solid #2c272e; vertical-align: middle; }
td.r, th.r { text-align: right; padding-right: 0; }
tr:last-child td { border-bottom: 0; }
.bar { height: 7px; background: #322b34; border-radius: 99px; overflow: hidden; width: 72px; display: inline-block; vertical-align: middle; margin-left: 8px; }
.bar > i { display: block; height: 100%; background: var(--crimson); border-radius: 99px; }
.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; height: 88px; padding-top: 4px; width: 100%; }
.bars .col { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .col b { display: block; width: 100%; border-radius: 4px 4px 1px 1px; background: var(--crimson); min-height: 2px; }
.bars .col span { font-size: 9px; color: var(--dim); }
.stack { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: #322b34; }
.stack i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.heat { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.heat b { display: block; aspect-ratio: 1; border-radius: 3px; background: #2a242c; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--chip); border: 1px solid var(--line); border-radius: 99px; padding: 4px 9px; font-size: 11px; color: var(--muted); }
.pill strong { color: var(--ink); font-weight: 650; }
.hours { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px 4px; }
.hours .h { text-align: center; }
.hours .h .a, .hours .h .c { height: 36px; display: flex; align-items: flex-end; }
.hours .h .a i, .hours .h .c i { display: block; width: 100%; border-radius: 2px 2px 0 0; }
.hours .h .a i { background: var(--green); }
.hours .h .c i { background: var(--crimson); opacity: .85; }
.hours .h span { font-size: 8px; color: var(--dim); }
.alert { background: #2a1b1e; border: 1px solid #5a2a32; border-radius: 10px; padding: 10px 12px; font-size: 12px; margin-bottom: 8px; }
.alert strong { color: #f0b8be; }
.digest { background: #1a201c; border: 1px solid #2d4438; }
.digest pre { white-space: pre-wrap; font: 11.5px/1.5 ui-monospace, Menlo, Consolas, monospace; color: #d7e4db; margin: 0; }
.tag { display: inline-block; background: #3a2a18; color: var(--gold); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; padding: 2px 6px; border-radius: 4px; margin-left: 6px; vertical-align: 2px; }
.ok { color: var(--green); }
.warn { color: var(--orange); }
.bad { color: #e06b6b; }
footer.fine { color: var(--dim); font-size: 11px; padding: 8px 20px 28px; max-width: 1240px; margin: 0 auto; }
@media (min-width: 900px) {
  .kpis { grid-template-columns: repeat(6, 1fr); }
  .kpis.four { grid-template-columns: repeat(4, 1fr); }
  .grid { grid-template-columns: 1.15fr .85fr; }
  .grid .wide { grid-column: 1 / -1; }
  .grid .third { }
  .hours { grid-template-columns: repeat(24, 1fr); }
}
@media (max-width: 899px) {
  header.top { padding: 12px 14px 10px; }
  .wrap { padding: 12px 14px 28px; }
  .brand .mark { font-size: 18px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi .n { font-size: 22px; }
  .meta { font-size: 11px; }
  table { font-size: 12px; }
  h2 { overflow-wrap: break-word; }
}

/* Info tips and clickable metrics */
.info {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
}
.kpi, .card { position: relative; overflow: visible; }
.kpi { padding: 12px 32px 12px 14px; }
.card { padding-top: 14px; }
.card > h2 {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding-right: 28px;
  position: relative;
}
.card > h2 .tag { flex: 0 0 auto; margin-left: 0; }
.card > h2.h2-sub { margin-top: 16px; }
.info-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 0;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gold);
  font: 15px/22px Georgia, "Times New Roman", serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .9;
}
.info-btn:hover, .info-btn:focus-visible {
  opacity: 1;
  background: #3a2a18;
  outline: none;
  box-shadow: 0 0 0 2px #3a2a18;
}
.info-btn[aria-expanded="true"] { background: #3a2a18; }
.info-tip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 242px;
  max-width: calc(100vw - 28px);
  background: #2c262e;
  color: var(--ink);
  border: 1px solid #5a5048;
  border-radius: 10px;
  padding: 12px 32px 12px 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
  z-index: 40;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.info-tip p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #f3ece4;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}
.info-tip.is-open { display: block; }
.info-close {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 18px/24px system-ui, sans-serif;
  cursor: pointer;
}
.info-close:hover, .info-close:focus-visible { color: var(--ink); background: #3a323c; outline: none; }
.info.flip-left .info-tip { right: auto; left: 0; }
.info.flip-up .info-tip { top: auto; bottom: calc(100% + 8px); }

button.metric, button.num, button.pill-num {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
  border-radius: 6px;
}
button.metric {
  display: block;
  width: 100%;
  text-align: left;
  color: var(--ink);
}
button.metric:hover .n, button.num:hover, button.pill-num:hover {
  color: var(--gold);
}
button.metric:focus-visible, button.num:focus-visible, button.pill-num:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
button.num {
  font-weight: 650;
  min-width: 1.5em;
}
button.pill-num {
  display: inline;
  font-weight: 650;
  color: var(--ink);
}

/* Drill-down sheet */
.drill {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8,6,9,.72);
  align-items: flex-end;
  justify-content: center;
}
.drill.is-open { display: flex; }
.drill-sheet {
  background: var(--bg2);
  color: var(--ink);
  width: 100%;
  max-width: 560px;
  max-height: min(92vh, 720px);
  overflow: auto;
  border-radius: 16px 16px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: 0 -12px 40px rgba(0,0,0,.45);
  padding: 0 0 24px;
}
.drill-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}
.drill-back {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: #322b34;
  color: var(--ink);
  font: 13px/1.2 system-ui, sans-serif;
  font-weight: 650;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  flex: 0 0 auto;
  margin-top: 2px;
}
.drill-back:hover, .drill-back:focus-visible { background: #3e3640; outline: none; box-shadow: 0 0 0 2px var(--gold); }
.drill-head .titles { flex: 1; min-width: 0; }
.drill-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}
.drill-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.drill-x {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font: 22px/36px system-ui, sans-serif;
  cursor: pointer;
  flex: 0 0 auto;
}
.drill-x:hover, .drill-x:focus-visible { color: var(--ink); background: #322b34; outline: none; }
.drill-body { padding: 14px 16px 0; }
.drill-total { font-family: Georgia, serif; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.drill-total span { display: block; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-family: "Segoe UI", system-ui, sans-serif; font-weight: 600; margin-top: 2px; }
.drill-bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; margin: 16px 0 8px; }
.drill-bars .col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.drill-bars .col b { display: block; width: 100%; background: var(--crimson); border-radius: 5px 5px 2px 2px; min-height: 2px; position: relative; }
.drill-bars .col.series-b b { background: var(--green); }
.drill-bars .col em {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -2px);
  font-style: normal;
  font-size: 9px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.drill-bars .col span { font-size: 10px; color: var(--dim); text-align: center; line-height: 1.2; }
.drill-note { color: var(--dim); font-size: 12px; margin: 8px 0 0; }
@media (min-width: 700px) {
  .drill { align-items: center; padding: 24px; }
  .drill-sheet { border-radius: 16px; border-bottom: 1px solid var(--line); max-height: min(86vh, 680px); }
}
.info-inline {
  position: relative;
  top: auto;
  right: auto;
  display: inline-flex;
  margin-left: 2px;
  flex: 0 0 auto;
  vertical-align: middle;
}
.hours[data-drill-area], .heat[data-drill-area], .bars[data-drill-area], .stack[data-drill-area] {
  cursor: pointer;
  border-radius: 8px;
}
.hours[data-drill-area]:focus-visible, .heat[data-drill-area]:focus-visible,
.bars[data-drill-area]:focus-visible, .stack[data-drill-area]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Date range filter */
.range-bar {
  margin: 0 0 14px;
  min-width: 0;
}
.range-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.range-presets button {
  appearance: none;
  -webkit-appearance: none;
  background: var(--chip);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 4px;
  font: 13px/1.2 "Segoe UI", system-ui, sans-serif;
  font-weight: 650;
  cursor: pointer;
}
.range-presets button[aria-selected="true"] {
  background: #3a2a18;
  border-color: var(--gold);
  color: var(--gold);
}
.range-presets button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.range-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.range-label { color: var(--muted); font-size: 12px; min-width: 0; }
.range-label strong { display: block; color: var(--ink); font-size: 13px; font-weight: 650; }
.range-compare {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.range-compare input {
  accent-color: var(--gold);
  width: 15px;
  height: 15px;
  margin: 0;
}
.range-meta .info-inline { margin-left: 0; }
.range-custom {
  display: none;
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.range-custom.is-open, .range-custom:not([hidden]) { display: block; }
.range-custom[hidden] { display: none !important; }
.range-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.range-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 650;
}
.range-fields input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  background: #1a161b;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: 14px/1.3 "Segoe UI", system-ui, sans-serif;
  padding: 8px 8px;
  width: 100%;
  color-scheme: dark;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.cal-head strong { font-size: 14px; }
.cal-nav {
  appearance: none;
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}
.cal-nav:focus-visible { outline: 2px solid var(--gold); }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  text-align: center;
}
.cal-grid .dow {
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 4px 0;
  font-weight: 650;
}
.cal-grid button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 0;
  font: 13px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}
.cal-grid button:hover { background: #322b34; }
.cal-grid button.is-out { color: #5a524c; }
.cal-grid button:disabled { color: #4a4440; cursor: default; background: transparent; }
.cal-grid button.is-in { background: #3a2a18; color: var(--gold); }
.cal-grid button.is-start, .cal-grid button.is-end {
  background: var(--crimson);
  color: #fff;
  font-weight: 700;
}
.cal-grid button.is-today { box-shadow: inset 0 0 0 1px var(--gold); }
.range-custom-hint { margin: 8px 0 10px; color: var(--muted); font-size: 12px; }
.range-actions { display: flex; gap: 8px; }
.range-actions button {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  font: 13px/1 "Segoe UI", system-ui, sans-serif;
  font-weight: 650;
  padding: 9px 14px;
  cursor: pointer;
}
.range-actions .apply {
  background: #3a2a18;
  border-color: var(--gold);
  color: var(--gold);
}
.range-actions button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
body.compare-off .kpi .d.delta { display: none; }
@media (min-width: 900px) {
  .range-bar {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 10px 20px;
    align-items: center;
  }
  .range-custom { grid-column: 1 / -1; max-width: 420px; }
  .range-meta { margin-top: 0; }
}
