/* ZNLove brand: navy #000528, sky-blue #A1D4FF, teal #00c79e */
:root {
  color-scheme: light;  /* native widgets (checkboxes, date pickers) follow the theme */
  --bg: #f3f7fc; --card: #ffffff; --ink: #000528; --muted: #5b6472;
  --line: #e2e8f2; --accent: #000528; --accent-ink: #ffffff;
  --active-bg: #dceeff; --active-ink: #000528; --ring: #7cc0ff;
  --ok: #00745c; --okbg: #d6f7ee; --saving: #fff3c4; --err: #fde2e2; --err-ink: #b91c1c;
  --chart: #2E6FBE; --chart-soft: #9CCAF0; --chart-track: #DCE6F3; --over: #C93B54;
  --heat-ok-bg: #DDF3EC; --heat-ok-ink: #045F4B; --heat-full-bg: #D9E9FB; --heat-full-ink: #1A4E8A;
  --heat-over-bg: #FBE2E6; --heat-over-ink: #9E2038;
  --head: #eef3fb;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000528; --card: #0a1440; --ink: #e9f1ff; --muted: #93a2c8;
  --line: #1b2a5c; --accent: #a1d4ff; --accent-ink: #001133;
  --active-bg: rgba(161,212,255,.16); --active-ink: #a1d4ff; --ring: #a1d4ff;
  --ok: #2fd4ac; --okbg: #06301f; --saving: #3a340f; --err: #3d1620; --err-ink: #fca5a5;
    --chart: #7FB8F0; --chart-soft: #46699F; --chart-track: #202F66; --over: #E85D70;
    --heat-ok-bg: #0D3B31; --heat-ok-ink: #6FE0C4; --heat-full-bg: #14305F; --heat-full-ink: #A1D4FF;
    --heat-over-bg: #46141F; --heat-over-ink: #FFA7B4;
  --head: #0d1a4a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000528; --card: #0a1440; --ink: #e9f1ff; --muted: #93a2c8;
    --line: #1b2a5c; --accent: #a1d4ff; --accent-ink: #001133;
    --active-bg: rgba(161,212,255,.16); --active-ink: #a1d4ff; --ring: #a1d4ff;
    --ok: #2fd4ac; --okbg: #06301f; --saving: #3a340f; --err: #3d1620; --err-ink: #fca5a5;
    --chart: #7FB8F0; --chart-soft: #46699F; --chart-track: #202F66; --over: #E85D70;
    --heat-ok-bg: #0D3B31; --heat-ok-ink: #6FE0C4; --heat-full-bg: #14305F; --heat-full-ink: #A1D4FF;
    --heat-over-bg: #46141F; --heat-over-ink: #FFA7B4;
    --head: #0d1a4a;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.brand { letter-spacing: -0.01em; }
h1 { letter-spacing: -0.015em; }
.topbar {
  display: flex; align-items: center; gap: 8px 18px;
  padding: 0 18px; min-height: 54px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; white-space: nowrap; color: var(--ink); text-decoration: none; }
/* main nav: flat links plus two grouped menus, one row on any laptop */
.mainnav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.mainnav > a, .navmenu > summary {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 7px 11px; border-radius: 8px; white-space: nowrap; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 4px; line-height: 1.3;
}
.mainnav > a:hover, .navmenu > summary:hover { color: var(--ink); background: var(--active-bg); }
.mainnav > a.active, .navmenu > summary.active { color: var(--active-ink); background: var(--active-bg); }
.mainnav > a:focus-visible, .navmenu > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.navmenu { position: relative; }
.navmenu > summary { list-style: none; }
.navmenu > summary::-webkit-details-marker { display: none; }
.navmenu .caret, .btnmenu .caret { font-size: 11px; color: var(--muted); transition: transform .15s; margin-left: 1px; }
.navmenu[open] .caret, .btnmenu[open] .caret { transform: rotate(180deg); }
.menu-list {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 240px;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 36px rgba(0,0,0,.16);
}
.menu-list.menu-end { left: auto; right: 0; }
.menu-list > a, .menu-list > button, .menu-list > form > button {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink);
  background: none; border: 0; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; line-height: 1.3;
}
.menu-list > a small { font-weight: 500; font-size: 12px; color: var(--muted); }
.menu-list > button, .menu-list > form > button { flex-direction: row; align-items: center; gap: 8px; }
.menu-list > a:hover, .menu-list > button:hover, .menu-list > form > button:hover { background: var(--active-bg); }
.menu-list > a.active { color: var(--active-ink); background: var(--active-bg); }
.menu-list > a.active small { color: var(--active-ink); opacity: .75; }
.menu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; line-height: 1.3; }
.menu-who b { font-size: 14px; }
.menu-who small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.logout-form { display: block; }
.usermenu { margin-left: auto; }
.usermenu > summary { padding: 3px; border-radius: 50%; }
.usermenu > summary:hover { background: var(--active-bg); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
/* a card that folds: summary reads as a button row, body is the form */
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .card-title { margin: 0; }
details.fold[open] > summary { margin-bottom: 6px; }
details.fold > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
/* a button that opens a small menu (⬇ Download on /project) */
.btnmenu { position: relative; display: inline-block; }
.btnmenu > summary { list-style: none; cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 6px; }
.btnmenu > summary::-webkit-details-marker { display: none; }
.btnmenu[open] > summary { border-color: var(--accent); box-shadow: 0 0 0 3px var(--chart-track); }
/* bulk actions beside the period arrows: a visible gap says "not navigation" */
.week-actions { display: flex; gap: 8px; margin-right: 10px; padding-right: 10px; border-right: 1px solid var(--line); }
/* phone tab bar — off unless the phone media query below turns it on */
.tabbar { display: none; }
.theme-btn {
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.theme-btn:hover { background: var(--active-bg); }
.theme-fixed { position: fixed; top: 16px; right: 16px; z-index: 10; }
main { max-width: 1280px; width: 100%; margin: 26px auto; padding: 0 22px; }
h1 { font-size: 26px; margin: 0 0 4px; }
.subtle { color: var(--muted); font-size: 13.5px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; max-width: 580px; margin: 0 auto;
}
.entry-form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--muted); }
label[hidden] { display: none; }   /* the flex above would otherwise win */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row2 > label { min-width: 0; } /* grid blowout guard: lets date/number inputs shrink instead of overlapping */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; width: 100%;
}
input[type="date"] {
  -webkit-appearance: none; appearance: none; min-width: 0; text-align: left;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ring); border-color: var(--ring); }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line);
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  padding: 9px 14px; border-radius: 9px; text-decoration: none; display: inline-block;
}
.btn { background: var(--card); color: var(--ink); }
.flash { background: var(--okbg); color: var(--ok); border-radius: 9px; padding: 10px 12px; margin: 12px 0; font-weight: 600; }

/* busy states — every page is rendered from Notion and every write goes back
   to it, so a click routinely sits for seconds. The browser's own tab spinner
   is far too easy to miss on the wide grids, hence our own top bar for page
   navigations and a spinner-in-the-button for in-place saves. */
.navprog {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  z-index: 20; pointer-events: none; overflow: hidden;
}
.navprog i {
  display: block; height: 100%; width: 40%; border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, transparent, var(--ring), var(--accent));
  animation: navslide 1.1s ease-in-out infinite;
}
@keyframes navslide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

button.is-busy, .btn.is-busy { cursor: progress; opacity: .75; }
button.is-busy::before, .btn.is-busy::before {
  content: ""; display: inline-block; width: 12px; height: 12px;
  margin-right: 8px; vertical-align: -1px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
button:disabled, .btn:disabled { cursor: not-allowed; opacity: .55; }
/* a busy dialog: inputs greyed so it reads as "in flight", not "broken" */
dialog.pop.is-busy label { opacity: .6; }

@media (prefers-reduced-motion: reduce) {
  .navprog i { width: 100%; animation: navpulse 1.4s ease-in-out infinite; }
  @keyframes navpulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
  button.is-busy::before, .btn.is-busy::before { animation: none; }
}

/* weekly grid */
.week-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; }
.weeknav { display: flex; gap: 8px; }
.grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
table.grid { border-collapse: collapse; width: 100%; min-width: 520px; }
.grid th, .grid td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: center; font-size: 15px; }
.grid thead th { background: var(--head); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); position: sticky; top: 0; }
.grid thead .col-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.grid thead .col-link:hover { color: var(--accent); }
.col-person, .col-project { text-align: left; overflow-wrap: anywhere; }  /* long one-word names wrap instead of painting over cells */
/* keep the Project column visible while day columns scroll horizontally;
   min-width stops wide tables (Assignments) from starving it under
   overflow-wrap:anywhere and wrapping names one character per line */
.grid .col-project { position: sticky; left: 0; background: var(--card); z-index: 1; min-width: 180px; }
.grid thead .col-project, .grid tfoot .col-project { background: var(--head); z-index: 2; }
.grid .col-person { font-weight: 600; }
.dnum { display: block; font-size: 11px; color: var(--muted); }
.cell { padding: 4px; }
.cell input { text-align: center; padding: 9px 4px; font-size: 15px; background: transparent; border: 1px solid transparent; border-radius: 7px; min-width: 52px; }
.cell input:hover { border-color: var(--line); }
.cell input:focus { background: var(--bg); }
.cell input.saving { background: var(--saving); }
.cell input.saved { background: var(--okbg); }
.cell input.err { background: var(--err); }
.rowtotal, .col-total { font-weight: 700; }
.grid tfoot td { background: var(--head); font-weight: 700; }
.empty td { color: var(--muted); padding: 22px; }
.addrow { max-width: none; margin-top: 18px; }
.addrow .row2 { grid-template-columns: 1fr 1fr auto; align-items: end; margin: 10px 0; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

/* ---- schedule planner -------------------------------------------------- */
/* Eight pill colors, assigned to a project by a hash of its id (_swatch in
   app.py) so a project keeps its color everywhere. Backgrounds are tinted,
   ink is the same hue darkened/lightened, so text stays readable in both
   themes. Declared separately from the main theme blocks to keep those
   readable — same three selectors, palette only. */
:root {
  --s0:#DCE9FB; --s0i:#1A4E8A; --s1:#D6F2EA; --s1i:#0A6B57;
  --s2:#FBEAD2; --s2i:#8A5411; --s3:#E6E1FA; --s3i:#463596;
  --s4:#FBE0E6; --s4i:#9E2038; --s5:#E3F1D8; --s5i:#3C6821;
  --s6:#D8EDF5; --s6i:#125A70; --s7:#F3E1F6; --s7i:#792B85;
}
:root[data-theme="dark"] {
  --s0:#16305F; --s0i:#A9CFFF; --s1:#0D3B31; --s1i:#6FE0C4;
  --s2:#40300F; --s2i:#F0CC8A; --s3:#26205A; --s3i:#BDB2FF;
  --s4:#46141F; --s4i:#FFA7B4; --s5:#1D3312; --s5i:#B7E39A;
  --s6:#0F303B; --s6i:#8FD6EC; --s7:#351340; --s7i:#E8B0F0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s0:#16305F; --s0i:#A9CFFF; --s1:#0D3B31; --s1i:#6FE0C4;
    --s2:#40300F; --s2i:#F0CC8A; --s3:#26205A; --s3i:#BDB2FF;
    --s4:#46141F; --s4i:#FFA7B4; --s5:#1D3312; --s5i:#B7E39A;
    --s6:#0F303B; --s6i:#8FD6EC; --s7:#351340; --s7i:#E8B0F0;
  }
}

table.plan { min-width: 720px; }
/* .grid td's text-align:center outranks .col-project's left — restate it here */
.plan td.col-project, .plan th.col-project { text-align: left; }
.plan .col-day { min-width: 148px; }
.plan-cell {
  position: relative; vertical-align: top; text-align: left;
  cursor: pointer; min-width: 148px;
}
/* `.grid td` (line ~131) outranks a bare `.plan-cell`, so the padding has to
   be written with the td to actually win — it silently didn't before. This
   also outranks the narrow-screen `.grid th, .grid td { padding: 7px 6px }`,
   deliberately: `table.plan`'s 720px min-width already puts this grid on a
   horizontal scroller below 560px, so there is nothing to tighten for. */
