/* ─── Power Dashboard · friendly consumer aesthetic ──────────────── */

:root {
  --bg: oklch(0.975 0.012 75);
  --bg-2: oklch(0.96 0.014 70);
  --card: #ffffff;
  --card-ink: oklch(0.22 0.02 60);
  --ink: oklch(0.22 0.02 60);
  --ink-dim: oklch(0.5 0.018 60);
  --ink-faint: oklch(0.65 0.015 60);
  --line: oklch(0.92 0.012 70);
  --line-2: oklch(0.88 0.014 70);

  --accent: oklch(0.72 0.16 50);      /* warm orange */
  --accent-soft: oklch(0.94 0.05 60);
  --accent-ink: oklch(0.4 0.14 45);

  --day: oklch(0.78 0.13 80);          /* warm amber */
  --day-soft: oklch(0.95 0.045 85);
  --day-ink: oklch(0.42 0.12 70);

  --night: oklch(0.66 0.11 260);       /* soft indigo */
  --night-soft: oklch(0.94 0.035 260);
  --night-ink: oklch(0.4 0.1 265);

  --good: oklch(0.66 0.13 155);
  --good-soft: oklch(0.95 0.045 155);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(40,30,20,.04), 0 2px 6px rgba(40,30,20,.04);
  --shadow-md: 0 1px 2px rgba(40,30,20,.04), 0 8px 24px rgba(40,30,20,.05);

  --font: "Heebo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }

/* ── App shell ──────────────────────────────────────────────────── */
.app {
  min-height: 100vh;
  padding: 28px 28px 80px;
  max-width: 1320px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-glyph {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), oklch(0.78 0.14 70));
  display: grid;
  place-items: center;
  color: white;
  box-shadow: 0 6px 14px oklch(0.72 0.16 50 / 0.28);
}

.brand-name {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin: 0;
}
.brand-sub {
  font-size: 12px;
  color: var(--ink-dim);
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.year-switch {
  display: inline-flex;
  background: var(--card);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  gap: 2px;
}
.year-switch button {
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  transition: 0.18s ease;
}
.year-switch button:hover { color: var(--ink); }
.year-switch button.on {
  background: var(--ink);
  color: var(--bg);
}

/* ── Customer card ─────────────────────────────────────────────── */
.customer-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 22px;
  margin-bottom: 22px;
}
.cust-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cust-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}
.cust-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cust-divider {
  width: 1px;
  background: var(--line);
}

/* ── KPI row ────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}
.kpi {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.kpi.featured {
  background: linear-gradient(135deg, oklch(0.97 0.04 60), oklch(0.94 0.06 55));
  border-color: oklch(0.9 0.06 55);
}
.kpi-label {
  font-size: 12px;
  color: var(--ink-dim);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.kpi-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.kpi-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.kpi-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-dim);
  letter-spacing: 0;
}
.kpi-sub {
  font-size: 12px;
  color: var(--ink-dim);
  margin-top: 6px;
}
.kpi-sub strong { color: var(--ink); font-weight: 600; }

.kpi.day .kpi-icon { background: var(--day-soft); color: var(--day-ink); }
.kpi.night .kpi-icon { background: var(--night-soft); color: var(--night-ink); }
.kpi.featured .kpi-icon { background: oklch(0.78 0.14 55); color: white; }
.kpi.period .kpi-icon { background: oklch(0.94 0.02 250); color: oklch(0.4 0.05 250); }

/* ── Period section ─────────────────────────────────────────────── */
.period-panel {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 22px 24px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  margin-bottom: 22px;
}
.period-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}
.period-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
}
.period-title small {
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-dim);
  margin-right: 8px;
}

