/* CCI Planning — premium dark UI for Celebration Church International.
   Near-black surfaces, warm gold brand accent, PC-green kept for confirm/success. */
:root {
  --bg: #0e1013;
  --bg-soft: #14171c;
  --card: #191d23;
  --card-2: #20252d;
  --card-3: #262c35;
  --border: #2b323c;
  --text: #f0ede6;
  --muted: #a7adb8;
  --muted-2: #6f7784;
  --gold: #d9a94f;
  --gold-deep: #b9862f;
  --gold-soft: rgba(217, 169, 79, 0.13);
  --gold-line: rgba(217, 169, 79, 0.45);
  --green: #6fbf5f;
  --green-soft: rgba(111, 191, 95, 0.13);
  --green-line: rgba(111, 191, 95, 0.45);
  --danger: #e57373;
  --danger-soft: rgba(229, 115, 115, 0.12);
  --warn: #e0b34c;
  --warn-soft: rgba(224, 179, 76, 0.12);
  --info: #7fb2e8;
  --radius: 14px;
  --nav-h: 66px;
  --topbar-h: 58px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0.1px;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
body.route-login { padding-bottom: 0; }

/* ---------- offline bar ---------- */
#offline-bar {
  position: sticky; top: 0; z-index: 60;
  background: #3a2b12; color: #f3d9a0;
  font-size: 13px; font-weight: 600; text-align: center;
  padding: 8px 12px; border-bottom: 1px solid rgba(217, 169, 79, 0.35);
}

/* ---------- top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: rgba(14, 16, 19, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17.5px; letter-spacing: 0.3px; }
.brand-logo img { width: 30px; height: 30px; object-fit: contain; display: block; }
.brand-cross {
  width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto;
  background: linear-gradient(145deg, rgba(217,169,79,0.22), rgba(217,169,79,0.06));
  border: 1px solid var(--gold-line);
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-cross svg { width: 18px; height: 18px; fill: var(--gold); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle {
  display: flex; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; overflow: hidden; padding: 2px;
}
.lang-toggle button {
  border: 0; background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 800; letter-spacing: 0.5px;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  transition: all 0.18s var(--ease); min-height: 34px;
}
.lang-toggle button.active {
  background: linear-gradient(145deg, var(--gold), var(--gold-deep));
  color: #171204; box-shadow: 0 2px 10px rgba(217, 169, 79, 0.35);
}
.icon-btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.12s var(--ease), border-color 0.15s;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.text-btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  font-size: 13px; font-weight: 700; padding: 9px 14px; border-radius: 999px; cursor: pointer;
  transition: transform 0.12s var(--ease);
}
.text-btn:active { transform: scale(0.96); }

/* ---------- main view ---------- */
#view { max-width: 740px; margin: 0 auto; padding: 18px 14px 36px; }
#view:empty { padding: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 16px; }
.page-head h1 { font-size: 24px; margin: 0; font-weight: 800; letter-spacing: 0.2px; }
.page-head h2 { font-size: 20px; margin: 0; font-weight: 750; }
.page-head > div { display: flex; gap: 8px; align-items: center; }
.page-sub { color: var(--muted); font-size: 13.5px; margin: -10px 0 16px; }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, var(--card), #161a20);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px; margin: 0 0 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  animation: fadeUp 0.28s var(--ease) both;
}
.card.tight { padding: 11px 13px; }
.card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 750; }
.card .row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- skeleton loading ---------- */
.skel {
  position: relative; overflow: hidden;
  background: var(--card-2); border-radius: 8px; min-height: 16px;
}
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.07) 50%, transparent 80%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skel-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; margin-bottom: 12px; }
.skel-line { height: 14px; margin: 8px 0; }
.skel-line.w60 { width: 60%; } .skel-line.w40 { width: 40%; } .skel-line.w80 { width: 80%; }
.skel-title { height: 20px; width: 45%; margin-bottom: 10px; }