.plan td.plan-cell { padding: 8px; }
.plan-cell:hover { background: var(--active-bg); }
/* the capacity meter: how full the day is against DAY_TARGET_HOURS */
.cap { height: 4px; border-radius: 3px; background: var(--chart-track); overflow: hidden; }
.cap i { display: block; height: 100%; border-radius: 3px; background: var(--chart); }
.cap-ok i { background: var(--ok); }
.cap-full i { background: var(--chart); }
.cap-over i { background: var(--over); }
.cap-num { font-size: 11px; font-weight: 700; color: var(--muted); margin: 3px 0 5px; min-height: 14px; }
.cap-of { font-weight: 500; opacity: .7; }
.cap-over + .cap-num { color: var(--over); }
.pills { display: flex; flex-direction: column; gap: 4px; }
.pill {
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
  width: 100%; padding: 5px 8px; border-radius: 7px; border: 1px solid transparent;
  font-size: 12.5px; font-weight: 600; text-align: left; line-height: 1.25;
  background: var(--s0); color: var(--s0i);
}
.pill:hover { border-color: currentColor; }
.pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-h { font-weight: 700; flex: none; opacity: .85; }
.pill.s0 { background: var(--s0); color: var(--s0i); }
.pill.s1 { background: var(--s1); color: var(--s1i); }
.pill.s2 { background: var(--s2); color: var(--s2i); }
.pill.s3 { background: var(--s3); color: var(--s3i); }
.pill.s4 { background: var(--s4); color: var(--s4i); }
.pill.s5 { background: var(--s5); color: var(--s5i); }
.pill.s6 { background: var(--s6); color: var(--s6i); }
.pill.s7 { background: var(--s7); color: var(--s7i); }
/* the add affordance: always in the flow beneath the pills, so it can never
   sit on top of one, and always visible (faintly) so it works on touch, where
   there is no hover to reveal it */
.addbtn {
  display: block; width: 100%; margin-top: 4px; padding: 3px 0;
  background: none; border: 1px dashed var(--line); border-radius: 7px;
  font-size: 13px; font-weight: 700; line-height: 1.25; text-align: center;
  color: var(--muted); opacity: .5;
  transition: opacity .12s ease, color .12s ease, border-color .12s ease;
}
.plan-cell:hover .addbtn { opacity: 1; }
.addbtn:hover { color: var(--ink); border-color: var(--ring); background: var(--card); }
.addbtn:focus-visible { opacity: 1; outline: 2px solid var(--ring); outline-offset: 1px; }
.plan-hint { margin-top: 12px; }

/* ---- the planner scrolls inside itself ---------------------------------
   `.grid thead th` has been position:sticky all along, but sticky needs a
   scroll container that actually scrolls: .grid-wrap only ever scrolled
   sideways, so vertically the header just left with the page and you lost
   track of which column was which day. Bounding the planner to the viewport
   gives the header something to stick to — and the totals row sticks to the
   bottom edge for the same reason. Short weeks are unaffected: a table under
   the max-height never scrolls. */
/* The grid is also sticky itself, docked just under the top bar: bounding it
   to the viewport is not enough on its own, because the little the *page*
   still scrolls (the hint under the grid, the footer) would slide the whole
   box — sticky header and all — up behind the bar. --topbar-h is measured in
   base.html, since the bar wraps to two lines on a narrow window. */
.plan-scroll {
  position: sticky; top: calc(var(--topbar-h, 60px) + 10px); z-index: 1;
  max-height: calc(100vh - var(--topbar-h, 60px) - 120px);
  min-height: 240px; overflow: auto;
}
/* above the body's sticky first column (z-index 1), and the corner cells
   above their own row so the person column can't paint over them */
.plan-scroll thead th { z-index: 3; }
.plan-scroll thead .col-project { z-index: 4; }
.plan-scroll tfoot td { position: sticky; bottom: 0; z-index: 3; }
.plan-scroll tfoot .col-project { z-index: 4; }
/* the last body row's border disappears under the sticky footer otherwise */
.plan-scroll tfoot td { box-shadow: 0 -1px 0 var(--line); }
@media (max-width: 720px) { .plan-scroll { max-height: calc(100vh - 150px - var(--tabbar-h, 0px)); } }

/* ---- dragging a booking ------------------------------------------------ */
.plan .pill[draggable="true"] { cursor: grab; }
.plan .pill.is-dragging { opacity: .4; cursor: grabbing; }
/* while a drag is live every cell is a target — say so, faintly, so the
   landing spots are visible before the pointer reaches them */
.plan.is-dnd .plan-cell { outline: 1px dashed var(--line); outline-offset: -3px; }
.plan.is-dnd .plan-cell.is-over { outline: 2px solid var(--ring); background: var(--active-bg); }
/* The cell's own buttons are dead zones mid-drag: a drop that lands on the +
   (or the ×) is refused by the browser and the booking snaps back, which
   reads as "drag doesn't work" — and the + sits exactly where an empty cell
   invites you to aim. Taking them out of the hit-testing makes the whole
   cell one uniform drop target. */
.plan.is-dnd .addbtn, .plan.is-dnd .cellx { pointer-events: none; }
/* A dropped pill is drawn in its new place immediately and the Notion write
   runs behind it, so this is the only trace of the wait: the pill reads as
   settled, just not yet acknowledged. Deliberately quiet — a refusal is
   reported out loud, and everything else needs no comment. */
.plan .pill.is-pending { opacity: .72; outline: 1px dashed currentColor; outline-offset: -2px; }
@media (prefers-reduced-motion: no-preference) {
  .plan .pill.is-pending { transition: opacity .15s ease; }
}

/* ---- selecting bookings, pasting them onto other days ------------------ */
.plan .pill.is-picked {
  outline: 2px solid var(--ring); outline-offset: 1px;
  box-shadow: 0 2px 8px rgba(0,5,40,.18);
}
/* while something is held, every other day is a target — the same faint
   dashed invitation a live drag paints, for the same reason */
.plan.is-picking .plan-cell { outline: 1px dashed var(--line); outline-offset: -3px; cursor: copy; }
.plan.is-picking .plan-cell:hover { outline: 2px solid var(--ring); background: var(--active-bg); }
/* the cell the selection came from is not a target */
.plan.is-picking .plan-cell:has(.pill.is-picked) { outline: none; cursor: default; }
.plan .plan-cell.is-pasted { animation: paste-flash .6s ease-out; }
@keyframes paste-flash { from { background: var(--okbg); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .plan .plan-cell.is-pasted { animation: none; } }

/* selects the whole cell — the touch way in, since ⌘-click has no equivalent */
.cellcopy {
  position: absolute; top: 6px; right: 26px; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 5px; background: none;
  color: var(--muted); font-size: 12px; line-height: 1; opacity: 0;
  transition: opacity .12s ease, color .12s ease, background .12s ease;
}
.plan-cell:hover .cellcopy { opacity: .75; }
.cellcopy:hover { opacity: 1; color: var(--ink); background: var(--card); }
.cellcopy:focus-visible { opacity: 1; outline: 2px solid var(--ring); outline-offset: 1px; }
.plan-cell.is-empty .cellcopy { display: none; }
.plan.is-dnd .cellcopy { pointer-events: none; }

/* what is held, and how to be rid of it. Sticky to the bottom of the viewport
   because the days being pasted into are up in the grid — the bar must not be
   the thing you scroll away from. */
.pastebar {
  position: sticky; bottom: 14px; z-index: 6; margin-top: 14px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--ring);
  box-shadow: 0 10px 26px rgba(0,5,40,.16);
}
.pastebar[hidden] { display: none; }   /* .btn's display would otherwise win */
.pastebar-what { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.pastebar-what .subtle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pastebar-how { margin-left: auto; }
@media (max-width: 700px) { .pastebar-how { display: none; } }

/* empties one cell — hidden while the cell has nothing in it, which is also
   how a cell filled in without a reload gets its × back */
.cellx {
  position: absolute; top: 6px; right: 5px; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 5px; background: none;
  color: var(--muted); font-size: 15px; line-height: 1; opacity: 0;
  transition: opacity .12s ease, color .12s ease, background .12s ease;
}
.plan-cell:hover .cellx { opacity: .75; }
.cellx:hover { opacity: 1; color: var(--over); background: var(--card); }
.cellx:focus-visible { opacity: 1; outline: 2px solid var(--ring); outline-offset: 1px; }
.plan-cell.is-empty .cellx { display: none; }

/* clears the whole day column, in that day's header */
.dayx {
  display: block; margin: 3px auto 0; padding: 0 4px; border: 0; background: none;
  font-size: 11px; line-height: 1.4; color: var(--muted); opacity: .45; border-radius: 5px;
  transition: opacity .12s ease, background .12s ease;
}
.col-day:hover .dayx { opacity: 1; }
.dayx:hover { background: var(--card); }
.dayx:focus-visible { opacity: 1; outline: 2px solid var(--ring); outline-offset: 1px; }

/* assign popover */
dialog.pop {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink);
  padding: 18px; width: min(340px, calc(100vw - 32px)); box-shadow: 0 18px 40px rgba(0,5,40,.22);
}
dialog.pop::backdrop { background: rgba(0,5,40,.35); }
.pop-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.pop-x { background: none; border: none; color: var(--muted); font-size: 20px; padding: 0 4px; line-height: 1; }
dialog.pop label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
dialog.pop label .subtle { font-size: 11.5px; }
.pop-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.pop-actions .primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pop-actions .danger { color: var(--err-ink); border-color: var(--line); background: var(--card); margin-right: auto; }
/* .btn's display:inline-block outranks the UA [hidden] rule — restore it */
.pop-actions .btn[hidden] { display: none; }
.pop-err { margin-top: 12px; background: var(--err); color: var(--err-ink); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; font-weight: 600; }

/* ---- the app's alert/confirm (zAlert/zConfirm in base.html) -------------
   Same shell as the assign popover, so a question and a form read as the same
   surface. Centred in the viewport — a native dialog is pinned to the top of
   the browser window, which on a tall screen is nowhere near what you
   clicked. */
dialog.zdlg {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink);
  padding: 20px; width: min(420px, calc(100vw - 32px));
  box-shadow: 0 18px 40px rgba(0,5,40,.22);
}
dialog.zdlg::backdrop { background: rgba(0,5,40,.35); }
.zdlg-title { margin: 0 0 8px; font-size: 17px; letter-spacing: -0.01em; }
/* the messages carry their own line breaks — keep them without markup */
.zdlg-body { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); white-space: pre-line; }
.zdlg-body:empty { display: none; }
.zdlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.zdlg-actions .primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* destructive: the confirming button carries the warning, not the wording */
.zdlg-actions .danger { background: var(--err-ink); color: var(--card); border-color: var(--err-ink); }
.zdlg-actions .danger:hover { filter: brightness(1.1); }
/* .btn's display:inline-block outranks the UA [hidden] rule — restore it */
.zdlg-actions .btn[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  dialog.zdlg[open] { animation: zdlg-in .12s ease-out; }
  @keyframes zdlg-in { from { opacity: 0; transform: translateY(-6px); } }
}



/* the phone's More sheet: every page, grouped, rising from the bottom edge */
dialog.sheet {
  margin: auto 0 0; width: 100%; max-width: none; border-radius: 18px 18px 0 0;
  padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  max-height: 85vh; overflow: auto;
}
dialog.sheet[open] { animation: sheet-in .18s ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }
.sheet-grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet-group { padding: 6px 0; }
.sheet-group + .sheet-group { border-top: 1px solid var(--line); }
.sheet-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 2px; }
.sheet-group > a {
  display: block; padding: 11px 10px; border-radius: 10px; text-decoration: none;
  color: var(--ink); font-weight: 600; font-size: 16px;
}
.sheet-group > a.active { color: var(--active-ink); background: var(--active-bg); }
.sheet-close { width: 100%; margin-top: 10px; text-align: center; }

