@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Work+Sans:wght@400;500;600;700&display=swap');

/* ============================================================
   Design tokens — earthy greens, warm clay, soft neutrals
   ============================================================ */
:root {
    --bg:            #FAF6EE;
    --bg-alt:        #F1E9DA;
    --surface:       #FFFCF6;
    --line:          #E4D9C4;
    --ink:           #2B2118;
    --ink-soft:      #6B5D4C;
    --forest:        #2F4A3A;
    --forest-dark:   #1F3327;
    --forest-light:  #4F7058;
    --forest-pale:   #E4ECE4;
    --clay:          #A65A34;
    --clay-pale:     #F3E2D4;
    --gold:          #C0923F;
    --gold-pale:     #F6EBD3;
    --danger:        #B23B3B;
    --danger-pale:   #FBEAEA;
    --radius:        16px;
    --radius-sm:     10px;
    --shadow:        0 4px 18px rgba(43,33,24,0.08);
    --shadow-lg:     0 12px 32px rgba(43,33,24,0.16);
    --header-h:      58px;
    --tab-h:         64px;

    /* Bootstrap variable overrides so bootstrap.min.css components (buttons,
       form-control, list-group, alerts) inherit the same palette. */
    --bs-primary: var(--forest);
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--line);
}

html[data-theme="dark"] {
    --bg: #1D211E;
    --bg-alt: #2A302B;
    --surface: #252B27;
    --line: #465249;
    --ink: #F4EFE5;
    --ink-soft: #C5BFAF;
    --forest: #4F7058;
    --forest-dark: #E4ECE4;
    --forest-pale: #34473A;
    --clay-pale: #513A2E;
    --gold-pale: #4C422E;
    --danger-pale: #4D2C2C;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"],
    html:not([data-theme="light"]):not([data-theme="dark"]) {
        --bg: #1D211E;
        --bg-alt: #2A302B;
        --surface: #252B27;
        --line: #465249;
        --ink: #F4EFE5;
        --ink-soft: #C5BFAF;
        --forest: #4F7058;
        --forest-dark: #E4ECE4;
        --forest-pale: #34473A;
        --clay-pale: #513A2E;
        --gold-pale: #4C422E;
        --danger-pale: #4D2C2C;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .serif { font-family: 'Fraunces', serif; font-weight: 600; color: var(--forest-dark); }
a { color: var(--clay); text-decoration: none; }
::selection { background: var(--gold-pale); }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 16px;
    background: var(--bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.icon-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--forest);
    position: relative;
    flex-shrink: 0;
}
.icon-btn:hover, .icon-btn:active { background: var(--forest-pale); }
.icon-btn svg { width: 22px; height: 22px; }
.dot-badge {
    position: absolute; top: 0; right: -2px;
    min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
    background: var(--clay); border: 1.5px solid var(--bg); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; line-height: 1;
}
.brand {
    display: flex; align-items: center; gap: 8px;
    font-family: 'Fraunces', serif; font-weight: 600; font-size: 19px;
    color: var(--forest); flex: 1; justify-content: center;
}
.brand-mark {
    width: 28px; height: 28px; display: block; flex-shrink: 0; object-fit: contain;
}
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.topbar-actions select { border-radius: 8px; border: none; padding: 6px 10px; font-size: 13px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12.5px; color: #fff; flex-shrink: 0;
}
.profile-avatar { object-fit: cover; }
.drawer-profile-avatar { width: 44px; height: 44px; }

.preferences-header { margin: 8px 0 20px; }
.preferences-header h1 { margin: 3px 0 5px; font-size: 28px; }
.preferences-header p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.preferences-form { max-width: 760px; }
.preference-section { padding: 0 18px; }
.preference-section .section-title { margin: 0 -18px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.preference-section .section-title h2 { font-size: 18px; }
.preference-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.preference-row:last-child { border-bottom: 0; }
.preference-row strong, .preference-row span { display: block; }
.preference-row strong { font-size: 14px; color: var(--ink); }
.preference-row > div span, .preference-row > span > span { margin-top: 3px; color: var(--ink-soft); font-size: 12.5px; }
.preference-control { width: 180px; flex-shrink: 0; }
.preference-check { cursor: pointer; }
.preference-check input { width: 20px; height: 20px; accent-color: var(--forest); flex-shrink: 0; }
.save-preferences { margin: 0 0 20px; padding: 10px 22px; }

@media (max-width: 560px) {
    .preference-row { align-items: flex-start; }
    .preference-control { width: 140px; }
}

/* ============================================================
   Drawer navigation
   ============================================================ */
.scrim {
    position: fixed; inset: 0; background: rgba(43,33,24,0.4);
    z-index: 48; opacity: 0; pointer-events: none; transition: .25s;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
    position: fixed; top: 0; bottom: 0;
    width: 82%; max-width: 300px;
    background: var(--bg);
    z-index: 49;
    transition: transform .28s ease;
    padding: 14px 0 24px;
    overflow-y: auto;
}
.drawer.left {
    left: 0; border-right: 1px solid var(--line);
    transform: translateX(-105%);
}
.drawer.right {
    right: 0; border-left: 1px solid var(--line);
    transform: translateX(105%);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 18px 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px;
}
.drawer-head b { display: block; font-size: 15px; color: var(--ink); }
.drawer-head .muted { font-size: 12px; color: var(--ink-soft); }
.drawer-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px; font-size: 14.5px; font-weight: 600; color: var(--ink);
}
.drawer button.drawer-item { width: 100%; border: 0; background: transparent; text-align: left; }
.drawer-item:hover, .drawer-item.active { background: var(--forest-pale); color: var(--forest-dark); }
.drawer-item.clay:hover { background: var(--clay-pale); color: var(--clay); }
.drawer-item .ic { width: 22px; text-align: center; flex-shrink: 0; }
.drawer-count {
    margin-left: auto; background: var(--clay); color: #fff; font-size: 11px; font-weight: 700;
    padding: 1px 7px; border-radius: 999px; flex-shrink: 0;
}
.drawer-sep { height: 1px; background: var(--line); margin: 10px 18px; }

/* ============================================================
   Layout shell
   ============================================================ */
.page-shell {
    flex: 1;
    padding: 18px 16px 32px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}
.page-shell.with-tabbar { padding-bottom: calc(var(--tab-h) + 28px); }

/* ============================================================
   Cards, hero, stats
   ============================================================ */
.card, .form-container {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
}

.hero {
    background:
        radial-gradient(circle at 85% -10%, var(--gold-pale) 0%, transparent 55%),
        linear-gradient(180deg, var(--forest-pale) 0%, var(--surface) 85%);
    display: grid;
    gap: 18px;
    align-items: center;
}
.hero-copy h1 { font-size: 28px; margin: 0 0 8px; }
.hero-copy p { color: var(--ink-soft); font-size: 14.5px; max-width: 46ch; margin: 0 0 16px; }
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.stat-card {
    background: linear-gradient(135deg, var(--forest) 0%, var(--forest-dark) 100%);
    color: #fff;
    padding: 14px 10px;
    border-radius: var(--radius-sm);
    text-align: center;
}
.stat-card strong { display: block; font-family: 'Fraunces', serif; font-size: 22px; }
.stat-card span { font-size: 11.5px; opacity: .85; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title h2 { font-size: 18px; margin: 0; }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--forest-light); font-weight: 700; }
.updates-card { max-width: 760px; margin: 24px auto; }
.updates-card h1 { margin: 5px 0 8px; font-size: 28px; }
.updates-version-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 22px 0 14px; }
.updates-version-item { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--forest-pale); }
.updates-version-item span, .updates-version-item strong, .updates-version-item small { display: block; overflow-wrap: anywhere; }
.updates-version-item span { color: var(--ink-soft); font-size: 12px; }
.updates-version-item strong { margin: 4px 0; font-size: 19px; }
.updates-status { min-height: 24px; margin: 12px 0 16px; color: var(--ink-soft); }
@media (max-width: 520px) { .updates-version-grid { grid-template-columns: 1fr; } }

