/* ============================================================================
   FamFolks — a deliberately single, warm LIGHT world (a printed family-album
   feel). Tokens are forced light so the keepsake look is consistent for everyone.
   ========================================================================== */
:root {
    --ground:    #FBF5EC;
    --ground-2:  #F4E9D9;
    --card:      #FFFFFF;
    --card-soft: #FFF9F0;
    --ink:       #3E332E;
    --ink-soft:  #8B7A6F;
    --line:      #EADFCF;
    --coral:     #EF7154;
    --coral-deep:#D9563B;
    --sun:       #F4B740;
    --teal:      #2FA98D;
    --teal-deep: #1F8C73;
    --ghost:     #EFE6D8;
    --shadow:    14px 18px 40px -22px rgba(90, 60, 40, .45);
    --shadow-sm: 8px 10px 24px -16px rgba(90, 60, 40, .40);
    --ff-font: "SF Pro Rounded", "Segoe UI Variable Display", -apple-system, "Segoe UI", system-ui, "Nunito", "Helvetica Neue", sans-serif;
    color-scheme: light;
}

/* border-box so a card's padding/border count inside its grid-track width — without this
   width:100% cards overflow their column and overlap the neighbouring partner. */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }
body {
    font-family: var(--ff-font);
    color: var(--ink);
    background:
        radial-gradient(1100px 480px at 15% -8%, rgba(244,183,64,.18), transparent 60%),
        radial-gradient(900px 460px at 92% 6%, rgba(47,169,141,.15), transparent 55%),
        var(--ground);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px 72px; }

