/* Quarter grid (JS/components/okr-quarter-grid.js). Layout only, from existing primitives
   (`.ms-trigger`, `.cfg-popover`, `.at-tabs`, `.a-chip`). No new colour: selection uses
   `--a-blue`/`--a-blue-soft`. Past/current is a stronger border, never fill (as `.okr-cell.now`
   in CSS/okr.css), so selected and current can both hold. */

body.alt-app .okr-qg-trigger{
  width:auto; min-width:160px; max-width:220px;
}

body.alt-app .okr-qg-pop{
  width:min(380px, calc(100vw - 32px));
  padding:var(--a-3);
  display:flex; flex-direction:column; gap:var(--a-3);
}

/* Quick picks wrap rather than scroll: the popover's fixed 380px overflows the four tabs at
   any window width. `height:auto` lets `.at-tab`'s `height:100%` resolve to content. */
body.alt-app .okr-qg-quick{
  width:100%; height:auto; flex-wrap:wrap; row-gap:2px;
}

/* The window bar — not `.a-cal-h` (that belongs to CSS/alt/alt-rail.css, never
   loaded here), but the same reused chevron-button pair. Layout only. */
body.alt-app .okr-qg-window{
  display:flex; align-items:center; gap:6px;
}
body.alt-app .okr-qg-window-label{
  flex:1 1 auto; text-align:center; font-size:var(--a-fs-ctl-sm); font-weight:700; color:var(--a-dim);
}

/* ---- the grid itself ----
   `display:contents` on each row is what lets its five children fall into ONE
   shared grid instead of nesting a grid inside a grid, so every year's Q1 lines
   up under the one above it. */
body.alt-app .okr-qg-grid{
  display:grid; grid-template-columns:minmax(34px,auto) repeat(4,minmax(56px,1fr));
  gap:6px; max-height:min(360px, 50vh); overflow-y:auto; overflow-x:hidden;
  padding-right:2px;
}
body.alt-app .okr-qg-row{ display:contents; }

body.alt-app .okr-qg-year{
  display:flex; align-items:center; justify-content:flex-start;
  font-size:var(--a-fs-11); font-weight:700; color:var(--a-dim); padding:0 2px;
}
body.alt-app .okr-qg-head .okr-qg-colhead{
  display:flex; align-items:center; justify-content:center;
  font-size:var(--a-fs-11); font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  color:var(--a-faint); padding-bottom:2px; line-height:var(--a-lh-tight);
}

/* Cells at least `--a-row` (44px) tall — the design system's own touch-target floor,
   CSS/alt/alt-tokens.css. */
body.alt-app .okr-qg-cell{
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px;
  min-height:var(--a-row); border:1px solid var(--a-line-soft); border-radius:var(--a-r-sm);
  background:var(--a-raised); color:var(--a-text); cursor:pointer; padding:4px 2px;
  font-family:var(--a-body); text-align:center;
}
body.alt-app button.okr-qg-cell:hover{ border-color:var(--a-line-strong); }
body.alt-app button.okr-qg-cell:focus-visible{ outline:var(--a-focus); outline-offset:var(--a-focus-offset); }
body.alt-app .okr-qg-cell-label{ font-size:var(--a-fs-ctl-sm); font-weight:700; }
body.alt-app .okr-qg-cell-sub{ font-size:var(--a-fs-11); color:var(--a-dim); }
/* The state word beside the count, one line under the label rather than a third.
   `flex-wrap:wrap` because "upcoming" beside a two-digit chip is the widest pair. */
body.alt-app .okr-qg-cell-meta{
  display:flex; align-items:center; justify-content:center; flex-wrap:wrap;
  gap:0 3px; row-gap:1px;
}
body.alt-app .okr-qg-cell-state{ font-size:var(--a-fs-11); color:var(--a-dim); }
/* The separator never dangles: wrapped in its own inline-flex span so it and the
   chip move to a new line together or not at all, rather than a bare " · " left
   alone at the end of a line with the chip pushed to the next one. */
body.alt-app .okr-qg-cell-count-group{ display:inline-flex; align-items:baseline; }
/* A real `.a-chip`, shrunk to fit rather than restated as bespoke text — only its
   padding/height and cursor are overridden, since the cell is the click target. */
body.alt-app .okr-qg-cell-chip{
  height:16px; padding:0 6px; cursor:inherit; background:var(--a-panel); border-color:transparent;
}
body.alt-app .okr-qg-cell-chip .n{ font-size:var(--a-fs-11); opacity:.85; }

/* SELECTION IS THE ONLY THING THAT TAKES COLOUR HERE — see the header comment. */
body.alt-app .okr-qg-cell.on{
  border-color:var(--a-blue); background:var(--a-blue-soft); color:var(--a-blue-text);
}
body.alt-app .okr-qg-cell.on .okr-qg-cell-sub{ color:var(--a-blue-text); }
body.alt-app .okr-qg-cell.on .okr-qg-cell-state{ color:var(--a-blue-text); }
body.alt-app .okr-qg-cell.on .okr-qg-cell-chip{ background:var(--a-blue-soft); }

/* CURRENT IS STRUCTURE, NOT SELECTION — a stronger edge, matching `.okr-cell.now` in
   CSS/okr.css exactly for the reason recorded there: a fill would make "today's quarter" read
   as chosen no matter what the reader actually picked. */
body.alt-app .okr-qg-cell.is-current{ border-color:var(--a-line-strong); }
body.alt-app .okr-qg-cell.is-current.on{ border-color:var(--a-blue); }

/* No board — `.okr-cell.empty`'s recipe, carried over rather than reinvented. In
   `periods` mode this is a plain `<div>`; in `range` mode a real button. */
body.alt-app .okr-qg-cell.no-board{
  background:transparent; border-style:dashed; color:var(--a-faint);
}
body.alt-app .okr-qg-cell.no-board .okr-qg-cell-sub{ color:var(--a-faint); }
body.alt-app div.okr-qg-cell.no-board{ cursor:default; }

/* ---- footer ---- */
body.alt-app .okr-qg-footer{
  display:flex; align-items:center; justify-content:space-between; gap:var(--a-3);
  padding-top:var(--a-2); border-top:1px solid var(--a-line-soft);
}
body.alt-app .okr-qg-summary{
  font-size:var(--a-fs-ctl-sm); color:var(--a-dim); min-width:0; overflow:hidden; text-overflow:ellipsis;
  white-space:nowrap;
}
body.alt-app .okr-qg-actions{ display:flex; gap:6px; flex:0 0 auto; }

/* ---- phone width: the grid still fits; the trigger just stops being narrow next
   to everything else that has already gone full-width (alt-responsive.css's pattern). ---- */
@media (max-width:639px){
  body.alt-app .okr-qg-trigger{ width:100%; max-width:none; }
  body.alt-app .okr-qg-pop{ width:min(340px, calc(100vw - 24px)); }
  body.alt-app .okr-qg-grid{ grid-template-columns:minmax(28px,auto) repeat(4,minmax(48px,1fr)); gap:4px; }
}
