/* ============================================================
   Rezef — soft, pastel, calm
   ============================================================ */

:root {
  --bg: #FBF6F1;
  --bg-tint: radial-gradient(1200px 600px at 100% -10%, #F8E6EE 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 10%, #E7F0F6 0%, transparent 55%);
  --surface: #FFFFFF;
  --surface-2: #F7F1EC;
  --ink: #3A3440;
  --ink-soft: #5E5664;
  --muted: #988E9C;
  --line: #EDE4DD;
  --accent: #CFC2F0;        /* lilac */
  --accent-ink: #3E3266;
  --accent-soft: #F1ECFB;
  --peach: #F8D9C8;
  --ok: #6FA58A;
  --warn: #C9963B;
  --bad: #C4606E;
  --shadow: 0 1px 2px rgba(80, 60, 90, .05), 0 6px 20px rgba(80, 60, 90, .06);
  --shadow-lift: 0 2px 4px rgba(80, 60, 90, .06), 0 14px 34px rgba(80, 60, 90, .10);
  --r: 20px;
  --r-sm: 14px;
  --font: 'Assistant', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-round: 'Varela Round', 'Assistant', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #1F1B23;
    --bg-tint: radial-gradient(1200px 600px at 100% -10%, #2E2433 0%, transparent 60%),
               radial-gradient(900px 500px at -10% 10%, #1F2A31 0%, transparent 55%);
    --surface: #2A2530;
    --surface-2: #332D39;
    --ink: #F1EBF4;
    --ink-soft: #D3CAD8;
    --muted: #A69CAB;
    --line: #3D3644;
    --accent: #BBA9EA;
    --accent-ink: #231A3D;
    --accent-soft: #3A3150;
    --peach: #4A3A35;
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 14px 34px rgba(0, 0, 0, .35);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg-tint), var(--bg);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* per-client pastel and its deep ink */
[style*="--c"] {
  --c-deep: color-mix(in oklab, var(--c) 30%, #2E2838);   /* text on the pastel itself */
  --c-ink: var(--c-deep);
  --c-soft: color-mix(in oklab, var(--c) 35%, var(--surface));
  --c-chip: color-mix(in oklab, var(--c) 65%, var(--surface));   /* chips need more than --c-soft to read */
  --c-line: color-mix(in oklab, var(--c) 60%, #8E8398);
}
[data-theme="dark"] [style*="--c"] {
  --c-ink: color-mix(in oklab, var(--c) 85%, #fff);
  --c-soft: color-mix(in oklab, var(--c) 18%, var(--surface));
  --c-chip: color-mix(in oklab, var(--c) 34%, var(--surface));
  --c-line: var(--c);
}

/* ---------- brand ---------- */
.brand-mark {
  font-family: var(--font-round);
  font-size: 22px;
  letter-spacing: .5px;
  background: linear-gradient(90deg, #E9A9A0, #B9A6E3 55%, #8EC1C9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-mark.big { font-size: 46px; line-height: 1.1; }
.brand-mark.sm { font-size: 22px; padding-inline: 6px; }

.splash { min-height: 100dvh; display: grid; place-content: center; gap: 18px; justify-items: center; }
.splash .brand-mark { font-size: 40px; animation: breathe 2.4s ease-in-out infinite; }

/* three brand-coloured dots, used by the splash and the loader veil */
.dots { display: flex; gap: 9px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; animation: dot 1.25s ease-in-out infinite; }
.dots i:nth-child(1) { background: #E9A9A0; }
.dots i:nth-child(2) { background: #B9A6E3; animation-delay: .16s; }
.dots i:nth-child(3) { background: #8EC1C9; animation-delay: .32s; }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-5px); opacity: 1; } }
@keyframes breathe { 50% { opacity: .72; } }

/* loader veil: dims + blurs whatever is on screen while something is in flight */
.veil {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 58%, transparent);
  backdrop-filter: blur(12px) saturate(1.3); -webkit-backdrop-filter: blur(12px) saturate(1.3);
  opacity: 0; transition: opacity .3s ease;
}
.veil.on { opacity: 1; }
.veil-card {
  display: grid; justify-items: center; gap: 14px; min-width: 150px;
  padding: 26px 34px 22px; border-radius: 28px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  box-shadow: var(--shadow-lift);
  transform: translateY(10px) scale(.97); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.veil.on .veil-card { transform: none; }
.veil-mark { font-size: 34px; animation: breathe 2.4s ease-in-out infinite; }
.veil-label { font-size: 14px; color: var(--ink-soft); min-height: 1.2em; }
.veil-label:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .dots i, .veil-mark, .splash .brand-mark { animation: none; } }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-top)) 12px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-family: var(--font-round); font-size: 18px; }
.topbar-title > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-soft); cursor: pointer;
  transition: background .15s;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--surface-2); outline: none; }

/* day / night switch */
.theme-switch {
  position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; align-items: center;
  width: 62px; height: 32px; margin-inline: 4px; padding: 0; border: 0; border-radius: 999px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); cursor: pointer;
}
.theme-switch::before {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow);
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}
.theme-switch svg { position: relative; width: 16px; height: 16px; justify-self: center; transition: color .2s; }
.theme-switch .sun { color: var(--warn); }
.theme-switch[aria-checked="true"]::before { transform: translateX(-30px); }
.theme-switch[aria-checked="true"] .sun { color: var(--muted); }
.theme-switch[aria-checked="true"] .moon { color: var(--accent); }
.theme-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page { max-width: 760px; margin: 0 auto; padding: 4px 16px calc(40px + var(--safe-bottom)); }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.stack { display: grid; gap: 14px; }
.hint { color: var(--muted); font-size: 15px; margin: 0; line-height: 1.6; text-wrap: pretty; }
.lead { margin: 0; font-size: 17px; line-height: 1.6; color: var(--ink-soft); text-wrap: balance; }
.err { color: var(--bad); margin: 0; font-size: 15px; }
.h2 { font-family: var(--font-round); font-weight: 400; font-size: 22px; margin: 0; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .15s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { box-shadow: var(--shadow-lift); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.danger { color: var(--bad); }
.btn.wide { width: 100%; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
input:not([type=checkbox]):not([type=file]), textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 17px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { resize: none; line-height: 1.65; }
input[dir=ltr] { text-align: left; }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; accent-color: #A897DA; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 400px); justify-content: center; align-content: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px; min-width: 0;
  background: var(--surface); border-radius: 28px; padding: 34px 20px 26px;
  box-shadow: var(--shadow-lift);
  text-align: center;
}
.auth-card .stack { text-align: start; margin-top: 22px; }
.auth-sub { margin: 4px 0 0; color: var(--muted); }
.forgot summary { cursor: pointer; text-align: center; list-style: none; text-decoration: underline; text-underline-offset: 3px; }
.forgot summary::-webkit-details-marker { display: none; }
.forgot p { margin-top: 8px; }
.code-box {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 20px; letter-spacing: 1px;
  display: flex; flex-wrap: wrap; justify-content: center; row-gap: 4px;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: var(--r-sm); padding: 14px 10px;
  user-select: all;
}
[data-theme="dark"] .code-box { color: var(--ink); }
.code-box > span { white-space: nowrap; }
.code-box .dash { opacity: .5; padding-inline: 2px; }
.hint .line { display: block; text-wrap: balance; }

/* ---------- home ---------- */
.today { color: var(--muted); margin: 2px 4px 18px; font-size: 15px; }
.section-title {
  font-family: var(--font-round); font-weight: 400; font-size: 15px;
  color: var(--muted); margin: 22px 4px 10px; letter-spacing: .3px;
}
.client-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 700px) { .client-list { grid-template-columns: 1fr 1fr; } }

.client-card {
  position: relative;
  display: flex; align-items: center;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s;
  overflow: hidden;
}
.client-card::before {
  content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 6px;
  background: var(--c);
}
.client-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.client-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 8px; padding-inline-start: 18px; }
.client-meta { display: grid; min-width: 0; }
.client-name { font-weight: 700; font-size: 18px; }
.client-sub { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.quick-new {
  display: grid; place-items: center; flex: none;
  width: 44px; height: 44px; margin-inline-end: 12px; border-radius: 50%;
  background: var(--c-soft); color: var(--c-ink);
  transition: transform .15s;
}
.quick-new:active { transform: scale(.92); }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--c); color: var(--c-deep);
  font-family: var(--font-round); font-size: 17px;
}
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.sm svg { width: 18px; height: 18px; }

.add-btn { width: 100%; margin-top: 22px; border-style: dashed; box-shadow: none; background: transparent; color: var(--ink-soft); }

.empty {
  text-align: center; background: var(--surface); border-radius: 28px;
  padding: 36px 22px; box-shadow: var(--shadow); display: grid; gap: 10px; justify-items: center;
}
.empty p { margin: 0 0 8px; color: var(--ink-soft); }

.pending-banner {
  margin-top: 20px; text-align: center; font-size: 14px;
  background: #FFF3D6; color: #7A5B16; border-radius: var(--r-sm); padding: 10px;
}

/* ---------- client page ---------- */
.about { color: var(--ink-soft); margin: 0 4px 12px; font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px; font-size: 15px;
  background: var(--c-chip); color: var(--c-ink); border: 1px solid color-mix(in oklab, var(--c) 45%, transparent);
}
.chip svg { width: 16px; height: 16px; }
.new-session { margin: 4px 0 16px; }

.search {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px;
  color: var(--muted);
}
.search input { border: 0 !important; box-shadow: none !important; background: transparent !important; padding: 11px 0 !important; }

/* the thread */
.thread { list-style: none; margin: 0; padding: 0; position: relative; }
.thread::before {
  content: ''; position: absolute; top: 18px; bottom: 18px;
  inset-inline-start: 11px; width: 2px; border-radius: 2px;
  background: linear-gradient(to bottom, var(--c-line), color-mix(in oklab, var(--c-line) 35%, transparent));
}
.entry { position: relative; padding-inline-start: 34px; margin-bottom: 12px; }
.knot {
  position: absolute; inset-inline-start: 4px; top: 20px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--c-line);
}
.entry.active .knot { background: var(--c-line); box-shadow: 0 0 0 5px var(--c-soft); }
.entry-card {
  display: grid; gap: 6px;
  background: var(--surface); border-radius: var(--r); padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
}
.entry-card:hover { box-shadow: var(--shadow-lift); }
.entry.active .entry-card { box-shadow: 0 0 0 2px var(--c-line), var(--shadow-lift); }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.entry-date { font-weight: 700; }
.entry-n { color: var(--muted); font-size: 14px; display: inline-flex; gap: 8px; align-items: center; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 999px; padding: 1px 10px; font-size: 13px;
}
[data-theme="dark"] .badge { color: var(--ink); }
.badge svg { width: 14px; height: 14px; }
.entry-snippet {
  color: var(--ink-soft); font-size: 15.5px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.thumbs { display: flex; gap: 6px; margin-top: 4px; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 12px; background: var(--surface-2); opacity: 0; transition: opacity .3s; }
.thumb.loaded, img.loaded { opacity: 1; }
.empty-thread { margin-top: 30px; }

/* split view: timeline + session */
.session-pane { display: none; }
.client-layout.has-session .timeline-pane { display: none; }
.client-layout.has-session .session-pane { display: block; }
.pane-empty { height: 70vh; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 8px; }
.pane-empty .brand-mark { font-size: 34px; opacity: .7; }

@media (min-width: 900px) {
  .client-layout { display: grid; grid-template-columns: minmax(340px, 400px) 1fr; height: 100dvh; }
  .client-layout .timeline-pane,
  .client-layout.has-session .timeline-pane { display: block; overflow-y: auto; border-inline-end: 1px solid var(--line); }
  .client-layout .session-pane { display: block; overflow-y: auto; }
  .timeline-pane .page { padding-inline: 14px; }
  .session-pane .editor-bar .icon-btn[href] { visibility: hidden; }
}

/* ---------- session editor ---------- */
.editor { display: grid; gap: 14px; }
/* tucked away at the very bottom, small and quiet, so it is not hit by accident */
.ed-delete {
  justify-self: center; margin-top: 28px; padding: 8px 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--bad); font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.ed-delete svg { width: 16px; height: 16px; }
.ed-delete:hover, .ed-delete:focus-visible { background: color-mix(in oklab, var(--bad) 12%, transparent); outline: none; }
.ed-title { font-size: 16px; }
.save-state {
  display: inline-flex; align-items: center; gap: 5px; padding-inline: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.save-state svg { width: 22px; height: 22px; }
.save-state.empty { visibility: hidden; }
.save-state.dirty { opacity: .45; }
.save-state.saving svg { animation: pulse 1s ease-in-out infinite; }
.save-state.ok { color: var(--ok); }
.save-state.warn { color: var(--warn); }
.save-state.bad { color: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }

.date-row {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--c-soft); color: var(--c-ink);
  border-radius: var(--r); padding: 12px 16px;
}
.date-row { cursor: pointer; }
.date-long { font-family: var(--font-round); font-size: 17px; }
.date-change { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; opacity: .8; }
.date-change svg { width: 16px; height: 16px; }
.date-row input[type=date] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; padding: 0; cursor: pointer;
}