/* ---- Banner ---- */
.banner {
    position: sticky; top: 0; z-index: 20;
    padding: 12px 0;
    background: color-mix(in srgb, var(--ground) 86%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.banner-in {
    max-width: 1000px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; text-decoration: none; color: inherit; }
.brand .mark { font-size: 1.5rem; line-height: 1; }
.brand b { font-size: 1.18rem; font-weight: 800; letter-spacing: -.01em; }
.brand small { display: block; color: var(--ink-soft); font-size: .74rem; font-weight: 600; margin-top: 1px; }
nav { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
    font-size: .86rem; font-weight: 700; text-decoration: none;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.pill:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: color-mix(in srgb, var(--coral) 45%, var(--line)); }
.pill:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.intro { text-align: center; color: var(--ink-soft); font-weight: 600; font-size: .9rem; padding: 24px 0 4px; }

/* ---- Couple ---- */
.stage { animation: rise .32s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.couple {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: clamp(16px, 4vw, 44px); align-items: start; margin-top: 10px;
}
.lineage { display: flex; flex-direction: column; align-items: center; gap: 0; }

/* per-person step-up to their own parents */
.up-pill {
    font-weight: 800; font-size: .82rem; text-decoration: none;
    display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
    padding: 8px 16px; border-radius: 999px;
    color: #fff; border: none;
    background: linear-gradient(180deg, var(--teal), var(--teal-deep));
    box-shadow: 0 9px 18px -11px color-mix(in srgb, var(--teal) 85%, black);
    transition: transform .15s ease, filter .15s ease;
}
.up-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-pill .arw { transition: transform .18s ease; }
.up-pill:hover { transform: translateY(-2px); filter: brightness(1.05); }
.up-pill:hover .arw { transform: translateY(-3px); }
.up-pill:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.up-pill.add {
    background: none; color: var(--ink-soft);
    border: 1px dashed var(--line); box-shadow: none; font-weight: 700; cursor: default;
}
.up-pill.ghost-pill { visibility: hidden; }
.connector { width: 2px; height: 16px; background: linear-gradient(var(--teal), transparent); border-radius: 2px; }
.connector.faint { background: linear-gradient(var(--line), transparent); }

.pcard {
    position: relative; width: 100%;
    background: linear-gradient(180deg, var(--card), var(--card-soft));
    border: 1px solid var(--line); border-radius: 26px;
    padding: 26px 24px 22px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center; text-align: center;
    transition: transform .16s ease, box-shadow .16s ease;
}
.pcard.home { border-color: transparent; box-shadow: var(--shadow), 0 0 0 3px var(--coral); }
.pcard.deceased { filter: grayscale(.5); }
.pcard.ghost {
    background: repeating-linear-gradient(135deg, var(--ghost), var(--ghost) 12px, transparent 12px, transparent 24px);
    border: 2px dashed var(--line); box-shadow: none; justify-content: center; min-height: 232px;
}
.ghost .ghost-in { color: var(--ink-soft); font-weight: 700; display: grid; gap: 8px; justify-items: center; }
.ghost .ghost-in .plus { font-size: 1.7rem; }

.tags { position: absolute; top: 14px; left: 14px; display: flex; gap: 6px; }
.tag {
    font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    padding: 4px 9px; border-radius: 999px; color: #fff;
}
.tag.home { background: var(--coral); }
.tag.you  { background: var(--teal); }

/* Avatars (rendered by the Avatar component) */
.avatar {
    width: 116px; height: 116px; border-radius: 50%;
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 2.1rem; letter-spacing: .02em;
    box-shadow: inset 0 0 0 4px rgba(255,255,255,.4), 0 8px 20px -10px rgba(0,0,0,.45);
    margin-bottom: 14px; text-shadow: 0 1px 2px rgba(0,0,0,.22);
}
.avatar.sm { width: 78px; height: 78px; font-size: 1.35rem; margin-bottom: 10px; }

.name-btn {
    font-weight: 800; font-size: 1.28rem; letter-spacing: -.01em; color: var(--ink);
    display: inline-block; padding: 2px 4px; border-radius: 8px;
    text-decoration: underline; text-decoration-color: transparent;
    text-underline-offset: 4px; text-decoration-thickness: 2px;
    transition: text-decoration-color .15s ease, color .15s ease;
}
.name-btn:hover { text-decoration-color: var(--coral); color: var(--coral-deep); }
.name-btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; text-decoration-color: transparent; }
.deceased .name-btn { color: var(--ink-soft); }
.child .name-btn { font-size: 1.02rem; }

.facts { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.facts li { display: flex; align-items: center; gap: 8px; justify-content: center; color: var(--ink-soft); font-size: .9rem; font-weight: 600; }
.facts .ic { font-size: .95rem; width: 18px; text-align: center; }
.num { font-variant-numeric: tabular-nums; }

/* ---- Marriage ribbon ---- */
.ribbon-row { display: flex; justify-content: center; margin-top: 22px; }
.ribbon {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 9px 18px; border-radius: 999px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--sun) 26%, var(--card)), var(--card));
    border: 1px solid color-mix(in srgb, var(--sun) 50%, var(--line));
    box-shadow: var(--shadow-sm); font-weight: 700; font-size: .92rem;
}
.ribbon .heart { font-size: 1.05rem; }
.ribbon .yrs { color: var(--ink-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.ribbon .yrs::before { content: "·"; margin-right: 8px; color: var(--line); }

/* ---- Children ---- */
.divider { display: flex; align-items: center; gap: 16px; margin: 34px 4px 22px; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.divider span { font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.children { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.child {
    position: relative;
    background: linear-gradient(180deg, var(--card), var(--card-soft));
    border: 1px solid var(--line); border-radius: 20px;
    padding: 18px 18px 16px; width: 158px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.child:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--coral) 40%, var(--line)); }
.child.deceased { filter: grayscale(.5); }
.child .sub { color: var(--ink-soft); font-size: .82rem; font-weight: 600; margin-top: 5px; }
.child .youchip { position: absolute; top: 10px; right: 10px; }
.none-kids { text-align: center; color: var(--ink-soft); font-weight: 600; padding: 4px 0 8px; }

.hint { margin-top: 40px; text-align: center; color: var(--ink-soft); font-size: .86rem; font-weight: 600; }
.hint kbd { font: inherit; font-weight: 800; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: 1px 7px; }

.empty { text-align: center; padding: 80px 20px; color: var(--ink-soft); }
.empty-emoji { font-size: 3rem; margin: 0; }
.empty h2 { color: var(--ink); margin: .4rem 0; }

@media (max-width: 640px) {
    .couple { grid-template-columns: 1fr; gap: 30px; }
    .pcard.ghost { min-height: 120px; }
    .brand { margin-right: 0; width: 100%; }
    nav { width: 100%; }
    .pill { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ============================================================================
   Inline editing — pencils, live ＋ affordances, modal dialogs and forms.
   ========================================================================== */

/* Small round pencil that sits in the top-right of a card. */
.editbtn {
    position: absolute; top: 12px; right: 12px;
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center;
    border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
    font-size: .9rem; cursor: pointer; line-height: 1; padding: 0;
    box-shadow: var(--shadow-sm);
    transition: transform .14s ease, color .14s ease, border-color .14s ease;
}
.editbtn:hover { transform: translateY(-1px); color: var(--coral-deep); border-color: color-mix(in srgb, var(--coral) 45%, var(--line)); }
.editbtn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.child .editbtn { width: 26px; height: 26px; top: 8px; right: 8px; font-size: .78rem; }
/* An inline pencil sitting inside a text row (the marriage ribbon), not absolutely placed. */
.editbtn.inline { position: static; width: 24px; height: 24px; box-shadow: none; margin-left: 2px; }

/* Turn the dashed "Add parents" pill into a real button when editing. */
.up-pill.add.live { cursor: pointer; }
.up-pill.add.live:hover { border-color: color-mix(in srgb, var(--teal) 55%, var(--line)); color: var(--teal-deep); transform: translateY(-2px); }
.up-pill.add.live:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

/* The empty-partner ghost, as a clickable button. */
.pcard.ghost.live { cursor: pointer; font: inherit; text-align: center; }
.pcard.ghost.live:hover { border-color: color-mix(in srgb, var(--coral) 45%, var(--line)); }
.pcard.ghost.live:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

/* "Add child" dashed card, styled like a child card. */
.child.addchild {
    cursor: pointer; font: inherit; color: var(--ink-soft);
    justify-content: center; gap: 6px;
    background: repeating-linear-gradient(135deg, var(--ghost), var(--ghost) 10px, transparent 10px, transparent 20px);
    border: 2px dashed var(--line); box-shadow: none; font-weight: 700;
}
.child.addchild .plus { font-size: 1.5rem; }
.child.addchild:hover { border-color: color-mix(in srgb, var(--coral) 45%, var(--line)); color: var(--coral-deep); }
.child.addchild:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* "Add marriage date" pill, styled like the ribbon. */
.ribbon.add { cursor: pointer; font: inherit; font-weight: 700; color: var(--ink-soft); border-style: dashed; }
.ribbon.add:hover { color: var(--coral-deep); border-color: color-mix(in srgb, var(--coral) 50%, var(--line)); }
.ribbon.add:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(62, 51, 46, .45); backdrop-filter: blur(3px);
    display: grid; place-items: center; padding: 20px;
    animation: fade .18s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto;
    background: linear-gradient(180deg, var(--card), var(--card-soft));
    border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
    animation: rise .22s ease both;
}
.modal-head {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 20px 12px; border-bottom: 1px solid var(--line);
    position: sticky; top: 0;
    background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(6px);
}
.modal-head h2 { margin: 0; font-size: 1.12rem; font-weight: 800; letter-spacing: -.01em; margin-right: auto; }
.modal-x {
    border: none; background: none; color: var(--ink-soft); font-size: .95rem;
    cursor: pointer; width: 32px; height: 32px; border-radius: 8px; line-height: 1;
}
.modal-x:hover { background: var(--ground-2); color: var(--ink); }
.modal-body { padding: 18px 20px 20px; }

/* ---- Forms ---- */
.pform { display: grid; gap: 14px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 5px; }
.field > span { font-size: .78rem; font-weight: 800; letter-spacing: .02em; color: var(--ink-soft); }
.inp {
    font: inherit; color: var(--ink);
    padding: 9px 11px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--card);
    transition: border-color .14s ease, box-shadow .14s ease;
}
.inp:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent); }
textarea.inp { resize: vertical; }
.field.check .checkline { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); padding-top: 4px; }
.field.check input { width: 18px; height: 18px; accent-color: var(--coral); }

