/* The one stylesheet (issue #34). Four parts, in this order:
     1. tokens      every size, space and colour the app may use — nowhere else holds a literal
     2. base        elements
     3. components  shared pieces: buttons, fields, messages, tables, dialogs
     4. pages       what only one page needs
   StyleDriftTests fails the build on a font-size, a colour or a px/rem spacing written outside
   :root. The values come from design 00a (map #28): type 24/17/15/13, space 4/8/16/32, one
   accent, and red spent only on "a human must act". */

/* ================================================================ 1. tokens */
:root {
    --ink: #1a1a1c;
    --muted: #6b6b73;
    --line: #e2e2e6;
    --keyline: #9a9aa2;      /* the photo frame, on screen and on paper */
    --bg: #fbfbfc;
    --paper: #ffffff;
    --surface: #f2f2f4;      /* the one grey surface */
    --accent: #2f5d8a;
    --on-accent: #ffffff;
    --bad: #a4292b;          /* only for "a human must act", always with a glyph and a word */
    --accent-tint: color-mix(in oklab, var(--accent) 9%, white);
    --bad-tint: color-mix(in oklab, var(--bad) 9%, white);
    --hover: color-mix(in oklab, var(--ink) 7%, transparent);
    --scrim: color-mix(in oklab, var(--ink) 55%, transparent);
    --shadow-lift: 0 1px 4px color-mix(in oklab, var(--ink) 14%, transparent);
    --shadow-dialog: 0 8px 32px color-mix(in oklab, var(--ink) 22%, transparent);
    --crop-dim: color-mix(in oklab, black 45%, transparent);

    --t1: 24px;   /* page title */
    --t2: 17px;   /* section, dialog title */
    --t3: 15px;   /* body */
    --t4: 13px;   /* labels, meta, controls */

    --s1: 4px;
    --s1b: 6px;   /* control padding only: the step between s1 and s2 */
    --s2: 8px;
    --s2b: 12px;  /* control padding only */
    --s3: 16px;
    --s4: 32px;

    --radius: 6px;
    --column: 1536px;
    --font: system-ui, "Segoe UI", sans-serif;
    --font-print: "Sitka Small", Georgia, serif;   /* the paper's face, for anything shown "as printed" */
}

/* ================================================================ 2. base */
* { box-sizing: border-box; }

/* Any rule that sets display beats the browser's own [hidden] { display:none }, so an element
   carrying hidden rendered anyway: panels open on load, twice (CLAUDE.md). Once, for everything. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font: var(--t3)/1.5 var(--font);
    color: var(--ink);
    background: var(--bg);
}

main { max-width: var(--column); margin: 0 auto; padding: var(--s4); }

h1 { font-size: var(--t1); font-weight: 600; margin: 0 0 var(--s3); }
h2 { font-size: var(--t2); font-weight: 600; margin: var(--s4) 0 var(--s2); }
h3 { font-size: var(--t2); font-weight: 600; margin: var(--s3) 0 var(--s2); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

label { display: block; font-size: var(--t4); color: var(--muted); margin-bottom: var(--s1); }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=file], input[type=search], input:not([type]), textarea, select {
    width: 100%; min-height: 38px; padding: var(--s2);
    border: 1px solid var(--line); border-radius: var(--radius);
    font: inherit; color: var(--ink); background: var(--paper);
}

table { width: 100%; border-collapse: collapse; background: var(--paper); }
th, td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
th { font-size: var(--t4); color: var(--muted); font-weight: 600; }

/* ================================================================ 3. components */

/* --- buttons. One neutral shape; primary is the page's one main action; danger fills red
       only inside a confirmation, where it is the last step. */
