:root {
  color-scheme: light;
  --bg:          #FFFFFF;
  --viewport:    #131215;
  /* The 3D simulator's backdrop, which follows the theme so the model always
     stands out: light grey here, charcoal in dark mode. The scene reads
     --stage and --stage-floor (see scene.applyTheme); the rest style the
     buttons and hints drawn over it. */
  --stage:       #E7E5EA;
  --stage-floor: #CFCCD4;
  --stage-fade:  231, 229, 234;     /* --stage as r, g, b, for the hint scrim */
  --stage-veil:  rgba(231, 229, 234, 0.78);
  --stage-btn:   rgba(255, 255, 255, 0.8);
  --stage-btn-text: #4A4850;
  --panel:       #F6F5F7;
  --panel-border:#E4E2E6;
  --ink:         #7C2430;
  --ink-bright:  #9E3040;
  --ink-text:    #F5F4F2;
  --steel:       #69707E;
  --text:        #17161A;
  --text-muted:  #6B6970;
  --text-faint:  #9B98A0;
  --warn:        #A9631E;
  --scrim:       rgba(17, 16, 20, 0.42);
  --shadow:      0 0 32px rgba(0, 0, 0, 0.18);
}

/* Dark theme. <html data-theme> is set before first paint by the inline
   script in index.html and kept current by js/theme.js, which resolves the
   "system" choice — so these rules never need a media query of their own. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:          #0B0B0C;
  --viewport:    #131215;
  --stage:       #2C2A30;   /* charcoal, not black: deep skin tones need the contrast */
  --stage-floor: #3A3840;
  --stage-fade:  44, 42, 48;
  --stage-veil:  rgba(44, 42, 48, 0.78);
  --stage-btn:   rgba(0, 0, 0, 0.55);
  --stage-btn-text: #A9A6AE;
  --panel:       #18171B;
  --panel-border:#2C2A30;
  --ink:         #8E2A38;
  --ink-bright:  #D0566A;
  --ink-text:    #F5F4F2;
  --text:        #EDECEA;
  --text-muted:  #A9A6AE;
  --text-faint:  #75727A;
  --warn:        #D99247;
  --scrim:       rgba(0, 0, 0, 0.6);
  --shadow:      0 0 32px rgba(0, 0, 0, 0.6);
}

/* Each logo ships in an ink-on-light and a light-on-dark version; only the
   one matching the theme is shown. */
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }

* { box-sizing: border-box; }

/* What each screen leaves free at the bottom: the phone's home bar, plus the
   tab bar when it's showing. */
:root {
  --tabbar-h: 58px;
  --bottom-space: env(safe-area-inset-bottom, 0px);
  /* The phone's status bar (time, Wi-Fi, battery). env() covers the iPhone app
     and current Android; the Android app also sets --safe-area-inset-top itself
     (Capacitor's SystemBars) for older Android web views that report 0. */
  --top-space: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
}
body.has-tabbar { --bottom-space: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }

html, body {
  margin: 0;
  background: var(--bg);
  transition: background-color 0.2s ease;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ── Gate: splash + auth ────────────────────────────────────────────
   Fixed rather than in flow, so the app underneath can already be laid out
   and loading its model while the splash is still up. */
.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.gate-screen {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px 28px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  text-align: center;
}

/* The logo carries the wordmark and tagline itself, so the splash adds no
   heading of its own. Capped on height as well as width: on a short landscape
   phone a width-only cap pushes the button off-screen. */
.splash { gap: 28px; }
.splash-logo {
  width: min(78%, 320px);
  max-height: 58vh;
  object-fit: contain;
}
.splash .btn-block { flex: 0 0 auto; align-self: stretch; }

/* Build number under the main button on the splash and sign-in screens. */
.app-version {
  margin: -4px 0 0;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.auth { justify-content: center; gap: 14px; }
.auth-logo {
  width: min(48%, 190px);
  max-height: 30vh;
  margin-bottom: 6px;
  object-fit: contain;
}
.auth .segmented { align-self: stretch; }

.auth-form {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}
.field input {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;   /* below 16px, iOS Safari zooms the page on focus */
}
.field input:focus {
  outline: none;
  border-color: var(--ink-bright);
}

/* Password field with a show / hide button inside its right edge. */
.password-wrap { position: relative; display: flex; }
.password-wrap input { flex: 1; min-width: 0; padding-right: 48px; }
.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 46px;            /* a comfortable thumb target */
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0 8px 8px 0;
}
.password-toggle:hover { color: var(--text); }
.password-toggle:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: -4px; }
.password-toggle .icon-eye-off { display: none; }
.password-toggle[aria-pressed="true"] .icon-eye { display: none; }
.password-toggle[aria-pressed="true"] .icon-eye-off { display: block; }

.auth-message {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-bright);
}
.auth-message.is-ok { color: var(--text-muted); }
.auth-notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  color: var(--text);
}

.auth .btn-block:disabled { opacity: 0.6; cursor: default; }

/* Under the build number on the sign-in screen and in the menu. */
.privacy-link {
  align-self: center;
  margin-top: -8px;
  font-size: 11px;
  color: var(--text-faint);
  text-decoration: underline;
}

/* Google / Apple buttons, in each company's own colours (both have rules on
   how their sign-in buttons look). */
