/* =====================================================================
   Locations (KPI dashboard) + Monthly savings report. Loaded after kpi.css and engage.css.
   ===================================================================== */
.loc-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -8px 0 18px; }
.loc-bar svg { width: 16px; height: 16px; stroke: var(--ember); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.loc-bar select, .report-tools select { background: var(--ink); border: 0; box-shadow: var(--key-shadow); color: var(--chalk); border-radius: 10px; padding: 8px 32px 8px 12px; font: 500 14px var(--ui); max-width: 100%; }
.loc-bar select option, .report-tools select option { background: var(--ink); }
.loc-bar .link { font-size: 13px; }

.compare-table td { white-space: nowrap; }
.compare-table td.is-best { color: var(--chalk); font-weight: 600; }
.best-mark { color: var(--ember); margin-right: 4px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 7px; vertical-align: middle; background: var(--smoke); }
.dot.good { background: #0ca30c; } .dot.neutral { background: var(--ash); } .dot.warn { background: #fab219; }
.compare-note { color: var(--smoke); font-size: 12px; margin: 10px 2px 0; }
.compare-note .dot { margin: 0 3px 0 8px; }
.kpi-table td.muted, .muted { color: var(--smoke); }

.loc-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.loc-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.03); box-shadow: var(--key-shadow); }
.loc-list b { color: var(--chalk); font-weight: 500; display: block; }
.loc-list small { color: var(--smoke); font-size: 12px; }
.loc-list .person-actions { display: flex; gap: 14px; }
.loc-add { margin-bottom: 4px; }
#loc-modal .join-card { margin: 0; }

/* ---------- Savings report ---------- */
.report-kicker { font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ember); margin: 0 0 10px; }
.report-tools { align-items: center; }
.report-body { display: grid; gap: 20px; max-width: 1040px; }
.report-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; padding: 26px 28px; border-radius: 18px; background: var(--ink); box-shadow: var(--key-shadow); }
.report-hero.good { background: linear-gradient(135deg, rgba(12,163,12,.16), var(--ink) 60%); }
.report-hero.bad { background: linear-gradient(135deg, rgba(240,122,106,.16), var(--ink) 60%); }
.report-hero .k { display: block; color: var(--ash); font-size: 14px; }
.report-hero .v { display: block; font: 500 clamp(36px, 5vw, 56px)/1.1 var(--mono); color: var(--chalk); margin: 6px 0; letter-spacing: -.02em; }
.report-hero.good .v { color: #59d499; }
.report-hero.bad .v { color: #f07a6a; }
.report-hero.neutral .v { font-size: clamp(26px, 3vw, 34px); }
.report-hero .n { color: var(--ash); font-size: 13px; max-width: 620px; display: block; }
.report-totals { display: flex; gap: 28px; margin: 0; }
.report-totals dt { color: var(--smoke); font-size: 12px; }
.report-totals dd { margin: 2px 0 0; font: 500 18px var(--mono); color: var(--mist); }

.report-card { padding: 22px 24px; border-radius: 16px; background: var(--ink); box-shadow: var(--key-shadow); }
.ai-card { background: linear-gradient(180deg, var(--ember-hush), var(--ink) 55%); }
.ai-card h2 { font: 500 20px/1.35 var(--ui); color: var(--chalk); margin: 0 0 8px; }
.ai-card p { color: var(--mist); margin: 0 0 14px; line-height: 1.6; }
.ai-card h3 { font: 600 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ash); margin: 18px 0 10px; }
.priorities { margin: 0; padding: 0; list-style: none; counter-reset: p; display: grid; gap: 10px; }
.priorities li { counter-increment: p; display: grid; grid-template-columns: 28px 1fr; column-gap: 10px; }
.priorities li::before { content: counter(p); grid-row: span 2; width: 24px; height: 24px; border-radius: 50%; background: var(--ember); color: #fff; font: 600 12px/24px var(--ui); text-align: center; }
.priorities b { color: var(--chalk); font-weight: 500; }
.priorities span { color: var(--ash); font-size: 13px; }
.ai-card.loading { display: flex; align-items: center; gap: 14px; }
.ai-card.loading p { margin: 0; }
.ai-pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--ember); animation: pulse 1.2s ease-in-out infinite; flex-shrink: 0; }
@keyframes pulse { 0%, 100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .ai-pulse { animation: none; } }