.addr { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; background: var(--card-soft); }
.addr legend { font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); padding: 0 6px; }
.addr legend .opt { text-transform: none; letter-spacing: 0; font-weight: 600; }

.factions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.factions .spacer { flex: 1; }
.btn {
    font: inherit; font-weight: 800; cursor: pointer;
    padding: 9px 18px; border-radius: 999px; border: 1px solid transparent;
    transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn.primary { color: #fff; background: linear-gradient(180deg, var(--coral), var(--coral-deep)); box-shadow: 0 10px 20px -12px var(--coral-deep); }
.btn.ghost { color: var(--ink); background: var(--card); border-color: var(--line); }
.btn.danger { color: var(--coral-deep); background: none; border-color: color-mix(in srgb, var(--coral) 45%, var(--line)); }
.btn.danger:not(:disabled):hover { background: color-mix(in srgb, var(--coral) 12%, var(--card)); }
.btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.fmsg { margin: 0; font-size: .86rem; font-weight: 700; }
.fmsg.err { color: var(--coral-deep); }

@media (max-width: 520px) {
    .fgrid { grid-template-columns: 1fr; }
}

/* ============================================================================
   Gender tint — a soft background wash on cards. Kept to the background only so it
   never fights the coral "home" ring or the hover border colour.
   ========================================================================== */
:root {
    --g-female: #E17BA3;
    --g-male:   #5E93C4;
}
.pcard.g-female, .child.g-female { background: linear-gradient(180deg, color-mix(in srgb, var(--g-female) 26%, var(--card)), color-mix(in srgb, var(--g-female) 15%, var(--card-soft))); }
.pcard.g-male,   .child.g-male   { background: linear-gradient(180deg, color-mix(in srgb, var(--g-male) 26%, var(--card)), color-mix(in srgb, var(--g-male) 15%, var(--card-soft))); }

/* ============================================================================
   Search — type-ahead name box in the banner with a floating results list.
   ========================================================================== */
.search { position: relative; width: min(260px, 42vw); }
.search-ic {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    font-size: .9rem; pointer-events: none; opacity: .7;
}
.search-inp {
    width: 100%; font: inherit; font-weight: 600; color: var(--ink);
    padding: 9px 12px 9px 34px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--card);
    transition: border-color .14s ease, box-shadow .14s ease;
}
.search-inp::placeholder { color: var(--ink-soft); font-weight: 600; }
.search-inp:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 20%, transparent); }
.search-inp::-webkit-search-cancel-button { cursor: pointer; }