/* ---------- empty states ---------- */
.empty { text-align: center; color: var(--muted); padding: 34px 18px; font-size: 14.5px; animation: fadeUp 0.3s var(--ease) both; }
.empty .empty-icon {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px;
  background: var(--gold-soft); border: 1px solid var(--gold-line);
  display: flex; align-items: center; justify-content: center;
}
.empty .empty-icon svg { width: 28px; height: 28px; fill: var(--gold); opacity: 0.9; }
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.empty p { margin: 0; font-size: 13.5px; }

/* ---------- badges ---------- */
.badge {
  display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: 0.3px;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.badge.confirmed { background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); }
.badge.declined { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(229,115,115,.4); }
.badge.unconfirmed { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(224,179,76,.4); }
.badge.needed { background: transparent; color: var(--muted); border: 1px dashed var(--border); }
.badge.kind-service { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line); }
.badge.kind-other { background: var(--card-2); color: var(--info); border: 1px solid var(--border); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 12px; cursor: pointer;
  font-size: 15px; font-weight: 750; letter-spacing: 0.2px;
  padding: 12px 18px; color: #171204;
  background: linear-gradient(145deg, #e6ba63, var(--gold-deep));
  box-shadow: 0 4px 16px rgba(217, 169, 79, 0.25);
  transition: transform 0.1s var(--ease), box-shadow 0.18s var(--ease), filter 0.15s;
  min-height: 48px;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.97); box-shadow: 0 2px 8px rgba(217, 169, 79, 0.2); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn.block { display: flex; width: 100%; }
.btn.secondary { background: var(--card-2); color: var(--text); border-color: var(--border); box-shadow: none; }
.btn.green { background: linear-gradient(145deg, #7fcb70, #4e9c41); color: #0d140c; box-shadow: 0 4px 16px rgba(111,191,95,.22); }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(229,115,115,.5); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--border); box-shadow: none; }
.btn.small { font-size: 13px; padding: 8px 13px; border-radius: 9px; min-height: 38px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.link-btn { background: none; border: 0; color: var(--gold); font-size: 14px; font-weight: 700; cursor: pointer; padding: 6px 2px; }
.link-btn.danger-link { color: var(--danger); }

/* ---------- forms ---------- */
form.stack > * { margin-bottom: 12px; }
label.f { display: block; font-size: 12.5px; font-weight: 750; letter-spacing: 0.4px; text-transform: uppercase; color: var(--muted); margin: 0 0 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="number"], select, textarea {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px; padding: 12px 13px; font-size: 15.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 169, 79, 0.18);
}
textarea { min-height: 110px; resize: vertical; }
input[type="checkbox"].chk { width: 22px; height: 22px; accent-color: var(--gold); flex: 0 0 auto; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 14.5px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input, .inline-form select { flex: 1; min-width: 0; }
fieldset.group { border: 1px solid var(--border); border-radius: var(--radius); padding: 13px; margin: 0 0 15px; background: var(--card); }
fieldset.group legend { font-size: 12.5px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); padding: 0 7px; }

/* ---------- bottom nav ---------- */
#bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(15, 17, 21, 0.97);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--muted-2); text-decoration: none; font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
  transition: color 0.18s var(--ease);
}
#bottomnav a svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.18s var(--ease); }
#bottomnav a.active { color: var(--gold); }
#bottomnav a.active svg { transform: translateY(-1px); }
#bottomnav a:active svg { transform: scale(0.88); }
#bottomnav a { position: relative; }
.nav-badge {
  position: absolute; top: 4px; right: calc(50% - 20px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--gold); color: #1a1408; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 7px; overflow-x: auto; margin: 0 0 16px; padding: 2px 2px 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 1 0 auto; text-align: center; text-decoration: none; color: var(--muted);
  font-size: 14px; font-weight: 750; padding: 10px 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border); white-space: nowrap;
  transition: all 0.18s var(--ease);
}
.tabs a:active { transform: scale(0.96); }
.tabs a.active {
  color: #171204; background: linear-gradient(145deg, #e6ba63, var(--gold-deep));
  border-color: transparent; box-shadow: 0 4px 14px rgba(217, 169, 79, 0.3);
}

/* ---------- plan order ---------- */
.section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 12px; overflow: hidden; animation: fadeUp 0.28s var(--ease) both; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 13px; background: linear-gradient(180deg, var(--card-2), var(--card));
  border-bottom: 1px solid var(--border);
}
.section-head h3 { margin: 0; font-size: 14.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; }
.section-head .dur { font-size: 12.5px; color: var(--gold); font-weight: 750; }
.item { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .iname { font-weight: 650; font-size: 14.5px; }
.item .inotes { font-size: 12.5px; color: var(--muted); }
.item .dur-chip {
  flex: 0 0 auto; font-size: 12.5px; font-weight: 800; color: var(--gold);
  background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 8px; padding: 3px 9px;
}
.mini-btns { display: flex; gap: 1px; flex: 0 0 auto; }
.mini-btn {
  border: 0; background: transparent; color: var(--muted-2); cursor: pointer;
  font-size: 16px; padding: 8px 8px; border-radius: 9px; line-height: 1; min-width: 36px; min-height: 36px;
  transition: all 0.13s var(--ease);
}
.mini-btn:hover { color: var(--text); background: var(--card-2); }
.mini-btn:active { transform: scale(0.9); }
.mini-btn.danger:hover { color: var(--danger); }

/* ---------- teams ---------- */
.team-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 12px; overflow: hidden; animation: fadeUp 0.28s var(--ease) both; }
.team-head { padding: 12px 13px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; background: linear-gradient(180deg, var(--card-2), var(--card)); }
.team-head h3 { margin: 0; font-size: 15.5px; font-weight: 750; }
.pos-row { padding: 11px 13px; border-bottom: 1px solid var(--border); }
.pos-row:last-child { border-bottom: 0; }
.pos-name { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.assign-chip {
  display: inline-flex; align-items: center; gap: 7px; margin: 7px 7px 0 0;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 6px 5px 12px; font-size: 13.5px; cursor: default;
  transition: outline-color 0.15s, transform 0.12s var(--ease);
}
.assign-chip.pickable { cursor: pointer; }
.assign-chip.pickable:active { transform: scale(0.96); }
.assign-chip .x {
  border: 0; background: var(--card-3); color: var(--muted); border-radius: 50%;
  width: 24px; height: 24px; cursor: pointer; font-size: 13px; line-height: 1;
}
.assign-chip .x:hover { color: var(--danger); }
.assign-chip.swap-pick { outline: 2px solid var(--gold); outline-offset: 1px; }
.tally { font-size: 12.5px; color: var(--muted); }

/* ---------- schedule ---------- */
.sched-card .meta { display: grid; gap: 5px; margin: 9px 0; font-size: 14px; }
.sched-card .meta .k { color: var(--muted); font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); margin-bottom: 15px; animation: fadeUp 0.28s var(--ease) both; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 580px; }
table.tbl th, table.tbl td { text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tbl th { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); background: var(--card-2); }
table.tbl tr:last-child td { border-bottom: 0; }