button, .btn {
    display: inline-flex; align-items: center; gap: var(--s1b);
    padding: var(--s1b) var(--s2b);
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--paper); color: var(--ink);
    font: inherit; font-size: var(--t4); white-space: nowrap; cursor: pointer;
}
button:hover, .btn:hover { text-decoration: none; background: var(--surface); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover, button.primary:hover { filter: brightness(1.08); }
.btn.go, button.go { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn.quiet, button.quiet { border-color: transparent; background: transparent; color: var(--accent); }
.btn.danger, button.danger { background: var(--bad); border-color: var(--bad); color: var(--on-accent); }
.btn.danger:hover, button.danger:hover { filter: brightness(.92); }
button[disabled], .btn[aria-disabled="true"], .btn.disabled {
    color: var(--muted); background: var(--surface); border-color: var(--surface); cursor: default;
}

/* A button that reads as a link, for actions inside running text. */
.linkish {
    background: none; border: 0; padding: 0; min-height: 0;
    color: var(--accent); font: inherit; cursor: pointer;
}
.linkish:hover { background: none; text-decoration: underline; }

/* --- segmented filter: Tous / actifs / archivés / masqués */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.seg > * { border: 0; border-radius: 0; background: none; padding: var(--s1b) var(--s2b); font-size: var(--t4); color: var(--ink); }
.seg > * + * { border-left: 1px solid var(--line); }
.seg > [aria-pressed="true"], .seg > [aria-current] { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.seg .n { color: var(--muted); margin-left: var(--s1); }
.seg [aria-pressed="true"] .n, .seg [aria-current] .n { color: inherit; }

/* --- fields */
.field, .f { margin-bottom: var(--s3); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

/* --- small text */
.meta { font-size: var(--t4); color: var(--muted); }
p.meta { max-width: 68ch; }  /* prose caps itself; past ~80 characters the eye loses the line */
.empty { color: var(--muted); font-style: italic; max-width: 68ch; }
.tag, .pill {
    display: inline-block; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 0 var(--s1b); font-size: var(--t4); color: var(--muted); background: var(--paper);
}
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* "a human must act": the only red. Text plus an outlined glyph, never a fill. */
.must { display: inline-flex; align-items: center; gap: var(--s1b); color: var(--bad); font-size: var(--t4); }
.must b {
    display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%;
    border: 1.5px solid var(--bad); font-size: var(--t4); line-height: 1; transform: scale(.77);
}
.cnt { display: inline-flex; align-items: center; gap: var(--s1b); }
.cnt svg { color: var(--muted); }

/* --- messages after a POST. Neutral for "done"; red only when something was refused. */
.msg { padding: var(--s2) var(--s3); border-radius: var(--radius); margin: 0 0 var(--s3); font-size: var(--t4); }
.msg.ok { background: var(--surface); color: var(--ink); }
.msg.error { background: var(--bad-tint); color: var(--bad); }
.notice {
    display: flex; gap: var(--s2); align-items: baseline;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--s2) var(--s3); margin-bottom: var(--s2); font-size: var(--t4);
}

/* --- panels */
.card {
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--s3); margin-bottom: var(--s3);
}
.card header { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.card .title { font-weight: 600; }
.card .actions { margin-top: var(--s2b); display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

/* --- dialogs. <dialog class="dlg">: title, body, footer. */
dialog.dlg, dialog.confirm {
    border: 0; border-radius: var(--radius); padding: 0; color: var(--ink);
    width: min(92vw, 560px); box-shadow: var(--shadow-dialog); background: var(--paper);
}
dialog.dlg::backdrop, dialog.confirm::backdrop { background: var(--scrim); }
dialog.dlg[hidden], dialog.confirm[hidden] { display: none; }
.dlg h2, dialog.confirm h2 { font-size: var(--t2); margin: 0; padding: var(--s3) var(--s3) var(--s2); }
.dlg .bd { padding: 0 var(--s3) var(--s3); }
.dlg .ft, .confirm-actions {
    display: flex; gap: var(--s2); align-items: center; justify-content: flex-end;
    padding: var(--s3); border-top: 1px solid var(--line);
}
.dlg .ft .grow { flex: 1; }
dialog.confirm form { margin: 0; }
dialog.confirm p { margin: 0; padding: 0 var(--s3) var(--s3); }

/* ================================================================ 4. pages */

/* --- header (every signed-in page, #38 §6): the way home, the person, the language */
.bar {
    display: flex; align-items: center; gap: var(--s3);
    min-height: 56px; padding: 0 max(var(--s4), calc((100% - var(--column)) / 2 + var(--s4)));
    background: var(--paper); border-bottom: 1px solid var(--line);
}
.logo { font-size: var(--t4); font-weight: 700; letter-spacing: .08em; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumb { font-size: var(--t4); color: var(--muted); }
.crumb a { color: var(--muted); }
.bar .right { margin-left: auto; display: flex; gap: var(--s2); }
details.menu { position: relative; }
details.menu > summary {
    list-style: none; display: inline-flex; align-items: center; gap: var(--s1b);
    padding: var(--s1) var(--s2b); border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--paper); font-size: var(--t4); cursor: pointer; user-select: none;
}
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after {
    content: ""; width: 6px; height: 6px; margin-left: var(--s1);
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
}
details.menu > summary:hover { background: var(--surface); }
details.menu .pop {
    position: absolute; right: 0; top: calc(100% + var(--s1)); z-index: 10; min-width: 100%;
    display: flex; flex-direction: column; padding: var(--s1) 0;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
}
details.menu:not([open]) .pop { display: none; }
details.menu .pop a, details.menu .pop .linkish {
    display: block; width: 100%; text-align: left; white-space: nowrap;
    padding: var(--s1b) var(--s3); font-size: var(--t4); color: var(--ink);
}
details.menu .pop a:hover, details.menu .pop .linkish:hover { background: var(--surface); text-decoration: none; }
details.menu .pop form { margin: 0; }
details.menu .pop [aria-current] { font-weight: 700; }

/* --- list (design 00a, screen A) */
.list-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.list-head h1 { margin: 0; }
.grow { flex: 1; }
.seg a:hover { text-decoration: none; background: var(--surface); }
table.list { border: 1px solid var(--line); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.list th { padding: var(--s2) var(--s3); }
.list td { padding: var(--s3); vertical-align: top; }
.list tr.grp td { background: var(--surface); padding: var(--s1) var(--s3); font-size: var(--t4); color: var(--muted); font-weight: 600; }
.list tbody tr:last-child td { border-bottom: 0; }
.list .t { font-weight: 600; }
.list tr.faded td { color: var(--muted); }
.list tr.faded .t { font-weight: 400; }
.list .acts { display: flex; gap: var(--s2); justify-content: flex-end; }
.nowrap { white-space: nowrap; }
.row1 { display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: wrap; }


/* --- Admin: four sections (#52) */
.admin { max-width: 760px; margin: 0 auto; }
.admin .panel { max-width: none; margin: 0 0 var(--s3); }
.admin .panel h2 { font-size: var(--t2); margin: 0; padding: var(--s3) var(--s3) var(--s2); }
.row-acts.end { justify-content: flex-end; margin-top: var(--s2); }
.recent td { vertical-align: top; }

/* --- Admin (design 00a, screen C): the dialog's layout as a page */
.panel {
    max-width: 640px; margin: 0 auto; background: var(--paper);
    border: 1px solid var(--line); border-radius: var(--radius);
}
.panel h1 { font-size: var(--t2); margin: 0; padding: var(--s3) var(--s3) var(--s2); }
.panel .bd { padding: 0 var(--s3) var(--s3); }
.panel .ft { display: flex; gap: var(--s2); align-items: center; padding: var(--s3); border-top: 1px solid var(--line); }
.panel .ft a.grow { font-size: var(--t4); }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s3); }
.field.last { margin-bottom: 0; }
.label { display: block; font-size: var(--t4); color: var(--muted); margin-bottom: var(--s1); }
table.own { font-size: var(--t4); background: none; }
.own td { padding: var(--s1b) 0; }
.own td + td { padding-left: var(--s3); }
.own td.r { text-align: right; }
.own form { margin: 0; }
form.inline { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s2); }
form.inline select { width: auto; flex: 1; }
.lc { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; background: var(--surface); border-radius: var(--radius); padding: var(--s2) var(--s3); }
.lc form { margin: 0; }
.sw { font-size: var(--t4); font-weight: 600; }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: var(--s1) var(--s3); margin: 0 0 var(--s2); font-size: var(--t4); }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* --- workshop progress (#55): the season in order. Done is filled accent, current is an accent
       outline, to do is grey; the count sits under each step with the step's own action. */
button.sm, .btn.sm { padding: var(--s1) var(--s2); }

button.wide { width: 100%; justify-content: center; }
.sortmode { display: flex; }
.sortmode select { width: auto; min-height: 0; padding: var(--s1) var(--s2); font-size: var(--t4); }
.notice .grow { flex: 1; }
.pile-empty { border: 1px dashed var(--keyline); border-radius: var(--radius); padding: var(--s3); text-align: center; color: var(--muted); font-size: var(--t4); margin: var(--s2) 0; }
.pile-empty p { margin: 0 0 var(--s2); }

/* --- workshop = concept 00, frames 03/06/08: one toolbar across, groups left, members in the
       middle, the photo pile right. The toolbar's filled button is the next thing to do. */
.ws00 {
    display: grid; grid-template-columns: 240px minmax(0, 1fr) 300px; align-items: stretch;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.ws00.ro { grid-template-columns: 240px minmax(0, 1fr); }
.ws00.ro .pile00 { display: none; }
.tools00 {
    grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center;
    padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line);
}
.tools00 form { margin: 0; }
.tools00 .btn, .tools00 button { font-size: var(--t3); }
.btn.dotted { border-style: dashed; border-color: var(--ink); }
.btn[aria-disabled="true"] { cursor: default; }
.tools00 .count { font-size: var(--t4); color: var(--muted); white-space: nowrap; }
.tools00 .count b { font-weight: 700; }
.tools00 .count.on { color: var(--ink); }
/* Progress in colour (#59, variant A): done reads blue with ✓, waiting on a person red with !.
   After the disabled rule, so a done step that cannot be clicked stays blue. */
.btn.done, button.done { background: var(--accent-tint); border-color: var(--accent-tint); color: var(--accent); }
.btn.act, button.act { background: var(--bad-tint); border-color: var(--bad-tint); color: var(--bad); }
.btn.done > span[aria-hidden], .btn.act > span[aria-hidden], button.done > span[aria-hidden], button.act > span[aria-hidden] { font-weight: 700; margin-right: var(--s1b); }
.tools00 .count.act { color: var(--bad); }
.cap { font-size: var(--t4); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 var(--s3); }
.side00 { padding: var(--s3); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s2); }
.side00 .cap { margin-bottom: var(--s1); }
.grp { justify-content: space-between; width: 100%; font-size: var(--t3); padding: var(--s2) var(--s2b); border-color: var(--line); }
.grp[aria-pressed="true"] { border: 2px solid var(--ink); font-weight: 700; }
.grprow { display: flex; gap: var(--s1); align-items: center; }
.grprow .grp { flex: 1; min-width: 0; gap: var(--s2); }
.grprow .grp span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grprow[draggable="true"] .grp { cursor: grab; }
.grprow.drag { opacity: .4; }
.grprow.over .grp { outline: 2px solid var(--ink); outline-offset: 2px; }
.gacts { display: flex; margin: 0; }
.gacts .gedit { visibility: hidden; }
.grprow.sel .gedit { visibility: visible; }
.gacts .ic { box-sizing: border-box; width: 22px; min-width: 0; padding: var(--s1) 0; }
button.ic { padding: var(--s1) var(--s1b); min-width: 28px; justify-content: center; font-size: var(--t4); border-color: transparent; background: none; }
button.ic:hover { border-color: var(--line); }
.pile00.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-tint); }
.pile00 .meta { font-size: var(--t4); margin: var(--s2) 0 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2b); margin-bottom: var(--s3); }
.tile { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2b) var(--s3); display: flex; flex-direction: column; gap: var(--s1); color: var(--muted); font-size: var(--t4); }
.tile b { font-size: var(--t1); color: var(--ink); line-height: 1; }
.tile.on { border: 2px solid var(--ink); color: var(--ink); }
.tile.bad { border: 2px solid var(--bad); color: var(--ink); }
.tcol ul { list-style: none; margin: var(--s2) 0 0; padding: 0 var(--s1); font-size: var(--t4); }
.tcol li { padding: var(--s1) 0; border-bottom: 1px solid var(--line); }
.tcol li s { color: var(--bad); }
.dlg .ft.three { display: grid; grid-template-columns: 1fr auto 1fr; }
.dlg .ft.three > span:last-child { justify-self: end; }
/* The member popup (#55): the photo and its crop frame, then the fields. */
dialog.dlg.member { width: min(94vw, 1040px); }
.mdbody { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--s4); align-items: start; }
.mdstage { height: 62vh; display: grid; place-items: center; background: var(--surface); }
.mdstage > * { grid-area: 1 / 1; }
.mdphoto .cropper img { max-height: 62vh; }
.mdphoto .ph.none { width: 200px; aspect-ratio: 2 / 3; display: grid; place-items: center; border: 1px dashed var(--keyline); color: var(--muted); font-size: var(--t4); }
.mdphoto .meta { margin: var(--s2) 0 0; }
.mdside .printed { margin: 0 0 var(--s3); }
.mdside .printed .meta { margin: 0 0 var(--s1); }
.mdside .row-acts { flex-wrap: wrap; }
#importDlg .bd { max-height: 60vh; overflow: auto; }
.grpadd { width: 100%; justify-content: center; border-color: var(--ink); }
.main00 { padding: var(--s3); min-width: 0; }
.empty00 { border: 1px dashed var(--keyline); border-radius: var(--radius); padding: var(--s4) var(--s3); text-align: center; color: var(--muted); margin-top: var(--s4); }
.empty00 h2 { font-size: var(--t2); color: var(--ink); margin: 0 0 var(--s2); font-weight: 600; }
.empty00 p { margin: 0 auto var(--s3); max-width: 68ch; }
.empty00.small { margin: 0; padding: var(--s3); font-size: var(--t4); }
.empty00.small p { margin-bottom: var(--s2); }
.row-acts.center { justify-content: center; }
.warn00 { display: flex; gap: var(--s3); align-items: center; background: var(--surface); border: 1px solid var(--keyline); border-radius: var(--radius); padding: var(--s2) var(--s3); font-size: var(--t4); margin: 0 0 var(--s3); }
.warn00 .grow { flex: 1; }
.pile00 { padding: var(--s3); border-left: 1px solid var(--line); }
.pile00 .acts { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s2); }
.pile00 .acts form { margin: 0; }
.pile00 .sel-note { font-size: var(--t4); color: var(--accent); font-weight: 600; margin: var(--s2) 0 0; }
a.badge { font-size: var(--t4); }