/* login page */
.login-main { display: flex; min-height: 70vh; align-items: center; justify-content: center; }
.login-card { text-align: center; max-width: 380px; }
.brand.big { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.login-card .notion-btn {
  display: block; margin: 18px 0 10px; padding: 12px 16px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-weight: 700; text-decoration: none;
}
.login-card .google-btn {
  display: block; margin: 18px 0 0; padding: 11px 16px; border-radius: 10px;
  border: 1px solid var(--line); color: var(--ink); font-weight: 700; text-decoration: none;
}
.login-card .google-btn + .notion-btn { margin-top: 10px; }
.login-card .small { font-size: 12px; }
/* the iPhone escape hatch: present but folded away, since it's noise for
   everyone whose sign-in just works */
.login-help { margin-top: 18px; text-align: left; font-size: 12px; color: var(--muted); }
.login-help > summary { cursor: pointer; font-weight: 600; text-align: center; }
.login-help p { margin: 10px 0 6px; }
.login-help ul { margin: 0; padding-left: 18px; }
.login-help li { margin-bottom: 6px; }
.login-help .linkbtn { font-size: 12px; }
.deny { background: var(--err); color: var(--err-ink); border-radius: 9px; padding: 10px 12px; margin: 12px 0; font-weight: 600; font-size: 13px; }

/* reports */
.range-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 18px; }
.range-form label { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.range-form label { font-size: 12px; }
.range-form input[type=date] { padding: 7px 8px; }
.range-dates, .range-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.weeknav .btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* destructive nav action (Clear week): reads as a warning without shouting —
   the confirm dialog is what actually guards it */
.btn-danger { color: var(--err-ink); border-color: var(--err-ink); }
.btn-danger:hover { background: var(--err); }
.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { text-align: center; padding: 16px; max-width: none; }
.stat-n { font-size: 34px; font-weight: 800; line-height: 1.1; }
.stat-l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
a.stat { color: inherit; text-decoration: none; }   /* the dashboard's tiles are links */
a.stat:hover { border-color: var(--ink); }
.card.wide { max-width: none; margin: 0 0 16px; }
.card.wide h3 { margin: 0 0 12px; font-size: 15px; }
.baritem { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 64px; gap: 12px; align-items: center; margin-bottom: 10px; }
.bar-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--chart-track); border-radius: 7px; height: 18px; overflow: hidden; }
.bar-fill { background: var(--chart); height: 100%; border-radius: 6px; min-width: 2px; }
.bar-val { font-size: 14px; font-weight: 700; text-align: right; }
.cols { display: flex; gap: 8px; align-items: flex-end; height: 150px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.col-v { font-size: 12px; font-weight: 700; color: var(--muted); }
.col-bar { width: 100%; max-width: 44px; flex: 1; display: flex; align-items: flex-end; background: var(--chart-track); border-radius: 6px; overflow: hidden; }
.col-fill { width: 100%; background: var(--chart); border-radius: 6px 6px 0 0; }
.col-l { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: center; }
.col-l span { display: block; }

/* weekly capacity */
.capacity { display: flex; align-items: center; gap: 12px; margin: -6px 0 14px; }
.cap-bar { flex: 1; height: 10px; background: var(--chart-track); border-radius: 6px; overflow: hidden; }
.cap-fill { height: 100%; background: var(--chart); border-radius: 6px; }

/* timer */
.timer-row { display: flex; align-items: center; gap: 12px; }

/* schedule / forecast */
.heat { text-align: center; font-weight: 700; }
.heat-ok { background: var(--heat-ok-bg); color: var(--heat-ok-ink); }
.heat-full { background: var(--heat-full-bg); color: var(--heat-full-ink); }
.heat-over { background: var(--heat-over-bg); color: var(--heat-over-ink); }
.row3 { grid-template-columns: 1fr 1fr auto !important; }
.cell input:disabled { color: var(--ink); opacity: 1; -webkit-text-fill-color: var(--ink); }
.group-row td { background: var(--head); font-weight: 800; }
.group-row .col-project, .group-row .col-person { background: var(--head); }
.col-project.sub { padding-left: 22px; font-weight: 500; color: var(--muted); }
.group-add td { padding: 4px 10px 10px; }
.group-add select { max-width: 320px; font-size: 13px; padding: 6px 8px; background: transparent; border-style: dashed; color: var(--muted); }
.range-form select { max-width: 200px; }

/* people filter (reports): a <details> dropdown of checkboxes, so multi-select
   works without JS (JS only adds search, live label, outside-click close).
   Selectors are kept at .range-form-beating specificity — the form styles
   labels/inputs generically, and this panel must win inside it. */
.pfilter { position: relative; }
.range-form .pfilter > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 8px; max-width: 260px;
}
.pfilter > summary::-webkit-details-marker { display: none; }
.pfilter[open] > summary { border-color: var(--accent); box-shadow: 0 0 0 3px var(--chart-track); }
.pfilter-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pfilter-ico { flex: none; }
.pfilter-caret { flex: none; font-size: 13px; line-height: 1; color: var(--muted); transition: transform .15s; }
.pfilter[open] .pfilter-caret { transform: rotate(180deg); }

.pfilter-menu {
  position: absolute; z-index: 30; top: calc(100% + 8px); left: 0;
  /* explicit width, not max-content: an auto-fill grid inside a shrink-to-fit
     box resolves to a single column, which wastes the second one */
  width: 520px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column;
  /* stay inside the fold (the panel hangs ~215px down the page), but never
     collapse to a useless sliver on a short window */
  max-height: max(240px, min(440px, calc(100vh - 250px)));
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,.16); overflow: hidden;
}
/* a picker sitting at the right end of the toolbar (the project filter on
   /project) drops its 520px panel leftwards, or it hangs off the viewport */
.pfilter-end > .pfilter-menu { left: auto; right: 0; }
.pfilter-head { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.range-form .pfilter-search {
  width: 100%; padding: 8px 10px; font-size: 14px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--bg); color: var(--ink);
}
.pfilter-tools { display: flex; align-items: center; gap: 8px; padding-top: 8px; }
.pfilter-sep { color: var(--muted); font-size: 12px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--accent); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* two columns once there's room — a 20-person roster fits without scrolling */
.pfilter-list {
  overflow-y: auto; padding: 8px; display: grid; gap: 2px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); align-content: start;
}
.range-form .pfilter-opt {
  display: flex; flex-direction: row; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px; font-size: 14px; font-weight: 500;
  cursor: pointer; min-width: 0;
}
.pfilter-opt:hover { background: var(--head); }
.pfilter-opt:focus-within { background: var(--head); box-shadow: inset 0 0 0 2px var(--chart-track); }
/* min-height:0 defends against the mobile rule that gives .range-form inputs a
   44px tap target — the row is the tap target here, not the box itself */
.range-form .pfilter-opt input[type=checkbox] { flex: none; width: 17px; height: 17px; min-height: 0; margin: 0; accent-color: var(--accent); }
.pfilter-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfilter-opt[hidden] { display: none; }
.pfilter-empty { padding: 10px; font-size: 13px; grid-column: 1 / -1; }

/* partner grouping inside the project picker. Each group spans the picker's
   full width and re-declares the same auto-fill grid for its own options, so
   the headings read as headings instead of becoming a third column of them. */
