/* Colour tokens: "light table" (docs/ux-plan.md M0, UX review §4). The photos are the only saturated
   thing on screen; UI colour is kept for links, selection and decisions. WCAG contrast in the comments
   (tests/test_web_m0_css.py recomputes the ones that matter). */
:root {
  --paper: #eef0f2;        /* page */
  --surface: #ffffff;      /* cards, bars */
  --sunken: #e4e7ea;       /* image wells, placeholders */
  --ink: #16191d;          /* 15.4:1 on paper */
  --ink-2: #50565e;        /* secondary text: 6.5:1 on paper, 6.0:1 on sunken */
  --rule: #d3d7dc;         /* dividers only (decorative) */
  --edge: #7b828b;         /* input and control borders: 3.4:1 on paper, 3.9:1 on white */
  --accent: #0a6b66;       /* links, selection: 5.6:1 on paper */
  --accent-ink: #ffffff;   /* 6.4:1 on accent */
  --caution: #8a5300;      /* one-day people, "photos show both": 5.5:1 on paper */
  --stop: #a3230f;         /* errors, disabling accounts */
  --ring: #16191d;         /* focus ring, drawn with a surface halo */
  --mark: #e8a33d;         /* the face box on a photo */
  --radius: 8px;
  --r-photo: 2px;
  --r-control: 6px;
  --r-chip: 999px;
  /* The earlier names, kept as aliases: templates and other rules still use them. */
  --bg: var(--paper);
  --panel: var(--surface);
  --muted: var(--ink-2);
  --line: var(--rule);
  --ok: var(--accent);
  --warn: var(--caution);
  --bad: var(--stop);
  --focus: var(--ring);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111315;
    --surface: #191c1f;
    --sunken: #23272b;
    --ink: #eceef0;
    --ink-2: #a8afb7;
    --rule: #2c3136;
    --edge: #737b84;
    --accent: #5cc2b8;
    --accent-ink: #0a1413;
    --caution: #e7b454;
    --stop: #ff8a73;
    --ring: #ffffff;
    --mark: #e7b454;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: break-word;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -10000px; top: 8px; z-index: 100; padding: 8px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--edge); border-radius: var(--r-control); }
.skip:focus { left: 8px; }

/* Header: wraps instead of widening the page; on narrow screens (phones, 200% zoom) the nav gets its
   own row and scrolls sideways inside itself. */
header.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px;
  padding: 6px 20px; background: var(--surface); border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 10;
}
header.top .brand { font-weight: 650; color: var(--ink); }
header.top nav {
  display: flex; gap: 14px; flex: 1 1 auto; min-width: 0;
  overflow-x: auto; white-space: nowrap; scrollbar-width: thin;
}
header.top nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 2px; }
header.top nav a.on { font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
header.top .who { color: var(--ink-2); display: flex; gap: 10px; align-items: center; margin-left: auto; }
@media (max-width: 760px) {
  header.top { padding: 4px 16px; }
  header.top nav { order: 3; flex-basis: 100%; }
}
/* The language switch (web/language.py): two small buttons, the current one marked. */
header.top-anon { justify-content: flex-end; }
.lang-switch { gap: 2px; }
.lang-switch button { padding: 4px 8px; font-size: 13px; letter-spacing: .02em; color: var(--ink-2); }
.lang-switch button[aria-pressed="true"] { color: var(--ink); font-weight: 650; border-color: var(--ink); }
main { max-width: 1320px; margin: 0 auto; padding: 18px 20px 60px; }
main:focus { outline: none; }
@media (max-width: 760px) { main { padding: 14px 16px 48px; } }
h1 { font-size: 24px; line-height: 1.2; margin: 4px 0 14px; }
h2 { font-size: 18px; line-height: 1.2; margin: 18px 0 10px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > * { min-width: 0; }
.spacer { flex: 1; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; }

/* Controls: borders at least 3:1 against the page, at least 40 px tall. */
button, .button {
  font: inherit; cursor: pointer; border-radius: var(--r-control); padding: 6px 12px; min-height: 40px;
  border: 1px solid var(--edge); background: var(--surface); color: var(--ink);
}
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.button:hover { text-decoration: none; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--stop); border-color: var(--stop); }
button:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=password], input[type=number], input[type=search], select {
  font: inherit; padding: 6px 8px; min-height: 40px; max-width: 100%;
  border: 1px solid var(--edge); border-radius: var(--r-control); background: var(--surface); color: var(--ink);
}
input[type=number] { width: 7em; }
input[type=checkbox] { accent-color: var(--accent); }
/* Focus: an ink ring with a surface halo on both sides, visible on any background, photos included. */
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; box-shadow: 0 0 0 7px var(--surface); }
form.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; max-width: 100%; }
kbd {
  font: 12px ui-monospace, monospace; padding: 1px 5px; border: 1px solid var(--edge); border-bottom-width: 2px;
  border-radius: 4px; background: var(--paper); color: var(--ink);
}
.flash { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--r-control); border: 1px solid var(--rule); background: var(--surface); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.flash.ok { border-color: var(--accent); }
.flash.error { border-color: var(--stop); color: var(--stop); }
.flash[hidden] { display: none; }
.badge { display: inline-block; font-size: 12px; padding: 0 7px; border-radius: 10px; border: 1px solid var(--edge); color: var(--ink-2); }
.badge.tentative { border-color: var(--caution); color: var(--caution); }
.badge.hidden { border-color: var(--stop); color: var(--stop); }