/* --- workshop (design 00a, screen B): status | members | photo pile */
.wshead { display: flex; align-items: flex-end; gap: var(--s3); margin-bottom: var(--s3); }
.wshead h1 { margin: 0; }
.wshead .tools { display: flex; gap: var(--s2); }
.ws {
    display: grid; grid-template-columns: 232px 1fr 248px; align-items: start;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.ws.ro { grid-template-columns: 232px 1fr; }
.ws.ro .pilecol { display: none; }
.side { padding: var(--s4) var(--s3); border-right: 1px solid var(--line); align-self: stretch; }
.side h2, .pilecol h2 { font-size: var(--t4); color: var(--muted); font-weight: 600; margin: 0 0 var(--s2); }
.side dl { display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s2); margin: 0 0 var(--s4); font-size: var(--t4); }
.side dd { margin: 0; text-align: right; font-weight: 600; }
.side .groups { display: flex; flex-direction: column; margin-bottom: var(--s2); }
.side .groups a { display: flex; justify-content: space-between; padding: var(--s1b) var(--s2); border-radius: var(--radius); color: var(--ink); font-size: var(--t4); }
.side .groups a:hover { background: var(--surface); text-decoration: none; }
.wsmain { padding: var(--s4); min-width: 0; }
.tb { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.tb form { margin: 0; }
.assign {
    display: flex; gap: var(--s3); align-items: center; margin-bottom: var(--s3);
    background: var(--accent-tint); color: var(--accent); border-radius: var(--radius);
    padding: var(--s2) var(--s3); font-size: var(--t4); font-weight: 600;
}
.assign[hidden] { display: none; }
.gsec { scroll-margin-top: var(--s3); }
h2.g, h3.g { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--t2); margin: var(--s3) 0 var(--s2); }
.g .n { font-size: var(--t4); color: var(--muted); font-weight: 400; }
button.sm { padding: 0 var(--s1b); font-weight: 400; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--s3); }