.social-signin {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-social { font-size: 14px; font-weight: 600; gap: 10px; }
.btn-social svg { flex: 0 0 auto; }
.btn.btn-google { background: #FFFFFF; color: #1F1F1F; border: 1px solid #747775; }
.btn.btn-apple  { background: #000000; color: #FFFFFF; border: 1px solid #000000; }
:root[data-theme="dark"] .btn.btn-google { background: #131314; color: #E3E3E3; border-color: #8E918F; }
:root[data-theme="dark"] .btn.btn-apple  { background: #FFFFFF; color: #000000; border-color: #FFFFFF; }
.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: var(--text-faint);
}
.or-divider::before,
.or-divider::after { content: ""; flex: 1; height: 1px; background: var(--panel-border); }

/* "Client or artist?" for a new Google / Apple account. */
.choose-title { margin: 0; font-size: 20px; font-weight: 800; color: var(--text); }
.choose-lede { margin: -6px 0 4px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.choose-switch { margin: 0; font-size: 12px; color: var(--text-faint); }
.choose-switch .btn-link { margin: 0 0 0 2px; font-size: 12px; color: var(--ink-bright); text-decoration: underline; }

/* ── Header ─────────────────────────────────────────────────────── */
/* One slim app bar: horizontal logo on the left, save status and the menu
   button on the right. */
.header {
  padding: calc(10px + var(--top-space)) 8px 12px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--panel); }
.icon-btn:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: 1px; }
/* Reserves its line whatever the status is, so the header doesn't jog upward
   every time a save settles and the label empties out. */
.save-status {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  min-height: 12px;
  white-space: nowrap;
}
.save-status.is-error { color: var(--warn); }

.brand-logo {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  height: 44px;
  width: auto;
  object-fit: contain;
  object-position: left center;
}

/* ── Menu drawer ────────────────────────────────────────────────── */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 15;           /* over the app, under the gate */
  pointer-events: none;
}
.drawer.is-open { pointer-events: auto; }

.drawer-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.drawer.is-open .drawer-scrim { opacity: 1; }

.drawer-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: min(82vw, 320px);
  background: var(--bg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 12px 20px;
  padding-top: calc(12px + var(--top-space));
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  transform: translateX(102%);
  transition: transform 0.22s ease;
}
.drawer.is-open .drawer-panel { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .drawer-scrim, .drawer-panel { transition: none; }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-right: -8px;
}
.drawer-logo { height: 36px; width: auto; }

.drawer-section { display: flex; flex-direction: column; }

.account-who {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-action { flex: 0 0 auto; }

.drawer-version { text-align: center; }

/* Stops the page behind the drawer scrolling under a finger. */
body.drawer-locked { overflow: hidden; }

/* ── Guest nudge ────────────────────────────────────────────────── */
.guest-banner {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px;
}
.guest-text {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ── Viewport ───────────────────────────────────────────────────── */
.viewport-frame {
  position: relative;
  margin: 0 16px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
}
.viewport {
  width: 100%;
  /* Most of the screen: everything but the status bar, the header, the tab bar
     and a strip for the hint and the first sliders, so it's clear
     the controls continue below (and there's somewhere to scroll from — the
     model itself takes every touch). Capped so a desktop window or tablet
     doesn't get an absurdly tall stage. */
  height: clamp(300px, calc(100vh - var(--bottom-space) - var(--top-space) - 150px), 760px);
  height: clamp(300px, calc(100dvh - var(--bottom-space) - var(--top-space) - 150px), 760px);
  background: var(--stage);
}
.viewport canvas { display: block; touch-action: none; }

.overlay {
  position: absolute;
  pointer-events: none;
  text-align: center;
  left: 0;
  right: 0;
}
.overlay-center {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}
/* Sits over the model, so it needs a scrim to stay readable. The generous
   bottom padding keeps the text clear of the tool toggle in the corner. */
.overlay-hint {
  bottom: 0;
  padding: 28px 24px 56px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  background: linear-gradient(to top, rgba(var(--stage-fade), 0.88), rgba(var(--stage-fade), 0));
}
/* Below the undo / save-image buttons in the top corners. */
.overlay-top {
  top: 54px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.loading { background: var(--stage-veil); font-size: 12px; letter-spacing: 1px; }

.load-error-text {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
#load-error .btn { pointer-events: auto; }

/* Rotate / Position: a segmented control under the gesture hint. */
/* Rotate / Position: a pill in the bottom-right corner of the 3D view,
   opposite Reset view. */
.tool-toggle {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--stage-btn);
}
.tool-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--stage-btn-text);
}
.tool-btn.is-on { background: var(--ink); color: var(--ink-text); }

/* Viewport buttons: Reset view bottom-left, Undo top-left, Share top-right. */
.view-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--stage-btn);
  color: var(--stage-btn-text);
}
.view-btn:hover { color: var(--ink-bright); }
.view-btn:disabled { opacity: 0.4; cursor: default; }
.view-btn:disabled:hover { color: var(--stage-btn-text); }
.view-btn-top { top: 10px; bottom: auto; }
.view-btn-left { left: 10px; right: auto; }
.view-btn-right { right: 10px; left: auto; }
.view-btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.view-btn-icon.view-btn-right { left: auto; }
.view-btn-icon:disabled { opacity: 0.4; }
#undo-btn { display: inline-flex; align-items: center; gap: 6px; }
#undo-btn.hidden { display: none !important; }
#share-btn.is-busy { color: var(--text-faint); }

/* First-run upload button, above the model. */
.first-upload { flex: 0 0 auto; margin: 0 16px 12px; width: auto; }

/* Cutout preview's Cancel: full width, under the two main buttons. */
.pending-cancel { width: 100%; margin-top: 10px; }

/* ── Panels ─────────────────────────────────────────────────────── */
.panel-stack {
  padding: 16px 20px 32px;
  padding-bottom: calc(32px + var(--bottom-space));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Placement hint — lives below the viewport now, not over the model. */
.place-hint {
  margin: 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--ink-bright);
}

/* Gesture microcopy — the zoom affordances aren't discoverable on touch. */
.viewport-hint {
  margin: 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.2px;
  color: var(--text-muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px;
}

.section-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
  font-weight: 700;
}

.checkerboard {
  height: 150px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: repeating-conic-gradient(#2a282d 0% 25%, #1d1c20 0% 50%);
  background-size: 16px 16px;
  margin-bottom: 10px;
}
.checkerboard img { max-width: 80%; max-height: 80%; object-fit: contain; }

.note {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 10px;
  line-height: 1.5;
}
.note.is-warn { color: var(--warn); }

.row { display: flex; gap: 10px; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--ink); color: var(--ink-text); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--panel-border);
  font-weight: 600;
}
.btn-block { border-radius: 10px; padding: 12px 16px; letter-spacing: 0.3px; }

.btn-link {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}

.upload-input { display: none; }

/* ── Tattoo chips ───────────────────────────────────────────────── */
.chips { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 6px; }
.chip { position: relative; }
.chip-btn {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 2px solid var(--panel-border);
  background: var(--panel);
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chip-btn.is-active { border-color: var(--ink); }
.chip-btn img { width: 100%; height: 100%; object-fit: contain; }

/* A 28px dot, with an invisible 44px tap area around it (::before). */
.chip-remove {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--ink-text);
  border: 2px solid var(--bg);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.chip-remove::before {
  content: '';
  position: absolute;
  inset: -8px;
}

.chip-add {
  background: transparent;
  font-family: inherit;
  padding: 0;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 1px dashed var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
}

/* ── Segmented control ──────────────────────────────────────────── */
.segmented {
  display: flex;
  background: var(--panel);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--panel-border);
}
.seg-btn {
  flex: 1;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 8px;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  transition: background 0.15s;
}
.seg-btn.is-on { background: var(--ink); color: var(--ink-text); }

/* ── Per-tattoo edit controls ───────────────────────────────────── */
.edit-controls.is-disabled { opacity: 0.4; pointer-events: none; }

.slider-row { margin-bottom: 12px; }
.slider-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.slider-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.slider-value { font-size: 12px; color: var(--text); font-family: ui-monospace, monospace; }
.slider-row input[type="range"] { width: 100%; accent-color: var(--ink); }

