/* ════════════════════════════════════════════════════════════════════════
   Gatherly design system — "Utsav"
   Modern festive: chandan cream, raat plum, rani pink, marigold, peacock.
   Mobile-first. Tokens first, components after. See /brand for the toolkit.
   ════════════════════════════════════════════════════════════════════════ */

/* ── 1. Tokens ─────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  /* surfaces */
  --bg: #FFF8EE;          /* chandan cream — page */
  --paper: #FFFDF8;       /* cards */
  --paper2: #FBF1E3;      /* inset fields, hover */
  --line: #EFE2CF;
  /* text */
  --ink: #2A1B3D;         /* raat plum */
  --muted: #6E6280;
  /* brand */
  --primary: #C2255C;     /* rani pink — the one action colour */
  --primary-ink: #FFFFFF;
  --primary-soft: #FCE7EF;
  --primary-soft-ink: #9D174D;
  --marigold: #F59E0B;    /* celebration, highlights, motif */
  --marigold-soft: #FEF3C7;
  --marigold-ink: #78350F;
  --peacock: #0F766E;
  --peacock-soft: #CCFBF1;
  --peacock-ink: #115E59;
  --hero: #2A1B3D;        /* event covers */
  --hero-ink: #FFF8EE;
  /* status */
  --st-listed: #6E6280;
  --st-invited: #4338CA;
  --st-yes: #0F766E;
  --st-maybe: #B45309;
  --st-no: #B91C1C;
  /* shape & depth */
  --r-sm: 10px; --r: 16px; --r-lg: 24px; --pill: 999px;
  --shadow: 0 1px 2px rgba(42,27,61,.05), 0 6px 20px rgba(42,27,61,.07);
  --shadow-lg: 0 24px 60px rgba(42,27,61,.22);
  --focus: 0 0 0 3px rgba(194,37,92,.28);
  /* spacing (4pt grid) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  /* type */
  --font-display: "Young Serif", Georgia, serif;
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* motion */
  --ease: cubic-bezier(.2,.8,.2,1);
  --fast: 140ms; --base: 240ms;
  /* layout */
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #150E1F; --paper: #1F1630; --paper2: #2A1F3D; --line: #392C4D;
    --ink: #F7EEDF; --muted: #B3A6C4;
    --primary: #F06595; --primary-ink: #2A0B18; --primary-soft: #3D1A2B; --primary-soft-ink: #FBCFE0;
    --marigold: #FBBF24; --marigold-soft: #3A2A0D; --marigold-ink: #FDE68A;
    --peacock: #2DD4BF; --peacock-soft: #0F2F2C; --peacock-ink: #99F6E4;
    --hero: #2A1F3D; --hero-ink: #FFF8EE;
    --st-listed: #B3A6C4; --st-invited: #A5B4FC; --st-yes: #5EEAD4; --st-maybe: #FBBF24; --st-no: #FCA5A5;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.25);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.5);
    --focus: 0 0 0 3px rgba(240,101,149,.35);
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ── 2. Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 500 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; letter-spacing: -.005em; line-height: 1.2; }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 17px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
code { font-size: .92em; background: var(--paper2); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: none; box-shadow: var(--focus); }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 28px; height: 28px; }

/* Rangoli dot motif — use sparingly: heroes, gate, empty states */
.motif { position: relative; isolation: isolate; }
.motif::before, .motif::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none; border-radius: 50%;
}
.motif::after { width: 156px; height: 156px; right: -52px; top: -52px; border: 2px dashed var(--marigold); opacity: .55; }
.motif::before { width: 100px; height: 100px; right: -24px; top: -24px; border: 4px dotted var(--primary); opacity: .45; }

/* ── 3. App shell (mobile-first: bottom tabs → sidebar ≥ 900px) ────────── */
.app { min-height: 100vh; }
main { padding: var(--s5) var(--s4) calc(var(--tabbar) + var(--safe-b) + var(--s6)); max-width: 1180px; margin: 0 auto; }

