/* Overblik — the task overview tab (docs/overview-spec.md §4, §6, §9).
   Flat and monochrome: app tokens only. Red (--hq-needs-you) and green
   (--hq-live) are dot fills in .ov-needs / .ov-live and nothing else, so every
   status word stays ink or muted. No effects and no motion. Mobile first: the
   wide grid, the sticky toolbar and the 220 px / 1100 px values live in the
   min-width block. Every selector starts with .overview. */

.overview { display: block; padding: 12px 16px 24px; color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.35; }
.overview .ov-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.overview [data-item] { scroll-margin-top: 109px; } /* topbar 57 + tabs 44 + 8 (the toolbar is not sticky here) */

/* ---- toolbar ---- */
.overview .ov-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.overview .ov-name { font-size: 18px; margin: 0 4px 0 0; }
.overview .ov-lens { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.overview .ov-lens button {
  height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.overview .ov-lens button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); }
.overview .ov-short { display: none; }
.overview .ov-tools { display: flex; align-items: center; gap: 8px; min-width: 0; }
.overview .ov-pick, .overview .ov-find {
  height: 36px; min-width: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
.overview .ov-find { width: 240px; }
.overview .ov-pick { display: none; }
.overview .ov-qbtn {
  width: 36px; height: 36px; flex: none; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer;
}
.overview .ov-banner {
  margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--ink); font-size: 13px;
}