/* ============================================================
   Alerts
   ============================================================ */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; }
.alert-success { background: var(--forest-pale); color: var(--forest-dark); }
.alert-danger  { background: var(--danger-pale); color: var(--danger); }
.alert-warning { background: var(--gold-pale); color: #7A5A1E; }

/* ============================================================
   Buttons (skins Bootstrap + custom variants)
   ============================================================ */
.btn { border-radius: 999px; font-weight: 600; padding: 5px 10px; }
.btn-primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn-primary:hover { background: var(--forest-dark); border-color: var(--forest-dark); color: #fff; }
.btn-outline-primary { color: var(--forest); border-color: var(--forest); }
.btn-outline-primary:hover { background: var(--forest); }
.btn-clay { background: var(--clay); color: #fff; border: none; }
.btn-clay:hover { background: #8f4b2a; color: #fff; }
.btn-ghost { background: var(--forest-pale); color: var(--forest-dark); border: none; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ============================================================
   Forms
   ============================================================ */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--line);
    background: var(--surface);
    padding: 10px 12px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--forest-light);
    box-shadow: 0 0 0 3px rgba(79,112,88,0.15);
}
.form-label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.section-label {
    font-family: 'Fraunces', serif; font-size: 13px; font-weight: 600;
    color: var(--clay); text-transform: uppercase; letter-spacing: .04em;
    margin: 18px 0 8px; padding-top: 12px; border-top: 1px solid var(--line);
}
.section-label:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.form-check-input:checked { background-color: var(--forest); border-color: var(--forest); }

.form-container { max-width: 440px; margin: 24px auto; }
.tabs2 { display: flex; background: var(--bg-alt); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.tabs2 a { flex: 1; text-align: center; border: none; background: transparent; padding: 10px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.tabs2 a.active { background: var(--forest); color: #fff; }
.back-button { color: var(--clay); font-weight: 600; font-size: 13.5px; display: inline-block; margin-bottom: 10px; }

/* ============================================================
   List group (bootstrap) re-skin
   ============================================================ */
.list-group-item {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
    font-size: 14px;
}

/* ============================================================
   Bottom tab bar (mobile primary nav)
   ============================================================ */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 42;
    height: var(--tab-h);
    background: var(--surface);
    border-top: 1px solid var(--line);
    display: flex;
    box-shadow: 0 -6px 18px rgba(43,33,24,0.06);
}
.tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: var(--ink-soft); font-size: 10.5px; font-weight: 600;
}
.tab-item svg { width: 21px; height: 21px; }
.tab-item.active, .tab-item:hover { color: var(--forest); }

@media (min-width: 860px) {
    .tabbar { display: none; }
    .page-shell.with-tabbar { padding-bottom: 32px; }
}

/* ============================================================
   Floating action button (write story / create event / add member)
   ============================================================ */
.fab {
    position: fixed; z-index: 45;
    right: 18px; bottom: calc(var(--tab-h) + 18px);
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--clay); color: #fff; border: none;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s;
}
.fab:active { transform: scale(.94); }
.fab svg { transition: transform .2s; }
.fab.open svg { transform: rotate(45deg); }

.fab-menu {
    position: fixed; z-index: 44;
    right: 18px; bottom: calc(var(--tab-h) + 82px);
    display: flex; flex-direction: column; gap: 10px;
    opacity: 0; pointer-events: none; transform: translateY(8px);
    transition: opacity .2s, transform .2s;
}
.fab-menu.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.fab-item {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 999px; padding: 8px 8px 8px 14px;
    box-shadow: var(--shadow); font-size: 13px; font-weight: 600; color: var(--ink);
    white-space: nowrap;
}
.fab-item .ic {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--forest-pale); color: var(--forest);
    display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;
}

@media (min-width: 860px) {
    .fab { bottom: 28px; }
    .fab-menu { bottom: 92px; }
}

/* ============================================================
   Reusable content components (dashboard, explore, stats, etc.)
   ============================================================ */
.pill-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pill {
    flex: 0 0 auto; padding: 8px 14px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line);
    font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.pill.active { background: var(--forest); color: #fff; border-color: var(--forest); }

.card-list { display: flex; flex-direction: column; gap: 10px; }
.article-card {
    display: flex; gap: 12px; align-items: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px;
}
.article-thumb {
    width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
    background: var(--forest-pale);
}
.article-card h4 { margin: 0 0 3px; font-size: 14px; color: var(--ink); }
.article-card p { margin: 0; font-size: 12px; color: var(--ink-soft); }

.family-card {
    display: flex; gap: 12px; align-items: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.family-card .thumb {
    width: 60px; height: 60px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 24px; background: var(--forest-pale);
}
.family-card h4 { margin: 0 0 3px; font-size: 15px; }
.family-card p { margin: 0 0 6px; font-size: 12.5px; color: var(--ink-soft); }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 10.5px; background: var(--forest-pale); color: var(--forest-dark); padding: 3px 9px; border-radius: 999px; font-weight: 600; }

.member-list { display: flex; flex-direction: column; }
.member-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--forest-light);
    border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px;
}
.member-row.status-deceased { border-left-color: #B08028; background: var(--gold-pale); }
.member-row.status-inactive { border-left-color: #9C8A73; background: var(--bg-alt); }
.member-row.status-active   { border-left-color: var(--forest-light); }
.member-row .avatar { flex-shrink: 0; }
.member-row .info { flex: 1; min-width: 0; }
.member-row .info b { display: block; font-size: 14.5px; color: var(--ink); }
.member-row .info span { font-size: 12px; color: var(--ink-soft); }
.member-row .actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-round {
    width: 30px; height: 30px; border-radius: 50%; border: none;
    display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}

.invite-card {
    display: flex; align-items: center; gap: 10px;
    background: var(--gold-pale); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px;
}
.invite-text { flex: 1; font-size: 12.5px; color: var(--ink); }
.invite-text b { display: block; font-size: 13.5px; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.invite-details { margin: 0 0 18px; }
.invite-details > div { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.invite-details dt { width: 110px; flex-shrink: 0; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.invite-details dd { margin: 0; color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }

.post-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px; margin-bottom: 12px;
}
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-head .avatar { width: 38px; height: 38px; font-size: 14px; }
.post-head b { font-size: 14px; display: block; color: var(--ink); }
.post-head span { font-size: 11.5px; color: var(--ink-soft); }
.post-badge {
    margin-left: auto; font-size: 10.5px; background: var(--forest-pale); color: var(--forest-dark);
    padding: 3px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap;
}
.post-text { font-size: 14px; line-height: 1.5; color: var(--ink); }
.post-reactions-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.reaction-control { position: relative; display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.reaction-control form { margin: 0; }
.reaction-main { min-width: 38px; height: 32px; display: grid; place-items: center; padding: 0 9px; border: 0; border-radius: 999px 0 0 999px; background: transparent; font-size: 19px; line-height: 1; cursor: pointer; }
.reaction-main:hover, .reaction-main.is-selected { background: var(--forest-pale); }
.reaction-main:disabled, .reaction-choice:disabled { opacity: .55; cursor: wait; }
.reaction-picker { position: relative; }
.reaction-picker summary { width: 28px; height: 32px; display: grid; place-items: center; list-style: none; border-left: 1px solid var(--line); border-radius: 0 999px 999px 0; background: transparent; cursor: pointer; }
.reaction-picker summary::-webkit-details-marker { display: none; }
.reaction-picker summary svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reaction-picker[open] summary, .reaction-picker summary:hover { background: var(--forest-pale); }
.reaction-picker-menu { position: absolute; z-index: 15; left: 0; top: calc(100% + 7px); display: flex; gap: 4px; padding: 7px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: 0 4px 14px rgb(0 0 0 / 14%); }
.reaction-choice { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 999px; background: transparent; font-size: 21px; line-height: 1; cursor: pointer; }
.reaction-choice:hover, .reaction-choice.is-selected { background: var(--forest-pale); border-color: var(--forest); }
.reaction-popover { position: relative; color: var(--forest); font-size: 12px; }
.reaction-popover summary { cursor: pointer; }
.reaction-popover-list {
    position: absolute; z-index: 10; left: 0; top: calc(100% + 6px); min-width: 220px; max-height: 240px;
    overflow-y: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); box-shadow: 0 4px 14px rgb(0 0 0 / 14%);
}
.reaction-person { display: flex; align-items: center; gap: 7px; padding: 4px 0; color: var(--ink); }
.reaction-person span:nth-child(2) { flex: 1; }
.formatted-content a { color: var(--forest); text-decoration: underline; overflow-wrap: anywhere; }
.formatted-content ul, .formatted-content ol { margin: 6px 0; padding-left: 22px; }
.formatted-content .rich-media-image { display: block; max-width: 100%; max-height: 460px; height: auto; margin: 8px 0; border-radius: var(--radius-sm); }
.formatted-content .rich-media-video { display: block; max-width: 100%; max-height: 460px; margin: 8px 0; border-radius: var(--radius-sm); background: #111; }
.post-card > .img-fluid { display: block; width: auto; max-width: min(100%, 560px); max-height: 420px; object-fit: contain; cursor: zoom-in; }
.profile-avatar[data-image-viewer], .avatar[data-image-viewer] { cursor: zoom-in; }

.image-viewer-open { overflow: hidden; }
.fullscreen-image-viewer {
    position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
    overflow: hidden; background: rgba(0, 0, 0, .94); touch-action: none;
}
.fullscreen-image-viewer[hidden] { display: none; }
.fullscreen-image-viewer__image {
    display: block; max-width: min(94vw, 1600px); max-height: 90vh; width: auto; height: auto;
    object-fit: contain; user-select: none; -webkit-user-drag: none; cursor: grab; transform-origin: center;
    will-change: transform;
}
.fullscreen-image-viewer__image:active { cursor: grabbing; }
.fullscreen-image-viewer__close, .fullscreen-image-viewer__controls button {
    display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .35);
    color: #fff; background: rgba(0, 0, 0, .58); cursor: pointer; touch-action: manipulation;
}
.fullscreen-image-viewer__close {
    position: absolute; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right));
    width: 44px; height: 44px; border-radius: 50%; font-size: 30px; line-height: 1;
}
.fullscreen-image-viewer__controls {
    position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; display: flex; gap: 8px;
    padding: 6px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px;
    background: rgba(0, 0, 0, .58); transform: translateX(-50%);
}
.fullscreen-image-viewer__controls button {
    min-width: 40px; height: 40px; padding: 0 10px; border-radius: 999px; font-size: 20px;
}
.fullscreen-image-viewer__controls button:disabled { opacity: .45; cursor: default; }
.fullscreen-image-viewer__close:focus-visible, .fullscreen-image-viewer__controls button:focus-visible {
    outline: 2px solid #fff; outline-offset: 3px;
}

.rich-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0; }
.rich-toolbar > button, .rich-emoji-picker > button, .rich-emoji-menu button {
    min-width: 32px; min-height: 30px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer;
}
.rich-toolbar > button, .rich-emoji-picker > button { display: inline-flex; align-items: center; justify-content: center; padding: 0 7px; }
.rich-icon { display: block; width: 17px; height: 17px; }
.rich-icon-gif { width: 25px; height: 17px; }
.rich-toolbar button:hover { background: var(--bg-alt); }
.rich-emoji-picker { position: relative; }
.rich-emoji-menu { position: absolute; z-index: 5; bottom: calc(100% + 5px); left: 0; display: grid; grid-template-columns: repeat(7, 34px); gap: 3px; max-height: 220px; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 4px 14px rgb(0 0 0 / 14%); }
.rich-emoji-menu[hidden] { display: none; }
.rich-emoji-menu button { font-size: 17px; }
.rich-link-entry { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.rich-link-entry[hidden] { display: none; }
.rich-link-entry input { flex: 1 1 220px; min-width: 0; }
.rich-file-status { display: block; color: var(--ink-soft); font-size: 11px; overflow-wrap: anywhere; }
.rich-text-field { width: 100%; resize: vertical; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.bar-row .name { width: 120px; font-size: 12.5px; font-weight: 600; flex-shrink: 0; color: var(--ink); }
.bar-track { flex: 1; height: 12px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--forest-light), var(--forest)); }
.bar-val { width: 34px; text-align: right; font-size: 12px; color: var(--ink-soft); }

.leader-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px;
}
.leader-rank {
    width: 26px; height: 26px; border-radius: 50%; background: var(--gold-pale); color: var(--clay);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.leader-row .info { flex: 1; }
.leader-row .info b { display: block; font-size: 13.5px; color: var(--ink); }
.leader-pts { font-size: 12.5px; font-weight: 700; color: var(--forest); }

.acc-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; overflow: hidden; }
.acc-head { display: flex; justify-content: space-between; align-items: center; padding: 13px 14px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink); }
.acc-body { max-height: 0; overflow: hidden; transition: max-height .25s ease; padding: 0 14px; }
.acc-item.open .acc-body { max-height: 260px; padding: 0 14px 14px; }
.acc-item.open .chev { transform: rotate(180deg); }
.chev { transition: .2s; flex-shrink: 0; }
.acc-body p { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.6; }

