/* ---------- Tokens ---------- */
:root {
  --bg: #f6efe3;
  --bg-2: #efe5d4;
  --paper: #fffaf2;
  --ink: #2b1d14;
  --ink-2: #5e4a3b;
  --muted: #8a7462;
  --line: #e4d6c1;
  --line-2: #d6c3a6;
  /* --accent-l / --accent-d / --accent-ink-* are set from the Appearance panel or config. */
  --accent: var(--accent-l, #c2410c);
  --accent-ink: var(--accent-ink-l, #fff7ed);
  --accent-soft: color-mix(in srgb, var(--accent) 17%, var(--paper));
  --maroon: #7f1d1d;
  --gold: #b7791f;
  --ok: #3f7d4e;
  --danger: #b42318;
  --shadow: 0 1px 0 rgba(80, 50, 20, .04), 0 8px 24px -12px rgba(80, 50, 20, .25);
  --shadow-lg: 0 24px 60px -20px rgba(60, 30, 10, .45);
  --radius: 16px;
  --radius-sm: 10px;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}
/* Dark tokens: used when the device is dark (unless Light is chosen) or when Dark is chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16110d;
    --bg-2: #1e1712;
    --paper: #221a14;
    --ink: #f3e8d8;
    --ink-2: #d2bfa8;
    --muted: #a08b77;
    --line: #3a2e24;
    --line-2: #4d3d30;
    --accent: var(--accent-d, #f08a4b);
    --accent-ink: var(--accent-ink-d, #1d0f05);
    --accent-soft: color-mix(in srgb, var(--accent) 20%, var(--paper));
    --maroon: #f19a9a;
    --gold: #e0b25c;
    --ok: #7fc28f;
    --danger: #ff8b80;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 30px -14px rgba(0,0,0,.7);
    --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16110d;
  --bg-2: #1e1712;
  --paper: #221a14;
  --ink: #f3e8d8;
  --ink-2: #d2bfa8;
  --muted: #a08b77;
  --line: #3a2e24;
  --line-2: #4d3d30;
  --accent: var(--accent-d, #f08a4b);
  --accent-ink: var(--accent-ink-d, #1d0f05);
  --accent-soft: color-mix(in srgb, var(--accent) 20%, var(--paper));
  --maroon: #f19a9a;
  --gold: #e0b25c;
  --ok: #7fc28f;
  --danger: #ff8b80;
  --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 30px -14px rgba(0,0,0,.7);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.55 var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    radial-gradient(900px 400px at -10% 0%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; margin: 0; }
code { font-size: .9em; background: var(--bg-2); padding: .1em .35em; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(400px, 100%); text-align: center; background: var(--paper);
  border: 1px solid var(--line); border-radius: 24px; padding: 40px 32px 28px; box-shadow: var(--shadow-lg);
}
.login-card h1 { font-size: 32px; margin-top: 14px; }
.login-card p { margin: 4px 0 26px; }
.login-card form { text-align: left; display: grid; gap: 14px; }
.lamp { width: 64px; height: 64px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.lamp svg { width: 40px; height: 40px; fill: var(--accent); stroke: none; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 50%, transparent)); animation: flicker 4s ease-in-out infinite; transform-origin: 50% 90%; }
.lamp .inner { fill: #ffd8a8; }
@keyframes flicker { 0%,100% { transform: scale(1) rotate(0) } 40% { transform: scale(1.03, .98) rotate(-1.5deg) } 70% { transform: scale(.98, 1.03) rotate(1deg) } }
.home-link { display: inline-block; margin-top: 22px; font-size: 13px; color: var(--muted); text-decoration: none; }
.home-link:hover { color: var(--accent); }
.notice { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; text-align: left; }
.form-error { color: var(--danger); font-size: 13px; min-height: 1em; margin: 0; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, var(--accent), var(--maroon)); box-shadow: 0 6px 16px -6px var(--accent); }
.brand-mark svg { width: 18px; height: 18px; fill: #fff3e0; stroke: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-family: var(--serif); font-weight: 600; font-size: 17px; white-space: nowrap; }
.brand-text small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.nav { display: flex; gap: 2px; margin-left: 12px; }
.nav a { text-decoration: none; padding: 7px 13px; border-radius: 999px; color: var(--ink-2); font-weight: 500; font-size: 14px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--bg-2); color: var(--ink); }
.nav a.active { background: var(--ink); color: var(--bg); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: 17px; color: var(--ink-2); }
.icon-btn:hover { color: var(--accent); border-color: var(--line-2); }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .brand-text small { display: none; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .nav a { flex: 1; text-align: center; }
  .home-btn span { display: none; }
  .home-btn { padding: 0; width: 38px; height: 38px; justify-content: center; border-radius: 50%; }
}

/* ---------- Layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 28px 20px 80px; }
@media (max-width: 760px) { .container { padding: 20px 16px 60px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; }
.page-head .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 22px; }
.section-head .count { font-family: var(--sans); font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-2); border-radius: var(--radius); font-size: 14px; }
.loading { display: grid; place-items: center; min-height: 40vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s, background .15s, border-color .15s; }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { font-size: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px -8px var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: transparent; }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; height: 44px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--bg);
  outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.form { display: grid; gap: 14px; }

.segmented { display: inline-flex; padding: 3px; background: var(--bg-2); border-radius: 999px; border: 1px solid var(--line); flex-wrap: wrap; }
.segmented button { border: 0; background: none; padding: 6px 13px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.segmented button.on { background: var(--ink); color: var(--bg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search input { padding-left: 36px; border-radius: 999px; background: var(--paper); }

/* ---------- Chips, avatars ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); display: inline-block; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: color-mix(in srgb, var(--c, var(--accent)) 13%, transparent); color: color-mix(in srgb, var(--c, var(--accent)) 80%, var(--ink)); white-space: nowrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip { color: color-mix(in srgb, var(--c, var(--accent)) 45%, var(--ink)); background: color-mix(in srgb, var(--c, var(--accent)) 24%, transparent); } }
:root[data-theme="dark"] .chip { color: color-mix(in srgb, var(--c, var(--accent)) 45%, var(--ink)); background: color-mix(in srgb, var(--c, var(--accent)) 24%, transparent); }
.chip.plain { --c: var(--muted); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 6px; font-size: 12px; background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); }
.gid { font: 600 12px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em; padding: 4px 7px; border-radius: 6px; background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.avatar { --c: var(--accent); width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 15px;
  color: var(--c-ink, #fff); background: linear-gradient(145deg, color-mix(in srgb, var(--c) 85%, #fff), color-mix(in srgb, var(--c) 88%, #000)); }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { padding: 18px 20px; position: relative; overflow: hidden; }
.stat .label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat .value { font-family: var(--serif); font-size: 38px; line-height: 1.1; margin-top: 6px; }
.stat .sub { font-size: 13px; color: var(--muted); }
.stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: var(--c, var(--accent)); opacity: .08; }

/* ---------- Stay cards ---------- */
.stays { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.stay { position: relative; padding: 16px 18px 14px 22px; display: grid; gap: 10px; transition: transform .15s, box-shadow .15s; }
.stay::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c, var(--accent)); }
.stay:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stay.ignored { opacity: .55; }
.stay-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.stay-title { font-family: var(--serif); font-size: 18px; line-height: 1.25; font-weight: 500; }
.stay-dates { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stay-desc { font-size: 13px; color: var(--muted); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.stay-people { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.person-pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); text-decoration: none; font-size: 13px; font-weight: 500; transition: border-color .15s; }
.person-pill:hover { border-color: var(--accent); }
.person-pill .gid { padding: 2px 5px; font-size: 10.5px; background: transparent; border: 0; color: var(--muted); }
.stay-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }
.progress { height: 4px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 4px; }

/* ---------- Timeline ---------- */
.timeline { overflow-x: auto; padding: 0; }
.tl { --day: 34px; position: relative; min-width: max-content; }
.tl-head { display: flex; position: sticky; top: 0; background: var(--paper); z-index: 2; border-bottom: 1px solid var(--line); padding-left: var(--label); }
.tl-day { width: var(--day); flex: none; text-align: center; padding: 8px 0 6px; font-size: 11px; color: var(--muted); border-left: 1px solid transparent; }
.tl-day b { display: block; font-size: 13px; color: var(--ink); font-weight: 600; }
.tl-day.wkend { background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
.tl-day.today b { color: var(--accent-ink); background: var(--accent); border-radius: 50%; width: 24px; height: 24px; line-height: 24px; margin: 0 auto; }
.tl-day.month { border-left-color: var(--line-2); }
.tl-day .m { position: absolute; top: -2px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; transform: translateX(4px); }
.tl-row { display: flex; align-items: center; height: 42px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); position: relative; }
.tl-label { width: var(--label); flex: none; padding: 0 14px; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: sticky; left: 0; background: var(--paper); z-index: 1; height: 100%; display: flex; align-items: center; gap: 8px; border-right: 1px solid var(--line); cursor: pointer; }
.tl-label:hover { color: var(--accent); }
.tl-track { position: relative; height: 100%; flex: none; }
.tl-bar { position: absolute; top: 8px; height: 26px; border-radius: 8px; background: var(--c); color: var(--c-ink, #fff); font-size: 12px; font-weight: 500; padding: 0 10px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 88%, #fff), var(--c)); box-shadow: 0 4px 10px -6px var(--c); }
.tl-bar:hover { filter: brightness(1.08); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .6; z-index: 1; pointer-events: none; }
.tl-bg { position: absolute; inset: 0 auto 0 var(--label); display: flex; pointer-events: none; }
.tl-bg i { width: var(--day); flex: none; }
.tl-bg i.wkend { background: color-mix(in srgb, var(--bg-2) 50%, transparent); }

/* ---------- Guest list ---------- */
.guest-list { overflow: hidden; }
.guest-row { display: grid; grid-template-columns: 44px minmax(0, 2.2fr) minmax(0, 1.3fr) 90px minmax(0, 1.2fr) 70px; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); text-decoration: none; transition: background .12s; }
.guest-row:last-child { border-bottom: 0; }
.guest-row:hover { background: color-mix(in srgb, var(--bg-2) 55%, transparent); }
.guest-row.head { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 10px; padding-bottom: 10px; background: var(--bg-2); }
.guest-row.head:hover { background: var(--bg-2); }
.guest-row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guest-row .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guest-row .num { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 14px; }
.badge-new { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); margin-left: 6px; }
@media (max-width: 760px) {
  .guest-row { grid-template-columns: 40px 1fr auto; }
  .guest-row > :nth-child(4), .guest-row > :nth-child(5), .guest-row > :nth-child(6) { display: none; }
  .guest-row.head { display: none; }
}

/* ---------- Person page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--accent); }
.person-hero { display: flex; gap: 20px; align-items: center; padding: 24px; position: relative; overflow: hidden; }
.person-hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 200px at 100% 0, color-mix(in srgb, var(--c) 14%, transparent), transparent); pointer-events: none; }
.person-hero h1 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.15; }
.person-hero .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.person-hero .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
@media (max-width: 760px) { .person-hero { flex-wrap: wrap; } .person-hero .actions { margin-left: 0; width: 100%; } }
.person-grid { display: grid; grid-template-columns: 340px 1fr; gap: 20px; margin-top: 20px; align-items: start; }
@media (max-width: 960px) { .person-grid { grid-template-columns: 1fr; } }
.facts { display: grid; gap: 0; }
.fact { display: grid; grid-template-columns: 100px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.fact:last-child { border-bottom: 0; }
.fact dt { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding-top: 2px; }
.fact dd { margin: 0; word-break: break-word; white-space: pre-wrap; }
.fact dd a { color: var(--accent); }
.card h3 { font-size: 18px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.visits { display: grid; gap: 0; }
.visit { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.visit:last-child { border-bottom: 0; }
.visit .cal { width: 52px; text-align: center; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.visit .cal small { display: block; background: var(--c, var(--accent)); color: var(--c-ink, #fff); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 0; }
.visit .cal b { display: block; font-family: var(--serif); font-size: 20px; line-height: 1.3; font-weight: 500; }
.visit .what { font-size: 14px; min-width: 0; }
.visit .what .t { font-weight: 500; }
.visit .what .d { font-size: 12.5px; color: var(--muted); }

.composer { display: grid; gap: 10px; }
.composer textarea { background: var(--bg); min-height: 96px; }
.composer-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.composer-row input { flex: 1; min-width: 140px; max-width: 240px; padding: 8px 12px; }
.composer-row .btn { margin-left: auto; }
.notes { margin-top: 18px; display: grid; gap: 0; position: relative; }
.note { position: relative; padding: 2px 0 20px 26px; }
.note::before { content: ""; position: absolute; left: 6px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--line-2); }
.note::after { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 1px; background: var(--line-2); }
.note:last-child::after { display: none; }
.note-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note-meta strong { color: var(--ink-2); font-weight: 600; }
.note-meta .tools { margin-left: auto; display: flex; gap: 12px; opacity: 0; transition: opacity .15s; }
.note:hover .note-meta .tools, .note:focus-within .note-meta .tools { opacity: 1; }
@media (hover: none) { .note-meta .tools { opacity: 1; } }
.note-text { margin-top: 4px; white-space: pre-wrap; word-break: break-word; font-size: 15px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(30, 18, 8, .45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--paper); border-radius: 20px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 0; }
.modal-head h2 { font-size: 22px; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98) } }

.pick-list { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 10px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.pick:last-child { border-bottom: 0; }
.pick:hover { background: var(--bg-2); }
.pick.on { background: var(--accent-soft); }
.pick input { accent-color: var(--accent); }
.pick .gid { margin-left: auto; }
.selected-people { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }

/* ---------- Search palette ---------- */
.palette { width: min(620px, 100%); align-self: start; margin-top: 10vh; }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 18px 22px; font-size: 17px; background: transparent; box-shadow: none !important; }
.palette .results { max-height: 55vh; overflow: auto; padding: 6px; }
.palette .res { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; text-decoration: none; cursor: pointer; }
.palette .res.on, .palette .res:hover { background: var(--bg-2); }
.palette .res .gid { margin-left: auto; }
.palette .hint { padding: 16px 22px; color: var(--muted); font-size: 13px; }

