@layer theme, base, components, utilities;

/* Kalyana Prapthirasthu design system.
   Tokens: warm ivory paper, handloom indigo, temple gold. Tailwind (browser build) maps these to
   utilities like bg-surface, text-muted, border-line; the component classes below cover the rest. */

:root, [data-theme=light] {
  color-scheme: light;
  --bg: #F8F5EF;
  --surface: #FFFFFF;
  --surface-2: #F3EFE7;
  --surface-3: #EBE5DA;
  --ink: #1C1A26;
  --muted: #6C6875;
  --faint: #9A95A1;
  --line: #E8E2D7;
  --line-strong: #D6CEC0;
  --brand: #34308A;
  --brand-2: #4C46B6;
  --brand-ink: #FFFFFF;
  --brand-soft: #ECEBFA;
  --brand-softer: #F5F4FD;
  --gold: #A9792A;
  --gold-2: #D9AE62;
  --gold-soft: #F8EFDC;
  --rose: #B23E68;
  --rose-soft: #FBE9EF;
  --ok: #1D7A4C;
  --ok-soft: #E3F3EA;
  --warn: #9A5B00;
  --warn-soft: #FDF1DB;
  --danger: #B42318;
  --danger-soft: #FBE8E6;
  --glass: rgba(255, 255, 255, 0.72);
  --shadow-sm: 0 1px 2px rgba(28, 26, 38, 0.05);
  --shadow: 0 1px 2px rgba(28, 26, 38, 0.04), 0 12px 32px -16px rgba(40, 34, 90, 0.18);
  --shadow-lg: 0 2px 6px rgba(28, 26, 38, 0.05), 0 32px 64px -24px rgba(40, 34, 90, 0.32);
  --ring: 0 0 0 4px rgba(76, 70, 182, 0.16);
  --radius: 20px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

[data-theme=dark] {
  color-scheme: dark;
  --bg: #0E0E13;
  --surface: #16161D;
  --surface-2: #1D1D26;
  --surface-3: #262632;
  --ink: #EFECE6;
  --muted: #A6A2AE;
  --faint: #76727E;
  --line: #2A2935;
  --line-strong: #3A3946;
  --brand: #A7A2FF;
  --brand-2: #C2BEFF;
  --brand-ink: #15123A;
  --brand-soft: #24224A;
  --brand-softer: #1B1A33;
  --gold: #E3BD72;
  --gold-2: #F0D49A;
  --gold-soft: #33280F;
  --rose: #F28DB2;
  --rose-soft: #3A1726;
  --ok: #6FD39E;
  --ok-soft: #13301F;
  --warn: #F2B45C;
  --warn-soft: #36260D;
  --danger: #FF8B80;
  --danger-soft: #3B1714;
  --glass: rgba(22, 22, 29, 0.72);
  --shadow-sm: none;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 16px 40px -20px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 32px 64px -24px rgba(0, 0, 0, 0.8);
  --ring: 0 0 0 4px rgba(167, 162, 255, 0.2);
}

@layer components {

* { -webkit-tap-highlight-color: transparent; }
/* Grid and flex children may shrink below their content width; long text then wraps or truncates
   inside the item instead of widening the page on phones. */
.grid > *, .flex-1 { min-width: 0; }
html { scroll-behavior: smooth; }
body { font-size: 15px; line-height: 1.55; min-height: 100vh; font-feature-settings: 'ss01', 'cv11'; }
::selection { background: var(--brand-soft); color: var(--brand); }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 10px; }

.font-display { font-family: 'Instrument Serif', 'Noto Serif Telugu', Georgia, serif; font-weight: 400; letter-spacing: -0.01em; }
.te { font-family: 'Noto Serif Telugu', serif; }
.eyebrow { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.text-balance { text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); font-family: 'Instrument Serif', serif; font-size: 22px; }
.boot img { animation: pulse 1.4s var(--ease) infinite; }
@keyframes pulse { 50% { transform: scale(0.92); opacity: 0.7; } }

/* ---------- motion ---------- */
.page { animation: rise 0.5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
.stagger > * { animation: rise 0.55s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: 40ms; } .stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; } .stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; } .stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; } .stagger > *:nth-child(n+9) { animation-delay: 320ms; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------- buttons ---------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 550; font-size: 14.5px; white-space: nowrap; line-height: 1;
  transition: transform 0.18s var(--ease), background 0.18s, box-shadow 0.18s, border-color 0.18s, color 0.18s, opacity 0.18s;
  user-select: none;
}
.btn i { font-size: 18px; }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled=true] { opacity: 0.5; pointer-events: none; }
.btn-sm { --h: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-sm i { font-size: 16px; }
.btn-lg { --h: 54px; padding: 0 28px; font-size: 16px; }
.btn-icon { width: var(--h); padding: 0; }
.btn-block { width: 100%; }
.btn-primary {
  color: var(--brand-ink);
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(28, 26, 90, 0.2), 0 8px 20px -10px rgba(52, 48, 138, 0.6);
}
.btn-primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 4px rgba(28, 26, 90, 0.2), 0 14px 28px -12px rgba(52, 48, 138, 0.7); transform: translateY(-1px); }
.btn-gold {
  color: #2A1D05; background: linear-gradient(180deg, #F2D49A, #D8A957);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 20px -10px rgba(169, 121, 42, 0.7);
}
.btn-gold:hover { transform: translateY(-1px); }
.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-soft) 70%, var(--brand) 12%); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-ok { background: var(--ok); color: white; }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { transform: translateY(-1px); }
.btn-white { background: white; color: #1C1A26; }

.link { color: var(--brand); font-weight: 550; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-lift { transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s; }
.card-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.panel { background: var(--surface-2); border-radius: var(--radius-sm); }
.divider { height: 1px; background: var(--line); }
.glass { background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); }
.section-title { font-family: 'Instrument Serif', serif; font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; }
.page-title { font-family: 'Instrument Serif', serif; font-size: clamp(34px, 4.4vw, 48px); line-height: 1.04; letter-spacing: -0.015em; }

/* ---------- chips, tags, badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 500;
  transition: all 0.16s var(--ease); white-space: nowrap;
}
.chip:hover { border-color: var(--ink); }
.chip i { font-size: 15px; }
.chip[aria-pressed=true], .chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag i { font-size: 13px; }
.tag-brand { background: var(--brand-soft); color: var(--brand); }
.tag-gold { background: var(--gold-soft); color: var(--gold); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-rose { background: var(--rose-soft); color: var(--rose); }
.tag-muted { background: var(--surface-2); color: var(--muted); }
.tag-glass { background: rgba(255, 255, 255, 0.86); color: #1C1A26; backdrop-filter: blur(8px); }
.dot-badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--rose); color: white; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.count-pill { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 650; }

/* ---------- forms ---------- */
.label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.label .opt { color: var(--faint); font-weight: 500; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.err { font-size: 12.5px; color: var(--danger); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; height: 48px; padding: 0 15px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 120px; padding: 13px 15px; line-height: 1.55; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input[readonly] { background: var(--surface-2); }
.select {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256'%3E%3Cpath fill='%236C6875' d='M213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.input-group { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s; }
.input-group:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.input-group .input { border: 0; box-shadow: none !important; background: transparent; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px 0 15px; color: var(--muted); font-weight: 550; border-right: 1px solid var(--line); }
.input-group .addon-btn { display: grid; place-items: center; padding: 0 14px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14.5px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.opt-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
.opt-card {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 550; font-size: 14.5px; text-align: left;
  transition: all 0.16s var(--ease);
}
.opt-card:hover { border-color: var(--ink); }
.opt-card i { font-size: 20px; color: var(--muted); }
.opt-card[aria-checked=true] { border-color: var(--brand); background: var(--brand-softer); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.opt-card[aria-checked=true] i { color: var(--brand); }

.seg { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-2); border-radius: 999px; border: 1px solid var(--line); }
.seg button { height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 550; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; transition: all 0.16s; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--line); }
.seg-block { display: flex; }
.seg-block button { flex: 1; justify-content: center; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a { position: relative; height: 46px; padding: 0 14px; font-weight: 550; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tabs button:hover, .tabs a:hover { color: var(--ink); }
.tabs [aria-selected=true] { color: var(--ink); }
.tabs [aria-selected=true]::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ink); }

.switch { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); transition: background 0.2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.22s var(--ease); }
.switch[aria-checked=true] { background: var(--brand); }
.switch[aria-checked=true]::after { transform: translateX(18px); }
[data-theme=dark] .switch[aria-checked=true]::after { background: var(--brand-ink); }

input[type=range] { accent-color: var(--brand); width: 100%; }

/* ---------- popover / menu ---------- */
.menu { position: absolute; z-index: 60; min-width: 220px; padding: 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: pop 0.18s var(--ease); }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-size: 14px; text-align: left; color: var(--ink); }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu i { font-size: 18px; color: var(--muted); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu .danger, .menu .danger i { color: var(--danger); }

/* ---------- modal / sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(14, 12, 24, 0.42); backdrop-filter: blur(3px); animation: fade 0.2s; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); animation: pop 0.25s var(--ease); position: relative; max-height: calc(100vh - 40px); overflow: auto; }
.modal-wide { max-width: 760px; }
.modal-head { padding: 24px 24px 0; }
.modal-body { padding: 18px 24px; }
.modal-foot { padding: 0 24px 24px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-x { position: absolute; top: 14px; right: 14px; }
.drawer-scrim { place-items: stretch end; padding: 0; }
.drawer { width: min(460px, 100vw); height: 100vh; max-height: none; border-radius: 26px 0 0 26px; animation: drawer 0.3s var(--ease); display: flex; flex-direction: column; }
@keyframes drawer { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 640px) {
  .scrim:not(.drawer-scrim) { place-items: end stretch; padding: 0; }
  .scrim:not(.drawer-scrim) .modal { max-width: none; border-radius: 26px 26px 0 0; animation: slideup 0.3s var(--ease); max-height: 92vh; }
  .drawer { border-radius: 0; }
}

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 10px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 1023px) { .member .toasts { bottom: 92px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 16px; background: #1C1A26; color: #F6F3EC; box-shadow: var(--shadow-lg); animation: pop 0.25s var(--ease); font-size: 14px; }
[data-theme=dark] .toast { background: #EFECE6; color: #1C1A26; }
.toast i.lead { font-size: 20px; }
.toast .toast-act { margin-left: auto; font-weight: 650; color: var(--gold-2); padding: 4px 8px; border-radius: 8px; white-space: nowrap; }
[data-theme=dark] .toast .toast-act { color: var(--brand-ink); }
.toast-error i.lead { color: #FF9C93; }
.toast-ok i.lead { color: #7BDDA8; }

/* ---------- photos & avatars ---------- */
.photo-empty, .photo-locked { display: grid; place-items: center; align-content: center; gap: 6px; background: linear-gradient(145deg, var(--brand-soft), var(--gold-soft)); color: var(--brand); font-family: 'Instrument Serif', serif; overflow: hidden; }
.photo-empty { container-type: size; }
.photo-empty > span:first-child { font-size: clamp(16px, 34cqmin, 88px); line-height: 1; }
.photo-locked { background: linear-gradient(145deg, var(--surface-3), var(--surface-2)); color: var(--muted); font-family: 'Geist', sans-serif; font-size: 12.5px; font-weight: 550; text-align: center; padding: 8px; }
.photo-locked i { font-size: 26px; }
.av { border-radius: 999px; object-fit: cover; flex: none; background: var(--surface-2); }
.av-stack { display: flex; }
.av-stack > * { margin-left: -10px; border: 2.5px solid var(--surface); }
.av-stack > *:first-child { margin-left: 0; }

/* ---------- profile card ---------- */
.pcard { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s; }
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: transparent; }
.pcard-media { position: relative; display: block; aspect-ratio: 4 / 4.4; overflow: hidden; background: var(--surface-2); }
.pcard-media img, .pcard-media > div { width: 100%; height: 100%; transition: transform 0.6s var(--ease); }
.pcard:hover .pcard-media img { transform: scale(1.04); }
.pcard-media::after { content: ''; position: absolute; inset: auto 0 0 0; height: 28%; background: linear-gradient(to top, rgba(14, 12, 24, 0.16), transparent); pointer-events: none; }
.pcard-badges { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 1; }
.pcard-count { position: absolute; bottom: 10px; left: 12px; z-index: 1; color: white; font-size: 12px; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.pcard-fav { position: absolute; top: 10px; right: 10px; z-index: 2; width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.9); color: #1C1A26; font-size: 18px; backdrop-filter: blur(8px); transition: transform 0.2s var(--ease); }
.pcard-fav:hover { transform: scale(1.08); }
.pcard-fav.on { color: var(--rose); }
[data-theme=dark] .pcard-fav.on { color: #C2335F; }
.pcard-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pcard-name { font-family: 'Instrument Serif', serif; font-size: 23px; line-height: 1.15; letter-spacing: -0.01em; }
.pcard-name:hover { color: var(--brand); }
.pcard-meta { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-foot { margin-top: auto; padding-top: 12px; display: flex; gap: 8px; align-items: center; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }
.topbar { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.navpill { display: inline-flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.navpill a { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 999px; font-weight: 550; font-size: 14px; color: var(--muted); transition: color 0.15s, background 0.15s; }
.navpill a:hover { color: var(--ink); }
.navpill a i { font-size: 18px; }
.navpill a.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 0 0 1px var(--line); }
.navpill .n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--rose); color: white; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.bottomnav { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); }
.bottomnav a { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11.5px; font-weight: 550; color: var(--muted); border-radius: 14px; }
.bottomnav a i { font-size: 23px; }
.bottomnav a.active { color: var(--brand); }
.bottomnav .dot-badge { right: calc(50% - 22px); top: 0; }
.iconbtn { position: relative; width: 42px; height: 42px; border-radius: 999px; display: grid; place-items: center; font-size: 21px; color: var(--ink); transition: background 0.15s; }
.iconbtn:hover { background: var(--surface-2); }
.sidenav a, .sidenav button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border-radius: 12px; font-size: 14px; font-weight: 500; color: var(--muted); text-align: left; transition: background 0.15s, color 0.15s; }
.sidenav a:hover, .sidenav button:hover { background: var(--surface-2); color: var(--ink); }
.sidenav a.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--line); font-weight: 600; }
.sidenav i { font-size: 18px; }
.sidenav .grp { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); font-weight: 650; padding: 16px 12px 6px; }
.sidenav .c { margin-left: auto; font-size: 12px; color: var(--faint); font-weight: 600; }