.pfilter-group {
  grid-column: 1 / -1; display: grid; gap: 2px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.pfilter-group[hidden] { display: none; }
.pfilter-gh {
  grid-column: 1 / -1; padding: 8px 10px 4px; font-size: 11px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.pfilter-group + .pfilter-group .pfilter-gh { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
.pfilter-partner .pfilter-nm { font-weight: 700; }
.pfilter-ct { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); }
.pfilter-tag, .ptag {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 4px; white-space: nowrap;
}
/* the partner an item belongs to, said quietly beside its name */
.pname-partner { font-size: 11px; font-weight: 700; color: var(--muted); }
.pfilter-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-top: 1px solid var(--line); background: var(--head);
}
.pfilter-foot .subtle { font-size: 12px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* by person ▸ projects */
.ppgroup { margin-bottom: 16px; }
.ppgroup:last-child { margin-bottom: 0; }
.ppgroup-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-bottom: 6px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.ppgroup-name { font-weight: 700; font-size: 14px; }
.ppgroup-h { font-weight: 700; font-size: 14px; color: var(--muted); }
.baritem-sub .bar-name { font-weight: 500; color: var(--muted); }
.baritem-sub .bar-track { height: 12px; }
.grid td.zero { color: var(--muted); opacity: .55; }
.matrix-grid .col-project { text-align: left; }
.matrix-grid tfoot td { text-align: center; }
.matrix-grid tfoot .col-project { text-align: left; }

/* ---- mobile ---- */
@media (max-width: 560px) {
  main { margin: 18px auto; padding: 0 12px; }
  .brand { font-size: 15px; }
  .card { padding: 18px; border-radius: 12px; }
  .row2 { grid-template-columns: 1fr 1fr; gap: 10px; }
  h1 { font-size: 21px; }
  /* prevent iOS auto-zoom on focus (needs >=16px) */
  input, select, textarea { font-size: 16px; }
  /* consistent, tap-friendly height so Date/Hours (and other paired fields) align */
  .row2 input, .row2 select, .range-form input, .range-form select { min-height: 44px; }

  /* week header: stack title and controls */
  .week-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .weeknav { justify-content: space-between; width: 100%; }
  .weeknav .btn { flex: 1; text-align: center; padding: 9px 8px; }
  /* reports' 4-item range nav: tidy 2x2 grid instead of squeezed, wrapping chips.
     Scoped to .weeknav-4 so the 3-item Prev/This week/Next nav (week/schedule) is untouched. */
  .weeknav-4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .weeknav.arrows .week-actions { grid-column: 1 / -1; border: 0; margin: 0; padding: 0; }
  .week-actions .btn { flex: 1; }
  /* the ← [This week] → trio: arrows narrow, label wide */
  .weeknav.arrows { display: grid; grid-template-columns: auto 1fr auto; }
  .weeknav.arrows .btn { padding: 9px 14px; }
  .weeknav-4 .btn { flex: none; padding: 10px 6px; white-space: nowrap; }

  /* grid: tighter so more days fit before scrolling */
  .grid th, .grid td { padding: 7px 6px; }
  .cell input { padding: 7px 2px; font-size: 15px; border-color: var(--line); background: color-mix(in srgb, var(--bg) 55%, transparent); }
  /* pin the sticky name column: min-width stops table auto-layout from
     collapsing it to per-character lines under overflow-wrap:anywhere */
  .grid .col-project { min-width: 104px; max-width: 104px; }  /* .grid prefix: must outrank the desktop `.grid .col-project` min-width */
  .col-project.sub { padding-left: 10px; }  /* the 22px desktop indent starves narrow columns */

  /* assignments: roomier tap target for checkboxes on touch screens, and
     compact person columns so more people fit before scrolling */
  .assign-cell { padding: 10px 8px; }
  .assign-cell input[type="checkbox"] { width: 26px; height: 26px; }
  .assign-grid .col-day { width: 64px; padding: 6px 4px; }
  .assign-grid .col-project { min-width: 136px; max-width: 136px; }
  .p-avatar { width: 30px; height: 30px; font-size: 11px; }

  /* add-row: stack the picker and button */
  .addrow .row2 { grid-template-columns: 1fr; gap: 10px; }
  .addrow .row2 .btn { width: 100%; }

  /* reports range-form: From/To share a row, actions share the next row evenly */
  .range-dates, .range-actions { width: 100%; }
  .range-dates label { flex: 1; }
  .range-form input[type=date] { width: 100%; }
  .range-actions .btn { flex: 1; text-align: center; padding: 10px 6px; white-space: nowrap; }
  .range-form select { flex: 1; min-width: 130px; }
  /* people filter takes its own full-width row; the menu spans the screen
     instead of hanging off the right edge, and stays one comfortable column */
  .pfilter { width: 100%; }
  .range-form .pfilter > summary { width: 100%; max-width: none; justify-content: center; padding: 11px 10px; }
  .pfilter-menu, .pfilter-end > .pfilter-menu { left: 0; right: 0; width: auto; min-width: 0; max-width: none; max-height: 70vh; }
  .pfilter-list, .pfilter-group { grid-template-columns: 1fr; }
  .range-form .pfilter-opt { padding: 11px 10px; font-size: 15px; }
  .range-form .pfilter-search { min-height: 42px; }

  /* stat tiles: one row of three; 2x2 once a 4th (people) tile shows up in team scope */
  .statrow { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .statrow:has(> :nth-child(4)) { grid-template-columns: 1fr 1fr; }
  .stat { padding: 12px 8px; }
  .stat-n { font-size: 23px; }

  /* project/person bars: name+value on one line, bar full-width below, instead of truncating */
  .baritem {
    grid-template-columns: 1fr auto; grid-template-areas: "name val" "bar bar";
    row-gap: 6px; column-gap: 8px;
  }
  .bar-name { grid-area: name; }
  .bar-track { grid-area: bar; }
  .bar-val { grid-area: val; }
  .card.wide { padding: 16px; }

  .pva-row { grid-template-columns: 64px 1fr 48px; gap: 8px; }
  .pva-lbl { font-size: 10px; }
  .cols { height: 110px; }
}


/* scheduled vs tracked */
.pva-legend { display: flex; gap: 18px; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.pva-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.dot-sched { background: var(--chart-soft); }
.dot-track { background: var(--chart); }
.dot-over { background: var(--over); }
.pva-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pva-item:last-child { border-bottom: none; }
.pva-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.pva-name { font-weight: 700; font-size: 15px; }
.chip { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.chip-ok { background: var(--okbg); color: var(--ok); }
.chip-under { background: var(--head); color: var(--muted); }
.chip-over { background: var(--err); color: var(--err-ink); }
.chip-none { background: var(--head); color: var(--muted); font-weight: 600; }
/* PM / Account manager chips on /project's header — a set role reads as
   "assigned to someone" (accent tint), an unset one falls back to chip-none */
.chip-role { background: var(--chart-track); color: var(--ink); }
.rolechips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.pva-row { display: grid; grid-template-columns: 76px 1fr 56px; gap: 10px; align-items: center; margin: 4px 0; }
.pva-lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pva-track { background: var(--chart-track); border-radius: 7px; height: 16px; overflow: hidden; }
.pva-bar { height: 100%; border-radius: 7px; min-width: 3px; }
.pva-bar.sched { background: var(--chart-soft); }
.pva-bar.track { background: var(--chart); }
.pva-bar.track.over { background: var(--over); }
.pva-h { font-size: 14px; font-weight: 700; text-align: right; }

/* assignments matrix */
.assign-notice { background: var(--err); color: var(--err-ink); border-radius: 9px; padding: 10px 12px; margin: 0 0 12px; font-weight: 600; font-size: 13px; }

/* right/left edge fade telling you the matrix scrolls further. .assign-wrap
   is a non-scrolling outer shell around the existing .grid-wrap scroller
   (kept untouched, class="grid-wrap assign-scroll") so the fade overlays
   stay pinned to the viewport edges instead of drifting with the horizontal
   scroll, and so week/schedule grids (plain .grid-wrap) are unaffected. */
.assign-wrap { position: relative; }
.assign-wrap::before, .assign-wrap::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 26px;
  pointer-events: none; opacity: 0; transition: opacity .15s ease; z-index: 3;
}
.assign-wrap::before { left: 0; background: linear-gradient(to right, color-mix(in srgb, var(--card) 85%, var(--ink)), transparent); }
.assign-wrap::after { right: 0; background: linear-gradient(to left, color-mix(in srgb, var(--card) 85%, var(--ink)), transparent); }
.assign-wrap.can-scroll-left::before { opacity: 1; }
.assign-wrap.can-scroll-right::after { opacity: 1; }

.assign-grid .col-day { white-space: nowrap; width: 72px; padding: 8px 6px; }
.assign-grid .proj-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.assign-grid .proj-name { overflow: hidden; text-overflow: ellipsis; }
.chip-assign { background: var(--head); color: var(--muted); font-variant-numeric: tabular-nums; }
/* PM / Account manager pickers, one per project row — the only place these
   are edited, so unlike the checkboxes each cell is its own tiny form */
.assign-grid .col-role { width: 150px; min-width: 150px; padding: 6px 8px; }
.role-pick { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
             background: var(--card); color: var(--ink); font: inherit; font-size: 13px; }
.role-pick.bad { border-color: var(--over); background: var(--err); }
.role-pick:disabled { opacity: .6; }

/* identity avatars in the person headers; deterministic soft-tint palette
   built from existing theme vars so it adapts to dark mode automatically */
.p-avatar {
  width: 34px; height: 34px; margin: 0 auto 4px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--ink); text-transform: none;
}
.p-avatar[data-avatar="0"] { background: color-mix(in srgb, var(--chart) 32%, var(--card)); }
.p-avatar[data-avatar="1"] { background: color-mix(in srgb, var(--ok) 30%, var(--card)); }
.p-avatar[data-avatar="2"] { background: color-mix(in srgb, var(--over) 28%, var(--card)); }
.p-avatar[data-avatar="3"] { background: color-mix(in srgb, var(--ring) 34%, var(--card)); }
.p-avatar[data-avatar="4"] { background: color-mix(in srgb, var(--chart-soft) 42%, var(--card)); }
.p-avatar[data-avatar="5"] { background: color-mix(in srgb, var(--accent) 24%, var(--card)); }
.p-fname { font-size: 12px; font-weight: 600; text-transform: none; overflow: hidden; text-overflow: ellipsis; }
.p-count { font-size: 10.5px; font-weight: 600; text-transform: none; color: var(--muted); margin-top: 2px; }

.assign-cell { padding: 8px 10px; cursor: pointer; }
.assign-cell input[type="checkbox"] {
  width: 22px; height: 22px; cursor: pointer; accent-color: var(--accent);
}
.assign-cell input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px;
}
.assign-cell.saving { background: var(--saving); }
.assign-cell.saved { background: var(--okbg); }
.assign-cell.err { background: var(--err); }

/* zebra striping + row/column crosshair; the :not() guards make sure the
   saving/saved/err states always win over these purely cosmetic tints */
.assign-grid tbody tr:nth-child(even) > td.assign-cell:not(.saving):not(.saved):not(.err) {
  background: color-mix(in srgb, var(--head) 45%, var(--card));
}
.assign-grid tbody tr:nth-child(even) > td.col-project {
  background: color-mix(in srgb, var(--head) 45%, var(--card));
}
.assign-grid tbody tr:hover > td.assign-cell:not(.saving):not(.saved):not(.err),
.assign-grid tbody tr:focus-within > td.assign-cell:not(.saving):not(.saved):not(.err) {
  background: var(--active-bg);
}
.assign-grid tbody tr:hover > td.col-project,
.assign-grid tbody tr:focus-within > td.col-project {
  background: color-mix(in srgb, var(--active-bg) 65%, var(--card));
}
.assign-grid td.assign-cell.col-hover:not(.saving):not(.saved):not(.err) { background: var(--active-bg); }
.assign-grid th.col-day.col-hover { background: color-mix(in srgb, var(--active-bg) 55%, var(--head)); }

/* segmented "Group by" control (Schedule) */
.seg { display: inline-flex; align-items: center; }
.seg-label { font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-right: 8px; }
.filters-label { margin-left: auto; }
.seg-opts { display: inline-flex; gap: 2px; padding: 3px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.seg-opt { padding: 6px 16px; border-radius: 7px; font-weight: 600; font-size: 13.5px;
  color: var(--muted); text-decoration: none; line-height: 1.3; }
.seg-opt:hover { color: var(--ink); background: var(--active-bg); }
.seg-opt.is-on { background: var(--accent); color: var(--accent-ink); }
.seg-opt:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
@media (max-width: 720px) {
  .filters-label { display: none; } .seg-opts { flex: 1; } .seg-opt { flex: 1; text-align: center; }

  /* phone: the top bar keeps only brand + account; navigation moves to a
     thumb-reach tab bar pinned to the bottom of the screen. The everyday
     pages are tabs, everything else is behind More. */
  .topbar { min-height: 50px; padding: 0 14px; }
  .mainnav { display: none; }
  :root { --tabbar-h: calc(56px + env(safe-area-inset-bottom, 0px)); }
  main { padding-bottom: calc(var(--tabbar-h) + 8px); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--card); border-top: 1px solid var(--line);
  }
  .tabbar > a, .tabbar > button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font: inherit; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none;
    background: none; border: 0; padding: 6px 2px 4px; cursor: pointer; border-radius: 0;
  }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar > a.active, .tabbar > button.active { color: var(--active-ink); }
  .tabbar > a.active svg, .tabbar > button.active svg { stroke-width: 2.3; }
  .tabbar > a:focus-visible, .tabbar > button:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
}

/* per-project hours: one row per person for the chosen day/week/month. The
   share bar is scaled to the busiest person, so the split reads at a glance
   while the % stays the person's share of the project's total. */
.grid th.left, .grid td.left { text-align: left; }
.grid td.nowrap { white-space: nowrap; }
.entrylist { padding-bottom: 8px; }
.entrylist summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.entrylist summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 6px; }
.entrylist table.flat { margin-top: 12px; }
.entrylist table.flat th, .entrylist table.flat td { font-size: 13.5px; padding: 8px 10px; }
.entrylist .desc { color: var(--muted); }
/* the editable Hours cell is denser here than on the weekly grid */
.entrylist .cell { padding: 2px 4px; }
.entrylist .cell input { padding: 6px 4px; font-size: 13.5px; min-width: 60px; border-color: var(--line); }

/* ---- export & send screen ---- */
.notebar {
  margin: 0 0 16px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5;
  background: var(--head); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; color: var(--ink);
}
.notebar a { color: var(--accent); }
.sendbox { margin-bottom: 16px; }
.sendbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sendbox label, .sendbox-msg { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sendbox input[type=text], .sendbox input[type=number], .sendbox textarea {
  width: 100%; padding: 9px 10px; font: inherit; font-size: 14px; font-weight: 500;
  text-transform: none; letter-spacing: 0; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
}
.sendbox-msg { margin-top: 12px; }
/* the bill editor: the lines first, then the two totals side by side, then
   the arithmetic they add up to — above the To/Subject, since what the bill
   says comes before whom it goes to */
.sendbox .billlines { margin-top: 0; }
.sendbox .billnums { margin-top: 12px; }
.sendbox .billnums input[type=number] { font-variant-numeric: tabular-nums; }
/* display: contents keeps the hint on the label's line — the label is a flex
   column, and a span of its own would be dropped onto a second row */
.sendbox .lbl-hint { display: contents; font-weight: 500; text-transform: none; letter-spacing: 0; }
.sendbox .billtotal { margin: 8px 0 14px; font-variant-numeric: tabular-nums; }
.sendbox-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.sendbox-btns { display: flex; gap: 8px; }
.sendresult { margin-top: 12px; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 600; }
.sendresult[hidden] { display: none; }
.sendresult.is-ok { background: var(--okbg); color: var(--ok); }
.sendresult.is-err { background: var(--err); color: var(--err-ink); }
.exportgroup { margin-bottom: 14px; }
.exportgroup-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.exporttable th, .exporttable td { font-size: 13.5px; padding: 6px 10px; }
.exporttable .cell { padding: 2px 4px; }
.exporttable .cell input { padding: 6px 4px; font-size: 13.5px; min-width: 60px; border-color: var(--line); }
.exporttable .xdesc {
  width: 100%; min-width: 260px; padding: 6px 8px; font: inherit; font-size: 13.5px;
  color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 7px;
}
.exporttable .xdesc:hover { border-color: var(--line); }
.exporttable .xdesc:focus { background: var(--bg); border-color: var(--accent); }
@media (max-width: 720px) {
  .sendbox-grid { grid-template-columns: 1fr; }
  .sendbox-actions { flex-direction: column; align-items: stretch; }
}

/* an inline edit leaves the server-rendered sums above it one save out of date */
.stalebar {
  position: sticky; bottom: 16px; z-index: 25; margin-top: 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; font-size: 14px; font-weight: 600;
  background: var(--card); border: 1px solid var(--accent); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.16);
}
.stalebar[hidden] { display: none; }
/* the person column is the row label, not a data column: left-aligned and
   narrow, so the period columns get the remaining width. Scoped to .projgrid
   so the week/schedule/assignment grids keep their current layout. */
.projgrid td.col-project, .projgrid th.col-project { text-align: left; min-width: 200px; }
/* the share bar shouldn't swallow the slack — give it a cap and let the name
   column absorb the rest, so the numbers stay grouped and readable */
