:root {
  --bg: #ffffff;
  --bg-2: #f3f4f6;
  --bg-3: #e7e9ee;
  --fg: #1d1f24;
  --fg-2: #5d6270;
  --line: #e0e3e9;
  --accent: #3a6ff7;
  --accent-fg: #ffffff;
  --danger: #d33a2c;
  --prov: #c27c0e;
  --ok: #1f9d55;
  --shadow: 0 8px 30px rgba(0, 0, 0, .12);
  --radius: 10px;
  --top-h: 3.5rem;
  --bottom-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16171a; --bg-2: #202227; --bg-3: #2b2e35; --fg: #eceef2; --fg-2: #a2a7b3; --line: #30333b;
    --accent: #7ea2ff; --accent-fg: #0e1220; --danger: #ff6b5e; --prov: #f0b44c; --ok: #4cd38a; --shadow: 0 8px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16171a; --bg-2: #202227; --bg-3: #2b2e35; --fg: #eceef2; --fg-2: #a2a7b3; --line: #30333b;
  --accent: #7ea2ff; --accent-fg: #0e1220; --danger: #ff6b5e; --prov: #f0b44c; --ok: #4cd38a; --shadow: 0 8px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Sizes are in rem, so this one value scales the whole interface. On touch screens it's up to about 1.2x, following the
   screen's width: a phone at its standard size gets the full step, while a phone with Display Zoom (a narrower screen
   in CSS px) gets less, since everything there is already bigger. 1em is the browser's own text size, so a larger
   text setting in the browser still makes it bigger. Computers keep 16px. */
@media (pointer: coarse) {
  html { font-size: clamp(1em, 4.9vw, 1.1875em); }
  input, select, textarea, .tools .tool, .tools .tool-select { font-size: max(1rem, 16px); } /* under 16px, iPhones zoom the page in when you tap a field */
}
html.lb-lock { overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 0.9375rem/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
input[type="text"], input[type="search"], input[type="password"], textarea, select {
  width: 100%; padding: 0.5625rem 0.6875rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
textarea { resize: vertical; min-height: 2.75rem; }
button, .button {
  display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.5rem 0.875rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); cursor: pointer; text-decoration: none; color: var(--fg); white-space: nowrap; min-height: 2.375rem;
}
button:hover:not(:disabled), .button:hover { background: var(--bg-3); }
button:disabled { opacity: .45; cursor: default; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
button.danger { color: var(--danger); }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); }
.icon { width: 1.375rem; height: 1.375rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn { padding: 0.5rem; border: 0; background: transparent; border-radius: 999px; min-height: 2.5rem; min-width: 2.5rem; justify-content: center; }
.icon-btn:hover:not(:disabled) { background: var(--bg-3); }
.muted { color: var(--fg-2); }
.error { color: var(--danger); }
.spacer { flex: 1; }
.boot { padding: 40vh 0; text-align: center; color: var(--fg-2); }
[hidden] { display: none !important; }

/* ---------- sign in ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(23.75rem, 100%); display: grid; gap: 0.75rem; text-align: center; padding: 1.75rem 1.375rem; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); box-shadow: var(--shadow); }
.login-card h1 { margin: 0; font-size: 1.5rem; }
.login-card p { margin: 0; }
.login-card button { justify-content: center; }
.login-logo .icon { width: 2.75rem; height: 2.75rem; color: var(--accent); }

/* ---------- top bar & navigation ---------- */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 0.75rem;
  padding: 0 1rem; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.5rem; color: var(--fg); text-decoration: none; font-weight: 600; font-size: 1.0625rem; }
.brand .icon { color: var(--accent); }
.search { position: relative; flex: 1; max-width: 40rem; display: flex; align-items: center; }
.search > .icon { position: absolute; left: 0.625rem; color: var(--fg-2); width: 1.125rem; height: 1.125rem; }
.search input { padding-left: 2.125rem; background: var(--bg-2); border-color: transparent; border-radius: 999px; }
.suggest { position: absolute; top: calc(100% + 0.25rem); left: 0; right: 0; z-index: 30; list-style: none; margin: 0; padding: 0.25rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
.suggest li { padding: 0.5rem 0.625rem; border-radius: 6px; cursor: pointer; display: flex; gap: 0.5rem; align-items: baseline; }
.suggest li small { color: var(--fg-2); font-size: 0.75rem; min-width: 2.875rem; }
.suggest li:hover, .suggest li.active { background: var(--bg-2); }
.dlg-body .suggest { position: static; margin-top: 0.25rem; box-shadow: none; max-height: 30vh; }
nav.side { display: flex; gap: 2px; }
nav.side a, nav.bottom a { display: flex; align-items: center; gap: 0.375rem; padding: 0.5rem 0.625rem; border-radius: 8px; color: var(--fg-2); text-decoration: none; font-size: 0.875rem; }
nav.side a.active, nav.bottom a.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
nav.side a .icon { width: 1.25rem; height: 1.25rem; }
nav.bottom { display: none; }
.me { width: 2.25rem; height: 2.25rem; min-height: 2.25rem; padding: 0; border-radius: 999px; justify-content: center; background: var(--accent); color: var(--accent-fg); border: 0; font-weight: 600; flex: none; }

@media (max-width: 860px) {
  :root { --bottom-h: 3.75rem; }
  .brand span { display: none; }
  nav.side { display: none; }
  nav.bottom {
    display: flex; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--bg); border-top: 1px solid var(--line);
  }
  nav.bottom a { flex: 1 1 0; min-width: 0; padding: 0.375rem 0; flex-direction: column; gap: 2px; font-size: max(11px, min(0.6875rem, 3.25vw)); /* six labels share the width */ white-space: nowrap; justify-content: center; border-radius: 0; background: none !important; }
  nav.bottom a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .top { padding: 0 0.75rem; gap: 0.5rem; }
}

/* ---------- photos view ---------- */
.photos-head { position: sticky; top: var(--top-h); z-index: 10; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); padding: 0.375rem 1rem 0.25rem; }
.chips-bar, .jump-bar { display: flex; gap: 0.375rem; overflow-x: auto; scrollbar-width: none; padding: 0.25rem 0; }
.chips-bar::-webkit-scrollbar, .jump-bar::-webkit-scrollbar { display: none; }
.fchip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.375rem 0.25rem 0.75rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--fg); white-space: nowrap; font-size: 0.875rem; text-decoration: none; }
.fchip button { border: 0; background: none; min-height: 0; padding: 0 0.375rem; font-size: 1.0625rem; line-height: 1; color: var(--fg-2); }
.suggest-chip { padding-right: 0.75rem; background: color-mix(in srgb, var(--prov) 18%, transparent); }
.tools { display: flex; align-items: center; gap: 0.375rem; padding: 2px 0; }
.tools .count { color: var(--fg-2); font-size: 0.875rem; }
/* Narrow screens: Filters, the order menu and Select stay on one line; the photo count makes way for them, and a long
   order name is cut short rather than wrapping. */