/* ---------- hero / decorative ---------- */
.hero-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-bg::before { content: ''; position: absolute; width: 900px; height: 900px; left: -200px; top: -420px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 18%, transparent), transparent); }
.hero-bg::after { content: ''; position: absolute; width: 760px; height: 760px; right: -240px; top: -80px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--gold-2) 26%, transparent), transparent); }
.grain { position: absolute; inset: 0; opacity: 0.35; mix-blend-mode: multiply; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
[data-theme=dark] .grain { mix-blend-mode: screen; opacity: 0.25; }
.weave { height: 6px; background-image: repeating-linear-gradient(90deg, var(--brand) 0 14px, transparent 14px 18px, var(--gold-2) 18px 24px, transparent 24px 28px); opacity: 0.85; }
.weave-thin { height: 3px; }
.ikat { background-image: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--gold-2) 45%, transparent) 1.5px, transparent 2px), linear-gradient(45deg, transparent 46%, color-mix(in srgb, var(--brand-2) 22%, transparent) 47% 53%, transparent 54%), linear-gradient(-45deg, transparent 46%, color-mix(in srgb, var(--brand-2) 22%, transparent) 47% 53%, transparent 54%); background-size: 28px 28px; }
.band-dark { background: radial-gradient(1200px 400px at 20% 0%, #4C46B6 0%, transparent 60%), radial-gradient(800px 400px at 100% 100%, rgba(217, 174, 98, 0.35), transparent 60%), #1D1A4A; color: #F3F0FF; }
.gold-text { background: linear-gradient(90deg, #E9C27A, #F6DFAE, #C9963F); -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0 0.14em 0.06em 0.04em; margin: 0 -0.1em 0 -0.04em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.brand-text { background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
  /* Italic glyphs lean past their box; the padding gives the gradient room so no letter is cut. */
  padding: 0 0.14em 0.06em 0.04em; margin: 0 -0.1em 0 -0.04em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* ---------- misc ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 12px; }
.ring-track { stroke: var(--surface-3); }
.ring-val { stroke: url(#ringgrad); transition: stroke-dashoffset 1s var(--ease); }
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 10px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--ink); font-weight: 500; }
.scroll-x { overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { scroll-snap-align: start; }
.bubble { max-width: min(78%, 520px); padding: 10px 14px; border-radius: 20px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.bubble-me { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: var(--brand-ink); border-bottom-right-radius: 6px; }
.bubble-them { background: var(--surface-2); border-bottom-left-radius: 6px; }
details.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0; font-weight: 600; font-size: 15.5px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary i { transition: transform 0.2s; color: var(--muted); }
details.faq[open] summary i { transform: rotate(45deg); }
details.faq > div { padding: 0 0 18px; color: var(--muted); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); font-weight: 650; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr.clickable:hover { background: var(--surface-2); cursor: pointer; }
.bar { border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); transition: height 0.8s var(--ease); }
.chart-cell { position: relative; aspect-ratio: 1; border: 1px solid var(--line-strong); padding: 6px; font-size: 12px; font-weight: 600; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 3px 6px; color: var(--ink); }
.chart-cell .rn { position: absolute; bottom: 4px; right: 6px; font-size: 10px; color: var(--faint); font-weight: 500; }
.chart-cell .pl { color: var(--brand); }
.chart-cell .pl.lg { color: var(--gold); }
.call-screen { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; color: white; background: radial-gradient(900px 600px at 50% 20%, #3B358F, #14122E 70%); animation: fade 0.25s; }
.call-btn { width: 60px; height: 60px; border-radius: 999px; display: grid; place-items: center; font-size: 26px; background: rgba(255, 255, 255, 0.14); color: white; transition: transform 0.15s, background 0.15s; }
.call-btn:hover { background: rgba(255, 255, 255, 0.22); transform: scale(1.05); }
.call-btn.end { background: #E5484D; }
.call-btn.answer { background: #30A46C; }
.call-ring { position: absolute; inset: -14px; border-radius: 999px; border: 2px solid rgba(255, 255, 255, 0.35); animation: ringout 1.8s var(--ease) infinite; }
.call-ring.r2 { animation-delay: 0.6s; }
@keyframes ringout { from { transform: scale(0.9); opacity: 0.9; } to { transform: scale(1.45); opacity: 0; } }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--gold-2)); transition: width 0.6s var(--ease); }
.otp { display: flex; gap: 10px; }
.otp input { width: 56px; height: 64px; text-align: center; font-size: 26px; font-weight: 600; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.otp input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.dev-hint { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 550; }
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 56px 24px; }
.empty .ico { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; font-size: 34px; color: var(--brand); background: linear-gradient(145deg, var(--brand-soft), var(--gold-soft)); margin-bottom: 8px; }
.impersonate { background: repeating-linear-gradient(-45deg, #2A2560 0 12px, #312B6E 12px 24px); color: #F3F0FF; }
.admin-side { background: #15132E; color: #CFCBEA; }
.admin-side a { color: #B5B0D6; }
.admin-side a:hover { background: rgba(255, 255, 255, 0.06); color: white; }
.admin-side a.active { background: rgba(255, 255, 255, 0.1); color: white; box-shadow: none; }
.admin-side .grp { color: #6E699A; }
.admin-side .c { color: #8C87B8; }
.admin-side .c.hot { background: #D9AE62; color: #2A1D05; border-radius: 999px; padding: 0 7px; }

@media (max-width: 420px) { .iconbtn { width: 38px; height: 38px; font-size: 20px; } }

} /* end @layer components */

/* Turnstile bot check: shows only when Cloudflare needs a click. */
.turnstile-slot { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1000; }