.nav {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar) + var(--safe-b)); padding: 0 var(--s2) var(--safe-b);
  display: flex; justify-content: space-around; align-items: stretch;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.nav .brand, .nav .tag, .nav .sync { display: none; }
.nav a {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 600; border-radius: var(--r-sm);
  transition: color var(--fast) var(--ease);
}
.nav a svg.i { width: 24px; height: 24px; transition: transform var(--fast) var(--ease); }
.nav a.on { color: var(--primary); }
.nav a.on svg.i { transform: translateY(-1px); stroke-width: 2.1; }
.nav a .lbl-long { display: none; }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
  main { padding: var(--s6) 40px var(--s7); margin: 0; width: 100%; }
  .nav {
    position: sticky; top: 0; height: 100vh; padding: 28px var(--s4); background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
    flex-direction: column; justify-content: flex-start; gap: var(--s1); border-top: 0; border-right: 1px solid var(--line);
  }
  .nav .brand { display: flex; } .nav .tag { display: block; } .nav .sync:not([hidden]) { display: block; }
  .nav a { flex: none; max-width: none; flex-direction: row; justify-content: flex-start; gap: var(--s3); padding: 11px 14px; font-size: 15px; }
  .nav a svg.i { width: 20px; height: 20px; }
  .nav a:hover { background: var(--paper2); color: var(--ink); }
  .nav a.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
  .nav a.on svg.i { color: var(--primary); transform: none; }
  .nav a .lbl-long { display: inline; } .nav a .lbl-short { display: none; }
  .nav a.brand { font-size: 25px; font-weight: 400; padding: 0 6px; gap: 10px; color: var(--ink); background: none; box-shadow: none; margin-bottom: 4px; }
}

/* Brand lockup */
.brand { align-items: center; gap: 10px; font-family: var(--font-display); font-size: 25px; margin: 0 6px 4px; color: var(--ink); text-decoration: none; }
.brand .mark { width: 34px; height: 34px; flex: none; }
.tag { margin: 0 6px var(--s5) 50px; font-size: 12.5px; color: var(--muted); }
.sync { margin-top: auto; font-size: 12px; color: var(--muted); padding: 8px 14px; }
.sync[data-st=offline] { color: var(--st-no); }

/* Page header */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s5); }
.top h1 { flex: 1 1 auto; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 60ch; }
.row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.sect-title { margin: var(--s6) 0 var(--s3); font: 700 12px/1 var(--font-ui); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; margin-bottom: var(--s3); min-height: 32px; }
.back:hover { color: var(--ink); }

/* ── 4. Buttons ────────────────────────────────────────────────────────── */
.btn {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--pill); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none;
  background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 14.5px;
  transition: transform var(--fast) var(--ease), filter var(--fast) var(--ease), background var(--fast) var(--ease);
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: var(--paper2); filter: none; }
.btn.danger { background: transparent; color: var(--st-no); box-shadow: inset 0 0 0 1px var(--line); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; transform: none; filter: none; }
.btn svg.i { width: 18px; height: 18px; }
@media (max-width: 599px) { .top .btn.ghost .lbl { display: none; } .top .btn.ghost { width: 44px; padding: 0; } }