/* ── AI background removal (on the cutout preview) ──────────────── */
.ai-cutout { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 12px; }
.ai-cutout-btn {
  flex: none;
  width: 100%;
  background: transparent;
  color: var(--ink-bright);
  border: 1.5px solid var(--ink-bright);
  border-radius: 10px;
  padding: 11px 14px;
}
/* When the simple cutout struggled, the AI option is the obvious next step. */
.ai-cutout.is-suggested .ai-cutout-btn { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.ai-cutout-btn:disabled { opacity: 0.5; cursor: default; }
.ai-cutout-btn.is-busy svg { animation: ai-spin 1.2s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ai-cutout-btn.is-busy svg { animation: none; }
}
.ai-cutout-note { margin: 0; font-size: 12px; line-height: 1.4; color: var(--text-muted); text-align: center; }
.ai-cutout-note:empty { display: none; }
.ai-cutout-note.is-warn { color: var(--warn); }

/* ── Adjust image ───────────────────────────────────────────────── */
/* The way in: a full-width row under Size and Rotation. */
.adjust-open {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 2px;
  padding: 11px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.adjust-open svg { color: var(--ink-bright); flex: 0 0 auto; }
.adjust-open-label { flex: 1; }
.adjust-edited {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-bright);
}
.adjust-open-chevron { color: var(--text-faint); font-size: 18px; line-height: 1; }
.adjust-open:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.adjust-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 13;   /* over the tab bar (12), under the menu drawer and sheets */
  max-width: 460px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow);
  padding: 14px 20px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  animation: adjust-up 0.22s ease;
}
.adjust-controls .slider-row { margin-bottom: 8px; }
.adjust-controls .slider-row:last-child { margin-bottom: 0; }
.adjust-controls .slider-head { margin-bottom: 2px; }
@keyframes adjust-up {
  from { transform: translateY(100%); }
  to { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .adjust-controls { animation: none; }
}

.adjust-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.adjust-head .section-label { margin-bottom: 0; }
.adjust-actions { display: flex; align-items: center; gap: 14px; }
.adjust-actions .btn-link { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.adjust-actions .btn-link:disabled { opacity: 0.4; cursor: default; }
.slider-help { margin: 4px 0 0; font-size: 11px; line-height: 1.4; color: var(--text-faint); }

/* Skin tone: the track is a gradient of the tones (set from config by ui.js). */
.skin-tone-row { margin: 14px 0 0; }
.skin-tone-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  background: transparent;
  cursor: pointer;
}
.skin-tone-slider::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: var(--skin-track);
  border: 1px solid var(--panel-border);
}
.skin-tone-slider::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: var(--skin-track);
  border: 1px solid var(--panel-border);
}
.skin-tone-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.skin-tone-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.skin-tone-slider:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 999px; }

/* Per-tattoo actions sitting under the thumbnails. */
.chip-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}


.toggle {
  display: flex;
  align-items: center;
  align-self: flex-start;
  width: fit-content;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
}
.toggle-track {
  width: 30px;
  height: 16px;
  border-radius: 999px;
  background: var(--panel-border);
  position: relative;
  transition: background 0.15s;
}
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-text);
  box-shadow: 0 0 0 1px var(--panel-border);
  transition: left 0.15s;
}
/* The toggle now lives outside .edit-controls, so it carries its own
   disabled state rather than inheriting one from that container. */
.toggle.is-disabled { opacity: 0.4; pointer-events: none; }
.toggle.is-on .toggle-track { background: var(--ink); }
.toggle.is-on .toggle-knob { left: 16px; }
.toggle-label { font-size: 12px; color: var(--text); font-weight: 600; }


/* ════════════════════════════════════════════════════════════════════
   Account types: sign-up type picker, profile, client projects, sharing,
   the artist feed and its read-only 3D view.
   ════════════════════════════════════════════════════════════════════ */

a.btn { text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: default; }

/* ── Forms ──────────────────────────────────────────────────────── */
.stack-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }

.field-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}
.field-aside {
  margin-left: 6px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: none;
}

.field select,
.field textarea,
.select {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 76px; line-height: 1.4; }
.field select:focus,
.field textarea:focus { outline: none; border-color: var(--ink-bright); }

.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.form-message {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-bright);
  overflow-wrap: anywhere;
}
.form-message.is-ok { color: var(--text-muted); }

/* Two-line segmented buttons: "$$" over "$300 – $1,000". */
.segmented-stacked .seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
}
.seg-main { font-size: 13px; }
.seg-sub { font-size: 10px; font-weight: 600; opacity: 0.8; }

.contact-fields {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-fields legend { padding: 0 6px; }

/* ── Drawer additions ───────────────────────────────────────────── */
.account-kind {
  margin: -8px 0 12px;
  font-size: 12px;
  color: var(--text-muted);
}
#profile-form { gap: 12px; }

/* ── Chips (style / budget pickers and filters) ─────────────────── */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.filter-chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-text);
}
.filter-chip:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: 1px; }

/* ── Client: project card ───────────────────────────────────────── */
.project-card-head { display: flex; align-items: center; justify-content: space-between; }
.project-card-head .section-label { margin-bottom: 0; }
.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
}
.badge.is-public { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.project-summary {
  margin: 10px 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ── Sheets ─────────────────────────────────────────────────────── */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 16;
  pointer-events: none;
}
.sheet.is-open { pointer-events: auto; }
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.sheet.is-open .sheet-scrim { opacity: 1; }
.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 520px;
  max-height: 92vh;
  max-height: 92dvh;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow);
  padding: 8px 20px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateY(102%);
  transition: transform 0.24s ease;
}
.sheet.is-open .sheet-panel { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .sheet-scrim, .sheet-panel { transition: none; }
}
.sheet-head {
  position: sticky;
  top: -8px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -8px 8px 0;
  padding-top: 8px;
  background: var(--bg);
}
.sheet-title { margin: 0; font-size: 17px; }

/* ── "Are you sure?" pop-up (js/confirm.js) ─────────────────────────
   A sheet that sits in the middle of the screen instead of at the bottom,
   and above any sheet it was opened from. */