/* ---------- Data page ---------- */
.data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.data-grid .card p { margin: 6px 0 16px; color: var(--ink-2); font-size: 14px; }
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm); padding: 22px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; font-size: 14px; color: var(--muted); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.cal-status { display: grid; gap: 10px; }
.cal-line { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; }
.cal-line .err { color: var(--danger); font-size: 13px; }
pre.sample { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; font-size: 12px; overflow-x: auto; margin: 0 0 14px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

.fade-in { animation: rise .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px) } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Small-screen polish ---------- */
.home-btn svg, .icon-btn svg { width: 18px; height: 18px; flex: none; }
@media (max-width: 760px) {
  .segmented { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button { white-space: nowrap; flex: none; }
  .page-head .actions { width: 100%; }
  .stat .value { font-size: 32px; }
}

/* ---------- Tag picker ---------- */
.tag-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-opt { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.tag-opt:hover { border-color: var(--accent); color: var(--ink); }
.tag-opt.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tag-pick .tag-new { width: 140px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; border-style: dashed; }
.row-tags { display: inline-flex; gap: 4px; margin-right: 6px; vertical-align: middle; }
.row-tags .tag { height: 18px; font-size: 11px; padding: 0 6px; }
.person-hero .meta .link-btn { margin-left: 2px; }

/* ---------- Text size ---------- */
:root[data-size="small"] body { zoom: .92; }
:root[data-size="large"] body { zoom: 1.12; }

/* ---------- Appearance panel ---------- */
.appearance { display: grid; gap: 22px; }
.appearance .field > span { margin-bottom: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; background: var(--sw); position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .12s; }
.swatch:hover { transform: scale(1.08); }
.swatch.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--sw); }
.swatch.on::after { content: ""; position: absolute; inset: 0; margin: auto; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.swatch-custom { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; position: relative; border: 1.5px dashed var(--line-2); display: grid; place-items: center; color: var(--muted); font-size: 18px; cursor: pointer; }
.swatch-custom.on { border: 0; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--sw); background: var(--sw); color: transparent; }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.sw-name { font-size: 13px; color: var(--muted); margin-left: 4px; }
.cat-colors { display: grid; gap: 8px; }
.cat-color { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.cat-color input[type=color] { width: 38px; height: 28px; border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; background: var(--paper); cursor: pointer; }
.cat-color .preview { margin-left: auto; }
.theme-preview { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 14px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); }

