/* ==========================================================================
   Shri Rajput Pragatisheel Sabha — portal styles
   Mobile-first. No external fonts or frameworks: everything here is local so
   the page works on a slow connection and satisfies the strict CSP.
   ========================================================================== */

:root {
    --maroon:        #7b1e2b;
    --maroon-dark:   #5c1520;
    --maroon-light:  #9c3040;
    --saffron:       #e07a1f;
    --gold:          #c9962c;
    --ink:           #1f2328;
    --ink-soft:      #5a6169;
    --ink-faint:     #8a9199;
    --line:          #e3e6ea;
    --surface:       #ffffff;
    --surface-alt:   #f7f8fa;
    --surface-tint:  #fdf6f0;
    --green:         #1c7c43;
    --red:           #c0392b;
    --amber:         #b8860b;
    --blue:          #1f5fa8;
    --radius:        10px;
    --radius-sm:     6px;
    --shadow:        0 1px 3px rgba(20, 20, 30, .08), 0 4px 14px rgba(20, 20, 30, .05);
    --shadow-lg:     0 4px 12px rgba(20, 20, 30, .10), 0 12px 32px rgba(20, 20, 30, .08);
    --max:           1180px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Nirmala UI", "Noto Sans Devanagari", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface-alt);
}

/* Devanagari needs a little more line height to breathe. */
html[lang="hi"] body { line-height: 1.75; }

img { max-width: 100%; height: auto; display: block; }

a { color: var(--maroon); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }

hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--maroon); color: #fff; padding: 10px 16px;
}
.skip-link:focus { left: 0; }

