/* x-money.css: the owner's Reports page (demos.js + owner-money.js), plus the calm building blocks from
   demos.js that the Staff and Automations pages use too (.calm, .calm-fold, .calm-btn, .calm-tile, pop-ups).
   Only design tokens from style.css; reuses .card, .stats, .list-card, .row, .dash-table, .pill, .delta, .spark. */

/* ---------- Calm building blocks ---------- */
/* .calm: a page written for an owner who isn't confident with tech: 16px+ text everywhere it matters */
.calm p.muted, .calm .row-main em, .calm .rv-sub, .calm .st-sub, .calm .dash-table td .muted { font-size: 16px; }
.calm .row-main strong { font-size: 18px; }
.calm .stat-sub { font-size: 15px; line-height: 1.4; }
.calm .dash-table { font-size: 16px; }
.calm .dash-table .who strong { font-size: 17px; }
.calm .calc { font-size: 15px; }
.calm .calc summary { min-height: 40px; }
@media (max-width: 1099px) { .calm .is-stack td { font-size: 16px; } }

/* A big labelled row button: the quiet back-office outline, at a size that's easy to hit and read */
.btn.calm-btn { min-height: 48px; padding: 0 18px; font-size: 14px; letter-spacing: .05em; }
@media (pointer: fine) { .btn.calm-btn { min-height: 44px; } }

/* Underline tabs with clear names, then the panel */
.calm-tabs { margin-top: 8px; }
.rp-panel, .st-panel { margin-top: 24px; }