.confirm-dialog { z-index: 17; }
.confirm-dialog .confirm-panel {
  top: 50%;
  bottom: auto;
  left: 20px;
  right: 20px;
  max-width: 360px;
  padding: 22px 20px 18px;
  border-radius: 18px;
  opacity: 0;
  transform: translateY(-50%) scale(0.96);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.confirm-dialog.is-open .confirm-panel { opacity: 1; transform: translateY(-50%); }
.confirm-title { margin: 0 0 8px; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.confirm-text { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-muted); }
.confirm-buttons { display: flex; gap: 10px; margin-top: 20px; }
.confirm-buttons .btn { flex: 1 1 0; }
@media (prefers-reduced-motion: reduce) {
  .confirm-dialog .confirm-panel { transition: none; }
}

/* ── Share sheet ────────────────────────────────────────────────── */
.share-preview {
  position: relative;
  aspect-ratio: 341 / 380;
  max-height: 46vh;
  margin: 0 auto 12px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--viewport);
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-preview img { width: 100%; height: 100%; object-fit: contain; }
.share-preview img:not([src]) { display: none; }
#share-message { text-align: center; }
.share-preview-busy {
  position: absolute;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: #A9A6AE;
}
.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 10px;
}
.share-actions .share-copy { grid-column: 1 / -1; }
.share-actions.is-disabled { opacity: 0.4; pointer-events: none; }
#project-link-stop { display: block; margin: 12px auto 0; font-size: 13px; padding: 8px 12px; }

/* Share Project, under Project details on the project card. */
.project-link-btn { margin-top: 10px; }

/* ── Screens outside the simulator (artist feed, share page) ─────── */
.screen {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
}
.browse { max-width: 980px; }
.share-view { max-width: 520px; }
.header-spacer { margin-left: auto; }

.browse-body,
.share-body {
  padding: 4px 16px 40px;
  padding-bottom: calc(40px + var(--bottom-space));
}
.share-body { display: flex; flex-direction: column; gap: 16px; }

.screen-title { margin: 6px 0 4px; font-size: 22px; letter-spacing: -0.2px; }
.screen-sub { margin: 0 0 16px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }

.nudge {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--ink-bright);
  background: var(--panel);
}
.nudge p { margin: 0; flex: 1; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.nudge .btn { flex: 0 0 auto; }

.browse-status { margin: 0 0 10px; font-size: 12px; color: var(--text-muted); }

.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 16px;
}
.empty-state {
  grid-column: 1 / -1;
  padding: 32px 20px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  border: 1px dashed var(--panel-border);
  border-radius: 12px;
}

.project-item {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
}
.project-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: none;
  background: var(--viewport);
  color: #A9A6AE;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.thumb-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #F5F4F2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.project-thumb:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: -2px; }

.project-info { display: flex; flex-direction: column; gap: 10px; padding: 14px; flex: 1; }
/* Title on its own line with the client · city · time byline under it, so a
   long project name gets the full card width instead of being truncated. */
.project-top { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.project-top strong { font-size: 15px; overflow-wrap: anywhere; }
.project-top .muted { white-space: normal; }
.muted { font-size: 11px; color: var(--text-faint); white-space: nowrap; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
}

.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 12px;
}
.detail-grid dt { color: var(--text-faint); }
.detail-grid dd { margin: 0; color: var(--text); }

.project-notes {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-notes.is-full { display: block; -webkit-line-clamp: unset; }

.contact-row { margin-top: auto; }

/* ── Artist: read-only 3D view ──────────────────────────────────── */
/* The simulator, minus everything that edits. */
.app.is-viewer #tattoos-section,
.app.is-viewer #first-upload,
.app.is-viewer #model-section,
.app.is-viewer #edit-controls,
.app.is-viewer #pending-panel,
.app.is-viewer #guest-banner,
.app.is-viewer #place-hint,
.app.is-viewer #empty-hint,
.app.is-viewer #undo-btn,
.app.is-viewer #tool-toggle,
.app.is-viewer #save-status { display: none !important; }
.app.is-viewer .header .brand-logo { margin-right: auto; }

.viewer-card { display: flex; flex-direction: column; gap: 12px; }
.viewer-details { display: flex; flex-direction: column; gap: 12px; }
.contact-label { margin: 4px 0 -4px; }
.btn-back {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 4px 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-bright);
  cursor: pointer;
}


/* ════════════════════════════════════════════════════════════════════
   Multiple projects and the upload tips
   ════════════════════════════════════════════════════════════════════ */

.project-card-head { align-items: flex-start; }
.project-name {
  margin: 2px 0 0;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.projects-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.projects-item { position: relative; }
/* The whole card opens the project; the x sits over its top-right corner. */
.projects-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 44px 10px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.projects-card:active:not(:disabled) { transform: scale(0.99); }
.projects-card:disabled { cursor: default; opacity: 0.7; }
.projects-item.is-current .projects-card { border-color: var(--ink-bright); }
.projects-thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--viewport);
}
.projects-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.projects-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.projects-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projects-text .muted { white-space: normal; }
.projects-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.projects-delete:hover:not(:disabled) { color: var(--text); }
.projects-delete:disabled { opacity: 0.5; cursor: default; }
.btn-small { flex: 0 0 auto; padding: 6px 12px; font-size: 12px; }
.projects-plan { margin-top: 10px; text-align: center; }

/* "Shared with you" (Projects for clients, Saved for artists). */
.shared-section { margin-top: 24px; }
#saved-shared { margin: 0 0 18px; }
.shared-section .section-label { margin: 0 0 10px; }
#projects-new:disabled { opacity: 0.45; }

.tips-list {
  margin: 4px 0 16px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.tips-list strong { color: var(--text); }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.check-row input { width: 18px; height: 18px; accent-color: var(--ink); }

/* Full-width buttons inside a sheet (the panel isn't a flex container). */
.sheet-panel .btn-block { width: 100%; }

/* ── Account deletion ───────────────────────────────────────────── */
.drawer-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.delete-account-link {
  align-self: center;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: underline;
}
.delete-warning { margin: 0 0 14px; font-size: 13px; font-weight: 700; color: var(--ink-bright); }
#delete-account-sheet .field { margin-bottom: 14px; }
.btn-danger { background: #B3261E; color: #FFFFFF; }
.btn-danger:disabled { opacity: 0.4; cursor: default; }

/* ════════════════════════════════════════════════════════════════════
   Bottom tab bar, profile circle, tab screens
   ════════════════════════════════════════════════════════════════════ */

/* ── Profile circle (top right) ─────────────────────────────────── */
.avatar-btn {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  margin-left: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.avatar-btn:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: 1px; }
.avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
}
.avatar-initials {
  display: none;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1;
}
.avatar-btn.has-initials .avatar { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.avatar-btn.has-initials .avatar-initials { display: block; }
.avatar-btn.has-initials .avatar-icon { display: none; }
.avatar-btn:active .avatar { transform: scale(0.94); }

/* ── Tab bar ────────────────────────────────────────────────────── */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;           /* over the screens, under the drawer and sheets */
  background: var(--bg);
  border-top: 1px solid var(--panel-border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: background-color 0.2s ease;
}
.tabbar-tabs {
  max-width: 520px;
  height: var(--tabbar-h);
  margin: 0 auto;
  display: flex;
}
.tab {
  flex: 1;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px 5px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-family: inherit;
  cursor: pointer;
  position: relative;
}
.tab svg { display: block; }
.tab-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.2px; }
.tab.is-active { color: var(--ink-bright); }
.tab.is-active .tab-label { font-weight: 700; }
/* A short bar over the active tab, so it doesn't rely on colour alone. */
.tab.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 28px;
  height: 3px;
  margin-left: -14px;
  border-radius: 0 0 3px 3px;
  background: var(--ink-bright);
}
.tab:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: -4px; border-radius: 10px; }