/* ── 5. Chips, badges, segmented ───────────────────────────────────────── */
.chips { display: flex; gap: var(--s2); margin: 0 0 var(--s4); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .chips { flex-wrap: wrap; overflow: visible; } }
.chip {
  flex: none; min-height: 38px; padding: 0 14px; border: 0; border-radius: var(--pill); cursor: pointer;
  display: inline-flex; gap: 7px; align-items: center; font-weight: 600; font-size: 14px;
  background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); transition: background var(--fast) var(--ease);
}
.chip:hover { background: var(--paper2); }
.chip .n { font-size: 12px; color: var(--muted); font-weight: 700; }
.chip.on { background: var(--ink); color: var(--bg); box-shadow: none; }
.chip.on .n { color: inherit; opacity: .7; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.circ-chip.full:not(.on) { opacity: .6; }
.badge { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: var(--pill); background: var(--paper2); color: var(--muted); white-space: nowrap; }
.seg { display: inline-flex; background: var(--paper2); border-radius: var(--pill); padding: 3px; }
.seg button { border: 0; background: none; min-height: 32px; padding: 0 14px; border-radius: var(--pill); cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }

/* ── 6. Fields ─────────────────────────────────────────────────────────── */
.search, .field input, .field select, .field textarea, .qa input, textarea.msg, .crow input {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--paper); outline: none; font-weight: 500; transition: border-color var(--fast), box-shadow var(--fast);
}
.search { padding-left: 44px; margin-bottom: var(--s5);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236E6280' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 14px 50% no-repeat; }
.search:focus, .field input:focus, .field select:focus, .field textarea:focus, .qa input:focus, textarea.msg:focus, .crow input:focus { border-color: var(--primary); box-shadow: var(--focus); }
.field { display: block; margin-bottom: var(--s4); }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field textarea { min-height: 72px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr; gap: 0 var(--s3); }
@media (min-width: 520px) { .two { grid-template-columns: 1fr 1fr; } }
.picks { display: flex; flex-wrap: wrap; gap: var(--s2); }
.pick { min-height: 38px; border: 1px solid var(--line); background: var(--paper); border-radius: var(--pill); padding: 0 14px; cursor: pointer; font-size: 14px; font-weight: 600; }
.pick.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.file { display: inline-flex; } .file input { display: none; }
input[type=checkbox] { accent-color: var(--primary); }

/* ── 7. Cards & lists ──────────────────────────────────────────────────── */
.card { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); }
.panel { padding: var(--s4) var(--s4); }
@media (min-width: 600px) { .panel { padding: 20px 22px; } }
.panel h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.panel + .panel { margin-top: var(--s4); }
.grid { display: grid; grid-template-columns: 1fr; gap: var(--s2); }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s3); } }
.person { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); align-items: center; cursor: pointer; transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.person:hover { transform: translateY(-1px); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.av { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.av.sm { width: 36px; height: 36px; font-size: 13px; }
img.av { object-fit: cover; background: var(--paper2); }
.pinfo { flex: 1; min-width: 0; }
.pinfo b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinfo .line { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.acts { display: flex; gap: 2px; flex: none; }
.ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); text-decoration: none; border: 0; background: transparent; cursor: pointer; transition: background var(--fast), color var(--fast); }
.ic:hover { color: var(--primary); background: var(--primary-soft); }
.ic.wa:hover { color: var(--peacock); background: var(--peacock-soft); }
.ic.off { opacity: .25; pointer-events: none; }
.ic svg { width: 18px; height: 18px; fill: currentColor; }
.grid > .person { container-type: inline-size; }
@container (max-width: 400px) { .person .acts .ic:nth-child(n+3) { display: none; } }

.empty { padding: var(--s7) var(--s4); text-align: center; color: var(--muted); grid-column: 1 / -1; }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.empty p { max-width: 42ch; margin: 0 auto var(--s4); }
.empty .big { width: 88px; height: 88px; margin: 0 auto var(--s4); border-radius: 50%; display: grid; place-items: center; background: var(--marigold-soft); color: var(--marigold-ink); }
.empty .big svg.i { width: 40px; height: 40px; }

/* ── 8. Events ─────────────────────────────────────────────────────────── */
.evlist { display: grid; grid-template-columns: 1fr; gap: var(--s3); }
@media (min-width: 700px) { .evlist { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s4); } }
.evcard { display: block; padding: 20px; text-decoration: none; overflow: hidden; background: var(--hero); color: var(--hero-ink); border: 0; transition: transform var(--fast) var(--ease); }
.evcard:hover { transform: translateY(-2px); }
.evcard h2 { color: var(--hero-ink); font-size: 22px; margin-bottom: 2px; }
.evcard .date { display: inline-block; font-size: 12px; font-weight: 800; color: var(--marigold); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.evcard .muted { color: color-mix(in srgb, var(--hero-ink) 70%, transparent); }
.evcard .legend { color: color-mix(in srgb, var(--hero-ink) 78%, transparent); }
.evcard .bar { background: rgba(255,255,255,.14); }
.evcard.past { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.evcard.past h2 { color: var(--ink); } .evcard.past .date { color: var(--muted); }
.evcard.past .muted, .evcard.past .legend { color: var(--muted); } .evcard.past .bar { background: var(--paper2); }
.bar { display: flex; height: 6px; border-radius: var(--pill); overflow: hidden; background: var(--paper2); margin: var(--s4) 0 var(--s2); }
.bar i { display: block; height: 100%; }
.legend { display: flex; gap: var(--s3); flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; }

.evhead { background: var(--hero); color: var(--hero-ink); border-radius: var(--r-lg); padding: var(--s5); overflow: hidden; align-items: flex-start; }
.evhead h1 { color: var(--hero-ink); }
.evhead .meta { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: var(--s2); font-size: 14px; color: color-mix(in srgb, var(--hero-ink) 80%, transparent); }
.evhead .meta span { display: inline-flex; align-items: center; gap: 6px; }
.evhead .btn.ghost { background: rgba(255,255,255,.12); color: var(--hero-ink); box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.evhead .btn.ghost:hover { background: rgba(255,255,255,.2); }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s2); margin: var(--s4) 0 var(--s5); }
.stat { padding: 10px 8px; border: 0; text-align: center; cursor: pointer; background: var(--paper); border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--fast); }
.stat b { display: block; font: 400 24px/1.1 var(--font-display); color: var(--c); }
.stat span { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.on { box-shadow: inset 0 0 0 2px var(--c); }
@media (min-width: 600px) { .stat { padding: 14px 16px; text-align: left; } .stat b { font-size: 30px; } .stat span { font-size: 12.5px; } }

.evgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; }
@media (min-width: 1100px) { .evgrid { grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s5); } }
/* Phones/tablets: surface "Did you forget?" before the guest list */
@media (max-width: 1099px) { .evgrid > aside { display: contents; } .evgrid .forget { order: -1; } .evgrid .panel + .panel { margin-top: 0; } }
.guest { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.guest:first-child { border-top: 0; }
.guest .pinfo { flex-basis: 140px; }
.guest .pinfo b { font-size: 14.5px; }
@media (max-width: 599px) { .guest .acts { width: 100%; padding-left: 48px; justify-content: flex-start; } }
.st { min-height: 34px; border: 0; border-radius: var(--pill); padding: 0 14px; font-size: 12.5px; font-weight: 800; cursor: pointer; appearance: none; -webkit-appearance: none; text-align: center; min-width: 96px;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.x { width: 36px; height: 36px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 50%; font-size: 20px; line-height: 1; }
.x:hover { color: var(--st-no); background: var(--paper2); }
.forget { background: var(--marigold-soft); border-color: transparent; color: var(--marigold-ink); }
.forget .pinfo b { color: var(--ink); }
.forget .muted, .forget .why { color: var(--marigold-ink); opacity: .85; }
.forget .x { color: var(--marigold-ink); }
.forget .btn.ghost { background: rgba(255,255,255,.55); }
@media (prefers-color-scheme: dark) { .forget .btn.ghost { background: rgba(255,255,255,.08); color: var(--ink); } }
.sug { display: flex; align-items: center; gap: var(--s3); padding: 10px 0; border-top: 1px dashed color-mix(in srgb, var(--marigold-ink) 25%, transparent); }
.sug:first-of-type { border-top: 0; }
.sug .why { font-size: 12.5px; }
.qa { position: relative; margin-top: var(--s3); }
.qa input { background: var(--paper2); }
.qa-res { margin-top: 6px; }
.qa-res button { display: flex; width: 100%; text-align: left; gap: var(--s3); align-items: center; min-height: 48px; padding: 6px 8px; border: 0; background: none; border-radius: 12px; cursor: pointer; }
.qa-res button:hover { background: var(--paper2); }
textarea.msg { min-height: 112px; resize: vertical; font-size: 14px; background: var(--paper2); }
.preview { font-size: 13.5px; background: var(--primary-soft); color: var(--primary-soft-ink); border-radius: 14px 14px 14px 4px; padding: 12px 14px; margin: var(--s3) 0 var(--s4); white-space: pre-wrap; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.tools .wide { grid-column: 1 / -1; }

/* checklist */
.ck { width: 100%; border-collapse: collapse; margin-top: 4px; }
.ck th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 800; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.ck td { padding: 10px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ck tr:last-child td { border-bottom: 0; }
.ck th:nth-child(2), .ck td:nth-child(2) { text-align: center; width: 64px; }
.ck th:nth-child(3), .ck td:nth-child(3) { width: 132px; }
.ck tr.done td:first-child b { color: var(--muted); }
.ckb { width: 22px; height: 22px; cursor: pointer; }
.rbs { display: flex; gap: 4px; }
.rb { width: 40px; height: 36px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); border-radius: 10px; cursor: pointer; font-weight: 800; font-size: 15px; transition: background var(--fast), color var(--fast); }
.rb:hover { border-color: var(--c); color: var(--c); }
.rb.on { background: var(--c); border-color: var(--c); color: var(--paper); }

/* ── 9. Sheet / modal (bottom sheet on phones, dialog on desktop) ──────── */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(21,14,31,.48); }
.modal.hidden { display: none; }
.sheet {
  width: 100%; max-height: 92vh; overflow: auto; overscroll-behavior: contain; background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 10px var(--s4) calc(var(--s5) + var(--safe-b));
  box-shadow: var(--shadow-lg); animation: sheet-up var(--base) var(--ease);
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto var(--s4); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 640px) {
  .modal { align-items: center; padding: var(--s4); }
  .sheet { width: min(540px, 100%); border-radius: var(--r-lg); padding: var(--s5); max-height: calc(100vh - 32px); animation-name: pop; }
  .sheet::before { display: none; }
  .sheet.wide { width: min(660px, 100%); }
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.sheet h2 { margin-bottom: var(--s4); }
.foot { display: flex; justify-content: space-between; gap: var(--s2); margin-top: var(--s5); flex-wrap: wrap; }
.ph { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s4); }
.ph .av { width: 80px; height: 80px; font-size: 26px; }
.ph .row { gap: 6px; }
.crow { display: grid; grid-template-columns: 50px 1fr 44px 32px; gap: var(--s2); align-items: center; margin-bottom: var(--s2); }
.crow .cnt { display: none; }
@media (min-width: 520px) { .crow { grid-template-columns: 54px 1fr 44px auto 36px; } .crow .cnt { display: block; } }
.crow input[type=color] { padding: 3px; min-height: 44px; }
.crow input.emo { text-align: center; font-size: 18px; padding: 0; }
.history { font-size: 13px; border-top: 1px solid var(--line); padding-top: var(--s3); margin-top: var(--s2); }
.pklist { max-height: 48vh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--paper2); }
.pkrow { display: flex; gap: var(--s3); align-items: center; min-height: 56px; padding: 8px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.pkrow:first-child { border-top: 0; }
.pkrow:hover { background: var(--paper); }
.pkrow input { width: 22px; height: 22px; flex: none; cursor: pointer; }
.pkrow.locked { opacity: .5; cursor: default; }
.pkrow .tags { margin: 0; justify-content: flex-end; max-width: 45%; }
@media (max-width: 519px) { .pkrow .tags { display: none; } }

/* settings / data */
.cols { display: grid; grid-template-columns: 1fr; gap: var(--s4); }
@media (min-width: 1000px) { .cols { grid-template-columns: 1fr 1fr; } }
.cols .panel p { margin: 4px 0 var(--s4); color: var(--muted); font-size: 14px; }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-b) + 16px); transform: translateX(-50%) translateY(16px); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: var(--pill); font-size: 14px; font-weight: 600;
  opacity: 0; transition: opacity var(--base) var(--ease), transform var(--base) var(--ease); pointer-events: none; max-width: calc(100vw - 32px); text-align: center; box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translateX(-50%); }