/* ---------- login (front door) ---------- */
.login-screen {
  min-height: calc(100vh - var(--topbar-h));
  min-height: calc(100dvh - var(--topbar-h));
  display: flex; align-items: center; justify-content: center;
  padding: 28px 16px 40px;
  background:
    radial-gradient(600px 340px at 50% -40px, rgba(217, 169, 79, 0.14), transparent 70%),
    radial-gradient(500px 300px at 85% 110%, rgba(111, 191, 95, 0.06), transparent 70%);
}
.login-card { width: 100%; max-width: 400px; animation: fadeUp 0.4s var(--ease) both; }
.logo-mark {
  width: 84px; height: 84px; border-radius: 26px; margin: 0 auto 18px;
  background: linear-gradient(145deg, rgba(217,169,79,0.28), rgba(217,169,79,0.07));
  border: 1px solid var(--gold-line);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 34px rgba(217, 169, 79, 0.22), inset 0 1px 0 rgba(255,255,255,0.08);
}
.logo-mark svg { width: 44px; height: 44px; fill: var(--gold); }
.logo-mark img { width: 58px; height: 58px; object-fit: contain; display: block; }
.login-card h1 { text-align: center; font-size: 27px; margin: 0 0 5px; font-weight: 850; letter-spacing: 0.3px; }
.login-card .church { text-align: center; color: var(--gold); font-size: 12.5px; font-weight: 750; letter-spacing: 1.6px; text-transform: uppercase; margin: 0 0 8px; }
.login-card .tag { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }
.form-card {
  background: linear-gradient(180deg, var(--card), #151920);
  border: 1px solid var(--border); border-radius: 18px; padding: 22px 18px;
  box-shadow: var(--shadow);
}
.form-err { background: var(--danger-soft); border: 1px solid rgba(229,115,115,.45); color: var(--danger); border-radius: 12px; padding: 11px 13px; font-size: 13.5px; margin-bottom: 13px; font-weight: 600; }

/* ---------- public respond page ---------- */
.respond-hero {
  text-align: center; padding: 26px 10px 18px;
  background: radial-gradient(500px 260px at 50% -60px, rgba(217, 169, 79, 0.16), transparent 70%);
  border-radius: 0 0 24px 24px; margin: -18px -14px 16px;
}
.respond-hero .logo-mark { width: 68px; height: 68px; margin-bottom: 12px; }
.respond-hero h1 { font-size: 22px; margin: 0 0 4px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 100; display: none; max-width: 560px; margin: 0 auto;
}
#toast.show { display: block; animation: fadeUp 0.22s var(--ease) both; }
#toast .inner {
  background: var(--card-3); border: 1px solid var(--border); color: var(--text);
  border-radius: 14px; padding: 13px 15px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow);
}
#toast .inner.error { border-color: rgba(229,115,115,.65); }
#toast .inner.ok { border-color: var(--gold-line); }