/* ── Tab screens (Projects, placeholders) ───────────────────────── */
.tab-screen { max-width: 520px; }
.tab-body {
  padding: 4px 16px 32px;
  padding-bottom: calc(32px + var(--bottom-space));
}
.projects-current {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-bright);
}

.placeholder-body {
  min-height: calc(100vh - 66px - var(--bottom-space));
  min-height: calc(100dvh - 66px - var(--bottom-space));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-left: 28px;
  padding-right: 28px;
}
.placeholder-icon {
  width: 76px;
  height: 76px;
  margin-bottom: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--ink-bright);
}
.placeholder-icon svg { width: 34px; height: 34px; }
.placeholder-body .badge { margin-bottom: 10px; }
.placeholder-body .screen-sub { max-width: 320px; }
.placeholder-actions {
  align-self: stretch;
  max-width: 340px;
  width: 100%;
  margin: 8px auto 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.placeholder-actions .btn { flex: 0 0 auto; }

/* Back to the simulator from sign-in, for a guest. */
.auth-back { position: absolute; top: calc(14px + var(--top-space)); left: 20px; }
.auth { position: relative; }
.tab-body .btn-block,
.project-card .btn-block { width: 100%; }

/* ── Artist browse: Filter and Sort buttons, and their sheets ───── */
.browse-tools { display: flex; gap: 10px; margin-bottom: 14px; }
.tool-pill {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.tool-pill > span:not(.pill-count) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-pill svg { flex: 0 0 auto; color: var(--text-muted); }
.tool-pill.is-on { border-color: var(--ink-bright); }
.tool-pill:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: 1px; }
.pill-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ink-text);
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

.filter-sheet-label { margin-top: 20px; }
.filter-sheet-foot {
  position: sticky;
  bottom: calc(-24px - env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 10px;
  margin: 22px -20px 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  border-top: 1px solid var(--panel-border);
}
.filter-sheet-foot .btn { min-height: 46px; }
#filter-clear { flex: 0 0 auto; padding: 10px 18px; }
#filter-clear:disabled { opacity: 0.45; }

.sort-options { display: flex; flex-direction: column; margin-bottom: 4px; }
.sort-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 4px;
  border: none;
  border-bottom: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.sort-option:last-child { border-bottom: none; }
.sort-option.is-on { color: var(--ink-bright); font-weight: 700; }
.sort-check { font-size: 16px; }

.empty-state p { margin: 0 0 14px; }
.empty-state .btn { display: inline-flex; flex: 0 0 auto; }
/* Projects tab: New project above the list, the plan line below it. */
#projects-screen #projects-new { margin-bottom: 16px; }
#projects-screen .projects-plan { margin: 4px 0 0; }
#projects-screen #projects-message { margin-bottom: 12px; }

/* ════════════════════════════════════════════════════════════════════
   Saved projects (artists): bookmark button, Saved tab, toast
   ════════════════════════════════════════════════════════════════════ */

/* Title + byline on the left, bookmark on the right. */
.project-head { display: flex; align-items: flex-start; gap: 8px; }
.project-head .project-top { flex: 1; }

.save-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: -10px -10px -6px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.save-btn svg { fill: none; transition: transform 0.15s ease; }
.save-btn.is-on { color: var(--ink-bright); }
.save-btn.is-on svg { fill: currentColor; }
.save-btn:active svg { transform: scale(0.85); }
.save-btn:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: -2px; }
.viewer-details .save-btn { margin-top: -8px; }

.saved-screen { max-width: 980px; }
.saved-empty { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 40px 24px; }
.saved-empty .saved-empty-title { margin-bottom: 6px; font-size: 16px; font-weight: 700; color: var(--text); }
.saved-empty p { max-width: 300px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-space) + 12px);
  z-index: 14;           /* over the tab bar, under the drawer and sheets */
  width: min(440px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px 12px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.4;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-text { flex: 1; min-width: 0; }
.toast-action {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #F4A9B5;        /* the toast is dark in light mode */
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
:root[data-theme="dark"] .toast-action { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ════════════════════════════════════════════════════════════════════
   Profile photos, artist profiles, the Artists tab
   ════════════════════════════════════════════════════════════════════ */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* A photo covers the initials / outline underneath it. */
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.avatar-btn .avatar:has(.avatar-img) { border-color: var(--panel-border); }
/* Someone else's circle (artist lists): initials on ink until a photo loads. */
.avatar-person {
  flex: 0 0 auto;
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-text);
}
.avatar-person .avatar-initials { display: block; font-size: inherit; }

/* ── Photo picker (menu and artist editor) ──────────────────────── */
.profile-photo { margin-bottom: 16px; }
.photo-row { display: flex; align-items: center; gap: 14px; }
.photo-circle { display: inline-flex; transition: opacity 0.15s; }
.photo-circle.is-busy { opacity: 0.5; }
.photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.photo-actions .btn-small { flex: 0 0 auto; min-height: 36px; }
.photo-remove { margin-top: 4px; padding: 4px 0; font-size: 12px; }
.photo-message { margin-top: 8px; }
.artist-profile-btn { margin-bottom: 18px; }

/* ── Artist profile editor (a full screen over the tabs) ────────── */
.editor-screen {
  position: fixed;
  inset: 0;
  z-index: 13;           /* over the tab bar, under the toast, drawer and sheets */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--bg);
}
.editor-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: calc(10px + var(--top-space)) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--panel-border);
}
.editor-head .btn-back { justify-self: start; min-height: 44px; font-size: 14px; text-align: left; }
.editor-title { margin: 0; font-size: 16px; text-align: center; }
.editor-preview {
  justify-self: end;
  min-height: 44px;
  margin: 0;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-bright);
}
.editor-body {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(40px + env(safe-area-inset-bottom, 0px));
}
.editor-body .btn-block { width: 100%; }
.preview-note {
  margin: 0 0 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.input-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel);
  padding-left: 12px;
  color: var(--text-muted);
  font-size: 15px;
}
.input-prefix:focus-within { border-color: var(--ink-bright); }
.field .input-prefix input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding-left: 4px;
}
.field .input-prefix input:focus { outline: none; border: none; }