/* A member: the photo in its print frame, the name clamped to two lines as the paper does. */
.mcard { margin: 0; cursor: pointer; }
.mcard[hidden] { display: none; }
.mcard .ph { aspect-ratio: 2 / 3; border: 1px solid var(--keyline); background: var(--surface); overflow: hidden; }
.mcard .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mcard .ph.none { display: grid; place-items: center; border-style: dashed; font-size: var(--t4); color: var(--muted); }
.mcard.flag .ph { outline: 2px solid var(--bad); outline-offset: 2px; }
.mcard:hover .ph { border-color: var(--ink); }
.mcard.drag { opacity: .4; }
.mcard.over .ph { outline: 2px solid var(--ink); outline-offset: 2px; }
.mcard figcaption { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1); padding-top: var(--s1b); }
.mcard .nm { font-size: var(--t4); font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mcard .l2 { font-size: var(--t4); color: var(--muted); line-height: 1.3; }
.mcard .act { font-size: var(--t4); }
/* While a photo from the pile is selected, every card is a target. */
.assigning .mcard .ph { border: 2px dashed var(--accent); }
.assigning .mcard:hover .ph { background: var(--accent-tint); }

.pilecol { position: sticky; top: 0; padding: var(--s4) var(--s3); border-left: 1px solid var(--line); align-self: stretch; }
.grid2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin: var(--s3) 0; }
.grid2.wide { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.pt { padding: 0; border: 1px solid var(--keyline); border-radius: 0; background: var(--surface); width: 100%; aspect-ratio: 2 / 3; overflow: hidden; }
.pt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 2px; }
.hint-pile { font-size: var(--t4); color: var(--muted); margin: 0 0 var(--s2); }
.pilecol .acts { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); border-top: 1px solid var(--line); padding-top: var(--s3); }
.pilecol .acts form { margin: 0; }
.pilecol .acts p { margin: 0; }

