/* Kesar — the Jain Mahasangh design system. One stylesheet for the member app and the admin.
   Class names match the existing views (btn, card, list-item, badge, tree-node…), so a page adopts
   it by linking this file instead of app.css / admin.css. Documented at /designsystem/. */

/* ---------- tokens ---------- */
:root {
    --kesar-50: #FDF3EC; --kesar-100: #FBE3D3; --kesar-200: #F5C3A5; --kesar-300: #EC9A70; --kesar-400: #DB6E40;
    --kesar-500: #B4441B; --kesar-600: #983812; --kesar-700: #7B2D0E; --kesar-800: #5A210B; --kesar-900: #3B1607;
    --haldi-50: #FEF8EA; --haldi-100: #FCEDC6; --haldi-300: #F3C76E; --haldi-500: #E9A23B; --haldi-700: #9A6210;
    --chandan-0: #FFFFFF; --chandan-50: #FBF7F2; --chandan-100: #F5EEE5; --chandan-200: #E9E0D4; --chandan-300: #D6CABA;
    --chandan-400: #AC9F8F; --chandan-500: #857868; --chandan-600: #6A5E52; --chandan-700: #4A4038; --chandan-800: #2E2721; --chandan-900: #1C1714;
    --tulsi-50: #EDF7EF; --tulsi-600: #2E7D32;
    --neel-50: #EDF3FA; --neel-600: #2F5D8A;
    --sindoor-50: #FCEEEC; --sindoor-600: #B3261E;
    --slate-50: #EFF1F3; --slate-600: #56606B;
    --wa: #15803D;

    --bg: var(--chandan-50);
    --surface: var(--chandan-0);
    --surface-2: var(--chandan-100);
    --border: var(--chandan-200);
    --border-strong: var(--chandan-300);
    --text: var(--chandan-900);
    --text-2: var(--chandan-700);
    --muted: var(--chandan-600);
    --primary: var(--kesar-500);
    --primary-hover: var(--kesar-600);
    --primary-soft: var(--kesar-50);
    --on-primary: #FFFFFF;
    --accent: var(--haldi-500);
    --accent-soft: var(--haldi-50);
    --success: var(--tulsi-600); --success-soft: var(--tulsi-50);
    --warning: var(--haldi-700); --warning-soft: var(--haldi-50);
    --danger: var(--sindoor-600); --danger-soft: var(--sindoor-50);
    --info: var(--neel-600); --info-soft: var(--neel-50);
    --quiet: var(--slate-600); --quiet-soft: var(--slate-50);
    --sidebar-bg: var(--kesar-800);

    --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Tamil', 'Noto Sans Devanagari', sans-serif;
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --text-xs: .75rem; --text-sm: .875rem; --text-md: 1rem; --text-lg: 1.125rem;
    --text-xl: 1.25rem; --text-2xl: 1.5rem; --text-3xl: 1.875rem; --text-4xl: 2.25rem;

    --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
    --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;

    --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 24px; --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgb(59 22 7 / .06);
    --shadow-md: 0 1px 2px rgb(59 22 7 / .05), 0 6px 16px -4px rgb(59 22 7 / .12);
    --shadow-lg: 0 2px 4px rgb(59 22 7 / .06), 0 18px 40px -12px rgb(59 22 7 / .25);
    --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
    --ease: cubic-bezier(.2, .7, .2, 1);
    --dur: 160ms;
    --tap: 44px;
    color-scheme: light;
}