/* Folds: a titled row with its key fact; tap to show the detail. The cue says Show / Hide in words. */
.calm-folds { border-top: 2px solid var(--line-strong); }
.calm-fold { border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--top-h) + var(--tabs-h) + 16px); }
.calm-fold > summary { display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 14px 8px 14px 4px; cursor: pointer; list-style: none; transition: background-color .2s var(--ease-ui); }
.calm-fold > summary::-webkit-details-marker { display: none; }
.calm-fold > summary:hover { background: var(--surface-2); }
.calm-fold-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.calm-fold-text strong { font: 800 26px/1 var(--display); text-transform: uppercase; letter-spacing: .01em; }
.calm-fold-text em { font-style: normal; font-size: 16px; line-height: 1.4; color: var(--muted); }
.calm-fold-cue { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 96px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-ctl); background: var(--surface); color: var(--text); font: 700 14px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.calm-fold-cue::before { content: 'Show'; }
.calm-fold[open] > summary .calm-fold-cue::before { content: 'Hide'; }
.calm-fold > summary:hover .calm-fold-cue { border-color: var(--text); }
/* Same arrow and phone sizes as the Dashboard's folds (.dash-sec in x-summary.css), so every fold looks alike */
.calm-fold-cue::after { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.calm-fold[open] > summary .calm-fold-cue::after { transform: translateY(2px) rotate(-135deg); }
@media (max-width: 619px) {
  .calm-fold > summary { gap: 12px; padding-right: 0; }
  .calm-fold-text strong { font-size: 22px; }
  .calm-fold-cue { min-width: 80px; padding: 0 10px; }
}
.calm-fold-body { padding: 4px 0 32px; }
.calm-fold-body > .muted:first-child { margin-top: 4px; }
.calm-fold-body > .section:first-child { margin-top: 8px; }

/* A number tile you can tap to see the people behind it */
.calm-tile-cue { margin-top: 12px; font: 700 15px/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; text-decoration: underline; text-decoration-color: var(--accent-text); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.stats.rp-stats-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 760px; }
.stats.rp-stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 620px) { .stats.rp-stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Pop-ups: the people behind a number, and an email to a staff member */
.calm-people .row-link { min-height: 64px; }
.calm-open, .st-open-cue { flex: none; font: 700 15px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; text-decoration: underline; text-decoration-color: var(--accent-text); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.calm-mail p { font-size: 16px; line-height: 1.5; }
.calm-mail-meta { display: grid; gap: 1px; margin: 16px 0 0; background: var(--line); border: 1px solid var(--line); }
.calm-mail-meta > div { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 12px; padding: 10px 12px; background: var(--surface-2); }
.calm-mail-meta dt { color: var(--muted); font: 700 13px/1.6 var(--sans); text-transform: uppercase; letter-spacing: .06em; }
.calm-mail-meta dd { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.calm-mail textarea, .calm-mail input { font-size: 16px; }

/* ---------- Reports layout (demos.js) ---------- */
.rp-guide { margin-top: 4px; font-size: 17px; line-height: 1.5; color: var(--muted); max-width: 46em; }
.rp-more { margin-top: 48px; }
.rp-split { margin-top: 24px !important; }
.rp-quiet-say { font-size: 17px; line-height: 1.5; }
.rp-quiet { border-top: 4px solid var(--ink); }

/* Automations: a word next to every switch */
.auto-toggle { flex: none; display: inline-flex; flex-direction: row; align-items: center; gap: 10px; margin: 0; cursor: pointer; }
.auto-word { min-width: 2.2em; font: 700 14px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: right; }
.auto-word.is-on { color: var(--ok); }
.calm .auto-next { font-size: 16px; }

/* ---------- Revenue summary (owner-money.js) ---------- */
.rv-wrap { margin-bottom: 8px; }
.rv-wrap .sample-note { margin-top: 0; }
.rv-say { margin-top: 14px; font-size: 18px; line-height: 1.5; max-width: 44em; }
.rv-say strong { font-weight: 800; }
.rv-top-intro { font-size: 17px; line-height: 1.5; color: var(--muted); }
.rv-top-row { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "n main" ". val" ". btn"; gap: 10px 14px; align-items: start; padding: 18px 12px; }
.rv-top-row .count { grid-area: n; margin: 2px 0 0; }
.rv-top-row .row-main { grid-area: main; }
.rv-top-value { grid-area: val; display: flex; align-items: baseline; gap: 8px; }
.rv-top-row .calm-btn { grid-area: btn; width: 100%; }
@media (min-width: 720px) {
  .rv-top-row { grid-template-columns: auto minmax(0, 1fr) auto 220px; grid-template-areas: "n main val btn"; align-items: center; gap: 12px 20px; }
  .rv-top-value { flex-direction: column; align-items: flex-end; gap: 2px; }
}
.rv-move-side .calm-btn { margin-top: 8px; }
.rv-act { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
@media (max-width: 1099px) { .is-stack .rv-act .calm-btn { flex: 1 1 auto; } }

/* Goal card: earned bar plus a striped extension for what the money moves could add */
.rv-goal-num { margin: 6px 0 12px; font: 800 34px/1 var(--display); text-transform: uppercase; }
.rv-goal-num .muted { font-size: 22px; color: var(--muted); }
.rv-progress { position: relative; display: flex; height: 16px; background: var(--track); overflow: hidden; }
.rv-progress-earned { display: block; height: 100%; background: var(--ink); }
.rv-progress-possible { display: block; height: 100%; background: repeating-linear-gradient(135deg, var(--st-green) 0 5px, var(--st-green-tint) 5px 10px); }
.rv-progress-goal { position: absolute; top: -4px; bottom: -4px; right: 0; width: 2px; background: var(--accent); }
.rv-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.rv-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px; }
.rv-key-earned { background: var(--ink); }
.rv-key-possible { background: repeating-linear-gradient(135deg, var(--st-green) 0 3px, var(--st-green-tint) 3px 6px); }
.rv-key-goal { width: 12px !important; height: 0 !important; border-top: 2px dashed var(--accent); vertical-align: 3px !important; }
.rv-key-costs { width: 12px !important; height: 0 !important; border-top: 2px solid var(--accent); vertical-align: 3px !important; }
.rv-key-line { width: 12px !important; height: 0 !important; border-top: 2px solid var(--ink); vertical-align: 3px !important; }
.rv-gap { margin-top: 12px; font-size: 16px; line-height: 1.45; }

/* Number cards with a change badge, a trend line and a calc note */
.rv-stats .stat { min-height: 0; }
.rv-stats .stat-num { font-size: 40px; }
.rv-stats .delta { margin-top: 4px; }
.rv-stats .calc { margin-top: auto; padding-top: 6px; font-size: 13px; }
@media (min-width: 960px) { .rv-stats .stat-num { font-size: 44px; } }

/* Money moves */
.rv-move { align-items: flex-start; flex-wrap: wrap; }
.rv-move .count { flex: none; margin: 2px 0 0; }
.rv-move-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.rv-move-value { font: 800 24px/1 var(--display); color: var(--st-green); white-space: nowrap; }
.rv-move-value.is-zero { color: var(--dim); }
.rv-move-unit { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rv-move .calc { font-size: 13px; }
.rv-move.is-empty .row-main strong { color: var(--muted); }
@media (max-width: 619px) {
  .rv-move-side { flex-direction: row; align-items: baseline; gap: 10px; width: 100%; padding-left: 38px; justify-content: space-between; }
}

/* Line charts: lines stretch with the card; dots and strokes keep their size */
.rv-chart { position: relative; height: 180px; margin-left: 44px; border-bottom: 2px solid var(--ink); }
.rv-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rv-line { fill: none; stroke: var(--ink); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.rv-line-costs { stroke: var(--accent); }
.rv-goal-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.rv-grid-line { fill: none; stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rv-dot { fill: none; stroke: var(--ink); stroke-width: 7; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rv-dot.is-last { stroke: var(--accent); stroke-width: 10; }
.rv-dot-costs { stroke: var(--accent); }
.rv-hit { fill: transparent; cursor: pointer; }
.rv-hit:hover, .rv-hit:focus-visible { fill: var(--surface-2); fill-opacity: .7; outline: none; }
.rv-y { position: absolute; left: -44px; width: 40px; transform: translateY(-50%); font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.rv-y-goal { color: var(--accent-text); font-weight: 700; }
.rv-x { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); margin-left: 44px; }
.rv-x span { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center; white-space: nowrap; }
.rv-x span.is-last { color: var(--text); font-weight: 700; }
@media (max-width: 619px) { .rv-x span.odd { visibility: hidden; } }
@media (min-width: 960px) { .rv-chart { height: 220px; } }

/* Costs and cash */
.rv-cost-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 84px; align-items: center; gap: 12px; }
.rv-cost-row .busy-num { font-size: 18px; }
.rv-cost-total { border-top: 2px solid var(--line-strong); border-bottom: 0; }
.rv-cost-total .busy-label strong, .rv-cost-total .busy-num { font-weight: 800; }
.rv-table-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.dash-table .rv-actions { white-space: nowrap; }
.dash-table tr.is-done td { color: var(--muted); }
.rv-sub { display: block; font-size: 13px; color: var(--muted); }
.rv-goal-tag { position: absolute; right: 0; transform: translateY(-120%); padding: 0 4px; background: var(--surface); color: var(--accent-text); font: 700 12px/1.3 var(--sans); white-space: nowrap; pointer-events: none; }
.rv-chart svg :not(.rv-hit) { pointer-events: none; }
.rv-table-lead { margin-top: 12px; font-size: 16px; }