.hits {
    position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0;
    margin: 0; padding: 6px; list-style: none;
    background: var(--card); border: 1px solid var(--line); border-radius: 16px;
    box-shadow: var(--shadow); max-height: 60vh; overflow: auto;
}
.hits li { list-style: none; }
.hit {
    width: 100%; display: flex; align-items: center; gap: 11px; text-align: left;
    padding: 7px 9px; border: none; background: none; border-radius: 11px;
    font: inherit; color: var(--ink); cursor: pointer;
}
.hit:hover, .hit.active { background: var(--ground-2); }
.hit.empty { color: var(--ink-soft); font-weight: 600; cursor: default; padding: 10px; }
.hit-av .avatar.sm { width: 36px; height: 36px; font-size: .85rem; margin: 0; box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); }
.hit-main { display: grid; gap: 1px; min-width: 0; }
.hit-name { font-weight: 800; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-sub { color: var(--ink-soft); font-size: .8rem; font-weight: 600; }

@media (max-width: 640px) {
    .search { width: 100%; order: 3; }
}

/* ============================================================================
   Reports — the printable birthday / anniversary / contact lists.
   ========================================================================== */
.report { padding-top: 8px; }
.rpt-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
    padding: 28px 0 18px; margin-bottom: 10px; border-bottom: 2px solid var(--line); flex-wrap: wrap;
}
.rpt-kicker { margin: 0 0 2px; font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--coral-deep); }
.rpt-title { margin: 0; font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.rpt-title .rpt-ic { font-size: 1.5rem; }
.rpt-sub { margin: 6px 0 0; color: var(--ink-soft); font-weight: 600; font-size: .9rem; }

.rpt-loading, .rpt-empty { text-align: center; color: var(--ink-soft); font-weight: 600; padding: 48px 20px; }

/* ---- Text documents (birthdays, anniversaries, contacts, calendar list) ----
   Compact typographic lists that read like a traditional printed sheet. Rows use
   display:contents so their cells line up in the parent grid's columns. */
.doc { margin-top: 12px; }
.doc-list { display: grid; column-gap: 18px; max-width: 680px; }
.doc-list.c3 { grid-template-columns: max-content 1fr max-content; }
.doc-list.c2 { grid-template-columns: max-content 1fr; }
.doc-row { display: contents; }
.doc-row > span { padding: 7px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.doc-row:last-child > span { border-bottom: none; }
.doc-list .k { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); }
.doc-list .v { font-weight: 600; color: var(--ink); }
.doc-list .t { font-weight: 600; color: var(--ink-soft); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-list a { color: inherit; text-decoration: none; font-weight: 700; }
.doc-list a:hover { color: var(--coral-deep); text-decoration: underline; text-underline-offset: 3px; }
.doc-list .v a[href^="mailto"], .doc-list .v a[href^="tel"] { color: var(--teal-deep); font-weight: 600; }
.doc-list .mut { color: var(--ink-soft); font-weight: 600; }
.doc-list .sep { color: var(--line); margin: 0 7px; }
.doc-row.today .k, .doc-row.today .t { color: var(--coral-deep); font-weight: 800; }
.doc-month { margin: 24px 0 2px; font-size: 1.05rem; font-weight: 800; letter-spacing: .02em; color: var(--coral-deep); }
.doc-month:first-of-type { margin-top: 6px; }

/* Grid / List view toggle on the calendar pages */
.viewtoggle { display: inline-flex; gap: 2px; margin: 2px 0 14px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.viewtoggle a { padding: 5px 16px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: .85rem; color: var(--ink-soft); }
.viewtoggle a.on { background: var(--coral); color: #fff; }
.viewtoggle a:not(.on):hover { color: var(--coral-deep); }

/* ---- Print ---- */
@media print {
    .banner, .noprint, .hint, #blazor-error-ui { display: none !important; }
    body { background: #fff; }
    .wrap { max-width: none; padding: 0; }
    .rpt-head { padding-top: 0; }
    .doc-list { max-width: none; }
    .doc-row > span { break-inside: avoid; }
    a { color: inherit !important; text-decoration: none !important; }
}

/* ============================================================================
   Calendar report — 12 month grids, one per printed page.
   ========================================================================== */
.cal-legend { display: flex; gap: 18px; justify-content: flex-end; margin: 4px 0 12px; color: var(--ink-soft); font-weight: 700; font-size: .85rem; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }

.cal-months { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 900px) { .cal-months { grid-template-columns: 1fr 1fr; } }

.cal-month {
    background: linear-gradient(180deg, var(--card), var(--card-soft));
    border: 1px solid var(--line); border-radius: 18px; padding: 14px 14px 16px;
    box-shadow: var(--shadow-sm); break-inside: avoid;
}
.cal-mhead h2 { margin: 0 0 10px; font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 8px; }
.cal-mhead h2 span { color: var(--ink-soft); font-weight: 700; font-size: .95rem; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: .64rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); padding-bottom: 2px; }
.cal-cell {
    min-height: 62px; border: 1px solid var(--line); border-radius: 8px;
    padding: 3px 4px; background: var(--card);
    display: flex; flex-direction: column; gap: 2px; overflow: hidden;
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-dnum { font-size: .72rem; font-weight: 800; color: var(--ink-soft); align-self: flex-end; line-height: 1; }

.cal-ev {
    display: flex; align-items: center; gap: 3px; text-decoration: none;
    border-radius: 6px; padding: 1px 4px; font-size: .68rem; font-weight: 700; line-height: 1.15;
}
.cal-ev.bday { background: color-mix(in srgb, var(--sun) 26%, var(--card)); color: var(--ink); }
.cal-ev.anni { background: color-mix(in srgb, var(--coral) 20%, var(--card)); color: var(--ink); }
.cal-ev:hover { filter: brightness(.96); }
.cal-eic { font-size: .7rem; flex: none; }
.cal-enm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-eage { margin-left: auto; padding-left: 3px; color: var(--ink-soft); font-variant-numeric: tabular-nums; flex: none; }

@media print {
    .cal-legend { display: none !important; }
    .cal-months { grid-template-columns: 1fr; gap: 0; }
    .cal-month { break-after: page; page-break-after: always; box-shadow: none; border: none; border-radius: 0; padding: 0; }
    .cal-month:last-child { break-after: auto; page-break-after: auto; }
    .cal-cell { min-height: 92px; }
    .cal-grid { gap: 2px; }
    .cal-ev { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================================
   Map — Leaflet map of where the family lives.
   ========================================================================== */
.mapwrap { position: relative; }
.fammap {
    height: min(70vh, 620px); min-height: 380px; width: 100%;
    border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
    box-shadow: var(--shadow-sm); background: var(--ground-2);
    /* Contain Leaflet's internal z-indexes so tiles/controls stay below the sticky banner. */
    isolation: isolate;
}
.map-count { text-align: center; color: var(--ink-soft); font-weight: 600; font-size: .88rem; margin-top: 12px; }

.map-empty {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; text-align: center;
    color: var(--ink-soft); font-weight: 600; padding: 20px; pointer-events: none;
}
.map-empty p { margin: 2px 0; }
.map-empty-emoji { font-size: 2.6rem; }
.map-empty-sub { font-size: .85rem; }

/* Admin geocode bar on the map */
.geo-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-soft); font-weight: 600; font-size: .9rem; }
.geo-bar.ok { background: color-mix(in srgb, var(--teal) 12%, var(--card)); border-color: color-mix(in srgb, var(--teal) 35%, var(--line)); }
.geo-bar .btn.sm { margin-left: auto; }

/* divIcon pin — just the emoji, no default white box (className replaces leaflet-div-icon). */
.fam-pin { font-size: 26px; line-height: 30px; text-align: center; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }

/* Popup contents */
.pin-pop { font-family: var(--ff-font); }
.pin-pop a { color: var(--coral-deep); font-weight: 800; text-decoration: none; }
.pin-pop a:hover { text-decoration: underline; }
.pin-pop .pin-addr { color: var(--ink-soft); font-weight: 600; font-size: .85rem; margin-top: 2px; }

/* ============================================================================
   Authentication — sign-in / invitation pages, header user menu, admin invites.
   ========================================================================== */
.authpage { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.authcard {
    width: 100%; max-width: 420px;
    background: linear-gradient(180deg, var(--card), var(--card-soft));
    border: 1px solid var(--line); border-radius: 24px;
    padding: 30px 30px 26px; box-shadow: var(--shadow);
}
.auth-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; margin-bottom: 18px; }
.auth-brand .mark { font-size: 1.6rem; }
.auth-brand b { font-size: 1.05rem; font-weight: 800; display: block; }
.auth-brand small { color: var(--ink-soft); font-size: .74rem; font-weight: 600; }
.auth-title { margin: 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.auth-sub { margin: 4px 0 18px; color: var(--ink-soft); font-weight: 600; font-size: .92rem; }
.authform { display: grid; gap: 14px; }
.authform .checkline { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); font-size: .9rem; }
.authform .checkline input { width: 18px; height: 18px; accent-color: var(--coral); }
.btn.block { width: 100%; justify-content: center; text-align: center; padding: 11px 18px; }
.auth-links { margin-top: 16px; font-size: .88rem; font-weight: 600; }
.auth-links a { color: var(--teal-deep); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
/* Server-side validation summary renders a <ul>; tidy it up, and hide it when valid. */
.fmsg.err ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }
.fmsg.ok { color: var(--teal-deep); font-weight: 700; }

/* Account / profile page */
.field-help { color: var(--ink-soft); font-size: .78rem; font-weight: 600; }
.prof-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.prof-section:first-of-type { margin-top: 10px; padding-top: 0; border-top: none; }
.prof-h { font-size: 1.02rem; font-weight: 800; margin: 0 0 12px; }

/* Header user menu */
.usermenu { display: flex; align-items: center; gap: 10px; }
.uname { font-weight: 700; font-size: .86rem; color: var(--ink-soft); text-decoration: none; }
.uname:hover { color: var(--coral-deep); text-decoration: underline; }
.pill.admin { border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); color: var(--teal-deep); }
.logoutform { margin: 0; }
.linkbtn { border: none; background: none; cursor: pointer; font: inherit; font-weight: 700; font-size: .86rem; color: var(--coral-deep); padding: 4px; }
.linkbtn:hover { text-decoration: underline; }

/* Admin invitations page */
.mut { color: var(--ink-soft); font-weight: 600; }
.invite-cols { display: grid; grid-template-columns: 1fr; gap: 28px; margin-top: 6px; }
@media (min-width: 820px) { .invite-cols { grid-template-columns: 1fr 1fr; gap: 40px; } }
.invite-h { font-size: 1.05rem; font-weight: 800; margin: 0 0 12px; }
.invite-sent { margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--teal) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--teal) 35%, var(--line)); }
.invite-sent p { margin: 0 0 8px; font-weight: 600; font-size: .9rem; }
.invite-sent.warn { background: color-mix(in srgb, var(--sun) 16%, var(--card)); border-color: color-mix(in srgb, var(--sun) 50%, var(--line)); }
.invite-link { display: block; word-break: break-all; font-size: .8rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.btn.sm { padding: 4px 12px; font-size: .78rem; }

/* ============================================================================
   Marriage switcher (multiple unions) + partner picker dialog.
   ========================================================================== */
.unions-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0 2px; }
.union-pill {
    display: inline-flex; align-items: baseline; gap: 6px; text-decoration: none;
    padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: .84rem;
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    transition: transform .14s ease, border-color .14s ease;
}
.union-pill:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--coral) 40%, var(--line)); }
.union-pill.on { background: var(--coral); color: #fff; border-color: transparent; }
.union-pill .union-sub { font-weight: 600; font-size: .74rem; opacity: .72; font-variant-numeric: tabular-nums; }
.union-pill.on .union-sub { opacity: .85; }
.union-pill.add { cursor: pointer; font: inherit; font-weight: 700; font-size: .84rem; color: var(--ink-soft); border-style: dashed; }
.union-pill.add:hover { color: var(--coral-deep); border-color: color-mix(in srgb, var(--coral) 45%, var(--line)); }

/* The mode toggle reuses .viewtoggle, whose links act as buttons here. */
.viewtoggle a { cursor: pointer; }
.pick-chosen { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-soft); font-size: .95rem; }
.pick-results { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.pick-results li { list-style: none; }
.pick-hit { width: 100%; display: flex; align-items: center; gap: 11px; text-align: left; padding: 7px 9px; border: none; background: none; border-radius: 10px; font: inherit; color: var(--ink); cursor: pointer; }
.pick-hit:hover { background: var(--ground-2); }
.pick-hit .avatar.sm { width: 38px; height: 38px; font-size: .85rem; margin: 0; }
.pick-main { display: grid; gap: 1px; min-width: 0; }
.pick-name { font-weight: 800; letter-spacing: -.01em; }
.pick-sub { color: var(--ink-soft); font-size: .8rem; font-weight: 600; }

/* ============================================================================
   Members admin — account list with per-user actions.
   ========================================================================== */
.members { display: grid; gap: 10px; margin-top: 6px; }
.member {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: linear-gradient(180deg, var(--card), var(--card-soft));
    border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-sm);
}
.member.disabled { opacity: .62; }
.member-main { display: grid; gap: 2px; margin-right: auto; min-width: 200px; }
.member-name { font-weight: 800; font-size: 1.02rem; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.member-sub { color: var(--ink-soft); font-weight: 600; font-size: .86rem; }
.member-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.confirm-q { font-weight: 700; color: var(--coral-deep); font-size: .88rem; }
.member-actions .mut a { color: var(--teal-deep); text-decoration: none; }
.member-actions .mut a:hover { text-decoration: underline; }
.members-hint { margin-top: 14px; color: var(--ink-soft); font-size: .84rem; font-weight: 600; }
.tag.adm { background: var(--teal); }
.tag.off { background: var(--ink-soft); }

/* ============================================================================
   Contacts — household blocks (couple + minor kids folded in).
   ========================================================================== */
.households { margin-top: 12px; max-width: 640px; }
.hh { margin-bottom: 20px; break-inside: avoid; }
.hh:last-child { margin-bottom: 0; }
.hh-head { font-size: 1.05rem; line-height: 1.3; }
.hh-name { font-weight: 800; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.hh-name:hover { color: var(--coral-deep); text-decoration: underline; text-underline-offset: 3px; }
.hh-kids { color: var(--ink-soft); font-weight: 600; }
.hh-lines { display: grid; gap: 3px; margin-top: 5px; }
.hh-line { display: flex; align-items: baseline; gap: 8px; color: var(--ink-soft); font-weight: 600; font-size: .9rem; }
.hh-line .ic { width: 18px; flex: none; text-align: center; }
.hh-line a { color: var(--teal-deep); text-decoration: none; }
.hh-line a:hover { text-decoration: underline; }
.hh-line .who { color: var(--ink); font-weight: 700; margin-right: 2px; }
.hh-line .sep { color: var(--line); }
.hh-line .vals { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.hh-line.addr2 .cols { display: flex; flex-wrap: wrap; gap: 2px 24px; }

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}