/* File: /assets/css/style.css
   Ukoo 3.0 (formerly Family OS) — mobile-first design system.

   The archive should feel like a family's own keepsake box, held in one
   hand: faces first, big tap targets, calm surfaces, a serif that carries
   the family's name. Twelve brand themes (themes.css) × light / dark /
   match-my-phone. Everything is built for a 360px phone first; the desktop
   sidebar arrives at 1024px.

   Contents
     1. Tokens & modes          6. Cards, lists, media grids
     2. Base & typography       7. Module styles (v1 modules)
     3. App shell               8. Module styles (v2 modules)
     4. Controls                9. Public pages, auth, installer
     5. Panels, tables, badges 10. Utilities, print, motion
*/

/* 1. Tokens & modes ===================================================== */
:root {
    --font-display: 'Fraunces', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
    --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-pill: 999px;
    --tap: 44px;
    --nav-h: 64px;
    --topbar-h: 56px;
    --ease: cubic-bezier(.2, .7, .2, 1);

    /* light surfaces, tinted by the theme */
    --bg: color-mix(in srgb, var(--brand) 5%, #F6F5F1);
    --surface: #FFFFFF;
    --surface-2: color-mix(in srgb, var(--brand) 6%, #FBFAF7);
    --surface-3: color-mix(in srgb, var(--brand) 11%, #F3F2EE);
    --line: color-mix(in srgb, var(--brand) 13%, #E3E1DA);
    --line-strong: color-mix(in srgb, var(--brand) 22%, #CFCCC3);
    --ink: #19201C;
    --ink-soft: #505B55;
    --ink-faint: #7F8983;
    --on-brand: #FFFFFF;
    --link: var(--brand-text);
    --brand-ink: var(--brand-text);
    /* Fills that carry text. Light mode uses the theme colours as they are;
       dark mode swaps in the lifted --brand-light / --accent-light. */
    --primary: var(--brand);
    --on-primary: var(--on-brand);
    --accent-fill: var(--accent);
    --on-accent-fill: var(--on-accent);
    --brand-soft: color-mix(in srgb, var(--brand) 11%, #FFFFFF);
    --brand-mid: color-mix(in srgb, var(--brand) 55%, #FFFFFF);
    --accent-soft: color-mix(in srgb, var(--accent) 16%, #FFFFFF);
    --accent-ink: var(--accent-text);
    --sidebar-bg: var(--brand-deep);
    --sidebar-ink: color-mix(in srgb, #FFFFFF 86%, var(--brand));
    --sidebar-strong: #FFFFFF;
    --sidebar-hover: rgba(255, 255, 255, .07);
    --sidebar-active: rgba(255, 255, 255, .13);
    --sidebar-line: rgba(255, 255, 255, .08);
    --danger: #B3362B;
    --danger-soft: #FBE9E6;
    --warning: #A86A06;
    --warning-soft: #FDF1DC;
    --success: #23704A;
    --success-soft: #E3F3EA;
    --info-soft: color-mix(in srgb, #2B6CB0 10%, #FFFFFF);
    --shadow-1: 0 1px 2px rgba(20, 24, 22, .06), 0 0 0 1px var(--line);
    --shadow-2: 0 10px 30px -12px rgba(20, 24, 22, .28), 0 0 0 1px var(--line);
    --scrim: rgba(12, 16, 14, .5);
    color-scheme: light;

    /* v1 variable names, kept so older inline styles keep working */
    --green: var(--brand);
    --green-deep: var(--brand-deep);
    --brass: var(--accent);
    --brass-soft: var(--accent-soft);
    --paper: var(--bg);
    --paper-card: var(--surface);
    --red: var(--danger);
    --red-soft: var(--danger-soft);
    --blue-soft: var(--info-soft);
    --radius: var(--r-md);
}

:root[data-mode="dark"] {
    --bg: color-mix(in srgb, var(--brand-deep) 28%, #0D110F);
    --surface: color-mix(in srgb, var(--brand-deep) 24%, #161B18);
    --surface-2: color-mix(in srgb, var(--brand-deep) 30%, #1B211E);
    --surface-3: color-mix(in srgb, var(--brand-deep) 36%, #222925);
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .16);
    --ink: #ECEFEC;
    --ink-soft: #B2BBB5;
    --ink-faint: #85908A;
    --link: var(--brand-light);
    --brand-ink: var(--brand-light);
    --primary: var(--brand-light);
    --on-primary: var(--on-brand-light);
    --accent-fill: var(--accent-light);
    --on-accent-fill: var(--on-accent-light);
    --brand-soft: color-mix(in srgb, var(--brand) 26%, #161B18);
    --brand-mid: color-mix(in srgb, var(--brand) 60%, #FFFFFF);
    --accent-soft: color-mix(in srgb, var(--accent) 22%, #161B18);
    --accent-ink: var(--accent-light);
    --sidebar-bg: color-mix(in srgb, var(--brand-deep) 40%, #101412);
    --danger-soft: #3A1E1B;
    --warning-soft: #3A2C12;
    --success-soft: #16301F;
    --info-soft: #18263A;
    --shadow-1: 0 0 0 1px var(--line);
    --shadow-2: 0 14px 34px -14px rgba(0, 0, 0, .7), 0 0 0 1px var(--line);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root[data-mode="auto"] {
        --bg: color-mix(in srgb, var(--brand-deep) 28%, #0D110F);
        --surface: color-mix(in srgb, var(--brand-deep) 24%, #161B18);
        --surface-2: color-mix(in srgb, var(--brand-deep) 30%, #1B211E);
        --surface-3: color-mix(in srgb, var(--brand-deep) 36%, #222925);
        --line: rgba(255, 255, 255, .08);
        --line-strong: rgba(255, 255, 255, .16);
        --ink: #ECEFEC;
        --ink-soft: #B2BBB5;
        --ink-faint: #85908A;
        --link: var(--brand-light);
    --brand-ink: var(--brand-light);
    --primary: var(--brand-light);
    --on-primary: var(--on-brand-light);
    --accent-fill: var(--accent-light);
    --on-accent-fill: var(--on-accent-light);
        --brand-soft: color-mix(in srgb, var(--brand) 26%, #161B18);
        --brand-mid: color-mix(in srgb, var(--brand) 60%, #FFFFFF);
        --accent-soft: color-mix(in srgb, var(--accent) 22%, #161B18);
        --accent-ink: var(--accent-light);
        --sidebar-bg: color-mix(in srgb, var(--brand-deep) 40%, #101412);
        --danger-soft: #3A1E1B;
        --warning-soft: #3A2C12;
        --success-soft: #16301F;
        --info-soft: #18263A;
        --shadow-1: 0 0 0 1px var(--line);
        --shadow-2: 0 14px 34px -14px rgba(0, 0, 0, .7), 0 0 0 1px var(--line);
        color-scheme: dark;
    }
}

/* Light-menu themes (and "Your own colours" with a light menu): the menu
   sits on the page's own surface instead of the deep brand colour. In dark
   mode the same tokens resolve to dark surfaces, so it simply follows. */
:root[data-chrome="light"] {
    --sidebar-bg: var(--surface);
    --sidebar-ink: var(--ink-soft);
    --sidebar-strong: var(--ink);
    --sidebar-hover: var(--surface-3);
    --sidebar-active: var(--brand-soft);
    --sidebar-line: var(--line);
}
:root[data-chrome="light"] .sidebar { box-shadow: 1px 0 0 var(--line); }
:root[data-chrome="light"] .nav-link.active { color: var(--link); }

/* 2. Base & typography ================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
img, video, svg { max-width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
code { font-size: .88em; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; border-radius: 6px; }
.ic { width: 22px; height: 22px; flex-shrink: 0; vertical-align: middle; }
.ic-sm { width: 18px; height: 18px; }
.ic-lg { width: 30px; height: 30px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: .875rem; }

/* 3. App shell ========================================================== */
.shell { min-height: 100vh; min-height: 100dvh; }

/* Sidebar: off-canvas drawer on phones, fixed rail on desktop */
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    width: min(300px, 86vw);
    background: var(--sidebar-bg); color: var(--sidebar-ink);
    display: flex; flex-direction: column;
    transform: translateX(-102%);
    transition: transform .28s var(--ease);
    padding-bottom: env(safe-area-inset-bottom);
}
.shell.sidebar-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .35); }
.sidebar-overlay { position: fixed; inset: 0; background: var(--scrim); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
.shell.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 14px; min-height: 72px; }
.brand a { color: inherit; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--accent-fill); color: var(--on-accent-fill);
    font: 600 1.25rem/1 var(--font-display);
}
.brand-name { font: 600 1.15rem/1.15 var(--font-display); color: var(--sidebar-strong); }
.brand-logo { max-height: 40px; width: auto; max-width: 190px; object-fit: contain; display: block; }

.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; overscroll-behavior: contain; }
.nav-section-label { font-size: .78rem; font-weight: 600; color: color-mix(in srgb, var(--sidebar-ink) 60%, transparent); padding: 18px 10px 6px; letter-spacing: .02em; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    min-height: 42px; padding: 8px 10px; margin: 1px 0;
    border-radius: 10px; color: var(--sidebar-ink); font-weight: 500; font-size: .95rem;
}
.nav-link:hover { background: var(--sidebar-hover); text-decoration: none; }
.nav-link.active { background: var(--sidebar-active); color: var(--sidebar-strong); box-shadow: inset 3px 0 0 var(--accent-fill); }
.nav-icon { display: inline-flex; width: 22px; justify-content: center; opacity: .9; }
.nav-link .notif-badge { position: static; margin-left: auto; }

.sidebar-footer { border-top: 1px solid var(--sidebar-line); padding: 12px; display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px; border-radius: 10px; color: inherit; }
.user-chip:hover { background: var(--sidebar-hover); text-decoration: none; }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-fill); color: var(--on-accent-fill); font-weight: 700; flex-shrink: 0; overflow: hidden; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-meta { min-width: 0; }
.user-name { font-weight: 600; color: var(--sidebar-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.user-role { font-size: .78rem; opacity: .7; text-transform: capitalize; }
.logout-link { color: var(--sidebar-ink); opacity: .75; padding: 10px; border-radius: 10px; display: inline-flex; }
.logout-link:hover { opacity: 1; background: var(--sidebar-hover); }

/* Main column */
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: calc(var(--topbar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0;
    display: flex; align-items: center; gap: 4px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.page-title { font: 600 1.15rem/1.2 var(--font-display); margin: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.topbar-spacer { flex: 0; }
.icon-btn, .hamburger-btn, .notif-bell {
    position: relative; width: var(--tap); height: var(--tap); flex-shrink: 0;
    display: inline-grid; place-items: center;
    border: 0; background: transparent; color: var(--ink); border-radius: 50%; cursor: pointer; padding: 0;
}
.icon-btn:hover, .hamburger-btn:hover, .notif-bell:hover { background: var(--surface-3); text-decoration: none; }
.hamburger-btn span { display: none; }
.notif-badge {
    position: absolute; top: 5px; right: 4px;
    min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
    background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--bg);
}
.content { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.page-intro { color: var(--ink-soft); margin: 0 0 16px; max-width: 68ch; }

/* Bottom navigation (phones & tablets) */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
}
.bottom-nav a, .bottom-nav button {
    height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--ink-faint); font: 600 .7rem/1 var(--font-body); background: none; border: 0; cursor: pointer; text-decoration: none;
}
.bottom-nav .active { color: var(--brand-ink); }
:root[data-mode="dark"] .bottom-nav .active { color: var(--brand-mid); }
.bottom-nav .bn-add { display: grid; place-items: center; }
.bottom-nav .bn-add span {
    width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center;
    background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 20px -8px var(--primary); transform: translateY(-10px);
}
.bottom-nav .bn-add .ic { width: 26px; height: 26px; }

/* Sheets (quick add, more) */
.sheet-backdrop { position: fixed; inset: 0; background: var(--scrim); z-index: 70; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 71;
    background: var(--surface); border-radius: 22px 22px 0 0;
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform .28s var(--ease), visibility 0s linear .28s;
    max-height: 85vh; overflow-y: auto; visibility: hidden;
}
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 14px; }
.sheet h2 { font-size: 1.1rem; margin: 0 4px 12px; }
.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet-open .sheet.is-open { transform: none; visibility: visible; transition-delay: 0s; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-grid a {
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
    padding: 16px 6px; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink); font-size: .85rem; font-weight: 600;
}
.quick-grid a:hover { text-decoration: none; background: var(--brand-soft); }
.quick-grid .ic { width: 26px; height: 26px; color: var(--brand-ink); }
:root[data-mode="dark"] .quick-grid .ic { color: var(--brand-mid); }

.demo-ribbon {
    background: var(--accent-fill); color: var(--on-accent-fill); text-align: center; font-size: .82rem; font-weight: 600;
    padding: 6px 12px calc(6px);
}
.demo-ribbon a { color: inherit; text-decoration: underline; }

@media (min-width: 1024px) {
    .sidebar { transform: none; width: 268px; box-shadow: none; }
    .shell.sidebar-open .sidebar { box-shadow: none; }
    .sidebar-overlay, .bottom-nav, .hamburger-btn, .sheet-backdrop.only-mobile { display: none; }
    .main { margin-left: 268px; }
    .topbar { padding: 0 24px; height: 68px; }
    .page-title { font-size: 1.45rem; margin: 0; }
    .content { padding: 12px 32px 48px; }
    .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; border-radius: 22px; transform: translate(-50%, -46%) scale(.98); opacity: 0; pointer-events: none; transition: transform .2s var(--ease), opacity .2s, visibility 0s linear .2s; }
    .sheet::before { display: none; }
    .sheet-open .sheet.is-open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
    .quick-grid { grid-template-columns: repeat(4, 1fr); }
}

/* 4. Controls ============================================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--tap); padding: 10px 18px; border-radius: var(--r-pill);
    border: 1px solid transparent; font: 600 .95rem/1.2 var(--font-body); cursor: pointer;
    text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s;
    background: var(--surface-3); color: var(--ink);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 86%, #000); color: var(--on-primary); }
.btn-accent { background: var(--accent-fill); color: var(--on-accent-fill); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: .86rem; }
.btn-block { width: 100%; }
.btn .ic { width: 19px; height: 19px; }
.btn-link-danger { background: none; border: 0; color: var(--danger); cursor: pointer; font: inherit; font-size: .88rem; padding: 6px 4px; }
.btn-link-danger:hover { text-decoration: underline; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.field-label { display: block; font-weight: 600; font-size: .9rem; margin: 16px 0 6px; color: var(--ink); }
.field-label:first-child { margin-top: 0; }
.field-input {
    width: 100%; min-height: var(--tap); padding: 10px 14px;
    border: 1px solid var(--line-strong); border-radius: var(--r-sm);
    background: var(--surface); color: var(--ink);
    font: 400 1rem/1.4 var(--font-body); /* 16px stops iOS zooming on focus */
    transition: border-color .15s, box-shadow .15s;
}
.field-input:focus { outline: none; border-color: var(--brand-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
textarea.field-input { min-height: 120px; resize: vertical; }
select.field-input { 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% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 38px; }
input[type="file"].field-input { padding: 9px; font-size: .9rem; }
input[type="color"].field-input { padding: 4px; height: var(--tap); }
.field-hint { font-size: .85rem; color: var(--ink-soft); margin: 6px 0 0; }
.field-error { color: var(--danger); font-size: .85rem; margin-top: 6px; }
.checkbox-label { display: block; position: relative; padding-left: 30px; margin: 12px 0; font-size: .95rem; cursor: pointer; min-height: 22px; }
.checkbox-label > input { position: absolute; left: 0; top: 1px; width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.stacked-form { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.form-grid > div > .field-label { margin-top: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; align-items: center; }
.inline-form { display: inline; }
.inline-form-wrap { display: flex; flex-direction: column; gap: 10px; }
.member-photo-preview { width: 96px; height: 96px; object-fit: cover; border-radius: var(--r-md); display: block; margin-bottom: 8px; }
.search-form { display: flex; gap: 8px; flex: 1; }
.search-form .field-input { flex: 1; }
.list-toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

/* Segmented control & tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 18px; padding: 2px 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex-shrink: 0; min-height: 38px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow-1); color: var(--ink-soft); font-weight: 600; font-size: .88rem; }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.active { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.tab .count { font-size: .75rem; opacity: .8; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface-3); font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.chip-brand { background: var(--brand-soft); color: var(--brand-ink); }
:root[data-mode="dark"] .chip-brand { color: var(--brand-mid); }
.chip-accent { background: var(--accent-soft); color: var(--accent-ink); }

@media (min-width: 640px) {
    .form-grid { grid-template-columns: 1fr 1fr; }
    .inline-form-wrap { flex-direction: row; align-items: center; }
    .inline-form-wrap .field-input { flex: 1; }
    .list-toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
    .search-form { max-width: 420px; }
    .tabs { margin: 0 0 20px; padding: 2px; flex-wrap: wrap; overflow: visible; }
}

/* 5. Panels, tables, badges, flashes ===================================== */
.panel { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); margin-bottom: 18px; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 18px 0; }
.panel-header h2 { font-size: 1.12rem; margin: 0; }
.panel-header a { font-size: .9rem; font-weight: 600; }
.panel-body { padding: 16px 18px 18px; }
.panel-divider { height: 1px; background: var(--line); margin: 20px 0; }
.panel-flush .panel-body { padding: 0; }
.empty-state { text-align: center; color: var(--ink-soft); padding: 28px 16px; margin: 0; }
.empty-state .ic { width: 40px; height: 40px; color: var(--ink-faint); display: block; margin: 0 auto 10px; }
.empty-state strong { display: block; color: var(--ink); font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 4px; }
.empty-state .btn { margin-top: 14px; }
.settings-callout { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -18px; padding: 0 18px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.data-table th { text-align: left; font-weight: 600; color: var(--ink-soft); font-size: .82rem; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--r-pill); font-size: .76rem; font-weight: 700; background: var(--surface-3); color: var(--ink-soft); line-height: 1.4; white-space: nowrap; }
.badge-success, .badge-confirmed { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning, .badge-pending { background: var(--warning-soft); color: var(--warning); }
.badge-muted { background: var(--surface-3); color: var(--ink-faint); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
:root[data-mode="dark"] .badge-success, :root[data-mode="dark"] .badge-confirmed { color: #7FD3A4; }
:root[data-mode="dark"] .badge-danger { color: #F39A90; }
:root[data-mode="dark"] .badge-warning, :root[data-mode="dark"] .badge-pending { color: #F2C46B; }
.ai-tag { font-size: .72rem; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; }

.flash { border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 16px; font-size: .94rem; border: 1px solid transparent; }
.flash-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.flash-info { background: var(--info-soft); color: var(--ink); border-color: var(--line); }
.flash-warning { background: var(--warning-soft); color: var(--warning); }
:root[data-mode="dark"] .flash-success { color: #9BE0B8; }
:root[data-mode="dark"] .flash-error { color: #F7B1A8; }
:root[data-mode="dark"] .flash-warning { color: #F2C46B; }
.flash-standalone { max-width: 440px; margin: 16px auto; }

/* Stat tiles (dashboard, admin) */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 14px; position: relative; display: flex; flex-direction: column; gap: 2px; min-height: 92px; }
.stat-card-alert { background: var(--warning-soft); box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 30%, transparent); }
.stat-value { font: 600 1.6rem/1.1 var(--font-display); color: var(--ink); }
.stat-label { font-size: .84rem; color: var(--ink-soft); }
.stat-label a { color: inherit; }
.stat-action { display: block; margin-top: 4px; font-weight: 700; color: var(--link); }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

/* 6. Cards, lists, media grids ============================================ */
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; color: inherit; display: flex; flex-direction: column; }
a.card:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.card-media { aspect-ratio: 16 / 10; background: var(--surface-3); overflow: hidden; display: grid; place-items: center; color: var(--ink-faint); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media .ic { width: 40px; height: 40px; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { font: 600 1.05rem/1.25 var(--font-display); margin: 0; color: var(--ink); }
.card-meta { font-size: .84rem; color: var(--ink-soft); }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 1100px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { text-decoration: none; background: var(--surface-2); margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.list-row-main { flex: 1 1 160px; min-width: 0; }
.list-row { flex-wrap: wrap; }
.list-row > .btn-row { margin-left: auto; }
.list-row-title { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row-sub { font-size: .85rem; color: var(--ink-soft); }
.list-row-title, .list-row-sub { display: block; }
.list-row-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; flex-shrink: 0; }
:root[data-mode="dark"] .list-row-icon { color: var(--brand-mid); }
.list-row-icon.accent { background: var(--accent-soft); color: var(--accent-ink); }

.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }

/* Members */
.member-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.member-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 16px 12px; text-align: center; color: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.member-card:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.member-card-photo { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; margin-bottom: 8px; background: var(--brand-soft); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--line); }
.member-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.member-photo-placeholder { width: 100%; height: 100%; display: grid; place-items: center; font: 600 1.6rem/1 var(--font-display); color: var(--brand-ink); background: var(--brand-soft); }
:root[data-mode="dark"] .member-photo-placeholder { color: var(--brand-mid); }
.member-card-name { font-weight: 700; line-height: 1.25; }
.member-card-meta { font-size: .8rem; color: var(--ink-soft); }
.member-card-locked { opacity: .75; }
.deceased-mark { color: var(--ink-faint); font-size: .85em; }
@media (min-width: 640px) { .member-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .member-grid { grid-template-columns: repeat(5, 1fr); } }

.member-profile { display: flex; flex-direction: column; gap: 18px; }
.member-hero { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 22px 18px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; position: relative; overflow: hidden; }
.member-hero::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 86px; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); }
.member-hero > * { position: relative; }
.member-hero-photo { width: 128px; height: 128px; border-radius: 50%; overflow: hidden; background: var(--brand-soft); box-shadow: 0 0 0 5px var(--surface); }
.member-hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.member-hero-info h2 { font-size: 1.6rem; margin-bottom: 4px; }
.member-relation-to-you { display: inline-block; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: .82rem; padding: 3px 10px; border-radius: var(--r-pill); margin-bottom: 8px; }
.member-fact-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: .93rem; color: var(--ink-soft); }
.member-hero .form-actions { justify-content: center; margin-top: 4px; }
@media (min-width: 640px) {
    .member-hero { flex-direction: row; align-items: flex-start; text-align: left; padding: 24px; gap: 24px; }
    .member-hero-photo { flex-shrink: 0; margin-top: 18px; }
    .member-hero-info { flex: 1; min-width: 0; padding-top: 80px; }
    .member-hero::before { height: 96px; }
    .member-hero .form-actions { justify-content: flex-start; }
}

.relationship-group { margin-bottom: 18px; }
.relationship-group:last-child { margin-bottom: 0; }
.relationship-group-label { font: 700 .85rem/1.3 var(--font-body); color: var(--ink-soft); margin: 0 0 8px; letter-spacing: .01em; }
.relationship-list { list-style: none; padding: 0; margin: 0; }
.relationship-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.relationship-item:last-child { border-bottom: 0; }
.add-relationship-form { margin-top: 16px; }

/* Documents */
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.doc-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 14px; color: inherit; }
.doc-card:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.doc-card-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); flex-shrink: 0; font-size: 1.3rem; }
:root[data-mode="dark"] .doc-card-icon { color: var(--brand-mid); }
.doc-card-body { min-width: 0; flex: 1; }
.doc-card-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-card-meta, .doc-card-date { font-size: .82rem; color: var(--ink-soft); }
.doc-preview-image { max-width: 100%; border-radius: var(--r-md); display: block; }
.doc-preview-pdf { width: 100%; height: 70vh; border: 0; border-radius: var(--r-md); background: var(--surface-3); }
.cert-upload-block { border: 1px dashed var(--line-strong); border-radius: var(--r-md); padding: 14px; margin-top: 12px; }
.cert-on-file { font-size: .9rem; color: var(--success); margin-bottom: 8px; }
.cert-status-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.cert-label { font-weight: 600; }
.cert-ok { color: var(--success); }
.cert-missing { color: var(--warning); }
.vault-expiring { box-shadow: 0 0 0 1.5px var(--warning); }
@media (min-width: 640px) { .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .doc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0 -12px; }
.photo-card { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--surface-3); display: block; color: #fff; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
.photo-card:hover img { transform: scale(1.04); }
.photo-card-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: .75rem; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 640px) { .photo-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; } .photo-card { border-radius: var(--r-md); } }
@media (min-width: 1100px) { .photo-grid { grid-template-columns: repeat(5, 1fr); } }

/* Audio */
.audio-row { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; }
.audio-row-info { min-width: 0; }
.audio-row-title { font-weight: 700; }
.audio-row audio { width: 100%; height: 40px; }

/* Stories */
.story-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.story-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; color: inherit; display: flex; flex-direction: column; }
.story-card:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.story-card-cover { aspect-ratio: 16 / 9; background: var(--surface-3); overflow: hidden; }
.story-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.story-card-body { padding: 14px 16px 16px; }
.story-card-title { font: 600 1.15rem/1.25 var(--font-display); margin-bottom: 4px; }
.story-cover-hero { width: 100%; max-height: 380px; object-fit: cover; border-radius: var(--r-lg); margin-bottom: 18px; display: block; }
.story-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--surface-2); }
.story-toolbar + textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.story-body { font-family: var(--font-display); font-size: 1.08rem; line-height: 1.75; max-width: 68ch; }
.story-body h3 { margin-top: 1.4em; }
.story-body p { margin: 0 0 1.1em; }
.story-body ul { padding-left: 1.3em; }
.story-body blockquote { margin: 1.2em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); color: var(--ink-soft); font-style: italic; }
.rich-text-content p { margin: 0 0 .9em; }
.rich-text-content p:last-child { margin-bottom: 0; }
.rich-text-content ul, .rich-text-content ol { padding-left: 1.3em; }
.rich-text-content a { text-decoration: underline; }
@media (min-width: 640px) { .story-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .story-grid { grid-template-columns: repeat(3, 1fr); } }

/* 7. Module styles (v1 modules) ============================================ */
/* Activity */
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.activity-item:last-child { border-bottom: 0; }
.activity-actor { font-weight: 700; }
.activity-action { color: var(--ink-soft); }
.activity-desc { color: var(--ink-soft); }
.activity-time { margin-left: auto; color: var(--ink-faint); font-size: .8rem; }

/* Family tree */
.tree-visual-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.tree-visual-zoom-controls { display: flex; gap: 6px; }
.tree-visual-wrap { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; height: 68vh; min-height: 420px; position: relative; }
.ftree-host { width: 100%; height: 100%; }
.ftree-svg { width: 100%; height: 100%; cursor: grab; touch-action: none; background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px; }
.ftree-svg:active { cursor: grabbing; }
.ftree-status { position: absolute; top: 12px; left: 12px; background: var(--surface); padding: 6px 12px; border-radius: var(--r-pill); font-size: .85rem; box-shadow: var(--shadow-1); }
.ftree-status:empty { display: none; }
.ftree-node-box { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.2; transition: stroke .15s; }
.ftree-node:hover .ftree-node-box { stroke: var(--brand); stroke-width: 2; }
.ftree-node-private .ftree-node-box { fill: var(--surface-3); stroke-dasharray: 4 3; }
.ftree-avatar-text { fill: var(--brand-ink); font: 700 15px var(--font-body); }
.ftree-name-text { fill: var(--ink); font: 700 13px var(--font-body); }
.ftree-meta-text { fill: var(--ink-soft); font: 400 11px var(--font-body); }
.ftree-edge, .ftree-spouse-link { fill: none; stroke: var(--line-strong); stroke-width: 1.6; }
.ftree-spouse-link { stroke: var(--accent); stroke-dasharray: 5 4; }
.ftree-expand-circle { fill: var(--brand); }
.ftree-expand-btn:hover .ftree-expand-circle { fill: var(--brand-deep); }
.ftree-expand-btn { cursor: pointer; }
.ftree-expand-label { fill: #fff; font: 700 12px var(--font-body); pointer-events: none; }
.tree-visual-help { font-size: .85rem; color: var(--ink-soft); margin-top: 10px; }

/* Forum */
.forum-list { display: grid; gap: 10px; }
.forum-card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 16px; color: inherit; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.forum-card:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.forum-card-main { min-width: 0; flex: 1; }
.forum-card-title { font: 600 1.05rem/1.3 var(--font-display); }
.forum-card-stats { font-size: .84rem; color: var(--ink-soft); }
.forum-post { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 16px; margin-bottom: 12px; }
.forum-post-reply { margin-left: 14px; border-left: 3px solid var(--brand-soft); box-shadow: none; border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--surface-2); }
.forum-post-header { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.forum-post-author { font-weight: 700; }
.forum-post-time { font-size: .8rem; color: var(--ink-faint); }
.forum-post-body { line-height: 1.6; }
.forum-attachment { display: inline-flex; gap: 6px; margin-top: 10px; font-size: .9rem; font-weight: 600; }
.forum-post-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: .88rem; }
.forum-like-btn { background: var(--surface-3); border: 0; border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer; font: 600 .85rem var(--font-body); color: var(--ink-soft); min-height: 34px; }
.forum-like-btn-active { background: var(--danger-soft); color: var(--danger); }
.forum-like-count { font-weight: 700; }
.forum-replies { margin-top: 12px; }
.forum-reply-toggle { background: none; border: 0; color: var(--link); font: 600 .88rem var(--font-body); cursor: pointer; padding: 6px 0; }
.forum-reply-form { margin-top: 10px; }
.forum-delete-form { display: inline; }

/* Chat */
.chat-wrap { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); display: flex; flex-direction: column; height: calc(100dvh - var(--topbar-h) - var(--nav-h) - 60px); min-height: 380px; overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.chat-message { max-width: 86%; align-self: flex-start; background: var(--surface); border-radius: 16px 16px 16px 4px; padding: 8px 12px; box-shadow: var(--shadow-1); }
.chat-message-mine { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-radius: 16px 16px 4px 16px; box-shadow: none; }
.chat-message-mine .chat-message-meta, .chat-message-mine .chat-message-author, .chat-message-mine .chat-message-time { color: color-mix(in srgb, var(--on-brand) 75%, transparent); }
.chat-message-meta { display: flex; gap: 8px; font-size: .75rem; margin-bottom: 2px; color: var(--ink-faint); }
.chat-message-author { font-weight: 700; color: var(--brand-ink); }
.chat-message-body { white-space: pre-wrap; word-wrap: break-word; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface); align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 44px; max-height: 140px; resize: none; }
@media (min-width: 1024px) { .chat-wrap { height: calc(100vh - 150px); } .chat-message { max-width: 70%; } }

/* Messages */
.conversation-list { list-style: none; margin: 0; padding: 0; }
.conversation-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: inherit; }
.conversation-row:last-child { border-bottom: 0; }
.conversation-row:hover { background: var(--surface-2); text-decoration: none; }
.conversation-avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.conversation-meta { flex: 1; min-width: 0; }
.conversation-name { font-weight: 600; }
.conversation-row-unread .conversation-name { font-weight: 800; }
.conversation-preview { font-size: .87rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .76rem; color: var(--ink-faint); }

/* Calendar */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.calendar-nav h2 { margin: 0; font-size: 1.25rem; }
.calendar-list { display: grid; gap: 8px; }
.calendar-day-row { display: flex; gap: 14px; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 12px 14px; }
.calendar-day-num { font: 600 1.5rem/1 var(--font-display); color: var(--brand-ink); width: 42px; text-align: center; flex-shrink: 0; }
.calendar-day-num small { display: block; font: 600 .7rem/1.4 var(--font-body); color: var(--ink-faint); }
.calendar-day-items { flex: 1; min-width: 0; display: grid; gap: 6px; }
.calendar-item { display: flex; align-items: center; gap: 8px; color: inherit; padding: 4px 0; font-weight: 500; }
.calendar-item:hover { text-decoration: none; color: var(--link); }

/* Timeline */
.timeline-list { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; }
.timeline-list::before { content: ''; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 18px 12px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-icon { position: absolute; left: -26px; top: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--brand); display: grid; place-items: center; font-size: .7rem; }

/* Map */
.family-map-host { height: 62vh; min-height: 360px; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); z-index: 0; }
.family-map-host .leaflet-popup-content a { font-weight: 700; }

/* Notifications */
.notif-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.notif-item-unread { background: color-mix(in srgb, var(--brand-soft) 60%, transparent); margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.notif-link-btn { background: none; border: 0; color: var(--link); font: 600 .88rem var(--font-body); cursor: pointer; padding: 0; }

/* Fundraising */
.fundraiser-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.fundraiser-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; color: inherit; }
.fundraiser-card:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.fundraiser-card-cover { aspect-ratio: 16 / 9; background: var(--surface-3); overflow: hidden; }
.fundraiser-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.fundraiser-card-body { padding: 14px 16px 16px; }
.fundraiser-card-title { font: 600 1.1rem/1.25 var(--font-display); margin-bottom: 8px; }
.fundraiser-progress-track { height: 8px; background: var(--surface-3); border-radius: 8px; overflow: hidden; margin: 8px 0; }
.fundraiser-progress-track-lg { height: 14px; }
.fundraiser-progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 8px; }
.fundraiser-stats-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .9rem; color: var(--ink-soft); }
.gateway-choice-row { display: grid; gap: 10px; }
.gateway-choice { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1.5px solid var(--line-strong); border-radius: var(--r-md); cursor: pointer; font-weight: 600; }
.gateway-choice:has(input:checked) { border-color: var(--brand-ink); background: var(--brand-soft); }
@media (min-width: 640px) { .fundraiser-grid { grid-template-columns: repeat(2, 1fr); } .gateway-choice-row { grid-template-columns: repeat(3, 1fr); } }

/* Theme swatches (Settings) */
.theme-swatch-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 10px; }
.theme-swatch { cursor: pointer; border-radius: var(--r-md); padding: 8px; background: var(--surface-2); box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 6px; font-size: .78rem; font-weight: 600; text-align: center; color: var(--ink-soft); border: 2px solid transparent; }
.theme-swatch-colors { display: flex; height: 34px; border-radius: 8px; overflow: hidden; }
.theme-swatch-colors span { flex: 1; }
.theme-swatch-colors span:nth-child(1) { background: var(--brand-deep); }
.theme-swatch-colors span:nth-child(2) { background: var(--brand); }
.theme-swatch-colors span:nth-child(3) { background: var(--accent); }
.theme-swatch.selected, .theme-swatch:has(input:checked) { border-color: var(--ink); color: var(--ink); }
.theme-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch[data-chrome="light"] .theme-swatch-colors span:nth-child(1) { background: color-mix(in srgb, var(--brand) 8%, #F7F6F2); box-shadow: inset -1px 0 0 rgba(0, 0, 0, .06); }
.custom-theme { display: grid; gap: 14px; align-items: start; }
.custom-theme .theme-swatch { max-width: 160px; }
.custom-theme-fields { display: grid; gap: 14px; min-width: 0; }
.color-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.color-pair { display: flex; gap: 8px; align-items: center; }
.color-pair input[type=color] { width: 48px; height: 44px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: pointer; flex-shrink: 0; }
.color-pair .field-input { max-width: 140px; font-family: ui-monospace, Menlo, Consolas, monospace; text-transform: uppercase; }
@media (min-width: 720px) {
    .custom-theme { grid-template-columns: 160px minmax(0, 1fr); }
    .custom-theme-fields { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* 8. Module styles (v2 modules) ============================================ */
/* Dashboard: "Today in the family" */
.today { background: linear-gradient(160deg, var(--brand-deep) 0%, color-mix(in srgb, var(--brand) 80%, var(--brand-deep)) 100%); color: #fff; border-radius: var(--r-lg); padding: 18px 16px 16px; margin-bottom: 18px; position: relative; overflow: hidden; }
.today::after { content: ''; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(255, 255, 255, .05); }
.today-greeting { font: 600 1.45rem/1.2 var(--font-display); margin: 0 0 2px; color: #fff; }
.today-date { opacity: .78; font-size: .9rem; margin-bottom: 14px; }
.faces { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; position: relative; z-index: 1; }
.faces::-webkit-scrollbar { display: none; }
.face { width: 72px; flex-shrink: 0; text-align: center; color: #fff; font-size: .76rem; line-height: 1.25; }
.face:hover { text-decoration: none; }
.face-ring { display: block; width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; padding: 3px; background: rgba(255, 255, 255, .25); }
.face-ring.birthday { background: conic-gradient(var(--accent), #FFD98A, var(--accent)); }
.face-ring.anniversary { background: conic-gradient(#F4A3B4, #fff, #F4A3B4); }
.face-ring.memorial { background: rgba(255, 255, 255, .55); }
.face-ring > span, .face-ring > img { display: grid; width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; object-fit: cover; background: var(--brand-deep); border: 2px solid var(--brand-deep); font: 600 1.15rem var(--font-display); color: #fff; }
.face strong { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.face small { opacity: .75; }
.today-empty { opacity: .82; font-size: .92rem; margin: 0; position: relative; z-index: 1; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 18px; }
@media (min-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.shortcut-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.shortcut { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); color: var(--ink); font-size: .76rem; font-weight: 600; text-align: center; }
.shortcut:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.shortcut .ic { color: var(--brand-ink); width: 24px; height: 24px; }
:root[data-mode="dark"] .shortcut .ic { color: var(--brand-mid); }
@media (min-width: 640px) { .shortcut-row { grid-template-columns: repeat(8, 1fr); } }

.notice { border-radius: var(--r-md); padding: 14px 16px; background: var(--surface); box-shadow: var(--shadow-1); margin-bottom: 10px; border-left: 4px solid var(--line-strong); }
.notice-important { border-left-color: var(--accent-ink); }
.notice-urgent { border-left-color: var(--danger); background: var(--danger-soft); }
.notice-title { font: 600 1.05rem/1.3 var(--font-display); margin: 0 0 4px; display: flex; gap: 8px; align-items: center; }
.notice-meta { font-size: .8rem; color: var(--ink-faint); margin-top: 8px; }
.notice-body { white-space: pre-line; }

/* Memorials */
.memorial-hero { text-align: center; padding: 32px 18px 26px; border-radius: var(--r-lg); background: linear-gradient(180deg, var(--surface-3), var(--surface)); box-shadow: var(--shadow-1); margin-bottom: 18px; }
.memorial-photo { width: 148px; height: 148px; margin: 0 auto 16px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 6px var(--surface), 0 0 0 7px var(--line-strong); filter: saturate(.85); }
.memorial-photo img { width: 100%; height: 100%; object-fit: cover; }
.memorial-name { font-size: 1.9rem; margin-bottom: 4px; }
.memorial-dates { color: var(--ink-soft); font-size: 1rem; letter-spacing: .02em; }
.memorial-epitaph { font: italic 400 1.15rem/1.6 var(--font-display); color: var(--ink-soft); max-width: 46ch; margin: 16px auto 0; }
.candle-count { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-weight: 700; color: var(--accent-ink); }
.candle-flame { width: 14px; height: 20px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #FFF3C4, #F6B73C 55%, #E0782B); animation: flicker 2.4s infinite ease-in-out; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.08, .94) rotate(2deg); } }
.tribute { padding: 14px 0; border-bottom: 1px solid var(--line); }
.tribute:last-child { border-bottom: 0; }
.tribute-body { font-family: var(--font-display); font-size: 1.02rem; line-height: 1.7; white-space: pre-line; }
.tribute-by { font-size: .84rem; color: var(--ink-soft); margin-top: 4px; }
.memorial-card .card-media { aspect-ratio: 4 / 3; }
.memorial-card .card-media img { filter: grayscale(.25); object-position: 50% 30%; }

/* Time capsules */
.capsule-card { position: relative; }
.capsule-card.locked .card-media { background: repeating-linear-gradient(-45deg, var(--surface-3), var(--surface-3) 10px, var(--surface-2) 10px, var(--surface-2) 20px); }
.capsule-countdown { font: 600 1.6rem/1 var(--font-display); color: var(--brand-ink); }
:root[data-mode="dark"] .capsule-countdown { color: var(--brand-mid); }
.capsule-sealed { text-align: center; padding: 40px 18px; }
.capsule-sealed .ic { width: 54px; height: 54px; color: var(--accent-ink); }

/* Recipes */
.recipe-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.recipe-cols { display: grid; gap: 18px; }
.ingredient-list { padding-left: 0; list-style: none; margin: 0; }
.ingredient-list li { padding: 8px 0 8px 30px; border-bottom: 1px dashed var(--line); position: relative; }
.ingredient-list li::before { content: ''; position: absolute; left: 4px; top: 13px; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--line-strong); }
.step-list { padding-left: 0; list-style: none; counter-reset: step; margin: 0; }
.step-list li { counter-increment: step; position: relative; padding: 4px 0 14px 42px; }
.step-list li::before { content: counter(step); position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-weight: 800; font-size: .85rem; display: grid; place-items: center; }
@media (min-width: 900px) { .recipe-cols { grid-template-columns: 1fr 1.6fr; } }

/* Directory */
.contact-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 14px; display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.contact-card .list-row-main { flex: 1 1 160px; }
.contact-actions { display: flex; gap: 6px; margin-left: auto; }
.contact-actions a { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.contact-actions a:hover { text-decoration: none; background: var(--primary); color: var(--on-primary); }

/* Celebrations */
.celebration { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.celebration:last-child { border-bottom: 0; }
.celebration .list-row-title { white-space: normal; }
.list-row, .doc-card, .contact-card, .celebration { min-width: 0; }
.date-tile { width: 52px; flex-shrink: 0; text-align: center; border-radius: 12px; background: var(--surface-2); box-shadow: var(--shadow-1); padding: 6px 0; }
.date-tile b { display: block; font: 600 1.3rem/1.1 var(--font-display); color: var(--ink); }
.date-tile span { font-size: .7rem; font-weight: 700; color: var(--ink-faint); }
.when { font-size: .8rem; font-weight: 700; color: var(--accent-ink); }

/* Search */
.search-hero { margin-bottom: 16px; }
.search-hero form { display: flex; gap: 8px; }
.result-group h2 { font-size: 1rem; color: var(--ink-soft); font-family: var(--font-body); font-weight: 700; margin: 18px 0 6px; }

/* Settings / admin sub-navigation */
.settings-layout { display: grid; gap: 18px; }
.subnav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 16px; padding: 2px 16px; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill); color: var(--ink-soft); font-weight: 600; font-size: .9rem; background: var(--surface); box-shadow: var(--shadow-1); }
.subnav a:hover { text-decoration: none; color: var(--ink); }
.subnav a.active { background: var(--ink); color: var(--bg); box-shadow: none; }
@media (min-width: 1024px) {
    .settings-layout { grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
    /* Vertical side menu only when the page has a side column for it;
       elsewhere it stays a row of pills (never sticky over content). */
    .subnav { margin: 0 0 20px; padding: 2px; flex-wrap: wrap; overflow: visible; }
    .settings-layout > .subnav { flex-direction: column; flex-wrap: nowrap; margin: 0; padding: 0; position: sticky; top: 84px; }
    .settings-layout > .subnav a { background: transparent; box-shadow: none; border-radius: 10px; }
    .settings-layout > .subnav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
}
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 0 4px; }
.provider-option { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r-md); border: 1.5px solid var(--line-strong); cursor: pointer; font-weight: 700; font-size: .92rem; }
.provider-option small { font-weight: 500; color: var(--ink-soft); font-size: .76rem; }
.provider-option input { position: absolute; opacity: 0; }
.provider-option:has(input:checked) { border-color: var(--brand-ink); background: var(--brand-soft); }
.provider-fields { display: none; }
.provider-fields.active { display: block; }
.template-preview { width: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.placeholder-list { display: flex; flex-wrap: wrap; gap: 6px; }
.placeholder-list code { cursor: pointer; }
.sms-preview { max-width: 320px; background: var(--surface-3); border-radius: 18px 18px 18px 4px; padding: 12px 14px; white-space: pre-wrap; font-size: .93rem; }
.char-count { font-size: .8rem; color: var(--ink-faint); text-align: right; margin-top: 4px; }
.licence-status { display: flex; gap: 14px; align-items: center; }
.licence-status .ic { width: 42px; height: 42px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: .93rem; margin: 0; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; word-break: break-word; }

/* 9. Public pages, auth, installer ======================================== */
.auth-body, .landing-body { background: var(--bg); }
.auth-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-2); padding: 28px 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.auth-brand .brand-name { color: var(--ink); font-size: 1.3rem; }
.auth-brand .brand-mark { background: var(--primary); color: var(--on-primary); }
.auth-tagline { color: var(--ink-soft); margin: 0 0 20px; }
.auth-form .btn { margin-top: 22px; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 18px; font-size: .9rem; font-weight: 600; }
.auth-footer { text-align: center; color: var(--ink-faint); font-size: .82rem; margin-top: 18px; }
.demo-logins { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.demo-logins p { font-size: .85rem; color: var(--ink-soft); margin: 0 0 8px; }
.demo-logins .btn-row .btn { flex: 1; }

/* Landing */
.landing-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; max-width: 1160px; margin: 0 auto; }
.landing-nav .brand-name { color: var(--ink); }
.landing-nav .brand-mark { background: var(--primary); color: var(--on-primary); }
.landing-nav nav { display: flex; gap: 6px; align-items: center; }
.landing-hero { padding: 24px 16px 56px; }
.landing-hero-inner { max-width: 1160px; margin: 0 auto; display: grid; gap: 32px; align-items: center; }
.landing-hero h1 { font-size: clamp(2.2rem, 7.5vw, 4.1rem); line-height: 1.04; letter-spacing: -.025em; margin: 0 0 16px; max-width: 13ch; }
.landing-tagline { font-size: 1.12rem; color: var(--ink-soft); max-width: 46ch; margin: 0 0 24px; }
.landing-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.landing-cta .btn { min-height: 50px; padding: 12px 24px; font-size: 1rem; }
.landing-cta-ghost { background: var(--surface); }
.landing-logo { max-height: 72px; width: auto; margin-bottom: 18px; }
.landing-logo-mark { display: none; }
/* The memorable piece: a living family tree of faces, drawn in CSS */
.hero-tree { position: relative; aspect-ratio: 1 / .92; max-width: 520px; width: 100%; margin: 0 auto; }
.hero-tree svg.links { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-tree svg.links path { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.hero-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--ink-soft); }
.hero-node .dot { width: clamp(52px, 13vw, 76px); height: clamp(52px, 13vw, 76px); border-radius: 50%; display: grid; place-items: center; font: 600 clamp(1.1rem, 3.4vw, 1.5rem)/1 var(--font-display); color: #fff; box-shadow: 0 0 0 5px var(--bg), 0 0 0 7px var(--line); }
.hero-node.elder .dot { background: var(--brand-deep); }
.hero-node.mid .dot { background: var(--brand); }
.hero-node.young .dot { background: var(--accent-fill); color: var(--on-accent-fill); }
.hero-node.memorial .dot { background: var(--surface-3); color: var(--ink-soft); }
.hero-node .tag { background: var(--surface); padding: 2px 8px; border-radius: var(--r-pill); box-shadow: var(--shadow-1); white-space: nowrap; font-size: .7rem; }
@media (min-width: 640px) { .hero-node .tag { font-size: .78rem; } }
.landing-section { padding: 56px 16px; }
.landing-section-inner { max-width: 1160px; margin: 0 auto; }
.landing-section h2 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); max-width: 20ch; margin-bottom: 12px; }
.landing-section .lede { color: var(--ink-soft); max-width: 58ch; margin-bottom: 28px; font-size: 1.05rem; }
.landing-features { background: var(--surface); }
.feature-grid { display: grid; grid-template-columns: 1fr; gap: 26px 32px; }
.feature-card { display: grid; grid-template-columns: 44px 1fr; gap: 4px 14px; align-items: start; }
.feature-icon { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
:root[data-mode="dark"] .feature-icon { color: var(--brand-mid); }
.feature-card h3 { margin: 2px 0 0; font-size: 1.08rem; }
.feature-card p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.split { display: grid; gap: 28px; align-items: center; }
.pull-quote { font: italic 400 clamp(1.3rem, 3.6vw, 1.9rem)/1.45 var(--font-display); color: var(--ink); max-width: 30ch; margin: 0; }
.pull-quote cite { display: block; font: 600 .9rem var(--font-body); color: var(--ink-soft); margin-top: 14px; font-style: normal; }
.step-cards { display: grid; gap: 14px; counter-reset: s; }
.step-cards li { list-style: none; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 18px 18px 18px 64px; position: relative; counter-increment: s; }
.step-cards li::before { content: counter(s); position: absolute; left: 18px; top: 18px; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; }
.step-cards strong { display: block; margin-bottom: 2px; }
.landing-footer { padding: 28px 16px calc(28px + env(safe-area-inset-bottom)); text-align: center; color: var(--ink-faint); font-size: .86rem; border-top: 1px solid var(--line); }
.landing-footer nav { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.6em; }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } .step-cards { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) {
    .landing-nav { padding: 22px 24px; }
    .landing-hero { padding: 40px 24px 88px; }
    .landing-hero-inner { grid-template-columns: 1.05fr 1fr; gap: 48px; }
    .landing-section { padding: 88px 24px; }
    .feature-grid { grid-template-columns: repeat(3, 1fr); }
    .split { grid-template-columns: 1fr 1fr; gap: 64px; }
}

/* Public memorial page */
.public-wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }

/* 10. Utilities, print, motion ============================================= */
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 16px; }
.text-center { text-align: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.hide-mobile { display: none; }
@media (min-width: 1024px) { .hide-mobile { display: initial; } .hide-desktop { display: none !important; } }
.fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 35; width: 56px; height: 56px; border-radius: 18px; background: var(--accent-fill); color: var(--on-accent-fill); display: grid; place-items: center; box-shadow: var(--shadow-2); }
.fab:hover { text-decoration: none; }
@media (min-width: 1024px) { .fab { display: none; } }

@media print {
    .sidebar, .topbar, .bottom-nav, .sheet, .sheet-backdrop, .form-actions, .fab, .demo-ribbon { display: none !important; }
    .main { margin: 0 !important; }
    .content { padding: 0 !important; max-width: none; }
    body { background: #fff; color: #000; }
    .panel, .card, .member-hero { box-shadow: none; border: 1px solid #ccc; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Licence page: cPanel cron commands */
.cron-title{font-size:1rem;margin:20px 0 6px}
.cron-list{display:grid;gap:10px;margin:10px 0}
.cron-item{border:1px solid var(--line, #DEDCD4);border-radius:12px;padding:10px 12px;min-width:0}
.cron-head{display:flex;flex-wrap:wrap;gap:8px 14px;align-items:center;justify-content:space-between;margin-bottom:8px}
.cron-fields{display:flex;gap:6px;flex-wrap:wrap}
.cron-fields span{display:flex;flex-direction:column;align-items:center;font-size:.7rem;color:var(--muted, #6B6B63)}
.cron-fields code{font-size:.85rem;min-width:2.4em;text-align:center}
.cron-cmd{display:flex;gap:8px;align-items:center;min-width:0;margin:6px 0}
.cron-cmd code{flex:1;min-width:0;overflow-x:auto;white-space:nowrap;display:block;padding:6px 8px;font-size:.8rem}

/* File pickers match the theme in light and dark */
input[type=file] { color: var(--ink-soft); font: inherit; font-size: .9rem; max-width: 100%; }
input[type=file]::file-selector-button { font: 600 .86rem var(--font-body); color: var(--ink); background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: var(--r-pill); padding: 7px 14px; margin-right: 10px; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--brand-soft); }