@media (min-width: 900px) { #toast { bottom: 28px; } }

/* ── 10. Auth gate ─────────────────────────────────────────────────────── */
#gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--s4); overflow: auto;
  background: radial-gradient(circle at 85% 8%, var(--primary-soft), transparent 38%), radial-gradient(circle at 10% 95%, var(--marigold-soft), transparent 40%), var(--bg); }
#gate[hidden] { display: none; }
.gate-card { width: min(420px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 28px 24px; }
@media (min-width: 480px) { .gate-card { padding: 32px; } }
.gate-card .brand { display: flex; margin: 0 0 var(--s5); font-size: 24px; }
.gate-card h2 { margin-bottom: 6px; font-size: 25px; }
.gate-card p { margin: 0 0 var(--s4); }
.gate-card form { margin-top: var(--s3); }
.gerr { color: var(--st-no); font-size: 13.5px; font-weight: 600; min-height: 18px; margin: -6px 0 var(--s2); }
.gnote { background: var(--marigold-soft); color: var(--marigold-ink); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin-bottom: var(--s3); }
.glinks { display: flex; justify-content: space-between; gap: var(--s3); margin-top: var(--s4); font-size: 14px; flex-wrap: wrap; }
.glinks a { color: var(--primary); text-decoration: none; font-weight: 700; min-height: 32px; display: inline-flex; align-items: center; }
.lock { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: var(--s4); margin: var(--s5) 0 0 !important; }
.lock svg.i { color: var(--peacock); margin-top: 1px; }
.big-ic { width: 72px; height: 72px; margin: 0 auto var(--s3); border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.big-ic svg.i { width: 34px; height: 34px; }
.big-ic.gold { background: var(--marigold-soft); color: var(--marigold-ink); }
.big-ic.teal { background: var(--peacock-soft); color: var(--peacock); }
.big-ic.red { background: color-mix(in srgb, var(--st-no) 14%, transparent); color: var(--st-no); }
.gate-card .big-ic ~ h2, .gate-card .big-ic ~ p { text-align: center; }
.rk { font: 700 17px/1.6 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .06em; text-align: center; background: var(--marigold-soft); color: var(--marigold-ink); border: 1.5px dashed var(--marigold); border-radius: 14px; padding: var(--s4); word-break: break-word; user-select: all; }
.gcheck { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: var(--s2) 0 var(--s4); cursor: pointer; }
.gcheck input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.adm td .row { justify-content: flex-end; }
@media (max-width: 599px) { .adm th:nth-child(2), .adm td:nth-child(2) { display: none; } }

/* soft secondary action (tinted) — used for repeated row actions */
.btn.soft { background: var(--paper); color: var(--primary); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn.soft:hover { background: var(--primary-soft); filter: none; }

/* Phones: keep sheet actions reachable */
@media (max-width: 639px) {
  .sheet > .foot { position: sticky; bottom: calc(-1 * (var(--s5) + var(--safe-b))); background: var(--paper); margin: var(--s4) calc(-1 * var(--s4)) calc(-1 * (var(--s5) + var(--safe-b))); padding: var(--s3) var(--s4) calc(var(--s3) + var(--safe-b)); border-top: 1px solid var(--line); }
}