/* People grid */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.person-card { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; color: var(--ink); }
.person-card:hover { border-color: var(--accent); text-decoration: none; }
.person-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--sunken); }
.person-card .meta { padding: 8px 10px; }
.person-card .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Photo and face grids */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
@media (max-width: 480px) { .photos { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.photos a { display: block; }
.photos a img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; border-radius: var(--r-control); background: var(--sunken); }
.faces { display: flex; flex-wrap: wrap; gap: 8px; }
.face { position: relative; width: 104px; }
.face a { display: block; }
.face img { width: 104px; height: 120px; object-fit: cover; border-radius: var(--r-control); display: block; background: var(--sunken); }
.face.big, .face.big img { width: 168px; }
.face.big img { height: 196px; }
.face.small, .face.small img { width: 72px; }
.face.small img { height: 84px; }
.face > input[type=checkbox] { position: absolute; top: 4px; left: 4px; }
.face .strength { height: 4px; background: var(--rule); border-radius: 2px; margin-top: 3px; }
.face .strength span { display: block; height: 4px; background: var(--accent); border-radius: 2px; }
.face .caption { font-size: 12px; color: var(--ink-2); }
.face input[type=checkbox] { width: 18px; height: 18px; }
.face.selected img { outline: 3px solid var(--accent); }

/* Photo grids with a download selection (person, search, recently added) */
h3.day { font-size: 22px; font-weight: 700; line-height: 1.25; color: var(--ink); margin: 28px 0 10px; }
.photo { position: relative; }
.photo > input[type=checkbox] { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; margin: 0; cursor: pointer; }
.photo:has(input:checked) img { outline: 3px solid var(--accent); outline-offset: -3px; }
.dl-bar { position: sticky; bottom: 0; margin-top: 14px; }
ul.people-list { margin: 0; padding-left: 18px; }
ul.people-list li { margin: 3px 0; }

/* Full photo with a face box */
.photo-view { position: relative; display: inline-block; max-width: 100%; }
.photo-view img { max-width: 100%; max-height: 78vh; display: block; border-radius: var(--r-control); }
.photo-view .box { position: absolute; border: 2px solid rgba(255, 255, 255, .55); border-radius: 3px; }
.photo-view .box.focus { border: 3px solid var(--mark); box-shadow: 0 0 0 2px rgba(0, 0, 0, .45); }
.photo-view .box.hover { border: 3px solid var(--accent); box-shadow: 0 0 0 2px rgba(0, 0, 0, .45); }

/* Review */
.review-head { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.review-head a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--edge); border-radius: var(--r-chip); color: var(--ink); background: var(--surface);
}
.review-head a.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
@media (max-width: 760px) {
  .review-head { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; padding-bottom: 4px; }
}
.review-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; }
.review-card h2 { margin-top: 0; }
.review-card h2:focus { outline: none; }
.review-card h2:focus-visible { outline: 3px solid var(--ring); }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .sides { grid-template-columns: 1fr; } }
.side { border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; min-width: 0; }
.answers { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
.answers button, .answers .button { padding: 8px 14px; min-height: 44px; }
.answers button kbd { margin-left: 6px; }
.answers button.armed { background: var(--caution); border-color: var(--caution); color: var(--surface); }
.arm-note { color: var(--caution); font-weight: 600; margin: 8px 0 0; }
.img-status { color: var(--ink-2); margin: 8px 0 0; }
.undo { margin-top: 12px; }
.keys { margin-top: 14px; }
.warning { color: var(--caution); }
.context-photo { display: block; max-width: 100%; min-width: 0; }
.context-photo img { max-width: 100%; max-height: 300px; height: auto; border-radius: var(--r-control); display: block; }

/* Tables: on narrow screens a wide table scrolls inside itself, never the page. */
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
table.list th, table.list td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.list th { font-weight: 600; font-size: 14px; color: var(--ink-2); }
@media (max-width: 760px) { table.list { display: block; overflow-x: auto; } }
.pager { display: flex; gap: 14px; align-items: center; margin: 18px 0; font-size: 18px; }
.pager a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 12px; font-weight: 600;
  border: 1px solid var(--edge); border-radius: var(--r-control); background: var(--surface); }
