/* Quew client report — dark editorial. One accent (desaturated emerald),
   brass reserved for the spend data series. Numbers always mono. */

:root {
  --bg: #0b0b0c;
  --bg-2: #100f11;
  --surface: #131316;
  --hair: rgba(244, 243, 240, 0.08);
  --hair-2: rgba(244, 243, 240, 0.16);

  --ink: #f4f3f0;
  --ink-2: #adaca6;
  --ink-3: #6f6e69;

  --accent: #46c08a;
  --accent-dim: rgba(70, 192, 138, 0.14);
  --brass: #c2a36b;
  --brass-dim: rgba(194, 163, 107, 0.16);
  --red: #d9776e;

  --sans: "Outfit", system-ui, -apple-system, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  background:
    radial-gradient(1100px 500px at 78% -10%, rgba(70, 192, 138, 0.05), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.frame {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(28px, 4.5vw, 56px) clamp(18px, 3.5vw, 40px) 48px;
}

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--hair-2);
}

.eyebrow {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--accent);
  letter-spacing: 0.01em;
  margin-bottom: 10px;
}

.masthead h1 {
  font-size: clamp(30px, 4.4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
}

.masthead-sub {
  margin-top: 12px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sub-divider { width: 22px; height: 1px; background: var(--hair-2); }

/* ---------- date picker ---------- */

.datepicker { position: relative; }

.dp-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 500 13.5px var(--sans);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.12s var(--ease);
  white-space: nowrap;
}
.dp-trigger:hover { border-color: rgba(244, 243, 240, 0.3); }
.dp-trigger:active { transform: translateY(1px); }
.dp-trigger svg:first-child { color: var(--accent); flex: none; }
.dp-chev { color: var(--ink-3); transition: transform 0.2s var(--ease); }
.datepicker.open .dp-chev { transform: rotate(180deg); }

.dp-panel[hidden] { display: none; }

.dp-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--hair-2);
  border-radius: 14px;
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
  animation: dp-in 0.18s var(--ease);
}
@keyframes dp-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dp-presets {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  min-width: 158px;
  border-right: 1px solid var(--hair);
  background: rgba(255, 255, 255, 0.015);
}
.dp-presets button {
  font: 400 13.5px var(--sans);
  color: var(--ink-2);
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  text-align: left;
  padding: 9px 18px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.dp-presets button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.03); }
.dp-presets button.active {
  color: var(--accent);
  font-weight: 500;
  border-left-color: var(--accent);
  background: var(--accent-dim);
}

.dp-cal-wrap { display: flex; flex-direction: column; }

.dp-cals { display: flex; gap: 8px; padding: 16px 16px 6px; }

.dp-cal { width: 238px; user-select: none; }

.dp-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 10px;
}
.dp-cal-title { font: 500 13.5px var(--sans); color: var(--ink); }
.dp-nav {
  background: none;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink-2);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.dp-nav:hover { color: var(--ink); border-color: var(--hair-2); }
.dp-nav[disabled] { opacity: 0.25; pointer-events: none; }
.dp-nav-spacer { width: 26px; height: 26px; }

.dp-grid { display: grid; grid-template-columns: repeat(7, 32px); justify-content: center; }
.dp-dow {
  font: 500 10.5px var(--mono);
  color: var(--ink-3);
  text-transform: uppercase;
  text-align: center;
  padding: 4px 0 7px;
}
.dp-day {
  font: 400 12.5px var(--mono);
  color: var(--ink-2);
  background: none;
  border: 0;
  width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: color 0.12s;
}
.dp-day:hover:not([disabled]) { color: var(--ink); }
.dp-day:hover:not([disabled])::after {
  content: "";
  position: absolute;
  inset: 1px 2px;
  border: 1px solid var(--hair-2);
  border-radius: 8px;
}
.dp-day[disabled] { color: rgba(111, 110, 105, 0.35); cursor: default; }
.dp-day.outside { visibility: hidden; }
.dp-day.in-range { background: var(--accent-dim); color: var(--ink); }
.dp-day.range-start { border-radius: 8px 0 0 8px; }
.dp-day.range-end { border-radius: 0 8px 8px 0; }
.dp-day.range-start.range-end { border-radius: 8px; }
.dp-day.edge {
  background: var(--accent);
  color: #0b0b0c;
  font-weight: 600;
}
.dp-day.today-mark:not(.edge)::before {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
}