/* --- Header --------------------------------------------------------------- */
.site-header {
    background: linear-gradient(135deg, var(--maroon-dark), var(--maroon));
    color: #fff;
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 50;
}
.site-header a { color: #fff; }
.header-bar {
    display: flex; align-items: center; gap: 12px;
    min-height: 60px; padding: 8px 0;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand-mark {
    width: 40px; height: 40px; flex: 0 0 40px;
    display: grid; place-items: center;
    background: var(--gold); color: var(--maroon-dark);
    border-radius: 50%; font-weight: 800; font-size: 1.05rem;
}
.brand-text { min-width: 0; }
.brand-name {
    font-weight: 700; font-size: 1rem; line-height: 1.25;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-tag {
    font-size: .72rem; opacity: .8;
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* On the narrowest phones the tagline would wrap onto a third line and make the
   header unnecessarily tall, so it steps aside for the buttons. */
@media (max-width: 420px) {
    .brand-tag { display: none; }
}
.brand a:hover { text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.lang-toggle {
    border: 1px solid rgba(255,255,255,.4); border-radius: 999px;
    padding: 5px 12px; font-size: .8rem; white-space: nowrap;
    background: rgba(255,255,255,.08);
}
.lang-toggle:hover { background: rgba(255,255,255,.18); text-decoration: none; }

/* Buttons inside the maroon header need their own colours: `.site-header a`
   forces white text, which would otherwise make a white .btn-secondary
   invisible. */
   The gold call-to-action is exempt — it carries its own treatment. */
.header-actions .btn:not(.btn-gold),
.header-actions .btn:not(.btn-gold):hover {
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.45);
    color: #fff;
}
.header-actions .btn:not(.btn-gold):hover { background: rgba(255,255,255,.26); }
/* `.site-header a` forces white, which is unreadable on gold. */
.header-actions .btn-gold,
.header-actions .btn-gold:hover { color: #4a0b16; }

.nav-toggle {
    display: grid; place-items: center;
    width: 40px; height: 40px; padding: 0;
    background: rgba(255,255,255,.1); border: 0; border-radius: var(--radius-sm);
    color: #fff; font-size: 1.3rem; cursor: pointer;
}

/* --- Navigation ----------------------------------------------------------- */
.site-nav { background: var(--maroon-dark); }
.site-nav[hidden] { display: none; }
.nav-list {
    list-style: none; margin: 0; padding: 4px 0;
    display: flex; flex-direction: column;
    max-height: 65vh; overflow-y: auto;
}
.nav-list a {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; font-size: .92rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.nav-list a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.nav-list a.is-active { background: rgba(255,255,255,.16); font-weight: 600; }
.nav-icon { font-size: 1rem; width: 1.3em; text-align: center; }

/* --- Flash messages ------------------------------------------------------- */
.flash-stack { margin: 16px 0 0; }
.flash {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 11px 14px; border-radius: var(--radius);
    border-left: 4px solid; margin-bottom: 10px; font-size: .92rem;
}
.flash-success { background: #eaf7ef; border-color: var(--green); color: #14532d; }
.flash-error   { background: #fdecea; border-color: var(--red);   color: #7f1d1d; }
.flash-warning { background: #fdf6e3; border-color: var(--amber); color: #713f12; }
.flash-info    { background: #eaf1fb; border-color: var(--blue);  color: #1e3a8a; }

/* --- Layout blocks -------------------------------------------------------- */
main { padding: 20px 0 48px; min-height: 55vh; }
/* A full-bleed hero butts against the header; the usual gap would show a strip
   of page background between the two, which reads as a stray pale line. */
main.has-hero { padding-top: 0; }

.page-head {
    display: flex; flex-wrap: wrap; gap: 12px;
    align-items: flex-start; justify-content: space-between;
    margin-bottom: 18px;
}
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--ink-soft); font-size: .9rem; margin: 4px 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 18px; margin-bottom: 18px;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin: -18px -18px 16px; padding: 13px 18px;
    border-bottom: 1px solid var(--line); background: var(--surface-alt);
    border-radius: var(--radius) var(--radius) 0 0;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 1.02rem; }
.card-tight { padding: 0; }
.card-tight .card-head { margin: 0; border-radius: var(--radius) var(--radius) 0 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
.grid-sidebar { grid-template-columns: 1fr; }

.muted  { color: var(--ink-soft); }
.faint  { color: var(--ink-faint); }
.small  { font-size: .85rem; }
.tiny   { font-size: .78rem; }
.center { text-align: center; }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.stack > * + * { margin-top: 12px; }

/* --- Buttons -------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius-sm);
    border: 1px solid transparent; background: var(--maroon); color: #fff;
    font: inherit; font-size: .9rem; font-weight: 600;
    cursor: pointer; text-align: center;
}
.btn:hover { background: var(--maroon-dark); text-decoration: none; color: #fff; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-alt); color: var(--ink); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #96271b; }
.btn-success { background: var(--green); }
.btn-success:hover { background: #145c31; }
.btn-ghost { background: transparent; color: var(--maroon); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-tint); color: var(--maroon-dark); }
.btn-sm { padding: 5px 11px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* --- Forms ---------------------------------------------------------------- */
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-wide { grid-column: 1 / -1; }
label, .label { font-size: .87rem; font-weight: 600; color: var(--ink); }
.label-hint { font-weight: 400; color: var(--ink-faint); font-size: .8rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="datetime-local"],
input[type="search"], input[type="url"], select, textarea {
    width: 100%; padding: 9px 11px; font: inherit; font-size: .93rem;
    border: 1px solid #cdd2d9; border-radius: var(--radius-sm);
    background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
html[lang] select:lang(hi) { padding-right: 32px; }

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--maroon-light); outline-offset: 1px; border-color: var(--maroon-light);
}
input[type="file"] { font-size: .85rem; }

/* Recommended-dimensions note shown under every upload field. */
.size-hint {
    display: inline-block; margin-top: 5px;
    font-size: .76rem; font-weight: 600; color: var(--maroon);
    background: var(--surface-tint); border: 1px solid var(--line);
    border-radius: 999px; padding: 2px 10px;
}

/* Thumbnail of whatever is already uploaded, beside its filename. */
.current-file { display: flex; gap: 10px; align-items: flex-start; margin-top: 9px; }
.current-file img {
    width: 108px; height: auto; max-height: 90px; object-fit: cover;
    border-radius: var(--radius-sm); border: 1px solid var(--line);
}
.current-file .help-text { margin: 0; }

/* Preview of the drawn artwork standing in for an empty slot. */
.slot-preview {
    margin-top: 9px; max-width: 260px; overflow: hidden;
    border: 1px dashed var(--line); border-radius: var(--radius-sm);
}

/* The four hero slide slots sit side by side rather than stacking. */
.slide-slots { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.slide-slots .slot-preview { max-width: 100%; }
.slide-slots .current-file { flex-direction: column; }
.slide-slots .current-file img { width: 100%; max-height: 120px; }

/* One row of a repeating admin block (pillars, stats, feature cards). */
.repeat-row {
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px; margin-bottom: 12px;
}
.repeat-row:last-of-type { border-bottom: 0; margin-bottom: 0; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }
.error-text { color: var(--red); font-size: .82rem; }
.help-text { color: var(--ink-soft); font-size: .82rem; }

.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: .9rem; font-weight: 400; }
.check-row input { margin-top: 4px; flex: 0 0 auto; width: auto; }
.check-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 16px; }
legend { padding: 0 6px; font-weight: 700; font-size: .95rem; color: var(--maroon); }

.filter-bar {
    display: grid; gap: 10px; grid-template-columns: 1fr;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px; margin-bottom: 18px;
}

/* --- Tables --------------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th, table.data td {
    padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line);
    vertical-align: top;
}
table.data th { background: var(--surface-alt); font-weight: 600; white-space: nowrap; }
table.data tbody tr:hover { background: var(--surface-tint); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Badges & pills ------------------------------------------------------- */
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: .74rem; font-weight: 600; white-space: nowrap;
    background: var(--surface-alt); color: var(--ink-soft); border: 1px solid var(--line);
}
.badge-success { background: #eaf7ef; color: #14532d; border-color: #bfe3cd; }
.badge-danger  { background: #fdecea; color: #7f1d1d; border-color: #f3c4be; }
.badge-warning { background: #fdf6e3; color: #713f12; border-color: #ecdaa8; }
.badge-info    { background: #eaf1fb; color: #1e3a8a; border-color: #c3d5f0; }
.badge-muted   { background: #f0f1f3; color: var(--ink-soft); }

/* --- Stat tiles ----------------------------------------------------------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); margin-bottom: 20px; }
.stat {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.stat-label { font-size: .78rem; color: var(--ink-soft); margin-bottom: 4px; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.15; color: var(--maroon); font-variant-numeric: tabular-nums; }
.stat-note  { font-size: .74rem; color: var(--ink-faint); margin-top: 3px; }

/* --- Lists / cards -------------------------------------------------------- */
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list > li { border-bottom: 1px solid var(--line); padding: 12px 0; }
.item-list > li:last-child { border-bottom: 0; }
.item-title { font-weight: 600; margin: 0 0 2px; }
.item-meta { font-size: .8rem; color: var(--ink-faint); }

.tile-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.tile {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    display: flex; flex-direction: column;
}
.tile-body { padding: 14px; flex: 1; }
.tile-cover { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; background: var(--surface-alt); }
.tile h3 { font-size: 1rem; margin-bottom: 4px; }
.tile-foot { padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-alt); font-size: .8rem; }

.avatar {
    width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
    background: var(--surface-tint); flex: 0 0 auto;
}
.avatar-lg { width: 96px; height: 96px; }
.avatar-fallback {
    display: grid; place-items: center; font-weight: 700; color: var(--maroon);
    background: var(--surface-tint); border: 1px solid var(--line);
}

.person-row { display: flex; gap: 12px; align-items: center; }

/* --- Definition lists ----------------------------------------------------- */
dl.detail { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; }
dl.detail > div { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
dl.detail > div:last-child { border-bottom: 0; }
dl.detail dt { flex: 0 0 42%; color: var(--ink-soft); font-size: .85rem; margin: 0; }
dl.detail dd { flex: 1; margin: 0; font-size: .9rem; word-break: break-word; }

/* --- Pagination ----------------------------------------------------------- */
.pagination { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; justify-content: center; margin: 20px 0 0; }
.pagination a, .pagination span {
    display: inline-block; min-width: 36px; text-align: center;
    padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); font-size: .85rem;
}
.pagination a:hover { background: var(--surface-tint); text-decoration: none; }
.pagination .is-current { background: var(--maroon); color: #fff; border-color: var(--maroon); font-weight: 600; }
.pagination .is-gap { border: 0; background: transparent; }

/* --- Empty state ---------------------------------------------------------- */
.empty {
    text-align: center; padding: 40px 20px; color: var(--ink-soft);
    background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty-icon { font-size: 2rem; margin-bottom: 8px; opacity: .5; }

/* --- Hero (home) ---------------------------------------------------------- */
.hero {
    background: linear-gradient(135deg, var(--maroon-dark), var(--maroon) 55%, var(--maroon-light));
    color: #fff; padding: 36px 0; margin-bottom: 24px;
}
.hero h1 { font-size: 1.7rem; margin-bottom: 8px; }
.hero p { opacity: .92; margin-bottom: 18px; max-width: 62ch; }
.hero .btn-secondary { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.4); }
.hero .btn-secondary:hover { background: rgba(255,255,255,.24); color: #fff; }
.hero .btn:not(.btn-secondary) { background: var(--gold); color: var(--maroon-dark); }
.hero .btn:not(.btn-secondary):hover { background: #b8862a; }

/* --- Module toggle switch ------------------------------------------------- */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
    width: 46px; height: 26px; border-radius: 999px; background: #c3c8cf;
    position: relative; transition: background .15s ease; flex: 0 0 46px;
}
.switch-track::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s ease;
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--maroon); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .45; cursor: not-allowed; }

.module-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--line); }
.module-row:last-child { border-bottom: 0; }
.module-icon { font-size: 1.35rem; flex: 0 0 auto; width: 1.6em; text-align: center; }
.module-info { flex: 1; min-width: 0; }
.module-name { font-weight: 600; margin: 0; }
.module-desc { font-size: .82rem; color: var(--ink-soft); margin: 2px 0 0; }
.module-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; }

/* --- Membership card ------------------------------------------------------ */
.mcard {
    max-width: 420px; margin: 0 auto; border-radius: 14px; overflow: hidden;
    background: linear-gradient(135deg, var(--maroon-dark), var(--maroon));
    color: #fff; box-shadow: var(--shadow-lg);
}
.mcard-head { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.2); display: flex; gap: 10px; align-items: center; }
.mcard-head .brand-mark { width: 34px; height: 34px; flex-basis: 34px; font-size: .9rem; }
.mcard-org { font-weight: 700; font-size: .95rem; line-height: 1.25; }
.mcard-sub { font-size: .7rem; opacity: .8; }
.mcard-body { padding: 18px; display: flex; gap: 16px; }
.mcard-photo { width: 84px; height: 100px; object-fit: cover; border-radius: 8px; background: rgba(255,255,255,.15); flex: 0 0 84px; }
.mcard-fields { flex: 1; min-width: 0; font-size: .82rem; }
.mcard-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 2px; }
.mcard-row { display: flex; gap: 6px; margin-top: 4px; }
.mcard-row dt { opacity: .75; flex: 0 0 44%; margin: 0; }
.mcard-row dd { margin: 0; font-weight: 600; word-break: break-word; }
.mcard-foot { background: #fff; padding: 14px 18px; display: flex; gap: 14px; align-items: center; }
.mcard-qr { width: 92px; height: 92px; flex: 0 0 92px; }
.mcard-qr img, .mcard-qr svg { width: 100%; height: 100%; }
/* min-width:0 lets this flex item shrink; without it the long verification URL
   sets a floor and pushes the footer past the card's edge. */
.mcard-verify { font-size: .74rem; color: var(--ink-soft); min-width: 0; overflow-wrap: anywhere; }
.mcard-no { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .04em; }

/* --- Poll bars ------------------------------------------------------------ */
.poll-option { margin-bottom: 12px; }
.poll-bar { height: 9px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 5px; }
.poll-bar > span { display: block; height: 100%; background: var(--maroon); }
.poll-meta { display: flex; justify-content: space-between; font-size: .82rem; }

/* --- Bar chart (dashboard) ------------------------------------------------ */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 130px; padding-top: 6px; }
.bars > div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.bars .bar { width: 100%; background: var(--maroon-light); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .bar-label { font-size: .62rem; color: var(--ink-faint); white-space: nowrap; }
.bars .bar-value { font-size: .66rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.hbar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: .84rem; }
.hbar-label { flex: 0 0 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.hbar-track > span { display: block; height: 100%; background: var(--maroon); }
.hbar-value { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--ink-soft); }

/* --- Messaging ------------------------------------------------------------ */
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 62vh; overflow-y: auto; padding: 4px; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: .9rem; }
.bubble-in  { align-self: flex-start; background: var(--surface-alt); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble-out { align-self: flex-end; background: var(--maroon); color: #fff; border-bottom-right-radius: 4px; }
.bubble-time { display: block; font-size: .68rem; opacity: .7; margin-top: 3px; }

/* --- Timeline (audit) ----------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--line); }
.timeline li::before {
    content: ""; position: absolute; left: -6px; top: 5px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--maroon); border: 2px solid #fff;
}
.timeline li:last-child { border-left-color: transparent; }

/* --- Footer --------------------------------------------------------------- */
.site-footer {
    background: var(--maroon-dark); color: rgba(255,255,255,.85);
    padding: 28px 0 20px; font-size: .86rem; margin-top: auto;
}
.site-footer a { color: #fff; opacity: .9; }
.footer-grid { display: grid; gap: 20px; grid-template-columns: 1fr; margin-bottom: 18px; }
.footer-grid h4 { color: #fff; font-size: .92rem; margin-bottom: 8px; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 5px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.16); padding-top: 14px; font-size: .78rem; opacity: .75; }

/* --- Admin shell ---------------------------------------------------------- */
.admin-layout { display: grid; grid-template-columns: 1fr; gap: 0; }
.admin-side { background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-side nav ul { list-style: none; margin: 0; padding: 6px 0; display: flex; overflow-x: auto; gap: 2px; }
.admin-side nav a {
    display: block; padding: 8px 13px; font-size: .86rem; color: var(--ink);
    white-space: nowrap; border-radius: var(--radius-sm);
}
.admin-side nav a:hover { background: var(--surface-alt); text-decoration: none; }
.admin-side nav a.is-active { background: var(--maroon); color: #fff; font-weight: 600; }
.admin-main { padding: 20px 0 48px; }

.admin-banner {
    background: var(--maroon-dark); color: #fff; font-size: .8rem;
    padding: 6px 0; text-align: center;
}
.admin-banner a { color: var(--gold); }

/* --- Print ---------------------------------------------------------------- */
@media print {
    .site-header, .site-nav, .site-footer, .page-actions, .no-print, .admin-side, .flash-stack { display: none !important; }
    body { background: #fff; font-size: 12px; }
    main { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    .mcard { box-shadow: none; border: 1px solid #999; }
    a[href]::after { content: ""; }
}

/* --- Responsive ----------------------------------------------------------- */
@media (min-width: 620px) {
    h1 { font-size: 1.85rem; }
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
    .stats  { grid-template-columns: repeat(4, 1fr); }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { grid-template-columns: repeat(3, 1fr); align-items: end; }
    .tile-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: repeat(3, 1fr); }
    dl.detail { grid-template-columns: repeat(2, 1fr); column-gap: 22px; }
    .brand-name { font-size: 1.08rem; }
}

@media (min-width: 900px) {
    .nav-toggle { display: none; }
    .site-nav { display: block !important; }
    .site-nav[hidden] { display: block; }
    .nav-list {
        flex-direction: row; flex-wrap: wrap; max-height: none;
        overflow: visible; padding: 0;
    }
    .nav-list a { border-bottom: 0; padding: 11px 13px; font-size: .87rem; }
    .nav-list a.is-active { background: rgba(255,255,255,.16); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-sidebar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
    .tile-grid { grid-template-columns: repeat(3, 1fr); }
    .admin-layout { grid-template-columns: 232px minmax(0, 1fr); gap: 24px; }
    .admin-side {
        border-bottom: 0; border-right: 1px solid var(--line);
        background: transparent; padding: 20px 0;
    }
    .admin-side nav ul { flex-direction: column; overflow: visible; gap: 1px; }
    .hero { padding: 56px 0; }
    .hero h1 { font-size: 2.2rem; }
}