.pager a:hover { text-decoration: none; border-color: var(--accent); }
.login { max-width: 360px; margin: 10vh auto; }
.login label { display: block; margin: 10px 0 4px; }
.login input { width: 100%; }
pre.json { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; margin: 0; color: var(--ink-2); }

/* --- M1: person page, cover picker, about --- */
/* Person page head: the cover with its "Change cover" button, then the name and the details. */
.person-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.person-cover { display: flex; flex-direction: column; gap: 8px; width: 168px; }
.person-cover .cover-change { text-align: center; display: block; }
.person-info { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.person-name h1 { margin: 4px 0 2px; }
.person-name .name-edit { color: var(--ink); }
.person-name .name-edit:hover { text-decoration: none; }
.person-name .name-edit .name-edit-hint { font-weight: 400; color: var(--accent); margin-left: 6px; }
.person-name .name-edit:hover .name-edit-hint, .person-name .name-edit:focus-visible .name-edit-hint { text-decoration: underline; }
.name-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.name-form input[type=text] { font-size: 18px; min-width: 0; width: 22em; max-width: 100%; }
.name-form .small { flex-basis: 100%; }
details.person-edit > summary { cursor: pointer; color: var(--accent); width: max-content; }
details.person-edit[open] > summary { margin-bottom: 8px; }
details.person-edit input[type=number] { width: 7em; }

/* Sort links: the active one is marked (not only by colour). */
.sort-links a.on, .sort-links a[aria-current] { font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* Cover picker (Faces page, mode=cover): whole-tile buttons, the current cover ringed. */
.now-showing { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 4px 0 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.now-showing .face.big img { height: 186px; }
.now-showing .now-label { font-weight: 600; font-size: 17px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); gap: 10px; }
.pick { position: relative; display: block; width: 100%; padding: 4px; border: 2px solid transparent; border-radius: var(--radius);
  background: var(--panel); cursor: pointer; text-align: left; }
.pick img { display: block; width: 100%; aspect-ratio: 6 / 7; object-fit: cover; border-radius: 6px; background: var(--line); }
.pick:hover { border-color: var(--accent); }
.pick:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.pick.current, .pick:disabled { opacity: 1; cursor: default; border-color: var(--ok); }
.pick .strength { display: block; height: 4px; background: var(--line); border-radius: 2px; margin-top: 4px; }
.pick .strength span { display: block; height: 4px; background: var(--accent); border-radius: 2px; }
.pick-now { position: absolute; top: 8px; left: 8px; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 10px;
  background: var(--ok); color: var(--panel); }

/* About: text and files, in a card with an accent edge so it stands apart from the page (owner request);
   empty, reviewers get a dashed box with one button. */
section.about { margin: 12px 0 8px; max-width: 900px; }
section.about.about-card { background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--rule)); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 4px 16px 12px; }
section.about.about-add { border: 1px dashed var(--edge); border-radius: var(--radius); padding: 10px 16px; }
section.about h2 { margin: 10px 0 6px; }
section.about h3 { font-size: 15px; margin: 10px 0 6px; }
.about-head { gap: 8px; }
.about-files { border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 2px; }
.about-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 4px; }
.about-merged { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin: 10px 0; }
.about-form textarea { width: 100%; min-height: 8em; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--ink); }
.about-form textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.about-form .row { margin-top: 6px; }
details.add-file > summary { list-style: none; }
details.add-file > summary::-webkit-details-marker { display: none; }
details.add-file[open] > summary { margin-bottom: 8px; }
.upload-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.upload-form input[type=file] { max-width: 100%; }
table.files td { vertical-align: middle; }
table.files .file-name { overflow-wrap: anywhere; }
table.files .file-actions { white-space: nowrap; text-align: right; }
table.files .file-actions a + a, table.files .file-actions a + form { margin-left: 10px; }
.danger-link { color: var(--bad); }
.confirm-delete { flex-wrap: wrap; }
@media (max-width: 600px) {
  .person-cover { width: 100%; flex-direction: row; align-items: flex-end; }
  table.files .file-actions { white-space: normal; text-align: left; }
}