/* ---------- misc ---------- */
.loading { text-align: center; color: var(--muted); padding: 44px 0; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
details.collapse { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; animation: fadeUp 0.28s var(--ease) both; }
details.collapse summary { padding: 13px 15px; cursor: pointer; font-weight: 750; font-size: 14.5px; list-style: none; }
details.collapse summary::-webkit-details-marker { display: none; }
details.collapse summary::after { content: "›"; float: right; color: var(--gold); font-size: 18px; transform: rotate(90deg); transition: transform 0.18s var(--ease); }
details.collapse[open] summary::after { transform: rotate(-90deg); }
details.collapse .body { padding: 0 15px 15px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 13px; }
.toolbar input, .toolbar select { flex: 1; min-width: 120px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.phase2-icon { font-size: 44px; margin-bottom: 8px; }

@media (min-width: 720px) {
  body { font-size: 15.5px; }
  #view { padding: 26px 20px 52px; }
  .page-head h1 { font-size: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Welcome / guest intake */
.badge.newcomer { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line);
  font-size: 12px; font-weight: 600; line-height: 1.35;
}
.chip.more { background: var(--card-2); color: var(--muted); border-color: var(--border); }
.guest-row { display: block; color: inherit; text-decoration: none; }
.guest-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chev { color: var(--muted); font-size: 22px; line-height: 1; }
.scan-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.file-btn { cursor: pointer; }
.scan-preview { margin-top: 10px; }
.scan-thumb {
  width: 100%; max-width: 340px; border-radius: 12px; border: 1px solid var(--border);
  display: block; box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.ocr-review {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--gold-soft); border: 1px solid var(--gold-line);
}
.ocr-review h4 { margin: 0 0 4px; font-size: 14px; }
.ocr-review p { margin: 0 0 8px; }
.ocr-text {
  white-space: pre-wrap; font-size: 12.5px; line-height: 1.5; margin: 0;
  max-height: 180px; overflow: auto; color: var(--text);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .form-grid { grid-template-columns: 1fr; } }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--gold-soft); border: 1px solid var(--gold-line); }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; color: var(--gold); font-weight: 700; font-size: 15px; }