/* Tags that carry a colour (e.g. Membership volunteer) */
.tag.colored { gap: 5px; border-color: color-mix(in srgb, var(--c) 45%, var(--line)); background: color-mix(in srgb, var(--c) 14%, var(--paper)); }
.tag.colored .dot { width: 6px; height: 6px; }

/* Notes copied from a calendar entry */
.note.from-cal::before { background: var(--muted); }
.cal-badge { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--ink-2); }
.cal-badge svg { width: 13px; height: 13px; }

/* ---------- Guest photos ---------- */
.avatar.has-photo { padding: 0; overflow: hidden; background: var(--bg-2); }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl, .person-hero .avatar.lg.has-photo { width: 104px; height: 104px; }
.avatar-btn { position: relative; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; flex: none; }
.avatar-btn .avatar { box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--line-2); }
.avatar-btn .cam { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper); color: var(--ink-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); transition: color .15s, transform .15s; }
.avatar-btn .cam svg { width: 15px; height: 15px; }
.avatar-btn:hover .cam { color: var(--accent); transform: scale(1.08); }
.photo-body { display: grid; gap: 12px; }
.photo-drop { display: grid; justify-items: center; gap: 12px; padding: 22px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s; }
.photo-drop:hover, .photo-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.photo-preview { width: 180px; height: 180px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--bg-2); color: var(--muted); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview svg { width: 44px; height: 44px; }