.projgrid .col-share { width: 340px; }
.projgrid tbody td.col-project { font-weight: 600; }
.projgrid tfoot td { background: var(--head); font-weight: 700; }
.projgrid .col-hours { width: 110px; font-weight: 700; font-variant-numeric: tabular-nums; }
.projgrid .col-num { width: 90px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* PM/account-manager columns on the all-projects rollup only — project-level,
   so they're blank on person/entry rows underneath a group */
.projgrid .col-role { width: 130px; color: var(--muted); font-size: 13px; }
.projgrid tr.idle td { color: var(--muted); }
.share { display: flex; align-items: center; gap: 10px; }
.share-track { flex: 1; min-width: 60px; height: 10px; background: var(--chart-track); border-radius: 6px; overflow: hidden; }
.share-fill { height: 100%; background: var(--chart); border-radius: 6px; min-width: 2px; }
.share-pct { width: 42px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* table.grid carries a 520px min-width, so the entry list needs its own
   scroller or it widens the whole page on a phone */
.entrylist-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.range-form label.period-pick { white-space: nowrap; }
/* All-projects rollup: a project row expands to its people. Rows are plain
   <tr hidden> toggled by the disclosure button — no layout shift, and the
   whole table stays one grid so columns line up across groups. */
.projgrid .disclosure {
  background: none; border: none; padding: 0; font: inherit; font-weight: 700;
  color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.projgrid .disclosure:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 6px; }
.projgrid .caret { color: var(--muted); font-size: 11px; width: 10px; }
.projgrid .who-count {
  font-size: 11px; font-weight: 600; color: var(--muted); background: var(--head);
  border-radius: 999px; padding: 1px 7px;
}
.tag-former {
  margin-left: 6px; font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--muted); border-radius: 999px; padding: 0 6px;
  vertical-align: 1px; white-space: nowrap; opacity: .8;
}
.projgrid .group-row td { background: var(--card); font-weight: 700; }
.projgrid .group-row .col-project { background: var(--card); }
.projgrid .person-row td { background: var(--bg); font-weight: 500; }
.projgrid .person-row .col-project.sub { background: var(--bg); padding-left: 34px; font-weight: 500; color: var(--muted); }
.projgrid .person-row .share-track { max-width: 240px; }
/* One project: a person row expands the same way, into their own entries —
   date + description on the left, the hours still editable in place. */
.projgrid .entry-row td { background: var(--bg); font-weight: 500; }
.projgrid .entry-row .col-project.sub {
  background: var(--bg); padding-left: 34px; font-weight: 500; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline;
}
.projgrid .entry-row .entry-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* min-width:0 is what stops a long description (or a nowrap ticket link) from
   pushing out of this flex cell: a flex item's default min-width:auto refuses
   to shrink below its content, and the cell is *sticky*, so the spill painted
   straight over the Hours input beside it. */
.projgrid .entry-row .entry-desc { color: var(--muted); font-size: 13.5px; min-width: 0; }
.projgrid .entry-row .cell { padding: 2px 4px; }
.projgrid .entry-row .cell input { padding: 6px 4px; font-size: 14px; min-width: 60px; border-color: var(--line); }
/* In the rollup an entry sits one level deeper — project ▸ person ▸ entry —
   so it indents past the person name it hangs off. */
.projgrid .person-row .disclosure { font-weight: 500; color: var(--muted); }
.projgrid .entry-row[data-parent] .col-project.sub { padding-left: 64px; }
/* a column header with a narrow-screen short form: the wide one is what shows
   until the mobile block below swaps them */
.lbl-narrow { display: none; }
.expand-all {
  float: right; background: none; border: 1px solid var(--line); color: var(--muted);
  font: inherit; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; padding: 3px 9px; border-radius: 7px; cursor: pointer;
}
.expand-all:hover { color: var(--ink); background: var(--active-bg); }

/* ---- By project on a phone ----
   Five columns and a 520px floor meant this table only ever fit sideways: Days
   and Entries sat off-screen, and the name column was squeezed until every
   description wrapped a word per line while the ticket links (white-space:
   nowrap, in a *sticky* cell) painted over the Hours input to their right.
   Below 560px the table drops its min-width and every column is sized to the
   screen instead — the share bar keeps only its percentage, and an entry row
   stacks its date, description and ticket rather than laying them in a row
   that never had the width. Scoped to .projgrid so the week/schedule/
   assignment grids keep their horizontal scroll. */
@media (max-width: 560px) {
  /* fixed layout: the columns below are the widths, full stop. Auto layout
     sizes a column to its widest unbreakable word, so one long project name
     (or a ticket label) quietly pushed the table back off the screen. */
  table.grid.projgrid { min-width: 0; table-layout: fixed; }
  /* auto width: the name column takes whatever the numbers leave, and the
     `.grid .col-project` 104px cap above must not apply here */
  .projgrid td.col-project, .projgrid th.col-project {
    min-width: 0; max-width: none; width: auto; padding-right: 6px;
  }
  .projgrid .col-hours { width: 52px; }
  .projgrid .col-share { width: 40px; }
  .projgrid .col-num { width: 40px; font-size: 12px; }
  /* PM/AM don't fit a phone-width rollup row alongside Hours/Share/Days/Ent —
     the roles are still one tap away on /assignments and /budgets */
  .projgrid .col-role { display: none; }
  /* every column stays: in the rollup a project row's count pill is its number
     of *people*, so its entry count is nowhere else on the page. Only the
     header shrinks — "Entries" doesn't fit 40px, "Ent" does. */
  /* .col-num's 12px is the more specific selector, so the header restates it */
  .projgrid thead th, .projgrid thead th.col-num { font-size: 10px; letter-spacing: 0; }
  .projgrid thead .lbl-narrow { display: inline; }
  /* still read in full by a screen reader, which is why this isn't display:none */
  .projgrid thead .lbl-wide {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  /* the bar needs room the phone doesn't have; the number carries the meaning */
  .projgrid .share-track { display: none; }
  .projgrid .share { justify-content: flex-end; gap: 0; }
  .projgrid .share-pct { width: auto; font-size: 12px; }
  /* the name is the one flex item allowed to take the slack — the caret and
     the count pill keep their width, and only the name wraps. break-word, not
     the cell's `anywhere`, so it wraps between words ("Franco / Panzarin")
     rather than mid-word; the cell keeps `anywhere` because a description can
     be a pasted URL, whose min width would otherwise widen the whole table. */
  .projgrid .disclosure { text-align: left; align-items: baseline; gap: 6px; }
  .projgrid .who-name { flex: 1 1 auto; min-width: 0; overflow-wrap: break-word; }
  .projgrid .caret { flex: none; line-height: 1.5; }
  .projgrid .who-count { flex: none; }
  /* shallower indents: 34/64px of the desktop nesting is most of a phone's
     name column, and the row background already shows the level */
  .projgrid .person-row .col-project.sub { padding-left: 18px; }
  .projgrid .entry-row .col-project.sub { display: block; padding-left: 18px; }
  .projgrid .entry-row[data-parent] .col-project.sub { padding-left: 28px; }
  .projgrid .entry-row .entry-date { display: block; font-size: 12px; }
  .projgrid .entry-row .entry-desc { display: block; }
  .projgrid .entry-row .cell input { min-width: 44px; }
  /* the one place a ticket label may break mid-word — it is the whole line */
  .projgrid .entry-row .tlink, .entrylist td.desc .tlink {
    display: block; margin-left: 0; margin-top: 2px; white-space: normal; overflow-wrap: anywhere;
  }
}

/* Notion ticket picker on the log form: a search box whose results drop over
   the Save button, plus the chosen ticket as a chip. */
.tpick { position: relative; display: flex; flex-direction: column; gap: 6px; }
/* labels are column-flex app-wide; this one is a caption plus a hint, which
   belong on one line */
.tpick > label { flex-direction: row; align-items: baseline; gap: 5px; padding: 0; }
.tpick-list {
  position: absolute; z-index: 30; top: 100%; left: 0; right: 0; margin: 4px 0 0;
  padding: 6px; list-style: none; max-height: 260px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.16);
}
.tpick-opt {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--ink);
  cursor: pointer; min-width: 0;
}
.tpick-opt.on, .tpick-opt:hover { background: var(--head); }
.tpick-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpick-mine {
  flex: none; font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .03em; padding: 2px 7px; border-radius: 999px;
  background: var(--okbg); color: var(--ok);
}
.tpick-chip {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  /* an explicit display beats the UA's [hidden] rule, which would leave the
     empty chip on screen before a ticket is chosen */
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg);
}
.tpick-chip a {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.tpick-ico { flex: none; }
.tpick-hint { font-size: 12.5px; }
.tpick [hidden] { display: none; }
/* label on the left, "＋ New ticket" on the right, sharing the picker's line */
.tpick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tpick-head > label { flex-direction: row; align-items: baseline; gap: 5px; padding: 0; margin: 0; }
dialog.pop .tpick-hint { margin: -6px 0 12px; }

/* invoices: the tracked column is a reference number, the billed one is the
   decision — so tracked reads back a step */
.tracked { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.invoicebox { border: 1px solid var(--accent); }
/* the list's two toolbars — filter what's on file, and start a new one — sit
   side by side and stack rather than squeeze */
.invhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end; gap: 10px 26px; }
.invhead .range-form { margin: 0; }
/* width:auto beats the global `input, select { width: 100% }`, which would
   otherwise push the month picker onto a line of its own */
.newinv select, .newinv input[type=month] { width: auto; max-width: 190px; }
/* the invoice lifecycle: a status pill per row, filter chips above the list,
   and a step bar on the detail page — one colour per stage everywhere, so
   "blue" means waiting for the accountant on every screen */
.chip.stage-draft { background: var(--head); color: var(--muted); }
.chip.stage-approved { background: var(--chart-track); color: var(--ink); }
.chip.stage-sent { background: var(--saving); color: var(--ink); }
.chip.stage-overdue { background: var(--err); color: var(--err-ink); }
.chip.stage-paid { background: var(--okbg); color: var(--ok); }
.chip.stage-void { background: var(--head); color: var(--muted); text-decoration: line-through; }
.invstages { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.invstages a.chip { text-decoration: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.invstages a.chip b { margin-left: 4px; color: var(--muted); }
.invstages a.chip.chip-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--chart-track); }
.invstatus { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.invsteps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.invstep { font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 10px;
           border: 1px solid var(--line); border-radius: 999px; }
.invstep.is-done { color: var(--ok); border-color: var(--ok); }
.invstep.is-done::before { content: "✓ "; }
.invstep.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.invstep.is-void.is-on { background: var(--err); color: var(--err-ink); border-color: var(--err); }
.invfacts { flex: 1 1 260px; }
.invmoves { margin-left: auto; }
.invhistory { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.invhistory summary { cursor: pointer; font-weight: 600; }
.invhistory ol { margin: 6px 0 0; padding-left: 18px; }
.movefields { display: grid; gap: 10px; margin-bottom: 10px; }
.movefields[hidden] { display: none; }
/* invoice detail: a line billed at less than it was logged, and one billed at
   nothing — the second reads as struck through rather than merely faded, since
   "not on this bill" is a different statement from "small" */
.adjusted { color: var(--over); }
.row-unbilled td { opacity: .55; }
.row-unbilled .desc { text-decoration: line-through; }
/* the invoice page's editable lines */
.line-desc { width: 100%; min-width: 220px; font: inherit; resize: vertical; }
.line-hours { width: 5.5em; }
.line-hours.adjusted, .line-desc.adjusted { border-color: var(--over); }
.linebar { align-items: center; margin-top: 12px; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { text-decoration: underline; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: var(--head); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.notebar.warn { background: var(--saving); color: var(--ink); }
/* the linked ticket where an entry is listed (reports, export screen) */
.tlink { display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--accent); white-space: nowrap; }
td.desc .tlink { margin-left: 8px; }

/* ---- absences ----
   The board answers "who's away, when" at a glance: a filled mark is a day
   off (a count, in the monthly view where a column is a whole week), an empty
   one is a middot so the row still reads as a row. `--saving` is reused on
   purpose — the same amber that means "in flight" elsewhere reads here as
   "not at their desk", and both stay legible in either theme. */
.card-title { margin: 0 0 12px; font-size: 15px; }
.grid td.off {
  background: var(--saving); font-weight: 700; color: var(--ink);
  cursor: help;   /* the reason is in the title attribute */
}
.grid th .daysub { font-size: 10.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
/* a day somebody has *asked* for is drawn, but hollow: it isn't a day off yet,
   and it must not read like one — no fill, just the outline of the amber. */
.grid td.pend { background: transparent; box-shadow: inset 0 0 0 1px var(--saving); cursor: help; }
.pmark { color: var(--muted); font-weight: 700; margin-left: 2px; }
/* the status chip — small, and the same three colours everywhere they appear */
.status-chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; text-transform: capitalize;
  background: var(--head); color: var(--muted);
}
.status-chip.is-approved { background: var(--okbg); color: var(--ok); }
.status-chip.is-declined { background: var(--err); color: var(--err-ink); }
.status-chip.is-pending { background: var(--saving); color: var(--ink); }
/* Approve / Decline / Remove can all sit in one cell — keep them on one line
   each rather than letting a narrow column stack them into a wall. */
.decide-cell { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.decline-note { margin-top: 14px; color: var(--muted); }
.decline-note textarea {
  font: inherit; font-size: 13.5px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  resize: vertical; width: 100%; box-sizing: border-box;
}

/* read-only planner: /schedule is readable by everyone, but only an admin can
   plan, so a non-admin's cells are still cells — they're just not buttons.
   Drop every affordance that promises a click the server would refuse. */
.plan-cell.is-static { cursor: default; }
.plan-cell.is-static:hover { background: transparent; }
.plan-cell.is-static .pill:hover { border-color: transparent; }

/* ---- /budgets: the control centre -------------------------------------
   The first pass over this page is ~37 budgets typed one after another, so
   every row renders its inputs rather than an "add" affordance, and the cells
   are sized for a column of numbers rather than for prose. */
.brow .bnum {
  width: 78px; padding: 6px 8px; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 14px;
}
.brow .bnum.bsm { width: 56px; }
.brow .bnum.bad { border-color: var(--over); background: var(--err); }
.grid th.bcol, .grid td.bcol { width: 1%; white-space: nowrap; }
.th-sub { display: block; font-size: 10px; font-weight: 500; text-transform: none; opacity: .65; letter-spacing: 0; }
/* /budgets: clickable headers. The arrow shows only on the sorted column, so
   the header row doesn't turn into a column of ↕ glyphs. */
.grid th.sortable { cursor: pointer; user-select: none; }
.grid th.sortable:hover, .grid th.sortable.sorted { color: var(--ink, inherit); }
.grid th.sortable.sorted::after { content: " ▲"; font-size: 9px; }
.grid th.sortable.sorted.desc::after { content: " ▼"; }
.range-form label.hidezero { font-size: 13px; cursor: pointer; gap: 6px; white-space: nowrap; }
.range-form label.hidezero input { width: auto; margin: 0; }
.grid td.hnum { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.grid td.hnum.over { color: var(--over); }
.grid th.usedcol, .grid td.usedcol { min-width: 110px; }
/* the bar is the week page's capacity meter, reused rather than re-invented */
.usedcol .cap { margin-top: 2px; }
.usedcol .cap-num { margin: 3px 0 0; }
.brow .bpolicy { padding: 5px 8px; font-size: 13px; max-width: 150px; }
.brow .overrun { margin-left: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.brow .overrun.hidden { display: none; }
/* an unbudgeted project still shows its tracked hours — that's how you notice
   one that ought to have a budget — but it recedes */
.brow.unbudgeted td { color: var(--muted); }
.brow.unbudgeted .budget::placeholder { opacity: .5; }
.card.wide .subtle.small { font-size: 12.5px; line-height: 1.55; }
.card.wide .subtle.small p { margin: 0 0 8px; }
.card.wide .subtle.small p:last-child { margin-bottom: 0; }
.week-head .subtle .over { color: var(--over); font-weight: 700; }
/* the log-form budget meter: where this project stands this month, shown
   before the entry is saved rather than in tomorrow's email */
.bmeter { margin: -6px 0 2px; font-size: 13px; color: var(--muted); }
.bmeter[hidden] { display: none; }
.bmeter .cap { margin-bottom: 5px; }
.bmeter strong { color: var(--ink); font-weight: 700; }
.bmeter.lvl-warn strong { color: var(--chart); }
.bmeter.lvl-over strong { color: var(--over); }

/* The unfiled row on /reports' By goal card. reports.html has always asked for
   this class; without it the biggest, palest-by-intent row rendered as the
   darkest, fullest bar on the card — the exact inverse of /project. */
.baritem-idle .bar-name { color: var(--muted); }
.baritem-idle .bar-fill {
  background: repeating-linear-gradient(135deg,
    var(--chart-soft) 0 5px, var(--chart-track) 5px 10px);
  outline: 1px solid var(--chart-soft); outline-offset: -1px;
}
.bar-where { font-weight: 500; font-size: 12px; margin-left: 6px; }

/* ---- goals ----
   What a project's period went into. The block is a list of links, not a
   table: each row filters the page to its goal, and the last row is always
   Unassigned — the pile still to file, and for the first months the biggest
   number on the page. */
.goalcard { padding-bottom: 14px; }
.goalcard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.goalcard-head h3 { margin: 0; }
.goalcard-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Delete lives at the far end of the dialog's actions, away from Save */
.pop-actions .pop-spacer { flex: 1; }
.pop-actions .btn.danger { color: var(--err-ink); border-color: var(--err-ink); }
.pop-actions .btn.danger:hover { background: var(--err); }
.pop-actions .btn[hidden] { display: none; }

.goalcard-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.goalrows { display: flex; flex-direction: column; }
/* the row is a link that filters the page, so its edit control is a sibling —
   a <button> inside an <a> is invalid, and swallows the click where it renders
   at all */
.goalrow-wrap { display: flex; align-items: center; gap: 2px; }
.goalrow-wrap > .goalrow { flex: 1; min-width: 0; }
.goalrow-edit {
  flex: none; background: none; border: 1px solid transparent; border-radius: 8px;
  color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1;
  padding: 8px 9px; opacity: .35;   /* faint, not invisible: it's the way to archive a goal */
}
.goalrow-wrap:hover .goalrow-edit, .goalrow-edit:focus-visible { opacity: 1; }
.goalrow-edit:hover { color: var(--ink); border-color: var(--line); }
.goalrow-edit:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.goalrow {
  /* the name is a label, not a column to pad out: cap it and let the bar take
     the slack, or a wide screen leaves a hand's width between a goal and its
     hours (the .baritem rows on /reports are capped for the same reason) */
  display: grid; grid-template-columns: minmax(120px, 260px) 58px minmax(60px, 1fr) 44px minmax(96px, auto);
  align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px;
  color: inherit; text-decoration: none; border: 1px solid transparent;
}
.goalrow:hover { background: var(--head); }
.goalrow.is-on { border-color: var(--accent); background: var(--active-bg); }
.goalrow-name { font-weight: 600; overflow-wrap: anywhere; }
.goalrow.is-none .goalrow-name { color: var(--muted); font-weight: 500; }
.goalrow-h { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.goalrow-h .unit { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 1px; }
.goalrow-bar { height: 8px; background: var(--chart-track); border-radius: 6px; overflow: hidden; }
.goalrow-fill { display: block; height: 100%; background: var(--chart); border-radius: 6px; }
/* Visible *and* clearly not one of the real goals. It was a pale fill on a pale
   track — 1.4:1, well under the 3:1 a graphical object needs — on the row
   carrying the biggest number on the page. Now it reads at full strength and is
   told apart by its hatch and its muted name, not by being faint. */
.goalrow.is-none .goalrow-fill {
  background: repeating-linear-gradient(135deg,
    var(--chart-soft) 0 5px, var(--chart-track) 5px 10px);
  outline: 1px solid var(--chart-soft); outline-offset: -1px;
}
.goalrow-share { font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
/* past its target: the bar and its number say so together */
.goalrow-fill.is-over { background: var(--over); }
.goalrow-share.is-over { color: var(--over); font-weight: 700; }
.goalrow-meter { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* a Total and a Per month goal looked identical on the row, and the difference
   only lived in a tooltip no touch screen can reach */
.goalrow-meter .per { opacity: .75; }
.goalrow-meter.is-over { color: var(--over); font-weight: 600; }
.gstat {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); background: var(--head); border-radius: 999px; padding: 1px 7px; margin-left: 4px;
}

/* the goal on an entry, wherever that entry is shown */
.gchip {
  display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent);
  background: var(--active-bg); border-radius: 999px; padding: 1px 9px; overflow-wrap: anywhere;
}
.gchip.is-none { display: none; }          /* no goal is silence, not a badge */
.gchip-btn { border: 1px solid var(--line); cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
.gchip-btn:hover { border-color: var(--accent); }
.goal-else { margin-top: 4px; }
.goal-else-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* the same chip, under the date instead of in its own column — see the mobile
   block below, where the Goal column is off-screen */
.gchip-inline { display: none; margin-top: 3px; }
/* filed while triaging the unfiled: it is no longer part of what this view is
   about, so it fades rather than sitting there looking like work to do */
.entrylist tr.is-filed > td { opacity: .45; }

/* the tick column on the entry list */
.entrylist .col-tick { width: 34px; padding: 0; text-align: center; }
/* the label fills the cell, so the tap target is the whole cell rather than an
   18px square — the row is tall, and a missed tick costs a scroll to find again */
.entrylist .col-tick label { display: flex; align-items: center; justify-content: center;
  padding: 10px 8px; margin: 0; cursor: pointer; }
.entrylist .col-tick input { width: 18px; height: 18px; cursor: pointer; }

/* The file bar: the same sticky treatment as the stale bar it sits above, so
   the two read as one place where the page talks back. */
/* One sticky stack for both bottom bars. As independent sticky siblings they
   docked to the same 16px and the file bar simply covered the stale bar — the
   one control that reconciles the page, hidden exactly when a filing has just
   made it necessary. */
.bottombars {
  position: sticky; bottom: 16px; z-index: 26; margin-top: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.bottombars > .stalebar, .bottombars > .filebar { position: static; margin-top: 0; }
.filebar {
  position: sticky; bottom: 16px; z-index: 26; margin-top: 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 14px; font-size: 14px;
  background: var(--card); border: 1px solid var(--accent); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.16);
}
.filebar[hidden] { display: none; }
/* .btn sets display, which outranks the UA's [hidden] rule — so Undo rendered
   from the first tick and did nothing when pressed, which is worse than absent */
.filebar .btn[hidden] { display: none; }
.filebar .btn[disabled] { opacity: .45; cursor: default; }
.filebar-count { font-weight: 600; margin-right: 2px; }
/* labels stack their children by default here (see `label` at the top), so
   the direction is restated — the caption belongs beside the select */
.filebar-pick { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.filebar-pick select { min-width: 190px; }
.filebar .linkish { border-color: transparent; background: none; color: var(--muted); }
.filebar-prog { font-size: 13px; color: var(--muted); flex-basis: 100%; }

@media (max-width: 560px) {
  /* The goal row's five columns need ~426px before they even start; on a phone
     it becomes two lines — name and hours, then the bar with its share — and
     the target meter takes a line of its own. */
  .goalrow { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 8px; }
  /* no hover on a touch screen, so the edit control is simply always there,
     at a size a thumb can hit */
  .goalrow-edit { opacity: 1; padding: 10px 12px; border-color: var(--line); }
  .goalrow-name { min-width: 0; }
  .goalrow-meter { grid-column: 1 / -1; justify-content: flex-start; }
  .goalrow-meter .cap { width: 72px; }
  .goalcard-head { flex-wrap: wrap; }

  /* the file bar is the one control that has to work one-handed: a full-width
     select, then the actions sharing a line */
  .filebar { padding: 12px; gap: 8px; }
  .filebar-count { flex-basis: 100%; }
  .filebar-pick { flex-basis: 100%; }
  .filebar-pick select { flex: 1; min-width: 0; }
  .filebar .btn { flex: 1; }
  /* a comfortable tap target, in a roomier row to hit it in */
  .entrylist .col-tick { width: 40px; padding: 6px; }
  .entrylist .col-tick input { width: 22px; height: 22px; }

  /* The Goal column lives past the right edge of a 390px screen, and the list
     scrolls sideways — so while filing, the one thing you need to see (is this
     row already filed?) was the one thing you had to scroll for. The chip moves
     under the date; the column itself goes, rather than showing it twice. */
  .entrylist th.goal-col, .entrylist td.goal-col { display: none; }
  /* block, not inline: the date cell is nowrap, so an inline chip would widen
     the column instead of sitting under the date. `.gchip.is-none` is the more
     specific rule, so an unfiled entry still shows nothing at all. */
  .gchip-inline { display: block; }

  /* the file bar is sticky over the end of the list: leave it somewhere to sit
     so the last entries can still be scrolled clear of it */
  body.is-filing .entrylist { padding-bottom: 120px; }
}

/* the log form's live hint on "say what you worked on" */
#descHint.is-ok { color: var(--ok); }

/* ---- today's column on /schedule ----
   The planner's most-used landmark is "where am I now". Marked as one stripe
   — header, every cell and the footer total — rather than on the header
   alone, which is the first thing to leave the screen once the roster is long
   enough to scroll. The cell tint is deliberately weaker than
   `.plan-cell:hover`'s so hovering inside today's column still reads as a
   hover; the restated hover rules below keep that true for both the clickable
   and the read-only (`.is-static`) planner. Works in either view: in Days it
   is the weekday, in the Weeks rollup the week that holds it. */
.grid thead th.col-day.is-today {
  background: color-mix(in srgb, var(--active-bg) 55%, var(--head));
  color: var(--accent);
}
.grid thead th.col-day.is-today .dnum { color: var(--accent); opacity: .8; }
/* thead th is already position: sticky, so it is its own positioning context */
.grid thead th.col-day.is-today::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--ring);
}
/* Rails, not a background, on the body cells: the Weeks rollup paints its
   cells by load (`.heat-ok`/`.heat-full`/`.heat-over`), and a background here
   would outrank those single-class rules and blank the heat map on exactly
   one column. An inset shadow composes with whatever colour the cell already
   carries. */
.grid td.is-today {
  box-shadow: inset 1px 0 0 var(--ring), inset -1px 0 0 var(--ring);
}
.grid tfoot td.is-today {
  background: color-mix(in srgb, var(--active-bg) 55%, var(--head));
  box-shadow: inset 1px 0 0 var(--ring), inset -1px 0 0 var(--ring), inset 0 -2px 0 var(--ring);
}
/* the day planner's cells carry no heat colour, so they take the tint too */
.plan-cell.is-today { background: color-mix(in srgb, var(--active-bg) 40%, transparent); }
.plan-cell.is-today:hover { background: var(--active-bg); }
.plan-cell.is-today.is-static:hover { background: color-mix(in srgb, var(--active-bg) 40%, transparent); }


/* ---- planning: /plan and the public /p/<token> page --------------------
   The timeline is a CSS grid, one row per item: a fixed name column, then
   one column per weekday. A bar is absolutely positioned over the row's day
   cells with --a/--b (1-based, inclusive) doing the arithmetic, so a drag
   only ever changes two custom properties. Status colours reuse the pill
   palette (--s0…) so the two planners read as one app. */
.plan-tools { align-items: center; }
.plan-tools label { font-size: 12px; }
.plan-tools select { max-width: 240px; }
.plan-actions { display: inline-flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.plan-card { padding: 0; overflow: hidden; }
.tl { --name-w: 240px; font-size: 13px; overflow-x: auto; }
.tl-head, .tl-row { display: grid; grid-template-columns: var(--name-w) 1fr; min-width: 560px; }
.tl-head { position: sticky; top: 0; z-index: 3; background: var(--head); border-bottom: 1px solid var(--line); }
.tl-head .tl-name { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.tl-name { padding: 8px 12px; border-right: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; gap: 2px; justify-content: center;
  position: sticky; left: 0; background: var(--card); z-index: 2; }
.tl-head .tl-name { background: var(--head); }
.tl-days { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); position: relative; min-height: 40px; }
.tl-day { text-align: center; padding: 6px 2px; font-size: 11px; color: var(--muted); font-weight: 600; position: relative; line-height: 1.2; }
.tl-day .tl-dow { display: block; font-weight: 500; opacity: .8; }
.tl-day .tl-dnum { display: block; font-size: 13px; color: var(--ink); }
.tl-mon { position: absolute; top: -1px; left: 3px; font-size: 9px; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.tl-month .tl-day .tl-dow { display: none; }
.tl-day.is-mon, .tl-cell.is-mon { border-left: 1px solid var(--line); }
.tl-day.is-today .tl-dnum { color: var(--over); }
.tl-row { border-bottom: 1px solid var(--line); min-height: 44px; }
.tl-row.is-sunk { opacity: .55; }
.tl-cell { border-right: 1px dashed color-mix(in srgb, var(--line) 70%, transparent); min-height: 44px; }
.tl-cell.is-today { background: color-mix(in srgb, var(--active-bg) 40%, transparent); }
.tl-cell.is-over, .tl-day.is-over { background: var(--active-bg); outline: 2px dashed var(--ring); outline-offset: -2px; }
.tl-edit .tl-cell { cursor: cell; }
.tl-open { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.tl-open:hover { color: var(--accent); text-decoration: underline; }
.tl-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.tl-tag { font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--head); padding: 1px 6px; border-radius: 999px; }
.tl-int { color: var(--err-ink); background: var(--err); }
/* the bar: --a/--b are 1-based column indexes; left/width in fractions of the row */
.tl-bar {
  position: absolute; top: 8px; height: 28px;
  left: calc((var(--a) - 1) * 100% / var(--cols) + 2px);
  width: calc((var(--b) - var(--a) + 1) * 100% / var(--cols) - 4px);
  border-radius: 7px; overflow: hidden; display: flex; align-items: center;
  font-size: 11.5px; font-weight: 700; padding: 0 8px; box-sizing: border-box;
  background: var(--s0); color: var(--s0i); border: 1px solid transparent; user-select: none;
}
.tl-edit .tl-bar { cursor: grab; }
.tl-bar.is-dragging { cursor: grabbing; opacity: .85; box-shadow: 0 6px 16px rgba(0,5,40,.25); z-index: 5; }
.tl-row.is-pending .tl-bar, .tl-row.is-pending .tl-ms { outline: 2px dashed var(--ring); outline-offset: 1px; }
.tl-bar .tl-fill { position: absolute; inset: 0 auto 0 0; background: currentColor; opacity: .18; pointer-events: none; }
.tl-bar .tl-lbl { position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 4px solid currentColor; }
.tl-bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 4px solid currentColor; }
.tl-grip { position: absolute; top: 0; right: 0; width: 12px; height: 100%; cursor: ew-resize; }
.tl-grip::after { content: ""; position: absolute; top: 8px; bottom: 8px; right: 4px; width: 2px; background: currentColor; opacity: .5; border-radius: 1px; }
.tl-ms { position: absolute; top: 6px; height: 32px; width: calc(100% / var(--cols)); left: calc((var(--a) - 1) * 100% / var(--cols));
  display: flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1; color: var(--s2i); }
.tl-edit .tl-ms { cursor: grab; }
.tl-empty { padding: 26px 16px; text-align: center; }
/* status colours */
.st-backlog { background: var(--head); color: var(--muted); }
.st-planned { background: var(--s0); color: var(--s0i); }
.st-in-progress { background: var(--s2); color: var(--s2i); }
.st-blocked { background: var(--s4); color: var(--s4i); }
.st-done { background: var(--s1); color: var(--s1i); }
.st-dropped { background: var(--head); color: var(--muted); text-decoration: line-through; }
.tl-ms.st-done { color: var(--s1i); } .tl-ms.st-blocked { color: var(--s4i); } .tl-ms.st-planned { color: var(--s0i); }
.tl-ms.st-backlog, .tl-ms.st-dropped { color: var(--muted); }
.tl-ms.st-in-progress { color: var(--s2i); }
.tl-ms { background: transparent; }
/* the tray of unscheduled items */
.tray { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--bg); }
.tray-title { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; margin-right: 6px; width: 100%; }
.tray-item { display: inline-flex; flex-direction: column; gap: 1px; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; max-width: 260px; }
.tray-edit .tray-item { cursor: grab; }
.tray-item .tl-open { font-size: 12.5px; color: inherit; }
.tray-item .tl-meta { font-size: 11px; opacity: .8; }
.tray-item.is-sunk { opacity: .55; }
/* the tickets view */
.tk-group { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.tk-group > summary { list-style: none; cursor: pointer; padding: 10px 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; background: var(--head); }
.tk-group > summary::-webkit-details-marker { display: none; }
.tk-group > summary::before { content: "▸"; color: var(--muted); font-size: 12px; }
.tk-group[open] > summary::before { content: "▾"; }
.tk-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid transparent; }
.tk-count { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.tk-table { min-width: 0; }
.tk-table th, .tk-table td { font-size: 13.5px; padding: 8px 12px; }
.tk-name { font-weight: 600; }
.tk-status { padding: 5px 8px; font-size: 13px; }
.tk-none { padding: 10px 14px; }
.tk-link { font-size: 12px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.linkish:hover { color: var(--accent); text-decoration: underline; }
/* the dialogs */
dialog.plan-pop { width: min(460px, calc(100vw - 32px)); }
.pop-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pop-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.pop-actions .grow { flex: 1; }
dialog.pop label.pop-check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
dialog.pop label.pop-check input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--accent); }
.share-url { display: flex; gap: 8px; margin: 8px 0 12px; }
.share-url input { flex: 1; min-width: 0; font-size: 12.5px; }
.btn.is-shared { border-color: var(--ok); color: var(--ok); }
@media (max-width: 720px) {
  .tl { --name-w: 150px; }
  .tl-bar { padding: 0 5px; font-size: 10.5px; }
  .plan-actions { margin-left: 0; }
}

/* /people — the roster editor */
.card.people-add { max-width: none; margin: 0 0 16px; padding: 14px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.people-add label { flex-direction: row; }
.people-add select { width: auto; min-width: 240px; max-width: 100%; }
.people-add input { width: auto; min-width: 200px; max-width: 100%; }
.people-grid th, .people-grid td { text-align: left; }
.people-grid .col-flag { width: 96px; text-align: center; }
.people-name { padding: 6px 8px; border-color: transparent; background: transparent; min-width: 160px; }
.people-name:hover { border-color: var(--line); }
.people-name.bad { border-color: var(--over); background: var(--err); }
.people-grid tr.is-inactive .people-name,
.people-grid tr.is-inactive td.subtle { opacity: .55; }
/* on a phone the toggles matter more than whose Notion account it is */
@media (max-width: 560px) {
  table.grid.people-grid { min-width: 0; }
  .people-grid .col-user { display: none; }
  .people-grid .col-flag { width: 58px; padding-left: 4px; padding-right: 4px; font-size: 10px; }
  .people-name { min-width: 0; }
}
/* /projects/roles — one compact row per project, PM + AM pickers */
table.grid.roles-grid { min-width: 0; }
.roles-grid .col-role { width: 220px; padding: 6px 8px; }
.roles-grid .col-partner { white-space: nowrap; }
.roles-grid .col-archive { width: 1%; white-space: nowrap; text-align: right; }
.roles-search { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px;
                background: var(--card); color: var(--ink); font: inherit; font-size: 13.5px; min-width: 180px; }
/* a role held by someone no longer on the active roster: named, but greyed */
.role-pick.is-off { color: var(--muted); font-style: italic; }
.role-inline { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.role-inline .role-pick { width: auto; min-width: 150px; }
@media (max-width: 560px) {
  .roles-grid .col-partner { display: none; }
  .roles-grid .col-role { width: auto; }
  .roles-search { flex: 1 1 100%; min-width: 0; }
}

/* /tools — the software catalog */
.card.tools-mine { max-width: none; margin: 0 0 16px; padding: 12px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tools-mine a.chip { text-decoration: none; }
.tools-grid th, .tools-grid td { text-align: left; vertical-align: top; }
.tools-grid .tool-name { font-weight: 700; white-space: nowrap; }
.tools-grid .col-notes { max-width: 320px; white-space: pre-line; }
.tools-grid .col-edit { width: 1%; }
.tool-holders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.holder { font-size: 12.5px; font-weight: 600; color: var(--ink); background: var(--head);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
button.holder { cursor: pointer; }
button.holder:hover { border-color: var(--over); background: var(--err); }
.holder.is-former { color: var(--muted); font-style: italic; }
.tool-add { width: auto; padding: 2px 6px; font-size: 12.5px; }
.tools-matrix th, .tools-matrix td:first-child { text-align: left; }
.tools-matrix .col-flag { text-align: center; min-width: 72px; }
.tools-retired { margin-top: 20px; }
.tools-retired ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.tools-retired li { display: flex; align-items: center; gap: 8px; }
@media (max-width: 560px) {
  table.grid.tools-grid { min-width: 0; }
  .tools-grid .col-notes { display: none; }
}

/* ---- dashboard (docs/dashboard.md) ----
   The tiles are a.stat.card grid items: .card's `margin: 0 auto` made each one
   shrink to its text and centre in its track, so a row of tiles came out in
   four different widths. */
.dashboard .statrow > .stat { margin: 0; min-width: 0; }
.dashboard .sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.dashboard .mob-only { display: none; }

/* Phone: the four tables were 520px wide (table.grid's floor) and pushed the
   whole page sideways, Forecast and Status off-screen. Each row becomes a
   small stacked block instead — name and tag on top, the bar full width,
   the numbers labelled underneath. Desktop keeps the tables. */
@media (max-width: 560px) {
  .dashboard .mob-only { display: initial; }
  .dashboard .desk-only { display: none; }

  /* ← [month picker] → in one row, instead of a "This month" button row
     plus a separate picker row */
  .dashboard .weeknav.arrows { grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: stretch; }
  .dashboard .weeknav .range-form { display: block; margin: 0; min-width: 0; }
  .dashboard .weeknav .period-pick { display: block; width: 100%; }
  .dashboard .weeknav input[type=month] { -webkit-appearance: none; appearance: none; width: 100%; min-height: 44px; text-align: center; font-weight: 600; }
  .dashboard .weeknav input[type=month]::-webkit-date-and-time-value { text-align: center; }

  /* tiles: number beside its label, two even columns */
  .dashboard .statrow, .dashboard .statrow:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dashboard .statrow > .stat {
    display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px;
  }
  .dashboard .statrow > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .dashboard .stat-n { font-size: 22px; flex: none; min-width: 1.4em; }
  .dashboard .stat-l { font-size: 11px; line-height: 1.3; letter-spacing: .03em; }

  table.grid.dash-table { display: block; min-width: 0; }
  .grid.dash-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
  }
  .grid.dash-table tbody { display: block; }
  .grid.dash-table tbody tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px;
    padding: 10px 0; border-bottom: 1px solid var(--line);
  }
  .grid.dash-table tbody tr:last-child { border-bottom: 0; }
  .grid.dash-table tbody td {
    display: block; padding: 0; border: 0; text-align: left; min-width: 0;
    font-size: 14px; overflow-wrap: anywhere;
  }
  .grid.dash-table td[data-label]::before {
    content: attr(data-label); display: block;
    color: var(--muted); font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
  }
  .grid.dash-table .dt-name { grid-column: 1 / 3; order: -3; font-weight: 600; font-size: 15px; }
  .grid.dash-table .dt-tag { grid-column: 3; order: -2; justify-self: end; align-self: start; }
  .grid.dash-table .dt-wide { grid-column: 1 / -1; order: -1; }
  /* no tag cell: the name has the whole row */
  .dashboard .util-table .dt-name { grid-column: 1 / -1; }
  .dashboard .bill-table .dt-tag { text-align: right; }
  .dashboard .util-table tbody tr { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dashboard .bill-table td[data-label="Invoice"] { grid-column: span 2; }
  .grid.dash-table .usedcol { display: flex; align-items: center; gap: 10px; }
  .grid.dash-table .usedcol .cap { flex: 1; height: 6px; }
  .grid.dash-table .usedcol .cap-num { margin: 0; min-width: 3em; text-align: right; }
  .dashboard .miss-table .dt-wide { font-size: 13px; line-height: 1.5; }
  .grid.dash-table .dt-span2 { grid-column: span 2; }
  .grid.dash-table .dt-full { grid-column: 1 / -1; }
  .grid.dash-table .decide-cell { display: flex; justify-content: flex-start; padding-top: 4px; }
  .grid.dash-table .decide-cell .btn { flex: 1; min-height: 40px; }
  .grid.dash-table tr.empty td { grid-column: 1 / -1; padding: 14px 0; }
  .grid.dash-table .dt-name.dt-full { grid-column: 1 / -1; }

  /* an empty section is one line of text, not a tall card */
  .dashboard .card.wide.is-empty { padding: 12px 16px; margin-bottom: 10px; }
  .dashboard .card.wide.is-empty h3 { margin-bottom: 4px; }
  .dashboard .card.wide.is-empty > p { margin: 0; }
}
.goalbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.goalbar select { width: auto; max-width: 100%; }

/* Project details use the same folding cards and form controls as admin pages. */
.project-admin-form { align-items: end; }
.project-admin-form label { flex-direction: column; align-items: stretch; flex: 1 1 210px; min-width: 0; }
.project-admin-form input[type=checkbox] { width: auto; align-self: flex-start; min-height: 0; }
.project-admin-form textarea { min-height: 80px; }
.project-admin summary { font-weight: 600; overflow-wrap: anywhere; }
.project-admin .range-form { margin-top: 16px; margin-bottom: 0; }

/* Birthdays (docs/birthdays.md) */
.bday-group h2 { font-size: 15px; margin: 0 0 8px; }
.bday-list { list-style: none; margin: 0; padding: 0; }
.bday-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.bday-list li:first-child { border-top: 0; }
.bday-name { font-weight: 600; flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.bday-list li.is-today .bday-name { color: var(--ok); }
.bday-list li.is-inactive .bday-name { opacity: .6; }
.people-bday { display: flex; gap: 4px; align-items: center; }
.people-bday input { width: 4.2em; text-align: center; }
.people-bday button { padding: 2px 7px; min-height: 0; }
.bday-banner a { color: inherit; text-decoration: none; }

/* ---- entry editing + the monthly lock (docs/entry-editing.md) ------------ */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.form-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.form-head .linkbtn { font-size: 13px; text-decoration: none; white-space: nowrap; }
.date-hint { margin-top: -6px; font-size: 12.5px; }

/* how long a month stays editable: a quiet line, louder as it closes */
.entry-window {
  display: flex; align-items: flex-start; gap: 8px; margin: 0 0 14px; padding: 8px 12px;
  border-radius: 9px; font-size: 13px; line-height: 1.45; color: var(--muted);
  background: transparent; border: 1px solid var(--line);
}
/* display:flex outranks the UA [hidden] rule — without this the editor's and
   the day list's lock banners render as empty pink bars on an open month */
.entry-window[hidden] { display: none; }
.entry-window b { color: var(--ink); }
.entry-window.is-warning { background: var(--saving); color: var(--ink); border-color: transparent; font-weight: 600; }
.entry-window.is-locked { background: var(--err); color: var(--err-ink); border-color: transparent; font-weight: 600; }
.entry-window.is-admin { background: var(--active-bg); color: var(--active-ink); border-color: transparent; }
.lock-ico { flex: none; width: 15px; height: 15px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* My entries */
.card.wide.entries-list { padding: 0; overflow: hidden; }
.entries-list table.flat { margin-top: 0; }
dialog.pop.entry-edit input, dialog.pop.entry-edit textarea { font-weight: 400; font-size: 14.5px; color: var(--ink); }
.entries-table { min-width: 0; }
.entries-table th.num, .entries-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.entries-table th.act, .entries-table td.act { width: 1%; text-align: right; }
.entries-table td.e-date { color: var(--muted); }
.entries-table td.e-project { font-weight: 600; overflow-wrap: anywhere; }
.entries-table td.e-desc { overflow-wrap: anywhere; }
.entries-table .e-open { padding: 6px 14px; font-size: 13px; }
.entries-table tbody tr:last-child td { border-bottom: 0; }
.entries-empty { padding: 28px 20px; text-align: center; color: var(--muted); }
.entries-empty p { margin: 0 0 12px; }

/* the shared editor */
dialog.pop.entry-edit { width: min(480px, calc(100vw - 32px)); }
dialog.pop.entry-edit textarea { resize: vertical; min-height: 96px; }
dialog.pop.entry-edit input[readonly], dialog.pop.entry-edit textarea[readonly] { background: transparent; border-style: dashed; }
dialog.pop .sheet-grab { display: none; }
.ee-what { font-weight: 600; font-size: 14px; margin: -6px 0 10px; }
.ee-ticket { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.ee-ticket .tlink[hidden], .ee-ticket .gchip[hidden] { display: none; }
.ee-keys { font-size: 11.5px; margin: -6px 0 0; }
.ee-note { margin-top: 12px; padding: 8px 10px; border-radius: 8px; background: var(--active-bg); color: var(--active-ink); font-size: 12.5px;
           white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30vh; overflow: auto; }
.ee-note[hidden] { display: none; }
.ee-flash {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 30; margin: 0;
  box-shadow: 0 10px 28px rgba(0,5,40,.18); max-width: calc(100vw - 32px);
}

/* the week grid: one-entry cells keep typing, several open a list */
.weekgrid td.cell { position: relative; }
.weekgrid td.cell.has-edit input { padding-right: 18px; }
.cell-edit {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 22px; height: 22px; padding: 0; border-radius: 6px; font-size: 12px; line-height: 1;
  background: transparent; color: var(--muted); border: 1px solid transparent; opacity: .55;
}
.cell-edit:hover, .cell-edit:focus-visible { opacity: 1; color: var(--ink); background: var(--card); border-color: var(--line); }
.cell-edit:focus-visible, .cell-open:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.cell-open {
  width: 100%; min-height: 40px; padding: 4px 6px; border-radius: 7px; line-height: 1.2;
  background: var(--active-bg); color: var(--active-ink); border: 1px dashed var(--ring);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.cell-open .cm-h { font-size: 15px; font-weight: 700; }
.cell-open .cm-n { font-size: 11px; font-weight: 600; opacity: .85; }
td.cell.is-locked { background: color-mix(in srgb, var(--head) 70%, transparent); }
td.cell.is-locked .cell-open { background: transparent; color: var(--ink); border: 1px solid var(--line); }
td.cell.is-locked input:disabled { opacity: 1; cursor: not-allowed; background: transparent; border-color: transparent; }
.col-day.is-locked { color: var(--err-ink); }
.day-lock { display: inline-flex; align-items: center; gap: 3px; justify-content: center; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
.day-lock .lock-ico { width: 11px; height: 11px; margin: 0; }
.week-help { margin: 10px 2px 0; font-size: 12.5px; }
.cell-list { width: min(440px, calc(100vw - 32px)); }
.cl-list { list-style: none; margin: 12px 0 0; padding: 0; }
.cl-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.cl-list .cl-h { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cl-list .cl-d { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.cl-list .cl-open { padding: 6px 14px; font-size: 13px; }
.cell-list .entry-window { margin: 10px 0 0; }

@media (max-width: 720px) {
  /* entries as stacked cards — no sideways scroll */
  /* selectors carry .entries-list + table.grid so they outrank `table.grid`'s
     520px floor and `.entrylist table.flat td`'s padding */
  .entries-table thead { display: none; }
  .entries-list table.grid.entries-table, .entries-list .entries-table tbody { display: block; min-width: 0; width: 100%; }
  .entries-list .entries-table tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--line);
  }
  .entries-list .entries-table tbody tr:last-child { border-bottom: 0; }
  .entries-list table.flat.entries-table td { display: block; border: 0; padding: 0; text-align: left; min-width: 0; }
  .entries-list table.flat.entries-table td.e-date { grid-column: 1; grid-row: 1; font-size: 12.5px; }
  .entries-list table.flat.entries-table td.e-hours { grid-column: 2; grid-row: 1; font-weight: 700; font-size: 15px; text-align: right; }
  .entries-list table.flat.entries-table td.e-project { grid-column: 1 / -1; grid-row: 2; font-size: 15px; }
  .entries-list table.flat.entries-table td.e-desc { grid-column: 1; grid-row: 3; font-size: 14px; }
  .entries-list table.flat.entries-table td.act { grid-column: 2; grid-row: 3; width: auto; align-self: end; }
  .entries-table .e-open { min-height: 44px; min-width: 64px; }
  .entries-table td.desc .tlink { display: block; margin: 4px 0 0; white-space: normal; }

  /* the editor and the day list rise as bottom sheets, clear of the tab bar's
     safe area and of the on-screen keyboard (the sheet scrolls) */
  dialog.pop.entry-edit, dialog.pop.cell-list {
    margin: auto 0 0; width: 100%; max-width: none; border-radius: 18px 18px 0 0;
    padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: 92vh; max-height: 92dvh; overflow: auto;
  }
  dialog.pop.entry-edit[open], dialog.pop.cell-list[open] { animation: sheet-in .18s ease-out; }
  dialog.pop .sheet-grab { display: block; }
  dialog.pop.entry-edit input, dialog.pop.entry-edit textarea { font-size: 16px; min-height: 44px; }
  dialog.pop.entry-edit .pop-actions { flex-wrap: wrap; }
  dialog.pop.entry-edit .pop-actions button { min-height: 44px; flex: 1; }
  dialog.pop.entry-edit .pop-actions .danger { flex-basis: 100%; order: 3; margin: 0; }
  .pop-x { min-width: 44px; min-height: 44px; }
  .cl-list .cl-open, .cell-list .pop-actions .btn { min-height: 44px; }
  .ee-flash { bottom: calc(var(--tabbar-h, 0px) + 12px); }
  /* Phone cells are ~60px wide, too narrow for a 44px target beside the
     number, and any target laid over the input would steal taps meant for
     typing. So the pencil drops below the input as its own full-width,
     44px-tall row; the glyph stays small. */
  .cell-edit {
    position: static; transform: none; display: block; width: 100%; height: 44px; min-height: 44px;
    margin: 0 0 -7px; font-size: 13px; opacity: .8;
  }
  .weekgrid td.cell.has-edit input { padding-right: 2px; }
  /* numbers line up across a row, pencil or not — and the project name and
     row total sit level with them rather than centred in a taller row */
  .weekgrid tbody td.cell { vertical-align: top; }
  .weekgrid tbody td.col-project, .weekgrid tbody td.col-total { vertical-align: top; padding-top: 15px; }
  .cell-open .cm-n { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  dialog.pop.entry-edit[open], dialog.pop.cell-list[open] { animation: none; }
}