.modes {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--surface-2); border-radius: 999px; padding: 5px;
}
.mode {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: transparent; border-radius: 999px;
  padding: 10px 6px; cursor: pointer; color: var(--ink-soft); font-weight: 600;
  transition: background .2s, color .2s, box-shadow .2s;
}
.mode svg { width: 19px; height: 19px; }
.mode.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.mode-panel { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(-4px); } }

.rec {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow);
}
.rec-btn {
  flex: none; width: 66px; height: 66px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #F7C8BA, #E7B8D5); color: #5A2E3E;
  box-shadow: 0 6px 18px rgba(231, 160, 170, .45);
  transition: transform .15s;
}
.rec-btn svg { width: 28px; height: 28px; }
.rec-btn.on { animation: breathe 1.6s ease-in-out infinite; background: linear-gradient(135deg, #F4A9A0, #E59ABF); }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(236, 150, 160, .55); }
  50% { box-shadow: 0 0 0 14px rgba(236, 150, 160, 0); }
}
.rec-info { display: grid; gap: 4px; min-width: 0; }
.rec-status { font-weight: 600; }
.rec-live { color: var(--muted); font-size: 15px; min-height: 1.5em; }

.drop {
  display: grid; justify-items: center; gap: 8px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--r); padding: 22px 16px;
  color: var(--ink-soft); background: var(--surface);
  transition: border-color .15s, background .15s;
}
.drop svg { width: 30px; height: 30px; color: #A897DA; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.panel-note { background: var(--surface); border-radius: var(--r); padding: 6px 16px; box-shadow: var(--shadow); font-size: 15.5px; }

.block {
  background: var(--surface); border-radius: var(--r); padding: 14px 16px 16px;
  box-shadow: var(--shadow); display: grid; gap: 10px;
}
.block-title { margin: 0; font-family: var(--font-round); font-weight: 400; font-size: 16px; color: var(--ink-soft); }
details.block > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary::after { content: '+'; font-size: 22px; color: var(--muted); line-height: 1; }
details.block[open] > summary::after { content: '–'; }
.block textarea { background: var(--surface-2); border-color: transparent; }
.block textarea:focus { background: var(--surface); }
.main-text { min-height: 150px; }

.chip.toggle { cursor: pointer; background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.chip.toggle.on { background: var(--c-chip); color: var(--c-ink); text-decoration: none; }

.member-note { display: grid; gap: 6px; }
.member-note.absent { opacity: .45; }
.member-name { font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.member-name::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photo, .photo-add {
  position: relative; width: 96px; height: 96px; border-radius: 16px; overflow: hidden;
  background: var(--surface-2);
}
.photo img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; opacity: 0; transition: opacity .3s; }
.photo img.loaded { opacity: 1; }
.photo.loading::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .9s linear infinite;
}
.photo-del {
  position: absolute; top: 5px; inset-inline-end: 5px; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .9); color: #6a5a6a; display: grid; place-items: center; cursor: pointer;
}
.photo-del svg { width: 15px; height: 15px; }
.photo-add {
  display: grid; place-content: center; justify-items: center; gap: 4px; cursor: pointer;
  border: 2px dashed var(--line); color: var(--muted); font-size: 13px; background: transparent;
}