.portfolio-editor { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--panel-border); }
.portfolio-head { display: flex; align-items: baseline; justify-content: space-between; }
.portfolio-head .section-label { margin-bottom: 0; }
.portfolio-head .field-aside { font-size: 12px; color: var(--text-muted); }
.portfolio-hint { margin: 6px 0 12px; }
.portfolio-editor .form-message { margin-bottom: 10px; }
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.portfolio-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--panel-border);
}
.portfolio-tile.is-uploading {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  border-style: dashed;
}
.portfolio-thumb {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}
.portfolio-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.portfolio-first {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #F5F4F2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  pointer-events: none;
}
.portfolio-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #F5F4F2;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.portfolio-delete.is-confirming { padding: 0 10px; background: var(--warn); color: var(--bg); }
.portfolio-delete:disabled { opacity: 0.5; cursor: default; }
.portfolio-move {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.portfolio-arrow {
  pointer-events: auto;
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #F5F4F2;
  cursor: pointer;
}
.portfolio-arrow:disabled { opacity: 0; pointer-events: none; }
#portfolio-add:disabled { opacity: 0.5; }

/* ── Artists tab: the list ──────────────────────────────────────── */
.artist-list { display: flex; flex-direction: column; gap: 14px; }
.artist-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s;
}
.artist-card:active { transform: scale(0.99); }
.artist-card:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: 2px; }
.artist-previews {
  display: grid;
  gap: 2px;
  background: var(--panel-border);
}
.artist-previews.n1 { grid-template-columns: 1fr; aspect-ratio: 2 / 1; }
.artist-previews.n2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1; }
.artist-previews.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 3 / 2; }
.artist-previews.n3 img:first-child { grid-row: 1 / 3; }
.artist-previews img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; background: var(--viewport); }
.artist-card-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; }
.artist-card-head { display: flex; align-items: center; gap: 12px; }
.artist-card-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.artist-card-text strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artist-card-text .muted { white-space: normal; }

/* Client bookmarks on artists: All artists / Saved, and the bookmark on each
   card (on top of the card, top right) and on the profile. */
.artists-view-toggle { margin-bottom: 12px; }
.artist-card-wrap { position: relative; }
.artist-card-wrap .artist-card-text { padding-right: 36px; }
.save-btn.artist-save-card {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
}
/* Over the portfolio previews: a dark disc so it reads on any photo. */
.save-btn.artist-save-card.has-previews {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.5);
  color: #FFFFFF;
}
.save-btn.artist-save-card.has-previews.is-on { color: #FFFFFF; }
.save-btn.artist-share,
.save-btn.artist-save-detail {
  margin: 0;
  border: 1px solid var(--panel-border);
  background: var(--panel);
}

/* ── One artist's profile ───────────────────────────────────────── */
.artist-profile { display: flex; flex-direction: column; gap: 14px; }
.artist-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 4px 0 2px;
}
.artist-hero .avatar { margin-bottom: 4px; }
.artist-name { margin: 0; font-size: 22px; letter-spacing: -0.2px; overflow-wrap: anywhere; }
.artist-city { margin: 0; font-size: 13px; color: var(--text-muted); }
.instagram-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  min-height: 44px;
  text-decoration: none;
}
.artist-profile .tag-row { justify-content: center; }
.artist-bio {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.portfolio-label { margin: 8px 0 -4px; }
.portfolio-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gallery-tile {
  display: block;
  aspect-ratio: 1;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  cursor: zoom-in;
}
.gallery-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-tile:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: 2px; }
.artist-detail .empty-state, .artist-profile .empty-state { margin: 0; }

/* ── Full-screen image viewer ───────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.94);
  touch-action: pan-y;
}
.lightbox.hidden { display: none; }
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-btn {
  position: absolute;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #F5F4F2;
  cursor: pointer;
}
.lightbox-close { top: calc(12px + var(--top-space)); right: 12px; }
.lightbox-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lightbox-count {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: rgba(245, 244, 242, 0.8);
}

/* ════════════════════════════════════════════════════════════════════
   Messaging: tab badge, conversation list, chat, sharing switches
   ════════════════════════════════════════════════════════════════════ */

.tab-badge {
  position: absolute;
  top: 3px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ink-bright);
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.share-switches { display: flex; flex-direction: column; gap: 8px; }
.share-switches .toggle, .contact-fields .toggle { max-width: 100%; text-align: left; }
.share-switches .toggle-label, .contact-fields .toggle-label { white-space: normal; }

.artist-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}
.artist-actions .btn { flex: 0 0 auto; min-width: 140px; min-height: 44px; }
.artist-actions .instagram-link { margin-top: 0; }
.artist-actions .btn:disabled { opacity: 0.5; }