/* ---- slice panel (desktop) ---- */
.overview .ov-side { display: none; }
.overview .ov-slices ul { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.overview .ov-sl {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 4px 8px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; cursor: pointer;
}
.overview .ov-sl:hover { background: var(--surface-2); }
.overview .ov-sl[aria-current="true"] { background: var(--surface-3); font-weight: 700; }
.overview .ov-sln { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- the list panel ---- */
.overview .ov-panel { min-width: 0; padding: 4px 12px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.overview .ov-hits { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.overview .ov-link { padding: 0; border: 0; background: transparent; color: var(--ink); text-decoration: underline; cursor: pointer; }
.overview .ov-empty { margin: 0; padding: 16px 4px; color: var(--muted); overflow-wrap: anywhere; }
.overview .ov-empty p { margin: 0 0 10px; }
.overview .ov-acts { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- headings ---- */
.overview .ov-hz { margin: 16px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.overview .ov-sh { display: flex; align-items: center; gap: 6px; }
.overview h3.ov-sh { margin: 10px 0 4px; font-size: 14px; letter-spacing: 0; text-transform: none; }
.overview .ov-cnt { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.overview .ov-fold {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 32px; padding: 2px 4px 2px 0;
  border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit;
  letter-spacing: inherit; text-transform: inherit; text-align: left; cursor: pointer;
}
.overview .ov-caret { width: 12px; flex: none; color: var(--muted); }
.overview .ov-note { margin: 2px 0 6px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.overview .ov-band { margin: 8px 0 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.overview .ov-subh { margin: 8px 0 2px; font-size: 13px; }
.overview .ov-gh { margin: 8px 0 2px; font-size: 14px; }
.overview .ov-gh .ov-fold { flex-wrap: wrap; gap: 4px 8px; }
.overview .ov-gname { font-weight: 700; overflow-wrap: anywhere; }
.overview .ov-heads { color: var(--muted); font-size: 13px; font-weight: 400; }
.overview .ov-frag { display: inline-flex; align-items: center; gap: 4px; }
.overview .ov-loud { color: var(--ink); font-weight: 700; }
.overview .ov-pinp { margin: 10px 0 4px; }
.overview .ov-pin {
  min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.overview .ov-pinhint { color: var(--muted); }

/* ---- rows ---- */
.overview .ov-rows { list-style: none; margin: 0; padding: 0; }
.overview .ov-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) 40px; grid-template-areas: "lead main menu" ". meta menu";
  align-items: center; column-gap: 8px; row-gap: 2px; min-height: 44px; padding: 4px 4px 4px 6px;
  border-radius: 8px; cursor: pointer;
}
.overview .ov-row:hover, .overview .ov-row:focus-visible { background: var(--surface-2); }
.overview .ov-lead { grid-area: lead; display: inline-flex; justify-content: center; color: var(--muted); }
.overview .ov-num { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.overview .ov-g { display: block; width: 12px; height: 12px; flex: none; }
.overview .ov-main {
  grid-area: main; min-width: 0; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.overview .ov-key { margin-right: 6px; color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.overview .ov-key:empty { display: none; }
.overview .ov-title { color: var(--ink); }
.overview .ov-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; font-size: 12px; }
.overview .ov-meta > :empty { display: none; }
.overview .ov-mark { order: 1; display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; font-size: 13px; }
.overview .ov-mt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview .ov-proj { order: 2; }
.overview .ov-prio { order: 3; }
.overview .ov-age { order: 4; }
.overview .ov-badges { order: 5; }
.overview .ov-soft { display: none; } /* ready/backlog ages are desktop only */
.overview .ov-t-needs { color: var(--ink); font-weight: 700; }
.overview .ov-t-ink, .overview .ov-t-live { color: var(--ink); }
.overview .ov-t-quiet, .overview .ov-t-muted { color: var(--muted); }
.overview .ov-dot { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; }
.overview .ov-needs { background: var(--hq-needs-you); }
.overview .ov-live { background: var(--hq-live); }
.overview .ov-proj {
  max-width: 100%; min-width: 0; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px;
}
.overview .ov-where { padding: 0; border-color: transparent; }
.overview .ov-age { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.overview .ov-prio { color: var(--ink); white-space: nowrap; }
.overview .ov-p-urgent { font-weight: 700; }
.overview .ov-p-low { color: var(--muted); }
.overview .ov-badges { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.overview .ov-badge { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; }
/* Follow-ups (docs/followups-spec.md §6.4): a muted tag — right after the
   marker on a phone, its own line under the title ≥ 981 px. Never a colour. */
.overview .ov-follow { order: 1; min-width: 0; max-width: 100%; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.overview .ov-follow > span + span::before { content: " · "; }
.overview .ov-dots {
  grid-area: menu; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer;
}
.overview .ov-dots:hover, .overview .ov-dots[aria-expanded="true"] { background: var(--surface-3); color: var(--ink); }
.overview .ov-ptr .ov-lead { font-weight: 700; }
.overview .ov-line .ov-main { font-weight: 600; -webkit-line-clamp: 3; }
.overview .ov-morel { padding: 2px 0 4px 30px; }
.overview .ov-more {
  min-height: 32px; padding: 4px 0; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer;
}

/* ---- the I gang row ---- */
.overview .ov-nowsub { grid-column: 2 / 3; min-width: 0; }
.overview .ov-steps { display: flex; flex-wrap: wrap; gap: 2px 6px; margin: 4px 0 2px; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.overview .ov-step[aria-current="step"], .overview .ov-did { color: var(--ink); }
.overview .ov-sep { margin-right: 6px; color: var(--muted); }
.overview .ov-nowmeta { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.overview .ov-nowmeta > span + span:not(:empty)::before { content: " · "; }
.overview .ov-foot { font-size: 12px; }

/* ---- menu: popover ≥ 601 px, bottom sheet ≤ 600 px (§4.3) ---- */
.overview .ov-scrim { position: fixed; inset: 0; z-index: 34; background: transparent; }
.overview .ov-menu {
  position: fixed; z-index: 35; min-width: 220px; max-width: min(320px, calc(100vw - 32px)); max-height: 70vh;
  overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
}
.overview .ov-mtitle { margin: 4px 10px 6px; color: var(--muted); font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.overview .ov-mnote, .overview .ov-minote { margin: 0 10px 6px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.overview .ov-mgl { margin: 6px 10px 2px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.overview .ov-msep { height: 1px; margin: 4px 0; background: var(--line); }
.overview .ov-mi {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 6px 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.overview .ov-mi:hover, .overview .ov-mi:focus { background: var(--surface-3); }
.overview .ov-mi[aria-disabled="true"] { color: var(--muted); cursor: default; }
.overview .ov-mil { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.overview .ov-rd { width: 14px; flex: none; }
.overview .ov-hint {
  flex: none; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px;
  color: var(--muted); font-family: var(--mono); font-size: 11px;
}

/* ---- cheat sheet ---- */
.overview .ov-keys {
  max-width: min(460px, calc(100vw - 32px)); padding: 16px 20px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.overview .ov-keys::backdrop { background: var(--ink); opacity: .35; }
.overview .ov-keys h2 { margin: 0 0 10px; font-size: 16px; }
.overview .ov-kl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0 0 10px; }
.overview .ov-kl dd { margin: 0; }
.overview .ov-keys kbd { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.overview .ov-kfoot { margin: 0 0 10px; color: var(--muted); font-size: 13px; }

/* ---- ≤ 980 px: two-line rows, no slice panel, toolbar wraps (§4.2) ---- */
@media (max-width: 980px) {
  .overview .ov-name { display: none; }
  .overview .ov-lens { width: 100%; }
  .overview .ov-lens button { flex: 1 1 0; }
  .overview .ov-tools { width: 100%; }
  .overview .ov-pick { display: block; flex: 0 1 auto; max-width: 45%; }
  .overview .ov-find { flex: 1 1 auto; width: auto; }
  .overview .ov-mt { white-space: normal; overflow-wrap: anywhere; } /* a loud marker keeps its action words at 343 px */
}
@media (max-width: 980px) and (pointer: coarse) {
  .overview .ov-qbtn { display: none; }
}

/* ---- ≤ 600 px: short lens labels, 16 px fields (no iOS zoom), bottom sheet ---- */
@media (max-width: 600px) {
  .overview .ov-long { display: none; }
  .overview .ov-short { display: inline; }
  .overview .ov-find, .overview .ov-pick { font-size: 16px; }
  .overview .ov-menu {
    left: 16px; right: 16px; bottom: 16px; top: auto; max-width: none; max-height: 60dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .overview .ov-mi { min-height: 44px; }
}

/* ---- ≥ 981 px: one-line row grid, sticky toolbar, slice panel (§4.1) ---- */
@media (min-width: 981px) {
  .overview { max-width: 1100px; margin: 0 auto; padding: 18px 16px 24px; }
  .overview [data-item] { scroll-margin-top: 117px; } /* topbar 57 + toolbar 52 + 8 */
  .overview .ov-bar { position: sticky; top: 57px; z-index: 10; flex-wrap: nowrap; height: 52px; margin: 0 0 12px; background: var(--bg); }
  .overview .ov-tools { margin-left: auto; }
  .overview .ov-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
  .overview .ov-side { display: block; position: sticky; top: 117px; }
  .overview .ov-row {
    /* The title keeps at least 9rem; markers shrink (with an ellipsis) before it does. */
    grid-template-columns: 24px 64px minmax(9rem, 1fr) fit-content(11rem) fit-content(14rem) 112px 92px 72px 32px;
    grid-template-areas: none; min-height: 36px; padding: 2px 4px 2px 6px;
  }
  .overview .ov-main, .overview .ov-meta { display: contents; }
  .overview .ov-lead, .overview .ov-dots { grid-area: auto; }
  .overview .ov-key { margin: 0; overflow: hidden; text-overflow: ellipsis; }
  .overview .ov-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .overview .ov-meta > :empty { display: block; }
  .overview .ov-soft { display: block; }
  .overview .ov-mark, .overview .ov-proj, .overview .ov-prio, .overview .ov-age, .overview .ov-badges { order: 0; }
  .overview .ov-proj { justify-self: start; }
  .overview .ov-proj:empty { border-color: transparent; }
  .overview .ov-dots { width: 32px; height: 32px; }
  .overview .ov-line .ov-title { grid-column: 3 / -1; white-space: normal; }
  .overview .ov-nowsub { grid-column: 3 / -1; }
  .overview .ov-follow { grid-row: 2; grid-column: 3 / -1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ---- desktop drag (Appendix A): Næste and Senere rows only. A 2 px ink line
   marks the slot and takes no space (a 2 px top border on a 0 px box, margins
   −1), so the row midpoints never shift under the pointer. It is a border, not
   a background: forced colours (High Contrast) paint backgrounds as Canvas but
   keep borders visible. A clamped line carries a muted 11 px note on the side
   away from its lane. Still and flat. ---- */
@media (min-width: 981px) and (pointer: fine) {
  .overview .ov-dragging { opacity: .45; }
  .overview .ov-drop {
    position: relative; height: 0; margin: -1px 0; padding: 0;
    border-top: 2px solid var(--ink); pointer-events: none;
  }
  .overview .ov-dropnote {
    position: absolute; right: 40px; bottom: 5px; padding: 0 6px; border-radius: 4px;
    background: var(--surface); color: var(--muted); font-size: 11px; line-height: 16px; white-space: nowrap;
  }
  .overview .ov-drop-below .ov-dropnote { top: 3px; bottom: auto; }
}
