/* PotteryDave — warm, earthy, calm. Light + dark. */
:root {
  --bg: #f6f1ea;
  --surface: #fffdf9;
  --surface-2: #efe7dc;
  --line: #e0d5c7;
  --text: #2b2420;
  --muted: #736558;
  --accent: #a9502b;        /* terracotta */
  --accent-ink: #ffffff;
  --accent-soft: #f4e0d5;
  --ok: #4f7a52;
  --warn: #a8761a;
  --danger: #a33b32;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
  --tabbar-h: 64px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1916;
    --surface: #26211d;
    --surface-2: #312a25;
    --line: #3d352f;
    --text: #efe6dc;
    --muted: #a8998c;
    --accent: #e0835a;
    --accent-ink: #1d1916;
    --accent-soft: #3d2a20;
    --ok: #8fbf8f;
    --warn: #e0b35a;
    --danger: #ef7d73;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* Nothing should ever make the page scroll sideways on a phone. clip (unlike hidden) keeps sticky headers working. */
html, body { overflow-x: clip; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
body.public { padding-bottom: 24px; }
body.public .tabbar { display: none; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 8px; align-items: center; text-decoration: none; color: var(--text); font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.brand img { border-radius: 7px; }
.topbar-actions { display: flex; gap: 8px; }

main { max-width: 760px; margin: 0 auto; padding: 16px; outline: none; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 500;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--accent); }
.tabbar .tab-new svg { background: var(--accent); color: var(--accent-ink); border-radius: 50%; padding: 4px; width: 32px; height: 32px; }

/* Cards & lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.section { margin-top: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; color: inherit; text-decoration: none; }
.list-item .title { font-weight: 600; }
.chev { color: var(--muted); margin-left: auto; }
/* Live request #39: the shared glaze list has an Add button beside each row */
.sg-row { display: flex; align-items: center; gap: 10px; }
.sg-row > .list-item { min-width: 0; }
.sg-add { flex: none; white-space: nowrap; }

.piece-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.piece {
  display: block; text-decoration: none; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.piece .thumb { aspect-ratio: 4 / 5; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.piece .thumb img { width: 100%; height: 100%; object-fit: cover; }
.piece .thumb svg { width: 44%; opacity: .35; }
.piece .meta { padding: 10px 12px 12px; }
.piece .meta .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filters button { flex: none; }

/* Buttons */
button, .btn {
  font: inherit; font-weight: 600; font-size: .95rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
}
button:disabled { opacity: .5; cursor: default; }
.btn-primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost, button.ghost { background: transparent; border-color: transparent; }
button.danger { color: var(--danger); }
button.small, .btn.small { min-height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 10px; }
button.pill { border-radius: 999px; min-height: 36px; font-size: .85rem; }
button.pill.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-block { width: 100%; }
.icon-btn { min-width: 44px; padding: 0; }

/* Forms */
form .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
label, .label { font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 16px; /* prevents iOS zoom */
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text);
}
textarea { min-height: 88px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[type=color] { padding: 4px; width: 56px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
.hint { font-size: .8rem; color: var(--muted); }
.form-error { color: var(--danger); font-size: .9rem; margin: 8px 0; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented label { margin: 0; position: relative; }
/* The real radio buttons are hidden behind the pill labels. Keep them tiny: at full width they stuck out past
   the right edge of the screen and let the whole page scroll sideways on phones (live request #6). */
.segmented input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 38px; border-radius: 9px; font-size: .9rem; color: var(--text); cursor: pointer; text-align: center; padding: 0 6px; }
.segmented input:checked + span { background: var(--surface); box-shadow: var(--shadow); font-weight: 700; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

/* Project detail */
.hero { border-radius: var(--radius); overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; margin-bottom: 12px; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.fact { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.fact .k { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.fact .v { font-weight: 600; }

/* Stage stepper */
.stepper { list-style: none; margin: 0; padding: 0; position: relative; }
.stepper li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 8px 0; position: relative; }
.stepper li::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: -8px; width: 2px; background: var(--line); }
.stepper li:last-child::before { display: none; }
.stepper .node { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: .75rem; z-index: 1; }
.stepper li.done .node { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper li.done::before { background: var(--accent); }
.stepper li.current .node { box-shadow: 0 0 0 4px var(--accent-soft); }
.stepper li.skipped .node { border-style: dashed; }
.stepper .name { font-weight: 600; }
.stepper li:not(.done) .name { color: var(--muted); font-weight: 500; }
.stepper .when { font-size: .85rem; color: var(--muted); }

.treat { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.treat:first-child { border-top: 0; }
.swatch { width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(0,0,0,.12); background: var(--surface-2); }
.swatch-img { display: block; object-fit: cover; flex: none; } /* live request #25: a glaze's own picture */
.layers { display: inline-flex; align-items: center; gap: 4px; }
.layers button { min-height: 30px; min-width: 30px; padding: 0; border-radius: 8px; }

.photo-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photo-strip button { padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); min-height: 0; }
.photo-strip img { width: 100%; height: 100%; object-fit: cover; }
/* Request #5: cover photo */
.photo-strip button { position: relative; }
.photo-strip .is-cover { outline: 3px solid var(--accent); outline-offset: -3px; }
.cover-badge { position: absolute; left: 6px; bottom: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
.cover-pick button[aria-checked="true"] { outline: 4px solid var(--accent); outline-offset: -4px; }
.cover-pick button[aria-checked="true"]::after { content: '✓'; position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.cover-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; flex: none; }
.upsell { background: var(--accent-soft); border: 1px dashed var(--accent); border-radius: var(--radius); padding: 14px; }

/* Catalog */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs a { padding: 10px 12px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--accent); }

/* Modal (native dialog) */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 48px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(20, 12, 6, .45); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
dialog .dlg-body { padding: 16px; }
dialog .dlg-foot { padding: 12px 16px 16px; display: flex; gap: 8px; justify-content: flex-end; }
dialog.viewer { width: auto; max-width: 96vw; background: #000; }
dialog.viewer img { max-height: 80dvh; width: auto; margin: 0 auto; }

/* Share preview */
.share-preview { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.share-preview canvas, .share-preview img { flex: none; width: 180px; height: 225px; border-radius: 8px; box-shadow: var(--shadow); scroll-snap-align: start; object-fit: cover; }
.caption-box { font-size: .9rem; white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: 12px; }

/* Toast & misc */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 50; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.error { background: var(--danger); color: #fff; }
.offline-pill { position: fixed; top: calc(60px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: var(--warn); color: #fff; font-size: .8rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; z-index: 20; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { width: 72px; height: 72px; opacity: .4; margin: 0 auto 8px; display: block; }
.auth-wrap { max-width: 400px; margin: 5vh auto 0; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.plan-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.kbd-note { font-size: .8rem; color: var(--muted); margin-top: 6px; }

@media (min-width: 720px) {
  main { padding: 24px; }
  /* Live request #36: admin pages use more of a wide screen. */
  body.wide main { max-width: 1200px; }
  .piece-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Help assistant ---------- */
.help-fab {
  position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 15;
  width: 52px; height: 52px; min-height: 0; padding: 0; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(60, 40, 20, .18); color: var(--accent);
}
.help-fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
dialog.chat { display: flex; flex-direction: column; width: min(520px, calc(100vw - 16px)); height: min(680px, calc(100dvh - 32px)); max-height: none; }
dialog.chat:not([open]) { display: none; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 85%; padding: 9px 12px; border-radius: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.msg.bot .bubble { background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.user .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.bubble code, pre.code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; }
.msg-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chat-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 8px; max-height: 38%; overflow-y: auto; }
.chat-chips button { min-height: 36px; text-align: left; }
.chat-input { display: flex; gap: 8px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.chat-input input { flex: 1; min-width: 0; }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- Requests & admin ---------- */
.req-list { padding-top: 4px; padding-bottom: 4px; }
.req { padding: 12px 0; }
.reply { margin-top: 8px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: .92rem; }
.chip.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
pre.code { white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: 12px; font-size: .8rem; overflow-x: auto; max-height: 420px; }
.transcript { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
details summary { cursor: pointer; padding: 6px 0; }
.list.card { padding-left: 16px; padding-right: 16px; }

/* ---------- Review Claude's work ---------- */
:root { --add-bg: #e3f3e1; --add-ink: #1f5b25; --del-bg: #fbe3df; --del-ink: #8c2a1f; }
@media (prefers-color-scheme: dark) { :root { --add-bg: #1f3a22; --add-ink: #a9dfa9; --del-bg: #43211c; --del-ink: #f2aba2; } }
.review.deciding { border: 2px solid var(--accent); }
.banner { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; font-size: .92rem; }
.summary { background: var(--surface-2); border-radius: 10px; padding: 4px 14px; margin: 4px 0 12px; }
.summary p, .summary ul { margin: 10px 0; }
.summary h3 { margin: 12px 0 4px; font-size: 1rem; }
.test-badge { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-weight: 700; border-radius: 10px; padding: 10px 12px; }
.test-badge.pass { background: var(--add-bg); color: var(--add-ink); }
.test-badge.fail { background: var(--del-bg); color: var(--del-ink); }
.test-badge .small { font-weight: 500; }
.warn-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: .9rem; }
.warn-list li { padding: 6px 0; }
.changed-files { list-style: none; padding: 0; margin: 6px 0 8px; }
.changed-files li { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--line); }
.changed-files li:first-child { border-top: 0; }
.diffstat { margin-left: auto; font: 600 .8rem ui-monospace, Menlo, monospace; white-space: nowrap; }
.diffstat .plus { color: var(--add-ink); } .diffstat .minus { color: var(--del-ink); }
details.exact > summary { font-weight: 600; color: var(--accent); }
.diff-file { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; overflow: hidden; }
.diff-file > summary { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 8px 10px; background: var(--surface-2); }
.diff { font: .78rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; max-height: 520px; overflow-y: auto; }
.dl { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0 10px 0 1.8em; text-indent: -1.4em; }
.dl .sign { display: inline-block; width: 1.4em; text-align: center; opacity: .7; user-select: none; }
.dl.add { background: var(--add-bg); color: var(--add-ink); }
.dl.del { background: var(--del-bg); color: var(--del-ink); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--del-ink) 40%, transparent); }
.dl.ctx { color: var(--muted); }
.dl.hunk { color: var(--muted); background: var(--surface-2); font-style: italic; padding: 4px 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.decide { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.decide button { flex: 1 1 auto; }

/* Pounds + ounces weight entry (request #2) */
fieldset.lboz { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
fieldset.lboz legend { padding: 0; margin-bottom: 4px; }
.unit-input { position: relative; display: block; margin: 0; }
.unit-input input { padding-right: 38px; }
.unit-input span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; font-size: .9rem; pointer-events: none; }
/* Shared clay list (request #1) */
.suggest { display: block; background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
a.suggest:hover { filter: brightness(0.98); }
.chip.small { font-size: .7rem; padding: 2px 8px; vertical-align: middle; }

/* Request #7: colour theme picker */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.theme-swatch { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; width: 100%; padding: 6px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); min-height: 0; text-align: left; }
.theme-swatch[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.sw-preview { position: relative; display: block; height: 58px; border-radius: 8px; background: var(--sw-bg); padding: 7px; overflow: hidden; }
.sw-card { display: flex; flex-direction: column; gap: 4px; height: 100%; width: 72%; background: var(--sw-surface); border: 1px solid var(--sw-line); border-radius: 6px; padding: 5px; }
.sw-line { display: block; height: 4px; width: 80%; border-radius: 2px; background: var(--sw-text); opacity: .75; }
.sw-line.short { width: 50%; opacity: .4; }
.sw-btn { display: block; margin-top: auto; height: 8px; width: 55%; border-radius: 4px; background: var(--sw-accent); }
.sw-chip { position: absolute; right: 7px; top: 7px; width: 16px; height: 16px; border-radius: 50%; background: var(--sw-soft); border: 3px solid var(--sw-accent); }
.sw-name { font-size: .85rem; font-weight: 600; padding: 0 2px; }

/* Admin sections (Users, Requests, Shared clays, Shared glazes) */
/* Live request #36: the section buttons wrap onto another row instead of hiding off the right edge. */
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding-bottom: 2px; }
.admin-nav a { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); text-decoration: none; font-size: .85rem; font-weight: 600; }
.admin-nav a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* Live request #36: on admin pages, filter buttons (request status, plan…) wrap too, so none are out of reach. */
body.wide .filters { flex-wrap: wrap; overflow-x: visible; }
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.admin-tile { display: block; text-decoration: none; color: inherit; }
.admin-tile h2 { margin: 0 0 4px; font-size: 1.1rem; }
.admin-tile .todo { margin-top: 8px; font-weight: 600; color: var(--accent); font-size: .9rem; }
.admin-tile:hover, .admin-tile:focus-visible { border-color: var(--accent); }
.disabled-banner { background: color-mix(in srgb, var(--danger, #b3261e) 14%, var(--surface)); border: 1px solid var(--danger, #b3261e);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }

/* Front-page gallery for visitors */
.welcome { text-align: center; padding: 18px 8px 8px; }
.welcome h1 { margin-bottom: 6px; }
.welcome .row { justify-content: center; margin-top: 12px; }
.welcome-requests { margin: 14px auto 0; max-width: 34em; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery-grid a { position: relative; display: block; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gallery-grid a:hover img, .gallery-grid a:focus-visible img { transform: scale(1.03); }
.gallery-grid .cap { position: absolute; inset: auto 0 0 0; padding: 18px 8px 6px; color: #fff; font-size: .8rem; line-height: 1.25;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.gallery-grid .cap strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .gallery-grid img { transition: none; } }

/* Continue with Google */
.google-btn { background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 600; text-decoration: none; justify-content: center; }
.google-btn:hover, .google-btn:focus-visible { border-color: var(--accent); }
.or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* Privacy policy and terms (web/privacy.html, web/terms.html) */
.legal-page { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; line-height: 1.6; }
.legal-page h2 { margin-top: 28px; }
.legal-page h3 { margin: 18px 0 4px; font-size: 1rem; }
.legal-page ul { padding-left: 20px; }
.legal-page li { margin: 4px 0; }
.access { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Live request #7: bell, likes & comments, feed, reports */
.bell { position: relative; margin-left: auto; margin-right: 8px; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 999px; color: var(--text); }
.bell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bell .badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list > li + li { margin-top: 10px; }
button.linkish { background: none; border: 0; padding: 0; min-height: 0; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.like-btn.on { color: var(--accent); border-color: var(--accent); }
.social .comments { list-style: none; margin: 10px 0 0; padding: 0; }
.social .comment { padding: 10px 0; border-top: 1px solid var(--line); }
.social .comment.reply { margin-left: 18px; padding: 8px 0 0; border-top: 0; }
.social .comment .comments { margin-top: 4px; }
.c-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0 4px; }
.c-actions { display: flex; gap: 14px; }
.c-form { margin-top: 10px; }
.c-form textarea { width: 100%; }
blockquote.c-body { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 6px; }
.notif-list { list-style: none; padding: 0; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.notif:first-child { border-top: 0; }
.notif.unread { background: var(--accent-soft); }
.notif .n-icon { width: 22px; text-align: center; }
.n-snip { overflow-wrap: anywhere; }
.feed-strip { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 2px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.feed-strip a { flex: 0 0 56px; text-decoration: none; color: var(--text); scroll-snap-align: start; }
.feed-strip .thumb { display: block; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.feed-strip .thumb img, .feed-strip .thumb svg { width: 100%; height: 100%; object-fit: cover; }
.follow-box { display: inline-flex; gap: 8px; align-items: center; }

/* Live request #10: Admin → Email */
.rte-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.rte { min-height: 180px; max-height: 60vh; overflow: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); line-height: 1.5; }
.rte:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.rte img { max-width: 100%; height: auto; border-radius: 8px; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 8px 0 4px; }
.progress span { display: block; height: 100%; background: var(--accent); }

/* Live request #14: profile photo */
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: none; background: var(--line); }
.avatar.lg { width: 96px; height: 96px; }
.avatar.sm { width: 22px; height: 22px; vertical-align: middle; margin-right: 4px; }
.avatar-crop { position: relative; margin: 0 auto; max-width: 100%; touch-action: none; overflow: hidden; border-radius: 12px; background: #111; }
.avatar-crop canvas { display: block; cursor: grab; }
.avatar-crop canvas:active { cursor: grabbing; }
.avatar-crop-ring { position: absolute; inset: 0; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.45); outline: 2px solid rgba(255, 255, 255, 0.85); outline-offset: -2px; }

/* Live request #16: Admin → Deploy */
.deploy-log { max-height: 280px; overflow: auto; font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px; white-space: pre-wrap; }
.warn-text { color: var(--danger); }

/* Live request #20: share my gallery */
#gal-link { flex: 1; min-width: 0; }

/* Live request #27: calmer Pieces page on phones. The header buttons stay on one line
   (icons only on very narrow screens) and the "following" row is a slim strip. */
.pieces-head { align-items: center; flex-wrap: nowrap; }
.pieces-head h1 { margin: 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pieces-head .head-links { display: flex; gap: 6px; flex: none; }
.pieces-head .head-links .btn { white-space: nowrap; }
@media (max-width: 360px) { .pieces-head .lbl { display: none; } }
.feed-mini { margin: 4px 0 12px; }
.feed-mini-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

/* Live request #26: "My gallery" card at the top of Account. */
.my-gallery { border-color: var(--accent); }
.my-gallery .gallery-url { overflow-wrap: anywhere; }

/* Live request #30: "This piece is done" */
.done-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--ok) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent); }
.done-banner .done-check { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--ok); color: #fff; font-weight: 700; }
.mark-done:not(.primary) { border-color: var(--ok); color: var(--ok); font-weight: 600; }

/* Live request #29: clearer notifications */
.notif .n-text { overflow-wrap: anywhere; }
.notif .n-thumb { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.notif .n-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.notif .n-meta .linkish { font-size: inherit; }
.n-help { margin-top: 12px; }

/* Admin → Deploy → Server health */
.health-list { margin: 10px 0 0; }
.health-list li { padding: 8px 0; border-top: 1px solid var(--line, var(--surface-2)); }
.health-list li:first-child { border-top: 0; }
.health-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 6px 0 4px; }
.health-bar span { display: block; height: 100%; background: var(--ok); }
.health-bar.warn span { background: var(--warn); }
.health-bar.bad span { background: var(--danger); }
.health-list > li + li { margin-top: 0; }
.chip.danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