.avatar-btn { background: none; border: none; padding: 0; cursor: pointer; position: relative; }
.avatar-btn::after { content: '✎'; position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: #1a1a1a; font-size: 11px; line-height: 18px; text-align: center; }
.person-row { display: flex; gap: 12px; align-items: flex-start; }
/* photo source chooser */
.photo-sheet { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; animation: psfade .18s ease; }
.photo-sheet-card { width: 100%; max-width: 520px; background: var(--card); border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); }
@keyframes psfade { from { opacity: 0; } }
/* ---- Splash screen (plays on app open, fades into login) ---- */
#splash { position: fixed; inset: 0; z-index: 200; overflow: hidden; background: #0e1013;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .6s ease; }
#splash.done { opacity: 0; pointer-events: none; }
.sp-bg { position: absolute; inset: -40%; background:
  radial-gradient(ellipse 60% 45% at 20% 15%, rgba(217,169,79,.38), transparent 70%),
  radial-gradient(ellipse 55% 50% at 85% 80%, rgba(243,217,160,.16), transparent 70%),
  radial-gradient(ellipse 40% 35% at 70% 20%, rgba(120,85,30,.42), transparent 70%),
  linear-gradient(160deg,#0e1013 0%,#171204 45%,#241a08 100%);
  animation: spbg 8s ease-in-out infinite alternate; }
@keyframes spbg { from { transform: translate3d(-2%,-1%,0) scale(1); } to { transform: translate3d(2%,2%,0) scale(1.06); } }
.sp-waves { position: absolute; inset: 0; opacity: .5; }
.sp-waves svg { position: absolute; bottom: -6%; left: -20%; width: 140%; height: 60%; animation: spwave 7s ease-in-out infinite alternate; }
.sp-waves .sp-w2 { animation-duration: 11s; opacity: .6; bottom: auto; top: -4%; }
@keyframes spwave { from { transform: translateX(-4%); } to { transform: translateX(4%); } }
.sp-frame { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); }
.sp-frame rect { fill: none; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1100; stroke-dashoffset: 1100; animation: spdraw 1.5s ease-out .3s forwards; }
.sp-frame .sp-f2 { stroke-dashoffset: -1100; }
@keyframes spdraw { to { stroke-dashoffset: 0; } }
.sp-center { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; padding: 0 24px;
  animation: sprise 1s cubic-bezier(.2,.8,.25,1) .15s both; }
@keyframes sprise { from { opacity: 0; transform: translateY(26px) scale(.94); } to { opacity: 1; transform: none; } }
.sp-logo { width: 118px; height: auto; animation: spglow 3s ease-in-out 1.1s infinite alternate; }
@keyframes spglow { from { filter: drop-shadow(0 6px 18px rgba(217,169,79,.4)); } to { filter: drop-shadow(0 6px 32px rgba(243,217,160,.6)); } }
.sp-title { margin-top: 20px; color: #fff; font-weight: 800; font-size: 30px; letter-spacing: 2px; text-align: center; }
.sp-sub { margin-top: 8px; color: #f3d9a0; font-size: 11px; letter-spacing: 3.5px; text-align: center; }

/* ---------------- chat ---------------- */
.chat-wrap { display: flex; flex-direction: column; gap: 12px; }
.chat-channels { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chat-chan { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 9px 13px;
  color: var(--text); cursor: pointer; }
.chat-chan.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.chat-chan-name { font-weight: 700; font-size: 14px; }
.chat-chan-kind { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.chat-thread { display: flex; flex-direction: column; }
.chat-msgs { display: flex; flex-direction: column; gap: 10px; max-height: 52vh; overflow-y: auto;
  padding: 6px 2px; }
.chat-msg { max-width: 88%; }
.chat-msg .chat-who { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.chat-msg .chat-body { background: var(--card); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px;
  padding: 9px 12px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: break-word; }
.chat-msg.mine { align-self: flex-end; }
.chat-msg.mine .chat-who { text-align: right; }
.chat-msg.mine .chat-body { background: rgba(217,169,79,.14); border-color: rgba(217,169,79,.45);
  border-radius: 14px 4px 14px 14px; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; position: sticky; bottom: 0; }
.chat-form input { flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 13px; color: var(--text); font-size: 15px; }
.chat-form input:focus { outline: none; border-color: var(--gold); }