@media (max-width: 520px) {
  .tools { flex-wrap: nowrap; justify-content: space-between; }
  .tools .count, .tools .spacer { display: none; }
  .tools > * { flex: none; }
  .tools label.tool { flex: 0 1 auto; min-width: 0; }
  .tools .tool-select { max-width: 100%; min-width: 0; padding-right: 0.25rem; }
  .tools { gap: 0.125rem; }
  .tools button.tool { padding-left: 0.375rem; padding-right: 0.375rem; gap: 0.25rem; }
  .tools label.tool > .icon { left: 0.375rem; }
  .tools .tool-select { padding-left: 1.75rem; }
}
.tool { background: none; border: 0; padding: 0.375rem 0.5rem; min-height: 2.125rem; color: var(--fg-2); font-size: 0.875rem; }
.tool .icon { width: 1.125rem; height: 1.125rem; }
/* The order menu: the select covers the whole button (icon included), so tapping the arrows opens it too. */
label.tool { display: inline-flex; align-items: center; position: relative; padding: 0; }
label.tool > .icon { position: absolute; left: 0.5rem; top: 50%; translate: 0 -50%; pointer-events: none; }
.tool-select { appearance: none; -webkit-appearance: none; background: none; border: 0; padding: 0.375rem 0.5rem 0.375rem 1.875rem; min-height: 2.125rem; color: inherit; font: inherit; cursor: pointer; max-width: 15em; text-overflow: ellipsis; }
.when-hint { display: block; min-height: 1.3em; margin-top: 2px; }
.tool-select:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }
.tool.icon-only { padding: 0.375rem; }
.tile.marked { outline: 3px solid var(--accent); outline-offset: -3px; z-index: 1; }
/* Uploaded around the same time: a row of small thumbnails, the current photo outlined. */
.nearby-strip { display: flex; gap: 0.1875rem; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.nearby-tile { flex: none; height: 3.5rem; max-width: 6.875rem; border-radius: 4px; overflow: hidden; background: var(--bg-2); opacity: .85; }
.nearby-tile:hover { opacity: 1; }
.nearby-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nearby-tile.current { opacity: 1; outline: 2px solid var(--accent); outline-offset: -2px; }
.nearby .lbl-row small a { color: var(--accent); }
.jump-bar button { padding: 0.1875rem 0.625rem; min-height: 1.75rem; border-radius: 999px; font-size: 0.8125rem; background: var(--bg-2); border: 0; color: var(--fg-2); }
.callout { margin: 0.5rem 1rem; padding: 0.625rem 0.875rem; border-radius: var(--radius); background: color-mix(in srgb, var(--prov) 14%, transparent); }

.grid-wrap { padding: 0 1rem 2.5rem; }
.grid { -webkit-user-select: none; user-select: none; }
@media (max-width: 600px) { .grid-wrap { padding: 0 2px 1.875rem; } .photos-head { padding: 0.25rem 0.625rem 2px; } }
.sec-head { display: flex; align-items: baseline; gap: 0.625rem; padding: 1.125rem 2px 0.5rem; }
.sec-head h2 { margin: 0; font-size: 1.0625rem; font-weight: 600; }
.sec-head .count { color: var(--fg-2); font-size: 0.8125rem; }
.row { display: flex; gap: 0.1875rem; margin-bottom: 0.1875rem; contain: layout paint; }
.tile { position: relative; padding: 0; border: 0; border-radius: 0; min-height: 0; background: var(--bg-2); overflow: hidden; cursor: pointer; flex: none; height: 100%; -webkit-touch-callout: none; user-select: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s ease; }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.badge.prov { position: absolute; right: 0.375rem; bottom: 0.375rem; width: 0.5625rem; height: 0.5625rem; border-radius: 9px; background: var(--prov); box-shadow: 0 0 0 2px rgba(0,0,0,.3); }
.badge.del { position: absolute; left: 0.375rem; top: 0.375rem; font-size: 0.875rem; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.tile.flagged img { opacity: .55; }
.check { display: none; position: absolute; top: 0.375rem; left: 0.375rem; width: 1.375rem; height: 1.375rem; border-radius: 22px; border: 2px solid #fff; background: rgba(0,0,0,.25); }
.selecting .check { display: block; }
.tile.selected img { transform: scale(.88); }
.tile.selected .check { background: var(--accent); border-color: var(--accent); }
.tile.selected .check::after { content: ""; position: absolute; left: 0.375rem; top: 2px; width: 0.3125rem; height: 0.625rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.empty { color: var(--fg-2); text-align: center; padding: 3.75rem 0; }

/* Selection bar: replaces the count/sort/select row (sticky under the header) while selecting. Bright blue in both themes. */
.selbar {
  --sel: #1769ff;
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.375rem 0.5rem; margin: 2px 0; padding: 0.375rem 0.5rem 0.375rem 0.375rem; border-radius: 12px;
  background: var(--sel); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--sel) 35%, transparent);
}
.selbar .icon { width: 1.125rem; height: 1.125rem; }
.selbar strong { color: #fff; }
.selbar button { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .35); }
.selbar button:hover:not(:disabled) { background: rgba(255, 255, 255, .28); }
.selbar button.danger { background: #fff; color: #d93025; border-color: transparent; }
.selbar button.danger:hover:not(:disabled) { background: #ffeceb; }
.selbar button:disabled { opacity: .5; }
.selbar .icon-btn { background: transparent; border-color: transparent; }
.selbar strong { white-space: nowrap; }
/* While selecting, the filter chips, decade buttons and (on phones) the bottom bar step aside, so the photos and the
   selection bar get the room. They come back when selecting ends. */
body.has-selbar .chips-bar, body.has-selbar .jump-bar, body.has-selbar nav.bottom { display: none; }
body.has-selbar { --bottom-h: 0px; }
@media (max-width: 860px) { /* phones: the top bar too (keeping clear of a notch when added to the home screen) */
  body.has-selbar .top { display: none; }
  body.has-selbar { --top-h: 0px; }
  body.has-selbar .photos-head { padding-top: max(0.375rem, env(safe-area-inset-top)); }
}
/* Phones: "✕ 3 selected" on the first line, then the actions as one even row of icons across the full width. */
@media (max-width: 600px) {
  .selbar { flex-wrap: wrap; justify-content: flex-start; gap: 0.25rem; padding: 0.25rem 0.375rem 0.375rem; }
  .selbar > strong { flex: 1 0 calc(100% - 3rem); }
  .selbar > .spacer { display: none; }
  .selbar button span { display: none; }
  .selbar > button:not(.icon-btn) { flex: 1 1 0; min-width: 0; padding: 0.5rem 0; justify-content: center; }
}

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; color: #fff; }
.lb-main { position: relative; flex: 1; min-width: 0; }
.lb-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; display: grid; place-items: center;
  /* Fixed-size cell: with auto tracks a tall photo stretches the row past the screen and gets cropped. */
  grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.lb-stage img { grid-area: 1 / 1; max-width: 100%; max-height: 100%; object-fit: contain; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; transition: transform .2s ease; }
.lb-stage.zoomed img { transition: none; cursor: grab; }
.lb-img { opacity: 0; }
.lb-img.ready { opacity: 1; }
.lb-thumb { filter: blur(2px); }
.lb-stage:has(.lb-img.ready) .lb-thumb { visibility: hidden; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; padding: 0.5rem; padding-top: max(0.5rem, env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.55), transparent); }
.lb-top .icon-btn { color: #fff; }
.lb-top .icon-btn:hover { background: rgba(255,255,255,.15); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); color: #fff; background: rgba(0,0,0,.35) !important; }
.lb-nav.prev { left: 0.625rem; } .lb-nav.next { right: 0.625rem; }
/* Under the photo: what's known (each a button that opens that field) and "+ When?" style prompts for the rest. */
.lb-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.875rem 1rem max(0.875rem, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.6)); display: flex; align-items: flex-end; gap: 0.625rem; font-size: 0.875rem; pointer-events: none; }
.lb-caption:empty { display: none; }
.lb-caption button { pointer-events: auto; }
.lb-facts { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0.375rem; }
.lb-fact { min-height: 2.125rem; padding: 0.3125rem 0.75rem; border-radius: 999px; font-size: 0.875rem; color: #fff; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.28); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-fact.when { font-weight: 600; }
.lb-fact.empty { border-style: dashed; color: rgba(255,255,255,.85); }
.lb-fact:hover { background: rgba(255,255,255,.18); }
/* Edit: a labelled accent button in the top bar (opens/closes the details panel). */
.lb-edit { flex: none; align-self: center; display: inline-flex; align-items: center; gap: 0.375rem; height: 2.375rem; margin-left: 0.375rem; padding: 0 1rem 0 0.75rem; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-fg); font-size: 0.9375rem; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.lb-edit .icon { width: 1.125rem; height: 1.125rem; }
.lb-edit:hover { filter: brightness(1.08); }
.lb-edit.on { background: rgba(255,255,255,.2); color: #fff; box-shadow: none; }
.lb-hd { flex: none; align-self: center; height: 1.875rem; margin: 0 0.25rem; padding: 0 0.5625rem; border-radius: 6px; border: 1.5px solid rgba(255,255,255,.7); background: transparent; color: #fff; font-size: 0.8125rem; font-weight: 700; letter-spacing: .04em; opacity: .75; }
.lb-hd:hover { opacity: 1; background: rgba(255,255,255,.15); }
.lb-hd.on { opacity: 1; background: #fff; color: #111; border-color: #fff; }
@media (max-width: 860px) { .lb-hd { display: none; } }
/* Admin → Settings → Phone-size copies: the try-it-out comparison */
.mid-try { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border, #8883); }
.mid-try h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.mid-try label { display: inline-flex; gap: 0.375rem; align-items: center; }
.mid-sum { font-weight: 600; margin: 0.625rem 0 0; }
.mid-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; margin: 0.75rem 0 1.25rem; }
.mid-pair figure { margin: 0; min-width: 0; }
.mid-pair figcaption { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.8125rem; margin-bottom: 0.25rem; }
.mid-pair .trial figcaption b { color: var(--accent); }
.mid-view { position: relative; width: 100%; max-height: calc(100vh - 8.75rem); min-height: 12.5rem; overflow: hidden; background: #000; border-radius: 6px; }
.mid-view img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.mid-pairs[data-view="phone"] .mid-pair { grid-template-columns: repeat(2, minmax(0, 24.375rem)); justify-content: center; }
.mid-pairs[data-view="zoom"] .mid-view img { inset: auto; height: auto; max-width: none; object-fit: fill; left: 50%; top: 50%; transform: translate(-50%, -50%); }
@media (max-width: 700px) { .mid-pair { grid-template-columns: 1fr; } .mid-pairs[data-view="phone"] .mid-pair { grid-template-columns: 1fr; } }
.lb-info { width: 23.75rem; flex: none; background: var(--bg); color: var(--fg); overflow-y: auto; display: none; border-left: 1px solid var(--line); }
.lb.info-open .lb-info { display: block; }
.lb.info-open .lb-caption { display: none; }
.lb-sheet-head { display: none; }
@media (hover: none) { .lb-nav { display: none; } }
@media (max-width: 860px) {
  .lb { flex-direction: column; }
  .lb-info { width: auto; max-height: 62vh; border-left: 0; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .lb.info-open .lb-main { flex: 1; }
  /* The bar sits below the photo instead of over it, so it never hides part of the picture. */
  .lb-main { display: flex; flex-direction: column; }
  .lb-stage { position: relative; inset: auto; flex: 1; min-height: 0; }
  .lb-caption { position: static; padding: 0.625rem 0.75rem max(0.75rem, env(safe-area-inset-bottom)); background: #111; border-top: 1px solid #262626; }
  .lb-fact { min-height: 2.5rem; font-size: 0.9375rem; }
  .lb-sheet-head { display: flex; align-items: center; gap: 0.625rem; position: sticky; top: 0; z-index: 2; padding: 0.875rem 1rem 0.625rem; background: var(--bg); border-bottom: 1px solid var(--line); touch-action: none; }
  .lb-sheet-head .grab { position: absolute; top: 0.3125rem; left: 50%; width: 2.5rem; height: 0.25rem; margin-left: -1.25rem; border-radius: 2px; background: var(--line); }
  .lb-sheet-title { flex: 1; font-size: 1rem; }
  .lb-done { min-height: 2.25rem; padding: 0.25rem 1.125rem; border-radius: 999px; }
}
.info { padding: 1rem; display: grid; gap: 0.875rem; }
.field { display: grid; gap: 0.25rem; }
.lbl { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-2); }
.lbl-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 1.375rem; }
.save-state { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; font-weight: 600; color: var(--fg-2); transition: opacity .5s ease; }
.save-state .icon { width: 0.9375rem; height: 0.9375rem; stroke-width: 3; }
.save-state.saved { color: var(--ok); animation: saved-pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.save-state.saved .icon path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: saved-draw .35s .1s ease-out forwards; }
.save-state.gone { opacity: 0; }
.save-state.error { color: var(--danger); }
.save-btn { min-height: 1.375rem; padding: 1px 0.625rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--accent); color: var(--accent-fg); border: 0; animation: saved-pop .2s ease-out; }
/* The countdown before a change is saved ("Saving in 5"): tap it to save now. Big enough to hit on a phone. */
.save-state.counting .save-btn { min-height: 2rem; margin: -0.3125rem 0; padding: 0 0.875rem; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .save-state.counting .save-btn { min-height: 2.5rem; margin: -0.5rem 0; padding: 0 1rem; } }
.spinner { width: 0.6875rem; height: 0.6875rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes saved-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes saved-draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .save-state, .save-state *, .save-btn { animation: none !important; stroke-dashoffset: 0 !important; } }
.hint { color: var(--fg-2); font-size: 0.8125rem; }
.field.provisional input, .field.provisional textarea, .chips.provisional { border-bottom: 2px dotted var(--prov); }
.prov-note { color: var(--prov); font-size: 0.75rem; }
.place-details { margin-top: 0.375rem; }
.place-details summary { cursor: pointer; color: var(--fg-2); font-size: 0.8125rem; }
.place-details[open] { display: grid; gap: 0.625rem; }
.chip-input { position: relative; }
.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; align-items: center; padding: 0.375rem; border: 1px solid var(--line); border-radius: 8px; min-height: 2.625rem; }
.chips input { flex: 1; min-width: 7.5rem; border: 0; padding: 0.25rem; box-shadow: none !important; background: transparent; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 0.1875rem 0.25rem 0.1875rem 0.625rem; border-radius: 999px; background: var(--bg-3); font-size: 0.875rem; }
.chip button { border: 0; background: none; min-height: 0; padding: 0 0.3125rem; font-size: 1rem; line-height: 1; color: var(--fg-2); }
.info-actions { display: grid; gap: 0.625rem; padding-top: 0.25rem; border-top: 1px solid var(--line); padding-top: 0.875rem; }
.dl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.375rem; }
.dl-head .link { font-size: 0.8125rem; }
.dl-group { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.dl-btn { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.2; padding-top: 0.375rem; padding-bottom: 0.375rem; }
.dl-btn small { font-size: 0.75rem; font-weight: 400; opacity: .75; }
.tool-group { display: flex; gap: 0.25rem; }
.tool-group .danger { margin-left: auto; color: var(--danger); }
.banner { margin: 0; padding: 0.5rem 0.75rem; border-radius: 8px; background: color-mix(in srgb, var(--danger) 14%, transparent); }
.history summary { cursor: pointer; color: var(--fg-2); font-size: 0.8125rem; }
.history ul { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.375rem; font-size: 0.8125rem; }
.history li small { color: var(--fg-2); }
.history li.reverted { text-decoration: line-through; opacity: .6; }
.history li.provisional { color: var(--prov); }
.meta { color: var(--fg-2); font-size: 0.75rem; margin: 0; }

/* ---------- dialogs & toasts ---------- */
dialog.dlg { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(30rem, calc(100% - 1.5rem)); background: var(--bg); color: var(--fg); box-shadow: var(--shadow); }
dialog.dlg::backdrop { background: rgba(0,0,0,.45); }
dialog.dlg form { padding: 1.125rem; display: grid; gap: 0.75rem; }
dialog.dlg h2 { margin: 0; font-size: 1.125rem; }
.dlg-body { display: grid; gap: 0.625rem; max-height: 65vh; overflow: auto; }
.dlg-body p { margin: 0; }
.dlg-body progress { width: 100%; }
.dlg-actions { display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }
.bulk { display: grid; gap: 0.75rem; }
#toast { position: fixed; z-index: 100; left: 50%; bottom: calc(var(--bottom-h) + 5rem + env(safe-area-inset-bottom)); transform: translate(-50%, 1.25rem); opacity: 0; pointer-events: none;
  padding: 0.625rem 1rem; border-radius: 10px; background: var(--fg); color: var(--bg); transition: all .2s ease; max-width: calc(100% - 2rem); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }

/* ---------- pages ---------- */
.page { max-width: 47.5rem; margin: 0 auto; padding: 1rem 1rem 3.75rem; }
.page.wide { max-width: 75rem; }
.page h1 { font-size: 1.5rem; margin: 0.5rem 0 0.875rem; }
.page-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.page-head h1 { margin-right: auto; }
.search-people { max-width: 16.25rem; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: grid; gap: 0.625rem; margin-bottom: 0.875rem; }
.card h2 { margin: 0; font-size: 1rem; }
.row-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 3rem 1rem; text-align: center; cursor: pointer; transition: all .15s; }
.drop.over, .drop:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.drop p { margin: 0.25rem 0; color: var(--fg-2); }
.up-stopped { border-color: var(--danger, #c0392b); }
.up-stopped p { margin: 0.375rem 0 0; }
.drop .big { font-size: 1.25rem; color: var(--fg); font-weight: 600; }
.up-summary { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.875rem 0; }
.up-summary p { margin: 0; }
.up-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; font-size: 0.875rem; }
.up-item { display: flex; gap: 0.625rem; padding: 0.375rem 0.5rem; border-radius: 6px; background: var(--bg-2); }
.up-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item .status { color: var(--fg-2); text-align: right; }
.up-item.done .status { color: #2a9d55; }
.up-item.error { flex-wrap: wrap; }
.up-item.error .status { color: var(--danger); white-space: normal; text-align: left; flex: 1 1 100%; order: 3; } /* under the file name, which stays visible */
.up-item .see { white-space: nowrap; }
.up-item .retry { white-space: nowrap; font-weight: 600; }
.up-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; flex-wrap: wrap; }
.up-head h1 { margin-right: auto; }
.name-dup-all { display: inline-flex; gap: 0.375rem; align-items: center; }

.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr)); gap: 1.125rem 0.75rem; }
.person { display: grid; justify-items: center; gap: 2px; text-align: center; }
.person-link { display: grid; justify-items: center; gap: 0.25rem; color: var(--fg); text-decoration: none; }
.avatar { width: 6.875rem; height: 6.875rem; border-radius: 999px; overflow: hidden; background: var(--bg-3); display: grid; place-items: center; font-size: 2.5rem; color: var(--fg-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person small { color: var(--fg-2); font-size: 0.75rem; }
@media (max-width: 500px) { .people-grid { grid-template-columns: repeat(3, 1fr); } .avatar { width: 5.5rem; height: 5.5rem; } }
button.person-link { background: none; border: 0; padding: 0; min-height: 0; white-space: normal; }
button.person-link:hover:not(:disabled) { background: none; }
.person.picked .avatar { outline: 4px solid var(--accent); outline-offset: 2px; }
.person.picked strong { color: var(--accent); }
.people-pick-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 0.625rem; flex-wrap: wrap;
  margin: 0.5rem 0 0.875rem; padding: 0.5rem 0.75rem; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.people-pick-bar[hidden] { display: none; }

.subtabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 0.875rem; overflow-x: auto; }
.subtabs a { padding: 0.5rem 0.75rem; color: var(--fg-2); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.subtabs a.active { color: var(--accent); border-color: var(--accent); }
.table-wrap { overflow-x: auto; }
table.devices { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.devices th { text-align: left; font-size: 0.75rem; color: var(--fg-2); font-weight: 600; padding: 0.375rem 0.5rem; border-bottom: 1px solid var(--line); }
table.devices td { padding: 0.625rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.devices tr.blocked { opacity: .55; }
table.devices tr.untrusted td:nth-child(2) { color: var(--prov); }
div.actions { display: flex; flex-wrap: wrap; gap: 0.25rem; }
div.actions button { padding: 0.25rem 0.625rem; min-height: 1.875rem; font-size: 0.8125rem; }
.tag { display: inline-block; margin-left: 0.375rem; padding: 0 0.375rem; border-radius: 4px; background: var(--bg-3); font-size: 0.6875rem; color: var(--fg-2); }
.edit-log { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.edit-log li { display: flex; gap: 0.625rem; align-items: center; padding: 0.5rem; border-radius: 8px; background: var(--bg-2); font-size: 0.875rem; }
.edit-log li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.edit-log img, .edit-log .ph { width: 3.25rem; height: 3.25rem; object-fit: cover; border-radius: 6px; flex: none; display: grid; place-items: center; background: var(--bg-3); }
.edit-log li.reverted { opacity: .55; }
.edit-log li.reverted .new { text-decoration: line-through; }
.edit-log .old { color: var(--fg-2); }
.edit-log li small { color: var(--fg-2); }
.trash { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; }
.trash-item { display: grid; gap: 0.375rem; }
.trash-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.trash-item div { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.trash-item button { padding: 0.25rem 0.5rem; min-height: 1.875rem; font-size: 0.8125rem; }

/* ---------- faces ---------- */
.face-row { display: flex; flex-wrap: wrap; gap: 0.625rem 1rem; padding: 0.25rem 0 0 0.375rem; }
.face-chip { display: grid; justify-items: center; gap: 0.1875rem; padding: 0; border: 0; background: none; min-height: 0; width: 4rem; font-size: 0.75rem; color: var(--fg); }
.face-chip img { width: 3.5rem; height: 3.5rem; border-radius: 50%; object-fit: cover; border: 2px solid transparent; background: var(--bg-3); }
.face-chip span { max-width: 4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.face-chip.named img { border-color: var(--ok); }
.face-chip.suggested img { border: 2px dashed var(--accent); }
.face-chip.suggested span { color: var(--accent); }
.face-chip.unknown img { border: 2px dashed var(--fg-2); }
.face-chip.unknown span { color: var(--fg-2); }
.lb-faces { position: absolute; inset: 0; pointer-events: none; }
.lb-stage.zoomed .lb-faces { display: none; }
.face-outline { position: absolute; border: 3px solid #ffd54a; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 0 12px rgba(255,213,74,.55); }
/* Where someone was marked (no face found for them): a small ring, shown only while pointing at their name. */
.point-marker { position: absolute; width: 1.375rem; height: 1.375rem; margin: -0.6875rem 0 0 -0.6875rem; border: 3px solid #ffd54a; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 0 10px rgba(255,213,74,.6), inset 0 0 0 1px rgba(0,0,0,.4); }
.point-marker::after { content: ""; position: absolute; left: 50%; top: 50%; width: 0.25rem; height: 0.25rem; margin: -2px 0 0 -2px; border-radius: 50%; background: #ffd54a; }
.lb-stage.marking, .lb-stage.marking img { cursor: crosshair; }
.lb-mark { position: absolute; z-index: 5; top: calc(max(0.5rem, env(safe-area-inset-top)) + 3.25rem); left: 50%; transform: translateX(-50%); max-width: calc(100% - 2rem);
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: center; padding: 0.5rem 0.625rem 0.5rem 1rem; border-radius: 999px; background: rgba(20,20,20,.88); color: #fff; font-size: 0.875rem; box-shadow: 0 4px 18px rgba(0,0,0,.45); }
.lb-mark[hidden] { display: none; }
.lb-mark button { min-height: 2rem; padding: 0.25rem 0.75rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; font-size: 0.8125rem; }
.lb-mark button:hover { background: rgba(255,255,255,.15); }
.chip .chip-pin { display: inline-grid; place-items: center; padding: 0 0.1875rem; color: var(--fg-2); opacity: .55; }
.chip .chip-pin .icon { width: 0.9375rem; height: 0.9375rem; }
.chip .chip-pin:hover, .chip .chip-pin:focus-visible { opacity: 1; color: var(--accent); }
.chip .chip-pin.set { opacity: 1; color: var(--accent); }
.lb-top .icon-btn.on { background: rgba(255,255,255,.25); }
.scan-pill { position: fixed; left: 0.75rem; bottom: calc(var(--bottom-h) + 0.75rem + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.875rem; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 0.8125rem; }
.face-dialog { display: grid; gap: 0.75rem; justify-items: center; }
.face-dialog .field { width: 100%; }
.face-big { width: 10rem; height: 10rem; border-radius: 12px; object-fit: cover; background: var(--bg-3); }
.group-dialog { display: grid; gap: 0.625rem; }
.pick-bar { display: flex; align-items: center; gap: 0.875rem; flex-wrap: wrap; font-size: 0.875rem; }
.pick-bar .muted { margin-right: auto; }
.filters-form { display: grid; gap: 0.75rem; }
.filters-form select { width: 100%; }
/* Rows sized by their faces (max-content), not squeezed to fit the capped height: with many faces the grid scrolls
   instead of the squares overlapping. */
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 0.375rem; max-height: 42vh; overflow: auto; padding: 2px; }
dialog.dlg:has(.face-grid) { width: min(45rem, calc(100% - 1.5rem)); }
dialog.dlg:has(.leaders) { width: min(35rem, calc(100% - 1.5rem)); }
.face-pick { padding: 0; min-height: 0; border: 3px solid var(--accent); border-radius: 10px; overflow: hidden; background: var(--bg-3); aspect-ratio: 1; }
.face-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.merge-likely { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; margin: 0.5rem 0 0.75rem; }
.merge-likely .lbl { width: 100%; }
.merge-target { margin: 0.375rem 0 0; }
.dupes-sec { margin-bottom: 1.125rem; }
.dupe-list { display: grid; gap: 0.5rem; }
.dupe { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 0.625rem; padding: 0.5rem 0.625rem; border: 1px solid var(--line); border-radius: 12px; }
.dupe-who { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.dupe-who > span:last-child { display: grid; min-width: 0; }
.dupe-who strong, .dupe-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dupe .avatar.small { width: 2.75rem; height: 2.75rem; font-size: 1.125rem; flex: none; }
.dupe-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.375rem; }
@media (max-width: 700px) { .dupe { grid-template-columns: 1fr 1fr; } .dupe-actions { grid-column: 1 / -1; } }
.cover-pick { max-height: 62vh; overflow: auto; }
.cover-pick .cover-grid { max-height: none; overflow: visible; }
.cover-dec { margin: 0.75rem 0 0.375rem; font-size: 0.9375rem; }
.cover-face { position: relative; border-color: transparent; }
.cover-face.current { border-color: var(--accent); }
.cover-face small { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 0; background: rgb(0 0 0 / .55); color: #fff; font-size: 0.6875rem; text-align: center; }
.cover-row .cover-now { display: flex; align-items: center; gap: 0.75rem; }
.avatar.small { width: 3.5rem; height: 3.5rem; font-size: 1.375rem; }
.face-pick.off { border-color: transparent; opacity: .35; filter: grayscale(1); }
.faces-sec { display: grid; gap: 0.625rem; margin-bottom: 1.75rem; }
.faces-sec:empty { display: none; }
.sec-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
.sec-title h2 { margin: 0; font-size: 1.125rem; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.375rem, 1fr)); gap: 0.875rem; }
.group-card { display: grid; gap: 0.25rem; justify-items: center; padding: 0; min-height: 0; border: 0; background: none; color: var(--fg); text-align: center; }
.group-card small { color: var(--fg-2); }
.mosaic { width: 100%; aspect-ratio: 1; border-radius: 14px; overflow: hidden; display: grid; gap: 2px; background: var(--bg-3); }
.mosaic.n2, .mosaic.n3, .mosaic.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic.n2 img { grid-row: span 2; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 0; }
.group-card:hover, .group-card:focus-visible { background: none; }
.group-card:hover .mosaic, .group-card:focus-visible .mosaic { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) {
  .group-grid { display: flex; overflow-x: auto; gap: 0.625rem; padding: 0.25rem 2px 0.375rem; scroll-snap-type: x proximity; }
  .group-card { flex: 0 0 5.75rem; scroll-snap-align: start; font-size: 0.8125rem; }
}

/* ---------- view-only visitors and share links ---------- */
.signin { flex: none; min-height: 2.25rem; padding: 0.375rem 0.875rem; border-radius: 999px; background: var(--accent); color: var(--accent-fg); border: 0; font-weight: 600; }
.info.read-only .field.ro { display: grid; gap: 2px; }
.ro-val { font-size: 0.9375rem; overflow-wrap: anywhere; }
.ro-caption { margin: 0; white-space: pre-wrap; }
.ro-chips { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.ro-chips a.chip { display: inline-flex; padding: 0.1875rem 0.625rem; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-size: 0.875rem; }
.ro-chips a.chip:hover { border-color: var(--accent); }
a.face-chip { text-decoration: none; color: inherit; }
.share { display: grid; gap: 0.625rem; min-width: min(28.75rem, 100%); }
.share h3 { margin: 0.5rem 0 0; font-size: 0.9375rem; }
.share-make { display: flex; gap: 0.5rem; }
.share-make input { flex: 1; min-width: 0; }
.share-new:not(:empty) { display: grid; gap: 0.5rem; padding: 0.75rem; border-radius: 10px; background: color-mix(in srgb, var(--ok) 12%, transparent); }
.share-new p { margin: 0; }
.share-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; }
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; max-height: 40vh; overflow: auto; }
.share-link { display: grid; grid-template-columns: 1fr auto; gap: 0.375rem 0.625rem; align-items: center; padding: 0.625rem; border: 1px solid var(--line); border-radius: 10px; }
.share-link .share-url { grid-column: 1 / -1; }
.share-link.off { opacity: .6; }
.share-link .actions { display: flex; gap: 0.375rem; }
@media (max-width: 520px) { .share-make { flex-direction: column; } .share-link { grid-template-columns: 1fr; } }

/* ---------- upload: details for the whole batch ---------- */
.batch-card { gap: 0; padding: 0; }
.batch-card > * { padding: 0.75rem 0.875rem; }
.batch-card > * + * { border-top: 1px solid var(--line); }
.batch-details { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.625rem 0.75rem; }
.batch-details .row-buttons { justify-self: end; flex-wrap: nowrap; }
.batch-details-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.batch-details-text small { overflow-wrap: anywhere; }
.batch-details button { flex: none; }

/* Duplicates by appearance: the upload question and Admin → Duplicates */
.look-dup { display: flex; gap: 0.75rem; align-items: flex-start; flex-wrap: wrap; margin-top: 0.5rem; }
.look-dup-new, .look-dup-old > * { display: grid; gap: 0.25rem; justify-items: center; text-align: center; color: inherit; text-decoration: none; font-size: 0.75rem; max-width: 11.25rem; overflow-wrap: anywhere; }
.look-dup-old { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.look-dup img { width: 10.625rem; height: 10.625rem; object-fit: contain; border-radius: 6px; display: block; background: var(--bg-2); }
.dupe-list { display: grid; gap: 0.75rem; }
.dupe-head { margin: 0 0 0.5rem; }
.dupe-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.dupe-photo { display: grid; gap: 0.375rem; align-content: start; }
.dupe-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 8px; background: var(--bg-2); display: block; }
.dupe-photo button { justify-self: start; }
.dupe-facts { font-size: 0.8125rem; overflow-wrap: anywhere; }
.scan-pill.dupe-scan { bottom: calc(var(--bottom-h) + 4rem + env(safe-area-inset-bottom)); }
@media (max-width: 520px) { .look-dup img { width: 8.125rem; height: 8.125rem; } }
/* Possible duplicates waiting for a decision (Upload page) */
.dup-ask { border: 2px solid var(--accent, #1769ff); }
.dup-ask-head { display: flex; align-items: baseline; gap: 0.625rem; flex-wrap: wrap; }
.dup-ask-head h2 { margin: 0; font-size: 1.0625rem; }
.dup-ask-count { color: var(--fg-2); font-size: 0.8125rem; }
.dup-ask .row-buttons { justify-content: flex-end; margin-top: 0.625rem; }
.up-item.ask .status { color: var(--accent, #1769ff); }
a[data-nav="upload"][data-badge] { position: relative; }
a[data-nav="upload"][data-badge]::after { content: attr(data-badge); position: absolute; top: 2px; right: 2px; min-width: 1rem; height: 1rem; padding: 0 0.25rem; border-radius: 8px; background: #1769ff; color: #fff; font-size: 0.6875rem; line-height: 1rem; text-align: center; }
/* "How this site works" */
.about-btn { flex: none; }
.about { max-width: 35rem; }
.about-lead { margin-top: 0; }
.about-sec h3 { font-size: 0.9375rem; margin: 0.875rem 0 0.25rem; }
.about-sec ul { margin: 0; padding-left: 1.25rem; }
.about-sec li { margin: 0.1875rem 0; }
.about-foot { margin-top: 0.875rem; }
.about-link { display: block; margin: 0.625rem auto 0; font-size: 0.8125rem; }
/* Upload page: keep or remove the camera's date and location */
.camera-card { display: grid; gap: 0.375rem; }
.camera-opts { display: flex; gap: 1.125rem; flex-wrap: wrap; }
.camera-opt { display: inline-flex; gap: 0.375rem; align-items: center; cursor: pointer; }
.camera-card p { margin: 0; }

/* Leaderboard: one category under another, a horizontal bar per person */
.leaders { display: grid; gap: 1.25rem; }
.leader h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.leader h3 small { font-weight: 400; font-size: 0.8125rem; }
.leader ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; }
.leader li { display: grid; grid-template-columns: 1.8em minmax(4.375rem, 9em) 1fr 3.5em; align-items: center; gap: 0.5rem; padding: 0.1875rem 0.375rem; border-radius: 6px; font-size: 0.875rem; }
.leader li.you { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.leader .rank { text-align: center; color: var(--fg-2); }
.leader .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader .bar { display: block; min-width: 0; }
.leader .bar span { display: block; height: 0.875rem; border-radius: 0 4px 4px 0; background: var(--accent); }
.leader li:not(.you) .bar span { background: color-mix(in srgb, var(--accent) 70%, transparent); }
.leader li b { font-variant-numeric: tabular-nums; font-size: 0.8125rem; }
@media (max-width: 500px) { .leader li { grid-template-columns: 1.6em minmax(3.75rem, 6.5em) 1fr 2.8em; gap: 0.375rem; } }
.needs-callout { display: flex; align-items: center; gap: 0.625rem 0.875rem; flex-wrap: wrap; justify-content: space-between; }
.needs-callout > div { flex: 1 1 16.25rem; }
.fchip.add-chip { border: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); background: none; padding: 0.25rem 0.75rem; min-height: 0; color: var(--accent); cursor: pointer; }

/* Stars */
.badge.votes { position: absolute; left: 0.375rem; bottom: 0.25rem; display: flex; gap: 0.1875rem; font-size: 0.9375rem; line-height: 1; pointer-events: none; }
.badge.votes .star { color: #ffd34d; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.badge.votes .down { font-size: 0.8125rem; filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
.lb-star { flex: none; align-self: center; display: inline-flex; align-items: center; gap: 0.1875rem; min-height: 2.5rem; padding: 0 0.625rem; border: 0; border-radius: 999px; background: transparent; color: #fff; font-size: 0.875rem; font-weight: 600; }
.lb-star:hover:not(:disabled) { background: rgba(255,255,255,.15); }
.lb-star.on { color: #ffd34d; }
.lb-star.on .icon { fill: currentColor; }
.lb-down.on { color: #ff9a8a; }
.lb-star span:empty { display: none; }

/* Albums */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.625rem, 1fr)); gap: 1.125rem 0.875rem; }
.album-card { display: grid; gap: 0.25rem; }
.album-card a { display: grid; gap: 0.25rem; color: var(--fg); text-decoration: none; }
.album-card small { color: var(--fg-2); font-size: 0.75rem; }
.album-card .link { justify-self: start; font-size: 0.8125rem; }
.album-cover { aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--bg-3); display: grid; place-items: center; color: var(--fg-2); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-cover .icon { width: 2.5rem; height: 2.5rem; }
.album-dialog { display: grid; gap: 0.75rem; }
.album-pick { display: grid; gap: 0.375rem; max-height: 50vh; overflow-y: auto; }
.album-pick button { justify-content: flex-start; gap: 0.625rem; padding: 0.375rem 0.625rem 0.375rem 0.375rem; white-space: normal; text-align: left; }
.album-pick button span { flex: 1; }
.album-pick img, .album-pick .ph { width: 2.75rem; height: 2.75rem; border-radius: 6px; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--bg-3); }
.album-pick small { color: var(--fg-2); }
.album-chips { align-items: center; }
.album-chips .chip a { color: inherit; text-decoration: none; }

/* People groups */
.groups-sec { margin-bottom: 1.125rem; }
.group-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.gchip { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.75rem; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); }
.gchip a { display: grid; color: var(--fg); text-decoration: none; font-weight: 600; }
.gchip a small { font-weight: 400; color: var(--fg-2); font-size: 0.75rem; }
.gchip .link { font-size: 0.8125rem; }
.pick-actions { display: inline-flex; gap: 0.5rem; flex-wrap: wrap; }
.fchip.mode-chip { border: 0; min-height: 0; padding: 0.25rem 0.75rem; background: var(--bg-3); color: var(--fg); cursor: pointer; font-size: 0.8125rem; }

/* What's new and the "since your last visit" dots */
.whats-new { padding-bottom: 0.375rem; border-bottom: 1px solid var(--line); }
.whats-new h3 { margin-top: 0; }
.change { margin: 0.5rem 0 0.625rem; }
.change-head { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.change ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }
.change li { margin: 2px 0; }
.whats-new details summary { cursor: pointer; color: var(--accent); font-size: 0.875rem; margin: 0.375rem 0; }
.new-badge { font-size: 0.6875rem; font-weight: 700; padding: 1px 0.4375rem; border-radius: 999px; background: var(--accent); color: var(--accent-fg); }
.about-title { font-size: 1.0625rem; margin: 1rem 0 0.25rem; }
.has-dot { position: relative; }
.has-dot::after { content: ""; position: absolute; top: 0.3125rem; right: 0.3125rem; width: 0.5625rem; height: 0.5625rem; border-radius: 9px; background: #ff4d4f; box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
nav.side a.has-dot::after { top: 0.25rem; right: 0.25rem; }
nav.bottom a.has-dot::after { top: 0.375rem; right: calc(50% - 1.125rem); }

/* Requests: a better copy, or keep the original */
.badge.votes .req { font-size: 0.75rem; filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
.req-dialog { display: grid; gap: 0.625rem; }
.req-kind { display: flex; gap: 0.625rem; align-items: flex-start; padding: 0.625rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.req-kind:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.req-kind input { width: auto; margin-top: 0.1875rem; }
.req-kind span { display: grid; gap: 2px; }
.req-list { list-style: none; margin: 0.25rem 0 0.5rem; padding: 0; display: grid; gap: 0.375rem; }
.req-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.625rem; }
.req-list li.done, .req-list li.ignored { opacity: .7; }
.req-list q { flex-basis: 100%; color: var(--fg-2); font-style: italic; }
.requests-field .row-buttons { display: flex; flex-wrap: wrap; gap: 0.25rem 0.875rem; }
.req-card { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.125rem; align-items: start; margin-bottom: 1rem; }
.req-card.ignored { opacity: .8; }
.req-pic { display: block; border-radius: 10px; overflow: hidden; background: var(--bg-3); }
.req-pic img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.req-info { display: grid; gap: 0.375rem; min-width: 0; }
.req-info h3 { margin: 0; }
.req-info p { margin: 0; }
.req-caption { white-space: pre-wrap; }
.req-meta { display: grid; grid-template-columns: auto 1fr; gap: 0.1875rem 0.75rem; margin: 0.375rem 0; font-size: 0.875rem; }
.req-meta dt { color: var(--fg-2); }
.req-meta dd { margin: 0; overflow-wrap: anywhere; }
.req-card .row-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.req-status { color: var(--fg-2); }
.req-sec { margin: 1.625rem 0 0.625rem; font-size: 1.125rem; }
.req-done summary { cursor: pointer; color: var(--accent); margin: 1.25rem 0 0.625rem; }
.replace-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; }
.replace-compare figure { margin: 0; display: grid; gap: 0.25rem; }
.replace-compare img { width: 100%; max-height: 40vh; object-fit: contain; background: var(--bg-3); border-radius: 8px; }
.replace-compare figcaption { font-size: 0.8125rem; overflow-wrap: anywhere; }
.replace-compare p { grid-column: 1 / -1; margin: 0.25rem 0 0; }
@media (max-width: 700px) { .req-card { grid-template-columns: 1fr; } }
dialog.dlg:has(.replace-compare) { width: min(47.5rem, calc(100% - 1.5rem)); }
.face-wrap { position: relative; }
.face-yes { position: absolute; top: 2.625rem; right: -0.5625rem; /* bottom right of the 56px face, clear of the next face's ✕ */ width: 1.375rem; height: 1.375rem; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid var(--bg);
  background: var(--ok); color: #0b2416; font-weight: 800; font-size: 0.75rem; line-height: 1; display: grid; place-items: center; cursor: pointer; }
.face-no { position: absolute; top: -0.5rem; left: -0.5625rem; width: 1.375rem; height: 1.375rem; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid var(--bg);
  background: var(--fg-2); color: var(--bg); font-weight: 800; font-size: 0.75rem; line-height: 1; display: grid; place-items: center; cursor: pointer; }
.face-wrap > .face-quick { display: contents; }
.face-yes:hover { filter: brightness(1.1); }
.face-no:hover { background: var(--danger); color: #fff; }
.face-yes:disabled, .face-no:disabled { opacity: .5; }
/* Instant tooltips (data-tip, placed by ui.js) */
.tip { position: fixed; z-index: 1000; pointer-events: none; white-space: nowrap; padding: 0.25rem 0.5rem; border-radius: 6px; background: var(--fg); color: var(--bg);
  font-size: 0.75rem; font-weight: 600; line-height: 1.2; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
/* "Are these …?": each face with "Photo" under it, and the whole photo shown over the dialog */
.face-cell { display: grid; gap: 2px; justify-items: center; }
.face-cell .face-pick { width: 100%; }
.face-photo { font-size: 0.75rem; padding: 0 0.25rem; min-height: 0; }
.photo-peek { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.88); display: grid; place-items: center; align-content: center; gap: 0.625rem; padding: 1rem; cursor: zoom-out; }
.photo-peek-frame { position: relative; line-height: 0; }
.photo-peek-frame img { max-width: calc(100vw - 2rem); max-height: calc(100vh - 5.625rem); object-fit: contain; border-radius: 6px; }
.photo-peek-box { position: absolute; border: 3px solid #ffd54a; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 0 14px rgba(255,213,74,.6); }
.photo-peek-bar { display: flex; gap: 1rem; align-items: center; color: #fff; font-size: 0.875rem; }
.photo-peek-bar a { color: #9db8ff; }
.opt-check { display: flex; gap: 0.5rem; align-items: center; cursor: pointer; } .opt-check input { width: auto; }

/* Questions: an "Ask for help" pill beside a detail's label asks the family for help with it; asked details are highlighted. */
.ask-btn { display: inline-flex; align-items: center; min-height: 1.75rem; margin: -0.25rem auto -0.25rem 0.375rem; padding: 0 0.625rem; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--fg-2); font-size: 0.8125rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.ask-btn:hover, .ask-btn:focus-visible { color: var(--prov); border-color: var(--prov); background: color-mix(in srgb, var(--prov) 12%, transparent); }
.ask-btn.on { border-color: var(--prov); color: #fff; background: var(--prov); }
.lbl-row:has(.ask-btn) { justify-content: flex-start; }
.lbl-row:has(.ask-btn) > .save-state { margin-left: auto; }
.field.asked { position: relative; padding: 0.5rem 0.625rem 0.625rem; margin: 0 -0.625rem; border-radius: var(--radius); background: color-mix(in srgb, var(--prov) 12%, transparent); box-shadow: inset 3px 0 0 var(--prov); }
.field.asked.flash { animation: q-flash 1.4s ease-out; }
@keyframes q-flash { 0%, 40% { box-shadow: inset 3px 0 0 var(--prov), 0 0 0 3px var(--prov); } 100% { box-shadow: inset 3px 0 0 var(--prov), 0 0 0 3px transparent; } }
.q-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.125rem 0.625rem; font-size: 0.9375rem; }
.q-note q { flex-basis: 100%; font-style: italic; color: var(--fg-2); }
.q-note.answered { padding: 0.375rem 0.5rem; border-radius: 8px; background: color-mix(in srgb, var(--ok) 12%, transparent); }
.q-dialog { display: grid; gap: 0.75rem; }
.q-picks { display: grid; gap: 0.25rem; }
.q-pick { display: flex; align-items: center; gap: 0.625rem; min-height: 2.75rem; padding: 0 0.25rem; cursor: pointer; border-radius: 8px; }
.q-pick:hover { background: var(--bg-2); }
.q-pick input { width: 1.25rem; height: 1.25rem; flex: none; }
.q-pick small { display: inline; }
.q-pill { position: absolute; left: 0.25rem; right: 0.25rem; bottom: 0.25rem; padding: 0.125rem 0.5rem; border-radius: 999px; background: rgba(0,0,0,.66); color: #fff; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: fit-content; max-width: calc(100% - 0.5rem); pointer-events: none; }
.badge.q-badge { position: absolute; right: 0.25rem; top: 0.25rem; font-size: 0.875rem; filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); pointer-events: none; }
.lb-fact.asked { border-color: var(--prov); background: color-mix(in srgb, var(--prov) 45%, rgba(0,0,0,.4)); }
.fchip.answered-chip { background: color-mix(in srgb, var(--ok) 18%, transparent); box-shadow: inset 0 0 0 1px var(--ok); font-weight: 600; }