.scope-switch {
  display: inline-flex;
  background: var(--bg-2);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--line);
}
.scope-switch button {
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  transition: 0.18s ease;
}
.scope-switch button:hover { color: var(--ink); }
.scope-switch button.on {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ── Navigation: month/day pickers ──────────────────────────────── */
.nav-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.nav-arrow {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-dim);
  display: grid;
  place-items: center;
  transition: 0.15s ease;
}
.nav-arrow:hover { color: var(--ink); border-color: var(--line-2); }
.nav-arrow:disabled { opacity: 0.35; cursor: not-allowed; }

.month-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.month-chips button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-dim);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  transition: 0.15s ease;
}
.month-chips button:hover:not(:disabled) { color: var(--ink); border-color: var(--line-2); }
.month-chips button.on {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.month-chips button:disabled { opacity: 0.35; cursor: not-allowed; }

.day-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  padding: 5px 6px 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.day-picker .lbl { font-size: 13px; color: var(--ink-dim); font-weight: 500; }
.day-picker .val { font-size: 14px; font-weight: 600; color: var(--ink); min-width: 9ch; text-align: center; }
.day-picker .arrows { display: flex; gap: 4px; }
.day-picker .arrows button {
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 0;
  background: var(--card);
  color: var(--ink-dim);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}
.day-picker .arrows button:hover:not(:disabled) { color: var(--ink); }
.day-picker .arrows button:disabled { opacity: 0.35; cursor: not-allowed; }

.day-input {
  border: 0;
  background: var(--card);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  outline: none;
  cursor: pointer;
  min-width: 0;
}
.day-input:focus {
  box-shadow: var(--shadow-sm), 0 0 0 3px var(--accent-soft);
}
.day-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  margin-inline-start: 4px;
}

/* ── Chart ──────────────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
  user-select: none;
}
.chart-svg {
  display: block;
  width: 100%;
  height: 320px;
  overflow: visible;
}

.chart-bar {
  cursor: pointer;
  transition: 0.15s ease;
}
.chart-bar:hover .bar-rect { fill: var(--accent); }
.chart-bar.active .bar-rect { fill: var(--accent); }
.bar-rect {
  fill: oklch(0.88 0.04 60);
  transition: fill 0.15s ease;
}
.bar-label {
  font-size: 11px;
  fill: var(--ink-faint);
  text-anchor: middle;
  font-weight: 500;
}
.bar-value {
  font-size: 10.5px;
  fill: var(--ink-dim);
  text-anchor: middle;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.chart-bar:hover .bar-value { opacity: 1; }
.chart-bar.active .bar-value { opacity: 1; }

.grid-line { stroke: var(--line); stroke-dasharray: 2 4; }
.axis-label { font-size: 10.5px; fill: var(--ink-faint); }

.chart-tooltip {
  position: absolute;
  background: oklch(0.22 0.02 60);
  color: oklch(0.97 0.012 75);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  margin-top: -8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  font-weight: 500;
  z-index: 4;
}
.chart-tooltip strong { font-weight: 700; }
.chart-tooltip .ttl { font-size: 11px; opacity: 0.7; margin-bottom: 2px; font-weight: 500; }

/* ── Insights row ───────────────────────────────────────────────── */
.insights-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.insight {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.insight-label {
  font-size: 12px;
  color: var(--ink-dim);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.insight-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.insight-meta {
  font-size: 12.5px;
  color: var(--ink-dim);
}
.insight-meta strong { color: var(--ink); font-weight: 600; }
.insight-bar {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
}
.insight-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* ── Savings panel ──────────────────────────────────────────────── */
.savings-panel {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 26px 28px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  margin-top: 22px;
}
.savings-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}
.savings-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.018em;
}
.savings-sub {
  font-size: 13.5px;
  color: var(--ink-dim);
  margin: 0;
  line-height: 1.6;
  text-wrap: pretty;
}
.savings-baseline {
  background: var(--bg-2);
  border-radius: var(--r-md);
  padding: 12px 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
}
.savings-baseline span {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.savings-baseline strong {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.savings-baseline em {
  font-style: normal;
  font-size: 12px;
  color: var(--ink-dim);
  font-weight: 500;
}

.savings-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 14px;
}
.savings-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}
.savings-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.savings-card-head h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.savings-card-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-dim);
}
.savings-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.savings-warm .savings-icon { background: var(--accent-soft); color: var(--accent-ink); }
.savings-day .savings-icon { background: var(--day-soft); color: var(--day-ink); }
.savings-night .savings-icon { background: var(--night-soft); color: var(--night-ink); }

