/* /pages/overview.css — Overview-only styles (CONTRACTS §J2). Everything structural comes from
   /app.css (panels, tiles, grids, band-head, chart primitives, needs, chips). This file ONLY ADDS:
   the two-column shell, the tile row sizing, chart spacing/labels, the recolor for positive-outcome
   bars, the band notes and the compact freshness strip. It never shrinks a shell size. Dark-only. */

/* ---- the layout engine (CONTRACTS §Y2): a dense 12-col grid of declared-size widgets ----
   Widgets carry a size class (w-wide/half/third/tile) that the grid maps to a column span; grid-auto-flow:
   dense fills the gaps so a sparse or reordered selection still packs into tidy rows. align-items:start
   lets each widget size to its own content (a lone tile never stretches to a tall band beside it) — the
   old two-column masonry look, now driven entirely by declared sizes. The default layout (Ads/Website on
   row 1, Store/Outreach on row 2, then Action Items and freshness full width) reproduces the old shell. */
.ov-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); grid-auto-flow: dense; align-items: start; }
.ov-grid > * { min-width: 0; }
.w-wide  { grid-column: span 12; }
.w-half  { grid-column: span 6; }
.w-third { grid-column: span 4; }
.w-tile  { grid-column: span 3; }
/* min-heights by size — a floor so a content-light widget is not a ragged sliver. Naturally tall bands
   ignore it; it only bites for a sparse custom selection, so the default view is unaffected. */
.w-third { min-height: 200px; }
.w-tile  { min-height: 118px; }
/* medium: halves stay two-up, thirds pair up, tiles go three-up (wide still full width) */
@media (max-width: 1100px) {
  .w-half  { grid-column: span 6; }
  .w-third { grid-column: span 6; }
  .w-tile  { grid-column: span 4; }
}
/* narrow: everything stacks full width */
@media (max-width: 760px) {
  .ov-grid { grid-template-columns: repeat(12, 1fr); }
  .w-wide, .w-half, .w-third, .w-tile { grid-column: span 12; }
}

/* band header wraps cleanly on narrow bands; the "more →" link stays put and never shrinks */
.ov-band .band-head { flex-wrap: wrap; }
.ov-band .band-head h2 { flex: 0 0 auto; }
.ov-band .band-head .judgement { flex: 1 1 240px; min-width: 0; }
.ov-band .band-head .more { flex: 0 0 auto; white-space: nowrap; }

/* tile row: BIG tiles (shell .v stays 32px — no override), as many 150px as fit, so a five-tile band
   reads three-up in a desktop column and two-up at 390px. */
.ov-tiles { grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); }
.ov-tiles .tile { padding: 14px 16px; }
.ov-tiles .tile .v { font-size: 30px; }