.dp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--hair);
}
.dp-selection { font: 500 12px var(--mono); color: var(--ink-2); white-space: nowrap; }
.dp-actions { display: flex; gap: 8px; }
.dp-btn {
  font: 500 13px var(--sans);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.15s, border-color 0.15s;
}
.dp-btn:active { transform: translateY(1px); }
.dp-btn.ghost { background: none; border: 1px solid var(--hair-2); color: var(--ink-2); }
.dp-btn.ghost:hover { color: var(--ink); border-color: rgba(244, 243, 240, 0.3); }
.dp-btn.solid { background: var(--accent); border: 1px solid var(--accent); color: #0b0b0c; font-weight: 600; }
.dp-btn.solid:hover { background: #3aa978; border-color: #3aa978; }
.dp-btn.solid[disabled] { opacity: 0.35; pointer-events: none; }

/* ---------- notice ---------- */

.notice {
  margin-top: 22px;
  padding: 13px 16px;
  border: 1px solid rgba(217, 119, 110, 0.35);
  border-radius: 10px;
  background: rgba(217, 119, 110, 0.08);
  color: #e8a49d;
  font-size: 13.5px;
  font-weight: 400;
}
.notice.info {
  border-color: var(--hair-2);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink-2);
}

/* ---------- KPI strip (rules, not cards) ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 8px;
  border-bottom: 1px solid var(--hair);
}
.kpi {
  padding: 26px 22px 28px;
  border-left: 1px solid var(--hair);
}
.kpi:first-child { border-left: 0; padding-left: 0; }
.kpi-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.kpi-value {
  margin-top: 12px;
  font: 500 clamp(24px, 2.6vw, 31px) var(--mono);
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: opacity 0.25s var(--ease);
}
.kpi-value .unit { font-size: 0.55em; color: var(--ink-3); margin-left: 2px; }
.kpi-value.null { color: var(--ink-3); }

/* skeleton shimmer */
[data-skeleton].loading {
  color: transparent !important;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  min-width: 72px;
}
[data-skeleton].loading::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- chart blocks ---------- */

.charts {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: clamp(28px, 4vw, 56px);
  margin-top: 44px;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hair);
  margin-bottom: 20px;
}
.block-head h2 {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.block-note { font-size: 12px; font-weight: 400; color: var(--ink-3); white-space: nowrap; }

.legend-key { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; color: var(--ink-2); }
.swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.swatch-spend { background: var(--brass); }
.swatch-calls { background: var(--accent); }

.chart-canvas-wrap { position: relative; height: 280px; }

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 4px;
}
.chart-empty p:first-child { font-size: 14px; font-weight: 400; color: var(--ink-2); }
.empty-sub { font-size: 12.5px; color: var(--ink-3); }
.creatives .chart-empty, .charts .chart-empty[id="bars-empty"] {
  position: static;
  padding: 44px 0 30px;
}

/* ---------- CSS bar chart ---------- */

.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 280px;
  padding-top: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.bar-group {
  flex: 1 1 0;
  min-width: 44px;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.bar-pair {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  border-bottom: 1px solid var(--hair-2);
  padding: 0 4px;
}
.bar {
  width: 14px;
  height: 100%;
  position: relative;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
}
.bar i {
  position: absolute;
  inset: 0;
  border-radius: 3px 3px 0 0;
  transform-origin: bottom;
  transform: scaleY(var(--v, 0));
  transition: transform 0.6s var(--ease);
}
.bar.spend i { background: linear-gradient(180deg, var(--brass), rgba(194, 163, 107, 0.55)); }
.bar.calls i { background: linear-gradient(180deg, var(--accent), rgba(70, 192, 138, 0.55)); }
.bar.zero i { background: rgba(255, 255, 255, 0.07); transform: scaleY(1); height: 2px; top: auto; }
.bar-label {
  padding-top: 9px;
  text-align: center;
  font: 400 10.5px var(--mono);
  color: var(--ink-3);
  white-space: nowrap;
}

/* ---------- creatives table ---------- */

.creatives { margin-top: 52px; }

.creative-table { width: 100%; border-collapse: collapse; }
.creative-table th {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  padding: 0 14px 11px 0;
  border-bottom: 1px solid var(--hair-2);
}
.creative-table td {
  padding: 15px 14px 15px 0;
  border-bottom: 1px solid var(--hair);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-2);
  vertical-align: middle;
}
.creative-table .t-num, .creative-table td.n { text-align: right; }
.creative-table td.n { font: 500 13.5px var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.creative-table .t-rank { width: 38px; }
.creative-table td.rank { font: 500 12px var(--mono); color: var(--accent); }
.creative-table td.name { color: var(--ink); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creative-table tbody tr { transition: background 0.15s; }
.creative-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

/* ---------- colophon ---------- */

.colophon {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--hair);
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  color: var(--ink-3);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: breathe 2.6s ease-in-out infinite;
}
.live-dot.stale { background: var(--red); animation: none; }
@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

/* ---------- responsive ---------- */

@media (max-width: 960px) {
  .charts { grid-template-columns: 1fr; }
  .chart-canvas-wrap { height: 240px; }
  .bars { height: 240px; }
}

@media (max-width: 820px) {
  .masthead { flex-direction: column; align-items: flex-start; }
  .kpis { grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--hair); }
  .kpi { padding: 20px 18px; }
  .kpi:first-child { padding-left: 18px; }
  .kpi:nth-child(odd) { border-left: 0; padding-left: 0; }
  .kpi:nth-child(odd) { padding-left: 0; }
  .kpi { border-bottom: 1px solid var(--hair); }
  .kpis { border-bottom: 0; }

  .dp-panel {
    position: fixed;
    inset: auto 12px 12px 12px;
    top: auto;
    flex-direction: column;
    max-height: 82dvh;
    overflow-y: auto;
  }
  .dp-presets {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--hair);
    padding: 10px;
    gap: 2px;
  }
  .dp-presets button { border-left: 0; border-radius: 8px; padding: 7px 12px; }
  .dp-presets button.active { border-left: 0; }
  .dp-cals { flex-direction: column; align-items: center; }
  .dp-footer { flex-direction: column; align-items: stretch; text-align: center; }
  .dp-actions { justify-content: stretch; }
  .dp-actions .dp-btn { flex: 1; }

  .creative-table .t-name, .creative-table td.name { max-width: 150px; }
  .creative-table th, .creative-table td { padding-right: 8px; }
}
