:root {
  /* RULING P107: without this the native date-picker glyphs paint black on the dark
     background and the calendar popup opens white — the two controls we do not draw
     ourselves, and the only ones that were still light-mode-only. */
  color-scheme: light dark;
  --bg: #fafaf7;
  --card: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e3dc;
  --line-hover: #b7b3a9;
  --accent: #2a6df4;
  /* RULING P108: ink ON the accent, flipped per palette. White on the dark palette's
     lighter accent measured 2.20:1, against a 4.5:1 requirement. */
  --on-accent: #fff;
  --mark: #ffe27a;
  --chip: #efece4;
  --chip-active: #1a1a1a;
  --on-chip-active: #ffffff;
  /* The letter tiles keep ONE ink in both palettes, because their backgrounds do too
     (see the .tile rules): a tile is a small bright object on the card either way,
     like the favicon it stands in for. */
  --tile-ink: #2b2b2b;
  --danger: #b94f4f;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #14161a;
    --card: #1b1e23;
    --fg: #e7e9ee;
    --muted: #9aa1ad;
    --line: #292d34;
    --line-hover: #414854;
    --accent: #7fb0ff;
    --on-accent: #101216;
    --mark: #6b5200;
    --chip: #23272e;
    --chip-active: #e7e9ee;
    --on-chip-active: #14161a;
    --danger: #ff8a8a;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fafaf7;
  --card: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e3dc;
  --line-hover: #b7b3a9;
  --accent: #2a6df4;
  /* RULING P108: ink ON the accent, flipped per palette. White on the dark palette's
     lighter accent measured 2.20:1, against a 4.5:1 requirement. */
  --on-accent: #fff;
  --mark: #ffe27a;
  --chip: #efece4;
  --chip-active: #1a1a1a;
  --on-chip-active: #ffffff;
  /* The letter tiles keep ONE ink in both palettes, because their backgrounds do too
     (see the .tile rules): a tile is a small bright object on the card either way,
     like the favicon it stands in for. */
  --tile-ink: #2b2b2b;
  --danger: #b94f4f;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
:root[data-theme="dark"] {
  color-scheme: dark;
    --bg: #14161a;
    --card: #1b1e23;
    --fg: #e7e9ee;
    --muted: #9aa1ad;
    --line: #292d34;
    --line-hover: #414854;
    --accent: #7fb0ff;
    --on-accent: #101216;
    --mark: #6b5200;
    --chip: #23272e;
    --chip-active: #e7e9ee;
    --on-chip-active: #14161a;
    --danger: #ff8a8a;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.top { padding: 28px 32px 20px; max-width: 1120px; margin: 0 auto; border-bottom: 1px solid var(--line); }
.top-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.theme-control { position: relative; inline-size: fit-content; display: flex; align-items: center; gap: 8px; }
.theme-control[hidden] { display: none; }
/* Keep the native select interaction, but give its chevron a consistent inset.
   Native arrows ignore select padding and sit against the edge in macOS Chrome. */
.theme-control select { -webkit-appearance: none; appearance: none; font-size: 13px; padding-block: 6px; padding-inline: 12px 34px; min-height: 44px; }
.theme-control::after { content: ""; position: absolute; inset-inline-end: 14px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--fg); border-bottom: 1.5px solid var(--fg); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
@media (forced-colors: active) { .theme-control select { -webkit-appearance: auto; appearance: auto; padding-inline-end: 10px; } .theme-control::after { display: none; } }
.top h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -0.02em; font-weight: 700; }
.top h1 a { color: var(--fg); text-decoration: none; }
.meta { color: var(--muted); font-size: 13px; margin: 0; }
.controls {
  max-width: 960px;
  margin: 0 auto 24px;
  padding: 0 32px;
}
.field { display: flex; flex-direction: column; gap: 4px; flex: 0 1 auto; }
/* The query box takes the whole first row: at 1280px the four filters, the sort and
   the button cannot share one line, and letting them wrap organically stranded "To"
   and "Search" on a second row in an order that read as an afterthought. */
.field.grow { flex: 1 1 280px; }
.field.grow input { width: 100%; }
label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
input, button, select {
  font: inherit;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
}
select { padding: 10px 12px; }
input:focus { border-color: var(--accent); }
input:focus-visible, button:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  font-weight: 600;
}
.chips {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 32px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--fg);
  font-size: 12.5px;
  text-decoration: none;
  border: 1px solid transparent;
  /* A chip label is a domain, and a domain can be one unbroken 48-character token. */
  overflow-wrap: anywhere;
  transition: transform 0.08s ease;
}
.chip:hover { transform: translateY(-1px); }
.chip.active { background: var(--chip-active); color: var(--on-chip-active); }
.chip .count { opacity: 0.6; margin-left: 6px; font-variant-numeric: tabular-nums; }
.total {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 32px 12px;
  color: var(--muted);
  font-size: 0.8rem;
}
main { max-width: 960px; margin: 0 auto; padding: 0 32px 48px; }
.hits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hit {
  display: flex;
  gap: 12px;
  padding: 22px 24px;
  margin: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  break-inside: avoid;
  transition: border-color 0.12s ease;
}
.hit:hover { border-color: var(--line-hover); }
.copy-url {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  align-self: flex-start;
  width: 32px;
  height: 32px;
  padding: 6px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  border-radius: 6px;
}
.copy-url[hidden] { display: none; }
.copy-url:hover { background: var(--chip); color: var(--fg); }
.copy-check { display: none; }
.copy-url.copied { color: var(--accent); }
.copy-url.copied .copy-glyph { display: none; }
.copy-url.copied .copy-check { display: block; }
.copy-feedback:not(:empty) {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 1;
  padding: 4px 8px;
  background: var(--chip);
  color: var(--fg);
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.tile {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex: 0 0 22px;
  border-radius: 4px;
  color: var(--tile-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  overflow: hidden;
  user-select: none;
}
/* Twelve pastels at HSL 62% saturation, 82% lightness, 30 degrees apart. Every one
   clears 7:1 against --tile-ink, so the letter is legible on all of them and in both
   palettes — which is why these are NOT redefined in the dark block. */
.tile.t0 { background: #eeb5b5; }
.tile.t1 { background: #eed1b5; }
.tile.t2 { background: #eeeeb5; }
.tile.t3 { background: #d1eeb5; }
.tile.t4 { background: #b5eeb5; }
.tile.t5 { background: #b5eed1; }
.tile.t6 { background: #b5eeee; }
.tile.t7 { background: #b5d1ee; }
.tile.t8 { background: #b5b5ee; }
.tile.t9 { background: #d1b5ee; }
.tile.t10 { background: #eeb5ee; }
.tile.t11 { background: #eeb5d1; }
/* A vendored service icon in the tile's place: same size, same corner, on a white
   ground in both palettes because the icons are drawn for light backgrounds. The
   padding keeps a square logo off the edge; object-fit keeps a wide one in shape. */
.tile.icon {
  background: #fff;
  border: 1px solid var(--line);
  box-sizing: border-box;
  padding: 2px;
  object-fit: contain;
  display: block;
}
/* Keep the visible icon as the flex item, and choose its variant entirely in CSS. */
.hit > .themed-icon { display: contents; }
.tile.icon.icon-dark { display: none; }
:root[data-theme="dark"] .tile.icon.icon-light { display: none; }
:root[data-theme="dark"] .tile.icon.icon-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .tile.icon.icon-light { display: none; }
  :root:not([data-theme]) .tile.icon.icon-dark { display: block; }
}
/* An icon with a dark-background twin needs no ground: CSS shows the variant drawn
   for the palette in force. */
.tile.icon.themed { background: transparent; border: none; padding: 0; }
/* The same white ground as the tile, for the same reason: GitHub's mark is black and
   the dark palette's chip is nearly black, so without it the icon simply vanishes. */
.chip-icon {
  width: 16px;
  height: 16px;
  vertical-align: -4px;
  margin-right: 6px;
  padding: 1px;
  box-sizing: border-box;
  border-radius: 3px;
  background: #fff;
  object-fit: contain;
}
/* Without this the flex item refuses to shrink below its content, and one long token
   in a title pushes the card past the column. It is the pair to the overflow-wrap
   rules below, not a substitute for either. */
.body { flex: 1 1 auto; min-width: 0; }
/* RULING P103: every element that carries archived page text breaks inside a word.
   .snip is arbitrary body text — a base64 blob, a minified JS line, a pasted url —
   and one unbreakable token in it made the WHOLE document scroll sideways
   (scrollWidth 3369 against clientWidth 1000), pushing every other hit off-screen.
   Reachable from ordinary browsing, not from a crafted attack.

   The line clamps below do NOT replace it. -webkit-line-clamp only ever hides lines
   that have already been laid out, so an unbreakable token still sets the width of
   the line it is on; overflow-wrap is what lets it break in the first place, and the
   clamp is then what hides the rest. Both, or neither works. */
.hit .t {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hit .t a { color: var(--fg); text-decoration: none; }
.hit .t a:hover { color: var(--accent); }
.url {
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Three lines, not the reference's two: db.ts asks snippet() for 20 tokens, which at
   this column width is routinely a little over two lines, and the line the snippet
   exists for is the one carrying the <mark>. Clamping at two cut the highlight off
   the end of the very result it was explaining. */
.snip {
  color: var(--muted);
  font-size: 13.5px;
  margin: 10px 0 0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
mark { background: var(--mark); color: inherit; padding: 0 0.12em; border-radius: 2px; }
.footer {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.footer .domain { overflow-wrap: anywhere; }
.footer .sep { opacity: 0.5; }
.badge { background: var(--chip); border-radius: 999px; padding: 0 0.5em; }
.badge.group { background: var(--cool-wash, var(--chip)); }
.badge.enriched { background: var(--cool-wash, var(--chip)); }
/* RULING Q24. margin-left:auto moves to Remove, so the two end-of-row controls sit
   together at the right rather than one of them stealing the whole gap. The button is
   deliberately quiet — it is destructive, but it is not the thing the eye should land
   on when scanning an archive. */
.reopen { color: var(--accent); text-decoration: none; font-weight: 600; margin-left: auto; }
form.remove { display: inline; margin: 0; }
.remove-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
.remove-btn:hover { color: var(--danger); text-decoration: underline; }
.removed-notice {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 32px 12px;
  font-size: 0.85rem;
  color: var(--muted);
}
.confirm { max-width: 640px; margin: 0 auto; padding: 24px 24px 64px; }
.confirm h2 { font-size: 1.25rem; margin: 0 0 20px; }
.confirm-title { font-weight: 600; font-size: 1.05rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.confirm-url { color: var(--muted); font-size: 0.85rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.confirm-meta { color: var(--muted); font-size: 0.8rem; margin: 0 0 20px; }
.confirm-warn {
  background: rgba(185, 79, 79, 0.12);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.85rem;
  margin: 0 0 20px;
}
.confirm-actions { display: flex; align-items: center; gap: 16px; }
.confirm-actions form { margin: 0; }
button.danger {
  background: var(--danger);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.danger:hover { filter: brightness(1.08); }
.cancel { color: var(--accent); text-decoration: none; }
.cancel:hover { text-decoration: underline; }
.reopen:hover { text-decoration: underline; }
.noreopen { color: var(--muted); font-style: italic; }
.empty { text-align: center; color: var(--muted); padding: 40px; overflow-wrap: anywhere; }
.empty a { color: var(--accent); }
.pager {
  max-width: 960px;
  margin: 0 auto 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.85rem;
}
.pager a { color: var(--accent); text-decoration: none; }
.pager a:hover { text-decoration: underline; }
.pager .page { color: var(--muted); }
.pager .off { color: var(--muted); opacity: 0.45; }
.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--chip-active);
  color: var(--on-chip-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease;
  z-index: 100;
}
.to-top:hover { transform: translateY(-2px); }
a { color: var(--accent); text-underline-offset: 3px; }
.archive-intro { max-width: 960px; margin: 36px auto 26px; padding: 0 32px; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 10px; }
.archive-intro h2 { max-width: 22ch; font-size: clamp(28px, 4vw, 42px); font-weight: 600; line-height: 1.15; letter-spacing: -.045em; margin: 0 0 14px; text-wrap: balance; }
.search-row { display: flex; align-items: end; gap: 10px; }
.search-row .field { flex: 1; min-width: 0; }
.search-row input { min-height: 54px; font-size: 16px; }
.search-row > button { min-height: 54px; padding-inline: 24px; }
.filter-drawer { margin-top: 14px; border-bottom: 1px solid var(--line); }
.filter-drawer summary { padding: 12px 0; min-height: 44px; cursor: pointer; font-size: 13px; font-weight: 600; }
.filter-state { display: inline; margin-left: 12px; color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
.filter-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 12px 0 20px; }
.filter-fields .field { flex: 1 1 160px; min-width: 0; }
.filter-fields input, .filter-fields select { width: 100%; min-width: 0; }
.reset-filters { display: inline-flex; align-items: center; min-height: 44px; padding: 12px 4px; font-size: 13px; }
.filter-fields button { min-height: 44px; }
input, select, textarea { max-width: 100%; }
summary:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
@media (max-width: 560px) {
  .copy-url { display: none; }
  .top { padding: 20px 16px 12px; }
  .top h1 { font-size: 22px; }
  .theme-control select { font-size: 16px; }
  .archive-intro { margin: 24px auto; padding: 0 16px; }
  .controls { padding: 0 16px; }
  .search-row > button { padding-inline: 18px; }
  .filter-fields .field { flex: 1 1 42%; }
  .filter-state { display: block; margin: 4px 0 0 16px; }
  .hit { padding: 18px 14px; gap: 10px; }
  .hit .t { font-size: 16px; }
  input, select, textarea { font-size: 16px; }
  .reopen, .remove-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; }
  .footer { gap: 8px; }
  .chips { padding: 0 16px 10px; }
  .total { padding: 0 16px 8px; }
  main { padding: 0 16px 48px; }
  .pager { padding: 0 16px; }
  /* The filter fields share a row two-up rather than stacking into six full-width
     boxes, which pushed the first result entirely below the fold on a phone. */
  .field { flex: 1 1 45%; }
  .field select, .field input, .field button { width: 100%; }
}

/* ── sign-in page (renderLoginPage) ───────────────────────────────────────────
   Reuses the same tokens as everything above, so it follows the light/dark
   palette without defining a single colour of its own. */
body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.card-auth {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.card-auth .top-heading { flex-direction: column; gap: 8px; margin-bottom: 20px; }
.card-auth h1 { margin: 0 0 8px; font-size: 24px; letter-spacing: -0.02em; }
.card-auth .lead { color: var(--muted); font-size: 14px; margin: 0 0 20px; line-height: 1.5; }
.notice {
  font-size: 13.5px;
  border-radius: 8px;
  padding: 9px 12px;
  margin: 0 0 16px;
  background: var(--chip);
  color: var(--fg);
}
.notice.error { background: rgba(185, 79, 79, 0.12); color: var(--danger); }
form.login { display: flex; flex-direction: column; gap: 10px; }
form.login label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: left;
}
form.login input {
  padding: 12px 14px;
  font-size: 22px;
  /* A six-digit code is read back digit by digit; tabular figures keep the
     glyphs from shifting as it is typed. */
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
}
form.login input:focus { outline: none; border-color: var(--accent); }
form.login button {
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}
form.login button:hover { filter: brightness(1.06); }
form.resend { margin-top: 14px; }
button.link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
}
button.link:hover { color: var(--accent); }

.archive-nav { display:flex; flex-wrap:wrap; gap:6px; margin-top:20px; }
.archive-nav a { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:10px 18px; border-radius:8px; text-decoration:none; color:var(--muted); font-size:14px; }
.archive-nav a:hover { color:var(--fg); background:var(--chip); }
.archive-nav [aria-current] { font-weight:600; background:var(--chip-active); color:var(--on-chip-active); }
.archive-nav [aria-current]:hover { background:var(--chip-active); color:var(--on-chip-active); }
.archive-access { color:var(--muted); font-size:12px; margin:8px 0 0; }
.image-archive { max-width:1120px; margin:36px auto; padding:0 32px 48px; }
.gallery-heading { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:28px; }
.gallery-heading h2 { font-size:38px; letter-spacing:-.04em; line-height:1.15; margin:0 0 12px; }
.capture-link { display:inline-flex; align-items:center; gap:14px; min-height:48px; padding:12px 18px; border:1px solid var(--line); border-radius:10px; text-decoration:none; color:var(--fg); background:var(--card); font-weight:600; font-size:14px; }
.capture-link:hover { border-color:var(--line-hover); }
.image-title { font-size:clamp(26px,4vw,38px); line-height:1.2; letter-spacing:-.035em; overflow-wrap:anywhere; margin:20px 0 28px; }
.back-link { display:inline-flex; align-items:center; min-height:44px; font-size:14px; }
.image-detail-layout { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); gap:32px; align-items:start; }
.image-canvas,.image-details { min-width:0; overflow-wrap:anywhere; }
.image-canvas { padding:20px; background:var(--card); border:1px solid var(--line); border-radius:16px; }
.image-details h2 { font-size:20px; letter-spacing:-.02em; margin:0 0 12px; }
.image-notes { border-top:1px solid var(--line); margin-top:24px; padding-top:24px; }
.image-notes:first-child { margin-top:0; }
.image-details .receipt-details { margin:0 0 24px; }
.product-enrichment { margin-bottom:24px; padding-bottom:24px; border-bottom:1px solid var(--line); }
.image-canvas .meta { overflow-wrap:anywhere; }
.image-filters { display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin-bottom:24px; }
.image-filters button { min-height:44px; }
.image-filters label { flex:1 1 180px; min-width:0; }
.image-filters input,.image-filters select { width:100%; min-width:0; }
.image-filters label,.image-edit label { display:flex; flex-direction:column; gap:6px; }
.image-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,220px),1fr)); gap:24px; }
.image-card { border:1px solid var(--line); border-radius:14px; padding:14px; min-width:0; background:var(--card); }
.image-card img,.image-placeholder { width:100%; height:200px; object-fit:contain; border-radius:8px; }
.image-placeholder { display:flex; align-items:center; justify-content:center; background:var(--card); }
.image-card h2 { font-size:16px; overflow-wrap:anywhere; margin:16px 0 8px; }
.image-card > a { text-decoration:none; color:var(--fg); }
.image-card > a:hover h2 { color:var(--accent); }
.image-card .image-caption { color:var(--muted); font-size:14px; }
.image-caption,.image-context { white-space:pre-wrap; overflow-wrap:anywhere; }
.image-original { display:block; width:auto; max-width:100%; max-height:70vh; margin:20px auto; object-fit:contain; }
.image-actions { display:flex; flex-wrap:wrap; gap:8px 20px; }
.image-actions a,.image-pagination a { display:inline-flex; align-items:center; min-height:44px; }
.camera-preview { display:block; max-width:100%; max-height:300px; margin:16px 0; }
.camera-comment { display:flex; flex-direction:column; gap:6px; }
.camera-comment textarea { font:inherit; color:inherit; background:var(--card); border:1px solid var(--line); border-radius:8px; padding:12px; }
.camera-actions { display:flex; flex-wrap:wrap; gap:12px; margin:12px 0; }
#barcode-video { display:block; width:100%; max-height:360px; background:#000; }
.image-edit { display:flex; flex-direction:column; gap:16px; max-width:650px; margin:24px 0; }
.image-edit textarea { font:inherit; color:inherit; background:var(--card); border:1px solid var(--line); padding:12px; border-radius:8px; }
.image-edit button { align-self:start; }
.image-delete { margin-top:24px; padding-top:24px; border-top:1px solid var(--line); }
.image-pagination { display:flex; gap:24px; margin:24px 0; }
.image-receipts li { margin:12px 0; }
.receipt-details { margin:24px 0; padding:20px; border:1px solid var(--line); border-radius:12px; }
.receipt-items { overflow-x:auto; }
.receipt-items table { width:100%; border-collapse:collapse; }
.receipt-items th,.receipt-items td { padding:10px; border-bottom:1px solid var(--line); text-align:right; }
.receipt-items th:first-child,.receipt-items td:first-child { text-align:left; min-width:160px; }
.pending-preview { width:80px; height:80px; object-fit:contain; vertical-align:middle; margin-right:12px; }
@media (max-width:760px) {
  .image-detail-layout { grid-template-columns:minmax(0,1fr); gap:24px; }
  .image-original { max-height:55dvh; }
  .gallery-heading { align-items:start; flex-direction:column; }
}
@media (max-width:560px) {
  .image-archive { margin:24px auto; padding:0 16px 40px; }
  .image-filters { gap:12px; }
  .image-filters label { flex-basis:100%; }
  .image-filters button { width:100%; min-height:48px; }
  .image-canvas { padding:14px; }
  .gallery-heading h2 { font-size:30px; }
}

.share { --capture-blue:var(--accent); }
.share [hidden] { display:none !important; }
.share .top { max-width:880px; padding:24px 32px 20px; }
.share .top h1 { font-size:21px; letter-spacing:-.04em; }
.share .theme-control { font-size:12px; text-transform:none; letter-spacing:0; }
.share .capture-main { max-width:720px; padding:28px 32px 40px; margin:auto; }
.share label { text-transform:none; letter-spacing:0; font-size:15px; color:var(--fg); }
.share button,.share input,.share textarea { font-size:16px; }
.share button { min-height:48px; }
.share button:disabled { opacity:.5; cursor:default; }
.share .capture-heading { margin:8px 0 24px; }
.share .capture-heading .eyebrow { margin-bottom:12px; }
.share .capture-heading h2 { font-size:clamp(29px,6vw,38px); line-height:1.2; letter-spacing:-.035em; margin:0 0 10px; }
.share .capture-heading p:not(.eyebrow) { color:var(--muted); margin:0; max-width:42ch; }
.share .capture-entry { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.share .photo-picker,.share .scan-entry { display:flex; align-items:center; gap:12px; min-height:100px; padding:20px 16px; text-align:left; border:1px solid var(--line); border-radius:14px; font-weight:600; cursor:pointer; }
.share .photo-picker { background:var(--card); }
.share .scan-entry { background:var(--capture-blue); color:var(--on-accent); border-color:var(--capture-blue); }
.share .capture-entry small { display:block; font-size:12px; font-weight:400; margin-top:4px; }
.share .photo-picker small { color:var(--muted); }
.share .capture-symbol,.share .barcode-symbol { width:28px; height:28px; flex-shrink:0; }
.share .photo-picker:has(+input:focus-visible) { outline:3px solid var(--accent); outline-offset:3px; }
.share .capture-status { margin:16px 0; font-size:14px; color:var(--muted); overflow-wrap:anywhere; }
.share .capture-status[data-error=true],.share .capture-error { color:var(--fg); background:var(--card); border-left:3px solid #ba4444; padding:12px 16px; }
.share .draft-workspace { border-top:1px solid var(--line); padding-top:16px; }
.share .draft-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.share .draft-heading h3 { font-size:18px; margin:0; }
.share .quiet-button { border:0; background:transparent; color:var(--muted); font-size:13px; padding:10px 0 10px 10px; }
.share .camera-preview { display:block; width:100%; max-height:300px; object-fit:contain; margin:16px 0; border-radius:12px; background:var(--card); }
.share .draft-tools { display:flex; flex-wrap:wrap; gap:10px; margin:16px 0; }
.share .secondary-button { background:var(--card); color:var(--fg); border-color:var(--line); font-size:14px; }
.share .camera-comment { font-weight:600; }
.share .camera-comment textarea { width:100%; font-size:16px; font-weight:400; line-height:1.55; min-height:120px; resize:vertical; }
.share textarea:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.share .draft-hint { font-size:12px; color:var(--muted); margin:10px 0; }
.share .camera-actions { position:sticky; bottom:0; margin:16px 0 24px; padding:10px 0 calc(10px + env(safe-area-inset-bottom)); background:var(--bg); }
.share #camera-save { width:100%; background:var(--capture-blue); border-color:var(--capture-blue); color:var(--on-accent); min-height:54px; }
.share .barcode-result { border-left:3px solid #338563; padding:12px 16px; background:var(--card); }
.share .barcode-result>span { font-size:13px; color:var(--muted); }
.share .barcode-result strong { display:block; font-size:23px; font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric:tabular-nums; letter-spacing:.015em; overflow-wrap:anywhere; line-height:1.35; margin:4px 0; }
.share .barcode-result p { font-size:13px; margin:0; color:var(--muted); overflow-wrap:anywhere; }
.share .capture-footer { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; padding:20px 0; border-top:1px solid var(--line); }
.share .capture-footer a { display:inline-flex; align-items:center; min-height:44px; }
.share #settings > summary { min-height:44px; padding:12px 0; cursor:pointer; }
.share .capture-footer span { font-size:12px; color:var(--muted); }
.share #settings { padding:12px 0; color:var(--muted); }
.share #token-form { display:flex; flex-wrap:wrap; gap:12px; margin:12px 0; }
.share #token-form label { flex-basis:100%; display:grid; gap:8px; }
.share #token { width:100%; }
.share .image-receipts { margin:28px 0; }
.share .image-receipts h2 { font-size:19px; margin:0 0 6px; }
.share #image-results { list-style:none; padding:0; }
.share #image-results li { border-bottom:1px solid var(--line); padding:12px 0; }
.share .visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.share .scan-dialog { position:fixed; inset:0; width:100%; max-width:720px; height:100%; height:100dvh; max-height:100dvh; margin:auto; padding:0; border:0; border-radius:0; background:var(--bg); color:var(--fg); }
.share .scan-dialog[open] { display:flex; flex-direction:column; }
.share .scan-dialog::backdrop { background:rgba(6,14,25,.85); }
.share .scan-top { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:calc(18px + env(safe-area-inset-top)) 20px 18px; }
.share .scan-top h2 { font-size:22px; margin:0; }
.share #barcode-state { font-size:13px; color:var(--muted); margin:5px 0 0; max-width:45ch; }
.share .scan-dialog button { background:var(--card); color:var(--fg); border-color:var(--line-hover); padding:10px 18px; }
.share #barcode-cancel { flex-shrink:0; }
.share .scan-viewfinder { position:relative; flex:1; min-height:180px; background:#060e19; overflow:hidden; }
.share #barcode-video { width:100%; height:100%; max-height:none; object-fit:contain; }
.share .scan-guide { pointer-events:none; position:absolute; inset:0; margin:auto; border:2px solid #c5dfff; border-radius:12px; }
.share .scan-bottom { overflow-y:auto; max-height:45dvh; padding:18px 20px calc(20px + env(safe-area-inset-bottom)); }
.share #barcode-help { margin:0 0 12px; color:var(--muted); font-size:14px; max-width:54ch; }
.share #barcode-focus-status { font-size:13px; color:var(--muted); margin:12px 0; }
.share .scan-camera-controls { display:flex; flex-wrap:wrap; align-items:center; gap:18px; }
.share #barcode-zoom-control { display:flex; align-items:center; gap:10px; flex:1; color:var(--fg); }
.share #barcode-zoom { min-width:100px; width:100%; accent-color:var(--accent); padding:0; min-height:44px; }
.share #barcode-camera-control,.share #barcode-focus-control { display:flex; align-items:center; gap:10px; color:var(--fg); font-size:14px; margin:10px 0; }
.share #barcode-camera { min-width:0; flex:1; font-size:16px; }
.share #barcode-focus { flex:1; width:100%; min-height:44px; accent-color:var(--accent); padding:0; }
.share .scan-confirmation { margin:auto; padding:24px; width:100%; text-align:center; overflow-y:auto; }
.share .scan-confirmation h3 { font-size:24px; margin:0 0 16px; }
.share #barcode-candidate { display:block; font:26px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.share #barcode-candidate-format { font-size:13px; color:var(--muted); }
.share .scan-confirmation>div { display:flex; flex-wrap:wrap; justify-content:center; gap:12px; margin:24px 0; }
.share #barcode-use { background:var(--accent); color:var(--on-accent); border-color:var(--accent); }
.share #barcode-retry,.share #barcode-read-photo { margin:6px 8px 0 0; }
@media (max-width:560px) { .share .top { padding:18px 16px 8px; } .share .capture-main { padding:12px 16px 32px; } .share .capture-entry { gap:8px; } .share .photo-picker,.share .scan-entry { flex-direction:column; align-items:flex-start; padding:16px 12px; gap:8px; } }
@media (max-height:480px) { .share .scan-top { padding:10px 16px; } .share .scan-bottom { overflow-y:auto; max-height:45dvh; padding:10px 16px; } .share .scan-viewfinder { min-height:100px; } .share #barcode-help { font-size:12px; margin-bottom:6px; } }