/* --- M1b: "Could be the same person" on the person page (web/similar.py) --- */
section.similar { margin: 8px 0 4px; max-width: 900px; }
section.similar h2 { margin: 14px 0 8px; }
.similar-row { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 10px; }
.similar-row .similar-head { gap: 6px 12px; }
.similar-row .faces { margin: 8px 0 4px; }
.similar-row .warning { margin: 6px 0; }
.similar-row .flash { margin: 8px 0; }
.similar-row .match { display: inline-flex; align-items: center; gap: 6px; }
.similar-row .strength { display: inline-block; width: 96px; height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.similar-row .strength span { display: block; height: 6px; background: var(--accent); }
.similar-row.done { color: var(--ink-2); padding: 8px 14px; }
.badge.question { border-color: var(--accent); color: var(--accent); }
.similar-actions { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 8px; }
.similar-actions .warning, .similar-actions .arm-note { flex-basis: 100%; margin: 0; }
.similar-actions button.armed { background: var(--caution); border-color: var(--caution); color: var(--surface); }
/* "Merge selected": a checkbox per row, the bar once something is ticked, the confirmation page. */
.similar-row .pick { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; margin: -8px 0 -8px -10px; cursor: pointer; }
.similar-row .pick input { width: 20px; height: 20px; margin: 0; cursor: pointer; }
.similar-row.picked { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.similar-row[data-pick-row]:focus { outline: none; }
.similar-row[data-pick-row]:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.pick-help { margin: -2px 0 10px; }
.pick-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 4px 0 10px; border-color: var(--accent); }
.pick-bar[hidden] { display: none; }
.merge-confirm { max-width: 900px; }
.merge-confirm .merge-what { margin: 0 0 12px; }
.merge-confirm .similar-row.refused { border-color: var(--stop); }
.merge-confirm .similar-row .flash { margin: 8px 0; }
.merge-confirm-actions { margin: 14px 0; }
button.link-button { background: none; border-color: transparent; color: var(--accent); padding: 6px 4px; }
button.link-button:hover { text-decoration: underline; }

/* --- M3: person photos --- */
/* Person page: photo tiles (web/photos.py, templates/_photo_macros.html). The frame fills the
   tile with a ring at the face; the person's face is a small inset in the bottom corner away from
   the ring. When the photo isn't on this server, the face fills the tile with a note. "×6" when the
   tile stands for photos taken moments apart; the checkbox selects all of them. */
.bursts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
@media (max-width: 600px) { .bursts { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; } }
.burst { position: relative; padding: 4px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.burst:hover { border-color: var(--accent); }
.burst:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.burst > a { position: relative; display: block; color: var(--ink); }
.burst > a:hover { text-decoration: none; }
.burst-frame { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r-photo); background: var(--sunken); }
.burst-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.burst-face { position: absolute; bottom: 6px; width: 28%; max-width: 88px; aspect-ratio: 5 / 6; object-fit: cover;
  border: 2px solid var(--surface); border-radius: var(--r-photo); background: var(--sunken); box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.burst.inset-left .burst-face { left: 6px; }
.burst.inset-right .burst-face { right: 6px; }
.burst.no-photo .burst-face { position: static; width: 100%; max-width: none; aspect-ratio: 16 / 9; object-fit: contain;
  border: 0; box-shadow: none; }
.burst-frame.none { aspect-ratio: auto; margin-top: 4px; padding: 2px 6px; text-align: center; font-size: 12px; line-height: 1.25;
  color: var(--ink-2); background: none; }
.burst-n { position: absolute; top: 8px; right: 8px; padding: 1px 8px; border-radius: var(--r-chip); font-size: 13px; font-weight: 600;
  background: rgba(0, 0, 0, .72); color: #fff; pointer-events: none; }
.burst > input[type=checkbox] { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; margin: 0; cursor: pointer; }
/* A ring around a face on a 16:9 photo tile, centred on the face box (--l/--t/--w/--h in % of the
   photo) and at least 16 px wide: a face is about 2% of the frame's width. */
.ring { position: absolute; left: calc(var(--l) + var(--w) / 2); top: calc(var(--t) + var(--h) / 2);
  width: max(calc(var(--w) * 2), 16px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  border: 2px solid var(--mark); box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(0, 0, 0, .6); pointer-events: none; }
/* Search results: rings on the named people; a photo that isn't on this server shows the face. */
.photos a { position: relative; }
.photo.stand-in a img { object-fit: contain; }
.tile-note { position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: var(--r-control);
  font-size: 12px; text-align: center; color: var(--ink-2); background: var(--surface); }
/* Photo page: previous / next through a person's photos, the photos of the same moment, and the
   face when the photo itself isn't on this server. */
.photo-nav { margin: 0 0 10px; }
.photo-steps { display: inline-flex; gap: 10px; align-items: center; margin-left: auto; }
@media (max-width: 600px) { .photo-steps { flex-basis: 100%; justify-content: space-between; } }
.photo-missing { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.photo-view .photo-missing img { width: 240px; aspect-ratio: 5 / 6; object-fit: cover; border-radius: var(--r-photo); background: var(--sunken); }
.burst-strip h2 { font-size: 16px; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; }
.strip a { flex: none; display: block; padding: 2px; border: 2px solid transparent; border-radius: var(--r-control); }
.strip a.on { border-color: var(--accent); }
.strip img { display: block; width: 72px; height: 86px; object-fit: cover; border-radius: var(--r-photo); background: var(--sunken); }

/* --- M2: naming --- */
/* Name people (/name): cards with the cover (six faces on hover or focus) and a name field. */
.naming-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 6px; font-weight: 600; }
.naming-progress progress { width: 160px; height: 10px; accent-color: var(--accent); }
.naming-help { margin: 0 0 8px; max-width: 75ch; }
.naming-filter { margin-bottom: 4px; }
.naming-hint { margin: 0 0 14px; }
.naming-empty, .people-empty { margin: 8px 0; max-width: 75ch; }
.naming-empty p, .people-empty p { margin: 4px 0; }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-top: 12px; }
@media (max-width: 420px) { .name-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.name-card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden; }
.name-card:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.name-card.conflict { border-color: var(--caution); box-shadow: 0 0 0 1px var(--caution); }
.name-card.error { border-color: var(--stop); box-shadow: 0 0 0 1px var(--stop); }
.name-card.saved { border-color: var(--accent); }
.name-card[aria-busy="true"] .nc-input { color: var(--ink-2); }
.nc-look { position: relative; display: block; aspect-ratio: 6 / 7; background: var(--sunken); }
.nc-look:focus-visible { outline-offset: -3px; }
.nc-cover { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Three faces a row, rows sharing the height; two or four faces two a row. */
.nc-samples { position: absolute; inset: 0; display: none; grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr; gap: 2px; background: var(--sunken); }
.nc-samples[data-n="2"], .nc-samples[data-n="4"] { grid-template-columns: repeat(2, 1fr); }
.nc-samples img { display: block; width: 100%; height: 100%; object-fit: cover; }
.name-card:hover .nc-samples, .name-card:focus-within .nc-samples { display: grid; }
.nc-body { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 10px; min-width: 0; }
.nc-head { display: flex; flex-direction: column; min-width: 0; }
.nc-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-card.saved .nc-label { font-size: 18px; color: var(--accent); }
.nc-form { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.nc-form .nc-input { flex: 1 1 90px; min-width: 0; width: 100%; }
.nc-save { flex: none; padding: 6px 8px; }
.nc-note { font-size: 14px; margin: 0; color: var(--ink); }
.nc-note p { margin: 0 0 4px; }
.name-card.conflict .nc-note > p:first-child { color: var(--caution); font-weight: 600; }
.nc-note.error { color: var(--stop); }
.nc-hint { color: var(--ink-2); }
.nc-saved { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.nc-done { font-weight: 600; color: var(--accent); }
.nc-undo button { padding: 4px 10px; }

/* Person typeahead: a listbox under the field (search, People, "Merge into..."). */
.suggest-wrap { position: relative; display: inline-block; max-width: 100%; }
.suggest-wrap > input { max-width: 100%; }
.suggest { position: absolute; z-index: 20; left: 0; top: calc(100% + 4px); min-width: 100%; width: 18rem;
  max-width: calc(100vw - 32px); max-height: 60vh; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-control);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.suggest[hidden] { display: none; }
@media (max-width: 600px) { .suggest { right: 0; width: auto; min-width: 0; } }  /* as wide as the field */
.suggest a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 3px 8px; color: var(--ink);
  border-radius: 4px; }
.suggest a:hover { text-decoration: none; background: var(--sunken); }
.suggest [aria-selected="true"] a { background: var(--accent); color: var(--accent-ink); }
.suggest [aria-selected="true"] .muted { color: inherit; }
.suggest img, .merge-preview img { flex: none; width: 32px; height: 38px; object-fit: cover; border-radius: 4px;
  background: var(--sunken); }
.suggest-text { display: flex; flex-direction: column; min-width: 0; }
.suggest-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merge-preview { display: inline-flex; align-items: center; gap: 8px; }
.merge-preview[hidden] { display: none; }
.merge-preview .suggest-text { flex-direction: row; gap: 6px; flex-wrap: wrap; }

/* --- Fragment absorption: approving a batch its control cards alone blocked (web/absorb.py) --- */
.panel.override { margin: 16px 0; max-width: 900px; border-color: var(--caution); }
.panel.override h2 { margin: 0 0 8px; }
.panel.override ul { margin: 4px 0 10px; padding-left: 20px; }
.override-form { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.override-form textarea { width: 100%; min-height: 5em; font: inherit; padding: 8px; border: 1px solid var(--edge);
  border-radius: var(--r-control); background: var(--surface); color: var(--ink); }
.override-accept { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.override-note { overflow-wrap: anywhere; }

/* --- breadcrumbs --- */
/* One trail on every page below the header menu's sections (templates/_crumbs.html; the rules are in
   web/crumbs.py). It is the first thing on the page, in quiet 14 px text: the earlier steps are links,
   the page itself is secondary ink, and the chevrons are decoration only (screen readers skip them).
   It wraps on narrow screens instead of scrolling sideways; a long name breaks inside itself. */
.crumbs { margin: -8px 0 6px; font-size: 14px; line-height: 1.35; color: var(--ink-2); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; margin: 0; padding: 0; list-style: none; }
.crumbs li { display: flex; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.crumbs li + li::before { content: "\203A"; content: "\203A" / ""; padding: 0 8px; color: var(--edge); }
.crumbs a { display: inline-block; padding: 5px 0; }
/* A page's own controls on the trail's row, at its end (the photo page's previous / next); on a
   phone they take a row of their own under it. */
.crumbs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: -8px 0 10px; }
.crumbs-bar > .crumbs { margin: 0; min-width: 0; }
.crumbs-bar > :last-child { margin: 0 0 0 auto; }
@media (max-width: 760px) { .crumbs, .crumbs-bar { margin-top: -6px; } }
@media (max-width: 600px) { .crumbs-bar > :last-child { flex-basis: 100%; } }

/* --- attendance --- */
/* Staff attendance (web/attendance.py). A day square is shaded by the faces that day, four steps of
   the accent over the surface (att-l1..4); a day the person wasn't seen is an outlined square, a day
   without any photos is hatched. The month matrix scrolls inside its box, never the page, with the
   names kept in view. The bar is a day's photos in camera order, the person's first to last marked. */
.att-head { gap: 6px 16px; }
.att-nav { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: center; }
.att-nav a { display: inline-flex; align-items: center; min-height: 40px; }
.att-note { max-width: 80ch; margin: 0 0 10px; }
.att-months { margin: 0 0 8px; }
.att-links-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.att-l1 { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.att-l2 { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.att-l3 { background: color-mix(in srgb, var(--accent) 72%, var(--surface)); }
.att-l4 { background: var(--accent); }
.att-none { background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule); }
.att-nodata { background: repeating-linear-gradient(135deg, var(--sunken) 0 3px, var(--paper) 3px 6px); }
.att-sq { display: inline-block; width: 18px; height: 18px; border-radius: 3px; vertical-align: middle; }
.att-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 4px 0 10px; font-size: 14px; color: var(--ink-2); }
.att-legend > span { display: inline-flex; align-items: center; gap: 6px; }
/* The month matrix */
.att-scroll { max-width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
table.att-matrix { border-collapse: separate; border-spacing: 2px; font-size: 13px; }
.att-matrix th, .att-matrix td { padding: 0; text-align: center; }
.att-matrix thead th { font-weight: 600; color: var(--ink-2); vertical-align: bottom; min-width: 22px; }
.att-matrix thead th a, .att-matrix thead th > span { color: inherit; }
.att-matrix thead th a { display: flex; flex-direction: column; align-items: center; padding: 2px 0; }
.att-matrix thead th .att-wd { display: block; font-weight: 400; font-size: 11px; }
.att-matrix thead th.att-we { color: var(--ink); }
.att-matrix th.att-who { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left;
  padding: 1px 8px 1px 4px; min-width: 150px; max-width: 220px; }
.att-matrix th.att-who a { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); }
.att-matrix th.att-who img { flex: none; width: 28px; height: 33px; object-fit: cover; border-radius: 3px; background: var(--sunken); }
.att-matrix th.att-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-matrix td.att-n { padding: 0 6px; color: var(--ink-2); }
.att-matrix td.att-cell { width: 22px; height: 26px; border-radius: 3px; }
.att-matrix td.att-cell a { display: block; width: 100%; height: 26px; border-radius: 3px; }
.att-matrix td.att-cell a:hover { box-shadow: inset 0 0 0 2px var(--ink); }
@media (max-width: 600px) { .att-matrix th.att-who { min-width: 110px; max-width: 140px; } }
/* A day of the staff */
.att-people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.att-person { display: flex; gap: 12px; min-width: 0; padding: 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.att-person:target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.att-face { flex: none; display: block; }
.att-face img { display: block; width: 84px; height: 98px; object-fit: cover; border-radius: var(--r-control); background: var(--sunken); }
.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.att-links { display: flex; flex-wrap: wrap; gap: 0 12px; }
.att-links a { display: inline-flex; align-items: center; min-height: 32px; }
.att-bar { position: relative; height: 10px; margin: 6px 0 2px; border-radius: 5px; background: var(--sunken); }
.att-span { position: absolute; top: 0; bottom: 0; min-width: 4px; border-radius: 5px; background: var(--accent); }
.att-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink-2); }
/* A person's day */
.att-day-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; margin: 4px 0 8px; }
.att-day-head .att-info { min-width: 220px; max-width: 520px; }
.att-kept { width: 280px; max-width: 100%; }
.att-kept a { display: block; }
.att-kept img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-photo); background: var(--sunken); }
.att-kept img.att-kept-face { object-fit: contain; }
/* The person page's block and the calendars */
.att-block { margin: 8px 0 4px; max-width: 900px; }
.att-block h2 { margin: 12px 0 6px; }
.att-strip { display: flex; flex-wrap: wrap; gap: 3px; }
.att-strip .att-sq { width: 22px; height: 30px; }
.att-strip a.att-sq:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.att-month h2 { margin: 18px 0 6px; }
table.att-cal { border-collapse: separate; border-spacing: 3px; font-size: 14px; }
.att-cal th { font-weight: 600; font-size: 12px; color: var(--ink-2); }
.att-cal td { padding: 0; }
.att-day { display: flex; align-items: center; justify-content: center; width: 40px; height: 36px; border-radius: 4px; color: var(--ink); }
a.att-day:hover { text-decoration: none; box-shadow: inset 0 0 0 2px var(--ink); }
/* Day numbers on the shades, at least 4.5:1: ink up to att-l3 (4.9:1 on it), accent-ink on att-l4;
   in the dark theme att-l3 is light enough for accent-ink (5.2:1), not for ink. */
.att-day.att-l3, .att-day.att-l4 { font-weight: 600; }
.att-day.att-l4 { color: var(--accent-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .att-day.att-l3 { color: var(--accent-ink); } }
.att-day.att-none, .att-day.att-nodata { color: var(--ink-2); }
@media (max-width: 480px) { .att-day { width: 36px; } }

/* --- staff --- */
/* Staff marking (revision 0005; web/staff.py): the People / Staff tabs, the Staff badge, the
   "Likely staff" cards with a red-clothing bar, the review queue's Staff chip. */
.tabs { display: flex; gap: 4px 28px; flex-wrap: wrap; margin: 0 0 10px; border-bottom: 1px solid var(--rule); }
.tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 2px;
  font-size: 22px; font-weight: 700; border-bottom: 4px solid transparent; margin-bottom: -1px; color: var(--ink-2); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { border-bottom-color: var(--accent); color: var(--ink); }
.tab-n { font-size: 15px; color: var(--ink-2); font-weight: 400; }
/* The page heading under the tabs repeats the tab: keep it smaller than the tab title. */
h1.under-tabs { font-size: 17px; font-weight: 600; margin: 2px 0 10px; color: var(--ink-2); }
.badge.staff { border-color: var(--accent); color: var(--accent); }
a.badge.staff:hover { text-decoration: none; background: var(--sunken); }
.person-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.person-title .badge.staff { font-size: 14px; padding: 1px 9px; }
.staff-hint, .staff-help { margin: 0 0 12px; max-width: 80ch; }
.staff-links { margin: 0 0 12px; gap: 4px 18px; }
.staff-links a { display: inline-flex; align-items: center; min-height: 40px; }
.staff-note { margin: 0; color: var(--accent); font-weight: 600; }
.staff-bar { margin: 8px 0 12px; position: sticky; top: 56px; z-index: 5; }
.staff-bar-end { position: static; }
@media (max-width: 760px) { .staff-bar { position: static; } }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
@media (max-width: 420px) { .staff-grid { grid-template-columns: minmax(0, 1fr); } }
.staff-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); }
.staff-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.staff-pick { display: flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.staff-pick input[type=checkbox] { width: 20px; height: 20px; margin: 0; flex: none; }
.staff-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-look { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 6px; align-items: start; color: var(--ink); }
.staff-look:hover { text-decoration: none; }
.staff-cover { width: 64px; aspect-ratio: 5 / 6; object-fit: cover; border-radius: var(--r-photo); background: var(--sunken); }
.staff-frame.none { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; background: var(--sunken); }
/* The red clothing as a plain bar (no number): the red token on a neutral track, both themes. */
.redbar { height: 8px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.redbar span { display: block; height: 100%; background: var(--stop); border-radius: 4px; }
.staff-not { align-self: flex-start; min-height: 32px; color: var(--stop); }
.staff-confirm-faces { margin: 10px 0 14px; }
.staff-hint-hide { margin-left: auto; }
.staff-hint-hide .link-button { min-height: 32px; }
.staff-warn { max-width: 80ch; border-color: var(--caution); color: var(--caution); }
.staff-toggle label { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.review-head a.staff-chip { border-style: dashed; }

/* --- progress (revision 0006; web/progress.py) --- */
/* The People / Staff filter "Not processed · Processed · Identified · All": chips like the review
   queue's, the chosen one marked by weight and colour and by aria-current. */
.progress-filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.progress-filter a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--edge); border-radius: var(--r-chip); color: var(--ink); background: var(--surface);
}
.progress-filter a:hover { text-decoration: none; border-color: var(--accent); }
.progress-filter a.on { border-color: var(--accent); color: var(--accent); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent); }
@media (max-width: 760px) {
  .progress-filter { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; padding-bottom: 4px; }
}
.badge.processed { border-color: var(--accent); color: var(--accent); }
.badge.identified { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.person-title .badge.identified { font-size: 14px; padding: 1px 9px; }
/* The person page: the three states as one segmented control, the current one filled. */
.progress-box { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 4px; }
.progress-set { gap: 8px; }
.seg { display: inline-flex; flex-wrap: wrap; }
.seg > button, .seg > .button { border-radius: 0; margin-left: -1px; }
.seg > :first-child { border-radius: var(--r-control) 0 0 var(--r-control); margin-left: 0; }
.seg > :last-child { border-radius: 0 var(--r-control) var(--r-control) 0; }
/* The current state: tinted and outlined, not filled, so it never looks like the primary action next to it. */
.seg > button.on { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--ink); font-weight: 650;
  border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); position: relative; z-index: 1; }
.identify-form { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.identify-form input[type=text] { width: 22em; max-width: 100%; }
.identify-form .small { flex-basis: 100%; }