/* A file input dressed as a button: the label is the control, the input stays reachable. */
.filebtn { position: relative; }
label.btn { margin: 0; color: var(--ink); font-size: var(--t4); }   /* a label dressed as a button is not a field label */
label.btn.quiet { color: var(--accent); }
.filebtn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.row-acts { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.row-acts form { margin: 0; }
dialog.dlg.wide { width: min(92vw, 720px); }
.dlg .ft form { margin: 0; }
.plan { background: var(--surface); border-radius: var(--radius); padding: var(--s2) var(--s3); margin-bottom: var(--s3); font-size: var(--t4); }
.plan p, .plan ul { margin: 0 0 var(--s2); }
.inline-label { display: inline-flex; align-items: center; gap: var(--s2); margin: 0; }
input.narrow { width: 4em; }

/* --- upload report (design 00b E) */
table.report { font-size: var(--t4); margin-top: var(--s2); }
.report th, .report td { padding: var(--s1b) var(--s2); }
.arrived { border-top: 1px solid var(--line); padding-top: var(--s3); }
.arrived h3 { margin-top: 0; }
.upl { display: flex; gap: var(--s2); flex-wrap: wrap; }
.upl figure { margin: 0; }
.upl img { display: block; width: 64px; height: 96px; object-fit: cover; border: 1px solid var(--keyline); }
.upl figcaption { font-size: var(--t4); color: var(--muted); text-align: center; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- crop editor (design 00b, screen F) */
.panel.wide { max-width: 760px; }
.panel .ft form { margin: 0; }
.printed { width: 150px; margin-top: var(--s2); }
.printed .cut { aspect-ratio: 2 / 3; border: 1px solid var(--keyline); background-repeat: no-repeat; background-color: var(--surface); }
.printed .pn { font-family: var(--font-print); font-size: var(--t4); text-align: center; margin-top: var(--s1b); }
.cropper img { max-height: 70vh; width: auto; }
.cropper { position: relative; display: inline-block; max-width: 100%; line-height: 0; overflow: hidden; }   /* the dimming shadow stays on the photo */
.cropper img { max-width: 100%; height: auto; display: block; }
#frame {
    position: absolute; box-sizing: border-box;
    border: 2px solid var(--paper); outline: 1px solid var(--crop-dim);
    box-shadow: 0 0 0 9999px var(--crop-dim);   /* dims outside the frame, no second element */
    cursor: move; touch-action: none;
}
#frame:focus-visible { outline: 3px solid var(--accent); }
#frame .grip {
    position: absolute; right: 0; bottom: 0; width: 16px; height: 16px;
    background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius);
    cursor: nwse-resize; touch-action: none;
}