/* ponytail: dark tokens are listed twice (system preference + explicit toggle); CSS has no way to share one block for both. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #14100D; --surface: #1E1814; --surface-2: #28201B; --border: #3A2F27; --border-strong: #4D4036;
        --text: #F5EEE5; --text-2: #D9CEC1; --muted: #AFA292;
        --primary: #E57A4B; --primary-hover: #EE915F; --primary-soft: rgb(229 122 75 / .14); --on-primary: #1C1714;
        --accent: #F0B455; --accent-soft: rgb(240 180 85 / .14);
        --success: #6CC57A; --success-soft: rgb(108 197 122 / .14); --warning: #F0B455; --warning-soft: rgb(240 180 85 / .14);
        --danger: #F2867D; --danger-soft: rgb(242 134 125 / .14); --info: #82AEDB; --info-soft: rgb(130 174 219 / .14);
        --quiet: #A3ADB8; --quiet-soft: rgb(163 173 184 / .14); --sidebar-bg: #1A1310;
        --shadow-sm: 0 1px 2px rgb(0 0 0 / .3); --shadow-md: 0 6px 16px -4px rgb(0 0 0 / .45); --shadow-lg: 0 18px 40px -12px rgb(0 0 0 / .6);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #14100D; --surface: #1E1814; --surface-2: #28201B; --border: #3A2F27; --border-strong: #4D4036;
    --text: #F5EEE5; --text-2: #D9CEC1; --muted: #AFA292;
    --primary: #E57A4B; --primary-hover: #EE915F; --primary-soft: rgb(229 122 75 / .14); --on-primary: #1C1714;
    --accent: #F0B455; --accent-soft: rgb(240 180 85 / .14);
    --success: #6CC57A; --success-soft: rgb(108 197 122 / .14); --warning: #F0B455; --warning-soft: rgb(240 180 85 / .14);
    --danger: #F2867D; --danger-soft: rgb(242 134 125 / .14); --info: #82AEDB; --info-soft: rgb(130 174 219 / .14);
    --quiet: #A3ADB8; --quiet-soft: rgb(163 173 184 / .14); --sidebar-bg: #1A1310;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .3); --shadow-md: 0 6px 16px -4px rgb(0 0 0 / .45); --shadow-lg: 0 18px 40px -12px rgb(0 0 0 / .6);
    color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-md);
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; color: var(--text); }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p { margin: 0 0 .75em; }
a { color: var(--primary); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
code { font-size: .9em; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); }
hr, .divider { border: 0; height: 1px; background: var(--border); margin: var(--space-4) 0; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ---------- utilities ---------- */
.muted { color: var(--muted); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.eyebrow { font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack-sm { gap: var(--space-2); }
.stack-lg { gap: var(--space-6); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.row-between { justify-content: space-between; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: var(--tap); padding: 10px 18px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; line-height: 1.2; white-space: nowrap;
    text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn-secondary { background: var(--surface); }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-soft:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-whatsapp { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-whatsapp:hover { background: #166534; border-color: #166534; color: #fff; }
.btn-sm { min-height: 40px; padding: 6px 14px; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-lg { min-height: 52px; padding: 14px 24px; font-size: var(--text-lg); border-radius: var(--radius-lg); }
.btn-block { display: flex; width: 100%; }
.btn-icon { padding: 0; width: var(--tap); }
.btn-sm.btn-icon { width: 40px; }
.btn[aria-busy="true"] { pointer-events: none; }
.btn[aria-busy="true"]::before { content: ''; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ds-spin .7s linear infinite; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.form-group > .muted { font-size: var(--text-sm); margin: 0; }
.form-label { font-weight: 600; font-size: var(--text-sm); color: var(--text-2); }
.form-control {
    display: block; width: 100%; min-height: 48px; padding: 12px 14px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: max(16px, 1rem); /* 16px stops iOS zooming into the field */
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.form-control::placeholder { color: var(--muted); opacity: .75; }
.form-control:hover { border-color: var(--muted); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.form-control[aria-invalid="true"] { border-color: var(--danger); }
.form-control:disabled, div.form-control { background: var(--surface-2); color: var(--text-2); display: flex; align-items: center; }
textarea.form-control { min-height: 112px; resize: vertical; }
select.form-control {
    appearance: none; padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23857868' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
input[type="file"].form-control { padding: 8px; }
input[type="file"].form-control::file-selector-button { margin-right: 12px; padding: 8px 14px; border: 0; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }
.form-error { color: var(--danger); font-size: var(--text-sm); font-weight: 500; }
.form-check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--primary); }

/* <input type="checkbox" role="switch" class="switch"> */
input.switch { appearance: none; position: relative; width: 46px; height: 28px; border-radius: var(--radius-pill); background: var(--border-strong); cursor: pointer; transition: background var(--dur) var(--ease); }
input.switch::before { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform var(--dur) var(--ease); }
input.switch:checked { background: var(--primary); }
input.switch:checked::before { transform: translateX(18px); }
.switch-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-row > span { flex: 1; min-width: 0; }
.switch-row small { display: block; color: var(--muted); font-size: var(--text-sm); }

.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .form-control { padding-left: 44px; }
.input-addon { display: flex; }
.input-addon > span { display: flex; align-items: center; padding: 0 14px; border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.input-addon > .form-control { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* One field, not six boxes: keeps autocomplete="one-time-code" and paste working. */
.form-control.otp { font-size: 1.75rem; font-weight: 600; text-align: center; letter-spacing: .5em; padding-left: calc(14px + .5em); font-variant-numeric: tabular-nums; }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--space-6); border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); text-align: center; cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.dropzone:hover, .dropzone:focus-within { border-color: var(--primary); background: var(--primary-soft); }
.dropzone > .icon { width: 28px; height: 28px; color: var(--primary); }
.dropzone small { color: var(--muted); font-size: var(--text-sm); }

/* RSVP and other one-of-few choices: buttons with aria-pressed. */
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-2); }
.segmented > * { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 8px; white-space: nowrap; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-2); font: inherit; font-weight: 600; font-size: var(--text-sm); cursor: pointer; text-decoration: none; }
.segmented > [aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-md); }
.segmented .icon { width: 16px; height: 16px; }
.segmented-sm > * { min-height: 32px; padding: 4px 8px; font-size: var(--text-xs); }

/* ---------- cards, lists ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
img.card { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; padding: 0; }
.card-body { padding: var(--space-5); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { margin: 0; font-size: var(--text-lg); }
.card-footer { display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); color: inherit; }
.card-title { display: block; margin: 0; font-weight: 600; font-size: var(--text-md); line-height: 1.35; color: var(--text); text-decoration: none; }
a.card-title:hover { color: var(--primary); }
.is-cancelled .card-title { text-decoration: line-through; color: var(--muted); }

.media { display: flex; gap: 14px; align-items: flex-start; }
.media-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: var(--text-sm); }
.meta > span { display: inline-flex; align-items: center; gap: 4px; }
.meta .icon { width: 14px; height: 14px; }
.thumb { width: 76px; height: 76px; flex: none; border-radius: var(--radius-md); object-fit: cover; background: var(--surface-2); }

.list { display: flex; flex-direction: column; gap: var(--space-2); }
.list-item { display: flex; align-items: center; gap: var(--space-3); min-height: 64px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.list-item > div { flex: 1; min-width: 0; }
.list-item strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .muted { font-size: var(--text-sm); }
.list-item a:not(.btn) { color: inherit; text-decoration: none; }
.list-item > .chev { color: var(--muted); }
.list-grouped { gap: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.list-grouped .list-item { border: 0; border-radius: 0; border-bottom: 1px solid var(--border); }
.list-grouped .list-item:last-child { border-bottom: 0; }
a.list-item:hover, .list-grouped a.list-item:hover { background: var(--surface-2); color: inherit; }
a.list-item { color: inherit; text-decoration: none; }

.details { margin: 0; }
.details > div { display: grid; grid-template-columns: minmax(104px, 34%) 1fr; gap: var(--space-3); align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.details > div:last-child { border-bottom: 0; }
.details dt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--text-sm); }
.details dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: var(--space-6) 0 10px; font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.section-title a { font-size: var(--text-sm); font-weight: 600; letter-spacing: 0; text-transform: none; text-decoration: none; }

/* ---------- badges, chips, tabs ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-2); font-size: var(--text-xs); font-weight: 600; line-height: 1.4; white-space: nowrap; vertical-align: middle; }
.badge .icon { width: 12px; height: 12px; }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-primary, .badge-announcement { background: var(--primary-soft); color: var(--primary); }
.badge-success, .badge-achievement { background: var(--success-soft); color: var(--success); }
.badge-warning, .badge-event { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info, .badge-news { background: var(--info-soft); color: var(--info); }
.badge-muted, .badge-death { background: var(--quiet-soft); color: var(--quiet); }

.chips { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--space-4)); padding: 2px var(--space-4); }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; flex: none; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface); color: var(--text-2); font-size: var(--text-sm); font-weight: 500; text-decoration: none; white-space: nowrap; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
a.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip-active, a.chip-active:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
span.chip, p.chip { min-height: 26px; margin: 0; padding: 2px 10px; border-color: transparent; background: var(--surface-2); font-size: var(--text-xs); font-weight: 600; }

.tabs { display: flex; gap: 4px; margin-bottom: var(--space-4); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; padding: 12px 14px; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab-active, .tab[aria-current="page"] { color: var(--primary); }
.tab-active::after, .tab[aria-current="page"]::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }

/* ---------- avatars ---------- */
.avatar { --size: 40px; display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--size); height: var(--size); border-radius: 50%; object-fit: cover; background: var(--kesar-500); color: #fff; font-weight: 600; font-size: calc(var(--size) * .38); letter-spacing: .02em; user-select: none; }
.avatar-sm { --size: 32px; }
.avatar-md { --size: 56px; }
.avatar-lg { --size: 96px; }
.avatar[data-tone="1"] { background: var(--haldi-700); }
.avatar[data-tone="2"] { background: var(--tulsi-600); }
.avatar[data-tone="3"] { background: var(--neel-600); }
.avatar[data-tone="4"] { background: #7A4A7E; }
.avatar[data-tone="5"] { background: #2D7474; }
.avatar-late { filter: grayscale(1); opacity: .75; }
.avatar-ring { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--primary); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -10px; }

/* ---------- feedback ---------- */
.flash { display: flex; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-4); padding: 12px 16px; border: 1px solid transparent; border-radius: var(--radius-md); font-weight: 500; }
.flash .icon { margin-top: 2px; }
.flash-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); color: var(--success); }
.flash-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); }
.flash-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); color: var(--info); }
.flash-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 25%, transparent); color: var(--warning); }

