/* naztech Status Base — one committed look: dark navigation, light working surface. */
:root{
  color-scheme: light;
  --page:#EBEFF1; --surface:#FFFFFF; --surface-2:#F5F8F9; --surface-3:#EEF2F4;
  --ink:#13232A; --ink-2:#556D76; --ink-3:#566F7B;   /* -3 must clear 4.5:1 on --page, not only on white: 4.59:1 on --page, 5.31:1 on white (was #5E7885, 4.03:1 on --page) */
  --line:#E2E9EB; --line-hard:#C7D4D8;
  /* navy #010F31 for the sidebar, sign-in page and other dark surfaces; -2/-3 are lighter steps of the same hue */
  --band:#010F31; --band-2:#0B1E4C; --band-3:#1C346E; --band-ink:#E1E7F7; --band-ink-2:rgba(225,231,247,.64);
  /* brand gradient for buttons (violet → magenta) */
  --grad:linear-gradient(90deg, #7C3CF2 0%, #BE35CF 50%, #D91B8F 100%);
  --magenta:#E0218A; --magenta-ink:#C81B7A; --accent:#0A6E63; --accent-soft:#DDEDE9;   /* --magenta: borders, focus rings and accents (4.42:1 on white, too light for text); --magenta-ink: magenta text on white (5.39:1) */
  --danger:#B42318; --danger-soft:#FDECEA; --warn-soft:#FEF3DC; --ok-soft:#E3F4EA;
  --series-1:#2a78d6; --series-2:#eb6834;
  --busy:#0A6E63; --available:#7CC4B8; --leave:#C7D4D8;
  --sans:"IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif:"IBM Plex Serif", Georgia, "Times New Roman", serif;
  --mono:"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side-w:232px; --rail-w:64px; --top-h:44px; --r:8px;   /* --rail-w: the collapsed sidebar, the icon rail (52px at 720px and below) */
  /* One density scale. Every spacing, control height and type size below resolves through these. */
  --stick:var(--top-h);          /* what a page-level sticky element pins to */
  --filter-h:40px;               /* sticky filter band, one row (32px control + 4px padding each side); app.js measures its real height */
  --head-h:32px; --head-py:8px;  /* table head row */
  --row-h:32px;                  /* data row (a minimum: height on a td is a floor) */
  --ctl-h:32px; --ctl-h-sm:28px; /* control heights; -sm is a hard floor, never shave it */
  --field-h:32px;                /* inputs inside panels and dialogs */
  --page-x:16px; --page-y:12px;  /* .content gutters; -x must match the sticky band inset */
  --stack:12px;                  /* the one gap between stacked page sections */
  --pad-y:12px; --pad-x:16px;    /* panel / card / dialog padding */
  --cell-y:4px; --cell-x:12px;   /* table body cells */
  --fs-meta:var(--fs-caption); --fs-sm:var(--fs-caption); --fs-md:var(--fs-body);   /* older names, kept as aliases */   /* type floors */
  --shadow:0 1px 2px rgba(1,15,49,.06), 0 4px 14px rgba(1,15,49,.05);

  /* Enterprise design system (docs/ux-audit/design-system.md). */
  --card-label:112px;   /* phone cards: the label column; values start 8px after it */
  --confirm-w:112px;    /* a row's two-click trash icon, armed or deleting: its least width, which holds "Delete archive?" */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-6:24px;
  --fs-h1:24px; --fs-h2:18px; --fs-body:14px; --fs-caption:12px;
  --lh-tight:1.25; --lh-body:1.5; --lh-caption:1.4;
  /* semantic colours: text on its own soft background is >= 4.5:1 */
  --success:#136A36; --success-soft:#E3F4EA; --success-border:#BFE3CC;
  --warning:#7A4A00; --warning-soft:#FEF3DC; --warning-border:#F5C451;
  --info:#1C4E86;    --info-soft:#EAF2FB;    --info-border:#C9DDF3;
  --danger-border:#F5C2BC;
  --line-control:#8397A1;   /* input and select edges: 3:1 on white (WCAG 1.4.11) */
  --row-selected:#F3EDFD;   /* a selected grid row, or a selected phone card */
  --ring-dark:#F25BA8;      /* the focus ring inside the navy sidebar: 3.9:1 on the current item (--band-3), 6.1:1 on --band; --magenta is 2.7:1 there */
  --dur-fast:150ms; --dur:180ms; --ease:cubic-bezier(.2,0,.2,1);
}
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0}
html{scrollbar-gutter:stable}   /* keep the width steady when filtering makes a page too short to scroll */
/* Focus and in-page jumps land below the pinned header, not under it (the filter band and the Settings tabs add their height below). */
html{scroll-padding-top:calc(var(--top-h) + var(--sp-2))}
body{background:var(--page); color:var(--ink); font:var(--fs-body)/var(--lh-body) var(--sans); -webkit-font-smoothing:antialiased}
/* Two weights only (design system §2): nothing falls back to the browser's bold (700) or bolder. */
b, strong, h1, h2, h3, th{font-weight:600}
::placeholder{color:var(--ink-3); opacity:1}   /* 5.31:1 on white */
a{color:var(--accent)}
img{max-width:100%}
[hidden]{display:none !important}
:focus-visible{outline:2px solid var(--magenta); outline-offset:2px; border-radius:3px}
::selection{background:var(--accent-soft)}
.sr{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}
.skip{position:absolute; left:-999px; top:8px; background:#fff; padding:8px 12px; z-index:100}
.skip:focus{left:8px}
.ic{width:17px; height:17px; flex:none}
.mono{font-family:var(--mono); font-variant-numeric:tabular-nums}
.muted{color:var(--ink-3)}
.small{font-size:var(--fs-caption)}
.nw{white-space:nowrap}
code{font-family:var(--mono); font-size:1em; background:var(--surface-3); padding:1px 4px; border-radius:4px}   /* the size of the text around it: 12px in a hint, 14px in body text */

/* ---------- shell ---------- */
.shell{display:grid; grid-template-columns:var(--side-w) minmax(0,1fr); min-height:100vh}
.side{
  position:sticky; top:0; height:100vh; background:var(--band); color:var(--band-ink);
  display:flex; flex-direction:column; border-right:1px solid #000A24; z-index:40; overflow:hidden;
}
/* Fixed height, and the toggle sits where the collapsed rail centres it, so nothing jumps when collapsing. */
.side-brand{display:flex; align-items:flex-start; gap:8px; height:82px; padding:16px 12px 0 16px; border-bottom:1px solid rgba(255,255,255,.07)}
.side-logo{display:flex; flex-direction:column; gap:4px; min-width:0; padding-top:1px}
.side-logo img{width:132px; height:auto}
/* the product and the company on two lines, in their own letter case (xPROJECT), inside the 82px brand row */
.side-name{display:flex; flex-direction:column; font-size:var(--fs-caption); line-height:1.2; white-space:nowrap}
.side-name b{font-weight:600; letter-spacing:.02em; color:var(--band-ink)}
.side-name small{font-size:var(--fs-caption); font-weight:400; color:var(--band-ink-2)}
.side-toggle{flex:none; display:grid; place-items:center; width:30px; height:30px; margin-top:2px; padding:0; border-radius:8px; border:1px solid rgba(255,255,255,.14); background:none; color:var(--band-ink-2); cursor:pointer}
.side-toggle:hover{background:rgba(255,255,255,.08); border-color:rgba(255,255,255,.28); color:#fff}
.side-toggle .chev{transition:transform .18s; transform-box:fill-box; transform-origin:center}
.side-nav{display:flex; flex-direction:column; gap:2px; padding:12px 8px; flex:1; overflow-y:auto; overflow-x:hidden; scrollbar-width:none; -ms-overflow-style:none}
.side-nav::-webkit-scrollbar{width:0; height:0}   /* the rail still scrolls, it just does not show a bar */
.side-nav a span{white-space:nowrap}
.side-nav a, .side-foot > .side-link{min-height:38px}          /* same height with or without the label, so the rail doesn't shift */
.side-nav a span, .side-foot > .side-link span{line-height:20px}
.side-nav a, .side-link{
  position:relative; display:flex; align-items:center; gap:12px; padding:8px 12px; border-radius:8px;
  color:var(--band-ink); text-decoration:none; font-weight:600; font-size:var(--fs-body);
  background:none; border:0; width:100%; font-family:inherit; cursor:pointer; text-align:left;
}
.side-nav a .ic, .side-link .ic{color:var(--band-ink-2)}
.side-nav a:hover, .side-link:hover{background:rgba(255,255,255,.12); color:#fff}
.side-nav a:hover .ic, .side-link:hover .ic{color:#fff}
.side-nav a.on, .side-link.on{background:var(--band-3); color:#fff}
.side-nav a.on .ic, .side-link.on .ic{color:#fff}
.side-nav a.on:hover, .side-link.on:hover{box-shadow:inset 0 0 0 1px var(--band-ink-2)}   /* the current item keeps its fill and gains an edge */
/* Focus in the navy sidebar: a lighter magenta that still clears 3:1 on the current item, drawn above the next item. */
.side :focus-visible{outline-color:var(--ring-dark)}
.side-nav a:focus-visible, .side-link:focus-visible{z-index:1}
.side-nav a.on::before, .side-link.on::before{content:""; position:absolute; left:-10px; top:8px; bottom:8px; width:3px; border-radius:0 3px 3px 0; background:var(--magenta)}
.side-nav .ro{margin-left:auto; font-style:normal; font-size:var(--fs-meta); letter-spacing:.06em; text-transform:uppercase; color:var(--band-ink-2); border:1px solid rgba(255,255,255,.16); border-radius:10px; padding:0 8px}
.side-foot{padding:8px; border-top:1px solid rgba(255,255,255,.07); display:flex; flex-direction:column; gap:4px}
.me{display:flex; align-items:center; gap:8px; padding:8px 12px 8px}
.avatar{width:30px; height:30px; border-radius:50%; background:var(--band-3); color:#fff; display:grid; place-items:center; font-size:var(--fs-caption); font-weight:600; flex:none}
.me-txt{display:flex; flex-direction:column; min-width:0}
.me-txt b{font-size:var(--fs-body); font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.me-txt small{font-size:var(--fs-caption); color:var(--band-ink-2)}
.me-acts{display:flex; gap:2px}
.me-acts .side-link{font-size:var(--fs-caption); padding:8px 8px; white-space:nowrap}
.me-acts form{flex:1; margin:0}

/* The icon rail. Above 900px it shows while the sidebar is collapsed (.side-collapsed, a remembered choice); at 900px and
   below the sidebar is always the rail unless its toggle has opened it over the page (.nav-open, see the responsive rules).
   Labels stay in the page for screen readers; app.js adds hover tooltips. */
@media (min-width:901px){
  .shell{transition:grid-template-columns .18s ease}
  .side-collapsed{--side-w:var(--rail-w)}
  .side-collapsed .side-logo{display:none}
  .side-collapsed .side-toggle .chev{transform:rotate(180deg)}
  .side-collapsed .side-nav a, .side-collapsed .side-link{justify-content:center; gap:0; padding-left:0; padding-right:0}
  .side-collapsed .side-nav a > span, .side-collapsed .side-link > span, .side-collapsed .me-txt{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}
  .side-collapsed .side-nav .ro{display:none}
  .side-collapsed .me{justify-content:center; padding:8px 0 4px}
  .side-collapsed .me-acts{flex-direction:column}
}
/* The same rail at 900px and below, whatever the remembered choice, until the toggle opens it (keep the two blocks in step). */
@media (max-width:900px){
  body:not(.nav-open) .side-logo{display:none}
  body:not(.nav-open) .side-toggle .chev{transform:rotate(180deg)}
  body:not(.nav-open) .side-nav a, body:not(.nav-open) .side-link{justify-content:center; gap:0; padding-left:0; padding-right:0}
  body:not(.nav-open) .side-nav a > span, body:not(.nav-open) .side-link > span, body:not(.nav-open) .me-txt{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}
  body:not(.nav-open) .side-nav .ro{display:none}
  body:not(.nav-open) .me{justify-content:center; padding:8px 0 4px}
  body:not(.nav-open) .me-acts{flex-direction:column}
}

.main-col{display:flex; flex-direction:column; min-width:0}
/* One header on every page: the title (and the DEV badge) with its helper text beneath, the actions on the right.
   It sits on the page background with no divider, so the header, the filter band and the tabs read as one light band.
   app.js measures its height into --top-h for the sticky layers below it. The actions keep their width on one row:
   the helper text gives up width first, then a long title ends in an ellipsis. */
.top{
  position:sticky; top:0; z-index:30; display:flex; align-items:center; gap:12px;
  min-height:var(--top-h); padding:4px var(--page-x); background:var(--page);
}
.top-bar{flex:1 1 0; min-width:0; display:flex; align-items:center; gap:var(--sp-3)}
.top-title{flex:1 1 0; min-width:0; display:grid; grid-template-columns:minmax(0,max-content) auto minmax(0,1fr); align-items:center; column-gap:8px}
.top-title h1{margin:0; min-width:0; overflow-x:clip; text-overflow:ellipsis; font-family:var(--serif); font-weight:600; font-size:var(--fs-h2); letter-spacing:-.01em; line-height:1.15; white-space:nowrap}
.top-title p{grid-column:1 / -1; margin:0; min-width:0; color:var(--ink-2); font-size:var(--fs-caption); line-height:1.25; white-space:nowrap; overflow-x:clip; text-overflow:ellipsis}
.top-acts{flex:none; margin-left:auto; display:flex; gap:8px; flex-wrap:nowrap}
.top-acts:empty{display:none}
/* DEV environment marker (never rendered in production) */
.env-badge{flex:none; align-self:center; font:600 var(--fs-meta)/1 var(--sans); letter-spacing:.08em; color:var(--warning); background:var(--warning-soft); border:1px solid var(--warning-border); border-radius:5px; padding:1px 8px}
.env-badge-float{position:fixed; top:10px; right:12px; z-index:300}
.content{padding:var(--page-y) var(--page-x) 8px; flex:1; min-width:0}
.foot{display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:8px 0 12px; color:var(--ink-3); font-size:var(--fs-meta); border-top:1px solid var(--line-hard); margin:0 var(--page-x)}

/* ---------- buttons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:8px; font:600 var(--fs-body)/1 var(--sans);
  padding:4px var(--pad-x); min-height:var(--ctl-h); border-radius:8px; border:1px solid transparent; cursor:pointer; text-decoration:none; white-space:nowrap;
  transition:background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn .ic{width:15px; height:15px}
/* Hover and press darken the gradient: its middle stop holds white text at 4.57:1 at rest, so any lightening fails 4.5:1.
   Hover 5.05:1, pressed 5.64:1 at the middle stop. Only the shadow and the press move (design system §4 motion). */
.btn-primary{background:var(--grad); color:#fff; border-color:transparent; box-shadow:0 4px 14px -4px rgba(190,53,207,.6); transition:box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease)}
.btn-primary:hover{filter:brightness(.94); box-shadow:0 6px 18px -4px rgba(190,53,207,.7)}
.btn-primary:active{filter:brightness(.88)}
.btn-ghost{background:var(--surface); color:var(--ink); border-color:var(--line-hard)}
.btn-ghost:hover{border-color:#7C3CF2; color:#5B21B6}
.btn-danger-ghost{background:none; color:var(--danger); border-color:transparent}
.btn-danger-ghost:hover{background:var(--danger-soft)}
.btn-danger-ghost[data-armed]{background:var(--danger); color:#fff}
.btn-sm{padding:4px 8px; min-height:var(--ctl-h-sm); font-size:var(--fs-sm)}
.btn-block{width:100%; justify-content:center; padding:12px}
.btn[disabled]{opacity:.5; cursor:not-allowed}
.icon-btn{display:inline-flex; align-items:center; justify-content:center; width:var(--ctl-h-sm); height:var(--ctl-h-sm); min-height:var(--ctl-h-sm); background:none; border:1px solid var(--line-hard); border-radius:6px; padding:4px; cursor:pointer; color:var(--ink-2); line-height:0; vertical-align:middle}
.icon-btn .ic{width:16px; height:16px}
.icon-btn:hover:not([disabled]){border-color:var(--magenta); color:var(--magenta)}
.icon-btn[disabled]{opacity:.3; cursor:not-allowed}

/* ---------- forms ---------- */
.form{display:flex; flex-direction:column; gap:12px}
.field{display:flex; flex-direction:column; gap:var(--sp-1); min-width:0; border:0; margin:0; padding:0}
.field > span, .field > legend{font-size:var(--fs-caption); font-weight:600; color:var(--ink-2)}
.field > legend{margin-bottom:8px; padding:0}
.field small, .hint{font-size:var(--fs-caption); color:var(--ink-2); font-weight:400}
.field-row{display:flex; gap:12px; flex-wrap:wrap}
.field-row > .grow{flex:1 1 180px}
.w-sm{flex:0 0 120px} .w-md{flex:0 0 230px; max-width:100%}
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=url], input[type=search], select, textarea{
  font:inherit; font-size:var(--fs-md); color:var(--ink); background:#fff; width:100%;
  border:1px solid var(--line-control); border-radius:8px; padding:4px var(--cell-x); min-height:var(--field-h);
}
textarea{resize:vertical; min-height:60px}
input:where(:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file])):focus, input:where([type=date],[type=month]):focus-within, select:where(:not(.st-select):not(.grid-select)):focus, textarea:focus{outline:none; border-color:var(--magenta); box-shadow:0 0 0 3px rgba(224,33,138,.13)} /* text-like controls only (a checkbox cannot paint border-color, a file input has no border: both keep the global ring); :where() keeps the old 0,1,1 specificity. Checkboxes, radios and the inline selects get the outline ring after .grid-select:focus */
/* Keyboard focus (which a text box always shows): the design system's 2px ring at 2px offset, around the magenta border. */
input:where(:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file])):focus-visible, select:where(:not(.st-select):not(.grid-select)):focus-visible, textarea:focus-visible{outline:2px solid var(--magenta); outline-offset:2px; box-shadow:none}
/* the date field's calendar button is its own tab stop: while it has focus the field matches :focus-within but not :focus */
input:is([type=date],[type=month]):focus-within:not(:focus)::-webkit-calendar-picker-indicator{outline:2px solid var(--magenta); outline-offset:2px; border-radius:3px}
input[type=date], input[type=month]{height:var(--field-h)}   /* Chrome's date editor adds 1px above and below: 33px beside 32px fields */
input:disabled, select:disabled, textarea:disabled{background:var(--surface-2); color:var(--ink-2)}
.form-h{font-size:var(--fs-body); text-transform:uppercase; letter-spacing:.06em; color:var(--ink-3); margin:8px 0 -4px; font-weight:600}
.form-error{margin:0; padding:8px 12px; border-radius:8px; background:var(--danger-soft); color:var(--danger); font-size:var(--fs-body); font-weight:600}
.check{display:flex; align-items:flex-start; gap:8px; cursor:pointer; font-size:var(--fs-body)}
.check input{margin:4px 0 0; accent-color:var(--band); width:15px; height:15px; flex:none}
.check span{display:flex; flex-direction:row; align-items:baseline; flex-wrap:wrap; gap:0 8px}
.check small{color:var(--ink-3); font-size:var(--fs-caption)}
.check-inline{padding:0}
/* A quiet control's hover: the row tints, 4px beyond its box, without moving anything. */
.check{border-radius:6px}
.check:hover:not(:has(input:disabled)){background:var(--surface-2); box-shadow:0 0 0 var(--sp-1) var(--surface-2)}
.settings-row > .check, .config-grid > .check{align-self:center; align-items:center; min-height:var(--ctl-h)}
.settings-row > .check{align-self:flex-end}   /* on the boxes' line, under their labels */
.check-sm{font-size:var(--fs-caption); align-items:center}
.check-sm input{margin:0}
.checklist{display:grid; grid-template-columns:repeat(auto-fill, minmax(210px,1fr)); gap:4px 12px; max-height:180px; overflow:auto; padding:8px 8px; border:1px solid var(--line); border-radius:8px; background:var(--surface-2)}
.checklist-tall{max-height:230px}
.checklist .check{padding:4px 0}
.checklist .dot{display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--c); margin-right:8px}
.seg{display:inline-flex; border:1px solid var(--line-hard); border-radius:8px; overflow:hidden; background:#fff; flex-wrap:wrap}
.seg label{position:relative; cursor:pointer}
.seg input{position:absolute; opacity:0; pointer-events:none}
.seg span{display:block; padding:8px 12px; font-size:var(--fs-caption); font-weight:600; color:var(--ink-2); border-right:1px solid var(--line)}
.seg label:last-child span{border-right:0}
.seg input:checked + span{background:var(--band); color:#fff}
.seg input:focus-visible + span{outline:2px solid var(--magenta); outline-offset:-2px}
.seg label:hover input:not(:checked):not(:disabled) + span{background:var(--surface-2); color:var(--ink)}
.seg input:disabled + span{opacity:.55; cursor:not-allowed}
.seg-sm span{padding:4px 12px; font-size:var(--fs-caption)}
.prog-input{display:flex; align-items:center; gap:8px}
.prog-input input[type=range]{flex:1 1 auto; min-width:0; width:100%; accent-color:var(--accent)}
.prog-input input[type=number]{width:78px; flex:none}
.toggle{display:inline-flex; align-items:center; gap:8px; font-size:var(--fs-caption); color:var(--ink-2); cursor:pointer}
.toggle input{accent-color:var(--band)}

/* ---------- alerts / empty ---------- */
.alert{padding:8px 12px; border-radius:8px; font-size:var(--fs-body); font-weight:600; border:1px solid}
.alert-error{background:var(--danger-soft); color:var(--danger); border-color:var(--danger-border)}
.alert-info{background:var(--info-soft); color:var(--info); border-color:var(--info-border)}
.alert-ok{background:var(--ok-soft); color:var(--success); border-color:var(--success-border)}
.empty-state{display:flex; align-items:center; flex-wrap:wrap; gap:12px; background:var(--surface); border:1px solid var(--line-hard); border-radius:var(--r); padding:16px 16px; text-align:left; color:var(--ink-2); margin-top:var(--stack)}
.empty-state > *{margin:0}
.empty-state h2{font-family:var(--serif); font-size:var(--fs-h2); color:var(--ink); flex:0 0 auto}
.empty-state p{max-width:none; flex:1 1 320px; font-size:var(--fs-sm)}
.content > .empty-state{max-width:640px}
.table-wrap > .empty-state, .allocation-table > .empty-state{border:0; border-radius:0; margin:0; padding:12px var(--pad-x)}
.empty-inline{color:var(--ink-3); font-size:var(--fs-body); padding:8px 0}
.page-note{color:var(--ink-2); font-size:var(--fs-sm); max-width:90ch; margin:var(--sp-3) 0}   /* on the content edge, like the table above it */

/* ---------- toolbar ---------- */
/* Search and filter chips share one row: the search gives up width first, then chips wrap inside their own group. */
.toolbar{position:relative; display:flex; align-items:end; gap:8px 12px}
.search{position:relative; flex:0 1 240px; min-width:160px}
.search .ic{position:absolute; left:9px; top:50%; transform:translateY(-50%); width:14px; height:14px; color:var(--ink-3)}
.search input{padding:4px 8px 4px 24px; min-height:32px; font-size:var(--fs-caption)}
.chips{display:flex; flex-wrap:wrap; gap:4px; flex:0 0 auto; min-width:0; max-width:calc(100% - 172px)}
.chip{
  display:inline-flex; align-items:center; gap:4px; font:600 var(--fs-caption)/1 var(--sans); cursor:pointer; white-space:nowrap;
  padding:4px 8px; border-radius:20px; border:1px solid var(--line-hard); background:var(--surface); color:var(--ink-2);
}
.chip i{width:7px; height:7px; border-radius:50%; background:var(--c, var(--ink-3)); display:inline-block}
.chip span{font-family:var(--mono); font-size:var(--fs-meta); color:var(--ink-2); font-weight:600}
.chip:hover{border-color:var(--ink-3)}
.chip[aria-pressed=true]{background:var(--grad); border-color:transparent; color:#fff}
.chip[aria-pressed=true] span{color:rgba(255,255,255,.7)}
.chip .ic{width:12px; height:12px}
.chip-alert{color:var(--danger); border-color:var(--danger-border)}
.chip-alert[aria-pressed=true]{background:var(--danger); border-color:var(--danger)}
/* "Showing N of M" while filtering: a caption under the row's right end, so it never pushes chips around */
.toolbar-count{position:absolute; right:2px; top:100%; margin-top:1px; font-size:var(--fs-caption); line-height:12px; color:var(--ink-3); white-space:nowrap}
.toolbar .toggle{flex:none; white-space:nowrap; font-size:var(--fs-caption)}

/* ---------- tables ---------- */
.table-wrap{background:var(--surface); border:1px solid var(--line-hard); border-radius:var(--r)}
/* A grid scrolls sideways inside its own frame, never the page. grid.js sizes the frame to the room left on screen
   (--grid-frame-h), so a long list scrolls inside it as well, with its head frozen at the top and its scrollbars in
   view. Phone cards (720px and below) keep the page scroll. */
@media (min-width:721px){
  .table-wrap{overflow:auto; max-height:var(--grid-frame-h, none); overscroll-behavior-x:contain; scroll-padding-top:var(--head-h); scroll-padding-inline:32px}   /* a focused control stops clear of the 32px edge fade */
  .table-wrap:has(> .amc-grid){scroll-padding-top:calc(var(--head-h) + var(--row-h))}   /* ...and clear of the sticky client band under the head */
  .table-wrap:focus-visible{outline-offset:-2px}   /* a focused frame draws its ring inside (it drops its edge fade, below) */
  .table-wrap .grid{--stick:0px}   /* the head and the AMC client bands stick to the frame, not to the page */
  .table-wrap{container:frame / inline-size}   /* a list can drop a column by the frame's own width, sidebar open or not (fix 10) */
}
table.grid{width:100%; border-collapse:separate; border-spacing:0; table-layout:fixed}
body:has(.toolbar.live-filters){--stick:calc(var(--top-h) + var(--filter-h))}
.grid thead th{
  height:var(--head-h); position:sticky; top:var(--stick); z-index:5; background:var(--band-2); color:var(--band-ink);
  font-size:var(--fs-meta); font-weight:600; letter-spacing:.06em; text-transform:uppercase; text-align:left;
  padding:var(--head-py) calc(var(--cell-x) + 4px) var(--head-py) var(--cell-x); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.15;
  border-top:1px solid var(--magenta);
}
.grid thead th:first-child{border-top-left-radius:calc(var(--r) - 1px)}
.grid thead th:last-child{border-top-right-radius:calc(var(--r) - 1px)}
.grid thead th.c, .grid td.c{text-align:center}
.grid tbody td{height:var(--row-h); padding:var(--cell-y) var(--cell-x); font-size:var(--fs-md); line-height:1.3; vertical-align:middle; border-bottom:1px solid var(--line); background:var(--surface); position:relative; z-index:0; overflow-wrap:break-word}
.grid td.row-actions, .grid td.resource-actions, .grid td.act, .grid td:has(.st-wrap), .grid td:has(select){padding-block:1px}   /* a 28px control already fills the row */
.grid td.col-remarks, .grid td[colspan], .amc-grid td[data-l="Notes"]{vertical-align:top}   /* genuinely multi-line cells keep their top edge */
.grid tbody tr:last-child td{border-bottom:0}
.grid tbody tr:hover td{background:var(--surface-2)}
.grid tr.clickable{cursor:pointer}
.grid .row-inactive td{opacity:.55}
.grid .sub{display:block; color:var(--ink-3); font-size:var(--fs-caption); margin-top:1px}
.pname{font-weight:600}
.band td{background:var(--surface-3) !important; font-size:var(--fs-meta); font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-2); padding:4px var(--cell-x); border-top:1px solid var(--line-hard); border-bottom:1px solid var(--line-hard); box-shadow:inset 3px 0 0 var(--band-3)}
.band-dot{display:inline-block; width:9px; height:9px; border-radius:50%; background:var(--c); margin-right:8px; vertical-align:0}
.count{font-family:var(--mono); font-size:var(--fs-meta); font-weight:600; color:var(--ink-2); background:var(--surface-3); border:1px solid var(--line); border-radius:20px; padding:0 8px; letter-spacing:0; vertical-align:1px}

/* directory */
.dir tr.row-first td{border-top:1px solid var(--line-hard)}
.dir tbody tr.row-first:first-child td{border-top:0}
.dir .cl{white-space:normal}
.dir .ed-client{font-family:var(--serif); font-weight:600; font-size:var(--fs-body); display:inline; margin:0; padding:1px 4px}
.ghost-client{color:var(--ink-3); font-size:var(--fs-caption); opacity:.6}
.dir tr:hover .ghost-client{opacity:1}
.ed{min-height:22px; padding:1px 8px; margin:-1px -8px; border-radius:5px; border:1px solid transparent; white-space:pre-wrap; outline:none; font-size:var(--fs-body)}
.ed[contenteditable]:hover{border-color:var(--line-hard); cursor:text}
.ed[contenteditable]:focus{border-color:var(--magenta); background:#fff; box-shadow:0 0 0 3px rgba(224,33,138,.12)}
.ed:empty::before{content:attr(data-ph); color:var(--ink-3)}
.ed.saving{border-color:#E9C46A !important}
.ed.saved{border-color:#6CC08B !important; transition:border-color .6s}
.ed.bad{border-color:var(--danger) !important; background:var(--danger-soft)}
.f-code, .f-since{font-family:var(--mono); font-size:var(--fs-caption); font-variant-numeric:tabular-nums; color:var(--ink-2)}
.f-rem{color:var(--ink-2); font-size:var(--fs-caption)}
.mini{font:600 var(--fs-caption)/1 var(--sans); cursor:pointer; background:none; border:1px solid var(--line); color:var(--ink-3); border-radius:5px; padding:2px 8px; margin-left:4px; opacity:.35; vertical-align:1px}
tr:hover .mini, .mini:focus-visible{opacity:1}
.mini:hover{border-color:var(--magenta); color:var(--magenta)}
.del{font:600 var(--fs-body)/1 var(--sans); cursor:pointer; background:none; border:1px solid transparent; color:var(--ink-3); border-radius:5px; padding:4px 8px; opacity:.35}
tr:hover .del, .del:focus-visible{opacity:1; border-color:var(--line)}
.del:hover{color:var(--danger); border-color:var(--danger)}
.del[data-armed]{opacity:1; font-size:var(--fs-caption); color:#fff; background:var(--danger); border-color:var(--danger)}
.row-empty .muted{font-style:italic}

/* status select + chips */
.st-wrap{position:relative; display:inline-block; max-width:100%}
.st-wrap::after{content:""; position:absolute; right:9px; top:50%; margin-top:-2px; border:4px solid transparent; border-top-color:var(--ink-3); pointer-events:none}
.st-select{
  appearance:none; -webkit-appearance:none; min-height:var(--ctl-h-sm); width:auto; max-width:100%; font:600 var(--fs-caption)/1.3 var(--sans);
  padding:4px 24px 4px 24px; border-radius:20px; border:0; color:var(--ink); cursor:pointer; text-overflow:ellipsis;
  background:color-mix(in srgb, var(--c) 15%, #fff) no-repeat;
  background-image:radial-gradient(circle, var(--c) 3.5px, transparent 4px); background-size:18px 100%; background-position:3px 50%;
}
.st-select:disabled{opacity:1; cursor:default; background-color:color-mix(in srgb, var(--c) 15%, #fff)}
.st-wrap:has(.st-select:disabled)::after{display:none}
/* An option cell edited in place: quiet until you point at it, then obviously a control. */
.grid-select{appearance:none; -webkit-appearance:none; width:100%; min-width:0; height:var(--ctl-h-sm); min-height:var(--ctl-h-sm);
  padding:0 16px 0 8px; font:400 var(--fs-body)/1.2 var(--sans); color:var(--ink); cursor:pointer; text-overflow:ellipsis;
  background:var(--surface); border:1px solid transparent; border-radius:6px;
  background-image:linear-gradient(45deg,transparent 50%,var(--ink-3) 50%),linear-gradient(135deg,var(--ink-3) 50%,transparent 50%);
  background-position:calc(100% - 12px) 12px,calc(100% - 8px) 12px; background-size:4px 4px,4px 4px; background-repeat:no-repeat}
.grid tr:hover .grid-select,.grid-select:hover{border-color:var(--line-hard); background-color:var(--surface-2)}
.grid-select:focus{outline:none; border-color:var(--magenta); box-shadow:0 0 0 3px rgba(224,33,138,.13)}
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible, .st-select:focus-visible, .grid-select:focus-visible{outline:2px solid var(--magenta); outline-offset:1px; box-shadow:none} /* keyboard focus: the same 2px magenta ring as every other control; must follow .grid-select:focus (same specificity) */
.grid-select:disabled,.st-select:disabled{opacity:.6; cursor:progress}
/* Drag the right edge of a header to resize the column; double-click it to reset. */
.col-grip{position:absolute; top:0; right:0; width:9px; height:100%; cursor:col-resize; touch-action:none; z-index:1}
.col-grip::after{content:""; position:absolute; top:5px; bottom:5px; right:4px; width:1px; background:rgba(255,255,255,.3)}
.grid thead th:hover .col-grip::after{width:2px; background:var(--magenta)}
body.col-resizing{cursor:col-resize; user-select:none}
.chip-status{display:inline-flex; align-items:center; gap:8px; max-width:100%; overflow:hidden; text-overflow:ellipsis; font-size:var(--fs-caption); font-weight:600; padding:4px 8px 4px 8px; border-radius:20px; background:color-mix(in srgb, var(--c) 15%, #fff); white-space:nowrap}
.chip-status i{width:7px; height:7px; border-radius:50%; background:var(--c); flex:none}

/* projects */
.prog{display:flex; align-items:center; gap:8px}
.prog-track{flex:1; height:6px; border-radius:3px; background:var(--surface-3); overflow:hidden; max-width:110px}
.prog-fill{display:block; height:100%; background:var(--accent); border-radius:3px}
.prog b{font-family:var(--mono); font-size:var(--fs-caption); font-weight:600; color:var(--ink-2); min-width:34px}
.flag{display:inline-block; font-size:var(--fs-caption); font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--danger); background:var(--danger-soft); border-radius:4px; padding:1px 8px; vertical-align:1px}
.faces{display:inline-flex}
.face{width:26px; height:26px; border-radius:50%; background:var(--band-2); color:#fff; display:inline-grid; place-items:center; font-size:var(--fs-caption); font-weight:600; border:2px solid var(--surface); margin-left:-8px; flex:none}
.faces .face:first-child{margin-left:0}
.face-more{background:var(--surface-3); color:var(--ink-2)}
.who{display:flex; align-items:center; gap:8px}
.who .face{margin:0; border:0; width:30px; height:30px}
.you{font-size:var(--fs-meta); text-transform:uppercase; letter-spacing:.06em; color:var(--magenta-ink); font-weight:600; margin-left:4px}   /* magenta text: 5.39:1 at rest, 4.68:1 on a focused row */

/* resources */
.tags{display:flex; flex-wrap:wrap; gap:4px}
.tag{display:inline-flex; align-items:center; gap:8px; font-size:var(--fs-caption); font-weight:600; padding:4px 8px 4px 8px; border-radius:6px; background:var(--surface-3); border:1px solid var(--line)}
.tag i{width:7px; height:7px; border-radius:50%; background:var(--c); flex:none}
.tag small{color:var(--ink-2); font-weight:600; font-size:var(--fs-meta)}
.tag-idle{opacity:.6}
.pill{display:inline-flex; align-items:center; gap:8px; font-size:var(--fs-caption); font-weight:600; padding:4px 8px 4px 8px; border-radius:20px; white-space:nowrap; background:var(--surface-3)}
.pill i{width:8px; height:8px; border-radius:50%; flex:none}
.pill small{font-size:var(--fs-meta); font-weight:600; color:var(--ink-2); text-transform:uppercase; letter-spacing:.06em}
.pill-busy{background:#DCEFEB} .pill-busy i{background:var(--busy)}
.pill-available{background:#EAF6F3} .pill-available i{background:var(--available)}
.pill-on_leave{background:var(--surface-3)} .pill-on_leave i{background:var(--leave)}
.pill-inactive i{background:var(--ink-3)}
.seg-busy{background:var(--busy)} .seg-available{background:var(--available)} .seg-on_leave{background:var(--leave)}
.summary{display:flex; flex-wrap:wrap; gap:8px 32px; align-items:flex-end; background:var(--surface); border:1px solid var(--line-hard); border-radius:var(--r); padding:8px 16px}
.summary div{display:flex; flex-direction:column}
.summary > div > b{font-size:var(--fs-h1); font-weight:600; display:flex; align-items:center; gap:8px; line-height:1.2}
.summary > div > span{font-size:var(--fs-caption); letter-spacing:.06em; text-transform:uppercase; color:var(--ink-3); font-weight:600}
.summary-note b{font-weight:600; color:var(--ink-2)}
.summary .dot{width:10px; height:10px; border-radius:50%; display:inline-block}
.summary-note{flex:1 1 280px; margin:0; font-size:var(--fs-caption); color:var(--ink-3); text-align:right}

/* users */
.acc{display:inline-block; font-size:var(--fs-caption); font-weight:600; padding:2px 8px; border-radius:5px; letter-spacing:.02em}
.acc-edit{background:var(--success-soft); color:var(--success)}
.acc-view{background:var(--info-soft); color:var(--info)}
.acc-none{background:var(--surface-3); color:var(--ink-3)}
.acc-admin{background:#FBE3F0; color:#A0165F}
.perm-matrix{border:1px solid var(--line); border-radius:8px; padding:8px 12px; background:var(--surface-2)}
#userDlg{width:min(680px,calc(100vw - 24px))}
#userDlg .perm-matrix{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:16px; row-gap:0; padding:8px 12px;
  position:relative; margin-top:calc(var(--fs-caption) * var(--lh-body) + var(--sp-1))}   /* room for its label above the box */
/* "Section access" reads like every other label: on the fields' left edge, 4px above its box */
#userDlg .perm-matrix > legend{position:absolute; left:-1px; bottom:calc(100% + 1px + var(--sp-1)); margin:0; padding:0; line-height:var(--lh-body)}
.perm-matrix[disabled]{opacity:.55}
.perm-row{display:flex; align-items:center; justify-content:space-between; gap:8px; padding:4px 0; border-bottom:0}
.perm-row + .perm-row{border-top:1px solid var(--line)}
.perm-row:last-child{border-bottom:0}
#userDlg .perm-row + .perm-row{border-top:0}
#userDlg .perm-row:nth-of-type(n+3){border-top:1px solid var(--line)}   /* a divider between grid rows, not above the first row's second cell */
#userDlg .seg-sm span{line-height:22px}   /* 32px, like the fields around it */
@media (max-width:720px){
  #userDlg .perm-matrix{grid-template-columns:minmax(0,1fr)}   /* one column: each None / View / Edit control stays on one line */
  #userDlg .perm-row .seg{flex-wrap:nowrap; flex:none}
  #userDlg .perm-row:nth-of-type(2){border-top:1px solid var(--line)}
  #userDlg .field-row > .grow{flex-basis:100%}   /* Name and Email stack below 720px, like every form */
}
.perm-name{display:flex; align-items:center; gap:8px; font-weight:600; font-size:var(--fs-body)}
.perm-name .ic{color:var(--ink-3)}

/* ---------- dashboard ---------- */
.page-dashboard [hidden]{display:none!important}
.dashboard-widget-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 16px;padding:0}
.page-dashboard .kpis{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
.page-dashboard .single-widget{grid-template-columns:minmax(0,1fr)}
@media(min-width:1101px){.page-dashboard .grid-3.two-widgets{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:480px){.dashboard-widget-options{grid-template-columns:1fr}.page-dashboard .top-acts{width:auto;margin-left:auto}}
.kpis{display:grid; grid-template-columns:repeat(6, minmax(0,1fr)); gap:8px}
/* Label on top; the note sits beside the number while the tile has room and drops beneath it when narrow. */
.kpi{display:flex; flex-wrap:wrap; align-items:baseline; align-items:last baseline; align-content:flex-start; gap:1px 8px; background:var(--surface); border:1px solid var(--line-hard); border-radius:var(--r); padding:4px 12px; text-decoration:none; color:inherit; transition:border-color .15s, box-shadow .15s}
a.kpi{position:relative; overflow:hidden}
a.kpi::before{content:""; position:absolute; left:0; top:0; bottom:0; width:0; background:linear-gradient(180deg,#7C3CF2,#D91B8F); transition:width .15s}
a.kpi:hover::before{width:3px}
a.kpi:hover{border-color:var(--ink-3); box-shadow:var(--shadow)}
.kpi-label{flex:1 0 100%; display:flex; align-items:center; gap:8px; font-size:var(--fs-caption); line-height:1.2; font-weight:600; color:var(--ink-2)}
.kpi-label .ic{width:14px; height:14px; color:var(--danger)}
.kpi-value{flex:none; font-size:var(--fs-h2); font-weight:600; letter-spacing:-.01em; line-height:1.2; color:var(--ink)}
.kpi-value small{font-size:var(--fs-caption); font-weight:600; color:var(--ink-2); margin-left:1px}
.kpi-note{flex:1 1 80px; min-width:0; font-size:var(--fs-meta); line-height:1.3; color:var(--ink-2)}
.kpi-alert{border-color:var(--danger-border); background:linear-gradient(0deg, #fff, #fff 60%, var(--danger-soft))}
.kpi-alert .kpi-value{color:var(--danger)}
.grid-2-1{display:grid; grid-template-columns:minmax(0,2fr) minmax(0,1fr); gap:var(--stack)}
.grid-3{display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:var(--stack); align-items:start}
.card{background:var(--surface); border:1px solid var(--line-hard); border-radius:var(--r); display:flex; flex-direction:column; min-width:0}
.card-hd,.panel-hd{display:flex; flex-wrap:wrap; align-items:baseline; gap:var(--sp-1) var(--sp-3); padding:var(--pad-y) var(--pad-x) var(--sp-1)}
.card-hd > div:first-child{display:flex; flex-wrap:wrap; align-items:baseline; gap:0 8px; min-width:0}
.card-hd > div:first-child p{flex:0 1 auto}   /* keep the count on the same baseline as the title */
.card-hd > div:first-child p::before{content:"· "}
.card-hd h2{margin:0; font-size:var(--fs-body); line-height:1.3; font-weight:600; flex:none}
.card-hd p,.panel-hd p{margin:0; font-size:var(--fs-sm); line-height:1.3; color:var(--ink-3); max-width:none; flex:1 1 420px}
.card-hd-side{display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:8px 12px; margin-left:auto}
.card-hd-side .legend{margin:0}
.card-bd{padding:2px var(--pad-x) 12px; flex:1}
.card-bd.flush{padding:0 0 4px}
.card-bd.flush .empty-inline{padding:8px 12px}
.legend{display:flex; flex-wrap:wrap; gap:8px 16px; font-size:var(--fs-caption); color:var(--ink-2); margin:2px 0 8px}
.legend span{display:inline-flex; align-items:center; gap:8px}
.legend b{font-family:var(--mono); font-weight:600; color:var(--ink)}
.lk{display:inline-block; width:16px; height:2px; border-radius:1px; background:var(--c)}
.sw{display:inline-block; width:10px; height:10px; border-radius:2px}
.chart{position:relative; width:100%; height:200px; touch-action:pan-y}
.chart svg{position:absolute; inset:0; display:block; width:100%; height:100%; overflow:visible}
.chart .grid-line{stroke:#E6ECEE; stroke-width:1}
.chart .axis-line{stroke:var(--line-hard); stroke-width:1}
.chart text{font:var(--fs-caption) var(--sans); fill:var(--ink-3); font-variant-numeric:tabular-nums}
.chart .end-label{font-weight:600; fill:var(--ink)}
.chart .xhair{stroke:var(--ink-3); stroke-width:1}
.tip{position:absolute; pointer-events:none; background:var(--band); color:#fff; border-radius:8px; padding:8px 8px; font-size:var(--fs-caption); box-shadow:0 8px 24px rgba(0,0,0,.2); white-space:nowrap; z-index:3}   /* dashboard.js places it inside the plot, beside the crosshair */
.tip b{font-size:var(--fs-body)}
.tip .row{display:flex; align-items:center; gap:8px; margin-top:4px}
.tip .row i{width:12px; height:2px; background:var(--c); border-radius:1px}
.tip .row span{color:rgba(255,255,255,.7)}
.tip .when{font-size:var(--fs-caption); color:rgba(255,255,255,.65); margin-bottom:2px}
.chart-note{font-size:var(--fs-meta); line-height:1.35; color:var(--ink-2); margin:4px 0 0}   /* the caveats wrap: every reader, touch and keyboard included, gets the counts */
.chart-table table{width:100%; border-collapse:collapse; font-size:var(--fs-caption)}
.chart-table th, .chart-table td{padding:4px 8px; border-bottom:1px solid var(--line); text-align:right; font-variant-numeric:tabular-nums}
.chart-table th:first-child, .chart-table td:first-child{text-align:left}
.chart-table thead th{font-size:var(--fs-caption); color:var(--ink-3); text-transform:uppercase; letter-spacing:.06em}
.chart-table{max-height:200px; overflow:auto}
.bars{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:1px}
.bar-row{display:grid; grid-template-columns:minmax(90px, 40%) 1fr auto; align-items:center; gap:8px; padding:1px 8px; margin:0 -8px; border-radius:6px; text-decoration:none; color:inherit}
.bar-label,.bar-val{line-height:1.25}
.bar-row:hover{background:var(--surface-2)}
.bar-row:hover .bar-fill{filter:brightness(1.08)}
.bar-label{font-size:var(--fs-caption); line-height:1.3; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
@media (max-width:480px){ .bar-label{white-space:normal; overflow:visible; overflow-wrap:break-word} }   /* a phone has no hover title: a long status wraps */
.bar-track{height:12px; display:flex; align-items:center}
.bar-fill{display:block; height:12px; background:var(--c); border-radius:0 4px 4px 0}
.bar-val{font-family:var(--mono); font-size:var(--fs-caption); line-height:1.3; color:var(--ink-2); text-align:right}
.stack{display:flex; gap:2px; height:12px; margin:4px 0 8px}
.stack-seg{display:block; height:100%}
.stack-seg:first-child{border-radius:4px 0 0 4px}
.stack-seg:last-child{border-radius:0 4px 4px 0}
.stack-seg:only-child{border-radius:4px}
.list{list-style:none; margin:0; padding:0}
.list li{display:flex; align-items:flex-start; justify-content:space-between; gap:8px; padding:4px var(--pad-x); border-top:1px solid var(--line)}
.list li:first-child{border-top:0}
.list-tight li{padding:4px var(--pad-x)}
.card-bd:not(.flush) .list li{padding-left:0; padding-right:0}
.li-main{display:flex; flex-direction:column; min-width:0}
.li-main b{font-weight:600; font-size:var(--fs-body); line-height:1.35}
.li-main small, .li-side small{font-size:var(--fs-caption); line-height:1.35; color:var(--ink-3)}
.li-side{display:flex; flex-direction:column; align-items:flex-end; text-align:right; gap:1px; flex:none}
.li-side b{font-size:var(--fs-caption); line-height:1.35; font-weight:600}
.li-alert b{color:var(--danger)}
.act-txt{font-size:var(--fs-caption); line-height:1.3; color:var(--ink)}
.li-main small,.li-side small{line-height:1.3}
.act-who{max-width:110px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}

/* Let the page grow with the lists instead of squeezing them into the remaining
   viewport height. Each lower card gets readable space and expands with content. */
.page-dashboard .grid-3 .card{min-height:0}   /* cards end where their content ends */
.page-dashboard .grid-3 .card-bd{overflow:visible}
.page-dashboard .grid-3 .li-main{overflow-wrap:anywhere}
@media (min-width:1101px){
  .page-dashboard .card-bd-chart{display:flex; flex-direction:column}
  .page-dashboard .card-bd-chart .chart{flex:1 1 auto; min-height:200px}
}

/* ---------- panels (settings / password) ---------- */
.panel{background:var(--surface); border:1px solid var(--line-hard); border-radius:var(--r)}
/* One rhythm: every stacked section is separated by --stack, nothing else. */
.toolbar, .summary, .kpis, .grid-2-1, .amc-cards, .resource-nav, .resource-intro, .resource-months,
.config-grid, .panel, .field-section, .checks, .allocation-tabs, .allocation-toolbar{margin-bottom:var(--stack)}
.sync-now{margin-bottom:var(--stack)}
.content > :last-child:not(dialog){margin-bottom:0}   /* a dialog keeps the browser's margin:auto, which centres it */
.panel.narrow{max-width:760px}
.panel-hd h2{margin:0; font-size:var(--fs-h2); flex:0 1 auto; min-width:0; overflow-wrap:break-word}   /* a long record name wraps instead of widening the page */
.panel-body{padding:var(--pad-y) var(--pad-x) 12px}
.panel-body > .alert{margin-bottom:var(--stack)}   /* a banner never sits flush against the form under it */
.panel-actions{display:flex; justify-content:flex-end; align-items:center; gap:8px; margin-top:var(--stack)}
/* A destructive action reads as a strip, not as a second content panel. */
.danger-zone{display:flex; align-items:center; gap:16px; flex-wrap:wrap; padding:8px var(--pad-x); background:var(--surface-3); border-color:var(--danger-border)}
/* A refused delete lands back on the record at #delete-record (clear of the sticky bar) with its reason as the strip's last row. */
.danger-zone{scroll-margin-top:var(--sp-1)}   /* html's scroll-padding already clears the pinned header: together they keep the old 12px below it */
.danger-zone .form-error{flex:1 1 100%}
/* Two fields on one row, their buttons on a row of their own: beside the fields they squeezed the select's text. */
.config-grid.config-grid-inline{grid-template-columns:220px minmax(0,1fr); align-items:end; gap:12px; margin-bottom:0}
.config-grid-inline .panel-actions{grid-column:1 / -1; margin-top:0}
.panel-actions .push{margin-right:auto}
.panel-actions:not(:has(> :not([hidden]))){display:none}   /* nothing left to show, such as Add portfolio while its row is open */
.status-list{list-style:none; margin:0; padding:0; border-top:1px solid var(--line)}
.status-row{display:grid; grid-template-columns:22px 26px minmax(0,1fr) auto auto auto 30px; grid-template-areas:"idx color name count busy move del"; gap:8px; align-items:center; padding:8px 0; border-bottom:1px solid var(--line)}
.status-row .idx{grid-area:idx; font-family:var(--mono); font-size:var(--fs-caption); color:var(--ink-3); text-align:right}
.status-row .scolor{grid-area:color}
.status-row .sname{grid-area:name; font-weight:600; min-height:var(--ctl-h)}
.status-row .count{grid-area:count}
.status-row .check{grid-area:busy}
.status-row .move{grid-area:move; display:flex; gap:4px}
.status-row .sdel{grid-area:del; justify-self:end}   /* "Remove?" grows leftwards over the row instead of resizing it */
.status-row[data-new] .sname{box-shadow:inset 3px 0 0 var(--magenta)}   /* added, not saved yet: a magenta edge; the 3:1 control border stays */
/* colour picker drawn as a round swatch */
.scolor{appearance:none; -webkit-appearance:none; width:24px; height:24px; min-height:0; padding:0; border:2px solid #fff; border-radius:50%; box-shadow:0 0 0 1px var(--line-hard); background:none; cursor:pointer}
.scolor::-webkit-color-swatch-wrapper{padding:0}
.scolor::-webkit-color-swatch{border:0; border-radius:50%}
.scolor::-moz-color-swatch{border:0; border-radius:50%}
.scolor:hover{box-shadow:0 0 0 1px var(--ink-3)}
.sdel[data-armed]{position:relative; z-index:1; width:auto; min-width:max-content; white-space:nowrap; line-height:1; font:600 var(--fs-caption)/1 var(--sans); color:#fff; background:var(--danger); border-color:var(--danger); padding:0 var(--sp-2)}   /* "Remove <status>?" at its full width, not clipped to the 28px icon */

/* ---------- dialogs ---------- */
.dlg{border:0; padding:0; border-radius:10px; width:min(560px, calc(100vw - 24px)); max-height:calc(100vh - 32px); box-shadow:0 30px 80px rgba(1,15,49,.35); border-top:3px solid var(--magenta); color:var(--ink)}
.dlg-wide{width:min(760px, calc(100vw - 24px))}
.dlg::backdrop{background:rgba(1,15,49,.55)}
.dlg-form{display:flex; flex-direction:column; max-height:calc(100vh - 36px)}
.dlg-hd{display:flex; align-items:center; gap:8px; padding:8px 16px; background:var(--band); color:var(--band-ink)}
.dlg-hd h2{margin:0; font-family:var(--serif); font-size:var(--fs-h2); font-weight:600; color:#fff}
.crumb{font-size:var(--fs-caption); letter-spacing:.08em; text-transform:uppercase; color:var(--band-ink-2); font-weight:600}
.x{margin-left:auto; display:inline-flex; align-items:center; justify-content:center; min-width:var(--ctl-h-sm); min-height:var(--ctl-h-sm); background:none; border:1px solid rgba(255,255,255,.22); color:var(--band-ink); border-radius:6px; font-size:var(--fs-h2); line-height:1; padding:0 8px; cursor:pointer}
.x:hover{background:rgba(255,255,255,.12)}
.dlg-bd{padding:12px 16px; overflow:auto; display:flex; flex-direction:column; gap:8px}
.dlg-bd > p{margin:0}
.dlg-ft{display:flex; align-items:center; gap:8px; padding:8px 16px; border-top:1px solid var(--line); background:var(--surface-2)}
.dlg-ft .grow{flex:1}
.dlg[data-readonly=true] .dlg-ft [type=submit]{display:none}

/* ---------- auth ---------- */
body.bare{background:var(--band); min-height:100vh}
/* Compact card: sign-in fits a ~450px-tall window without scrolling (~495px with a "signed out" notice). */
.auth{min-height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:12px 16px}
.auth-card{width:min(360px, 100%); background:var(--surface); border-radius:12px; overflow:hidden; box-shadow:0 30px 80px rgba(0,0,0,.35); border-top:3px solid var(--magenta)}
.auth-wide .auth-card{width:min(640px, 100%)}
/* the full-colour naztech 2.0 logo is drawn for a light background */
.auth-brand{background:#fff; padding:16px 24px 12px; border-bottom:1px solid var(--line)}
.auth-brand img{width:160px; height:auto; display:block}
.auth-body{padding:16px 24px 16px}
.auth-body h1{font-family:var(--serif); font-size:var(--fs-h1); line-height:1.25; margin:0 0 var(--sp-1); letter-spacing:-.01em}
.eyebrow{margin:0 0 4px; font-size:var(--fs-caption); letter-spacing:.1em; text-transform:uppercase; color:var(--magenta-ink); font-weight:600}
.auth-lede{margin:0 0 12px; color:var(--ink-2); font-size:var(--fs-caption); line-height:1.45}
.auth-body .alert{margin-bottom:8px; padding:8px 12px; font-size:var(--fs-body)}
.auth-body .form{gap:8px}
.auth-body .btn-block{padding:8px}
.auth-help{margin:8px 0 0; font-size:var(--fs-caption); color:var(--ink-2); text-wrap:pretty}
.auth-foot{color:var(--band-ink-2); font-size:var(--fs-caption); margin:8px 0 0}
.checks{list-style:none; margin:0; padding:8px 12px; background:var(--surface-2); border-radius:8px; font-size:var(--fs-caption); display:grid; grid-template-columns:1fr 1fr; gap:4px 16px}
.checks .ok{color:var(--success)} .checks .bad{color:var(--danger); font-weight:600}

/* ---------- toast ---------- */
.toast{position:fixed; left:50%; bottom:22px; transform:translate(-50%, 12px); background:var(--band); color:#fff; border:1px solid var(--magenta); padding:8px 16px; border-radius:8px; font-size:var(--fs-body); font-weight:600; box-shadow:0 12px 32px rgba(0,0,0,.25); opacity:0; pointer-events:none; transition:opacity .2s, transform .2s; z-index:200; max-width:min(92vw, 480px)}
.toast.on{opacity:1; transform:translate(-50%, 0)}
.toast.err{border-color:var(--danger-border); background:var(--danger); color:#fff}

@media (prefers-reduced-motion: reduce){ *, *::before, *::after, ::backdrop{transition:none !important; animation:none !important} }   /* pseudo-elements too: the popup skeleton, the live-filter bar, the dialog overlay */

/* ---------- responsive ---------- */
@media (max-width:1100px){ .kpis{grid-template-columns:repeat(3, minmax(0,1fr))} }
@media (max-width:1100px){ .grid-2-1, .grid-3{grid-template-columns:1fr} }
/* At 900px and below the sidebar stays on screen as a fixed icon rail, and the page starts after it. Its toggle opens the
   full sidebar over the page, above a dimmed backdrop, without pushing the content (app.js moves focus and closes it). */
@media (max-width:900px){
  .shell{grid-template-columns:1fr}
  .main-col{margin-left:var(--rail-w)}
  .side{position:fixed; left:0; top:0; bottom:0; height:auto; width:var(--rail-w)}
  /* open, it and its backdrop sit above the page's floating bars (the selection bar is 190); the toast (200) stays on top */
  body.nav-open .side{width:var(--side-w); z-index:196; box-shadow:0 0 40px rgba(0,0,0,.35)}
  /* the backdrop is a dialog's overlay: dimmed, blurred, with the same short fade in */
  .shell::after{content:""; position:fixed; inset:0; z-index:195; display:none; background:color-mix(in srgb, var(--band) 50%, transparent);
    -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px)}
  body.nav-open .shell::after{display:block; animation:backdrop-in var(--dur) var(--ease)}
  .top{padding:4px 16px}
  .content{padding:12px 16px}
  .foot{margin:0 16px}
}
@media (max-width:720px){
  :root{--rail-w:52px}
  .side-brand{padding-left:var(--sp-3)}   /* the toggle sits over the 52px rail's icons, open or closed, so it never moves */
  .empty-state h2{flex-shrink:1}   /* beside the rail a long empty-state heading wraps instead of running past the page edge */
  .kpis{grid-template-columns:repeat(2, minmax(0,1fr))}
  .top-acts .btn{padding:var(--sp-1) var(--sp-2)}   /* the 32px min-height governs: an icon-only action is 32px, not 33 */
  table.grid, .grid tbody, .grid tr, .grid td{display:block; width:auto}
  .grid thead{display:none}
  .grid colgroup{display:none}
  .table-wrap{background:none; border:0}
  .grid tbody tr{background:var(--surface); border:1px solid var(--line-hard); border-radius:var(--r); margin-bottom:8px; padding:4px 8px}
  .grid tbody tr.band{border:0; background:none; padding:8px 0; margin:8px 0 4px}
  .grid tbody tr.band td{background:none !important; border:0; padding:0}
  /* A field grows with whatever it holds (fix 8): its height is auto, and its label floats in the field's own left
     padding, which the field (a flow-root) contains, so a value or a label that wraps to more lines pushes the next
     field down instead of running into it. The label sits 5px below the field's top edge, as it did when it was
     absolutely positioned, without making a one-line field taller; action cells have 1px padding (see
     .grid td.row-actions), so their label adds 4px. */
  .grid tbody td{display:flow-root; position:relative; padding:4px 0 4px calc(var(--card-label) + 8px); min-height:20px; height:auto; border:0 !important; background:none !important}
  .grid tbody td::before{content:attr(data-l); float:left; margin:1px 0 -1px calc(-1 * (var(--card-label) + var(--sp-2))); width:var(--card-label); font-size:var(--fs-caption); font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-3)}
  .grid tbody td.act{padding-left:0; text-align:right}
  .grid tbody td.act::before{content:""}
  .grid tbody :is(td.row-actions, td.resource-actions)::before{margin-top:var(--sp-1)}
  .grid tbody tr.band td::before{content:none}
  .grid tbody td[colspan]{padding-left:0}
  /* A field holding an inline select keeps it beside its label while it fits and puts it on its own line under the label
     when it does not, so the chosen option is never cut off (beside the rail a phone card is 52px narrower). */
  .grid tbody td:has(> .grid-select, > .st-wrap){display:flex; flex-wrap:wrap; align-items:center; gap:var(--sp-1) var(--sp-2); padding-left:0; overflow:visible}
  .grid tbody td:has(> .grid-select, > .st-wrap)::before{float:none; margin:0; flex:none}
  .grid tbody td > .grid-select{flex:1 0 auto; width:auto; max-width:100%}
  .grid tbody td > .st-wrap{flex:none}
  .grid tbody td:has(> .grid-select, > .st-wrap) > .sub{flex:1 0 100%; margin:0; padding-left:calc(var(--card-label) + var(--sp-2))}
  .dir tr.row-first td{border-top:0}
  .mini, .del{opacity:1}
  .toolbar{flex-wrap:wrap}
  .search{flex:1 1 100%}
  .chips{flex:1 1 100%; max-width:none}
  .summary-note{text-align:left}
  .checks{grid-template-columns:1fr}
  .config-grid.config-grid-inline{grid-template-columns:minmax(0,1fr)}   /* forms are one column below 720px */
  .content code{overflow-wrap:anywhere}   /* a long path in a hint breaks instead of running past the page edge */
  .status-row{grid-template-columns:18px 26px minmax(0,1fr) auto auto 30px; grid-template-areas:"idx color name name name name" "busy busy busy count move del"; row-gap:8px}   /* the name gets the whole first line; Remove keeps its 30px track, so "Remove <status>?" grows leftwards over the row instead of widening it */
}
/* Phones: only the title row stays pinned. The actions become one row under the bar that scrolls
   away with the page, the subtitle is dropped, and a long title wraps to two lines (the full name is in its title). */
@media screen and (max-width:720px){
  .top{display:contents}
  .top-bar{flex:none; position:sticky; top:0; z-index:30; min-height:var(--top-h); padding:var(--sp-1) var(--sp-4); background:var(--page)}
  .top-title p{display:none}
  .top-title h1{display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; white-space:normal; overflow-wrap:break-word; line-height:1.3}   /* the H2 line-height: at 1.15 the clamp cut the descenders (g, j, p) */
  .top-acts{flex-wrap:wrap; justify-content:flex-end; margin-left:0; padding:var(--sp-3) var(--sp-4) 0}
}
@media print{
  .side, .top-acts, .toolbar, .mini, .del, .toast{display:none !important}
  .shell{display:block}
  .main-col{margin-left:0}
  .top{position:static; border-bottom:2px solid #000}
  .grid thead th{position:static; background:#e8eef0; color:#000}
  .table-wrap{max-height:none; overflow:visible}
  body{background:#fff}
}

/* directory: when filtering hides a group's first row, the first visible row leads the group */
.dir tr.row-lead td{border-top:1px solid var(--line-hard)}
.dir tr.row-lead .ghost-client{opacity:1; color:var(--ink); font-family:var(--serif); font-weight:600; font-size:var(--fs-body)}

/* availability dots inside filter chips */
.chip i.seg-busy{background:var(--busy)} .chip i.seg-available{background:var(--available)} .chip i.seg-on_leave{background:var(--leave)}
/* users table: its own widths, which now win over the shared field defaults (fix 10). Role holds the Administrator
   badge (120px with its padding) and takes the 12% the others leave at 1440, so the set adds up to 100% there, and it
   stays that wide when the section columns keep to their labels on a narrower screen. */
.users th.col-uname{width:20%} .users th.col-email{width:22%} .users th.col-role{width:128px} .users th.col-mod{width:7%} .users th.col-last{width:11%}
/* floors for what the cells hold, which grid.js keeps (the frame scrolls sideways instead): an Edit / View / None badge; a date and time */
.users th.col-mod{--col-floor:72px} .users th.col-last{--col-floor:132px}
.users th.col-uname{--name-floor:200px}   /* a name with its avatar and the YOU tag, whole */
.users .who .face{width:22px; height:22px; font-size:var(--fs-meta)}
.users tbody td:last-child{white-space:nowrap}
.users tbody td:nth-child(2){overflow:hidden; text-overflow:ellipsis}
.users thead th{letter-spacing:.03em}   /* the shared head padding: each label starts on its column's text */
.who{white-space:nowrap; min-width:0}
.who b{overflow:hidden; text-overflow:ellipsis}
@media (max-width:720px){
  .users .who{white-space:normal}
  .users .who b{overflow:visible; overflow-wrap:break-word}   /* a card has room for the whole name */
  .users tbody td.c, .users tbody td.c::before{text-align:left}   /* section labels and badges line up with the other fields */
}

/* Configurable forms and monthly planning */
.allocation-tabs,.page-tabs{display:flex;flex-wrap:wrap;gap:4px}   /* no baseline: the current tab keeps its underline */
/* The section tabs stay put while a long tab scrolls, like the list filter band. */
.page-tabs{position:sticky;top:var(--top-h);z-index:6;background:var(--page);margin:0 calc(var(--page-x) * -1) var(--stack);padding:4px var(--page-x) 0}
@media(max-width:900px){.page-tabs{margin-inline:-16px;padding-inline:16px}}
@media(max-width:720px){.page-tabs{position:static}}   /* phones pin only the title row: three wrapped rows of tabs covered 152px */
@media(min-width:721px){html:has(.page-tabs){scroll-padding-top:calc(var(--top-h) + var(--tabs-h, 36px) + var(--sp-2))}}   /* app.js measures --tabs-h */
.allocation-tabs a,.page-tabs a{font-size:var(--fs-sm);font-weight:600;padding:4px 8px;text-decoration:none;color:var(--ink-2);border-bottom:2px solid transparent}
.page-tabs a{min-height:var(--ctl-h);display:flex;align-items:center}
.allocation-tabs a[aria-current=page],.page-tabs a[aria-current=page]{color:var(--ink);border-color:var(--magenta);background:var(--surface)}
.allocation-toolbar{display:flex;align-items:center;justify-content:flex-start;flex-wrap:wrap;gap:8px 12px;font-size:var(--fs-sm)}
.sheet-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-left:auto}   /* the sheet settings, at the right of the month bar */
.allocation-toolbar form{display:flex;align-items:center;gap:8px}.allocation-toolbar select{min-width:10rem}
.allocation-sheet-info{color:var(--ink-2)}
@media(min-width:721px){.page-resources .allocation-table{max-height:min(72dvh,calc(100dvh - 205px));overflow:auto;position:relative;background:var(--surface)}}   /* phone cards keep the page scroll */
.allocation-table .grid thead th{top:0}
.allocation-table .grid tbody td{vertical-align:middle}   /* body text and the shared cell padding, like every grid */
.allocation-table .resource-actions .btn{min-height:var(--ctl-h-sm);padding:4px 8px;font-size:var(--fs-meta)}
.allocation-table progress{width:55px}
.page-resources .allocation-table table.grid{min-width:0;table-layout:auto}
@media(max-width:720px){.page-resources .allocation-table table.grid{min-width:0}.allocation-table .grid tbody td{padding:4px 0 4px calc(var(--card-label) + 8px)}.allocation-table .grid tbody td[colspan],.allocation-table .grid tbody td.resource-actions{padding-left:0}.allocation-toolbar{align-items:start}.allocation-sheet-info{width:100%}}
.resource-sidebar{margin:0 0 8px 16px;padding-left:8px;border-left:1px solid rgba(255,255,255,.2)}
.side-nav .resource-sidebar a{font-size:var(--fs-sm);min-height:30px;padding:4px 8px;gap:8px}
.resource-sidebar .ic{width:15px;height:15px}
@media(min-width:901px){.side-collapsed .resource-sidebar{margin-left:0;padding-left:0;border-left:0}.side-collapsed .side-nav .resource-sidebar a{padding:8px 0;gap:0}}
@media(max-width:900px){body:not(.nav-open) .resource-sidebar{margin-left:0;padding-left:0;border-left:0}body:not(.nav-open) .side-nav .resource-sidebar a{padding:8px 0;gap:0}}
/* The sheet keeps Role, Join date and Current team member at every width (fix 10): its popup does not show them, so
   hiding them below 1200px left no way to read them. Its frame scrolls sideways instead, and an allocation keeps its
   figure beside its bar while the table sits at its narrowest. */
.allocation-table .grid td:has(> progress){white-space:nowrap}
.resource-nav{display:flex;flex-wrap:wrap;gap:4px;border-bottom:1px solid var(--line-hard);padding-bottom:4px}
.resource-nav a{display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:6px;text-decoration:none;color:var(--ink-2);font-weight:600;font-size:var(--fs-caption)}
.resource-nav a[aria-current=page]{background:var(--band);color:white}
.resource-intro{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}.resource-intro h2{font-size:var(--fs-h2);margin:0 0 1px}.resource-intro p{color:var(--ink-2);margin:0;max-width:85ch;font-size:var(--fs-caption);line-height:1.45}
.resource-hub{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--stack)}.resource-hub .panel{margin-bottom:0}.resource-hub .panel{display:flex;flex-direction:column}.resource-hub .panel-body{display:flex;flex-direction:column;flex:1;gap:12px}.resource-hub p{flex:1;margin:0;color:var(--ink-2)}.resource-hub .btn{align-self:start}.resource-count{display:inline-block;margin:0;font-size:var(--fs-meta);line-height:16px;padding:0 8px;border-radius:9px;background:var(--surface-3);color:var(--ink-2)}
.resource-steps{list-style:none;counter-reset:step;display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:8px 16px;padding:8px 16px 12px;margin:0}
.resource-steps li{counter-increment:step;position:relative;padding:0 0 0 24px;font-size:var(--fs-md);line-height:18px}
.resource-steps li::before{content:counter(step);position:absolute;left:0;top:1px;width:16px;height:16px;border-radius:50%;background:var(--surface-3);color:var(--ink-2);font:600 var(--fs-meta)/16px var(--sans);text-align:center}
.resource-archive-list{background:var(--surface);border:1px solid var(--line-hard);border-radius:var(--r);overflow:hidden;margin-bottom:var(--stack)}
.resource-archive-list .panel{display:grid;grid-template-columns:190px minmax(0,1fr) auto;align-items:center;gap:12px;border:0;border-top:1px solid var(--line);border-radius:0;margin:0;padding:8px 8px 8px var(--pad-x)}
.resource-archive-list .panel:first-child{border-top:0}
.archive-actions{display:flex;align-items:center;gap:var(--sp-1);flex-wrap:wrap}   /* the same row actions as the sheets index: quiet icons 4px apart */
.archive-actions form{margin:0}
.resource-archive-list h2{font-size:var(--fs-body);margin:0}.resource-archive-list p{margin:0;font-size:var(--fs-sm);color:var(--ink-2)}
.resource-months{display:flex;flex-wrap:wrap;gap:8px}.resource-months a{padding:4px 8px;border:1px solid var(--line-hard);border-radius:5px;text-decoration:none}.resource-months [aria-current=page]{background:var(--band);color:white}
@media(max-width:800px){.resource-hub{grid-template-columns:1fr}.resource-archive-list .panel{align-items:start;flex-direction:column}.resource-nav a{padding:8px 8px}}
@media(max-width:720px){.resource-archive-list .panel{grid-template-columns:minmax(0,1fr)}}   /* beside the rail an archived month's actions go under its name */
.amc-filters{flex-wrap:wrap}
.amc-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.amc-card{display:grid;grid-template-columns:auto 1fr;gap:0 8px;align-items:center;padding:4px 12px;border:1px solid var(--line-hard);border-radius:var(--r);background:var(--surface);color:var(--ink);text-decoration:none}
.amc-card strong{grid-row:span 2;font-size:var(--fs-h2);line-height:1.2;align-self:center}
.amc-card span{font-weight:600;font-size:var(--fs-caption);line-height:1.3}
.amc-card small{color:var(--ink-2);font-size:var(--fs-meta);line-height:1.3}
.amc-card.selected{border-color:var(--magenta);box-shadow:inset 0 0 0 1px var(--magenta)}
.amc-grid{table-layout:fixed}
.amc-grid th.col-amc-project{width:26%}.amc-grid th.col-amc-type{width:116px}.amc-grid th.col-amc-from,.amc-grid th.col-amc-until{width:112px}
.amc-grid th.col-amc-status{width:152px}.amc-grid th.col-amc-notes{width:36.5%}.amc-grid th.col-amc-action{width:116px}
.amc-grid tbody td{padding:var(--cell-y) 8px;vertical-align:middle}
.amc-grid td.row-actions,.amc-grid td:has(select){padding-block:1px}
.amc-grid td[data-l="Project"]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}   /* the row opens the full record */
.amc-grid .band td{position:sticky; top:calc(var(--stick) + var(--head-h)); z-index:4; padding:4px 8px}
.amc-grid .btn{padding:4px 8px;min-height:28px}
.amc-note summary{display:flex;align-items:flex-start;gap:8px;cursor:pointer;list-style:none}
.amc-note summary::-webkit-details-marker{display:none}
.amc-note summary span{flex:1;min-width:0;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow:hidden;line-height:1.35;white-space:pre-wrap}
.amc-note summary:hover span{text-decoration:underline;text-underline-offset:3px}   /* it opens the note, not the record */
.amc-note[open] summary span{display:block}
.amc-note summary::after{content:"";flex:none;width:0;height:0;margin-top:8px;border:4px solid transparent;border-top-color:var(--ink-3);transition:transform .15s}
.amc-note[open] summary::after{transform:rotate(180deg)}
.amc-note div{display:none}
.allocation-details[hidden]{display:none!important}
.allocation-breakdown{list-style:none;padding:0;margin:0;max-width:850px}
.allocation-breakdown li{display:flex;justify-content:space-between;gap:16px;padding:8px 0;border-bottom:1px solid var(--line)}
.allocation-breakdown strong{white-space:nowrap}
.resource-actions{white-space:normal}
.resource-actions .btn{min-height:var(--ctl-h-sm);padding:4px 8px;font-size:var(--fs-caption)}
.allocation-editor{scroll-margin-top:var(--sp-1)}   /* html's scroll-padding already clears the pinned header */
.allocation-heading{display:flex;align-items:start;justify-content:space-between;gap:16px;position:sticky;top:var(--stick);background:var(--surface);z-index:2;padding:var(--pad-y) var(--pad-x) 8px;border-bottom:1px solid var(--line)}
.allocation-heading h2{font-size:var(--fs-h2);margin:0 0 var(--sp-1)}
.allocation-heading p{font-size:var(--fs-caption)}
#allocationForm .panel-actions{position:sticky;bottom:0;z-index:2;margin:0 calc(var(--pad-x) * -1);padding:8px var(--pad-x);background:var(--surface);border-top:1px solid var(--line)}
.allocation-total{display:grid;text-align:right;white-space:nowrap;min-width:145px}
.allocation-total span,.allocation-total small{font-size:var(--fs-caption);color:var(--ink-2)}
.allocation-total strong{font-size:var(--fs-h2);line-height:1.2;color:var(--success)}
.allocation-total.over-capacity strong,.allocation-total.over-capacity small,.allocation-error{color:var(--danger)}
@media(min-width:1100px){.allocation-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:24px}.allocation-list-head{grid-column:1/-1}}
.allocation-list-head,.allocation-project{display:grid;grid-template-columns:minmax(0,1fr) 112px;gap:8px;align-items:center;padding:4px 12px;border-bottom:1px solid var(--line)}   /* 112px holds "Unassigned" beside the number arrows */
/* Tab keeps an allocation clear of the sticky name and total above it and of the Save bar below it */
#allocationForm .allocation-project input{scroll-margin-block:calc(var(--sp-6) * 3)}
.popup-page #allocationForm .allocation-project input{scroll-margin-top:0}
.allocation-list-head{position:sticky;top:0;z-index:1;background:var(--surface-2)}
.allocation-project > span{display:flex;align-items:baseline;gap:8px;min-width:0}
.allocation-list-head{background:var(--surface-2);font-size:var(--fs-caption);font-weight:600}
.allocation-project small{display:inline;flex:0 0 auto;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink-2);font-size:var(--fs-caption);line-height:1.35}
.allocation-project b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--fs-caption);line-height:1.35;font-weight:600}
.allocation-project input{width:100%;min-width:0;min-height:var(--ctl-h);height:var(--ctl-h);padding:4px 8px;font-size:var(--fs-md);text-align:right}
@media(max-width:720px){.amc-cards{grid-template-columns:1fr}.amc-grid tbody td{padding-left:calc(var(--card-label) + 8px)}.amc-grid .band td{padding-left:0}.allocation-heading{position:static}.allocation-list-head,.allocation-project{grid-template-columns:minmax(0,1fr) 112px;gap:8px;padding:8px 0}.grid tbody td.resource-actions{padding-left:0}}
/* phones: the client sits over the project and both wrap, instead of ending in an ellipsis a touch screen cannot expand */
@media(max-width:720px){.allocation-project > span{flex-direction:column;align-items:flex-start;gap:0}.allocation-project small,.allocation-project b{max-width:none;overflow:visible;white-space:normal;overflow-wrap:break-word}}
.config-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 16px; margin:0 0 var(--stack); }
.config-grid .field { min-width:0; }
.config-grid > .field-row-start { grid-column-start:1; }   /* starts a new row (Change password: the new pair under the current one) */
.config-grid select[multiple] { min-height:110px; }
.config-grid dd { margin:4px 0 0; font-size:var(--fs-body); white-space:pre-wrap; overflow-wrap:anywhere; }
.panel-body > dl.config-grid:last-child { margin-bottom:0; }
.config-grid dt { color:var(--ink-2); font-size:var(--fs-sm); font-weight:600; }   /* --muted was never defined: every dt inherited --ink */
/* A settings row (a portfolio, a field) uses the shared field: its label above the box with a 4px gap, so every row's
   name box starts on one edge. The number boxes keep fixed widths; the checks and Save sit on the boxes' line. */
.settings-row { display:flex; flex-wrap:wrap; align-items:flex-end; gap:8px 12px; padding:8px 0; border-bottom:1px solid var(--line); }
.settings-row .field > span { font-size:var(--fs-caption); }
.settings-row input:not([type=checkbox]):not([type=radio]),.settings-row select { min-height:var(--ctl-h); }
.settings-row .field { flex:1 1 240px; min-width:0; }
.settings-row .field:has(input[name=sort_order]) { flex:0 0 88px; }
.settings-row .field:has(input[name=parent_id]) { flex:0 0 140px; }
.settings-row .field:has(textarea) { flex:1 1 100%; }
.settings-row > .btn { flex:none; }
.settings-row > .btn:first-of-type { margin-left:auto; }   /* Save keeps its own width at the row's right end, also when the row wraps */
.field-section { border:1px solid var(--line); padding:12px; border-radius:var(--r); }
.field-section summary, details.panel>summary { cursor:pointer; font-weight:600; padding:8px 8px; }
.field-section summary { border-radius:6px; }
.field-section summary:hover { background:var(--surface-2); }
.toolbar .field { margin:0; min-width:150px; }
progress { accent-color:var(--accent); width:90px; height:10px; vertical-align:middle; }
.grid td { overflow-wrap:break-word; }   /* a long token (an email) still breaks when it cannot fit; "anywhere" also let a badge shrink below its word ("Ed|it") */
.grid td.col-remarks { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; white-space:normal; }
.grid .sub:empty { display:none; }
/* Column widths: under table-layout:fixed an unhinted table splits evenly, so Name wrapped on every row
   while four near-empty columns held a third of the table. These are each field's defaults wherever it is listed.
   They weigh nothing (:where), so a page's own table overrides them with any rule of its own (fix 10: the Users
   table's Email and Role widths never applied). Name has no width and takes what is left; grid.js keeps it at least
   128px wide, or --name-floor (a share of the frame) where a list asks for more, and grows the table so the frame
   scrolls sideways rather than squeeze it. */
:where(.grid th.col-project_code){width:96px} :where(.grid th.col-client_id){width:15%} :where(.grid th.col-portfolio){width:11%}
:where(.grid th.col-record_type){width:112px} :where(.grid th.col-status_key){width:172px} :where(.grid th.col-since){width:calc(96px + 2 * var(--cell-x))}
:where(.grid th.col-since_source){width:150px} :where(.grid th.col-progress){width:100px} :where(.grid th.col-openproject_id){width:96px}
:where(.grid th.col-start_date,.grid th.col-target_date,.grid th.col-join_date){width:92px}
/* Role takes the room short names do not need; Current team member holds one word, so it is as wide as its label. */
:where(.grid th.col-role){width:22%} :where(.grid th.col-email){width:20%} :where(.grid th.col-availability){width:116px} :where(.grid th.col-is_active){width:100px}
.grid td.col-project_code,.grid td.col-record_type,.grid td.col-since,.grid td.col-progress,
.grid td.col-start_date,.grid td.col-target_date,.grid td.col-join_date,.grid td.col-openproject_id{white-space:nowrap}
/* Chips and short labels never break inside: access and state badges, the sheet's month, AMC dates ("To confirm"). */
.grid .acc,.grid td.col-month,.amc-grid td.col-amc-from,.amc-grid td.col-amc-until{white-space:nowrap}
/* Text columns ellipsize on one line instead of wrapping the whole row to two: the cell carries a title
   attribute and the row opens the full record, so nothing is lost. */
.grid td.col-name,.grid td.col-client_id,.grid td.col-portfolio,.grid td.col-role,.grid td.col-email,
.grid td.col-contact_person,.grid td.col-manager{white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
/* Actions held an equal 1/n share - 309px on clients - for at most three 28px buttons. */
.page-clients .grid thead th:last-child{width:148px} .page-clients .grid thead th:nth-last-child(2){width:24%}
.page-projects .grid thead th:last-child{width:116px} .page-projects .grid thead th:nth-last-child(2){width:88px}
.page-resources .table-wrap:not(.allocation-table) .grid thead th:last-child{width:116px}
.page-resources .table-wrap:not(.allocation-table) .grid thead th.col-act{width:calc(var(--confirm-w) + 2 * var(--cell-x))}   /* the sheets index: its armed "Delete sheet?" fills the cell */
/* Projects: long names beside many fixed columns, so Name keeps at least a quarter of the frame (fix 10), and the
   least-filled columns give way one by one, measured by the frame, before it falls below that (which columns belong in
   the list by default is D8). Both OpenProject columns are empty until a sync runs and cost 348px with their labels,
   so they show from a 2490px frame; Progress from 1780px, Project ID from 1550px and Deadline, which the deadline
   cards filter by, from 1330px. The record popup and the export keep every field. Phone cards (720px and below) have
   no frame to measure: they keep every field but the two OpenProject ones, as before. */
.page-projects .grid th.col-name{--name-floor:25%}
@container frame (max-width:2489px){.page-projects .grid .col-openproject_id,.page-projects .grid tbody td:nth-last-child(2),.page-projects .grid thead th:nth-last-child(2){display:none}}
@media(max-width:720px){.page-projects .grid .col-openproject_id,.page-projects .grid tbody td:nth-last-child(2){display:none}}
@container frame (max-width:1779px){.page-projects .grid .col-progress{display:none}}
@container frame (max-width:1549px){.page-projects .grid .col-project_code{display:none}}
@container frame (max-width:1329px){.page-projects .grid .col-target_date{display:none}}
/* Below a 1135px frame even the remaining columns and that quarter do not fit, so the frame scrolls anyway: Client and
   Portfolio keep the widths they have at 1440 instead of shrinking with the table. */
@container frame (max-width:1134px){.page-projects .grid th.col-client_id{width:200px} .page-projects .grid th.col-portfolio{width:148px}}
@media(max-width:720px) { .config-grid { grid-template-columns:1fr; } .settings-row .field:first-of-type { flex-basis:100%; } }   /* forms are one column; a settings row's name box takes a line of its own */
/* Compact search controls shared by directory and AMC lists. */
.toolbar.live-filters { position:sticky; top:var(--top-h); z-index:6; gap:8px 8px; align-items:center; flex-wrap:wrap;
  margin:0 calc(var(--page-x) * -1) var(--stack); padding:4px var(--page-x); background:var(--page); }
@media(max-width:900px){ .toolbar.live-filters { margin-inline:-16px; padding-inline:16px; } }
/* Below 1100px the band can wrap to several rows: let it scroll away rather than pin that height. */
@media(min-width:1101px){ html:has(.toolbar.live-filters){scroll-padding-top:calc(var(--top-h) + var(--filter-h) + var(--sp-2))} }   /* focus lands below the pinned band */
@media(max-width:1100px){ body:has(.toolbar.live-filters){--stick:var(--top-h)}
  .toolbar.live-filters { position:static; margin:0 0 var(--stack); padding:0; box-shadow:none; } }
.toolbar.live-filters .field { flex:0 1 200px; min-width:150px; flex-direction:row; align-items:center; gap:8px; }
.toolbar.live-filters .field:first-child { flex:1 1 210px; max-width:300px; }
.toolbar.live-filters .field > span { flex:none; font-size:var(--fs-meta); font-weight:600; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-3); }
.toolbar.live-filters .field:first-child > span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }   /* the placeholder already says what the box searches */
.toolbar.live-filters input,.toolbar.live-filters select { flex:1 1 auto; min-width:0; width:100%; min-height:var(--ctl-h); height:var(--ctl-h); padding:4px 8px; font-size:var(--fs-caption); }
.toolbar.live-filters > a,.toolbar.live-filters [data-live-count] { font-size:var(--fs-caption); margin-bottom:0; white-space:nowrap; }
.toolbar.live-filters .filter-reset { display:inline-flex; align-items:center; min-height:var(--ctl-h); line-height:var(--lh-body); }   /* Reset filters and Expand all: 32px, like the controls beside them */
.toolbar.live-filters [data-live-count] { color:var(--ink-3); font-variant-numeric:tabular-nums; }
.live-filter-error { color:var(--danger); font-size:var(--fs-body); }
.live-filter-error:empty { display:none; }   /* an empty span still costs an 8px gap: the count stops short of the edge, or the span takes a row of its own */

.resource-dialog { width:min(720px,calc(100vw - 28px)); max-height:90dvh; padding:0; border:1px solid var(--line-hard); border-radius:14px; color:var(--ink); background:var(--surface); box-shadow:0 24px 80px #010f3140; }
.resource-dialog::backdrop { background:#010f3180; }
.resource-dialog > form { display:flex; flex-direction:column; max-height:90dvh; }
.resource-dialog-head { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; }
.resource-dialog-head h2 { margin:0; font-size:var(--fs-h2); }
.resource-dialog-head p { margin:4px 0 0; color:var(--ink-2); font-size:var(--fs-caption); }
.resource-dialog-head .icon-btn { padding:0; font-size:var(--fs-h2); line-height:1; }   /* a text close needs a line box, unlike the icon buttons */
.resource-dialog-body { padding:12px 16px; overflow:auto; min-height:0; }
.resource-dialog .config-grid { margin-bottom:0; }
.resource-dialog .config-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 12px; }
.resource-dialog .field { margin:0; gap:4px; }
.resource-dialog .field > span { font-size:var(--fs-caption); }
.resource-dialog .field textarea { min-height:54px; padding:8px 8px; font-size:var(--fs-body); }
.resource-dialog-actions { display:flex; justify-content:flex-end; gap:8px; padding:8px 16px; border-top:1px solid var(--line); }
.resource-dialog-actions .btn { padding:4px 12px; font-size:var(--fs-md); }
.resource-project-picker { grid-column:1/-1; min-width:0; margin:0; padding:0; border:0; }
.resource-project-picker legend { padding:0; font-size:var(--fs-caption); font-weight:600; margin-bottom:var(--sp-1); }
.project-picker-tools { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.project-picker-tools input { flex:1; min-width:0; min-height:var(--field-h); padding:var(--sp-1) var(--cell-x); font-size:var(--fs-body); }
.project-picker-tools span { white-space:nowrap; font-size:var(--fs-caption); color:var(--ink-2); }
.resource-project-cards { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; max-height:min(46vh,320px); overflow:auto; padding:2px; }
.resource-project-card { display:flex; align-items:flex-start; gap:8px; padding:8px; border:1px solid var(--line-hard); border-radius:9px; cursor:pointer; background:var(--surface); }
.resource-project-card[hidden] { display:none; }
.resource-project-card:hover { border-color:var(--accent); }
.resource-project-card:has(:checked) { background:var(--accent-soft); border-color:var(--accent); }
.resource-project-card:focus-within { outline:2px solid var(--accent); outline-offset:1px; }
.resource-project-card input[type=checkbox] { width:14px; height:14px; min-height:14px; flex:none; margin:2px 0 0; accent-color:var(--accent); }
.resource-project-card span { min-width:0; }
.resource-project-card strong { display:block; font-size:var(--fs-caption); line-height:1.3; overflow-wrap:anywhere; }
.resource-project-card small { display:block; color:var(--ink-2); font-size:var(--fs-caption); line-height:1.3; margin-top:4px; }
.project-picker-empty { color:var(--ink-2); font-size:var(--fs-caption); }
body:has(.resource-dialog[open]) { overflow:hidden; }
/* Compact module lists and shared details/editor popup. */
.grid tr[data-view-url],.grid tr[data-href] { cursor:pointer; }
.grid tr[data-href]:hover td { background:var(--surface-2); }
@media (min-width:721px){ .grid tr[data-href]:hover td:first-child { box-shadow:inset 3px 0 0 0 var(--magenta); } }   /* a phone card carries its own bar (below) */
.grid td.row-actions form { display:inline; }
.grid tr[data-view-url]:hover td { background:var(--surface-2); }
@media (min-width:721px){ .grid tr:is([data-view-url], .clickable):hover td:first-child { box-shadow:inset 3px 0 0 0 var(--magenta); } }   /* the row bar sits on the first cell */
/* Phone cards: the hover bar and the selected state belong to the card. Its first cell is the checkbox in the top right corner. */
@media (max-width:720px){
  .grid tbody tr:is([data-view-url], [data-href], .clickable):hover { box-shadow:inset 3px 0 0 var(--magenta); }
  .grid tbody tr.is-selected { background:var(--row-selected); box-shadow:inset 3px 0 0 var(--magenta); }
}
/* A control in a cell draws its focus ring inside itself: an outer ring ran under the sticky head, under the next row's
   cells and past the frame's edge. The armed delete keeps its outer ring (magenta inside red would not show), and the
   focused cell rises above the next row so that ring stays whole. */
.grid td :is(.icon-btn, .btn, .grid-select, .st-select):focus-visible:not([data-armed]) { outline-offset:-2px; }
.grid tbody td:focus-within { z-index:1; }
.grid td:has(> .grid-select, > .st-wrap) { overflow:visible; }   /* an option cell never clips its control's ring */
/* Row keyboard focus, one rule for every clickable row kind. The cells are opaque and positioned, so an outline on the <tr>
   is painted over; the ring is drawn on the cells instead, in the same magenta as every other focus ring. At <=720px the rows
   are stacked cards with transparent cells, so the card gets a magenta ring drawn inside its edge: the global outline sits
   2px outside the card and is clipped where the card fills a scroll container (the allocation sheet's .table-wrap). */
@media (min-width:721px){
  .grid :is(tr[data-view-url], tr[data-href], tr.clickable):focus-visible { outline:none; }
  .grid :is(tr[data-view-url], tr[data-href], tr.clickable):focus-visible td { background:#FCEAF4; box-shadow:inset 0 2px var(--magenta), inset 0 -2px var(--magenta); }
  .grid :is(tr[data-view-url], tr[data-href], tr.clickable):focus-visible td:first-child { box-shadow:inset 2px 0 var(--magenta), inset 0 2px var(--magenta), inset 0 -2px var(--magenta); }
  .grid :is(tr[data-view-url], tr[data-href], tr.clickable):focus-visible td:last-child { box-shadow:inset -2px 0 var(--magenta), inset 0 2px var(--magenta), inset 0 -2px var(--magenta); }
}
@media (max-width:720px){
  .grid :is(tr[data-view-url], tr[data-href], tr.clickable):focus-visible { outline:2px solid var(--magenta); outline-offset:-2px; }
}
.grid .row-actions,.grid .resource-actions { white-space:nowrap; }
.amc-card small { font-size:var(--fs-caption); }
.record-popup { width:min(840px,calc(100vw - 28px)); padding:0; border:1px solid var(--line-hard); border-radius:12px; background:var(--surface); color:var(--ink); box-shadow:0 24px 80px #010f3140; overflow:hidden; }
.record-popup::backdrop { background:#010f3180; }
.record-popup > header { display:flex; align-items:center; justify-content:space-between; padding:8px 12px; font-weight:600; }
.record-popup > header h2 { margin:0; min-width:0; font:600 var(--fs-h2)/1.3 var(--serif); color:var(--ink); overflow-wrap:break-word; }   /* a dialog title (design system §2) */
.record-popup > header button { padding:0; font-size:var(--fs-h2); line-height:1; }
.record-popup iframe { display:block; width:100%; height:min(72dvh,680px); border:0; background:var(--surface); }
body:has(.record-popup[open]) { overflow:hidden; }
.popup-page .side,.popup-page .top,.popup-page .foot,.popup-page .toolbar,.popup-page .resource-intro,.popup-page .table-wrap,.popup-page .amc-cards,.popup-page .kpis,.popup-page .skip,.popup-page .resource-tabs,.popup-page .allocation-toolbar { display:none!important; }
.popup-page .shell { display:block; padding:0; margin:0; min-height:0; }
.popup-page .main-col { margin:0; }
body.popup-page { background:var(--surface); }
.popup-page .content { padding:0; }
.popup-page .panel { border:0; border-radius:0; margin:0; background:transparent; }
.popup-page .panel + .panel { border-top:1px solid var(--line); }
.popup-page .panel-hd,.popup-page .panel-body { padding:8px var(--pad-x); }
/* The dialog header carries the record name, so the page heading underneath it is a duplicate. */
.popup-page .panel-hd, .popup-page .panel-body > h2 { display:none; }
.popup-page .panel-hd.allocation-heading { display:flex; }   /* except this one: it carries the total */
.popup-page .panel-actions { position:sticky; bottom:0; background:var(--surface); margin:8px calc(var(--pad-x) * -1) 0; padding:8px var(--pad-x); border-top:1px solid var(--line); }
.popup-page p.muted { margin:8px 0; font-size:var(--fs-sm); }
.popup-page .config-grid { gap:8px 12px; margin-bottom:12px; }
.popup-page .config-grid .field:has(textarea) { grid-column:1/-1; }
.popup-page .config-grid textarea { min-height:64px; }
.popup-page .allocation-heading { position:static; }
.popup-page .allocation-list-head { top:0; }
.popup-page .field { margin:0; gap:4px; }
.popup-page .config-grid dd { margin:4px 0 8px; }
.popup-page .allocation-tabs { display:none; }
@media(max-width:720px) { .resource-dialog .config-grid { grid-template-columns:1fr; } }   /* forms are one column below 720px */
@media(max-width:600px) { .resource-project-cards { grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* Opt-out: set data-density="comfortable" on <html> to restore the roomier scale. */
:root[data-density=comfortable]{--row-h:38px; --ctl-h:36px; --field-h:38px; --pad-y:14px; --stack:16px; --page-y:16px}

/* ---------- row selection, row delete, the selection bar and the confirm dialog ---------- */
.grid th.col-select, .grid td.col-select { width:36px; padding-inline:0; text-align:center; }
.grid td.col-select { padding-block:1px; }   /* the 28px checkbox target fills the row, like the action buttons */
.grid th.col-select input, .row-check input { width:15px; height:15px; margin:0; accent-color:var(--band); cursor:pointer; vertical-align:middle; }
.row-check { display:flex; align-items:center; justify-content:center; min-height:var(--ctl-h-sm); cursor:pointer; }
.grid tbody tr.is-selected td { background:var(--row-selected); }
.icon-btn-danger:hover:not([disabled]) { border-color:var(--danger); color:var(--danger); }
.btn-danger { background:var(--danger); color:#fff; border-color:var(--danger); }
.btn-danger:hover { filter:brightness(1.08); }
/* One floating bar while rows are selected, clear of the sticky header stack. */
.selection-bar { position:fixed; left:50%; bottom:16px; transform:translateX(-50%); z-index:190; display:flex; align-items:center; flex-wrap:wrap; gap:8px;
  max-width:calc(100vw - 24px); padding:8px 8px 8px 16px; background:var(--band); color:#fff; border:1px solid var(--magenta); border-radius:10px;
  box-shadow:0 12px 32px rgba(0,0,0,.25); font-size:var(--fs-md); }
.selection-bar .btn-ghost { background:transparent; color:#fff; border-color:rgba(255,255,255,.4); }
.selection-bar .btn-ghost:hover { border-color:#fff; color:#fff; }
/* While rows are selected, the page keeps room for the bar (grid.js measures it into --bar-h): the footer and the frame's
   last row scroll clear of it (fitFrame subtracts the taller footer), and a toast shows above it. */
.has-selection .foot { padding-bottom:calc(var(--bar-h, 48px) + var(--sp-6)); }
.has-selection .toast { bottom:calc(16px + var(--bar-h, 48px) + var(--sp-2)); }
.confirm-dlg { width:min(440px, calc(100vw - 24px)); }
.confirm-dlg .dlg-bd p { margin:0; line-height:1.5; }
@media (max-width:720px) {
  .grid thead th.col-select { display:none; }
  .grid tbody tr { position:relative; }
  .grid tbody td.col-select { position:absolute; top:4px; right:6px; width:auto; min-height:0; padding:0 !important; z-index:1; }   /* above the name cell, which it sits over: a tap reaches it */
  .grid tbody td.col-select + td { padding-right:var(--sp-6); }   /* the card's first line keeps clear of the checkbox */
  /* a card has no hover title, so its values wrap instead of ending in an ellipsis (the desktop grid keeps one line) */
  .grid tbody td:is(.col-name, .col-client_id, .col-portfolio, .col-role, .col-email, .col-contact_person, .col-manager),
  .amc-grid tbody td.col-amc-project { white-space:normal; overflow:visible; text-overflow:clip; }
  .grid tbody td.col-select::before { content:none; }
}

/* ---------- record views: a visual header card, then focused sections ---------- */
.record-card { background:var(--surface); border:1px solid var(--line-hard); border-radius:var(--r); overflow:hidden; margin-bottom:var(--stack); }
.record-hero { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:12px 16px; padding:16px var(--pad-x);
  background:linear-gradient(120deg,#F4EEFF 0%,#FCEFF7 55%,var(--surface) 100%); border-bottom:1px solid var(--line); }
.hero-media { line-height:0; }
.avatar-lg, .avatar-md, .avatar-sm { flex:none; border-radius:50%; object-fit:cover; background:var(--surface-3); }
.avatar-lg { width:72px; height:72px; box-shadow:0 0 0 3px #fff, 0 0 0 4px var(--line-hard); }
.avatar-md { width:48px; height:48px; box-shadow:0 0 0 2px #fff, 0 0 0 3px var(--line-hard); }
.avatar-sm { width:32px; height:32px; }
.avatar-initials, .avatar-tile { display:grid; place-items:center; background:var(--grad); color:#fff; font:600 var(--fs-h1)/1 var(--sans); letter-spacing:.02em; }
.avatar-md.avatar-initials { font-size:var(--fs-h2); }
.avatar-sm.avatar-initials { font-size:var(--fs-caption); }
.avatar-tile { border-radius:16px; }
.avatar-tile .ic { width:32px; height:32px; }
.avatar-tile-client { background:linear-gradient(135deg,var(--band-2),var(--band-3)); }
.hero-main { min-width:0; }
.hero-kicker { margin:0; font:600 var(--fs-meta)/1.2 var(--sans); letter-spacing:.08em; text-transform:uppercase; color:#C81B7A; }
.hero-title { margin:var(--sp-1) 0; font:600 var(--fs-h2)/1.2 var(--serif); color:var(--ink); overflow-wrap:break-word; }
body:not(.popup-page) .hero-title, body:not(.popup-page) .hero-edit { display:none; }   /* the page's own title bar says both */
.hero-meta { margin:0; color:var(--ink-2); font-size:var(--fs-sm); overflow-wrap:break-word; }
.hero-meta a { color:inherit; }
.hero-meta a:hover { color:var(--ink); }
.hero-badges { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.hero-side { display:flex; flex-direction:column; align-items:center; gap:8px; }
.hero-stat { display:grid; justify-items:center; gap:4px; text-align:center; min-width:88px; }
.hero-stat small { font-size:var(--fs-meta); color:var(--ink-2); max-width:110px; line-height:1.25; }
.stat-num { font:600 var(--fs-h2)/1.1 var(--sans); color:var(--ink); letter-spacing:-.02em; }
/* a percentage ring drawn with a conic gradient, so it needs no script or image */
.ring { --p:0; position:relative; display:grid; place-items:center; width:64px; height:64px; border-radius:50%;
  background:conic-gradient(#7C3CF2 0, #D91B8F calc(var(--p) * 1%), var(--surface-3) 0); }
.ring::before { content:""; position:absolute; inset:7px; border-radius:50%; background:var(--surface); }
.ring b { position:relative; font:600 var(--fs-body)/1 var(--sans); color:var(--ink); }
.record-section { padding:12px var(--pad-x) 12px; border-bottom:1px solid var(--line); }
.record-section:last-child { border-bottom:0; }
.record-section h3 { display:flex; align-items:center; gap:8px; margin:0 0 8px; font:600 var(--fs-meta)/1.2 var(--sans); letter-spacing:.06em; text-transform:uppercase; color:var(--ink-2); }
.record-section .config-grid { margin-bottom:0; }
.record-notes { margin:0; white-space:normal; line-height:1.55; }
/* projects as chips: status colour dot, name, client or status, and this month's share */
.project-chips { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:8px; }
.project-chips li { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:0 8px; padding:8px 8px; border:1px solid var(--line); border-left:3px solid var(--c); border-radius:8px; background:var(--surface); }
.project-chips i { width:8px; height:8px; border-radius:50%; background:var(--c); }
.project-chips span { min-width:0; display:grid; }
.project-chips b { font-weight:600; font-size:var(--fs-md); overflow-wrap:break-word; }   /* a chip grows with its text: the project status was the part cut off */
.project-chips small { font-size:var(--fs-meta); color:var(--ink-2); overflow-wrap:break-word; }
.project-chips em { font:600 var(--fs-sm)/1 var(--mono); font-style:normal; color:var(--ink); background:var(--surface-3); border-radius:10px; padding:4px 8px; }
.team-list { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:8px 12px; }
.team-list li { display:flex; align-items:center; gap:8px; min-width:0; }
.team-list span { display:grid; min-width:0; }
.team-list b { font-weight:600; font-size:var(--fs-md); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.team-list small { font-size:var(--fs-meta); color:var(--ink-2); }
.timeline { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:0; position:relative; }
.timeline::before { content:""; position:absolute; left:6px; right:6px; top:6px; height:2px; background:var(--line-hard); }
.timeline li { position:relative; display:grid; gap:var(--sp-1); padding-top:16px; }
.timeline li::before { content:""; position:absolute; top:1px; left:0; width:12px; height:12px; border-radius:50%; background:var(--surface); border:2px solid #7C3CF2; }
.timeline small { font-size:var(--fs-meta); color:var(--ink-2); text-transform:uppercase; letter-spacing:.06em; font-weight:600; }
.timeline b { font-weight:600; font-size:var(--fs-md); }
.timeline li.is-late::before { border-color:var(--danger); background:var(--danger-soft); }
.timeline li.is-late b { color:var(--danger); }
.validity-bar { height:10px; border-radius:5px; background:var(--surface-3); overflow:hidden; }
.validity-bar span { display:block; height:100%; background:var(--grad); border-radius:5px; }
.validity-ends { display:flex; justify-content:space-between; gap:12px; margin-top:8px; }
.validity-ends span { display:grid; gap:2px; }
.validity-ends span:last-child { text-align:right; }
.validity-ends small { font-size:var(--fs-meta); color:var(--ink-2); text-transform:uppercase; letter-spacing:.06em; font-weight:600; }
.status-stack { display:flex; gap:2px; height:10px; margin-bottom:8px; border-radius:5px; overflow:hidden; }
.status-stack span { display:block; min-width:6px; }
.status-legend { display:flex; flex-wrap:wrap; gap:4px 12px; margin-bottom:8px; font-size:var(--fs-sm); color:var(--ink-2); }
.status-legend span { display:inline-flex; align-items:center; gap:8px; }
.status-legend i { width:8px; height:8px; border-radius:50%; }
.status-legend b { font:600 var(--fs-sm)/1 var(--mono); color:var(--ink); }
/* inside the popup the card is the whole page */
.popup-page .record-card { border:0; border-radius:0; margin:0; }
.popup-page .danger-zone { margin:0; border:0; border-top:1px solid var(--danger-border); border-radius:0; background:#FFF7F6; }   /* .popup-page .panel resets panels to transparent */
/* record details read in two columns inside the popup, whose frame is narrower than the 900px single-column rule */
.popup-page .record-section .config-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 16px; }
.record-section .config-grid dd { margin:var(--sp-1) 0 0; }
@media (max-width:560px) { .popup-page .record-section .config-grid { grid-template-columns:1fr; } }
@media (max-width:720px) {
  .record-hero { grid-template-columns:auto minmax(0,1fr); }
  .hero-side { grid-column:1 / -1; flex-direction:row; justify-content:space-between; width:100%; }
  .hero-stat { justify-items:start; text-align:left; grid-auto-flow:column; align-items:center; gap:8px; }
  .avatar-lg { width:56px; height:56px; }
  .timeline { grid-template-columns:1fr; gap:8px; }
  .timeline::before { left:5px; right:auto; top:6px; bottom:6px; width:2px; height:auto; }
  .timeline li { padding:0 0 0 24px; }
}

/* ---------- the photo control in the resource form ---------- */
.photo-field { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; grid-column:1 / -1; margin-bottom:var(--stack); }
.photo-field .field { flex:1 1 240px; }
.photo-field input[type=file] { min-height:var(--field-h); padding:4px; font-size:var(--fs-sm); background:var(--surface-2); }
.photo-preview { line-height:0; }

/* ---------- every dialog: a dimmed, blurred overlay and a short entrance ---------- */
dialog::backdrop { background:rgba(1,15,49,.5); -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); }
dialog[open] { animation:dialog-in .18s ease-out; }
dialog[open]::backdrop { animation:backdrop-in .18s ease-out; }
@keyframes dialog-in { from { opacity:0; transform:translateY(10px) scale(.98); } to { opacity:1; transform:none; } }
@keyframes backdrop-in { from { opacity:0; } to { opacity:1; } }

/* ---------- enterprise design system: states, motion and loading ---------- */
/* One transition for every interactive element; the global reduced-motion rule switches it off. */
.icon-btn, .chip, .grid-select, .st-select, .side-nav a, .side-link, .page-tabs a, .allocation-tabs a, .resource-nav a,
input, select, textarea, .grid tbody td, a.kpi, .amc-card, .x, .side-toggle, .side-group-toggle, .band-toggle, .filter-reset, .check,
.seg span, .field-section summary, .hero-meta a {
  transition:background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), translate var(--dur-fast) var(--ease);
}
/* pressed */
.btn:active:not([disabled]), .icon-btn:active:not([disabled]), .chip:active { transform:translateY(1px); }
/* the same 1px press on the other buttons; the individual translate property keeps a transform they already have
   (the Resources chevron is centred with translateY(-50%)) */
:is(.x, .side-toggle, .side-group-toggle, button.side-link, button.filter-reset, .band-toggle, .amc-note summary, .field-section summary):active { translate:0 1px; }
/* hover: quiet controls step their background or border; tabs and nav step their colour */
.icon-btn:hover:not([disabled]) { background:var(--surface-2); }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not(:disabled):hover, select:not(.st-select):not(.grid-select):not(:disabled):hover, textarea:not(:disabled):hover { border-color:var(--ink-3); }
.page-tabs a:hover, .allocation-tabs a:hover { color:var(--ink); border-bottom-color:var(--line-control); }
.page-tabs a[aria-current=page]:hover, .allocation-tabs a[aria-current=page]:hover { border-bottom-color:var(--magenta); }
.amc-card:hover { border-color:var(--ink-3); }
.st-select:not(:disabled):hover { background-color:color-mix(in srgb, var(--c) 25%, #fff); box-shadow:inset 0 0 0 1px var(--c); }   /* the status chip deepens and gains an edge in its own colour */
/* alerts share one shape and the semantic families */
.alert { padding:var(--sp-2) var(--sp-3); line-height:var(--lh-caption); }
.alert-warning { background:var(--warning-soft); color:var(--warning); border-color:var(--warning-border); }
/* loading: the live filter's own busy flag shows a moving bar at once and dims the rows only if it lasts */
[data-live-results] { position:relative; }
[data-live-results]::before { content:""; position:absolute; left:0; right:0; top:0; height:2px; z-index:7; pointer-events:none;
  background:linear-gradient(90deg, transparent, #7C3CF2, #D91B8F, transparent) no-repeat; background-size:40% 100%; opacity:0;
  transition:opacity var(--dur) var(--ease); }
[data-live-results][aria-busy="true"]::before { opacity:1; animation:live-bar 1.1s linear infinite; }
[data-live-results] > * { transition:opacity var(--dur) var(--ease) .15s; }
[data-live-results][aria-busy="true"] > * { opacity:.7; }
@keyframes live-bar { from { background-position:-40% 0; } to { background-position:140% 0; } }
/* loading: the record popup shows a skeleton until its page has loaded, instead of a tall empty frame */
.record-popup { position:fixed; }   /* a modal is fixed to the viewport (relative made it absolute: off screen on a scrolled phone page); fixed also holds the ::after skeleton */
.record-popup iframe { transition:height var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.record-popup[aria-busy="true"] iframe { height:240px !important; opacity:0; }
.record-popup[aria-busy="true"]::after { content:""; position:absolute; left:var(--sp-4); right:var(--sp-4); top:64px; height:176px; border-radius:var(--r); pointer-events:none;
  background:
    linear-gradient(100deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%) 0 0 / 200% 100% no-repeat,
    radial-gradient(circle 32px at 40px 44px, var(--surface-3) 99%, transparent 100%) 0 0 / 100% 100% no-repeat,
    linear-gradient(var(--surface-3), var(--surface-3)) 96px 24px / 40% 14px no-repeat,
    linear-gradient(var(--surface-3), var(--surface-3)) 96px 50px / 28% 12px no-repeat,
    linear-gradient(var(--surface-3), var(--surface-3)) 0 112px / 100% 44px no-repeat;
  animation:skeleton 1.2s linear infinite; }
/* the shimmer is the top layer, so it sweeps over the grey shapes; the avatar layer stays at 0 0 (its gradient places the circle) */
@keyframes skeleton { from { background-position:150% 0, 0 0, 96px 24px, 96px 50px, 0 112px; } to { background-position:-50% 0, 0 0, 96px 24px, 96px 50px, 0 112px; } }
/* forms: long fields span both columns */
.config-grid .field:has(textarea), .config-grid .field:has(select[multiple]), .config-grid .resource-project-picker, .config-grid > .photo-field { grid-column:1 / -1; }

/* ---------- list pages: search icon, reset, count, category chips, quiet row actions ---------- */
.field-search { position:relative; }
.field-search .ic { position:absolute; left:10px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--ink-3); pointer-events:none; }
.toolbar.live-filters .field-search input { padding-left:32px; }
.filter-reset { padding:4px 8px; border-radius:6px; font-size:var(--fs-caption); color:var(--ink-3); text-decoration:none; }
.filter-reset:hover { color:var(--ink); background:var(--surface-3); }
.filter-reset.is-active { color:var(--accent); font-weight:600; text-decoration:underline; text-underline-offset:3px; }
.toolbar.live-filters [data-live-count] { margin-left:auto; }
/* category chips: categories are data, so calm tints rather than red or green status colours (all >= 7:1) */
.cat-chip { display:inline-flex; align-items:center; margin:0 4px 0 0; padding:2px 8px; border:1px solid transparent; border-radius:6px;
  font:600 var(--fs-caption)/1.3 var(--sans); white-space:nowrap; }
.cat-indigo { background:#EEF0FB; color:#3730A3; border-color:#DCDFF6; }
.cat-teal   { background:#E6F4F2; color:#0B5C55; border-color:#CDE8E4; }
.cat-violet { background:#F3EEFC; color:#5B2A99; border-color:#E4DAF7; }
.cat-sky    { background:#E8F2FA; color:#1B4F7A; border-color:#D2E4F3; }
.cat-slate  { background:#EEF2F4; color:#3D5159; border-color:#DDE4E7; }
.cat-none   { background:transparent; color:var(--ink-3); border-color:var(--line-hard); border-style:dashed; font-weight:400; }
/* row actions are quiet icons until you point at them; delete turns red only on hover or focus */
:is(.grid, .resource-archive-list) .row-actions .icon-btn { border-color:transparent; background:transparent; color:var(--ink-3); }
.grid tr:hover .row-actions .icon-btn { color:var(--ink-2); }
:is(.grid, .resource-archive-list) .row-actions .icon-btn:hover:not([disabled]) { background:var(--surface-3); border-color:transparent; color:var(--ink); }
:is(.grid, .resource-archive-list) .row-actions .icon-btn-danger:hover:not([disabled]), :is(.grid, .resource-archive-list) .row-actions .icon-btn-danger:focus-visible { background:var(--danger-soft); color:var(--danger); }
/* the name leads each row; dates line up */
.grid td.col-name { font-weight:600; color:var(--ink); }
.grid td.col-since { font-variant-numeric:tabular-nums; color:var(--ink-2); }
/* a selected row also carries a bar, so selection is not shown by colour alone */
@media (min-width:721px){ .grid tbody tr.is-selected td:first-child { box-shadow:inset 3px 0 0 var(--magenta); } }   /* phone cards: on the card itself */
.empty-state .btn { margin-left:auto; }

/* ---------- list filter bands: one design on every list ---------- */
/* dropdowns name themselves ("All clients", "Any deadline"), so their small labels step back to screen readers only */
.toolbar.live-filters .field > span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.toolbar.live-filters .field:first-child { flex:2 1 140px; max-width:420px; }
.toolbar.live-filters .field { flex:1 1 104px; min-width:104px; }   /* search, five dropdowns, Reset and the count fit one row from about 890px */
/* A dropdown is never narrower than the option it shows: it sizes to that option (at least 104px), and the band wraps
   rather than cut it ("All project statuses", "Internal Development"). The search still gives up width first. */
.toolbar.live-filters .field:not(:first-child) { min-width:auto; max-width:100%; }
.toolbar.live-filters select { field-sizing:content; min-width:104px; }
.allocation-table .grid td.resource-actions { padding-block:1px; }   /* 28px buttons in a 32px row, like every other grid */
.amc-grid td.col-amc-type { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }   /* a long type never wraps the row */

/* ---------- AMC: one collapsible group per client (amc.php) ---------- */
/* A closed group shows only its band: the client, how many projects it has and their status mix. The band is a 32px row
   like the others; the whole row is the click target. */
.amc-group.is-collapsed tr:not(.band) { display:none; }
.amc-grid .band td { cursor:pointer; }
.band-toggle { display:flex; align-items:center; gap:8px; width:100%; min-height:22px; padding:0; border:0; background:none; color:inherit;
  font:inherit; letter-spacing:inherit; text-transform:inherit; text-align:left; cursor:pointer; }
.band-toggle .ic { width:16px; height:16px; color:var(--ink-3); transition:transform var(--dur-fast) var(--ease); }
.amc-group.is-collapsed .band-toggle .ic { transform:rotate(-90deg); }
.band-toggle strong { color:var(--ink); }
/* the status mix follows the count, so it stays in view when a wide grid scrolls sideways */
.band-toggle:hover strong { text-decoration:underline; text-underline-offset:3px; }
.band-sum { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:400; letter-spacing:0;
  text-transform:none; color:var(--ink-3); font-size:var(--fs-caption); }
button.filter-reset { border:0; background:none; font-family:inherit; cursor:pointer; }
@media (max-width:720px) {   /* a phone band: the client wraps beside its chevron and count, and the status mix gets a line of its own under it */
  .band-toggle { display:grid; grid-template-columns:16px minmax(0, max-content) auto 1fr; column-gap:var(--sp-2); }
  .band-sum { grid-column:2 / -1; white-space:normal; overflow:visible; }
}
@media print { .amc-group.is-collapsed tr:not(.band) { display:table-row; } }

/* ---------- Projects: a row of small figure cards above the filters (directory-page.php) ---------- */
/* As many cards as fit in one row; the deadline cards filter the list and show when they are the active filter. */
.kpis-compact { grid-template-columns:repeat(auto-fit, minmax(112px, 1fr)); }
.kpi[aria-current="true"] { border-color:var(--magenta); box-shadow:inset 0 0 0 1px var(--magenta); }
@media (max-width:720px) {   /* phones: one row that scrolls sideways rather than four rows of cards */
  .kpis-compact { grid-template-columns:none; grid-auto-flow:column; grid-auto-columns:minmax(128px, 1fr); overflow-x:auto; scroll-snap-type:x proximity; }
  .kpis-compact .kpi { scroll-snap-align:start; }
  .kpis-compact .kpi:focus-visible { outline-offset:-2px; }   /* the scroller clips a ring drawn outside the card */
}

/* ---------- no visible scrollbars (product owner request) ----------
   Pages, grids, dialogs and panels still scroll with the wheel, a trackpad, touch and the keyboard; only the bars are
   hidden. A grid frame with more columns to one side fades that edge instead (grid.js sets .more-left/.more-right). */
* { scrollbar-width:none; -ms-overflow-style:none; }
*::-webkit-scrollbar { display:none; width:0; height:0; }
.table-wrap.more-right { -webkit-mask-image:linear-gradient(to right, #000 calc(100% - 32px), rgba(0,0,0,.2)); mask-image:linear-gradient(to right, #000 calc(100% - 32px), rgba(0,0,0,.2)); }
.table-wrap.more-left { -webkit-mask-image:linear-gradient(to left, #000 calc(100% - 32px), rgba(0,0,0,.2)); mask-image:linear-gradient(to left, #000 calc(100% - 32px), rgba(0,0,0,.2)); }
.table-wrap.more-left.more-right { -webkit-mask-image:linear-gradient(to right, rgba(0,0,0,.2), #000 32px, #000 calc(100% - 32px), rgba(0,0,0,.2)); mask-image:linear-gradient(to right, rgba(0,0,0,.2), #000 32px, #000 calc(100% - 32px), rgba(0,0,0,.2)); }
.table-wrap:focus-visible, .table-wrap.more-left.more-right:focus-visible { -webkit-mask-image:none; mask-image:none; }   /* the fade erased the focused frame's ring */

/* ---------- the sidebar's Resources group (layout.php) ----------
   A chevron at the right of Resources shows or hides its sections; closed, it points right. On the 64px rail it shrinks
   to the row's right edge beside the icon; on the 52px phone rail it steps aside (the opened sidebar has it). */
.side-group { position:relative; }
.side-group > a { padding-right:40px; }
.side-group-toggle { position:absolute; right:4px; top:50%; transform:translateY(-50%); display:grid; place-items:center; width:28px; height:28px;
  padding:0; border:0; border-radius:6px; background:none; color:var(--band-ink-2); cursor:pointer; }
.side-group-toggle:hover { background:rgba(255,255,255,.08); color:#fff; }
.side-group > a.on + .side-group-toggle { color:#fff; }
.side-group-toggle .ic { width:16px; height:16px; transition:transform var(--dur-fast) var(--ease); }
.side-group-toggle[aria-expanded="false"] .ic { transform:rotate(-90deg); }
@media (min-width:901px) {
  .side-collapsed .side-group > a { padding-right:0; }
  .side-collapsed .side-group-toggle { right:0; width:14px; height:24px; }
  .side-collapsed .side-group-toggle .ic { width:12px; height:12px; }
}
@media (max-width:900px) {
  body:not(.nav-open) .side-group > a { padding-right:0; }
  body:not(.nav-open) .side-group-toggle { right:0; width:14px; height:24px; }
  body:not(.nav-open) .side-group-toggle .ic { width:12px; height:12px; }
}
@media (max-width:720px) { body:not(.nav-open) .side-group-toggle { display:none; } }

/* ---------- figure cards: tone, icon and motion (includes/kpis.php, app.js, live-filters.js) ----------
   Each card has a tone: a tinted icon badge and a matching left edge. Cards rise in one after another, their numbers
   count up, and after a filter a card whose figure changed flashes once. The reduced-motion rule stops all of it. */
[data-tone="violet"] { --tone:#6D3FD9; --tone-soft:#F1ECFD; }
[data-tone="blue"]   { --tone:var(--info); --tone-soft:var(--info-soft); }
[data-tone="teal"]   { --tone:var(--accent); --tone-soft:var(--accent-soft); }
[data-tone="amber"]  { --tone:var(--warning); --tone-soft:var(--warning-soft); }
[data-tone="red"]    { --tone:var(--danger); --tone-soft:var(--danger-soft); }
[data-tone="green"]  { --tone:var(--success); --tone-soft:var(--success-soft); }
[data-tone="slate"]  { --tone:var(--ink-2); --tone-soft:var(--surface-3); }
.kpi[data-tone], .amc-card[data-tone] { box-shadow:inset 3px 0 0 var(--tone); }
a.kpi[data-tone]::before { display:none; }   /* the tone edge replaces the hover bar */
a.kpi[data-tone]:hover { box-shadow:inset 3px 0 0 var(--tone), var(--shadow); }
.amc-card.selected[data-tone] { box-shadow:inset 3px 0 0 var(--tone), inset 0 0 0 1px var(--magenta); }
.kpi-ic { display:inline-grid; place-items:center; flex:none; width:18px; height:18px; border-radius:5px; background:var(--tone-soft, var(--surface-3)); color:var(--tone, var(--ink-2)); }
.kpi-label .kpi-ic .ic { width:12px; height:12px; color:inherit; }
.kpi-label { gap:var(--sp-1); }
.amc-card strong { color:var(--tone, var(--ink)); }
.amc-card strong > span { font:inherit; }   /* the counting number keeps the figure size, not the label size */
@keyframes kpi-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
@keyframes kpi-flash { from { background-color:var(--tone-soft, var(--surface-2)); } to { background-color:var(--surface); } }
.kpis > .kpi, .amc-cards > .amc-card { animation:kpi-in .45s var(--ease) both; }
.kpis > .kpi:nth-child(2), .amc-cards > .amc-card:nth-child(2) { animation-delay:.05s; }
.kpis > .kpi:nth-child(3), .amc-cards > .amc-card:nth-child(3) { animation-delay:.1s; }
.kpis > .kpi:nth-child(4) { animation-delay:.15s; }
.kpis > .kpi:nth-child(5) { animation-delay:.2s; }
.kpis > .kpi:nth-child(6) { animation-delay:.25s; }
.kpis > .kpi:nth-child(7) { animation-delay:.3s; }
.kpis > .kpi:nth-child(8) { animation-delay:.35s; }
[data-live-summary].is-live > * { animation:none; }
[data-live-summary].is-live > .is-changed { animation:kpi-flash .9s var(--ease); }

/* ---------- the two-click delete (NZ.confirmClick in app.js) ----------
   Armed, a delete asks a short question in solid red ("Delete sheet?"); its accessible name is the full question, which
   the toast announces. Confirmed, it reads "Deleting…" in soft red and stays disabled until the page moves on. Its width
   never hangs on the words. A trash icon turns into a labelled button of at least --confirm-w in place of its row's
   other icons, so the question fits the Actions cell and stays under the pointer that armed it; a text button keeps at
   least its own width (--idle-w, set by app.js), so a tight dialog footer never overflows. Hover never repaints it. */
:is(.btn-danger-ghost, .icon-btn-danger):is([data-armed], [data-busy]) { justify-content:center; }
.icon-btn-danger:is([data-armed], [data-busy]) { width:auto; min-width:var(--confirm-w); padding:0 var(--sp-2); font:600 var(--fs-caption)/1 var(--sans); white-space:nowrap; }
.btn-danger-ghost:is([data-armed], [data-busy]) { min-width:var(--idle-w, auto); max-width:100%; padding-inline:var(--sp-2); white-space:normal; text-align:center; }   /* a long category name wraps instead of running out of the form */
.row-actions:has([data-armed], [data-busy]) > a { display:none; }
:is(.btn-danger-ghost, .icon-btn-danger, .sdel)[data-armed]:not([disabled]),
:is(.grid, .resource-archive-list) .row-actions .icon-btn-danger[data-armed]:not([disabled]) { color:#fff; background:var(--danger); border-color:var(--danger); }
:is(.btn-danger-ghost, .icon-btn-danger)[data-busy],
:is(.grid, .resource-archive-list) .row-actions .icon-btn-danger[data-busy][disabled] { opacity:1; cursor:progress; color:var(--danger); background:var(--danger-soft); border-color:var(--danger-border); }
.panel-actions:has([data-confirm-delete]) { flex-wrap:wrap; }   /* Save at the left, the two-click Remove at the far right: on a phone it takes a row of its own */