/* ── Conversation list ──────────────────────────────────────────── */
.conversation-list { display: flex; flex-direction: column; margin: 0 -16px; }
.conversation {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.conversation:active { background: var(--panel); }
/* Each conversation, with its ⋯ (archive / delete) on the right. */
.conversation-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
}
.conversation-row .conversation { flex: 1; min-width: 0; border-bottom: none; padding-right: 4px; }
.conversation-more { margin-right: 6px; color: var(--text-muted); }
.conversation-list > .btn-back { margin: 0 16px 2px; }
.archived-note { margin: 4px 16px 8px; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.archived-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.archived-link:active { background: var(--panel); }
.archived-link .muted { font-weight: 600; }
.conversation:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: -2px; }
.conversation-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conversation-top { display: flex; align-items: baseline; gap: 8px; }
.conversation-top strong {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-time { flex: 0 0 auto; font-size: 11px; color: var(--text-faint); }
.conversation-project {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-preview {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation.is-unread .conversation-preview { color: var(--text); font-weight: 600; }
.conversation.is-unread .conversation-time { color: var(--ink-bright); font-weight: 700; }
.unread-dot {
  flex: 0 0 auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink-bright);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.messages-empty { margin: 8px 16px 0; }

/* ── Chat ───────────────────────────────────────────────────────── */
.chat-screen {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 13;           /* over the tab bar, under the toast, drawer and sheets */
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.chat-screen.hidden { display: none; }
.chat-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(6px + var(--top-space)) 8px 6px 4px;
  border-bottom: 1px solid var(--panel-border);
  background: var(--bg);
}
.chat-avatar { display: inline-flex; }
.chat-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-who strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-contact { display: flex; gap: 2px; }
.chat-contact-btn { color: var(--ink-bright); }

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-log > :first-child { margin-top: auto; }
.chat-note {
  margin: 24px auto;
  max-width: 280px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.chat-day {
  margin: 12px 0 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-faint);
}
.chat-earlier { align-self: center; margin-bottom: 8px; }
.bubble-row { display: flex; flex-direction: column; max-width: 82%; }
.bubble-row.is-mine { align-self: flex-end; align-items: flex-end; }
.bubble-row.is-theirs { align-self: flex-start; align-items: flex-start; }
.bubble {
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.is-mine .bubble { background: var(--ink); color: var(--ink-text); border-bottom-right-radius: 6px; }
.is-theirs .bubble { background: var(--panel); color: var(--text); border: 1px solid var(--panel-border); border-bottom-left-radius: 6px; }
.bubble-row { gap: 4px; }
.bubble-row.is-pending > :not(.bubble-meta),
.bubble-row.is-failed > :not(.bubble-meta) { opacity: 0.6; }
.bubble-row.is-failed > :not(.bubble-meta) { outline: 1px solid var(--warn); outline-offset: 1px; }
.bubble.is-gone { font-style: italic; color: var(--text-muted); background: transparent; border: 1px dashed var(--panel-border); }

/* Photos in a message: one large, or a 2-column grid. */
.bubble-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: min(240px, 64vw);
  border-radius: 16px;
  overflow: hidden;
}
.bubble-photos.n1 { grid-template-columns: 1fr; }
.bubble-photos.n3 .bubble-photo:first-child { grid-column: span 2; aspect-ratio: 2 / 1; }
.bubble-photo {
  display: block;
  aspect-ratio: 1;
  padding: 0;
  border: none;
  background: var(--panel);
  cursor: zoom-in;
  overflow: hidden;
}
.bubble-photos.n1 .bubble-photo { aspect-ratio: 4 / 5; }
.bubble-photo:disabled { cursor: default; }
.bubble-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-wait, .attach-thumb.is-preparing, .design-card-blank {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(110deg, var(--panel) 30%, var(--panel-border) 50%, var(--panel) 70%);
  background-size: 250% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) {
  .photo-wait, .attach-thumb.is-preparing, .design-card-blank { animation: none; }
}

/* A project shared in a message. */
.design-card {
  display: flex;
  flex-direction: column;
  width: min(240px, 64vw);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  font: inherit;
}
.design-card:disabled { cursor: default; }
.design-card > img, .design-card > .design-card-blank {
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: cover;
  background: var(--viewport);
}
.design-card-text { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px 10px; }
.design-card-text strong { font-size: 14px; }
.design-card-text span { font-size: 12px; color: var(--text-muted); }
.design-card:not(:disabled) .design-card-text span { color: var(--ink-bright); font-weight: 600; }
.is-mine .design-card .design-card-text span { color: var(--text-muted); font-weight: 400; }
.bubble-meta { margin: 2px 6px 6px; font-size: 10.5px; color: var(--text-faint); }
.bubble-retry { margin: 0; font-size: 11px; color: var(--warn); text-decoration: underline; }

.chat-error { flex: 0 0 auto; padding: 0 16px 6px; }
.chat-more { color: var(--text-muted); }
.chat-more.hidden { display: none; }

.chat-blocked {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--panel-border);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.chat-blocked.hidden, .chat-form.hidden, .chat-attachments.hidden { display: none; }
.chat-blocked p { margin: 0; max-width: 320px; line-height: 1.45; }

/* What's attached to the message being written. */
.chat-attachments {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px 2px;
  overflow-x: auto;
  border-top: 1px solid var(--panel-border);
}
.attach-thumb {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-design {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  height: 64px;
  padding: 0 30px 0 0;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
}
.attach-design > img, .attach-design > .design-card-blank { flex: 0 0 64px; width: 64px; height: 64px; object-fit: cover; }
.attach-design > span:not(.design-card-blank) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #FFFFFF;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.chat-form .chat-attach {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.chat-form .chat-attach:disabled { opacity: 0.35; cursor: default; }

/* The chat's sheet: attach menu, pickers, block and report. */
.chat-sheet-body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }
.sheet-action {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.sheet-action strong { font-size: 15px; }
.sheet-action span { font-size: 12.5px; color: var(--text-muted); line-height: 1.4; }
.sheet-action.is-danger strong { color: #B3261E; }
:root[data-theme="dark"] .sheet-action.is-danger strong { color: #F2867E; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sheet-action.is-danger strong { color: #F2867E; }
}
.sheet-note { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.sheet-list { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.5; color: var(--text); }
.sheet-buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.pick-list { display: flex; flex-direction: column; gap: 8px; }
.pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.pick-row > img, .pick-row > .design-card-blank {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--viewport);
}
.pick-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pick-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-text span { font-size: 12px; color: var(--text-muted); }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pick-tile {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  cursor: pointer;
}
.pick-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-tile[aria-pressed="true"] { border-color: var(--ink-bright); }
.pick-tile[aria-pressed="true"]::after {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink-bright);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.report-form { display: flex; flex-direction: column; gap: 10px; }
.report-reasons { display: flex; flex-direction: column; gap: 6px; }
.report-reason {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel);
  font-size: 14px;
  cursor: pointer;
}
.report-reason:has(input:checked) { border-color: var(--ink-bright); }
.report-reason input, .switch-row input { accent-color: var(--ink-bright); width: 18px; height: 18px; margin: 0; }
.report-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  resize: vertical;
}
.switch-row { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.chat-form {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--panel-border);
  background: var(--bg);
}
.chat-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 140px;
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 21px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 16px;       /* 16px stops iOS zooming in on focus */
  line-height: 1.35;
  resize: none;
}
.chat-form textarea:focus { outline: none; border-color: var(--ink-bright); }
.chat-send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--ink-text);
  cursor: pointer;
}
.chat-send:disabled { opacity: 0.35; cursor: default; }

/* ── Artist booking info (Phase 1 of artist profiles) ───────────── */
/* Editor */
.booking-fields { display: flex; flex-direction: column; gap: 16px; }
.rate-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rate-grid .field { gap: 4px; }
.walk-ins-for { display: flex; flex-direction: column; gap: 10px; }
.books-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--warn);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}

/* Artists tab: the search box beside Filters */
.artists-tools { align-items: stretch; }
.search-field {
  flex: 2 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-muted);
}
.search-field:focus-within { border-color: var(--ink-bright); }
.search-field svg { flex: 0 0 auto; }
.search-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;   /* below 16px, iOS Safari zooms the page on focus */
  padding: 10px 0;
}
.search-field input:focus { outline: none; }
.artists-tools .tool-pill { flex: 1 1 0; }