.callout { display: flex; gap: 14px; padding: var(--space-4); border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)); }
.callout-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.callout h3 { margin: 0 0 2px; font-family: var(--font-sans); font-size: var(--text-md); }
.callout p { margin: 0 0 var(--space-3); color: var(--text-2); font-size: var(--text-sm); }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--space-10) var(--space-5); text-align: center; color: var(--muted); }
.empty-state > .icon { width: 40px; height: 40px; stroke-width: 1.5; color: var(--border-strong); margin-bottom: 4px; }
.empty-state strong { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; color: var(--text); }

.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: var(--space-5) 0; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: var(--text-sm); text-decoration: none; }
.pagination a:hover { border-color: var(--border-strong); color: var(--text); }
.pagination span { background: var(--text); border-color: var(--text); color: var(--bg); }
.pagination a:only-child { flex: 1; min-height: var(--tap); }

/* ---------- member app ---------- */
.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-2); min-height: 56px; padding: env(safe-area-inset-top) var(--space-2) 0 var(--space-4); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); }
.app-header h1 { flex: 1; min-width: 0; margin: 0; font-size: var(--text-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-header a { color: var(--text); text-decoration: none; }
.app-header .btn-icon { margin-left: calc(-1 * var(--space-2)); }
.app-main { max-width: 640px; margin: 0 auto; padding: var(--space-4) var(--space-4) calc(96px + env(safe-area-inset-bottom)); }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--border); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; -webkit-tap-highlight-color: transparent; }
/* the svg doubles as the active pill: padding around a 24px icon */
.bottom-nav svg { width: 56px; height: 32px; padding: 4px 16px; border-radius: var(--radius-pill); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: background var(--dur) var(--ease); }
.bottom-nav a.active, .bottom-nav a[aria-current="page"] { color: var(--primary); }
.bottom-nav a.active svg, .bottom-nav a[aria-current="page"] svg { background: var(--primary-soft); }