/* ---------- sheet ---------- */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 50; background: rgba(40, 30, 50, 0);
  display: flex; align-items: flex-end; justify-content: center;
  transition: background .2s;
}
.sheet-wrap.open { background: rgba(40, 30, 50, .28); }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--bg); border-radius: 28px 28px 0 0;
  padding: 18px 18px calc(22px + var(--safe-bottom));
  display: grid; gap: 16px;
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.sheet-wrap.open .sheet { transform: none; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 28px; transform: translateY(20px); opacity: 0; transition: transform .2s, opacity .2s; }
  .sheet-wrap.open .sheet { opacity: 1; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet textarea { min-height: 76px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 999px; padding: 5px; gap: 5px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 10px; cursor: pointer; font-weight: 600; color: var(--ink-soft); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-3 { grid-template-columns: 1fr 1fr 1fr; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; background: var(--c); border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--surface); box-shadow: 0 0 0 2px var(--c-ink); }
.members-pick { display: grid; background: var(--surface); border-radius: var(--r-sm); padding: 6px 14px; }
.members-pick .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.add-member { margin-top: 8px; }
.check.listed { align-items: flex-start; line-height: 1.35; }
.check.listed input { margin-top: 2px; }
.sheet-danger { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }

/* ---------- settings ---------- */
.settings { display: grid; gap: 14px; }
.settings .btn { justify-self: start; }

/* ---------- lightbox & toast ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(25, 20, 30, .9);
  display: grid; place-items: center; padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 90dvh; border-radius: 14px; }
.lb-close { position: absolute; top: calc(12px + var(--safe-top)); inset-inline-end: 12px; color: #fff; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); z-index: 70;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: 999px;
  font-size: 15px; box-shadow: var(--shadow-lift); transition: opacity .2s, transform .2s;
  max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- print ---------- */
#print { display: none; }
@media print {
  body { background: #fff !important; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; color: #000; font-size: 12pt; line-height: 1.5; }
  #print h1 { font-family: var(--font-round); font-weight: 400; margin: 0 0 4pt; }
  #print .p-meta, #print .p-about { color: #555; margin: 0 0 14pt; }
  #print article { break-inside: avoid-page; border-top: 1px solid #ddd; padding-top: 10pt; margin-top: 10pt; }
  #print h2 { font-size: 13pt; margin: 0 0 6pt; }
  #print h3 { font-size: 11pt; color: #555; margin: 8pt 0 2pt; }
  #print p { margin: 0 0 6pt; }
  #print .p-photos { display: flex; gap: 6pt; flex-wrap: wrap; }
  #print .p-photos img { width: 110pt; height: 110pt; object-fit: cover; border-radius: 6pt; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