.savings-card-base {
  margin-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--ink-dim);
}
.savings-card-base strong {
  color: var(--ink);
  font-weight: 700;
}
.savings-tiers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.tier {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tier-pct {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  flex-shrink: 0;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1;
}
.savings-warm .tier-pct {
  background: oklch(0.96 0.05 60);
  color: var(--accent-ink);
  border-color: oklch(0.9 0.06 60);
}
.savings-day .tier-pct {
  background: var(--day-soft);
  color: var(--day-ink);
  border-color: oklch(0.9 0.05 85);
}
.savings-night .tier-pct {
  background: var(--night-soft);
  color: var(--night-ink);
  border-color: oklch(0.9 0.04 260);
}
.tier-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
  flex: 1;
}
.tier-label {
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tier-savings {
  font-size: 17px;
  font-weight: 700;
  color: var(--good);
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tier-net {
  font-size: 11.5px;
  color: var(--ink-dim);
}

.savings-disclaimer {
  margin-top: 18px;
  margin-bottom: 0;
  padding: 14px 16px;
  background: var(--bg-2);
  border-radius: 14px;
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 1.65;
  border: 1px solid var(--line);
}
.savings-disclaimer strong {
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 900px) {
  .savings-head { grid-template-columns: 1fr; }
  .savings-grid { grid-template-columns: 1fr; }
  .savings-baseline { width: 100%; text-align: right; }
}

/* ── Upload screen ──────────────────────────────────────────────── */
.upload-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.upload-card {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 44px 40px 36px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  text-align: center;
}
.upload-glyph {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), oklch(0.78 0.14 70));
  display: grid;
  place-items: center;
  color: white;
  box-shadow: 0 12px 28px oklch(0.72 0.16 50 / 0.32);
}
.upload-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.upload-sub {
  font-size: 14.5px;
  color: var(--ink-dim);
  line-height: 1.55;
  margin: 0 0 26px;
}
.dropzone {
  border: 2px dashed var(--line-2);
  border-radius: var(--r-lg);
  padding: 32px 24px;
  background: var(--bg);
  transition: 0.18s ease;
  cursor: pointer;
  position: relative;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone-msg {
  font-size: 14px;
  color: var(--ink-dim);
  margin-bottom: 14px;
}
.dropzone-msg strong { color: var(--ink); font-weight: 600; }
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: var(--bg);
  border: 0;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 999px;
  transition: 0.15s ease;
}
.upload-btn:hover { transform: translateY(-1px); }
.upload-foot {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 22px;
  line-height: 1.6;
}
.upload-foot a {
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
}
.upload-foot a:hover { text-decoration: underline; }
.upload-error {
  color: oklch(0.55 0.18 25);
  background: oklch(0.96 0.04 25);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  margin-top: 16px;
  text-align: right;
}

.upload-features {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
  font-size: 12px;
  color: var(--ink-dim);
}
.upload-features > div {
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: right;
}
.upload-features strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 12.5px;
  margin-bottom: 2px;
}

/* ── Misc ───────────────────────────────────────────────────────── */
.muted-link {
  background: none;
  border: 0;
  color: var(--ink-dim);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
}
.muted-link:hover { color: var(--ink); background: var(--bg-2); }

.spark {
  height: 28px;
  display: block;
}

@media (max-width: 900px) {
  .customer-card { grid-template-columns: 1fr 1fr; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .insights-row { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar-actions { width: 100%; }
}