/* bottom sheet on a native <dialog>: Esc, focus trap and backdrop come free */
dialog.sheet { width: 100%; max-width: 560px; max-height: 90vh; margin: auto auto 0; padding: var(--space-6) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom)); border: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.sheet[open] { animation: ds-sheet-up 220ms var(--ease); }
dialog.sheet::backdrop { background: rgb(28 23 20 / .45); }
@keyframes ds-sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 600px) { dialog.sheet { margin: auto; border-radius: var(--radius-xl); } }
.sheet h2 { margin: 0; font-size: var(--text-xl); }
.sheet-icon { width: 56px; height: 56px; flex: none; border-radius: 14px; box-shadow: var(--shadow-md); object-fit: cover; }
.install-steps { display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-5) 0; padding: 0; list-style: none; counter-reset: step; }
.install-steps li { display: flex; align-items: center; gap: var(--space-3); padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-2); font-size: var(--text-sm); }
.install-steps li::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: var(--text-xs); font-weight: 700; }
.install-steps .icon { color: var(--primary); }

.hero { position: relative; overflow: hidden; padding: var(--space-6) var(--space-5); border-radius: var(--radius-xl); color: #fff; background: radial-gradient(120% 140% at 100% 0%, var(--kesar-400) 0%, transparent 55%), linear-gradient(160deg, var(--kesar-500), var(--kesar-700)); box-shadow: var(--shadow-md); }
.hero::after { content: ''; position: absolute; top: -70px; right: -70px; width: 200px; height: 200px; border-radius: 50%; border: 1px solid rgb(255 255 255 / .2); box-shadow: 0 0 0 20px rgb(255 255 255 / .05), 0 0 0 44px rgb(255 255 255 / .04), 0 0 0 70px rgb(255 255 255 / .03); pointer-events: none; }
.hero h1, .hero h2 { margin: 2px 0 0; color: #fff; font-size: var(--text-3xl); }
.hero p { margin: 4px 0 0; color: rgb(255 255 255 / .82); font-size: var(--text-sm); }
.hero .eyebrow { color: rgb(255 255 255 / .82); }

.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text-2); font-size: var(--text-xs); font-weight: 600; text-align: center; text-decoration: none; }
.quick-action:hover { border-color: var(--border-strong); color: var(--text); }
.quick-action > .icon { width: 44px; height: 44px; padding: 11px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }

.date-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; width: 56px; height: 60px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary); line-height: 1; }
.date-tile b { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 600; }
.date-tile span { margin-top: 3px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.date-tile-muted { background: var(--surface-2); color: var(--muted); }

.people-scroll { display: flex; gap: var(--space-3); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--space-4)); padding: 2px var(--space-4) 6px; }
.person-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 136px; padding: var(--space-4) var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); text-align: center; box-shadow: var(--shadow-sm); }
.person-tile strong { font-size: var(--text-sm); line-height: 1.3; }
.person-tile .btn { margin-top: 4px; }

.profile-hero { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-4) 0 var(--space-2); text-align: center; }
.profile-hero h1 { margin: var(--space-2) 0 0; font-size: var(--text-2xl); }
.action-bar { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: var(--space-2); }
.action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px; padding: 12px 8px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text-2); font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.action:hover { border-color: var(--border-strong); color: var(--text); }
.action .icon { width: 22px; height: 22px; color: var(--primary); }
.action-wa .icon { color: var(--wa); }

.condolence { padding: var(--space-8) var(--space-5); border-radius: var(--radius-xl); background: var(--quiet-soft); text-align: center; }
.condolence > .icon { width: 36px; height: 36px; color: var(--quiet); }
.condolence h1 { margin: var(--space-3) 0 var(--space-1); }