/* --- users (design 00b G) */
.users .why { font-size: var(--t4); color: var(--muted); text-align: right; max-width: 36ch; }
.users .acts form { margin: 0; }
.users .acts { align-items: center; }

/* choices laid out open, as a segmented row of radios (#54): one click, no dropdown */
fieldset.choice { border: 0; padding: 0; min-width: 0; }
.seg label { display: inline-flex; align-items: center; gap: var(--s1b); margin: 0; padding: var(--s1b) var(--s2b); font-size: var(--t4); color: var(--ink); cursor: pointer; }
.seg label + label { border-left: 1px solid var(--line); }
.seg label:has(input:checked) { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.inline { display: flex; gap: var(--s2); align-items: center; }
.inline input { flex: 1; font-family: ui-monospace, Consolas, monospace; }

/* --- audit (design 00b H) */
.filters { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin-bottom: var(--s3); }
.filters input[type=search] { width: 24em; max-width: 100%; }
.filters select { width: auto; }
table.diff { width: auto; margin-top: var(--s1); font-size: var(--t4); background: none; }
.diff th, .diff td { padding: 0 var(--s2) 0 0; border: 0; }
.diff th { color: var(--muted); font-weight: 600; }
.audit pre { white-space: pre-wrap; margin: var(--s1) 0 0; }
.pager { display: flex; gap: var(--s3); align-items: center; justify-content: center; margin-top: var(--s3); }

/* --- preview chrome (the sheets follow PageLayout, in the page itself) */
.pvbar {
    position: sticky; top: 0; z-index: 1; display: flex; gap: var(--s3); align-items: center;
    padding: var(--s2) var(--s4); background: var(--paper); border-bottom: 1px solid var(--line);
}

/* --- login */
.panel.login { max-width: 380px; margin: var(--s4) auto; }
.panel.login .logo { display: block; margin: var(--s3) var(--s3) 0; text-decoration: none; }
.panel.login h1 { padding-top: var(--s2); }
.panel.login form button { margin-top: var(--s1); }
body.busy, body.busy * { cursor: progress; }

/* --- the crop frame takes a finger drag instead of scrolling the page */
#frame, #frame .grip { touch-action: none; }

/* ================================================================ 5. phone
   One column, 16px gutters, nothing wider than the screen. Tables become stacked rows,
   dialogs become full-screen sheets. The desktop layout above stays the reference. */
@media (max-width: 720px) {
    main { padding: var(--s3); }
    .bar { padding: var(--s2) var(--s3); gap: var(--s2); flex-wrap: wrap; }
    .bar .crumb { order: 3; flex-basis: 100%; }

    table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
    table.list thead { display: none; }
    table.list tr { padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
    table.list td { padding: var(--s1) var(--s3); border: 0; }
    table.list td:empty { display: none; }
    .list .acts { justify-content: flex-start; flex-wrap: wrap; }
    table.own, .own tbody, .own tr, .own td { display: block; width: 100%; }
    .own tr { padding: var(--s1) 0; border-bottom: 1px solid var(--line); }
    .own td, .own td + td { padding: 0; border: 0; }
    .own td.r { text-align: left; }
    table.diff { width: 100%; }
    .audit td { overflow-wrap: anywhere; }
    form.inline { flex-wrap: wrap; }
    form.inline select { flex-basis: 100%; }
    .two { grid-template-columns: 1fr; }
    .filters input[type=search] { width: 100%; }

    .ws00, .ws00.ro { grid-template-columns: minmax(0, 1fr); }
    .tools00 .grow { display: none; }
    .side00 { border-right: 0; border-bottom: 1px solid var(--line); }
    .pile00 { border-left: 0; border-top: 1px solid var(--line); }
    .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s2b); }
    .seg { flex-wrap: wrap; }

    dialog.dlg, dialog.dlg.wide, dialog.dlg.member {
        width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0;
        display: flex; flex-direction: column;
    }
    dialog.dlg:not([open]) { display: none; }
    dialog.dlg > .bd, dialog.dlg > form, dialog.dlg > div:not(.ft) { flex: 1; overflow: auto; }
    .mdbody { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
    .mdstage { height: 52vh; }
    .mdphoto .cropper img { max-height: 52vh; }
    .tiles { grid-template-columns: minmax(0, 1fr); }
    .dlg .ft { flex-wrap: wrap; }

    .pvbar { padding: var(--s2) var(--s3); gap: var(--s2); }
}