/* Cards and profile: shop, walk-ins and books badges */
.artist-card-where { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artist-shop { margin: -2px 0 0; font-size: 14px; font-weight: 600; color: var(--text-muted); overflow-wrap: anywhere; }
.status-row { display: flex; flex-wrap: wrap; gap: 6px; }
.artist-hero .status-row { justify-content: center; margin-top: 4px; }
.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
}
.status-badge.is-walk-ins { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.status-badge.is-books-open { border-color: var(--ink-bright); color: var(--ink-bright); }

/* Profile: rates, payment methods and booking policy */
.booking-card { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.booking-card .section-label { margin-bottom: 8px; }
.artist-profile .booking-card .tag-row { justify-content: flex-start; }
.rate-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin: 0; }
.rate-list div { padding: 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--panel-border); }
.rate-list dt { font-size: 11px; color: var(--text-muted); }
.rate-list dd { margin: 2px 0 0; font-size: 17px; font-weight: 700; color: var(--text); }
.booking-note, .booking-policy {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.booking-policy { margin-top: 0; }

/* ── Current flash (Phase 2 of artist profiles) ─────────────────── */
/* Profile */
.flash-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flash-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.flash-image { position: relative; }
.flash-card.is-claimed .flash-image img { opacity: 0.55; }
.flash-claimed {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
}
.flash-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flash-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flash-text .muted { font-size: 12px; color: var(--text-muted); }
.flash-want { min-height: 40px; padding: 8px 10px; font-size: 13px; }

/* Editor */
.flash-tile.is-editing { outline: 2px solid var(--ink-bright); outline-offset: 2px; border-radius: 10px; }
.flash-claimed-tag { background: rgba(0, 0, 0, 0.65); }
.flash-details {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  gap: 14px;
}
.flash-details-head { display: flex; gap: 12px; align-items: flex-end; }
.flash-details-head img {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--bg);
  cursor: zoom-in;
}
.flash-details-head .field { flex: 1; min-width: 0; }
.flash-details .field input { background: var(--bg); }
.flash-details .input-prefix { background: var(--bg); }
.flash-details .flash-price { max-width: 180px; }

/* ── Artist profile from a share link (Phase 3 of artist profiles) ─ */
/* Over the app and the sign-in screens (20), under the photo viewer (30). */
.artist-page {
  position: fixed;
  inset: 0;
  z-index: 25;
  max-width: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
}
.artist-page > .header,
.artist-page > .artist-page-body { max-width: 520px; margin: 0 auto; }
.artist-page-cta { display: flex; flex-direction: column; gap: 12px; }
.artist-page-cta p { margin: 0; font-size: 14px; line-height: 1.5; }
/* Toasts ("Link copied") show over the page. */
body.artist-page-open .toast { z-index: 26; }
.editor-share { margin: -4px 0 16px; }

/* ── Notifications (js/notices.js) ──────────────────────────────── */
/* The bell, next to the profile circle on every screen. */
.notices-btn { position: relative; color: var(--text-muted); }
.notices-btn:hover { color: var(--ink-bright); }
.notices-dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-bright);
  box-shadow: 0 0 0 2px var(--bg);
}
.notices-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.notice-card { display: flex; gap: 12px; align-items: flex-start; }
.notice-card.is-new { border-color: color-mix(in srgb, var(--ink-bright) 45%, var(--panel-border)); }
.notice-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--ink-bright);
}
.notice-icon svg { display: block; }
.notice-body { flex: 1; min-width: 0; }
.notice-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.notice-title { margin: 0; font-size: 15px; }
.notice-text { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); white-space: pre-line; }
.notice-date { margin: 8px 0 0; font-size: 11px; color: var(--text-faint); }

/* ── Onboarding tour (js/tour.js) ───────────────────────────────── */
.tour {
  position: fixed;
  inset: 0;
  z-index: 18;           /* over the screens, sheets and drawer; under the gate */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-top: calc(16px + var(--top-space));
  padding-bottom: calc(14px + var(--bottom-space));
}
.tour-scrim { position: absolute; inset: 0; background: var(--scrim); }
.tour-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  animation: tour-in 0.22s ease;
}
@keyframes tour-in { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { .tour-card { animation: none; } }
.tour-top { display: flex; align-items: center; gap: 10px; }
.tour-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--ink-text);
}
.tour-icon svg { display: block; }
.tour-count { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; color: var(--text-faint); }
.tour-skip { margin: 0 0 0 auto; padding: 8px 0 8px 8px; font-size: 12px; }
.tour-title { margin: 14px 0 6px; font-size: 20px; letter-spacing: -0.2px; }
.tour-text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.tour-points {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tour-points li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}
.tour-points li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-bright);
}
.tour-foot { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.tour-foot .btn { flex: 0 0 auto; min-width: 88px; min-height: 44px; }
.tour-dots { flex: 1; display: flex; justify-content: center; gap: 6px; }
.tour-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--panel-border); transition: width 0.2s ease; }
.tour-dot.is-on { width: 18px; border-radius: 3px; background: var(--ink-bright); }
.is-invisible { visibility: hidden; }

/* While the tour is up the tab bar sits above its dimming, so the tab a card
   is about can be lit up; the bar itself can't be tapped until it ends. */
body.touring .tabbar { z-index: 19; pointer-events: none; }
body.touring .tabbar .tab { opacity: 0.45; }
body.touring .tabbar .tab.is-tour-target { opacity: 1; color: var(--ink-bright); }
body.touring .tabbar .tab.is-tour-target svg {
  border-radius: 12px;
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--ink-bright) 18%, transparent);
  animation: tour-pulse 1.6s ease-in-out infinite;
}
@keyframes tour-pulse { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--ink-bright) 8%, transparent); } }
@media (prefers-reduced-motion: reduce) { body.touring .tabbar .tab.is-tour-target svg { animation: none; } }
/* The profile card lights up the profile circle on the screen behind it. */
body.tour-spot-profile .avatar-btn {
  position: relative;
  z-index: 19;
  pointer-events: none;
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--ink-bright);
}

/* The tour's "client or artist?" welcome card: over the sign-in screens, on a
   plain backdrop, since there's no app behind it yet. */
.tour.is-choosing { z-index: 21; align-items: center; }
.tour.is-choosing .tour-scrim { background: var(--bg); }
.tour-choose { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.tour-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1.5px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.tour-option strong { font-size: 15px; }
.tour-option span { font-size: 12.5px; line-height: 1.4; color: var(--text-muted); }
.tour-option.is-on { border-color: var(--ink-bright); box-shadow: 0 0 0 1px var(--ink-bright); }
.tour-option:disabled { cursor: default; }
.tour-option:focus-visible { outline: 2px solid var(--ink-bright); outline-offset: 2px; }
.tour-choose .auth-message { margin: 0; }