/* family chart: generations stack top to bottom, joined by a connector */
.tree { display: flex; flex-direction: column; }
.tree-gen { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); padding-top: 28px; }
.tree-gen::before { content: ''; position: absolute; top: 4px; left: 50%; width: 2px; height: 18px; border-radius: 2px; background: var(--border-strong); }
.tree-gen:first-child { padding-top: 0; }
.tree-gen:first-child::before { display: none; }
.tree-gen-label { flex-basis: 100%; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tree-node { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 108px; padding: 12px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); text-align: center; box-shadow: var(--shadow-sm); }
.tree-node a { color: var(--text); text-decoration: none; }
.tree-node strong { font-size: var(--text-sm); line-height: 1.25; }
.tree-node .muted { font-size: var(--text-xs); }
.tree-node-self { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }

/* ---------- admin ---------- */
.admin-shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; height: 100vh; overflow-y: auto; padding: var(--space-5) 14px; background: var(--sidebar-bg); color: #fff; }
.admin-sidebar h1 { display: flex; align-items: center; gap: 10px; margin: 0 6px var(--space-5); font-size: var(--text-lg); color: #fff; }
.admin-sidebar a { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px; border-radius: var(--radius-md); color: rgb(255 255 255 / .78); font-size: var(--text-sm); font-weight: 500; text-decoration: none; }
.admin-sidebar a:hover { background: rgb(255 255 255 / .08); color: #fff; }
.admin-sidebar a.active { background: rgb(255 255 255 / .14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--haldi-300); }
.admin-sidebar .nav-label { margin: var(--space-4) 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgb(255 255 255 / .5); }
.admin-sidebar .count { margin-left: auto; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--haldi-500); color: var(--kesar-900); font-size: 11px; font-weight: 700; }
.admin-sidebar .stack { margin-top: auto; padding: var(--space-3); border-radius: var(--radius-md); background: rgb(0 0 0 / .18); font-size: var(--text-sm); }
.admin-main { width: 100%; max-width: 1280px; padding: var(--space-8) var(--space-10); container-type: inline-size; }

.page-header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-bottom: var(--space-6); }
.page-header h1 { margin: 0 auto 0 0; font-size: var(--text-3xl); }
.page-header > div:first-child { margin-right: auto; }
.page-header > div:first-child h1 { margin: 0; }
.page-header > div:first-child p { margin: 4px 0 0; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: var(--space-4); padding: var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.filters > .form-control { flex: 1 1 170px; width: auto; min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
.filters > input[type="search"] { flex: 2 1 240px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.stat { position: relative; display: flex; flex-direction: column; gap: 4px; padding: var(--space-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); color: var(--muted); font-size: var(--text-sm); font-weight: 500; text-decoration: none; }
.stat strong { font-family: var(--font-display); font-size: var(--text-4xl); font-weight: 600; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat > .icon { position: absolute; top: var(--space-5); right: var(--space-5); width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
a.stat:hover { border-color: var(--primary); color: var(--muted); }
.stat-alert { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--accent-soft); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table tr.row-error td { background: var(--danger-soft); }
.cell-person { display: flex; align-items: center; gap: var(--space-3); }
.cell-person strong { display: block; font-weight: 600; color: var(--text); }
.cell-person div > span { display: block; color: var(--muted); font-size: var(--text-xs); }

.form-section { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: var(--space-6); padding: var(--space-6) 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section h2 { margin: 0 0 4px; font-size: var(--text-lg); }
.form-section > div:first-child p { color: var(--muted); font-size: var(--text-sm); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-4); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) 0; background: linear-gradient(transparent, var(--bg) 35%); }

.steps { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-5); padding: 0; list-style: none; counter-reset: step; }
.steps li { display: flex; align-items: center; gap: var(--space-2); color: var(--muted); font-size: var(--text-sm); font-weight: 600; }
.steps li::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; border: 1.5px solid var(--border-strong); border-radius: 50%; font-size: var(--text-xs); }
.steps li:not(:last-child)::after { content: ''; width: 32px; height: 2px; margin-left: var(--space-2); border-radius: 2px; background: var(--border-strong); }
.steps li.done::before { content: '✓'; background: var(--success); border-color: var(--success); color: #fff; }
.steps li[aria-current="step"] { color: var(--text); }
.steps li[aria-current="step"]::before { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* relative request: requester —relation— relative */
.relation { display: flex; align-items: center; gap: var(--space-3); }
.relation > div { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: var(--text-sm); font-weight: 600; }
.relation-line { position: relative; flex: 1; min-width: 60px; height: 2px; background: repeating-linear-gradient(90deg, var(--border-strong) 0 6px, transparent 6px 10px); }
.relation-line span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 2px 10px; border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--primary); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }

.brand-logo { height: 32px; width: auto; object-fit: contain; vertical-align: middle; }
.brand-logo-lg { display: block; height: 72px; margin: 0 auto var(--space-3); }

/* ---------- responsive, motion ---------- */
@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { z-index: 20; flex-direction: row; align-items: center; gap: 4px; height: auto; padding: 10px; overflow-x: auto; white-space: nowrap; }
    .admin-sidebar h1 { flex: none; margin: 0 8px 0 0; }
    .admin-sidebar a { flex: none; }
    .admin-sidebar .nav-label { display: none; }
    .admin-sidebar .stack { flex: none; flex-direction: row; margin: 0 0 0 8px; padding: 0; background: none; }
    .admin-main { padding: var(--space-5) var(--space-4); }
}
/* admin forms follow the width of the main column, not the window */
@container (max-width: 720px) {
    .form-section { grid-template-columns: 1fr; gap: var(--space-3); }
}
@container (max-width: 420px) {
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .card-body { padding: var(--space-4); }
    .form-grid { grid-template-columns: 1fr; }
    .page-header h1 { font-size: var(--text-2xl); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* admin pages stack cards and forms directly inside the main column */
.admin-main > .card, .admin-main > form.card, .admin-main > .table-wrap { margin-bottom: var(--space-4); }
.admin-main > form.card, .admin-main > form > .card, .admin-main > .card:has(form) { max-width: 960px; }
.card .form-actions { background: linear-gradient(transparent, var(--surface) 35%); margin-bottom: calc(-1 * var(--space-5)); }
.admin-sidebar .segmented > * { color: rgb(255 255 255 / .7); }
.admin-sidebar .segmented > [aria-pressed="true"] { background: rgb(255 255 255 / .18); color: #fff; box-shadow: none; }

/* guided setup: numbered steps joined by a line; .is-done ticks a step off */
.guide { display: flex; flex-direction: column; gap: var(--space-4); counter-reset: guide; max-width: 960px; }
.guide-step { position: relative; padding-left: 52px; }
.guide-step::before { counter-increment: guide; content: counter(guide); position: absolute; left: 0; top: 18px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.guide-step.is-done::before { content: '✓'; background: var(--success); color: #fff; }
.guide-step:not(:last-child)::after { content: ''; position: absolute; left: 17px; top: 60px; bottom: calc(-1 * var(--space-4)); width: 2px; background: var(--border); }
.guide-step h2 { margin: 0 0 4px; font-size: var(--text-lg); }
.guide-step ol, .guide-step ul { margin: 0 0 var(--space-3); padding-left: 1.2em; }
.guide-step li { margin: 4px 0; }
pre.code { margin: 0 0 var(--space-4); padding: 14px 16px; overflow-x: auto; border-radius: var(--radius-md); background: var(--surface-2); font-size: 13px; line-height: 1.6; }
pre.code .hl { color: var(--primary); font-weight: 700; }
pre.code .dim { color: var(--muted); }
@media (max-width: 600px) { .guide-step { padding-left: 0; } .guide-step::before, .guide-step::after { display: none; } }