.report-section .rank-section { margin-top: 8px; }
.report-table td.left { text-align: left; }
.report-table tr.loc-row td { background: rgba(255,255,255,.025); }
.report-table td.lever { padding-left: 26px; color: var(--ash); }
.report-table td.lever small { display: inline; color: var(--smoke); }
.report-table td.pos { color: #59d499; }
.report-table td.neg { color: #f07a6a; }
.report-foot { color: var(--smoke); font-size: 12px; margin: 10px 2px 0; line-height: 1.5; }
.report-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.report-stats div { padding: 14px 18px; border-radius: 12px; background: var(--ink); box-shadow: var(--key-shadow); min-width: 110px; }
.report-stats b { display: block; font: 500 24px var(--mono); color: var(--chalk); }
.report-stats span { color: var(--ash); font-size: 12px; }
.done-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.done-list li { display: flex; gap: 10px; align-items: baseline; color: var(--mist); }
.done-list .check { color: #59d499; }
.done-list .verified-tag { font-style: normal; font-size: 11px; color: #59d499; border: 1px solid #1d4a33; border-radius: 99px; padding: 0 7px; white-space: nowrap; }
.done-list small { color: var(--smoke); margin-left: auto; white-space: nowrap; }
.report-upsell { max-width: 640px; }
.print-only { display: none; }
.nav-new { margin-left: auto; font: 600 10px/1 var(--ui); letter-spacing: .04em; text-transform: uppercase; background: var(--ember); color: #fff; border-radius: 9999px; padding: 3px 7px; }

@media (max-width: 720px) {
  .report-hero { padding: 20px; }
  .report-totals { gap: 18px; flex-wrap: wrap; }
  .report-tools { width: 100%; }
  .report-tools select { flex: 1; min-width: 0; }
}

/* Print / Save as PDF: just the report, on white. */
@media print {
  @page { margin: 14mm; }
  body, #app, .workspace, #reports { background: #fff !important; color: #111 !important; height: auto !important; overflow: visible !important; display: block !important; }
  .sidebar, #banner, .report-tools, #site, .modal, [data-write-summary] { display: none !important; }
  #reports { padding: 0 !important; }
  .print-only { display: block; }
  .kpi-head h1, .report-hero .v, .ai-card h2, .priorities b, .report-stats b, .report-totals dd, .kpi-table td b, .rank-section { color: #111 !important; }
  .report-hero, .report-card, .ai-card, .report-stats div, .table-scroll { background: #fff !important; box-shadow: none !important; border: 1px solid #ddd; }
  .report-hero.good .v, .report-table td.pos { color: #0a7a0a !important; }
  .report-hero.bad .v, .report-table td.neg { color: #b3261e !important; }
  .kpi-table th, .kpi-table td { color: #222 !important; border-color: #e5e5e5 !important; }
  .report-table tr.loc-row td { background: #f6f6f6 !important; }
  .ai-card p, .priorities span, .report-hero .n, .report-foot, .sub, .muted { color: #444 !important; }
  .report-section, .report-card { break-inside: avoid; }
  .table-scroll { overflow: visible !important; }
}

/* Fixes: let wide tables scroll inside their card instead of stretching the page; keep savings colors on bold cells. */
.report-body { grid-template-columns: minmax(0, 1fr); }
.report-body > * { min-width: 0; }
.report-table td.pos b { color: #59d499; }
.report-table td.neg b { color: #f07a6a; }
.ai-card .report-foot { color: var(--smoke); font-size: 12px; margin: 16px 0 0; }
@media (max-width: 720px) {
  .report-tools { flex-wrap: wrap; }
  .report-tools select { flex: 1 1 140px; }
}
@media print {
  .report-table td.pos b { color: #0a7a0a !important; }
  .report-table td.neg b { color: #b3261e !important; }
}
@media print {
  .status { background: #fff !important; color: #222 !important; box-shadow: inset 0 0 0 1px #ccc !important; }
}