/* ---- charts under a band's tiles ---- */
.ov-chart { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ov-chart + .ov-chart { margin-top: 6px; padding-top: 4px; border-top: 0; }   /* Ads' clicks chart hugs the spend chart */
.ov-chart-t { font: 12px var(--mono); color: var(--mute); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 8px; }
.ov-chart-sm svg.chart { height: 180px; }   /* the secondary (clicks) chart is smaller, still ≥160px */

/* replies (outreach) and orders (store) are positive OUTCOMES, so their bars are green, not the
   default action-cyan the cols primitive draws. The doubling word lives in the legend / labels. */
.ov-chart-green svg.cols rect:not(.y) { fill: var(--green); }
.ov-chart-green svg.cols rect.y { fill: var(--mute); opacity: 0.55; }
.ov-collegend { display: flex; gap: 16px; margin-top: 6px; font: 12px var(--mono); color: var(--dim); }
.ov-collegend i.sq { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.ov-collegend i.sq.sent { background: var(--mute); }
.ov-collegend i.sq.rep { background: var(--green); }

/* the muted analyst / last-digest / pixel note beneath a band's tiles + chart */
.ov-note { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.ov-note .k { margin-right: 8px; }

/* Action Items sits full width; empty state comes from app.css .needs. Let the middle column shrink
   and wrap long tokens (reply-from emails, urls) so a row never forces horizontal scroll at 390px. */
.ov-needs { scroll-margin-top: calc(var(--top) + 12px); }
.ov-needs .needs a.item > span:not(.kind):not(.when) { min-width: 0; }
.ov-needs .needs .title, .ov-needs .needs .detail { overflow-wrap: anywhere; }

/* compact freshness strip — the machine's pulse in one line */
.ov-fresh { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; padding: 12px 4px 4px; border-top: 1px solid var(--line); }
.ov-fresh .fresh-item { display: inline-flex; align-items: baseline; gap: 8px; }
.ov-fresh .fl { font: 12px var(--mono); color: var(--mute); letter-spacing: 0.06em; text-transform: uppercase; }
.ov-fresh .fv { font: 12px var(--mono); color: var(--dim); }

/* recent orders list under the Store tiles (replaces the one-bar orders chart) */
.ov-orders { display: grid; gap: 4px; }
.ov-order { display: grid; grid-template-columns: minmax(140px, 1.4fr) minmax(70px, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.ov-order:hover { text-decoration: none; background: var(--panel2); }
.ov-order:last-child { border-bottom: 0; }
.ov-order-who { display: grid; min-width: 0; } .ov-order-who b { font-weight: 500; } .ov-order-who .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-order-amt { font: 15px var(--mono); text-align: right; white-space: nowrap; }
.ov-order-when { font: 12px var(--mono); color: var(--mute); white-space: nowrap; }
.ov-band .ov-chart svg.chart, .ov-band .ov-chart svg.cols { height: 200px; }
.ov-chart-sm svg.chart { height: 160px; }

/* ---- Action Items: dismiss controls (Package A / §S) — ADDITIVE only ---- */
/* Each row is the shell's .needs a.item plus a dismiss ×. The wrapper carries the row's bottom border so
   the anchor and the × share one line; the anchor keeps its intact 3-column layout (kind · text · when). */
.ov-needslist { display: grid; gap: 0; }
.ov-needslist .ov-need { display: grid; grid-template-columns: 1fr auto; align-items: stretch; border-bottom: 1px solid var(--line); }
.ov-needslist .ov-need:last-child { border-bottom: 0; }
.ov-needslist a.item { border-bottom: 0; min-width: 0; }
.ov-needslist a.item:hover { margin: 0; padding: 12px 8px; border-radius: 8px; }
.ov-x { align-self: center; flex: 0 0 auto; margin: 0 2px 0 8px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1; color: var(--mute); background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.ov-x:hover { color: var(--text); background: var(--panel2); border-color: var(--line2); }
.ov-x:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }

/* "Clear all" — a text button in the header, action blue, pushed to the right like a.more */
.ov-needs .band-head .ov-clear { margin-left: auto; background: transparent; border: 0; padding: 2px 4px; font: 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--action); cursor: pointer; }
.ov-needs .band-head .ov-clear:hover { color: var(--text); text-decoration: underline; }
.ov-needs .band-head .ov-clear:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }

/* Undo toast — fixed, bottom-center, above the page; auto-dismisses after 5s */
.ov-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: inline-flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 10px 16px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); font-size: 14px; color: var(--text); }
.ov-toast-msg { color: var(--dim); }
.ov-toast-undo { background: transparent; border: 0; padding: 2px 4px; font: 13px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--action); cursor: pointer; }
.ov-toast-undo:hover { color: var(--text); text-decoration: underline; }

/* ---- pinned tiles (CONTRACTS §Y2): a compact card for a watched campaign/product/page ----
   A tile-sized grid child (.w-tile) fed by GET /api/pins. Shows the pin's name and up to four 7-day
   metrics; a "loading" line stands in until the fetch lands so the tile is never blank. */