.notif-tabs { display: flex; background: var(--bg-alt); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.notif-tabs button { flex: 1; border: none; background: transparent; padding: 9px; border-radius: 999px; font-weight: 600; font-size: 12.5px; color: var(--ink-soft); }
.notif-tabs button.active { background: var(--forest); color: #fff; }
.notif-row { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: flex-start; border-radius: var(--radius-sm); }
.notif-row.unread { background: var(--gold-pale); border-left: 3px solid var(--clay); }
.notif-row[href] { color: inherit; text-decoration: none; }
.notif-row[href]:hover { background: var(--forest-pale); }
.notif-row[href]:focus-visible { outline: 2px solid var(--forest); outline-offset: -2px; }
.notif-row .ic { width: 36px; height: 36px; border-radius: 50%; background: var(--forest-pale); color: var(--forest); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.notif-body { flex: 1; font-size: 13px; line-height: 1.4; color: var(--ink); }
.notif-time { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.notif-status { align-self: center; color: var(--clay); font-size: 10px; font-weight: 700; text-transform: uppercase; }

.inbox-layout {
    display: grid; grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
    min-height: min(72vh, 720px); background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
}
.inbox-list { min-width: 0; border-right: 1px solid var(--line); overflow-y: auto; }
.inbox-list-head, .inbox-thread-head { padding: 16px; border-bottom: 1px solid var(--line); }
.inbox-list-head h2, .inbox-thread-head h2 { margin: 0; font-size: 16px; }
.conversation-link {
    display: flex; gap: 10px; align-items: center; padding: 12px 14px;
    color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line);
}
.conversation-link:hover, .conversation-link.active { background: var(--bg-alt); color: var(--ink); }
.conversation-avatar { position: relative; display: inline-flex; flex-shrink: 0; }
.conversation-avatar .avatar { flex-shrink: 0; }
.conversation-online {
    position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px;
    border: 2px solid var(--surface); border-radius: 50%; background: #31834a;
}
.conversation-preview { flex: 1; min-width: 0; }
.conversation-preview b, .conversation-preview span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-preview b { font-size: 13px; }
.conversation-preview span { color: var(--ink-soft); font-size: 11.5px; margin-top: 3px; }
.conversation-meta { align-self: flex-start; color: var(--ink-soft); font-size: 10.5px; white-space: nowrap; }
.conversation-unread { display: inline-block; min-width: 18px; margin-top: 5px; padding: 2px 5px; border-radius: 10px; background: var(--forest); color: #fff; text-align: center; }
.inbox-thread { display: grid; grid-template-rows: auto minmax(220px, 1fr) auto; min-width: 0; }
.inbox-thread-head { display: flex; align-items: center; gap: 10px; }
.inbox-thread-head .avatar { flex-shrink: 0; }
.inbox-back { display: none; margin-left:auto; color: var(--forest); font-size: 12px; font-weight: 600; text-decoration: none; }
.inbox-thread-head span { color: var(--ink-soft); font-size: 12px; }
.message-list { display: flex; flex-direction: column; gap: 10px; max-height: min(62vh, 650px); min-height: 220px; padding: 16px; overflow-y: auto; }
.chat-message { display: flex; flex-direction: column; align-items: flex-start; max-width: min(78%, 520px); }
.chat-message.outgoing { align-self: flex-end; align-items: flex-end; }
.chat-message .sender { margin: 0 8px 3px; color: var(--ink-soft); font-size: 10.5px; }
.chat-bubble { padding: 9px 12px; background: var(--bg-alt); border-radius: 14px 14px 14px 3px; color: var(--ink); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-message.outgoing .chat-bubble { background: var(--forest); color: #fff; border-radius: 14px 14px 3px 14px; }
.chat-message time { margin: 3px 8px 0; color: var(--ink-soft); font-size: 10px; }
.chat-message .message-media { max-width: 100%; }
.chat-message .rich-media-image, .chat-message .rich-media-video { display: block; width: auto; max-width: min(100%, 420px); max-height: 320px; margin: 0; object-fit: contain; }
.inbox-compose, .rich-message-compose { display: flex; flex-direction: column; gap: 8px; }
.inbox-compose { padding: 12px 16px; border-top: 1px solid var(--line); }
.inbox-compose-row { display: flex; align-items: flex-end; gap: 8px; }
.inbox-compose-row .rich-text-field { min-width: 0; }
.inbox-empty { padding: 22px 16px; color: var(--ink-soft); font-size: 13px; }
@media (max-width: 640px) {
    .inbox-layout { display: block; min-height: calc(100dvh - 220px); }
    .inbox-list { max-height: none; border-right: 0; border-bottom: 0; }
    .inbox-thread { display: none; height: calc(100dvh - 220px); min-height: min(72vh, 720px); }
    .inbox-layout.conversation-open .inbox-list { display: none; }
    .inbox-layout.conversation-open .inbox-thread { display: grid; }
    .inbox-thread-head { gap: 8px; padding: 12px; }
    .inbox-back { display: inline-block; }
    .message-list { max-height: none; min-height: 0; }
    .chat-message { max-width: 90%; }
}

/* ============================================================
   Footer
   ============================================================ */
.app-footer {
    background: var(--forest-dark);
    color: #EDEAE1;
    padding: 28px 20px;
    text-align: center;
}
.footer-brand { font-family: 'Fraunces', serif; font-weight: 600; font-size: 18px; color: #fff; }
.footer-tag { font-size: 12.5px; color: #C7D1C8; margin: 4px 0 16px; }
.important-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-bottom: 14px; }
.important-links a { color: #EDEAE1; font-size: 13px; }
.important-links a:hover { color: var(--gold); }
.footer-copy { font-size: 11.5px; color: #93A093; margin: 0; }

/* ============================================================
   Responsive: desktop grid refinements
   ============================================================ */
@media (min-width: 720px) {
    .hero { grid-template-columns: 1.3fr 1fr; padding: 32px; }
    .page-shell { padding: 26px 24px 32px; }
}
.guest-promo-text {
    min-height: 220px;
}

.guest-promo-green { background: linear-gradient(135deg, #2f4a3a, #6f8f72); }
.guest-promo-clay { background: linear-gradient(135deg, #a65d43, #d79a73); }
.guest-promo-gold { background: linear-gradient(135deg, #9a7628, #e0bd62); }
.guest-promo-lavender { background: linear-gradient(135deg, #655b86, #aaa0d1); }
.guest-promo-dark { background: linear-gradient(135deg, #202b28, #465a53); }

.guest-promo-caption {
    inset: 0;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    background: transparent;
}
.region-field { position: relative; }
.region-suggestions {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: 100%;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 2px;
}
.region-suggestions .list-group-item { cursor: pointer; }
.image-editor-backdrop{position:fixed;inset:0;z-index:2000;background:rgba(12,18,15,.78);display:grid;place-items:center;padding:18px}.image-editor-backdrop[hidden]{display:none}.image-editor{width:min(560px,100%);max-height:95vh;overflow:auto;background:#fff;border-radius:18px;padding:20px;box-shadow:0 18px 60px #0005}.image-editor header,.image-editor footer{display:flex;align-items:center;justify-content:space-between;gap:12px}.image-editor h2{font-size:1.15rem;margin:0}.image-editor canvas{display:block;width:min(100%,420px);max-height:48vh;object-fit:contain;margin:18px auto;background:#161a18;border-radius:10px}.image-editor-controls{display:grid;grid-template-columns:1fr 1fr;gap:12px}.image-editor-controls>label{display:grid;gap:5px;font-size:.9rem}.image-editor-controls input[type=range]{width:100%}.image-editor-ratios{grid-column:1/-1;border:0;padding:0;margin:0;display:flex;flex-wrap:wrap;gap:8px}.image-editor-ratios legend{font-size:.9rem;margin-bottom:6px}.image-ratio-option{position:relative;display:flex;align-items:center;gap:7px;border:1px solid #d6ddd8;border-radius:9px;padding:7px 10px;cursor:pointer;font-size:.85rem}.image-ratio-option:has(input:checked){border-color:#247a4b;background:#edf7f0;color:#185d38}.image-ratio-option:has(input:disabled){opacity:.65}.image-ratio-option input{accent-color:#247a4b;margin:0}.image-ratio-icon{display:inline-flex;width:20px;height:20px}.image-ratio-icon svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.image-editor footer{justify-content:flex-end;margin-top:18px}.image-editor button{border:1px solid #d6ddd8;border-radius:8px;padding:8px 12px;background:#fff}.image-editor .image-editor-apply{background:#247a4b;color:white;border-color:#247a4b}.image-editor-close{font-size:1.4rem!important;padding:2px 10px!important}@media(max-width:480px){.image-editor-controls{grid-template-columns:1fr}.image-editor-ratios{grid-column:1}}
.video-clipper-backdrop{position:fixed;inset:0;z-index:2001;background:rgba(12,18,15,.78);display:grid;place-items:center;padding:18px}.video-clipper-backdrop[hidden]{display:none}.video-clipper{width:min(600px,100%);max-height:95vh;overflow:auto;background:#fff;border-radius:18px;padding:20px;box-shadow:0 18px 60px #0005}.video-clipper header,.video-clipper footer{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}.video-clipper h2{font-size:1.15rem;margin:0}.video-clipper video{display:block;width:100%;max-height:52vh;background:#101411;border-radius:10px;margin:16px auto}.video-clip-times{display:flex;gap:14px}.video-clip-times label{display:grid;gap:5px;flex:1;font-size:.9rem}.video-clip-times input{width:100%;border:1px solid #d6ddd8;border-radius:8px;padding:8px}.video-clip-status{min-height:1.4em;font-size:.88rem;color:#53635a;margin:12px 0}.video-clipper footer{justify-content:flex-end}.video-clipper button{border:1px solid #d6ddd8;border-radius:8px;padding:8px 12px;background:#fff}.video-clipper [data-trim]{background:#247a4b;color:#fff;border-color:#247a4b}.video-clipper [data-trim]:disabled{opacity:.55}@media(max-width:480px){.video-clipper footer>*{flex:1}}
.youtube-embed{position:relative;width:min(100%,720px);aspect-ratio:16/9;margin:.75rem 0;border-radius:12px;overflow:hidden;background:#111}.youtube-embed iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