.ov-pin { align-content: start; gap: 8px; }
.ov-pin .k { color: var(--mute); }
.ov-pin-name { font-size: 16px; color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.ov-pin-metrics { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ov-pin-metrics > span { display: inline-flex; align-items: baseline; gap: 5px; font-size: 13px; color: var(--dim); }
.ov-pin-metrics b { font: 16px var(--mono); color: var(--text); font-weight: 500; }
.ov-pin-metrics .delta { font: 11px var(--mono); font-style: normal; color: var(--mute); }
.ov-pin-metrics .delta.up { color: var(--green); } .ov-pin-metrics .delta.down { color: var(--red); }
.ov-pin-ml { font: 11px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--mute); }
.ov-pin-loading { font-size: 13px; color: var(--mute); }

/* ---- Arrange mode (Package A §Y4) — ADDITIVE; the non-arranging grid is untouched ----
   The page's own header row holds the Arrange toggle; in Arrange mode every widget is boxed in a
   .ov-arr-item that carries the size class + a drag handle and size chip, and the dense grid re-packs live
   as items are dragged. All colours come from the shared tokens; motion is gated for reduced-motion. */
.ov-head { display: flex; justify-content: flex-end; align-items: center; margin-bottom: var(--gap); }
.ov-arrange-btn[aria-pressed="true"] { border-color: var(--action); color: var(--text); background: var(--panel2); }

/* the boxed widget while arranging: a dashed outline says "movable"; the box itself is transparent so the
   widget's own panel styling reads through unchanged */
.ov-arr-item { position: relative; }
.ov-arranging .ov-arr-item { outline: 1px dashed var(--line2); outline-offset: 3px; border-radius: var(--radius); }
.ov-arr-item.lifting { z-index: 5; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5); }
.ov-arr-item.lifting .ov-arr-body { opacity: 0.96; }
/* the lift scale + its transition are the only motion here, so both are gated behind no-preference */
@media (prefers-reduced-motion: no-preference) {
  .ov-arr-item { transition: transform 0.12s ease, box-shadow 0.12s ease; }
  .ov-arr-item.lifting { transform: scale(1.02); }
}

/* controls sit top-right, above the widget's own header content (which is non-interactive while arranging) */
.ov-arr-bar { position: absolute; top: 8px; right: 8px; z-index: 4; display: inline-flex; gap: 6px; align-items: center; }
.ov-handle { touch-action: none; cursor: grab; width: 32px; height: 26px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; letter-spacing: -2px; color: var(--dim); background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; }
.ov-handle:hover { color: var(--text); border-color: var(--action); }
.ov-handle:active { cursor: grabbing; }
.ov-handle:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }
.ov-sizechip { cursor: pointer; height: 26px; padding: 0 10px; display: inline-flex; align-items: center; font: 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--mute); background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; }
.ov-sizechip:hover { color: var(--text); border-color: var(--action); }
.ov-sizechip:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }
.ov-sizechip.static { cursor: default; }

/* the trailing "+ Add" tile: hidden registry widgets, each appendable, plus the pins hint */
.ov-arr-add { display: grid; gap: 10px; align-content: start; padding: 14px 16px; border: 1px dashed var(--line2); border-radius: var(--radius); background: var(--panel); }
.ov-arr-add-h { font: 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.ov-arr-add-list { display: grid; gap: 6px; }
.ov-arr-add-item { text-align: left; cursor: pointer; padding: 8px 10px; font-size: 14px; color: var(--text); background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; }
.ov-arr-add-item:hover { border-color: var(--action); }
.ov-arr-add-item:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }
.ov-arr-add-empty { font-size: 13px; color: var(--mute); margin: 0; }
.ov-arr-add-hint { font-size: 12px; color: var(--faint); margin: 0; }

/* the polite announcement region (visually hidden; lives on <body>) */
.ov-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
