@import url('https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&display=swap');

:root {
    --red: #8c1d18;
    --red-dark: #5f1613;
    --gold: #b8862f;
    --ink: #2f251d;
    --muted: #75695e;
    --line: #e5d9c8;
    --paper: #fffdf8;
    --wash: #f6efe3;
    --green: #2f6f5e;
    --danger: #b8332c;
    --shadow: 0 14px 34px rgba(68, 40, 18, .11);
    --family-tree-font: "Noto Serif", "Times New Roman", Cambria, serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

label input,
label select,
label textarea {
    font-weight: 400;
}

/* Vinh danh: public directory, embedded genealogy context and admin workflow. */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.honor-category-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 5px 10px;
    border: 1px solid #e7c982;
    border-radius: 999px;
    background: #fff8df;
    color: #7f281f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .035em;
    line-height: 1.2;
    text-transform: uppercase;
}

.honor-page-hero {
    position: relative;
    overflow: hidden;
    padding: 54px 0;
    color: #fff8e8;
    background:
        radial-gradient(circle at 84% 20%, rgba(247, 208, 138, .24), transparent 24%),
        linear-gradient(130deg, #6f1413 0%, var(--red) 52%, #431411 100%);
}

.honor-page-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .12;
    pointer-events: none;
    background-image: radial-gradient(circle, #f7d08a 1px, transparent 1px);
    background-size: 26px 26px;
}

.honor-page-hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 26px;
}

.honor-page-hero .eyebrow {
    color: #f7d08a;
}

.honor-page-hero h1 {
    margin: 5px 0 10px;
    color: #fff;
    font-size: clamp(36px, 5vw, 58px);
}

.honor-page-hero p:last-child {
    max-width: 760px;
    margin: 0;
    color: rgba(255, 255, 255, .8);
    line-height: 1.75;
}

.honor-hero-emblem {
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(247, 208, 138, .5);
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    box-shadow: inset 0 0 0 8px rgba(247, 208, 138, .06);
}

.honor-hero-emblem svg {
    width: 56px;
    fill: none;
    stroke: #f7d08a;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.honor-hero-count {
    min-width: 150px;
    padding: 18px 20px;
    border: 1px solid rgba(247, 208, 138, .34);
    border-radius: 14px;
    background: rgba(255, 255, 255, .08);
    text-align: center;
}

.honor-hero-count strong,
.honor-hero-count span {
    display: block;
}

.honor-hero-count strong {
    color: #f7d08a;
    font: 800 34px/1 var(--font-heading, inherit);
}

.honor-hero-count span {
    margin-top: 6px;
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
}

.honor-directory-section {
    background: #fbf8f1;
}

.honor-public-filters {
    display: grid;
    grid-template-columns: minmax(280px, 1.4fr) minmax(180px, .7fr) minmax(160px, .55fr) auto auto;
    align-items: center;
    gap: 10px;
    margin-top: -82px;
    margin-bottom: 42px;
    padding: 16px;
    position: relative;
    z-index: 3;
    border: 1px solid #eadcc4;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 38px rgba(91, 40, 25, .12);
}

.honor-public-filters input,
.honor-public-filters select {
    width: 100%;
    min-height: 46px;
    border-color: #dfd5c5;
    background: #fffdf9;
}

.honor-public-search {
    position: relative;
}

.honor-public-search svg {
    position: absolute;
    z-index: 1;
    left: 14px;
    top: 50%;
    width: 18px;
    fill: none;
    stroke: #8c7666;
    stroke-width: 2;
    transform: translateY(-50%);
}

.honor-public-search input {
    padding-left: 42px;
}

.honor-clear-filter {
    color: var(--red);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.honor-result-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.honor-result-heading h2,
.honor-result-heading p {
    margin: 0;
}

.honor-result-heading h2 {
    margin-top: 4px;
    font-size: 28px;
}

.honor-result-heading > p {
    color: var(--muted);
}

.honor-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.honor-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #eadbc3;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(80, 43, 26, .08);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.honor-card:hover {
    transform: translateY(-4px);
    border-color: #d9ba79;
    box-shadow: 0 18px 38px rgba(80, 43, 26, .14);
}

.honor-card-media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eee5d5;
}

.honor-card-media::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 35%;
    background: linear-gradient(transparent, rgba(54, 18, 12, .3));
}

.honor-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.honor-card:hover .honor-card-media img {
    transform: scale(1.035);
}

.honor-card-medal {
    position: absolute;
    z-index: 2;
    right: 14px;
    bottom: 14px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 2px solid #fff5d7;
    border-radius: 50%;
    background: #c58b27;
    color: #fff9e8;
    box-shadow: 0 5px 14px rgba(84, 45, 9, .3);
}

.honor-card-body {
    padding: 20px;
}

.honor-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #856f5e;
    font-size: 12px;
}

.honor-card-body h2 {
    margin: 15px 0 3px;
    color: var(--red-dark);
    font-size: 25px;
}

.honor-card-body h2 a {
    color: inherit;
}

.honor-card-body h3 {
    min-height: 48px;
    margin: 0;
    color: #2d211a;
    font-size: 17px;
    line-height: 1.42;
}

.honor-card-body p {
    display: -webkit-box;
    min-height: 68px;
    margin: 12px 0 15px;
    overflow: hidden;
    color: #66594f;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.honor-card-link {
    color: var(--red);
    font-size: 13px;
    font-weight: 800;
}

.honor-card-link span {
    display: inline-block;
    margin-left: 3px;
    transition: transform .2s ease;
}

.honor-card-link:hover span {
    transform: translateX(3px);
}

.honor-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 30px;
}

.honor-pagination a,
.honor-pagination span {
    padding: 9px 14px;
    border: 1px solid #e3d5c0;
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
}

.honor-pagination a {
    color: var(--red);
}

.honor-empty-state {
    padding: 64px 24px;
    border: 1px dashed #d9c6a8;
    border-radius: 16px;
    background: #fff;
    text-align: center;
}

.honor-empty-state > span {
    color: #c18b2c;
    font-size: 40px;
}

.honor-empty-state h2 {
    margin: 12px 0 6px;
}

.honor-empty-state p {
    margin: 0 0 20px;
    color: var(--muted);
}

/* Homepage highlight */
.home-honors-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #fffdf8 0%, #f8efe1 100%);
    border-block: 1px solid #ead8b9;
}

.home-honors-section::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    right: -190px;
    top: -210px;
    border: 80px solid rgba(174, 114, 28, .055);
    border-radius: 50%;
}

.home-honors-heading {
    position: relative;
    z-index: 1;
}

.home-honors-heading > div {
    flex: 1;
    min-width: 0;
}

.home-honors-heading > div > p:last-child {
    max-width: none;
    margin: 7px 0 0;
    color: var(--muted);
}

.home-honors-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 22px;
}

.home-honors-layout.is-single {
    grid-template-columns: minmax(0, 880px);
    justify-content: center;
}

.home-honor-featured {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(190px, .82fr) minmax(0, 1.18fr);
    overflow: hidden;
    border: 1px solid #dec28c;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 16px 34px rgba(89, 43, 22, .1);
}

.home-honor-featured-media {
    position: relative;
    min-height: 370px;
    overflow: hidden;
    background: #eee4d2;
}

.home-honor-featured-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 62%, rgba(62, 17, 12, .38));
}

.home-honor-featured-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-honor-ribbon {
    position: absolute;
    z-index: 2;
    left: 16px;
    bottom: 16px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 245, 215, .7);
    border-radius: 999px;
    background: rgba(111, 20, 19, .88);
    color: #fff7db;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.home-honor-featured-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 26px;
}

.home-honor-name {
    margin: 17px 0 4px !important;
    color: #a36a13 !important;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.home-honor-featured h3 {
    margin: 0;
    color: var(--red-dark);
    font-size: clamp(25px, 2.1vw, 34px);
    line-height: 1.15;
}

.home-honor-featured h4 {
    margin: 8px 0 0;
    color: #2f211b;
    font-size: 17px;
    line-height: 1.45;
}

.home-honor-featured-body > p:not(.home-honor-name) {
    display: -webkit-box;
    margin: 15px 0;
    overflow: hidden;
    color: #66564b;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.home-honor-featured-body > .btn {
    margin-top: auto;
}

.home-honor-relation {
    display: block;
    margin-bottom: 18px;
    color: #8a5b21;
    font-size: 12px;
    font-weight: 700;
}


/* Detail and embedded genealogy nodes */
.honor-detail-hero {
    padding: 20px 0 56px;
    background: linear-gradient(180deg, #fffaf0 0%, #f7eddb 100%);
    border-bottom: 1px solid #e8d5b5;
}

.honor-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: #857363;
    font-size: 12px;
}

.honor-breadcrumb a {
    color: var(--red);
    font-weight: 700;
}

.honor-detail-hero-grid {
    display: grid;
    grid-template-columns: minmax(300px, .85fr) minmax(0, 1.15fr);
    align-items: center;
    gap: clamp(30px, 5vw, 70px);
}

.honor-detail-cover {
    position: relative;
    overflow: visible;
}

.honor-detail-cover > img {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: block;
    border: 8px solid #fff;
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 22px 48px rgba(80, 37, 22, .18);
}

.honor-detail-seal {
    position: absolute;
    right: -18px;
    bottom: -18px;
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    border: 5px solid #fff3cf;
    border-radius: 50%;
    background: #a86f19;
    box-shadow: 0 8px 22px rgba(89, 47, 11, .24);
}

.honor-detail-seal svg {
    width: 43px;
    fill: none;
    stroke: #fff8df;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.honor-detail-kicker {
    margin: 24px 0 4px;
    color: #a66e18;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.honor-detail-heading h1 {
    margin: 0;
    color: var(--red-dark);
    font-size: clamp(38px, 5vw, 62px);
    line-height: 1.06;
}

.honor-detail-heading h2 {
    margin: 14px 0 0;
    color: #33241d;
    font-size: clamp(20px, 2.4vw, 29px);
    line-height: 1.38;
}

.honor-detail-summary {
    margin: 17px 0;
    color: #67584d;
    font-size: 16px;
    line-height: 1.7;
}

.honor-detail-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 20px 0 0;
}

.honor-detail-facts div {
    padding: 12px 14px;
    border-left: 3px solid #c99330;
    border-radius: 0 8px 8px 0;
    background: rgba(255, 255, 255, .65);
}

.honor-detail-facts dt {
    color: #8a7767;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.honor-detail-facts dd {
    margin: 4px 0 0;
    color: #38261f;
    font-size: 13px;
    font-weight: 700;
}

.honor-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, .55fr);
    align-items: start;
    gap: 32px;
    padding-top: 54px;
    padding-bottom: 64px;
}

.honor-story {
    min-width: 0;
    padding: 30px;
    border: 1px solid #e5d9c6;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(67, 42, 27, .07);
}

.honor-story h2 {
    margin: 5px 0 20px;
    font-size: 30px;
}

.honor-story > p:last-child {
    color: #5f5147;
    line-height: 1.75;
}

.honor-genealogy-panel {
    position: sticky;
    top: 96px;
    padding: 22px;
    border: 1px solid #dfc99d;
    border-radius: 16px;
    background: linear-gradient(145deg, #fffdf8, #f8efe0);
    box-shadow: 0 14px 32px rgba(75, 38, 21, .09);
}

.honor-genealogy-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.honor-genealogy-heading h2,
.honor-genealogy-heading p {
    margin: 0;
}

.honor-genealogy-heading h2 {
    margin-top: 2px;
    font-size: 22px;
}

.honor-genealogy-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #f1dfb9;
    color: var(--red);
}

.honor-genealogy-icon svg {
    width: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.honor-node-embed {
    display: grid;
    gap: 10px;
}

.honor-tree-node {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid #d9dfe7;
    border-left: 4px solid #7d95ae;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(52, 63, 79, .07);
}

.honor-tree-node.is-honoree {
    border-color: #d8b563;
    border-left-color: #bd7e1a;
    background: #fffdf5;
}

.honor-tree-node.is-outside-tree {
    border-style: dashed;
    border-left-style: solid;
}

.honor-tree-avatar {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #f1dfb9;
    color: var(--red);
    box-shadow: 0 0 0 1px #dbc693;
    font-size: 13px;
    font-weight: 900;
}

.honor-tree-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.honor-tree-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.honor-tree-copy small {
    color: #9b6e24;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.honor-tree-copy strong {
    overflow: hidden;
    color: #2d2520;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.honor-tree-copy > span {
    color: #7c6f64;
    font-size: 11px;
}

.honor-relationship-connector {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    color: #8e5b1d;
    font-size: 11px;
}

.honor-relationship-connector span {
    border-top: 1px dashed #b98b43;
}

.honor-relationship-connector strong {
    padding: 4px 8px;
    border: 1px solid #e1c486;
    border-radius: 999px;
    background: #fff7df;
}

.honor-node-link {
    justify-self: end;
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
}

.honor-genealogy-note {
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid #e3d5bd;
    color: #75665b;
    font-size: 11px;
    line-height: 1.55;
}

.honor-related-section {
    background: #f8f3ea;
    border-top: 1px solid #e9ddca;
}

.honor-card-grid.is-related {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Admin */
.honor-admin-head .admin-overview-intro {
    max-width: 760px;
}

.honor-admin-form {
    display: grid;
    gap: 18px;
}

.honor-form-section {
    overflow: visible;
}

.honor-form-section .admin-panel-head {
    align-items: center;
}

.honor-form-step {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 26px;
    margin-bottom: 7px;
    border-radius: 999px;
    background: #f4e4c5;
    color: #8b5316;
    font-size: 11px;
    font-weight: 900;
}

.honor-form-body {
    display: grid;
    gap: 20px;
    padding: 22px;
}

.honor-recipient-modes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.honor-mode-card,
.honor-check-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 15px;
    border: 1px solid #ded6ca;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.honor-mode-card:has(input:checked),
.honor-check-card:has(input:checked) {
    border-color: #c1872a;
    background: #fff9e9;
    box-shadow: 0 0 0 3px rgba(193, 135, 42, .1);
}

.honor-mode-card input,
.honor-check-card input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 2px 0 0;
    accent-color: var(--red);
}

.honor-mode-card span,
.honor-check-card span {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.honor-mode-card strong,
.honor-check-card strong {
    color: #2e2722;
    font-size: 14px;
}

.honor-mode-card small,
.honor-check-card small,
.field-hint {
    color: #7b7067;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.5;
}

[data-honor-mode-panel][hidden] {
    display: none !important;
}

.honor-relative-fields {
    display: grid;
    gap: 20px;
    padding-top: 4px;
}

.honor-member-picker {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid #e0d8cc;
    border-radius: 12px;
    background: #faf9f7;
}

.honor-member-picker-label {
    color: #342b25;
    font-size: 13px;
    font-weight: 800;
}

.honor-member-picker .field-hint {
    margin: -4px 0 2px;
}

.honor-member-search {
    background: #fff !important;
}

.honor-member-picker select {
    min-height: 178px;
    padding: 5px;
    background: #fff;
}

.honor-member-picker select option {
    padding: 8px 10px;
    border-radius: 6px;
}

.honor-member-preview {
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border: 1px solid #e4d1a7;
    border-radius: 10px;
    background: #fffaf0;
}

.honor-member-preview > img,
.honor-member-preview-initial {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: #f0ddb7;
    color: var(--red);
    object-fit: cover;
    font-weight: 900;
}

.honor-member-preview > span:last-child {
    display: grid;
    gap: 3px;
}

.honor-member-preview strong {
    color: #31271f;
    font-size: 14px;
}

.honor-member-preview small,
.honor-member-preview > span:only-child {
    color: #7a6a5d;
    font-size: 11px;
}

.honor-achievement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.honor-essential-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(240px, .5fr);
}

.honor-optional-details {
    overflow: hidden;
    border: 1px solid #e0d8cc;
    border-radius: 12px;
    background: #faf9f7;
}

.honor-optional-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    color: #3b3129;
    cursor: pointer;
    list-style: none;
}

.honor-optional-details > summary::-webkit-details-marker {
    display: none;
}

.honor-optional-details > summary::after {
    content: '+';
    flex: 0 0 auto;
    color: var(--red);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.honor-optional-details[open] > summary::after {
    content: '−';
}

.honor-optional-details > summary > span:first-child {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.honor-optional-details > summary strong {
    font-size: 13px;
}

.honor-optional-details > summary small {
    color: #7b7067;
    font-size: 11px;
    font-weight: 400;
}

.honor-optional-badge {
    margin-left: auto;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f2e8d7;
    color: #765126;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.honor-optional-content {
    padding: 16px;
    border-top: 1px solid #e5ddd1;
    background: #fff;
}

.honor-publish-extras {
    display: grid;
    gap: 14px;
}

.honor-summary-field {
    position: relative;
}

.honor-summary-field > small {
    position: absolute;
    right: 10px;
    bottom: 8px;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .9);
    color: #85786e;
    font-size: 10px;
}

.honor-publish-layout {
    grid-template-columns: minmax(260px, .75fr) minmax(0, 1.25fr);
    align-items: start;
}

.honor-cover-field,
.honor-publish-controls {
    min-width: 0;
    display: grid;
    gap: 14px;
}

.honor-cover-preview {
    min-height: 240px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px dashed #cdbb9f;
    border-radius: 12px;
    background: #f6f1e8;
    color: #85766a;
    font-size: 12px;
}

.honor-cover-preview img {
    width: 100%;
    height: 100%;
    min-height: 240px;
    max-height: 360px;
    object-fit: cover;
}

.honor-check-card.is-consent {
    border-color: #d6c5a7;
}

.honor-form-actions {
    position: sticky;
    z-index: 8;
    bottom: 12px;
    justify-content: flex-end;
    padding: 12px;
    border: 1px solid #e1d5c5;
    border-radius: 12px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 10px 30px rgba(50, 39, 31, .12);
    backdrop-filter: blur(10px);
}

.honor-admin-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(160px, .55fr) minmax(180px, .65fr) auto auto;
    align-items: center;
    gap: 9px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: #faf9f7;
}

.honor-admin-filters input,
.honor-admin-filters select {
    width: 100%;
    min-height: 42px;
}

.honor-admin-recipient {
    min-width: 210px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.honor-admin-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: #f2e1bf;
    color: var(--red);
    font-size: 11px;
    font-weight: 900;
}

.honor-admin-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.honor-admin-recipient > span:last-child {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.honor-admin-recipient small,
.honor-list-visibility {
    display: block;
    color: #81766c;
    font-size: 10px;
}

.honor-featured-mini {
    display: inline-flex;
    margin-left: 7px;
    padding: 3px 6px;
    border-radius: 999px;
    background: #fff1bd;
    color: #8a5b0d;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

@media (min-width: 961px) and (max-width: 1180px) {
    .site-header .brand-logo {
        width: 112px;
    }

    .site-header .header-inner {
        gap: 8px;
    }

    .site-header .main-nav > a {
        padding-inline: 8px;
        font-size: 13px;
    }

    .site-header .site-account-copy {
        display: none;
    }
}

@media (min-width: 961px) and (max-width: 1500px) {
    body.admin-body .admin-topbar .admin-header-brand {
        min-width: 140px;
    }

    body.admin-body .admin-topbar .admin-brand-logo {
        width: 126px;
    }

    body.admin-body .admin-topbar .admin-topnav a {
        padding-inline: 9px;
        font-size: 14px;
    }

    body.admin-body .admin-topbar .admin-upload-health {
        display: none;
    }
}

@media (max-width: 980px) {
    .honor-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .honor-public-filters {
        grid-template-columns: minmax(0, 1fr) repeat(2, minmax(150px, .55fr)) auto;
    }

    .honor-public-filters .honor-clear-filter {
        grid-column: 1 / -1;
    }

    .home-honors-layout {
        grid-template-columns: 1fr;
    }

    .honor-detail-layout {
        grid-template-columns: 1fr;
    }

    .honor-genealogy-panel {
        position: static;
    }

    .honor-publish-layout {
        grid-template-columns: 1fr;
    }

    .honor-admin-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .honor-page-hero {
        padding: 34px 0 50px;
    }

    .honor-page-hero-inner {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 16px;
    }

    .honor-hero-emblem {
        width: 64px;
        height: 64px;
    }

    .honor-hero-emblem svg {
        width: 38px;
    }

    .honor-hero-count {
        grid-column: 1 / -1;
        display: flex;
        align-items: baseline;
        justify-content: center;
        gap: 8px;
        padding: 12px;
    }

    .honor-hero-count span {
        margin: 0;
    }

    .honor-public-filters {
        grid-template-columns: 1fr;
        margin-top: -76px;
        margin-bottom: 30px;
    }

    .honor-public-filters .honor-clear-filter {
        grid-column: auto;
        justify-self: center;
    }

    .honor-result-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .honor-card-grid,
    .honor-card-grid.is-related {
        grid-template-columns: 1fr;
    }

    .honor-card-body h3,
    .honor-card-body p {
        min-height: 0;
    }

    .home-honors-heading {
        align-items: start;
    }

    .home-honor-featured {
        grid-template-columns: 1fr;
    }

    .home-honor-featured-media {
        min-height: 280px;
        aspect-ratio: 4 / 3;
    }

    .home-honor-featured-body {
        padding: 22px;
    }

    .honor-detail-hero {
        padding-bottom: 36px;
    }

    .honor-detail-hero-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .honor-detail-cover > img {
        border-width: 5px;
    }

    .honor-detail-seal {
        right: 8px;
    }

    .honor-detail-heading h1 {
        font-size: 40px;
    }

    .honor-detail-facts {
        grid-template-columns: 1fr;
    }

    .honor-detail-layout {
        padding-top: 34px;
        padding-bottom: 42px;
    }

    .honor-story,
    .honor-genealogy-panel {
        padding: 18px;
    }

    .honor-recipient-modes,
    .honor-essential-grid,
    .honor-achievement-grid,
    .honor-admin-filters {
        grid-template-columns: 1fr;
    }

    .honor-form-body {
        padding: 16px;
    }

    .honor-member-picker {
        padding: 12px;
    }

    body.admin-body .honor-admin-form .honor-form-actions {
        position: static;
        bottom: auto;
        display: grid;
        grid-template-columns: 1fr;
    }

    body.admin-body .honor-admin-form .honor-form-actions .btn {
        width: 100%;
    }
}

/* Admin member avatar management */
body.admin-member-avatar-dialog-open {
    overflow: hidden;
}

.member-avatar-column {
    width: 104px;
    min-width: 104px;
    text-align: center;
}

.member-avatar-cell {
    width: 104px;
    min-width: 104px;
    text-align: center;
}

.member-avatar-control {
    position: relative;
    display: inline-flex;
    width: 58px;
    height: 58px;
}

.member-avatar-thumbnail {
    display: grid;
    width: 56px;
    height: 56px;
    padding: 0;
    overflow: hidden;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #f6ead2;
    color: #8f211a;
    font: 700 20px/1 Georgia, serif;
    box-shadow: 0 0 0 1px #dcc7a5, 0 4px 12px rgba(71, 47, 20, .1);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.member-avatar-thumbnail:hover,
.member-avatar-thumbnail:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 0 0 2px #a52922, 0 7px 16px rgba(71, 47, 20, .16);
    outline: none;
}

.member-avatar-thumbnail.is-empty {
    background: linear-gradient(145deg, #fff9ed, #edddbc);
}

.member-avatar-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-avatar-edit {
    display: none !important;
}

.member-avatar-edit:hover,
.member-avatar-edit:focus-visible {
    background: #761711;
    outline: 2px solid rgba(156, 34, 27, .24);
    outline-offset: 2px;
}

.member-avatar-edit.is-static {
    pointer-events: none;
}

.member-avatar-edit svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

.member-avatar-dialog[hidden] {
    display: none;
}

.member-avatar-dialog {
    position: fixed;
    z-index: 1400;
    inset: 0;
    display: grid;
    padding: 24px;
    place-items: center;
}

.member-avatar-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(27, 19, 14, .72);
    backdrop-filter: blur(3px);
}

.member-avatar-dialog-card {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid #ddc9a8;
    border-radius: 18px;
    background: #fffdf9;
    color: #2e2118;
    box-shadow: 0 24px 70px rgba(24, 15, 10, .32);
}

.member-avatar-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid #eadcc6;
}

.member-avatar-dialog-eyebrow {
    display: block;
    margin-bottom: 4px;
    color: #9c221b;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.member-avatar-dialog-header h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
}

.member-avatar-dialog-header p {
    margin: 5px 0 0;
    color: #765f4e;
}

.member-avatar-dialog-close {
    display: grid;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 1px solid #dfcbae;
    border-radius: 50%;
    background: #fff;
    color: #6e5140;
    cursor: pointer;
}

.member-avatar-dialog-close:hover,
.member-avatar-dialog-close:focus-visible {
    border-color: #9c221b;
    color: #9c221b;
    outline: 3px solid rgba(156, 34, 27, .12);
}

.member-avatar-dialog-close svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.member-avatar-viewer-card {
    width: min(760px, 100%);
}

.member-avatar-viewer-stage {
    display: grid;
    min-height: 300px;
    max-height: min(68vh, 720px);
    padding: 18px;
    place-items: center;
    overflow: hidden;
    background: #251d18;
}

.member-avatar-viewer-stage img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(min(68vh, 720px) - 36px);
    border-radius: 8px;
    object-fit: contain;
}

.member-avatar-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px 20px;
    border-top: 1px solid #eadcc6;
}

.member-avatar-dialog-actions .btn {
    min-height: 42px;
}

.member-avatar-download {
    margin-right: auto;
}

.member-avatar-download svg {
    width: 17px;
    height: 17px;
    margin-right: 6px;
    fill: currentColor;
    vertical-align: -3px;
}

.member-avatar-editor-body {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 24px;
    padding: 24px 22px;
}

.member-avatar-editor-preview {
    display: grid;
    width: 180px;
    aspect-ratio: 1;
    overflow: hidden;
    place-items: center;
    border: 1px dashed #cdb792;
    border-radius: 16px;
    background: #f8f2e8;
}

.member-avatar-editor-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-avatar-editor-preview img[hidden] {
    display: none;
}

.member-avatar-preview-empty {
    display: grid;
    gap: 8px;
    place-items: center;
    color: #856c58;
    font-size: 13px;
    font-weight: 700;
}

.member-avatar-preview-empty[hidden] {
    display: none;
}

.member-avatar-preview-empty svg {
    width: 42px;
    height: 42px;
    fill: #b79b72;
}

.member-avatar-upload-field label {
    display: block;
    margin: 2px 0 9px;
    font-weight: 800;
}

.member-avatar-upload-field input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px;
    border: 1px solid #d7c4a7;
    border-radius: 10px;
    background: #fff;
}

.member-avatar-upload-field input[type="file"]:focus-visible {
    border-color: #9c221b;
    outline: 3px solid rgba(156, 34, 27, .12);
}

.member-avatar-upload-field p {
    margin: 10px 0 0;
    color: #765f4e;
    font-size: 13px;
    line-height: 1.5;
}

.member-avatar-file-status {
    min-height: 22px;
    margin-top: 8px;
    color: #765f4e;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.member-avatar-file-status.is-ready {
    color: #27724f;
    font-weight: 700;
}

.member-avatar-file-status.is-error {
    color: #b42318;
    font-weight: 700;
}

@media (max-width: 620px) {
    .member-avatar-dialog {
        padding: 12px;
    }

    .member-avatar-dialog-card {
        max-height: calc(100vh - 24px);
        border-radius: 14px;
    }

    .member-avatar-editor-body {
        grid-template-columns: 1fr;
    }

    .member-avatar-editor-preview {
        width: min(180px, 100%);
        margin: 0 auto;
    }

    .member-avatar-dialog-actions {
        flex-wrap: wrap;
    }

    .member-avatar-dialog-actions .btn,
    .member-avatar-download {
        flex: 1 1 auto;
        margin-right: 0;
        text-align: center;
    }
}

.password-input-shell {
    position: relative;
    display: block;
    width: 100%;
}

.password-input-shell > input {
    padding-right: 48px;
}

.password-visibility-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #75695e;
    cursor: pointer;
}

.password-visibility-toggle:hover {
    background: #f4efe8;
    color: #5f1613;
}

.password-visibility-toggle:focus-visible {
    outline: 2px solid #8c1d18;
    outline-offset: 1px;
}

.password-visibility-icon {
    position: relative;
    display: block;
    width: 19px;
    height: 13px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.password-visibility-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: currentColor;
}

.password-visibility-toggle[aria-pressed="true"] .password-visibility-icon::before {
    content: '';
    position: absolute;
    z-index: 1;
    top: 4px;
    left: -4px;
    width: 23px;
    height: 2px;
    transform: rotate(42deg);
    border-radius: 2px;
    background: currentColor;
    box-shadow: 0 0 0 2px #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.container {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 253, 248, .96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.header-inner {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    display: block;
    width: clamp(118px, 14vw, 144px);
    height: auto;
}

.brand strong,
.brand small {
    display: block;
    line-height: 1.1;
}

.brand small {
    color: var(--muted);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (min-width: 961px) {
    .main-nav {
        flex-grow: 1;
    }
    .main-nav > a:first-child {
        margin-left: auto;
    }
    .main-nav > .site-account,
    .main-nav > .btn-outline {
        margin-left: auto;
    }
}

.main-nav > a {
    padding: 9px 12px;
    border-radius: 6px;
    font-weight: 700;
}

.main-nav > a:not(.btn):hover {
    background: var(--wash);
}

.site-account {
    position: relative;
}

.site-account-toggle {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 260px;
    padding: 5px 8px 5px 5px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.site-account-toggle:hover,
.site-account-toggle[aria-expanded="true"] {
    border-color: var(--line);
    background: #fff;
    box-shadow: 0 8px 20px rgba(68, 40, 18, .08);
}

.site-account-avatar {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.site-account-avatar > .site-account-initials,
.site-account-avatar > img {
    grid-area: 1 / 1;
}

.site-account-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.site-account-avatar img[hidden] {
    display: none;
}

.site-account-avatar.is-large {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
    font-size: 15px;
}

.site-account-copy {
    min-width: 0;
    display: grid;
    gap: 1px;
    text-align: left;
}

.site-account-copy span,
.site-account-summary strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-account-copy small,
.site-account-summary div > span,
.site-account-summary small {
    overflow: hidden;
    color: #5d5046;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.28;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-account-chevron {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 16px;
    line-height: 1;
}

.site-account-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 30;
    width: min(330px, calc(100vw - 32px));
    display: none;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffefb;
    box-shadow: 0 18px 38px rgba(68, 40, 18, .16);
}

.site-account.is-open .site-account-menu {
    display: grid;
}

.site-account-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 10px 10px 14px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}

.site-account-summary div {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.site-account-summary .site-account-avatar {
    color: #fff;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

.site-account-summary strong {
    font-size: 16px;
    line-height: 1.2;
}

.site-account-menu > a {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 6px;
    color: #2c211b;
    font-size: 15px;
    font-weight: 800;
}

.site-account-menu > a:hover,
.site-account-menu > a:focus-visible {
    background: #f7efe3;
    color: var(--red-dark);
    outline: none;
}

.site-account-menu > a.is-danger {
    color: #8f1715;
}

.nav-toggle {
    display: none;
    border: 0;
    background: var(--red);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 6px;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--red);
    border-radius: 6px;
    background: var(--red);
    color: #fff;
    padding: 10px 16px;
    font-weight: 500;
    cursor: pointer;
    min-height: 42px;
}

.btn:hover {
    background: var(--red-dark);
    border-color: var(--red-dark);
}

.btn-outline {
    background: transparent;
    color: var(--red);
}

.btn-outline:hover {
    background: var(--wash);
    color: var(--red-dark);
}

.btn-small {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
}

.btn-danger {
    border-color: var(--danger);
    background: var(--danger);
}

.text-link {
    color: var(--red);
    font-weight: 800;
}

.hero {
    min-height: calc(100vh - 74px);
    position: relative;
    display: grid;
    align-items: center;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
}

.hero-media {
    position: absolute;
    inset: 0;
}

.hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(47, 37, 29, .82), rgba(47, 37, 29, .48), rgba(47, 37, 29, .12));
}

.hero-content {
    position: relative;
    color: #fff;
    padding: 72px 0 110px;
}

.hero h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(42px, 6vw, 78px);
    line-height: 1.05;
}

.hero p {
    max-width: 620px;
    font-size: 19px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

.hero .btn-outline {
    border-color: #fff;
    color: #fff;
}

.section {
    padding: 64px 0;
}

.section-tint {
    background: var(--wash);
}

.page-hero {
    background: linear-gradient(135deg, var(--red), #3d241d);
    color: #fff;
}

.page-hero.compact {
    padding: 54px 0;
}

.page-hero h1 {
    margin: 0;
    font-size: 42px;
}

.page-hero p {
    max-width: 720px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    font-weight: 900;
    text-transform: uppercase;
    font-size: 13px;
}

.section-head,
.split,
.admin-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.section-head h2,
.split h2,
.admin-head h1 {
    margin: 0;
}

.section-head {
    margin-bottom: 24px;
}

.section-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 480px);
}

.feature-list {
    display: grid;
    gap: 12px;
}

.feature-list div,
.info-panel,
.admin-panel,
.auth-card,
.profile-card,
.stat-item,
.admin-stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.feature-list div {
    padding: 18px;
}

.feature-list strong,
.feature-list span {
    display: block;
}

.feature-list span,
.muted,
.empty {
    color: var(--muted);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.stat-item {
    padding: 22px;
}

.stat-item strong,
.admin-stat strong {
    display: block;
    color: var(--red);
    font-size: 34px;
    line-height: 1;
}

.stat-item span,
.admin-stat span {
    color: var(--muted);
    font-weight: 700;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.card img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: var(--wash);
}

.card-body {
    padding: 18px;
}

.card h2,
.card h3 {
    margin: 10px 0;
    line-height: 1.25;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 6px;
    background: #efe2ca;
    color: #6e4a18;
    font-size: 12px;
    font-weight: 900;
}

.gallery-strip,
.gallery-grid,
.photo-grid,
.media-grid {
    display: grid;
    gap: 16px;
}

.gallery-strip {
    grid-template-columns: repeat(4, 1fr);
}

.album-tile,
.album-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow);
}

.album-tile img,
.album-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.album-tile span {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    background: rgba(47, 37, 29, .78);
    color: #fff;
    border-radius: 6px;
    padding: 8px 10px;
    font-weight: 800;
}

.gallery-grid {
    grid-template-columns: repeat(3, 1fr);
}

.album-card {
    padding-bottom: 16px;
}

.album-card h2,
.album-card p,
.album-card .badge {
    margin-left: 16px;
    margin-right: 16px;
}

.album-card .badge {
    margin-top: 14px;
}

.photo-grid {
    grid-template-columns: repeat(3, 1fr);
}

.media-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.media-card {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow);
}

.gallery-image-button {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: #eee8de;
    cursor: zoom-in;
}

.gallery-image-button img,
.gallery-video-frame,
.gallery-video-frame iframe,
.gallery-video-frame video {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
}

.gallery-image-button img {
    object-fit: cover;
    transition: transform .22s ease;
}

.gallery-image-button:hover img { transform: scale(1.025); }
.gallery-image-button:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.gallery-video-frame { background: #211b18; }
.gallery-video-frame iframe { border: 0; }
.gallery-video-frame video { object-fit: contain; }

.media-card figcaption {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    font-weight: 700;
}

.media-type-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #efe2ca;
    color: #76511f;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.gallery-album-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.gallery-media-filters {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
}

.gallery-media-filters a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.gallery-media-filters a span {
    display: inline-grid;
    min-width: 20px;
    height: 20px;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    background: #eee8de;
    color: var(--ink);
    font-size: 10px;
}

.gallery-media-filters a.is-active { background: var(--red); color: #fff; }
.gallery-media-filters a.is-active span { background: rgba(255,255,255,.2); color: #fff; }

.gallery-media-placeholder {
    display: grid;
    width: 100%;
    aspect-ratio: 4 / 3;
    place-items: center;
    align-content: center;
    gap: 8px;
    background: linear-gradient(145deg, #4d211e, #81201b);
    color: #f5d99d;
}

.gallery-media-placeholder svg { width: 48px; height: 48px; }
.gallery-media-placeholder.is-album { aspect-ratio: 4 / 3; }
.gallery-media-placeholder.is-compact { width: 82px; height: 74px; aspect-ratio: auto; border-radius: 8px; }
.gallery-media-placeholder.is-compact svg { width: 30px; height: 30px; }

/* Story / Reels / Threads Style Lightbox Modal */
.story-lightbox {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(10, 8, 7, 0.96);
    backdrop-filter: blur(18px);
    color: #fff;
    overflow: hidden;
    z-index: 99999;
}

.story-lightbox::backdrop {
    background: rgba(10, 8, 7, 0.96);
    backdrop-filter: blur(18px);
}

.story-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    padding: 16px 24px 12px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
}

.story-progress-bar {
    display: flex;
    gap: 5px;
    width: 100%;
    margin-bottom: 12px;
}

.story-segment {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
    transition: background 0.2s ease;
}

.story-segment.is-active {
    background: #ffffff;
}

.story-segment.is-passed {
    background: rgba(255, 255, 255, 0.65);
}

.story-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.story-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.story-album-badge {
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 13px;
    font-weight: 700;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    letter-spacing: 0.3px;
}

.story-counter {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 700;
}

.story-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.story-close-btn:hover {
    background: #dc2626;
    transform: scale(1.08);
}

.story-close-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}

.story-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    padding: 70px 90px 90px;
    box-sizing: border-box;
}

.story-stage [hidden],
.story-stage img[hidden],
.story-stage video[hidden],
.story-stage iframe[hidden] {
    display: none !important;
}

.story-stage img,
.story-stage video {
    display: block;
    max-width: min(1000px, 85vw);
    max-height: calc(100vh - 160px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
}

.story-stage iframe {
    display: block;
    width: min(1000px, 85vw);
    height: min(562px, 70vh);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
}

.story-nav-area {
    position: absolute;
    top: 70px;
    bottom: 90px;
    z-index: 25;
    width: 110px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.story-nav-area:hover:not(:disabled) {
    opacity: 1;
}

.story-nav-area:disabled {
    opacity: 0.1;
    cursor: default;
}

.story-nav-prev { left: 12px; }
.story-nav-next { right: 12px; }

.story-nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.story-nav-area:hover:not(:disabled) .story-nav-arrow {
    transform: scale(1.1);
    background: var(--red, #b91c1c);
    border-color: #ffffff;
}

.story-nav-arrow svg {
    width: 24px;
    height: 24px;
    display: block;
}

.story-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    padding: 24px 30px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
    text-align: center;
    pointer-events: none;
}

.story-caption-text {
    margin: 0;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.gallery-video-card-button {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: #171311;
    cursor: pointer;
    overflow: hidden;
}

.gallery-media-placeholder.is-video-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: radial-gradient(circle at 50% 35%, #1d2536 0%, #0c1017 100%);
    position: relative;
    overflow: hidden;
}

.gallery-media-placeholder.is-video-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(rgba(212, 163, 89, 0.12) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.45));
    background-size: 20px 20px, 100% 100%;
    pointer-events: none;
}

.gallery-media-placeholder.is-video-card::after {
    content: '▶ VIDEO';
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(212, 163, 89, 0.22);
    border: 1px solid rgba(212, 163, 89, 0.45);
    color: #f5e6b3;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    backdrop-filter: blur(8px);
}

.gallery-video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: 2px solid rgba(255, 235, 190, 0.9);
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(197, 142, 60, 0.95), rgba(120, 75, 18, 0.95));
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 163, 89, 0.3);
    backdrop-filter: blur(8px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-video-play-overlay svg {
    width: 26px;
    height: 26px;
    margin-left: 3px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.gallery-video-card-button:hover .gallery-video-play-overlay {
    transform: translate(-50%, -50%) scale(1.14);
    background: linear-gradient(135deg, rgba(225, 165, 75, 1), rgba(145, 90, 25, 1));
    border-color: #ffffff;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(212, 163, 89, 0.5);
}

.photo-grid figure {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.photo-grid img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.photo-grid figcaption {
    padding: 12px;
    font-weight: 700;
}

.auth-shell {
    min-height: 70vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
    background:
        radial-gradient(circle at top, rgba(184, 134, 47, .11), transparent 34%),
        var(--paper);
}

.auth-standalone-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(184, 134, 47, .12), transparent 34%),
        var(--paper);
}

.auth-standalone-main {
    min-height: 100vh;
    display: grid;
}

.auth-shell.auth-shell-standalone {
    min-height: 100vh;
    padding: clamp(22px, 5vw, 54px) 16px;
    background: transparent;
}

.auth-shell .auth-card {
    width: min(820px, 100%);
    padding: 38px 58px;
    display: grid;
    gap: 12px;
    position: relative;
    overflow: hidden;
    background: #fffdf9;
    border: 2px solid var(--gold);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(110, 74, 24, .07);
}

.auth-shell .auth-card::before {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px dashed var(--gold);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(246, 239, 227, .25) 0%, rgba(255, 253, 248, .5) 100%);
    pointer-events: none;
    z-index: 0;
}

.auth-shell .auth-card::after {
    content: "";
    position: absolute;
    inset: 32px;
    background:
        linear-gradient(var(--red), var(--red)) top left / 18px 2px no-repeat,
        linear-gradient(var(--red), var(--red)) top left / 2px 18px no-repeat,
        linear-gradient(var(--red), var(--red)) top right / 18px 2px no-repeat,
        linear-gradient(var(--red), var(--red)) top right / 2px 18px no-repeat,
        linear-gradient(var(--red), var(--red)) bottom left / 18px 2px no-repeat,
        linear-gradient(var(--red), var(--red)) bottom left / 2px 18px no-repeat,
        linear-gradient(var(--red), var(--red)) bottom right / 18px 2px no-repeat,
        linear-gradient(var(--red), var(--red)) bottom right / 2px 18px no-repeat;
    pointer-events: none;
    z-index: 0;
}

.auth-shell .auth-card > * {
    position: relative;
    z-index: 1;
}

.auth-shell .auth-card label,
.auth-shell .auth-card .btn,
.auth-shell .auth-card .social-login,
.auth-shell .auth-card .auth-progress,
.auth-shell .auth-card .account-pending-summary,
.auth-shell .auth-card .account-pending-actions,
.auth-shell .auth-card > p:last-child {
    width: min(580px, 100%);
    justify-self: center;
}

.auth-shell .auth-card .eyebrow {
    margin: 0;
    color: var(--gold);
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.auth-shell .auth-card h1 {
    margin: 0 0 8px;
    color: var(--red);
    font-family: "Lora", Georgia, serif;
    font-size: 36px;
    line-height: 1.15;
    text-align: center;
}

.auth-shell .auth-card h1::after {
    content: "";
    display: block;
    width: 60px;
    height: 2px;
    margin: 14px auto 0;
    background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--red) 50%, var(--gold) 80%, transparent);
}

.auth-shell .auth-card label {
    color: var(--ink);
    font-weight: 800;
    gap: 8px;
}

.auth-shell .auth-card input {
    min-height: 50px;
    border-radius: 10px;
    background: #fffefb;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.auth-shell .auth-card input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 134, 47, .16);
    outline: none;
}

.auth-shell .auth-card .btn {
    min-height: 54px;
    margin-top: 4px;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(140, 29, 24, .12);
}

.auth-shell .auth-card .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(140, 29, 24, .16);
}

.auth-password-meta {
    width: min(580px, 100%);
    justify-self: center;
    margin-top: -5px;
    text-align: right;
}

.auth-password-meta a,
.auth-secondary-link {
    color: var(--red);
    font-size: 14px;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-password-meta a:hover,
.auth-secondary-link:hover {
    color: var(--red-dark);
    text-decoration: none;
}

.auth-recovery-card {
    text-align: center;
}

.auth-recovery-card > p:not(.eyebrow),
.auth-recovery-card > form,
.auth-recovery-card > .auth-inline-error,
.auth-recovery-card > .auth-secondary-link {
    width: min(580px, 100%);
    justify-self: center;
}

.auth-recovery-card > form {
    display: grid;
    gap: 14px;
    margin-top: 6px;
    text-align: left;
}

.auth-recovery-card > form .btn {
    width: 100%;
}

.auth-recovery-card label small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.auth-secondary-link {
    display: inline-flex;
    justify-content: center;
    margin-top: 6px;
}

.auth-recovery-result {
    width: min(580px, 100%);
    justify-self: center;
    display: grid;
    justify-items: center;
    gap: 8px;
}

.auth-recovery-result > span {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 50%;
    background: #e5f4e9;
    color: #207448;
    font-size: 25px;
    font-weight: 900;
}

.auth-recovery-result.is-error > span {
    background: #f9e7e3;
    color: var(--red);
}

.auth-recovery-result p {
    margin: 0;
}

.auth-recovery-note {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    margin-top: 8px !important;
    padding: 15px 18px;
    border: 1px solid #e2bb6d;
    border-radius: 11px;
    background: #fff6dc;
    box-shadow: 0 8px 20px rgba(151, 99, 25, .1);
    color: #664713;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    text-align: left;
}

.auth-recovery-note strong {
    color: #8f211d;
    font-size: 17px;
    font-weight: 900;
}

.auth-recovery-note-icon {
    display: inline-grid;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    background: #b87917;
    color: #fff;
    font-size: 19px;
    font-weight: 900;
}

.auth-inline-error {
    padding: 11px 13px;
    border: 1px solid #e5aaa2;
    border-radius: 8px;
    background: #fff0ed;
    color: var(--red);
    font-size: 14px;
    font-weight: 700;
    text-align: left;
}

.auth-helper-text,
.auth-switch-link {
    width: min(580px, 100%);
    justify-self: center;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.auth-switch-link a {
    color: var(--red);
    font-weight: 900;
}

.auth-switch-link a:hover {
    color: var(--red-dark);
}

.auth-progress {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 4px auto 28px;
    padding: 0;
}

.auth-progress-step {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.auth-progress-step:not(:last-child) {
    padding-right: 56px;
}

.auth-progress-step:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 14px;
    width: 28px;
    height: 1px;
    background: #e4d7c5;
}

.auth-progress-index {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #efe7dc;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.auth-progress-step strong {
    overflow: hidden;
    color: currentColor;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-progress-step.is-complete {
    color: var(--green);
}

.auth-progress-step.is-complete .auth-progress-index {
    background: var(--green);
    color: #fff;
}

.auth-progress-step.is-complete:not(:last-child)::after {
    background: rgba(47, 111, 94, .38);
}

.auth-progress-step.is-current {
    color: var(--red);
}

.auth-progress-step.is-current .auth-progress-index {
    background: var(--red);
    color: #fff;
}

.auth-progress-step.is-pending {
    color: #9a8f82;
}

.social-login {
    display: grid;
    gap: 14px;
    margin-top: 4px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg, transparent, var(--line), var(--gold));
}

.auth-divider::after {
    background: linear-gradient(90deg, var(--gold), var(--line), transparent);
}

.social-login-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.social-btn {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-bottom: 3px solid var(--gold);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.social-btn:hover {
    border-color: var(--line);
    border-bottom-color: var(--red);
    box-shadow: 0 12px 28px rgba(140, 29, 24, .1);
    transform: translateY(-1px);
}

.social-btn-facebook {
    border-color: var(--line);
    border-bottom-color: var(--gold);
    color: var(--ink);
    background: #fff;
}

.social-btn-facebook:hover {
    border-color: var(--line);
    border-bottom-color: var(--red);
}

.social-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--line);
    color: #4285f4;
    font-family: Arial, sans-serif;
    font-size: 17px;
    font-weight: 900;
}

.social-btn-facebook .social-icon {
    background: #1877f2;
    border-color: #1877f2;
    color: #fff;
    font-size: 21px;
    line-height: 1;
}

.social-login-note {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.auth-shell .account-setup-card {
    width: min(900px, 100%);
}

.auth-shell .auth-card select,
.auth-shell .auth-card textarea {
    border-radius: 10px;
    background: #fffefb;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.auth-shell .auth-card select:focus,
.auth-shell .auth-card textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 134, 47, .16);
    outline: none;
}

.account-setup-summary,
.account-setup-grid,
.account-type-fieldset,
.account-setup-panel,
.account-setup-note {
    width: min(620px, 100%);
    justify-self: center;
}

.account-setup-summary {
    display: grid;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf0;
    text-align: center;
}

.account-setup-summary span,
.account-setup-note {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.account-setup-summary strong {
    color: var(--ink);
    font-weight: 900;
}

.account-pending-summary {
    display: grid;
    gap: 4px;
    padding: 16px;
    border: 1px solid rgba(47, 111, 94, .24);
    border-radius: 10px;
    background: rgba(47, 111, 94, .08);
    text-align: center;
}

.account-pending-summary span,
.account-pending-summary small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.account-pending-summary strong {
    color: var(--green);
    font-size: 18px;
    font-weight: 900;
}

.account-pending-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.account-pending-actions.is-three {
    width: min(820px, 100%) !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.site-account-approval-status {
    display: inline-flex;
    width: fit-content;
    margin-top: 5px;
    padding: 3px 8px;
    border: 1px solid rgba(180, 120, 24, .28);
    border-radius: 999px;
    background: rgba(180, 120, 24, .1);
    color: #946311;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.25;
}

.account-state-modal[hidden] {
    display: none !important;
}

.account-state-modal {
    position: fixed;
    inset: 0;
    z-index: 300000;
    display: grid;
    place-items: center;
    padding: 22px;
}

.account-state-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(33, 24, 16, .66);
    backdrop-filter: blur(8px);
    animation: flashFadeIn .2s ease both;
}

.account-state-modal-card {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    min-width: 0;
    max-height: calc(100vh - 44px);
    overflow: auto;
    padding: 38px 40px 34px;
    border: 1px solid rgba(180, 120, 24, .58);
    border-radius: 18px;
    background: linear-gradient(145deg, #fffdf8 0%, #fffaf0 100%);
    box-shadow: 0 28px 80px rgba(40, 28, 17, .28);
    text-align: center;
    animation: flashScaleIn .25s cubic-bezier(.2, .8, .2, 1) both;
}

.account-state-modal-card:focus {
    outline: none;
}

.account-state-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, .82);
    color: var(--muted);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.account-state-modal-close:hover {
    border-color: var(--red);
    color: var(--red);
}

.account-state-modal-icon {
    display: grid;
    width: 68px;
    height: 68px;
    margin: 0 auto 16px;
    place-items: center;
    border-radius: 50%;
}

.account-state-modal-icon svg {
    width: 34px;
    height: 34px;
}

.account-state-modal-icon.is-pending {
    background: rgba(180, 120, 24, .12);
    color: #a36a0f;
}

.account-state-modal-icon.is-approved {
    background: rgba(47, 111, 94, .12);
    color: var(--green);
}

.account-state-modal-card .eyebrow {
    margin-bottom: 8px;
}

.account-state-modal-card h2 {
    margin: 0;
    color: var(--red);
    font-family: var(--serif);
    font-size: clamp(28px, 5vw, 40px);
    line-height: 1.16;
}

.account-state-modal-card > p:not(.eyebrow) {
    margin: 18px auto 0;
    color: var(--muted);
    font-size: 15px;
    font-weight: 650;
    line-height: 1.65;
}

.account-state-modal-summary {
    display: grid;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
    margin-top: 22px;
    padding: 15px;
    border: 1px solid rgba(47, 111, 94, .22);
    border-radius: 11px;
    background: rgba(47, 111, 94, .07);
}

.account-state-modal-summary strong {
    color: var(--green);
    font-size: 17px;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.account-state-modal-summary small {
    color: var(--muted);
    font-weight: 800;
}

.account-state-modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 26px;
}

.account-state-modal-actions.is-single {
    grid-template-columns: minmax(0, 360px);
    justify-content: center;
}

.account-state-modal-actions .btn {
    width: 100%;
    min-height: 50px;
}

body.account-state-modal-open {
    overflow: hidden;
}

@media (max-width: 620px) {
    .account-state-modal {
        padding: 14px;
    }

    .account-state-modal-card {
        max-height: calc(100vh - 28px);
        padding: 34px 18px 22px;
        border-radius: 14px;
    }

    .account-state-modal-actions {
        grid-template-columns: 1fr;
    }
}

.account-setup-grid,
.account-setup-panel {
    display: grid;
    gap: 12px;
}

[data-account-type-field][hidden] {
    display: none !important;
}

.account-setup-grid,
.account-type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-type-fieldset {
    display: grid;
    gap: 12px;
    margin: 4px 0 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.account-type-fieldset legend {
    padding: 0 8px;
    color: var(--ink);
    font-weight: 900;
}

.account-type-grid {
    display: grid;
    gap: 12px;
}

.account-type-option {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    min-height: 92px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.account-type-option input {
    width: auto;
    margin-top: 4px;
    accent-color: var(--red);
}

.account-type-option strong,
.account-type-option small {
    display: block;
}

.account-type-option small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
}

.account-type-option.is-selected {
    border-color: rgba(140, 29, 24, .55);
    background: #fff7ef;
    box-shadow: inset 0 0 0 1px rgba(140, 29, 24, .08);
}

.account-setup-note {
    margin: 0;
    text-align: center;
}

.account-member-search {
    min-height: 48px;
    border-color: #d7bd88;
    padding-left: 46px;
    background-color: #fffaf0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238b8176' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 16px center;
    background-size: 18px 18px;
}

.account-member-search::placeholder {
    color: #8b8176;
}

.account-member-suggestions {
    display: grid;
    gap: 4px;
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #d7bd88;
    border-radius: 10px;
    background: #fffefb;
    box-shadow: 0 12px 24px rgba(68, 40, 18, .12);
}

.account-member-suggestions[hidden] {
    display: none !important;
}

.account-member-suggestion {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 9px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.account-member-suggestion:hover,
.account-member-suggestion:focus-visible {
    background: #fff4df;
    color: var(--red-dark);
    outline: none;
}

.account-member-suggestion-empty {
    padding: 12px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

.auth-register-prompt {
    margin: 14px 0 8px;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

.auth-register-prompt .auth-register-link {
    color: var(--red);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-left: 3px;
    transition: color .18s ease;
}

.auth-register-prompt .auth-register-link:hover {
    color: var(--red-dark);
    text-decoration: none;
}

@media (max-width: 640px) {
    .auth-shell .auth-card h1 {
        font-size: 30px;
    }

    .account-setup-grid,
    .account-type-grid {
        grid-template-columns: 1fr;
    }

    .account-pending-actions,
    .account-pending-actions.is-three {
        grid-template-columns: 1fr;
    }

    .auth-progress {
        width: min(360px, 100%);
        justify-content: space-between;
    }

    .auth-progress-step {
        gap: 6px;
        font-size: 11px;
    }

    .auth-progress-step:not(:last-child) {
        padding-right: 28px;
    }

    .auth-progress-step:not(:last-child)::after {
        right: 8px;
        width: 14px;
    }

    .auth-progress-index {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
        font-size: 12px;
    }

    .account-type-option {
        min-height: 0;
    }
}

.legal-shell {
    padding: 56px 0;
    background: var(--wash);
}

.legal-card {
    max-width: 860px;
    margin: 0 auto;
    padding: clamp(24px, 5vw, 48px);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow);
}

.legal-card h1 {
    margin-top: 0;
}

.legal-card h2 {
    margin-top: 28px;
    font-size: 20px;
}

.legal-card p,
.legal-card li {
    line-height: 1.75;
}

.oauth-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.oauth-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--wash);
}

.badge-active {
    border-color: #b7ddce;
    background: #ecf8f3;
    color: var(--green);
}

.badge-pending {
    border-color: #ead29c;
    background: #fff7df;
    color: #8a5c00;
}

.badge-locked {
    border-color: #efb9b4;
    background: #fff0ef;
    color: var(--danger);
}

.oauth-settings-group {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.oauth-settings-group legend {
    padding: 0 8px;
    font-weight: 800;
}

.oauth-settings-group small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-weight: 400;
}

.callback-box {
    display: grid;
    gap: 6px;
    padding: 12px;
    border-radius: 6px;
    background: #f2eee8;
}

.callback-box span {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.callback-box code {
    overflow-wrap: anywhere;
    user-select: all;
}

.check-line {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.check-line input {
    width: auto;
}

.footer-phone-editor {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--wash);
}

.footer-phone-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.footer-phone-editor-head strong,
.footer-phone-editor-head small {
    display: block;
}

.footer-phone-editor-head small {
    margin-top: 3px;
    color: var(--muted);
    font-weight: 400;
}

.footer-phone-list-editor {
    display: grid;
    gap: 10px;
}

.footer-phone-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.footer-phone-remove {
    min-height: 44px;
}

.footer-phone-remove:disabled {
    cursor: not-allowed;
    opacity: .5;
}

@media (max-width: 560px) {
    .social-login-actions,
    .oauth-status-grid {
        grid-template-columns: 1fr;
    }

    .footer-phone-editor-head,
    .footer-phone-row {
        grid-template-columns: 1fr;
        display: grid;
    }
}

.alert {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 700;
}

.alert-success {
    border-color: #b7ddce;
    background: #ecf8f3;
    color: var(--green);
}

.alert-danger {
    border-color: #efb9b4;
    background: #fff0ef;
    color: var(--danger);
}

.alert-warning {
    border-color: #ead29c;
    background: #fff7df;
    color: #8a5c00;
}

.tree-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 360px) auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 24px;
}

.tree-scroll {
    overflow: auto;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.family-tree {
    min-width: 860px;
    text-align: center;
}

.family-tree ul {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 16px;
    padding-top: 28px;
    margin: 0;
    list-style: none;
}

.family-tree ul ul::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 28px;
    background: var(--line);
}

.family-tree li {
    position: relative;
    display: grid;
    justify-items: center;
    padding: 0 6px;
}

.tree-card {
    width: 180px;
    min-height: 174px;
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(68, 40, 18, .09);
    transition: opacity .2s, border-color .2s, transform .2s;
}

.tree-card:hover {
    transform: translateY(-2px);
}

.tree-card img {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold);
}

.tree-card strong,
.tree-card span,
.tree-card small {
    display: block;
}

.tree-card strong {
    line-height: 1.25;
}

.tree-card span,
.tree-card small,
.spouse {
    color: var(--muted);
    font-size: 12px;
}

.spouse {
    padding-top: 6px;
    border-top: 1px dashed var(--line);
}

.tree-card.is-dimmed {
    opacity: .22;
}

.tree-card.is-matched {
    border-color: var(--red);
}

.profile-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.member-detail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 24px;
}

.member-detail-contribution-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.member-detail-contribution-button svg {
    flex: 0 0 auto;
}

.profile-card {
    padding: 22px;
    text-align: center;
    position: sticky;
    top: 96px;
}

.profile-card img {
    width: 180px;
    height: 180px;
    margin: 0 auto 16px;
    border-radius: 8px;
    object-fit: cover;
}

.profile-main {
    display: grid;
    gap: 18px;
}

.info-panel {
    padding: 22px;
}

.info-list {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 10px 18px;
}

.info-list dt {
    color: var(--muted);
    font-weight: 800;
}

.info-list dd {
    margin: 0;
}

.relation-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.relation-list a {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
}

.relation-list span,
.relation-list strong {
    display: block;
}

.relation-list span {
    color: var(--muted);
    font-size: 12px;
}

.article-cover {
    width: min(960px, calc(100% - 32px));
    aspect-ratio: 16 / 9;
    margin: 28px auto 0;
    overflow: hidden;
    background: var(--wash);
}

.site-account-menu > a svg {
    flex: 0 0 auto;
    color: #9a681f;
}

.article-cover img,
.article-cover iframe,
.article-cover video {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

.article-cover video {
    background: #000;
}

.article-body {
    max-width: 820px;
    padding: 38px 0 72px;
}

.article-body h1 {
    margin: 12px 0 6px;
    font-size: 42px;
    line-height: 1.15;
}

.content {
    margin-top: 24px;
    font-size: 18px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.filter-row a {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-weight: 800;
}

.filter-row a.active {
    border-color: var(--red);
    background: var(--red);
    color: #fff;
}

.site-footer {
    position: relative;
    overflow: hidden;
    margin-top: 0;
    padding: 42px 0 18px;
    border-top: 4px solid rgba(255, 255, 255, .18);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0) 42%),
        #651414;
    color: #fff8ec;
}

.site-footer::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(ellipse 30px 18px at 50% 100%, transparent 61%, rgba(255, 255, 255, .2) 63%, rgba(255, 255, 255, .2) 68%, transparent 71%),
        radial-gradient(ellipse 30px 18px at 50% 100%, transparent 61%, rgba(255, 255, 255, .15) 63%, rgba(255, 255, 255, .15) 68%, transparent 71%);
    background-position: 0 0, 30px 18px;
    background-size: 60px 36px;
    opacity: .48;
}

.site-footer > .container {
    position: relative;
    z-index: 1;
}

.footer-layout {
    display: grid;
    grid-template-columns: minmax(210px, .9fr) minmax(320px, 1.25fr) minmax(140px, .55fr) minmax(150px, .6fr);
    align-items: start;
    gap: 28px;
}

.footer-brand-block,
.footer-contact-block,
.footer-link-block {
    min-width: 0;
}

.footer-brand-logo {
    display: inline-flex;
    width: min(214px, 100%);
    margin-bottom: 18px;
}

.footer-logo-mark {
    display: block;
    width: 100%;
    aspect-ratio: 912.94 / 279.39;
    background: #fff;
    -webkit-mask: url("../img/Logo.svg") center / contain no-repeat;
    mask: url("../img/Logo.svg") center / contain no-repeat;
}

.footer-brand-block p {
    max-width: 340px;
    margin: 0;
    color: rgba(255, 248, 236, .82);
    line-height: 1.75;
}

.footer-contact-block,
.footer-link-block {
    display: grid;
    gap: 12px;
}

.footer-contact-block > strong,
.footer-link-block > strong {
    display: block;
    color: #fff;
    font-size: 15px;
    letter-spacing: .02em;
}

.footer-address {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .07);
}

.footer-address span,
.footer-phone-heading {
    color: rgba(255, 248, 236, .68);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.footer-phone-heading {
    margin-top: 2px;
}

.footer-address p {
    margin: 0;
    color: #fffdf8;
    line-height: 1.65;
}

.footer-map-btn {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #f7d08a;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .04em;
    width: fit-content;
    transition: all 0.2s ease;
}

.footer-map-btn:hover {
    color: #fff;
    transform: translateX(3px);
}

.footer-map-btn svg {
    transition: transform 0.2s ease;
}

.footer-map-btn:hover svg {
    transform: scale(1.15);
}

.footer-phone-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.footer-phone-link {
    min-width: 0;
    display: grid;
    align-items: center;
    gap: 3px;
    padding: 11px 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.footer-phone-link strong {
    overflow-wrap: anywhere;
    color: #fff;
    font-size: 16px;
    line-height: 1.25;
}

.footer-phone-link:hover,
.footer-phone-link:focus-visible {
    border-color: rgba(255, 255, 255, .34);
    background: rgba(255, 255, 255, .13);
    transform: translateY(-1px);
}

.footer-link-block a {
    width: fit-content;
    color: rgba(255, 248, 236, .78);
    font-weight: 700;
    transition: color .18s ease, transform .18s ease;
}

.footer-link-block a:hover,
.footer-link-block a:focus-visible {
    color: #fff;
    transform: translateX(2px);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-top: 30px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .14);
    color: rgba(255, 248, 236, .68);
    font-size: 13px;
}

@media (max-width: 960px) {
    .footer-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-contact-block {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .site-footer {
        padding-top: 32px;
    }

    .footer-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .footer-brand-logo {
        width: 174px;
        margin-bottom: 14px;
    }

    .footer-phone-list {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        display: grid;
        gap: 6px;
        margin-top: 24px;
    }
}

.admin-shell {
    width: min(1320px, calc(100% - 32px));
    margin: 24px auto 64px;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 22px;
}

.admin-nav {
    align-self: start;
    position: sticky;
    top: 96px;
    display: grid;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.admin-nav strong {
    margin-bottom: 8px;
}

.admin-nav a {
    padding: 9px 10px;
    border-radius: 6px;
    font-weight: 800;
}

.admin-nav a:hover {
    background: var(--wash);
}

.admin-content {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.admin-head {
    align-items: center;
}

.admin-head.slim {
    margin-bottom: 12px;
}

.admin-panel {
    padding: 20px;
}

.admin-panel h2 {
    margin-top: 0;
}

.admin-tabs {
    display: flex;
    justify-content: flex-start;
    gap: 24px;
    overflow-x: auto;
    padding: 0 0 12px 0;
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    margin-bottom: 20px !important;
    box-shadow: none !important;
    scrollbar-width: none;
    position: relative;
}

.admin-tabs::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.admin-tabs::-webkit-scrollbar {
    display: none;
}

.admin-tab {
    min-height: 36px;
    display: inline-flex;
    flex: 0 0 auto !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 4px 12px 4px;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0 !important;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: color .2s ease, border-color .2s ease;
    position: relative;
    z-index: 1;
    background: transparent !important;
}

.admin-tab:hover {
    color: var(--red, #8c1d18) !important;
    background: transparent !important;
}

.admin-tab.is-active {
    color: var(--red, #8c1d18) !important;
    border-bottom: 3px solid var(--red, #8c1d18) !important;
    background: transparent !important;
    z-index: 2;
}

.admin-tabs + .admin-tabs {
    margin-top: -8px !important;
}

.admin-contribution-status-tabs {
    margin-left: 20px !important;
    margin-right: 20px !important;
    max-width: calc(100% - 40px);
}

.admin-tabs + .admin-panel,
.admin-tabs + .admin-contribution-panel,
.admin-tabs + .generation-tree-builder {
    margin-top: 16px !important;
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
    border: 1px solid #d8e0ea !important;
}

.admin-tab-count {
    min-width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    padding: 0 6px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    transition: background-color .2s ease, color .2s ease;
}

.admin-tab:hover .admin-tab-count {
    background: #fee2e2;
    color: var(--red, #8c1d18);
}

.admin-tab.is-active .admin-tab-count {
    background: var(--red, #8c1d18) !important;
    color: #ffffff !important;
}

.admin-tab-panel {
    min-width: 0;
}

.admin-tab-panel table {
    min-width: 720px;
}

.admin-tab-panel .gallery-album-table {
    min-width: 620px;
}

.admin-tab-panel .gallery-review-history-table {
    min-width: 1040px;
}

.gallery-review-history-actions {
    min-width: 132px;
    white-space: nowrap;
}

.admin-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.admin-panel-head h2 {
    margin: 0 0 5px;
}

.admin-panel-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.admin-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap-reverse;
}

.admin-form-actions .btn {
    width: auto;
    min-width: 130px;
}

.rich-text-upload-status {
    flex: 1 1 260px;
    margin: 0;
}

.admin-account-subtabs {
    margin-left: 20px !important;
    margin-right: 20px !important;
    max-width: calc(100% - 40px);
}

.admin-permission-fieldset {
    min-width: 0;
    margin: 6px 0 0;
    padding: 18px;
    border: 1px solid #dce3eb;
    border-radius: 12px;
    background: #f8fafc;
}

.admin-permission-fieldset legend {
    padding: 0 7px;
    color: #1e293b;
    font-size: 16px;
    font-weight: 800;
}

.admin-permission-fieldset > p {
    margin: -2px 0 14px;
    color: #64748b;
    font-size: 13px;
}

.admin-permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.admin-permission-option {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 13px 14px;
    border: 1px solid #dce3eb;
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
}

.admin-permission-option:has(input:checked) {
    border-color: #c4933b;
    background: #fffaf0;
    box-shadow: inset 0 0 0 1px rgba(196, 147, 59, .12);
}

.admin-permission-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--red);
}

.admin-permission-option input[disabled] {
    cursor: not-allowed;
}

.admin-permission-option span,
.admin-permission-option strong,
.admin-permission-option small {
    display: block;
    min-width: 0;
}

.admin-permission-option strong {
    color: #1e293b;
    font-size: 14px;
}

.admin-permission-option small {
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.admin-permission-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 210px;
    max-width: 520px;
}

.activity-overview-panel,
.activity-log-panel {
    display: grid;
    gap: 22px;
}

.activity-overview-panel .admin-panel-head,
.activity-log-panel .admin-panel-head {
    margin-bottom: 0;
}

.activity-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.activity-summary-card {
    min-width: 0;
    display: grid;
    gap: 5px;
    padding: 17px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.activity-summary-card.is-filtered {
    border-color: #e5c77c;
    background: #fffaf0;
}

.activity-summary-card span {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.activity-summary-card strong {
    color: #1e293b;
    font-size: clamp(24px, 3vw, 32px);
    line-height: 1.1;
}

.activity-summary-card small {
    color: #94a3b8;
    font-size: 12px;
}

.activity-account-summary {
    min-width: 0;
    display: grid;
    gap: 12px;
}

.activity-account-summary h3 {
    margin: 0;
    color: #334155;
    font-size: 16px;
}

.activity-account-table {
    min-width: 900px !important;
}

.activity-account-table td strong,
.activity-account-table td small {
    display: block;
}

.activity-account-table td small {
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
}

.activity-filter-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(160px, .8fr) minmax(140px, .65fr) minmax(140px, .65fr);
    align-items: end;
    gap: 14px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.activity-filter-form label {
    margin: 0;
}

.activity-filter-search {
    grid-column: span 2;
}

.activity-filter-actions {
    grid-column: span 2;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.activity-filter-actions .btn {
    min-width: 120px;
}

.activity-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #64748b;
    font-size: 13px;
}

.activity-result-head strong {
    color: #334155;
}

.activity-log-table {
    min-width: 980px !important;
}

.activity-log-table td {
    vertical-align: top;
}

.activity-time-cell {
    width: 112px;
    white-space: nowrap;
}

.activity-time-cell strong,
.activity-time-cell span,
.activity-actor-cell strong,
.activity-actor-cell span,
.activity-actor-cell small {
    display: block;
}

.activity-time-cell strong {
    color: #1e293b;
    font-size: 15px;
}

.activity-time-cell span,
.activity-actor-cell span,
.activity-actor-cell small {
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
}

.activity-actor-cell {
    min-width: 210px;
}

.activity-module-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid #dbe4ee;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.activity-action-cell {
    min-width: 360px;
}

.activity-action-cell > strong {
    color: #1e293b;
}

.activity-action-cell > p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.activity-log-details {
    margin-top: 9px;
}

.activity-log-details summary {
    width: fit-content;
    color: var(--red, #8c1d18);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.activity-log-details dl {
    display: grid;
    gap: 0;
    margin: 10px 0 0;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}

.activity-log-details dl > div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid #edf2f7;
}

.activity-log-details dl > div:last-child {
    border-bottom: 0;
}

.activity-log-details dt {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.activity-log-details dd {
    min-width: 0;
    margin: 0;
    color: #334155;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.activity-log-details code {
    margin-left: 5px;
    padding: 2px 5px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
}

.activity-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.activity-pagination span {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 980px) {
    .activity-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .activity-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .admin-account-subtabs {
        margin-left: 12px !important;
        margin-right: 12px !important;
        max-width: calc(100% - 24px);
    }

    .activity-summary-grid,
    .activity-filter-form {
        grid-template-columns: 1fr;
    }

    .activity-filter-search,
    .activity-filter-actions {
        grid-column: 1;
    }

    .activity-filter-actions {
        display: grid;
    }

    .activity-filter-actions .btn {
        width: 100%;
    }

    .activity-log-details dl > div {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}

.admin-form-actions .alert {
    margin: 0;
    flex: 1 1 auto;
    max-width: 650px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    border-radius: 8px;
}

.admin-category-form {
    margin-bottom: 22px;
}

.admin-category-form input {
    height: 42px;
}

.gallery-upload-form {
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf1;
}

}

.activity-time-cell strong,
.activity-time-cell span,
.activity-actor-cell strong,
.activity-actor-cell span,
.activity-actor-cell small {
    display: block;
}

.activity-time-cell strong {
    color: #1e293b;
    font-size: 15px;
}

.activity-time-cell span,
.activity-actor-cell span,
.activity-actor-cell small {
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
}

.activity-actor-cell {
    min-width: 210px;
}

.activity-module-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid #dbe4ee;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.activity-action-cell {
    min-width: 360px;
}

.activity-action-cell > strong {
    color: #1e293b;
}

.activity-action-cell > p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.activity-log-details {
    margin-top: 9px;
}

.activity-log-details summary {
    width: fit-content;
    color: var(--red, #8c1d18);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.activity-log-details dl {
    display: grid;
    gap: 0;
    margin: 10px 0 0;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}

.activity-log-details dl > div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid #edf2f7;
}

.activity-log-details dl > div:last-child {
    border-bottom: 0;
}

.activity-log-details dt {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.activity-log-details dd {
    min-width: 0;
    margin: 0;
    color: #334155;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.activity-log-details code {
    margin-left: 5px;
    padding: 2px 5px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
}

.activity-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.activity-pagination span {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 980px) {
    .activity-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .activity-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .admin-account-subtabs {
        margin-left: 12px !important;
        margin-right: 12px !important;
        max-width: calc(100% - 24px);
    }

    .activity-summary-grid,
    .activity-filter-form {
        grid-template-columns: 1fr;
    }

    .activity-filter-search,
    .activity-filter-actions {
        grid-column: 1;
    }

    .activity-filter-actions {
        display: grid;
    }

    .activity-filter-actions .btn {
        width: 100%;
    }

    .activity-log-details dl > div {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}

.admin-form-actions .alert {
    margin: 0;
    flex: 1 1 auto;
    max-width: 650px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    border-radius: 8px;
}

.admin-category-form {
    margin-bottom: 22px;
}

.admin-category-form input {
    height: 42px;
}

.gallery-upload-form {
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf1;
}

.gallery-upload-form .btn {
    min-height: 44px;
    justify-self: end;
}

.gallery-upload-method-selector {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.gallery-upload-method-option {
    position: relative;
    min-width: 0;
    cursor: pointer;
    margin: 0 !important;
}

.gallery-upload-method-option input {
    position: absolute;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    clip-path: inset(50%);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.gallery-upload-method-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    transition: all 0.2s ease;
    user-select: none;
}

.gallery-upload-method-card svg {
    width: 22px;
    height: 22px;
    margin-bottom: 6px;
    color: #64748b;
    transition: color 0.2s ease;
}

.gallery-upload-method-card span {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.gallery-upload-method-card small {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.gallery-upload-method-option input:checked + .gallery-upload-method-card {
    border-color: var(--red, #9c221b);
    background: #fdf6f6;
    box-shadow: 0 4px 14px rgba(156, 34, 27, 0.12);
}

.gallery-upload-method-option input:checked + .gallery-upload-method-card svg {
    color: var(--red, #9c221b);
}

.gallery-upload-field-panel {
    margin-bottom: 12px;
}

.gallery-upload-field-panel[hidden] {
    display: none !important;
}

.gallery-upload-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery-cover-source {
    min-width: 0;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf1;
}

.gallery-cover-source legend {
    padding: 0 6px;
    color: #202833;
    font-weight: 800;
}

.gallery-cover-source-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.gallery-cover-source-option {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    border: 1px solid #d8e0ea;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
}

.gallery-cover-source-option:has(input:checked) {
    border-color: var(--red);
    background: #fff3f1;
    color: var(--red);
}

.gallery-cover-source-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--red);
}

.gallery-cover-source-panel {
    display: grid;
    gap: 6px;
}

.gallery-cover-source-panel[hidden] {
    display: none;
}

.admin-subsection + .admin-subsection {
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}

.admin-subsection h3 {
    margin: 0 0 14px;
    font-size: 17px;
}

.admin-trash-photo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-trash-photo img {
    width: 54px;
    height: 42px;
    flex: 0 0 54px;
    border-radius: 5px;
    object-fit: cover;
    background: var(--wash);
}

.news-editor-field {
    min-width: 0;
}

.news-editor-field > label {
    display: block;
    margin-bottom: 8px;
}

.news-editor-field .ck-editor {
    width: 100%;
}

.news-editor-field .ck-editor__editable_inline {
    min-height: 360px !important;
}

.admin-trash-photo .gallery-media-placeholder.is-compact {
    width: 54px;
    height: 42px;
    flex: 0 0 54px;
    border-radius: 5px;
}

.admin-trash-photo .gallery-media-placeholder.is-compact svg { width: 24px; height: 24px; }

.intro-editor-field {
    min-width: 0;
}

.intro-editor-field > label {
    display: block;
    margin-bottom: 8px;
}

.intro-editor-field .ck-editor {
    width: 100%;
}

.intro-editor-field .ck-editor__editable_inline {
    min-height: 240px !important;
}

.intro-editor-field > small {
    display: block;
    margin-top: 8px;
}

.table-actions-heading {
    text-align: right;
}

.actions.actions-end {
    justify-content: flex-end;
}

.empty-table-cell {
    padding: 34px 16px;
    color: var(--muted);
    text-align: center;
}

.badge-draft {
    background: #f1f3f5;
    color: #59616c;
}

.badge-published {
    background: #e8f5ef;
    color: #24704f;
}

.badge-hidden {
    background: #fff1e7;
    color: #9b4b18;
}

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.admin-stat {
    padding: 18px;
}

/* Admin dashboard: quick status and review queue */
.admin-overview-head {
    align-items: flex-end;
}

.admin-overview-intro {
    margin: 8px 0 0;
    color: var(--muted);
}

.admin-overview-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid #ead5a5;
    border-radius: 999px;
    background: #fff8e7;
    color: #795612;
    white-space: nowrap;
}

.admin-overview-summary.has-pending {
    border-color: #ecc7b6;
    background: #fff3ed;
    color: #913b22;
}

.admin-overview-summary.is-clear {
    border-color: #bfddca;
    background: #edf8f1;
    color: #286344;
}

.admin-overview-summary-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 15%, transparent);
}

.admin-overview-summary strong {
    font-size: 17px;
    line-height: 1;
}

.admin-overview-summary > span:last-child {
    font-size: 13px;
    font-weight: 800;
}

.admin-attention-panel {
    overflow: hidden;
    min-width: 0;
    width: 100%;
    padding: 0;
}

.admin-attention-header,
.admin-data-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.admin-attention-header {
    padding: 20px 22px 18px;
    border-bottom: 1px solid #eee2d2;
    background:
        radial-gradient(circle at 92% 0%, rgba(184, 134, 47, .12), transparent 35%),
        #fffdf9;
}

.admin-section-kicker {
    margin: 0 0 3px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-attention-header h2,
.admin-data-heading h2,
.admin-recent-head h2 {
    margin: 0;
}

.admin-attention-header p:last-child,
.admin-data-heading > p,
.admin-recent-head p:last-child {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.footer-technical-support {
    color: inherit;
    font-weight: 600;
}

.footer-technical-support:hover,
.footer-technical-support:focus-visible {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.admin-attention-total {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 5px 11px;
    border-radius: 999px;
    background: #fee9e3;
    color: #9b372e;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.admin-attention-total.is-clear {
    background: #e8f5ed;
    color: #276448;
}

.admin-attention-grid {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    padding: 18px 20px;
}

.admin-attention-card {
    position: relative;
    min-width: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 1px 12px;
    min-height: 96px;
    padding: 14px 42px 14px 14px;
    border: 1px solid #e4d7c5;
    border-radius: 10px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.admin-attention-card:hover,
.admin-attention-card:focus-visible {
    border-color: #cda85e;
    box-shadow: 0 10px 24px rgba(68, 40, 18, .1);
    transform: translateY(-2px);
    outline: none;
}

.admin-attention-card.has-pending {
    border-color: #e2bdac;
    background: linear-gradient(135deg, #fff 45%, #fff7f2 100%);
}

.admin-attention-icon {
    grid-row: 1 / 3;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #f2e4cc;
    color: #8c5e18;
}

.admin-attention-card.type-family .admin-attention-icon {
    background: #f8dfdc;
    color: var(--red);
}

.admin-attention-card.type-gallery .admin-attention-icon {
    background: #e5f0f5;
    color: #2b627a;
}

.admin-attention-card.is-clear .admin-attention-icon {
    background: #e7f4eb;
    color: #2b6849;
}

.admin-attention-icon svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.admin-attention-copy {
    grid-column: 2;
    min-width: 0;
    align-self: end;
}

.admin-attention-copy strong,
.admin-attention-copy small {
    display: block;
}

.admin-attention-copy strong {
    color: var(--ink);
    font-size: 14px;
    line-height: 1.3;
}

.admin-attention-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.admin-attention-count {
    grid-column: 3;
    grid-row: 1 / 3;
    min-width: 34px;
    color: var(--red);
    font-size: 27px;
    font-weight: 900;
    line-height: 1;
    text-align: right;
}

.admin-attention-card.is-clear .admin-attention-count {
    color: #3c7656;
}

.admin-attention-arrow {
    position: absolute;
    right: 14px;
    bottom: 12px;
    color: #a18466;
    font-weight: 900;
}

.admin-pending-feed {
    border-top: 1px solid #eee2d2;
    padding: 17px 20px 20px;
    background: #fffcf7;
}

.admin-pending-feed-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.admin-pending-feed-head h3 {
    margin: 0;
    font-size: 15px;
}

.admin-pending-feed-head span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.admin-pending-list {
    overflow: hidden;
    border: 1px solid #eadfce;
    border-radius: 9px;
    background: #fff;
}

.admin-pending-item {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr) auto 18px;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 9px 13px;
    border-bottom: 1px solid #eee5d8;
    transition: background .18s ease;
}

.admin-pending-item:last-child {
    border-bottom: 0;
}

.admin-pending-item:hover,
.admin-pending-item:focus-visible {
    background: #fff8ee;
    outline: none;
}

.admin-pending-type {
    display: inline-flex;
    justify-content: center;
    padding: 4px 7px;
    border-radius: 999px;
    background: #f2e4cc;
    color: #795516;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.25;
}

.admin-pending-type.type-family {
    background: #f9e4e1;
    color: #96352f;
}

.admin-pending-type.type-gallery {
    background: #e6f0f5;
    color: #2b627a;
}

.admin-pending-copy {
    min-width: 0;
}

.admin-pending-copy strong,
.admin-pending-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-pending-copy strong {
    color: #3d3027;
    font-size: 13px;
}

.admin-pending-copy small,
.admin-pending-item time {
    color: var(--muted);
    font-size: 11px;
}

.admin-pending-item time {
    white-space: nowrap;
}

.admin-pending-open {
    color: var(--red);
    font-weight: 900;
}

.admin-pending-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #e2ecdf;
    background: #f5fbf7;
}

.admin-pending-empty > span {
    width: 36px;
    height: 36px;
    display: grid;
    flex: 0 0 36px;
    place-items: center;
    border-radius: 50%;
    background: #dcefe3;
    color: #286344;
    font-weight: 900;
}

.admin-pending-empty strong {
    color: #285b40;
}

.admin-pending-empty p {
    margin: 2px 0 0;
    color: #5b7565;
    font-size: 12px;
}

.admin-data-overview {
    min-width: 0;
    display: grid;
    gap: 12px;
}

.admin-data-overview .admin-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-data-heading {
    align-items: center;
    padding: 0 2px;
}

.admin-data-heading > p {
    text-align: right;
}

.admin-stat-link {
    position: relative;
    min-height: 100px;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.admin-stat-link:hover,
.admin-stat-link:focus-visible {
    border-color: #d0ad6d;
    box-shadow: 0 13px 30px rgba(24, 31, 42, .12);
    transform: translateY(-2px);
    outline: none;
}

.admin-stat-arrow {
    position: absolute;
    right: 15px;
    bottom: 12px;
    color: #aa8c6d !important;
}

.admin-recent-panel {
    min-width: 0;
    padding-top: 18px;
}

.admin-recent-head {
    margin-bottom: 12px;
}

@media (max-width: 620px) {
    .gallery-album-toolbar { align-items: stretch; flex-direction: column; }
    .gallery-media-filters { width: 100%; }
    .gallery-media-filters a { flex: 1; justify-content: center; padding-inline: 8px; }
    .admin-overview-summary {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }

    .admin-attention-header,
    .admin-data-heading {
        display: grid;
        align-items: start;
    }

    .admin-attention-total {
        justify-self: start;
    }

    .admin-attention-grid {
        grid-template-columns: minmax(0, 1fr);
        padding: 14px;
    }

    .admin-attention-card {
        min-height: 92px;
    }

    .admin-pending-feed {
        padding: 15px 14px 16px;
    }

    .admin-pending-feed-head {
        display: grid;
        gap: 2px;
    }

    .admin-pending-item {
        grid-template-columns: 68px minmax(0, 1fr) 14px;
        grid-template-rows: auto auto;
        gap: 1px 9px;
        padding: 11px 10px;
    }

    .admin-pending-type {
        grid-column: 1;
        grid-row: 1 / 3;
    }

    .admin-pending-copy {
        grid-column: 2;
        grid-row: 1;
    }

    .admin-pending-item time {
        grid-column: 2;
        grid-row: 2;
    }

    .admin-pending-open {
        grid-column: 3;
        grid-row: 1 / 3;
    }

    .admin-data-heading > p {
        text-align: left;
    }

    .admin-data-overview .admin-stat-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-pending-empty {
        align-items: flex-start;
        justify-content: flex-start;
        padding-inline: 16px;
    }
}

.admin-form {
    display: grid;
    gap: 14px;
}

.member-detail-head {
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid #edf0f3;
}

.member-edit-title h2 {
    margin-bottom: 4px;
}

.member-edit-title .muted {
    margin: 0;
    font-size: 14px;
}

#member-detail {
    scroll-margin-top: 96px;
}

.member-delete-form {
    margin: 0;
}

.member-edit-form {
    gap: 0;
    min-width: 0;
}

.member-edit-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    align-items: start;
    gap: 22px;
}

.member-edit-preview {
    min-width: 0;
    align-self: stretch;
}

.member-edit-preview-inner {
    position: sticky;
    top: 96px;
    display: grid;
    gap: 10px;
    padding-top: 18px;
}

.member-edit-preview-card {
    overflow: hidden;
    border: 1px solid #d8e0ea;
    border-top: 5px solid var(--red);
    border-radius: 8px;
    background: #ffffff;
}

.member-edit-preview-card.is-living {
    border-top-color: var(--green);
}

.member-edit-preview-card.is-deceased {
    border-top-color: var(--red);
}

.member-edit-preview-main {
    display: grid;
    gap: 7px;
    padding: 13px 14px 14px;
    transition: opacity .18s ease, filter .18s ease;
}

.member-edit-preview-main.is-muted {
    opacity: .34;
    filter: grayscale(1);
}

.member-edit-preview-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.member-edit-preview-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid #eadcc8;
    border-radius: 999px;
    background: #fffaf1;
    color: #7b271f;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.member-edit-preview-card.is-living .member-edit-preview-status {
    border-color: #b7dacd;
    background: #edf8f3;
    color: var(--green);
}

.member-edit-preview-main h3 {
    margin: 0;
    color: #111827;
    font-size: 18px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.member-edit-preview-main p {
    margin: 0;
    color: #667085;
    font-size: 13px;
    line-height: 1.35;
}

.member-edit-preview-spouses {
    display: grid;
    gap: 7px;
    padding: 0 12px 13px;
}

.member-edit-preview-spouse {
    display: grid;
    gap: 2px;
    padding: 7px 10px;
    border: 1px solid #eadcc8;
    border-radius: 10px;
    background: #fffaf1;
    color: #7b271f;
    transition: opacity .18s ease, filter .18s ease, border-color .18s ease, background-color .18s ease;
}

.member-edit-preview-spouse span {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.member-edit-preview-spouse strong {
    font-size: 13px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.member-edit-preview-spouse.is-muted {
    opacity: .28;
    filter: grayscale(1);
}

.member-edit-preview-spouse.is-active {
    border-color: var(--red);
    background: #fff4d8;
    color: var(--red);
    opacity: 1;
    filter: none;
}

.member-edit-preview-note {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.member-form-section {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 26px;
    padding: 22px 0;
    border-bottom: 1px solid #edf0f3;
}

.member-section-copy h3 {
    margin: 0;
    color: #202833;
    font-size: 15px;
}

.member-section-copy p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.member-form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px 16px;
    align-items: start;
}

.member-form-grid label {
    min-width: 0;
    color: #202833;
    font-size: 14px;
}

.member-form-grid input,
.member-form-grid select,
.member-form-grid textarea {
    margin-top: 6px;
}

.member-form-grid select[multiple] {
    min-height: 112px;
}

.field-help {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
}

.member-parent-field {
    /* Remove display: grid to behave like standard form columns */
}

.member-parent-readonly,
.member-parent-select {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-top: 6px; /* Match default 6px margin-top below label */
}

.member-parent-readonly[hidden],
.member-parent-select[hidden] {
    display: none;
}

.member-parent-readonly input,
.member-parent-select select {
    flex: 1 1 auto;
    min-width: 0;
    margin-top: 0 !important; /* Reset default input margin-top to prevent alignment shifting */
}

.member-parent-readonly-input {
    background-color: #f1f5f9;
    cursor: not-allowed;
}

.member-parent-edit-button,
.member-parent-cancel-button {
    flex: 0 0 auto;
    margin-top: 0 !important; /* Reset margin-top to align vertically with input */
}

.member-spouse-field {
    display: grid;
    gap: 8px;
}

.member-spouse-manager {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.member-spouse-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    background-color: var(--card-bg, #fff);
    max-height: 180px;
    overflow-y: auto;
}

.member-spouse-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    font-size: 14px;
}

.member-spouse-item:last-child {
    border-bottom: none;
}

.member-spouse-name {
    flex-grow: 1;
    margin-right: 12px;
    color: var(--text-color, #1e293b);
}

.member-spouse-item-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.member-spouse-item-buttons .btn {
    padding: 4px 8px;
    min-height: 28px;
    line-height: 1;
    font-size: 12px;
}

.member-spouse-empty {
    padding: 16px;
    text-align: center;
    color: var(--muted, #64748b);
    font-style: italic;
    font-size: 14px;
}

.member-spouse-actions-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

body.admin-spouse-modal-open {
    overflow: hidden;
}

.admin-spouse-add-modal[hidden] {
    display: none;
}

.admin-spouse-add-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    padding: 20px;
}

.admin-spouse-add-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(42, 24, 15, .52);
    backdrop-filter: blur(4px);
    cursor: default;
}

.admin-spouse-add-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 460px);
    padding: 28px;
    border: 1px solid #ead5b5;
    border-top: 4px solid var(--red, #961f1a);
    border-radius: 16px;
    background: #fffdf9;
    box-shadow: 0 24px 70px rgba(42, 24, 15, .3);
}

.admin-spouse-add-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #e6d3b8;
    border-radius: 50%;
    background: #fff;
    color: #6f6257;
    font: 400 26px/1 Arial, sans-serif;
    cursor: pointer;
}

.admin-spouse-add-close:hover,
.admin-spouse-add-close:focus-visible {
    border-color: var(--red, #961f1a);
    color: var(--red, #961f1a);
}

.admin-spouse-add-eyebrow {
    margin: 0 44px 8px 0;
    color: #b4822b;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
}

.admin-spouse-add-title {
    margin: 0 44px 8px 0;
    color: var(--red, #961f1a);
    font-family: var(--family-tree-font, Georgia, serif);
    font-size: 25px;
    line-height: 1.25;
}

.admin-spouse-add-message {
    margin: 0 0 20px;
    color: #6f6257;
    font-size: 14px;
    line-height: 1.55;
}

.admin-spouse-add-label {
    display: block;
    margin-bottom: 7px;
    color: #342a23;
    font-weight: 700;
}

.admin-spouse-add-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid #dcc8a9;
    border-radius: 9px;
    background: #fff;
    color: #2e241d;
    font: inherit;
}

.admin-spouse-add-input:focus {
    border-color: var(--red, #961f1a);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(150, 31, 26, .12);
}

.admin-spouse-add-input[aria-invalid="true"] {
    border-color: #c62828;
}

.admin-spouse-add-error {
    margin: 7px 0 0;
    color: #b42318;
    font-size: 13px;
}

.admin-spouse-add-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.admin-spouse-add-confirm {
    background: var(--red, #961f1a);
    border-color: var(--red, #961f1a);
    color: #fff;
}

@media (max-width: 520px) {
    .admin-spouse-add-modal {
        align-items: end;
        padding: 12px;
    }

    .admin-spouse-add-dialog {
        width: 100%;
        padding: 24px 20px 20px;
        border-radius: 16px 16px 12px 12px;
    }

    .admin-spouse-add-actions .btn {
        flex: 1;
    }
}

.member-spouse-readonly {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spouse-readonly-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    background-color: var(--card-bg, #f8fafc);
    font-size: 14px;
}

.spouse-readonly-name {
    color: var(--text-color, #1e293b);
}

.member-form-grid textarea {
    min-height: 150px;
}

.field-span-3 {
    grid-column: span 3;
}

.field-span-4 {
    grid-column: span 4;
}

.field-span-5 {
    grid-column: span 5;
}

.field-span-6 {
    grid-column: span 6;
}

.field-span-9 {
    grid-column: span 9;
}

.field-span-12 {
    grid-column: 1 / -1;
}

.member-deceased-toggle {
    min-height: 44px;
    align-self: end;
    padding: 10px 0;
}

.member-life-status-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    min-height: 46px;
    margin-top: -12px;
}

.member-life-status-options .member-deceased-toggle,
.member-life-status-options .member-died-young-toggle {
    display: flex;
    align-items: center;
    align-self: center;
    min-height: 46px !important;
    margin: 0;
    padding: 0;
}

.member-life-status-options .member-deceased-toggle label {
    min-height: 46px;
    margin: 0;
}

.member-life-status-options input[type="checkbox"] {
    margin: 0;
}

.member-deceased-toggle input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.member-search-result-title {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    color: #1e293b;
    font-size: 13px;
    font-weight: 800;
}

.member-search-disambiguator {
    color: #8a5a1e;
    font-size: .86em;
    font-weight: 800;
}

.member-search-result-meta {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: 11px;
}

/* Public header uses the same ceremonial red/gold palette as admin. */
.site-header {
    background: var(--red);
    border-bottom-color: rgba(0, 0, 0, .1);
    box-shadow: 0 4px 14px rgba(110, 18, 18, .18);
}

.public-brand-logo .cls-1 {
    fill: #f7d08a;
    transition: fill .2s ease;
}

.brand:hover .public-brand-logo .cls-1,
.brand:focus-visible .public-brand-logo .cls-1 {
    fill: #fff2ce;
}

.site-header .main-nav > a:not(.btn) {
    color: rgba(255, 255, 255, .86);
}

.site-header .main-nav > a:not(.btn):hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.site-header .main-nav > .btn-outline {
    border-color: rgba(247, 208, 138, .72);
    background: transparent;
    color: #fff4dc;
}

.site-header .main-nav > .btn-outline:hover {
    border-color: #f7d08a;
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.site-header .main-nav > .btn:not(.btn-outline) {
    border-color: #f7d08a;
    background: #f7d08a;
    color: var(--red-dark);
    font-weight: 800;
}

.site-header .main-nav > .btn:not(.btn-outline):hover {
    border-color: #fff0c9;
    background: #fff0c9;
    color: var(--red-dark);
}

.site-header .site-account-toggle {
    color: #fff;
}

.site-header .site-account-toggle:hover,
.site-header .site-account-toggle[aria-expanded="true"] {
    border-color: rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .11);
    box-shadow: 0 8px 20px rgba(68, 10, 10, .12);
}

.site-header .site-account-toggle .site-account-avatar {
    background: #f7d08a;
    color: var(--red);
}

.site-header .site-account-toggle .site-account-copy span {
    color: #fff;
}

.site-header .site-account-toggle .site-account-copy small {
    color: rgba(255, 255, 255, .7);
}

.site-header .site-account-toggle .site-account-chevron {
    color: #f7d08a;
}

.site-header .nav-toggle {
    border: 1px solid rgba(247, 208, 138, .5);
    background: rgba(255, 255, 255, .1);
    color: #fff3d6;
}

.member-died-young-toggle select {
    width: min(220px, 100%);
    min-width: min(190px, 100%);
    max-width: 100%;
    min-height: 46px;
    margin-top: 0;
    border-color: #fecaca;
    color: #dc2626;
    font-weight: 600;
    cursor: pointer;
}

.date-unknown-toggle {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.member-birth-place-field {
    grid-column: 1 / span 6;
}

.member-deceased-field[hidden] {
    display: none;
}

.member-avatar-field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.member-avatar-preview {
    width: 118px;
    height: 118px;
    overflow: hidden;
    border: 1px solid #eadcc8;
    border-radius: 8px;
    background: #fffaf1;
    box-shadow: 0 8px 18px rgba(68, 40, 18, .08);
}

.member-avatar-preview[hidden] {
    display: none;
}

.member-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 18px;
}

.member-form-actions .btn {
    width: auto;
    min-width: 120px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

/* Anniversary settings: large, accessible calendar and leap-month choices. */
.anniversary-settings-form {
    gap: 24px;
}

.anniversary-title-field {
    width: min(100%, 680px);
}

.anniversary-title-field input {
    min-height: 48px;
}

.anniversary-calendar-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.anniversary-calendar-fieldset legend {
    padding: 0;
    color: var(--ink);
    font-weight: 800;
}

.anniversary-calendar-fieldset > p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.anniversary-calendar-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 320px));
    gap: 12px;
    margin-top: 12px;
}

.anniversary-calendar-option {
    position: relative;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 12px;
    min-height: 82px;
    padding: 14px 15px;
    border: 1px solid #d8e0ea;
    border-radius: 12px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.anniversary-calendar-option:hover {
    border-color: #c8a764;
    background: #fffdf8;
    transform: translateY(-1px);
}

.anniversary-choice-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.anniversary-calendar-option:has(.anniversary-choice-input:focus-visible),
.anniversary-leap-option:has(.anniversary-choice-input:focus-visible) {
    outline: 3px solid rgba(140, 29, 24, .18);
    outline-offset: 2px;
}

.anniversary-calendar-option:has(.anniversary-choice-input:checked) {
    border-color: #a7332d;
    background: linear-gradient(135deg, #fff9f2 0%, #fffdf9 100%);
    box-shadow: inset 0 0 0 1px rgba(140, 29, 24, .09), 0 8px 22px rgba(89, 48, 22, .08);
}

.anniversary-calendar-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: #f7f3eb;
    color: #927032;
    transition: background-color .18s ease, color .18s ease;
}

.anniversary-calendar-icon svg {
    width: 24px;
    height: 24px;
}

.anniversary-calendar-option:has(.anniversary-choice-input:checked) .anniversary-calendar-icon {
    background: #8c1d18;
    color: #fff8e8;
}

.anniversary-calendar-copy {
    min-width: 0;
}

.anniversary-calendar-copy strong,
.anniversary-calendar-copy small {
    display: block;
}

.anniversary-calendar-copy strong {
    color: #1e293b;
    font-size: 15px;
    line-height: 1.35;
}

.anniversary-calendar-copy small {
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.anniversary-radio-indicator {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    background: #fff;
    transition: border-color .18s ease;
}

.anniversary-radio-indicator::after {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #8c1d18;
    opacity: 0;
    transform: scale(.5);
    transition: opacity .18s ease, transform .18s ease;
}

.anniversary-calendar-option:has(.anniversary-choice-input:checked) .anniversary-radio-indicator {
    border-color: #8c1d18;
}

.anniversary-calendar-option:has(.anniversary-choice-input:checked) .anniversary-radio-indicator::after {
    opacity: 1;
    transform: scale(1);
}

.anniversary-date-panel {
    max-width: 920px;
    padding: 20px;
    border: 1px solid #e1e7ef;
    border-radius: 12px;
    background: #f8fafc;
}

.anniversary-date-panel-head {
    display: grid;
    gap: 3px;
    margin-bottom: 16px;
    padding-bottom: 13px;
    border-bottom: 1px solid #e2e8f0;
}

.anniversary-date-panel-head strong {
    color: #27364a;
    font-size: 15px;
}

.anniversary-date-panel-head span {
    color: #64748b;
    font-size: 12px;
}

.anniversary-solar-date-field {
    width: min(100%, 360px);
}

.anniversary-solar-date-field input,
.anniversary-lunar-fields select {
    min-height: 46px;
    border-color: #cfd8e3;
    background-color: #fff;
}

.anniversary-lunar-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 220px)) minmax(250px, 310px);
    align-items: end;
    gap: 14px;
}

.anniversary-leap-option {
    position: relative;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 8px 12px;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.anniversary-leap-option:hover {
    border-color: #c8a764;
    background: #fffdf8;
}

.anniversary-leap-option:has(.anniversary-choice-input:checked) {
    border-color: #a7332d;
    background: #fff9f2;
    box-shadow: inset 0 0 0 1px rgba(140, 29, 24, .07);
}

.anniversary-checkbox-indicator {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    transition: border-color .18s ease, background-color .18s ease;
}

.anniversary-checkbox-indicator::after {
    content: "";
    width: 9px;
    height: 5px;
    margin-top: -2px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    opacity: 0;
    transform: rotate(-45deg) scale(.7);
    transition: opacity .18s ease, transform .18s ease;
}

.anniversary-leap-option:has(.anniversary-choice-input:checked) .anniversary-checkbox-indicator {
    border-color: #8c1d18;
    background: #8c1d18;
}

.anniversary-leap-option:has(.anniversary-choice-input:checked) .anniversary-checkbox-indicator::after {
    opacity: 1;
    transform: rotate(-45deg) scale(1);
}

.anniversary-leap-copy strong,
.anniversary-leap-copy small {
    display: block;
}

.anniversary-leap-copy strong {
    color: #334155;
    font-size: 13px;
    line-height: 1.25;
}

.anniversary-leap-copy small {
    margin-top: 2px;
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
}

.anniversary-conversion-result {
    width: fit-content;
    max-width: 100%;
    margin: 14px 0 0;
    padding: 9px 12px;
    border: 1px solid #e5d6b9;
    border-radius: 8px;
    background: #fffaf0;
    color: #6e4a18;
    font-size: 12px;
    line-height: 1.45;
}

.anniversary-conversion-result:empty {
    display: none;
}

.anniversary-conversion-result strong {
    font-weight: 700;
}

@media (max-width: 720px) {
    .anniversary-calendar-options,
    .anniversary-lunar-fields {
        grid-template-columns: 1fr;
    }

    .anniversary-date-panel {
        padding: 16px;
    }

    .anniversary-solar-date-field {
        width: 100%;
    }
}

/* Keep announcement controls aligned when only some fields have helper text. */
.announcement-form-grid > label {
    min-width: 0;
    align-self: start;
    align-content: start;
}

.announcement-form-grid > label > input,
.announcement-form-grid > label > select {
    height: 48px;
}

.donation-quick-form {
    gap: 18px;
}

.donation-entry-section {
    display: grid;
    gap: 18px;
    padding: 20px;
    border: 1px solid #e5d8c5;
    border-radius: 12px;
    background: #fffdf9;
}

.donation-entry-section-optional {
    background: #fcfaf6;
}

.donation-entry-section-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eee3d3;
}

.donation-entry-section-head h3 {
    margin: 0 0 4px;
    color: #7f1d1d;
    font-size: 18px;
}

.donation-entry-section-head p {
    margin: 0;
    color: var(--muted, #64748b);
    font-size: 13px;
    line-height: 1.5;
}

.donation-entry-step {
    display: grid;
    flex: 0 0 30px;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--red, #8c1d18);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}

.donation-entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.donation-entry-grid > label {
    align-self: start;
    align-content: start;
}

.donation-entry-grid > [hidden] {
    display: none !important;
}

.donation-member-picker {
    display: grid;
    align-content: start;
    gap: 7px;
    min-width: 0;
}

.donation-member-picker > label {
    margin: 0;
}

.donation-member-picker select {
    margin-top: 0;
}

.field-optional {
    display: inline-flex;
    justify-self: start;
    width: fit-content;
    margin-left: 5px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #f4ede2;
    color: #75685c;
    font-size: 11px;
    font-weight: 700;
    vertical-align: middle;
}

.donation-member-picker .field-help {
    min-height: 19px;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.45;
}

.donation-anonymous-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: fit-content;
    padding: 12px 14px;
    border: 1px solid #e5d8c5;
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
}

.donation-anonymous-option input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
}

.donation-anonymous-option span {
    display: grid;
    gap: 2px;
}

.donation-anonymous-option small {
    color: var(--muted, #64748b);
    font-weight: 400;
}

.donation-submit-button[disabled] {
    cursor: wait;
    opacity: .72;
}

@media (max-width: 720px) {
    .donation-entry-section {
        padding: 16px;
    }

    .donation-entry-grid {
        grid-template-columns: 1fr;
    }

    .donation-entry-grid .field-span-full {
        grid-column: 1;
    }

    .donation-anonymous-option {
        width: 100%;
    }
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-line input {
    width: auto;
}

.campaign-featured-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.campaign-featured-title {
    color: var(--ink);
    font-weight: 700;
}

.campaign-featured-option {
    display: flex;
    align-items: center;
    justify-self: start;
    gap: 10px;
    width: auto;
    max-width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
    color: #3c3028;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .16s ease, background-color .16s ease;
}

.campaign-featured-option:hover {
    border-color: #c7a56d;
    background: #fffaf1;
}

.campaign-featured-option:has(input:checked) {
    border-color: rgba(140, 29, 24, .42);
    background: #fff7f2;
}

.campaign-featured-option input[type="checkbox"] {
    appearance: auto;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 3px;
    box-shadow: none;
    accent-color: var(--red);
    cursor: pointer;
}

.campaign-featured-option input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(140, 29, 24, .28);
    outline-offset: 2px;
}

.donation-bank-admin-card {
    min-width: 0;
    margin: 4px 0 0;
    padding: 20px;
    border: 1px solid #e6d8c4;
    border-radius: 10px;
    background: #fffcf7;
}

.donation-bank-admin-card legend {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
}

.donation-bank-admin-card legend small {
    padding: 4px 8px;
    border-radius: 999px;
    background: #f3ead9;
    color: #845b20;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.donation-bank-admin-card > p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.donation-bank-admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    gap: 22px;
    align-items: start;
}

.donation-bank-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.donation-bank-fields > label,
.donation-qr-upload-field > label:first-child {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-weight: 700;
}

.donation-bank-fields label > small {
    color: var(--muted);
    font-weight: 500;
}

.donation-bank-fields-note {
    grid-column: 1 / -1;
    color: var(--muted);
    line-height: 1.5;
}

.donation-qr-upload-field {
    display: grid;
    gap: 9px;
}

.donation-qr-preview {
    display: grid;
    place-items: center;
    width: min(100%, 250px);
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px dashed #cfb98f;
    border-radius: 10px;
    background: #fff;
}

.donation-qr-preview img {
    width: 100%;
    height: 100%;
    padding: 10px;
    object-fit: contain;
}

.donation-qr-preview img[hidden],
.donation-qr-preview-empty[hidden] {
    display: none !important;
}

.donation-qr-preview-empty {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 18px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.donation-qr-placeholder-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border: 2px solid #c9aa72;
    border-radius: 12px;
    color: #9b211b;
    background:
        linear-gradient(90deg, rgba(155, 33, 27, .1) 1px, transparent 1px) 0 0 / 9px 9px,
        linear-gradient(rgba(155, 33, 27, .1) 1px, transparent 1px) 0 0 / 9px 9px,
        #fffaf1;
    box-shadow: 0 8px 20px rgba(82, 55, 26, .1);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.04em;
}

.donation-qr-upload-field input[type="file"] {
    min-width: 0;
    padding: 8px;
    background: #fff;
}

.donation-qr-upload-field > small {
    color: var(--muted);
    line-height: 1.45;
}

.donation-qr-upload-field > small.is-error {
    color: #b42318;
    font-weight: 700;
}

.donation-qr-upload-field > small.is-ready {
    color: #18794e;
    font-weight: 700;
}

.donation-qr-remove-option {
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center;
    justify-self: start;
    gap: 8px !important;
    color: #8c1d18 !important;
    font-size: 13px;
    cursor: pointer;
}

.donation-qr-remove-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--red);
}

.donation-account-selector {
    display: grid;
    gap: 18px;
    padding: 20px;
    border: 1px solid #e6d8c4;
    border-radius: 10px;
    background: #fffcf7;
}

.donation-account-selector-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.donation-account-selector-heading h3 {
    margin: 0;
    color: var(--ink);
    font-size: 17px;
}

.donation-account-selector-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.donation-account-selector-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, .7fr);
    gap: 18px;
    align-items: stretch;
}

.donation-account-selector-fields {
    display: grid;
    gap: 14px;
}

.donation-account-selector-fields > label {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-weight: 700;
}

.donation-account-selector-fields label small,
.donation-account-selector-fields > small {
    color: var(--muted);
    font-weight: 500;
}

.donation-account-selected-preview {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    min-width: 0;
    padding: 14px;
    border: 1px solid #dfc99f;
    border-radius: 10px;
    background: #fff;
}

.donation-account-selected-preview[hidden] {
    display: none;
}

.donation-account-selected-preview img {
    width: 112px;
    height: 112px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: contain;
}

.donation-account-selected-preview > div {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.donation-account-selected-preview strong {
    color: var(--red-dark);
    font-size: 16px;
}

.donation-account-selected-preview span {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.donation-account-selected-preview b {
    color: var(--ink);
    font-size: 18px;
    overflow-wrap: anywhere;
}

.donation-account-empty {
    margin: 0;
}

.donation-bank-qr-thumb {
    display: inline-grid;
    place-items: center;
    width: 54px;
    height: 54px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}

.donation-bank-qr-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.donation-bank-account-table td {
    vertical-align: middle;
}

.donation-bank-account-table .btn:disabled {
    cursor: not-allowed;
    opacity: .45;
}

@media (max-width: 900px) {
    .donation-bank-admin-layout {
        grid-template-columns: 1fr;
    }

    .donation-account-selector-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .donation-bank-admin-card {
        padding: 16px 12px;
    }

    .donation-bank-fields {
        grid-template-columns: 1fr;
    }

    .donation-bank-fields-note {
        grid-column: auto;
    }

    .donation-account-selector {
        padding: 16px 12px;
    }

    .donation-account-selector-heading {
        flex-direction: column;
    }

    .donation-account-selected-preview {
        grid-template-columns: 84px minmax(0, 1fr);
    }

    .donation-account-selected-preview img {
        width: 84px;
        height: 84px;
    }
}

.member-branch-root-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    color: #8a5709 !important;
    font-weight: 600 !important;
    cursor: pointer;
    user-select: none;
}

.member-branch-root-label input {
    width: 22px;
    height: 22px;
    margin: 0;
    cursor: pointer;
}

.member-branch-root-note {
    color: #586579;
    font-weight: 500;
}

.member-help-trigger {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #c58a28;
    border-radius: 50%;
    background: #fffdf8;
    color: #8a5709;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.member-help-trigger:hover,
.member-help-trigger:focus-visible {
    border-color: var(--red);
    background: #fff4f1;
    color: var(--red);
    outline: none;
}

.member-help-modal[hidden] {
    display: none;
}

.member-help-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(24, 31, 42, .56);
}

.member-help-dialog {
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 22px;
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .24);
}

.member-help-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.member-help-head h3 {
    margin: 2px 0 0;
    color: #172033;
    font-size: 20px;
    line-height: 1.3;
}

.member-help-close {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #d8e0ea;
    border-radius: 7px;
    background: #fff;
    color: #536174;
    cursor: pointer;
}

.member-help-close:hover,
.member-help-close:focus-visible {
    border-color: var(--red);
    color: var(--red);
    outline: none;
}

.member-help-intro {
    margin: 14px 0 16px;
    color: #3f4b5e;
    line-height: 1.55;
}

.member-help-points {
    display: grid;
    gap: 12px;
    padding: 15px 0;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.member-help-points p {
    display: grid;
    grid-template-columns: 145px minmax(0, 1fr);
    gap: 12px;
    margin: 0;
    color: #465267;
    line-height: 1.5;
}

.member-help-points strong {
    color: #172033;
}

.member-help-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

body.has-member-help-modal {
    overflow: hidden;
}

@media (max-width: 560px) {
    .member-help-dialog {
        padding: 18px;
    }

    .member-help-points p {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}

.inline-form,
.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-form input,
.search-form input {
    width: min(340px, 100%);
}

.donation-list-filters {
    display: grid;
    grid-template-columns: minmax(240px, 360px) minmax(130px, 160px) minmax(300px, 1fr) auto auto;
    width: 100%;
}

.donation-list-filters select,
.donation-list-filters .donation-list-filter-search {
    width: 100%;
    min-width: 0;
}

@media (max-width: 960px) {
    .donation-list-filters {
        grid-template-columns: minmax(0, 1fr) 150px auto auto;
    }

    .donation-list-filter-search {
        grid-column: 1 / 3;
    }
}

@media (max-width: 620px) {
    .donation-list-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .donation-list-filter-campaign,
    .donation-list-filter-type,
    .donation-list-filter-search {
        grid-column: 1 / -1;
    }

    .donation-list-filters .btn {
        width: 100%;
    }
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.actions form {
    display: inline;
}

.admin-password-modal[hidden] {
    display: none !important;
}

.admin-password-modal {
    position: fixed;
    z-index: 10020;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
}

.admin-password-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 19, 15, .62);
    backdrop-filter: blur(7px);
    animation: flashFadeIn .18s ease both;
}

.admin-password-modal-card {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: calc(100vh - 44px);
    overflow: auto;
    padding: 30px;
    border: 1px solid rgba(180, 120, 24, .42);
    border-radius: 16px;
    background: #fffdf9;
    box-shadow: 0 26px 80px rgba(28, 22, 18, .3);
    animation: flashScaleIn .22s cubic-bezier(.2, .8, .2, 1) both;
}

.admin-password-modal-card:focus {
    outline: none;
}

.admin-password-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font-size: 23px;
    line-height: 1;
}

.admin-password-modal-close:hover,
.admin-password-modal-close:focus-visible {
    border-color: var(--red);
    color: var(--red);
}

.admin-password-modal-head {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 15px;
    align-items: center;
    padding-right: 36px;
}

.admin-password-modal-head .eyebrow {
    margin: 0 0 3px;
}

.admin-password-modal-head h2 {
    margin: 0;
    color: var(--red-dark);
    font-family: var(--serif);
    font-size: 29px;
    line-height: 1.15;
}

.admin-password-modal-head p:last-child {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.admin-password-modal-icon {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 14px;
    background: rgba(140, 29, 24, .09);
    color: var(--red);
}

.admin-password-modal-icon svg {
    width: 27px;
    height: 27px;
}

.admin-password-account-summary {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    margin: 24px 0 20px;
    padding: 13px 15px;
    border: 1px solid rgba(47, 111, 94, .2);
    border-radius: 11px;
    background: rgba(47, 111, 94, .06);
}

.admin-password-account-summary > span:last-child {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.admin-password-account-summary strong,
.admin-password-account-summary small {
    overflow-wrap: anywhere;
}

.admin-password-account-summary strong {
    color: var(--green);
}

.admin-password-account-summary small {
    color: var(--muted);
}

.admin-password-account-avatar {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .04em;
}

.admin-password-reset-form {
    display: grid;
    gap: 14px;
}

.admin-password-field {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-weight: 800;
}

.admin-password-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.btn-generate-password {
    background: transparent;
    border: none;
    color: var(--red);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-generate-password:hover {
    background: rgba(185, 28, 28, 0.08);
    color: var(--red-dark);
}

.admin-password-modal .password-visibility-toggle {
    display: none !important;
}

.admin-password-input-wrap {
    position: relative;
    display: block;
}

.admin-password-input-wrap input {
    width: 100%;
}

.admin-password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: -5px;
    color: var(--muted);
}

.admin-password-strength-bars {
    display: grid;
    width: 90px;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.admin-password-strength-bars i {
    height: 4px;
    border-radius: 999px;
    background: #ded7ce;
}

.admin-password-strength[data-level="weak"] .admin-password-strength-bars i:first-child {
    background: #c8453a;
}

.admin-password-strength[data-level="medium"] .admin-password-strength-bars i:nth-child(-n+2) {
    background: #c28722;
}

.admin-password-strength[data-level="strong"] .admin-password-strength-bars i {
    background: var(--green);
}

.admin-password-strength[data-level="strong"] small,
.admin-password-match.is-match {
    color: var(--green);
}

.admin-password-match {
    min-height: 18px;
    color: var(--muted);
    font-weight: 700;
}

.admin-password-match.is-mismatch {
    color: var(--red);
}

.admin-password-security-note {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 9px;
    padding: 12px 13px;
    border-radius: 9px;
    background: var(--wash);
    color: var(--muted);
}

.admin-password-security-note svg {
    width: 19px;
    height: 19px;
    margin-top: 1px;
    color: var(--gold-dark);
}

.admin-password-security-note p {
    margin: 0;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.55;
}

.admin-password-modal-actions {
    display: grid;
    grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr);
    gap: 10px;
    margin-top: 5px;
}

.admin-password-modal-actions .btn {
    width: 100%;
}

body.admin-password-modal-open {
    overflow: hidden;
}

@media (max-width: 620px) {
    .admin-password-modal {
        padding: 13px;
    }

    .admin-password-modal-card {
        max-height: calc(100vh - 26px);
        padding: 25px 18px 18px;
        border-radius: 13px;
    }

    .admin-password-modal-head {
        grid-template-columns: 44px minmax(0, 1fr);
        gap: 11px;
        padding-right: 25px;
    }

    .admin-password-modal-icon {
        width: 44px;
        height: 44px;
        border-radius: 11px;
    }

    .admin-password-modal-head h2 {
        font-size: 25px;
    }

    .admin-password-modal-actions {
        grid-template-columns: 1fr;
    }
}

.family-contribution-section {
    background: #fbf8f2;
}

.family-contribution-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
    gap: 24px;
    align-items: start;
}

.family-contribution-card,
.family-contribution-note,
.family-contribution-history {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.family-contribution-card {
    display: grid;
    gap: 18px;
}

.family-contribution-card-head h2,
.family-contribution-note h2,
.family-contribution-history h2 {
    margin: 0;
}

.family-contribution-fields {
    display: grid;
    grid-template-columns: minmax(180px, .42fr) minmax(0, 1fr);
    gap: 14px;
}

.family-contribution-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.family-contribution-side {
    display: grid;
    gap: 18px;
}

.family-contribution-note ol {
    margin: 14px 0 0;
    padding-left: 20px;
    color: var(--muted);
}

.family-contribution-history-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.family-contribution-history-list article {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0e7da;
}

.family-contribution-history-list article:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.family-contribution-history-list strong,
.family-contribution-history-list span {
    display: block;
}

.family-contribution-history-list article > div {
    min-width: 0;
}

.family-contribution-history-list article > div span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.family-tree-contribution-panel {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(47, 37, 29, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.family-tree-contribution-panel[hidden] {
    display: none;
}

.family-tree-contribution-modal {
    position: relative;
    background: #fffcf8;
    border: 1px solid #e2d3b5;
    border-radius: 16px;
    box-shadow: 
        0 24px 48px rgba(68, 40, 18, 0.16),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    width: min(100%, 920px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 28px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: modal-fade-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.family-tree-contribution-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1.5px solid var(--line);
    padding-right: 48px;
    padding-bottom: 16px;
}

.family-tree-contribution-head > .btn-close-modal {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 1;
}

.family-tree-contribution-head h2 {
    margin: 0;
    color: var(--red);
    font-size: 22px;
    font-weight: 800;
}

.family-tree-contribution-head p:not(.eyebrow) {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.btn-close-modal {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
    transition: all 0.2s;
}

.btn-close-modal:hover {
    background: #fff4f2;
    color: var(--red);
    border-color: var(--red);
    transform: rotate(90deg);
}

.family-tree-contribution-form {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

.family-tree-contribution-form [data-family-contribution-member-display] {
    background-color: #f1f5f9;
    cursor: not-allowed;
}

.family-contribution-edit-fields {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid #ead8c0;
    border-radius: 10px;
    background: #fff8ed;
}

.family-contribution-edit-fields[hidden] {
    display: none;
}

.family-contribution-edit-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #e1ccb0;
}

.family-contribution-edit-head strong,
.family-contribution-edit-head span {
    display: block;
}

.family-contribution-edit-head strong {
    color: var(--red);
    font-size: 16px;
}

.family-contribution-edit-head span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.family-contribution-edit-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 12px;
}

.family-contribution-field-label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}

.family-contribution-required-marker {
    color: #c2410c;
    font-size: 12px;
    font-weight: 500;
}

.family-contribution-required-marker[hidden],
[data-family-contribution-submit][hidden] {
    display: none;
}

.family-contribution-avatar-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 1px solid #e1ccb0;
    border-radius: 12px;
    background: #fff;
}

.family-contribution-avatar-control.has-preview {
    grid-template-columns: 116px minmax(0, 1fr);
}

.family-contribution-avatar-preview {
    display: grid;
    gap: 6px;
}

.family-contribution-avatar-preview[hidden],
.family-contribution-avatar-remove[hidden] {
    display: none;
}

.family-contribution-avatar-preview img {
    width: 104px;
    height: 104px;
    object-fit: cover;
    border: 1px solid #e1ccb0;
    border-radius: 10px;
    background: #f8fafc;
}

.family-contribution-avatar-preview span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.family-contribution-avatar-inputs {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.family-contribution-avatar-picker {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-width: 0;
    min-height: 72px;
    padding: 12px 14px;
    overflow: hidden;
    border: 1.5px dashed #cba96e;
    border-radius: 10px;
    background: #fffcf7;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.family-contribution-avatar-picker:hover {
    border-color: var(--red);
    background: #fff7eb;
}

.family-contribution-avatar-picker:focus-within {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(151, 30, 24, .12);
}

.family-contribution-avatar-picker input[type="file"] {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.family-contribution-avatar-picker-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 50%;
    background: #f2e2c5;
    color: var(--red);
}

.family-contribution-avatar-picker-icon svg {
    width: 23px;
    height: 23px;
}

.family-contribution-avatar-picker-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.family-contribution-avatar-picker-copy strong {
    overflow: hidden;
    color: #3f2a21;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.family-contribution-avatar-picker-copy small,
.family-contribution-avatar-note {
    color: var(--muted);
    line-height: 1.45;
}

.family-contribution-avatar-picker-action {
    padding: 8px 12px;
    border: 1px solid #c99461;
    border-radius: 8px;
    background: #fff;
    color: var(--red);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.family-contribution-avatar-note {
    margin: 0;
    font-size: 12px;
}

.family-contribution-avatar-remove {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    color: #991b1b;
    font-size: 13px;
    font-weight: 700;
}

.family-tree-contribution-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 4px;
}

.admin-tabs + .admin-panel {
    margin-top: 18px;
}

.admin-contribution-list {
    display: grid;
    gap: 20px;
}

.admin-contribution-panel {
    margin-top: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #dbe2ea;
    border-radius: 14px;
    background: #f6f8fb;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

.admin-contribution-panel-head {
    margin: 0;
    padding: 22px 24px;
    border-bottom: 1px solid #e5eaf0;
    background: #fff;
}

.admin-contribution-panel-head h2 {
    margin: 0 0 4px;
    color: #172033;
    font-size: 22px;
}

.admin-contribution-panel-head p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.admin-contribution-panel > .admin-contribution-list {
    padding: 20px;
}

.admin-contribution-item {
    overflow: hidden;
    padding: 0;
    background: #ffffff;
    border: 1px solid #dce3eb;
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.05);
}

.admin-contribution-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 24px 20px;
    border-bottom: 1px solid #e8edf3;
}

.admin-contribution-item-head h2 {
    margin: 8px 0 5px;
    color: #172033;
    font-size: 20px;
    line-height: 1.35;
}

.admin-contribution-item-head p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.55;
}

.admin-contribution-item-head p strong {
    color: #334155;
}

.admin-contribution-links {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-contribution-links .btn-outline {
    border-color: #cbd5e1;
    color: #475569;
    background: #fff;
}

.admin-contribution-links .btn-outline:hover {
    border-color: #94a3b8;
    color: #1e293b;
    background: #f8fafc;
}

.admin-contribution-body {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr);
    gap: 20px;
    align-items: start;
    padding: 20px 24px 24px;
}

.admin-contribution-context {
    display: grid;
    grid-column: 2;
    gap: 14px;
}

.admin-contribution-body.no-changes .admin-contribution-context {
    grid-column: 1 / -1;
}

.admin-contribution-meta {
    display: grid;
    gap: 0;
    overflow: hidden;
    margin: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}

.admin-contribution-meta div {
    padding: 11px 13px;
    border-bottom: 1px solid #edf1f5;
}

.admin-contribution-meta div:last-child {
    border-bottom: 0;
}

.admin-contribution-meta dt {
    margin-bottom: 3px;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.admin-contribution-meta dd {
    margin: 0;
    color: #273449;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.45;
}

.admin-contribution-content {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}

.admin-contribution-content h3 {
    margin: 0;
    padding: 11px 13px 0;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

.admin-contribution-content p {
    margin: 0;
    padding: 6px 13px 12px;
    color: #334155;
    font-size: 13px;
    line-height: 1.55;
    white-space: normal;
}

.admin-contribution-content.is-empty p {
    color: #94a3b8;
    font-style: italic;
}

.admin-contribution-source {
    border-color: #ead7ad;
    background: #fffbeb;
}

.admin-contribution-source h3 {
    color: #825b19;
}

.admin-contribution-structured {
    display: grid;
    grid-column: 1;
    grid-row: 1;
    gap: 0;
    overflow: hidden;
    border: 1px solid #dce3eb;
    border-radius: 12px;
    background: #fff;
}

.admin-contribution-structured-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid #e8edf3;
    background: #fbfcfe;
}

.admin-contribution-structured-head h3,
.admin-contribution-structured-head p {
    margin: 0;
}

.admin-contribution-structured-head h3 {
    color: #1e293b;
    font-size: 16px;
}

.admin-contribution-structured-head p {
    margin-top: 4px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.admin-contribution-change-count {
    flex: 0 0 auto;
    padding: 5px 9px;
    border: 1px solid #f1d49a;
    border-radius: 999px;
    background: #fff8e7;
    color: #825b19;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.admin-proposed-field-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    padding: 16px 18px 18px;
}

.admin-proposed-field {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid #bbdfc9;
    border-radius: 8px;
    background: #f3fbf6;
}

.admin-proposed-field span {
    color: #567063;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.admin-proposed-field strong {
    color: #17653a;
    font-size: 14px;
    word-break: break-word;
}

.admin-contribution-avatar {
    display: block;
    width: 88px;
    height: 88px;
    object-fit: cover;
    border: 1px solid #d7dee7;
    border-radius: 9px;
    background: #fff;
}

.admin-compare-old .admin-contribution-avatar,
.admin-compare-new .admin-contribution-avatar {
    width: 96px;
    height: 96px;
}

.admin-contribution-avatar-empty {
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

.admin-contribution-compare-label {
    padding: 12px 18px 8px;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.admin-compare-table {
    margin: 0 18px 18px;
    overflow: hidden;
    border: 1px solid #dfe5ec;
    border-radius: 9px;
}

.admin-compare-heading,
.admin-compare-row {
    display: grid;
    grid-template-columns: minmax(120px, .72fr) minmax(0, 1fr) 36px minmax(0, 1fr);
    align-items: stretch;
}

.admin-compare-heading {
    background: #f3f6f9;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.admin-compare-heading span {
    padding: 9px 12px;
}

.admin-compare-row {
    border-top: 1px solid #e5eaf0;
}

.admin-compare-row span {
    min-width: 0;
    padding: 12px;
    word-break: break-word;
}

.admin-compare-field {
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.admin-compare-old {
    color: #64748b;
    background: #fafbfc;
    font-size: 13px;
    line-height: 1.45;
}

.admin-compare-arrow {
    display: grid;
    place-items: center;
    align-self: center;
    justify-self: center;
    width: 26px;
    height: 26px;
    padding: 0 !important;
    border-radius: 50%;
    background: #eef2f6;
    color: #64748b;
    font-weight: 800;
}

.admin-compare-new {
    background: #effaf3;
    color: #17653a;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
}

.admin-contribution-review {
    display: grid;
    grid-template-columns: minmax(180px, .55fr) minmax(300px, 1.4fr) auto;
    gap: 16px;
    align-items: end;
    padding: 18px 24px 20px;
    border-top: 1px solid #e1e7ee;
    background: #f7f9fc;
}

.admin-contribution-review-copy {
    align-self: start;
}

.admin-contribution-review-copy h3 {
    margin: 2px 0 4px;
    color: #1e293b;
    font-size: 15px;
}

.admin-contribution-review-copy p {
    margin: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
}

.admin-contribution-review > label {
    display: grid;
    gap: 6px;
    margin: 0;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

.admin-contribution-review > label small {
    margin-left: 4px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 500;
}

.admin-contribution-review textarea {
    min-height: 72px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    resize: vertical;
}

.admin-contribution-review textarea:focus {
    border-color: #9b221b;
    outline: 3px solid rgba(155, 34, 27, .1);
}

.admin-contribution-review-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-contribution-review-actions [value="reject"] {
    order: 1;
}

.admin-contribution-review-actions [value="reopen"] {
    order: 2;
}

.admin-contribution-review-actions [value="approve"],
.admin-contribution-review-actions [value="apply_contribution"] {
    order: 3;
}

.admin-contribution-reject {
    border-color: #d6a3a0;
    color: #8f241d;
    background: #fff;
}

.admin-contribution-reject:hover {
    border-color: #b53a32;
    color: #7d1b16;
    background: #fff5f4;
}

@media (max-width: 1100px) {
    .admin-contribution-body {
        grid-template-columns: 1fr;
    }

    .admin-contribution-context,
    .admin-contribution-structured {
        grid-column: 1;
    }

    .admin-contribution-structured {
        grid-row: 1;
    }

    .admin-contribution-context {
        grid-row: 2;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-contribution-meta {
        grid-row: span 2;
    }

    .admin-contribution-body.no-changes .admin-contribution-context {
        grid-row: 1;
    }

    .admin-contribution-review {
        grid-template-columns: minmax(180px, .55fr) minmax(300px, 1.45fr);
    }

    .admin-contribution-review-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .admin-contribution-panel-head,
    .admin-contribution-item-head,
    .admin-contribution-body,
    .admin-contribution-review {
        padding-left: 16px;
        padding-right: 16px;
    }

    .admin-contribution-panel > .admin-contribution-list {
        padding: 12px;
    }

    .admin-contribution-links {
        justify-content: stretch;
    }

    .admin-contribution-links .btn {
        flex: 1 1 auto;
        text-align: center;
    }

    .admin-contribution-context,
    .admin-contribution-review {
        grid-template-columns: 1fr;
    }

    .admin-contribution-meta {
        grid-row: auto;
    }

    .admin-contribution-structured-head {
        padding: 14px;
    }

    .admin-contribution-change-count {
        align-self: flex-start;
    }

    .admin-contribution-compare-label {
        padding-inline: 14px;
    }

    .admin-compare-table {
        margin: 0 14px 14px;
        border: 0;
        overflow: visible;
    }

    .admin-compare-heading {
        display: none;
    }

    .admin-compare-row {
        display: grid;
        grid-template-columns: 1fr 30px 1fr;
        gap: 0;
        margin-top: 10px;
        overflow: hidden;
        border: 1px solid #dfe5ec;
        border-radius: 9px;
    }

    .admin-compare-field {
        grid-column: 1 / -1;
        border-bottom: 1px solid #e5eaf0;
        background: #f5f7fa;
    }

    .admin-compare-old,
    .admin-compare-new {
        position: relative;
        padding-top: 30px !important;
    }

    .admin-compare-old::before,
    .admin-compare-new::before {
        content: attr(data-label);
        position: absolute;
        top: 9px;
        left: 12px;
        color: #64748b;
        font-size: 9px;
        font-weight: 800;
        letter-spacing: .05em;
        text-transform: uppercase;
    }

    .admin-compare-arrow {
        align-self: center;
    }

    .admin-contribution-review-actions {
        grid-column: auto;
    }
}

body.admin-body {
    min-height: 100vh;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    color: #202833;
    background: #f4f6f8;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.admin-body .admin-layout {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding-top: 74px;
}

.admin-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 74px;
    padding: 12px 26px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    background: var(--red);
    box-shadow: 0 4px 12px rgba(139, 22, 22, 0.15);
}

.admin-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 168px;
    padding: 0;
    border-radius: 0;
    border: none;
    background: transparent;
}

.admin-brand-logo {
    display: block;
    width: 144px;
    max-width: 100%;
    height: auto;
}

.admin-brand-logo .cls-1 {
    fill: #f7d08a;
    transition: fill 0.2s ease;
}

.admin-header-brand:hover .admin-brand-logo .cls-1 {
    fill: #fff;
}

.admin-header-brand strong,
.admin-header-brand small {
    display: block;
    line-height: 1.15;
}

.admin-header-brand small {
    margin-top: 3px;
    color: #dec89c;
}

.admin-topnav {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1 1 auto;
    overflow-x: auto;
    scrollbar-width: none;
}

.admin-topnav::-webkit-scrollbar {
    display: none;
}

.admin-topnav a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.82);
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.admin-topnav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.admin-topnav a.active {
    background: #f7d08a;
    color: var(--red);
    border-color: #e5b96a;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.admin-upload-health {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    white-space: nowrap;
    position: relative;
    transition: background .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.admin-upload-health:hover {
    border-color: rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .18);
    color: #fff;
    transform: translateY(-1px);
}

.admin-upload-health-icon {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: transparent;
    color: currentColor;
}

.admin-upload-health-icon svg {
    width: 19px;
    height: 19px;
}

.admin-upload-health-dot {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(80, 10, 10, .85);
    border-radius: 50%;
    background: #f59e0b;
    box-sizing: border-box;
}

.admin-upload-health-copy {
    display: grid;
    line-height: 1.12;
}

.admin-upload-health-copy small {
    color: rgba(255, 255, 255, .64);
    font-size: 10px;
    font-weight: 600;
}

.admin-upload-health-copy strong {
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.admin-upload-health.is-online {
    border-color: rgba(34, 197, 94, .55);
    background: rgba(34, 197, 94, .18);
    color: #4ade80;
}

.admin-upload-health.is-online:hover {
    background: rgba(34, 197, 94, .28);
    box-shadow: 0 0 12px rgba(34, 197, 94, .35);
}

.admin-upload-health.is-online .admin-upload-health-icon {
    background: transparent;
    color: #4ade80;
}

.admin-upload-health.is-online .admin-upload-health-dot {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, .35), 0 0 8px #22c55e;
}

.admin-upload-health.is-offline {
    border-color: rgba(239, 68, 68, .55);
    background: rgba(239, 68, 68, .18);
    color: #f87171;
}

.admin-upload-health.is-offline:hover {
    background: rgba(239, 68, 68, .28);
    box-shadow: 0 0 12px rgba(239, 68, 68, .35);
}

.admin-upload-health.is-offline .admin-upload-health-icon {
    background: transparent;
    color: #f87171;
}

.admin-upload-health.is-offline .admin-upload-health-dot {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, .35), 0 0 8px #ef4444;
}

.admin-upload-health.is-checking .admin-upload-health-dot {
    animation: admin-upload-health-pulse 1.2s ease-in-out infinite;
}

@keyframes admin-upload-health-pulse {
    50% {
        opacity: .45;
        transform: scale(.78);
    }
}

.admin-header-actions .btn {
    min-height: 40px;
    padding-inline: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.admin-topbar .btn-outline {
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
    background: transparent;
}

.admin-topbar .btn-outline:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #fff;
    color: #fff;
}

.admin-topbar .btn-danger {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-topbar .btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.admin-main {
    min-width: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    position: relative;
    z-index: 1;
}

.admin-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.admin-user span:last-child {
    display: grid;
    line-height: 1.2;
}

.admin-user strong {
    color: #fff;
}

.admin-user small {
    color: rgba(255, 255, 255, 0.65);
}

.admin-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f7d08a;
    color: var(--red);
    font-weight: 800;
}

@media (max-width: 1500px) {
    .admin-upload-health-copy small {
        display: none;
    }

    .admin-topnav a {
        padding-inline: 11px;
    }

    .admin-user {
        padding-inline: 7px;
    }

    .admin-user span:last-child {
        display: none;
    }
}

.admin-page-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: grid;
    gap: 18px;
    align-content: start;
    padding: 24px 26px 48px;
}

.admin-page-content > *,
body.admin-body .admin-layout,
body.admin-body .admin-main {
    min-width: 0;
    max-width: 100%;
}

body.admin-body .admin-panel,
body.admin-body .admin-stat {
    box-shadow: 0 10px 28px rgba(24, 31, 42, .08);
}

body.admin-body .alert {
    margin: 0;
}

.admin-menu-btn {
    display: none;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.admin-menu-btn span {
    width: 18px;
    height: 2px;
    display: block;
    border-radius: 999px;
    background: var(--ink);
}

.admin-topbar .admin-menu-btn {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.12);
}

.admin-topbar .admin-menu-btn span {
    background: #fff;
}

.admin-topbar .admin-menu-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.admin-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.admin-photo-grid figure {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    box-shadow: 0 5px 16px rgba(72, 43, 20, .06);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.admin-photo-grid figure:hover {
    border-color: #d7b77a;
    box-shadow: 0 10px 24px rgba(72, 43, 20, .11);
    transform: translateY(-2px);
}

.admin-media-list-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    margin-top: 22px;
}

.admin-media-list-head h3,
.admin-media-list-head p {
    margin: 0;
}

.admin-media-list-head h3 {
    color: var(--ink);
    font-size: 17px;
}

.admin-media-list-head p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.admin-media-preview {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #eee8de;
    cursor: zoom-in;
}

.admin-media-preview:disabled {
    cursor: not-allowed;
    opacity: .72;
}

.admin-media-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .22s ease;
}

.admin-media-preview:not(:disabled):hover img,
.admin-media-preview:not(:disabled):focus-visible img {
    transform: scale(1.035);
}

.admin-media-preview:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: -3px;
}

.admin-media-video-thumb {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    align-content: center;
    gap: 8px;
    background:
        radial-gradient(circle at 30% 20%, rgba(226, 185, 104, .24), transparent 38%),
        linear-gradient(145deg, #3b1b1a, #7b211d);
    color: #f8e4b6;
}

.admin-media-video-thumb svg {
    width: 42px;
    height: 42px;
    padding: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    box-shadow: 0 7px 20px rgba(0, 0, 0, .22);
}

.admin-media-video-thumb small {
    font-size: 11px;
    font-weight: 800;
}

.admin-media-preview-hint {
    position: absolute;
    inset: auto 8px 8px auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, .26);
    border-radius: 999px;
    background: rgba(21, 14, 10, .7);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .18s ease, transform .18s ease;
    backdrop-filter: blur(6px);
}

.admin-media-preview-hint svg {
    width: 14px;
    height: 14px;
}

.admin-media-preview:hover .admin-media-preview-hint,
.admin-media-preview:focus-visible .admin-media-preview-hint {
    opacity: 1;
    transform: translateY(0);
}

.admin-media-card-body {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px;
}

.admin-photo-grid figcaption {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 6px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.admin-media-card-title {
    min-width: 0;
    overflow: hidden;
    color: #493f37;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-media-card-body form {
    flex: 0 0 auto;
    margin: 0;
}

.admin-media-delete-button {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 11px;
}

.admin-album-lightbox .story-footer {
    pointer-events: none;
}

.generation-tree-builder {
    display: grid;
    gap: 18px;
    font-family: var(--family-tree-font);
    scroll-margin-top: 110px;
}

.generation-tree-builder * {
    font-family: inherit;
}

body.generation-tree-open {
    overflow: hidden;
}

.generation-tree-builder.is-expanded {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 18px 22px;
    border-radius: 0;
    background: #fffdf8;
    box-shadow: 0 24px 80px rgba(24, 31, 42, .28);
}

.generation-tree-builder.is-expanded .admin-head.slim {
    align-items: center;
    margin-bottom: 0;
}

.generation-tree-builder.is-expanded .generation-tree-stage {
    min-height: 0;
    height: 100%;
    max-height: none;
}

.generation-view-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    flex: 0 0 auto;
}

.generation-view-actions .btn {
    height: 42px;
    min-height: 42px;
    padding-top: 0;
    padding-bottom: 0;
}

.generation-view-actions .toolbar-dropdown-container {
    flex: 0 0 auto;
    align-self: flex-end;
    display: inline-flex !important;
}

.generation-view-actions .toolbar-dropdown-toggle {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    box-sizing: border-box;
}

.generation-view-actions .toolbar-dropdown-toggle svg {
    margin: 0;
}

.generation-expand-button,
.generation-overview-button,
.generation-center-button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.generation-role-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 3px;
    border: 1px solid #eadcc8;
    border-radius: 8px;
    background: #fffaf1;
}

.generation-role-filter {
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 7px;
    line-height: 1.2;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.generation-role-filter-count {
    margin-left: 4px;
    font-size: .92em;
    font-weight: 800;
    opacity: .74;
}

.generation-role-filter.is-active .generation-role-filter-count {
    opacity: .9;
}

.generation-role-filter.is-active {
    border-color: var(--red);
    background: var(--red);
    color: #ffffff;
}

.generation-overview-button.active {
    border-color: var(--red);
    background: var(--red);
    color: #ffffff;
}

.generation-kinship-button.active {
    border-color: var(--red);
    background: #fff3f1;
    color: var(--red);
}

.kinship-panel[hidden] {
    display: none !important;
}

.kinship-panel {
    margin: 0 24px;
    padding: 16px;
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(31, 41, 55, .08);
}

.kinship-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.kinship-panel-head h2 {
    margin: 2px 0 0;
    color: #172033;
    font-size: 20px;
    line-height: 1.15;
}

.kinship-eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fff3f1;
    color: var(--red);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.kinship-close,
.kinship-swap,
.kinship-reset {
    border: 1px solid #d8e0ea;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease, background-color .16s ease, transform .16s ease;
}

.kinship-close {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
}

.kinship-close:hover,
.kinship-swap:hover,
.kinship-reset:hover {
    border-color: var(--red);
    background: #fff7f5;
    color: var(--red);
}

.kinship-tools {
    box-sizing: border-box;
    margin: 0 -16px;
    padding: 0 16px 12px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.kinship-slots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.kinship-slot {
    min-width: 0;
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    background: #f8fafc;
    color: #172033;
    text-align: left;
    cursor: pointer;
}

.kinship-slot span {
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.kinship-slot strong {
    overflow: hidden;
    color: #172033;
    font-size: 14px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kinship-slot.is-active {
    border-color: var(--red);
    background: #fff7f5;
    box-shadow: 0 0 0 3px rgba(140, 29, 24, .08);
}

.kinship-slot.is-kinship-just-picked {
    border-color: var(--red);
    background: #fff3f1;
    animation: kinship-confirm-pulse 1s ease-in-out 2;
}

.kinship-picker-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr);
    align-items: end;
    gap: 10px;
}

.kinship-picker-field {
    position: relative;
    display: grid;
    gap: 6px;
    min-width: 0;
    margin: 0;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.kinship-picker-field select {
    width: 100%;
    min-height: 40px;
    border: 1px solid #d8e0ea;
    border-radius: 7px;
    background: #ffffff;
    color: #172033;
    font-size: 14px;
}

.kinship-member-search {
    width: 100%;
    min-height: 40px;
    padding-left: 40px;
    font-size: 14px;
}

.kinship-member-search-wrap {
    position: relative;
    display: block;
    min-width: 0;
}

.kinship-member-search-wrap .account-member-suggestions {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: min(240px, 42vh);
}

.kinship-picker-actions {
    display: grid;
    grid-template-columns: repeat(2, 44px);
    gap: 4px;
}

.kinship-swap,
.kinship-reset {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
}

.kinship-swap:hover,
.kinship-reset:hover {
    transform: translateY(-1px);
}

.kinship-result {
    margin-top: 10px;
}

.kinship-empty,
.kinship-loading,
.kinship-error {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px dashed #d8e0ea;
    border-radius: 8px;
    background: #f8fafc;
    color: #64748b;
    font-size: 13px;
}

.kinship-empty strong,
.kinship-loading strong,
.kinship-error strong {
    color: #172033;
    font-size: 14px;
}

.kinship-loading {
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
}

.kinship-loading span {
    width: 16px;
    height: 16px;
    border: 2px solid #eadcc8;
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.kinship-error {
    border-color: #fecaca;
    background: #fff7f7;
    color: #991b1b;
}

.kinship-answer {
    display: grid;
    gap: 8px;
}

.kinship-answer-summary {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, .85fr);
    gap: 8px;
}

.kinship-answer-card {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 6px 12px;
    padding: 11px 13px;
    border: 1px solid #eadcc8;
    border-radius: 8px;
    background: linear-gradient(180deg, #fffdf8 0%, #fffaf2 100%);
}

.kinship-answer-label {
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.kinship-answer-sentence {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px 8px;
    color: #64748b;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
}

.kinship-answer-sentence strong {
    max-width: 100%;
    padding: 3px 7px;
    border: 1px solid #d8e0ea;
    border-radius: 7px;
    background: #ffffff;
    color: #172033;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.kinship-answer-term {
    margin-left: 1px;
    color: var(--red);
    font-family: inherit;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    vertical-align: baseline;
    overflow-wrap: anywhere;
}

.kinship-alt-list {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.kinship-alt-list em {
    color: #64748b;
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

.kinship-alt-list span,
.kinship-notes span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.kinship-alt-list span {
    background: #eef6ff;
    color: #1d4ed8;
}

.kinship-reverse-line {
    min-width: 0;
    display: grid;
    align-content: center;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    background: #f8fafc;
}

.kinship-reverse-line > span {
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.kinship-reverse-line strong {
    color: #172033;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.kinship-reverse-line b {
    font-weight: 900;
}

.kinship-reverse-line em {
    color: var(--red);
    font-size: 16px;
    font-style: normal;
    font-weight: 900;
}

.kinship-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    align-items: start;
    gap: 8px;
}

.kinship-detail-layout.is-single {
    grid-template-columns: minmax(0, 1fr);
}

.kinship-detail-stack {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.kinship-detail {
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.kinship-detail summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    color: #334155;
    cursor: pointer;
    font-size: 11px;
    font-weight: 900;
    list-style: none;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.kinship-detail summary::-webkit-details-marker {
    display: none;
}

.kinship-detail summary::after {
    content: "+";
    display: inline-grid;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid #d8e0ea;
    border-radius: 999px;
    color: var(--red);
    font-size: 14px;
    line-height: 1;
}

.kinship-detail[open] summary::after {
    content: "-";
}

.kinship-path {
    display: block;
    margin: 0;
    padding: 0 10px 10px;
    border: 0;
    background: #ffffff;
}

.kinship-path-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    color: #172033;
    font-size: 12px;
    line-height: 1.45;
}

.kinship-path-person {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 7px;
    border: 1px solid #dbe3ec;
    border-radius: 6px;
    background: #f8fafc;
    overflow-wrap: anywhere;
}

.kinship-path-person.is-kinship-common-node {
    border-color: #d39a24;
    background: #fff0be;
    color: #774300;
    box-shadow: 0 0 0 2px rgba(211, 154, 36, .2);
}

.kinship-path-step {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.kinship-path-connector {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.kinship-path-connector em {
    color: #687386;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
}

.kinship-path-connector b {
    color: var(--red);
    font-weight: 900;
}

.kinship-path .kinship-path-spouse {
    display: inline-flex;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff1ef;
    color: var(--red);
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
}

.kinship-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0 10px 10px;
}

.kinship-notes span {
    background: #fff7ed;
    color: #9a3412;
}

.kinship-explain {
    display: grid;
    gap: 4px;
    padding: 0 10px 10px;
}

.kinship-explain p {
    margin: 0;
    color: #475569;
    font-size: 12px;
    line-height: 1.4;
}

.generation-tree-stage.is-kinship-selecting .generation-card[data-kinship-member-id],
.generation-tree-stage.is-kinship-selecting [data-kinship-member-id] {
    cursor: pointer;
}

.generation-tree-stage.is-kinship-selecting .generation-card[data-kinship-member-id]:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(31, 41, 55, .12);
}

.generation-card.is-kinship-from,
.generation-card.is-kinship-to {
    box-shadow: 0 0 0 4px rgba(140, 29, 24, .16), 0 16px 34px rgba(31, 41, 55, .12);
}

.generation-card.is-kinship-from {
    border-color: var(--red);
}

.generation-card.is-kinship-to {
    border-color: #1d4ed8;
}

.generation-card.is-kinship-just-picked {
    animation: pulse-highlight .7s ease-in-out 3;
}

.is-kinship-picked-link {
    color: var(--red) !important;
    font-weight: 900;
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

.is-kinship-picked-link.is-kinship-just-picked {
    box-shadow: 0 0 0 3px rgba(140, 29, 24, .16);
}

@keyframes kinship-confirm-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(140, 29, 24, 0);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(140, 29, 24, .16);
    }
}

.generation-tree-stage {
    position: relative;
    overflow: auto;
    min-height: 620px;
    max-height: min(88vh, 920px);
    padding: 0;
    border: 1px solid #d8bd82;
    border-radius: 8px;
    background:
        radial-gradient(circle, rgba(184, 134, 47, .20) 1px, transparent 1.9px) 0 0 / 28px 28px,
        linear-gradient(135deg, rgba(255, 250, 241, .94), rgba(248, 239, 221, .86)),
        #fffaf1;
    scrollbar-color: rgba(140, 29, 24, .45) transparent;
    cursor: grab;
    user-select: none;
    overscroll-behavior: contain;
}

.generation-tree-stage:active {
    cursor: grabbing;
}

.generation-tree-stage.is-overview {
    overflow: hidden;
    cursor: zoom-in;
}

.tree-zoom-selection-box {
    position: absolute;
    border: 2px dashed var(--red);
    background: rgba(147, 44, 44, 0.15);
    pointer-events: none;
    z-index: 99999;
}

.generation-tree-canvas {
    position: relative;
    min-width: 100%;
    transform-origin: 0 0;
    transition: transform .22s ease;
    contain: layout paint style;
    padding-bottom: 350px;
}

.generation-tree-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.generation-tree-line {
    fill: none;
    stroke: #a89067;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: opacity .18s ease, stroke .18s ease, stroke-width .18s ease;
}

.generation-tree-line.is-role-filter-muted {
    opacity: .14;
    stroke: #d6c39d;
}

.generation-tree-line.is-role-filter-match {
    opacity: 1;
    stroke: #8c1d18;
    stroke-width: 2.5;
}

.generation-tree-stage.is-kinship-path-focus .generation-card {
    opacity: .24;
    filter: grayscale(1);
}

.generation-tree-stage.is-kinship-path-focus .generation-card.is-kinship-path-member {
    z-index: 4;
    opacity: 1;
    filter: none;
    box-shadow: 0 0 0 4px rgba(140, 29, 24, .16), 0 18px 36px rgba(68, 40, 18, .18);
}

.generation-tree-stage.is-kinship-path-focus .generation-card.is-kinship-path-member.is-kinship-common-node {
    border-color: #d39a24;
    background: #fff4cf;
    box-shadow: 0 0 0 5px rgba(211, 154, 36, .3), 0 18px 36px rgba(89, 57, 10, .24);
}

.generation-tree-stage.is-kinship-path-focus .generation-tree-line {
    opacity: .1;
    filter: grayscale(1);
}

.generation-tree-stage.is-kinship-path-focus .generation-tree-line.is-kinship-path-line {
    opacity: 1;
    filter: none;
    stroke: var(--red);
    stroke-width: 4;
}

.generation-tree-stage.is-kinship-path-focus .is-kinship-path-inline {
    border-color: rgba(140, 29, 24, .55);
    background: #fff1ef;
    box-shadow: 0 0 0 2px rgba(140, 29, 24, .1);
}

.generation-tree-stage.is-kinship-path-focus .is-kinship-path-inline.is-kinship-common-node {
    border-color: #d39a24;
    background: #fff0be;
    color: #774300 !important;
    box-shadow: 0 0 0 3px rgba(211, 154, 36, .24);
}

.generation-markers-axis {
    position: absolute;
    left: 0;
    top: 0;
    width: 100px;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    background: linear-gradient(to right, rgba(255, 250, 241, .96) 0%, rgba(255, 250, 241, .78) 65%, rgba(255, 250, 241, 0) 100%);
    /* Badges are counter-scaled when the tree is zoomed out and can become
       wider than the axis itself. Keep layout/style containment, but allow
       the complete badge (including its navigation arrows) to be painted. */
    contain: layout style;
    will-change: transform;
}

.generation-axis-line {
    position: absolute;
    left: 54px;
    width: 2px;
    background: repeating-linear-gradient(to bottom, var(--gold) 0, var(--gold) 6px, transparent 6px, transparent 12px);
    z-index: 2;
}

.generation-axis-badge {
    position: absolute;
    left: 8px;
    width: 92px;
    height: 36px;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) 20px;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 3px;
    background: #fffaf1;
    border: 2px solid var(--gold);
    border-radius: 18px;
    box-shadow: 0 4px 10px rgba(68, 40, 18, 0.08);
    z-index: 5;
    transform-origin: 0 50%;
    box-sizing: border-box;
    pointer-events: auto;
}

.generation-axis-jump,
.generation-axis-nav-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--red);
    font: inherit;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.generation-axis-jump {
    grid-column: 2;
    min-width: 0;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.generation-axis-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--red);
    white-space: nowrap;
}

.generation-axis-static-label {
    grid-column: 1 / -1;
    min-width: 0;
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.generation-axis-nav-btn {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: .8;
    transition: background .15s ease, color .15s ease, opacity .15s ease, transform .15s ease;
}

.generation-axis-nav-prev {
    grid-column: 1;
}

.generation-axis-nav-next {
    grid-column: 3;
}

.generation-axis-nav-btn[hidden] {
    display: none !important;
}

.generation-axis-nav-btn svg {
    display: block;
    pointer-events: none;
}

.generation-axis-jump:hover .generation-axis-label,
.generation-axis-jump:focus-visible .generation-axis-label {
    color: #6f120f;
}

.generation-axis-nav-btn:hover,
.generation-axis-nav-btn:focus-visible {
    background: rgba(140, 29, 24, .1);
    color: #6f120f;
    opacity: 1;
    outline: none;
    transform: translateY(-1px);
}

.generation-card {
    --node-accent: #8c1d18;
    --node-gold: #b8862f;
    --node-corner: rgba(140, 29, 24, .88);
    --node-paper: #fffdf8;
    --node-paper-warm: #fff7e9;
    --node-frame-inset: 12px;
    --node-corner-size: 13px;
    --node-corner-thickness: 2px;
    --node-dash-color: rgba(184, 134, 47, .36);
    --node-dash-thickness: 1px;
    --node-dash-start: calc(var(--node-frame-inset) + var(--node-corner-size));
    --node-dash-length: calc(100% - var(--node-frame-inset) - var(--node-frame-inset) - var(--node-corner-size) - var(--node-corner-size));
    position: absolute;
    z-index: 1;
    width: 286px;
    min-height: 218px;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px 20px 20px;
    border: 1px solid #dfc99f;
    border-top: 3px solid var(--node-accent);
    border-radius: 10px;
    background:
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(180deg, rgba(255, 255, 255, .70), rgba(255, 255, 255, 0) 44%),
        linear-gradient(135deg, var(--node-paper), var(--node-paper-warm));
    box-shadow:
        0 13px 28px rgba(68, 40, 18, .12),
        inset 0 0 0 1px rgba(255, 255, 255, .76);
    color: #2f251d;
    cursor: default;
    user-select: text;
    transition: opacity .18s ease, filter .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.generation-card:not(.generation-family-card)::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(to right, var(--node-dash-color) 0 4px, transparent 4px 8px) left var(--node-dash-start) top var(--node-frame-inset) / var(--node-dash-length) var(--node-dash-thickness) no-repeat,
        repeating-linear-gradient(to right, var(--node-dash-color) 0 4px, transparent 4px 8px) left var(--node-dash-start) bottom var(--node-frame-inset) / var(--node-dash-length) var(--node-dash-thickness) no-repeat,
        repeating-linear-gradient(to bottom, var(--node-dash-color) 0 4px, transparent 4px 8px) left var(--node-frame-inset) top var(--node-dash-start) / var(--node-dash-thickness) var(--node-dash-length) no-repeat,
        repeating-linear-gradient(to bottom, var(--node-dash-color) 0 4px, transparent 4px 8px) right var(--node-frame-inset) top var(--node-dash-start) / var(--node-dash-thickness) var(--node-dash-length) no-repeat;
    pointer-events: none;
}

.generation-card.is-virtual {
    --node-accent: var(--gold);
    border-top-color: var(--gold);
    background: #fffdf8;
}

.generation-card.is-focused {
    border-color: rgba(184, 134, 47, .86);
    border-top-color: var(--red);
    box-shadow:
        0 0 0 4px rgba(140, 29, 24, .10),
        0 20px 38px rgba(68, 40, 18, .18);
}

.generation-card.is-living,
.generation-card.is-living.is-focused {
    --node-accent: #2f6f5e !important;
    --node-corner: #2f6f5e !important;
    border-color: rgba(47, 111, 94, 0.45) !important;
    border-top-color: #2f6f5e !important;
}

.generation-card.is-deceased,
.generation-card.is-deceased.is-focused {
    --node-accent: var(--red) !important;
    --node-corner: var(--red) !important;
    border-color: rgba(140, 29, 24, 0.45) !important;
    border-top-color: var(--red) !important;
}

.generation-spouse-row.is-focused {
    opacity: 1 !important;
    border-color: rgba(184, 134, 47, .86) !important;
    background: #fff8e8 !important;
    box-shadow: 0 0 0 3px rgba(140, 29, 24, .10);
}

.generation-card:not(.generation-family-card)[data-generation="1"],
.generation-card:not(.generation-family-card)[data-generation="2"],
.generation-card:not(.generation-family-card)[data-generation="3"] {
    border-width: 2px;
    border-color: #bd8529;
    border-top-color: #8c1d18 !important;
    border-radius: 14px;
}

/* --- THỦY TỔ (ĐỜI 1) --- */
.generation-card:not(.generation-family-card)[data-generation="1"] {
    --node-accent: #8c1d18;
    --node-corner: #a05a2c;
    --node-corner-size: 16px;
    --node-corner-thickness: 3px;
    --node-paper: #fffdf2;
    --node-paper-warm: #ffeec9;
    border-width: 3px;
    border-color: #b8862f;
    border-top-width: 6px;
    border-top-color: #8c1d18 !important;
    border-radius: 16px;
    box-shadow:
        0 24px 50px rgba(68, 40, 18, .25),
        0 0 0 1px rgba(184, 134, 47, .30),
        0 0 20px rgba(184, 134, 47, .20),
        inset 0 0 0 1px rgba(255, 255, 255, .90);
}
.generation-card:not(.generation-family-card)[data-generation="1"]::before {
    --node-dash-color: rgba(184, 134, 47, .78);
    --node-dash-thickness: 1.2px;
}
.generation-card:not(.generation-family-card)[data-generation="1"] h3 {
    font-size: 25px !important;
    font-weight: 900 !important;
    font-family: Georgia, serif !important;
    color: #8c1d18 !important;
    text-shadow: 0.5px 0.5px 0px rgba(255, 255, 255, 0.8);
}
.generation-card:not(.generation-family-card)[data-generation="1"] p:not(.generation-branch-line):not(.generation-meta-line) {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #8c1d18, #a81c15);
    color: #fff !important;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 6px rgba(140, 29, 24, .20);
    margin-top: 4px;
    width: fit-content;
}
.generation-card:not(.generation-family-card)[data-generation="1"] .generation-spouse-row {
    border-color: #dfc99f;
    background: linear-gradient(135deg, #fffdf8, #ffeec9);
    font-weight: 800;
    color: #8c1d18;
    box-shadow: 0 2px 6px rgba(184, 134, 47, .08);
}
.generation-card:not(.generation-family-card)[data-generation="1"] .generation-spouse-add-button {
    border-color: #b8862f;
    background: #ffffff;
}
.generation-card:not(.generation-family-card)[data-generation="1"] .generation-spouse-add-button::before,
.generation-card:not(.generation-family-card)[data-generation="1"] .generation-spouse-add-button::after {
    background: #8c1d18;
}
.generation-card:not(.generation-family-card)[data-generation="1"] .generation-spouse-add-button:hover {
    background: #fff3dc;
    border-color: #8c1d18;
}

/* --- ĐỜI 2 --- */
.generation-card:not(.generation-family-card)[data-generation="2"] {
    --node-accent: #8c1d18;
    --node-corner: #8c1d18;
    --node-corner-size: 14px;
    --node-corner-thickness: 2.5px;
    --node-paper: #fffdfb;
    --node-paper-warm: #fff3dc;
    border-width: 2.5px;
    border-color: #dfb265;
    border-top-width: 4.5px;
    border-top-color: #8c1d18 !important;
    border-radius: 14px;
    box-shadow:
        0 20px 42px rgba(68, 40, 18, .18),
        0 0 0 1px rgba(184, 134, 47, .15),
        inset 0 0 0 1px rgba(255, 255, 255, .82);
}
.generation-card:not(.generation-family-card)[data-generation="2"]::before {
    --node-dash-color: rgba(184, 134, 47, .58);
}
.generation-card:not(.generation-family-card)[data-generation="2"] h3 {
    font-size: 22px !important;
    font-weight: 850 !important;
    font-family: Georgia, serif !important;
    color: #8c1d18 !important;
}
.generation-card:not(.generation-family-card)[data-generation="2"] p:not(.generation-branch-line):not(.generation-meta-line) {
    display: inline-flex;
    align-items: center;
    background: rgba(184, 134, 47, .10);
    color: #a06e15 !important;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    width: fit-content;
    margin-top: 2px;
}
.generation-card:not(.generation-family-card)[data-generation="2"] .generation-spouse-row {
    border-color: rgba(184, 134, 47, .24);
    background: rgba(255, 252, 244, .95);
}

/* --- ĐỜI 3 --- */
.generation-card:not(.generation-family-card)[data-generation="3"] {
    --node-accent: #8c1d18;
    --node-corner: rgba(140, 29, 24, .78);
    --node-corner-size: 12px;
    --node-corner-thickness: 2px;
    --node-paper: #fffdfc;
    --node-paper-warm: #fff6e8;
    border-width: 2px;
    border-color: #e3d1ac;
    border-top-width: 3.5px;
    border-top-color: #8c1d18 !important;
    border-radius: 12px;
    box-shadow:
        0 16px 34px rgba(68, 40, 18, .14),
        inset 0 0 0 1px rgba(255, 255, 255, .80);
}
.generation-card:not(.generation-family-card)[data-generation="3"]::before {
    --node-dash-color: rgba(184, 134, 47, .48);
}
.generation-card:not(.generation-family-card)[data-generation="3"] h3 {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: #8c1d18 !important;
}
.generation-card:not(.generation-family-card)[data-generation="3"] p:not(.generation-branch-line):not(.generation-meta-line) {
    color: #8c1d18 !important;
    font-weight: 700;
}

.generation-card.is-role-filter-muted {
    opacity: .24;
    filter: grayscale(1);
    border-color: #d1d5db !important;
    border-top-color: #94a3b8 !important;
    background: #f1f5f9;
    box-shadow: none;
}

.generation-card.is-role-filter-muted h3,
.generation-card.is-role-filter-muted p,
.generation-card.is-role-filter-muted .generation-chip,
.generation-card.is-role-filter-muted .generation-spouse-row {
    color: #94a3b8;
}

.generation-card.is-role-filter-match {
    z-index: 6;
    box-shadow:
        0 0 0 4px rgba(47, 111, 94, .10),
        0 18px 34px rgba(31, 41, 55, .16);
}

.generation-family-card {
    min-height: 112px;
    height: 112px;
    padding: 18px 20px 18px;
    --node-accent: var(--gold);
    border-top-color: var(--gold);
    background:
        linear-gradient(135deg, #fffdf8, #fff1d7);
    border-color: #dfc99f;
}

.generation-family-card h3 {
    font-size: 14px;
    line-height: 1.25;
}

.generation-family-card p {
    font-size: 12px;
}

.generation-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    margin-bottom: 2px;
}

.generation-chip {
    min-width: 0;
    min-height: 30px;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border: 1px solid #d8b56f;
    border-radius: 999px;
    background: #fff7e6;
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    white-space: nowrap;
}

.generation-card:not(.generation-family-card)[data-generation="1"] .generation-chip,
.generation-card:not(.generation-family-card)[data-generation="2"] .generation-chip,
.generation-card:not(.generation-family-card)[data-generation="3"] .generation-chip {
    border-color: #b8862f;
    background: #8c1d18;
    color: #fffdf8;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .10);
}

.generation-node-feedback {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid #d8b56f;
    border-radius: 50%;
    background: rgba(255, 253, 248, .9);
    color: var(--red);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    
    /* Ẩn theo mặc định */
    opacity: 0;
    pointer-events: none;
    transform: scale(0.6);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.contribution-mode .generation-node-feedback {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.generation-node-feedback svg {
    display: block;
}

.generation-node-feedback:hover,
.generation-node-feedback:focus-visible {
    border-color: var(--red);
    background: var(--red);
    color: #fff;
    outline: none;
    box-shadow: 0 4px 8px rgba(193, 39, 45, 0.25);
    transform: translateY(-1.5px) scale(1.08) !important;
}

/* Nút bấm trạng thái Active */
.btn.btn-active {
    background: var(--red) !important;
    border-color: var(--red) !important;
    color: #fff !important;
}

.btn.btn-active:hover {
    background: var(--red-dark) !important;
    border-color: var(--red-dark) !important;
    color: #fff !important;
}

.generation-card-body {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.generation-avatar {
    flex: 0 0 54px !important;
    width: 54px !important;
    height: 54px !important;
    max-width: 54px !important;
    max-height: 54px !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
    border: 2px solid #d8b56f !important;
    border-radius: 50% !important;
    background: #fff2dc !important;
    box-shadow: 0 7px 16px rgba(140, 29, 24, .12) !important;
}

.generation-avatar img {
    width: 100% !important;
    height: 100% !important;
    max-width: 54px !important;
    max-height: 54px !important;
    object-fit: cover !important;
}

.generation-card-main {
    --generation-name-text-offset: 24px;
    --generation-role-text-inset: 30px;
    --generation-life-label-width: 36px;
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 4px;
}

.generation-name-view {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.generation-name-view[hidden] {
    display: none;
}

.generation-name-view h3 {
    min-width: 0;
    flex: 0 1 auto;
}

.generation-inline-name-toggle,
.generation-inline-name-save,
.generation-inline-name-cancel {
    display: inline-grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    padding: 0;
    border: 1px solid #dfc99f;
    border-radius: 50%;
    background: #fffdf8;
    color: #8c1d18;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease, transform .15s ease;
}

.generation-inline-name-toggle {
    margin-top: -2px;
    color: #8b7764;
}

.generation-inline-name-toggle:hover,
.generation-inline-name-toggle:focus-visible,
.generation-inline-name-save:hover,
.generation-inline-name-save:focus-visible {
    border-color: #8c1d18;
    background: #8c1d18;
    color: #fff;
    outline: none;
    transform: translateY(-1px);
}

.generation-inline-name-cancel:hover,
.generation-inline-name-cancel:focus-visible {
    border-color: #b8a99c;
    background: #f3eee8;
    color: #4f453d;
    outline: none;
}

/* Card action dropdown menu */
.generation-card-menu-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    width: 28px;
    height: 28px;
    border: 1px solid #dfc99f;
    border-radius: 50%;
    background: #fffdf8;
    color: #8b7764;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: -2px;
}

.generation-card-menu-toggle svg {
    display: block !important;
    margin: 0 !important;
}

.generation-card-menu-toggle:hover,
.generation-card-menu-toggle:focus-visible {
    border-color: #8c1d18;
    background: #8c1d18;
    color: #fff;
    outline: none;
    transform: translateY(-1px);
}

.generation-card-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 34px;
    width: 190px;
    background: #ffffff;
    border: 1px solid #dfc99f;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(140, 29, 24, 0.12);
    z-index: 100;
    padding: 6px 0;
    transform-origin: 100% 0;
}

.generation-card-menu-item {
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    font-size: 14px;
    color: #4f453d;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    font-weight: 600;
    box-sizing: border-box;
}

.generation-card-menu-item:hover,
.generation-card-menu-item:focus-visible {
    background: #fff4f2;
    color: #8c1d18 !important;
    outline: none;
}

.generation-card-menu-item svg {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0;
}

.generation-inline-name-form {
    min-width: 0;
    margin: 0;
}

.generation-inline-name-form[hidden] {
    display: none;
}

.generation-inline-name-fields {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.generation-inline-name-input {
    width: 100%;
    min-width: 0;
    height: 34px;
    margin: 0;
    padding: 6px 9px;
    border: 1px solid #c9a970;
    border-radius: 6px;
    background: #fff;
    color: #2f251d;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.2;
}

.generation-inline-name-input:focus {
    border-color: #8c1d18;
    outline: none;
    box-shadow: 0 0 0 3px rgba(140, 29, 24, .12);
}

.generation-inline-name-form.is-saving .generation-inline-name-input,
.generation-inline-name-form.is-saving button {
    cursor: wait;
    opacity: .62;
}

.generation-inline-name-status {
    display: block;
    max-width: 100%;
    color: #9b241f;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.generation-inline-name-status[hidden] {
    display: none;
}

.generation-inline-name-status.is-success {
    color: #24705d;
}

.generation-card.is-inline-name-editing {
    z-index: 15;
    border-color: #c9a970;
    box-shadow: 0 16px 34px rgba(61, 43, 31, .16);
}

.generation-card.is-name-saved {
    animation: generation-name-saved .9s ease;
}

@keyframes generation-name-saved {
    0%, 100% { box-shadow: 0 14px 28px rgba(31, 41, 55, .10); }
    45% { box-shadow: 0 0 0 5px rgba(36, 112, 93, .18), 0 16px 30px rgba(31, 41, 55, .14); }
}

.generation-card h3 {
    margin: 0;
    color: #2f251d;
    font-size: 17px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.generation-card:not(.generation-family-card)[data-generation="1"] h3,
.generation-card:not(.generation-family-card)[data-generation="2"] h3,
.generation-card:not(.generation-family-card)[data-generation="3"] h3 {
    color: #8c1d18;
    font-size: 21px;
    font-weight: 800;
}

.generation-card:not(.generation-family-card)[data-generation="1"] h3 {
    font-size: 23px;
}

.generation-card p {
    margin: 0;
    color: #75695e;
    font-size: 13px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.generation-card p.generation-meta-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 5px;
    row-gap: 2px;
    width: auto;
    max-width: 100%;
    margin-top: 4px;
    margin-left: var(--generation-name-text-offset);
    color: #8b7764;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.25;
    letter-spacing: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.generation-meta-item {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.generation-meta-item.is-life-years {
    color: #75695e;
}

.generation-life-year-birth {
    color: #15803d;
    font-weight: 900;
}

.generation-life-year-death {
    color: #b42318;
    font-weight: 900;
}

.generation-life-year-prefix {
    min-width: var(--generation-life-label-width);
    color: #8b7764;
    font-weight: 800;
    margin-right: 4px;
    text-align: left;
}
.generation-life-year-separator {
    color: #8b7764;
    font-weight: 800;
}

.generation-life-year-separator {
    margin: 0 3px;
}

.generation-meta-item.is-founder,
.generation-meta-item.is-role-clan {
    color: #8c1d18;
    font-weight: 850;
}

.generation-meta-item.is-role-branch {
    color: #7a5317;
    font-weight: 850;
}

.generation-meta-item.is-adopted {
    color: #0284c7;
    font-weight: 850;
}

.generation-meta-separator {
    color: #c4a168;
    font-weight: 900;
    line-height: 1;
}

.generation-card p.generation-branch-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
    margin-left: var(--generation-name-text-offset);
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.member-edit-preview-main p.generation-branch-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.generation-founder-badge {
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 4px;
    border: 1px solid #e3b84c;
    border-radius: 999px;
    background: linear-gradient(135deg, #fff8df, #fff0bd);
    box-shadow: 0 2px 5px rgba(140, 29, 24, .10);
    color: #8c1d18;
    font-family: var(--family-tree-font);
    font-size: 12px;
    font-weight: 900;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.generation-founder-icon {
    width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 20px;
    border-radius: 50%;
    background: #8c1d18;
    color: #ffffff;
}

.generation-founder-icon svg {
    width: 13px;
    height: 13px;
    display: block;
}

.generation-role-badge {
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 4px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.generation-role-icon {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 18px;
    border-radius: 50%;
    color: #ffffff;
    font-size: 11px;
    line-height: 1;
}

.generation-role-badge-clan {
    color: #8c1d18;
    background: #fff0c9;
    border-color: #e3b84c;
}

.generation-role-badge-clan .generation-role-icon {
    background: #8c1d18;
}

.generation-role-badge-branch {
    color: #7a5317;
    background: #fff7e6;
    border-color: #d8b56f;
}

.generation-role-badge-branch .generation-role-icon {
    background: #b8862f;
}


.generation-spouse-list {
    display: grid;
    gap: 7px;
    margin-top: auto;
    min-width: 0;
}

.generation-spouse-row {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 30px;
    padding: 5px 7px 5px 12px;
    border: 1px solid #dfc99f;
    border-radius: 999px;
    background: rgba(255, 250, 241, .90);
    color: var(--red);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.generation-spouse-row a {
    position: relative;
    z-index: 1;
    min-width: 0;
    flex: 1 1 auto;
    margin-right: 0;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.generation-spouse-row.is-living {
    border-color: rgba(47, 111, 94, .26);
}

.generation-spouse-row.is-deceased {
    border-color: rgba(140, 29, 24, .26);
    background: rgba(255, 247, 238, .92);
}

.generation-spouse-status {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    display: inline-block;
    margin-right: 6px;
    border: 1px solid rgba(255, 253, 248, .92);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(184, 134, 47, .10);
}

.generation-spouse-status.is-living {
    background: var(--green);
}

.generation-spouse-add {
    flex: 0 0 auto;
    margin: 0;
}

.generation-spouse-add-button {
    position: relative;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(140, 29, 24, .18);
    border-radius: 50%;
    background: #ffffff;
    color: transparent;
    font-size: 0;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(140, 29, 24, .10);
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.generation-spouse-add-button::before,
.generation-spouse-add-button::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 2px;
    border-radius: 999px;
    background: var(--red);
    transform: translate(-50%, -50%);
}

.generation-spouse-add-button::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.generation-spouse-add-button:hover,
.generation-spouse-add-button:focus-visible {
    border-color: rgba(140, 29, 24, .34);
    background: #fff4f2;
    transform: translateY(-1px);
    outline: none;
}

.generation-node-edit {
    flex: 0 0 auto;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border: 1px solid #dfc99f;
    border-radius: 999px;
    background: rgba(255, 253, 248, .82);
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.generation-node-edit:hover,
.generation-node-edit:focus-visible {
    border-color: rgba(140, 29, 24, .3);
    background: #fff4f2;
}

.generation-add-form {
    position: absolute;
    left: 50%;
    bottom: -38px;
    margin: 0;
    transform: translateX(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.generation-add-button {
    position: relative;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    margin: 0;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: var(--danger);
    color: transparent;
    font-size: 0;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background .18s ease, transform .18s ease;
}

.generation-add-button::before,
.generation-add-button::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 15px;
    height: 3px;
    border-radius: 999px;
    background: #ffffff;
    transform: translate(-50%, -50%);
}

.generation-add-button::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.generation-add-button:hover,
.generation-add-button:focus-visible {
    background: var(--red-dark);
    box-shadow: none;
    transform: translateY(-1px);
    outline: none;
}

.setup-page {
    background: var(--wash);
}

@media (max-width: 960px) {
    .nav-toggle {
        display: inline-grid;
        place-items: center;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 74px;
        left: 16px;
        right: 16px;
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
        box-shadow: var(--shadow);
    }

    .main-nav.is-open {
        display: flex;
    }

    .site-header .main-nav > a:not(.btn) {
        color: var(--ink);
    }

    .site-header .main-nav > a:not(.btn):hover {
        background: var(--wash);
        color: var(--red-dark);
    }

    .site-header .main-nav > .btn-outline {
        border-color: var(--red);
        background: transparent;
        color: var(--red);
    }

    .site-header .main-nav > .btn-outline:hover {
        border-color: var(--red);
        background: var(--red);
        color: #fff;
    }

    .site-header .main-nav > .btn:not(.btn-outline) {
        border-color: var(--red);
        background: var(--red);
        color: #fff;
    }

    .site-account {
        width: 100%;
    }

    .site-account-toggle {
        width: 100%;
        max-width: none;
        justify-content: flex-start;
        border-color: var(--line);
        background: #fff;
    }

    .site-header .site-account-toggle {
        color: var(--ink);
    }

    .site-header .site-account-toggle:hover,
    .site-header .site-account-toggle[aria-expanded="true"] {
        border-color: var(--line);
        background: #fff;
        box-shadow: none;
    }

    .site-header .site-account-toggle .site-account-copy span {
        color: var(--ink);
    }

    .site-header .site-account-toggle .site-account-copy small {
        color: #5d5046;
    }

    .site-header .site-account-toggle .site-account-chevron {
        color: var(--muted);
    }

    .site-account-copy {
        flex: 1 1 auto;
    }

    .site-account-menu {
        position: static;
        width: 100%;
        margin-top: 8px;
        box-shadow: none;
    }

    .hero {
        min-height: 620px;
    }

    .hero h1 {
        font-size: 44px;
    }

    .split,
    .profile-layout,
    .family-contribution-layout,
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-nav,
    .profile-card {
        position: static;
    }

    .admin-topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
        gap: 10px;
    }

    .admin-header-brand {
        min-width: 0;
    }

    .admin-topnav {
        grid-column: 1 / -1;
        display: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        width: 100%;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
        box-shadow: var(--shadow);
    }

    .admin-topnav.is-open {
        display: flex;
    }

    .admin-topnav a {
        min-height: 42px;
        color: #4d5663;
    }

    .admin-topnav a:hover {
        background: #fff7f2;
        color: var(--red);
    }

    .admin-topnav a.active {
        background: var(--red);
        color: #fff;
        box-shadow: none;
    }

    .admin-menu-btn {
        display: grid;
    }

    .stat-grid,
    .card-grid,
    .gallery-strip,
    .gallery-grid,
    .photo-grid,
    .media-grid,
    .admin-stat-grid,
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tree-toolbar {
        grid-template-columns: 1fr;
    }

    .member-edit-layout {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .member-edit-preview-inner {
        position: static;
        padding-top: 0;
    }

    .member-form-section {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .admin-contribution-meta {
        grid-template-columns: 1fr;
    }

    .member-section-copy p {
        max-width: 560px;
    }

    .member-form-grid .field-span-3,
    .member-form-grid .field-span-4,
    .member-form-grid .field-span-5,
    .member-form-grid .field-span-6 {
        grid-column: span 6;
    }

    .generation-tree-stage {
        padding-inline: 16px;
    }
}

@media (max-width: 620px) {
    .container,
    .admin-shell {
        width: min(100% - 22px, 1160px);
    }

    .header-inner {
        min-height: 66px;
    }

    .main-nav {
        top: 66px;
    }

    .hero {
        min-height: 560px;
    }

    .hero-content {
        padding: 52px 0 84px;
    }

    .hero h1,
    .page-hero h1,
    .article-body h1 {
        font-size: 34px;
    }

    .section {
        padding: 42px 0;
    }

    .section-head,
    .admin-head {
        display: grid;
    }

    .section-actions {
        justify-content: flex-start;
    }

    .stat-grid,
    .card-grid,
    .gallery-strip,
    .gallery-grid,
    .photo-grid,
    .media-grid,
    .admin-stat-grid,
    .form-grid,
    .relation-list {
        grid-template-columns: 1fr;
    }

    .admin-photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .admin-media-card-body {
        display: grid;
        align-items: stretch;
    }

    .admin-media-card-body form,
    .admin-media-delete-button {
        width: 100%;
    }

    .member-form-grid {
        grid-template-columns: 1fr;
    }

    .member-form-grid .field-span-3,
    .member-form-grid .field-span-4,
    .member-form-grid .field-span-5,
    .member-form-grid .field-span-6,
    .member-form-grid .field-span-12 {
        grid-column: 1 / -1;
    }

    .member-detail-head,
    .member-form-actions {
        display: grid;
    }

    .member-form-actions .btn,
    .member-delete-form .btn {
        width: 100%;
    }

    .info-list {
        grid-template-columns: 1fr;
    }

    .auth-card,
    .admin-panel,
    .info-panel,
    .profile-card {
        padding: 18px;
    }

    .admin-topbar {
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 12px;
    }

    body.admin-body .admin-layout {
        padding-top: 132px;
    }

    .admin-header-brand {
        padding: 8px 10px;
    }

    .admin-header-brand span:last-child {
        min-width: 0;
    }

    .admin-header-brand strong,
    .admin-header-brand small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-header-actions {
        grid-column: 1 / -1;
        width: 100%;
        margin-left: 0;
    }

    .admin-header-actions .btn {
        flex: 1 1 0;
        justify-content: center;
        min-width: 0;
        padding-inline: 9px;
    }

    .admin-upload-health {
        gap: 6px;
        padding: 5px 9px 5px 6px;
    }

    .admin-upload-health-icon {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }

    .admin-topnav {
        grid-column: 1 / -1;
    }

    .admin-page-content {
        padding: 16px 12px 34px;
    }

    .admin-user span:last-child {
        display: none;
    }

    .admin-tabs {
        margin-inline: -2px;
    }

    .admin-contribution-status-tabs {
        margin-left: 12px !important;
        margin-right: 12px !important;
        max-width: calc(100% - 24px);
    }

    .admin-tab {
        min-height: 42px;
        padding-inline: 13px;
    }

    .admin-panel-head,
    .admin-contribution-item-head,
    .admin-form-actions,
    .admin-category-form,
    .gallery-upload-form {
        display: grid;
    }

    .family-contribution-fields {
        grid-template-columns: 1fr;
    }

    .family-tree-contribution-head {
        display: grid;
    }

    .family-tree-contribution-form {
        grid-template-columns: 1fr;
    }

    .family-tree-contribution-form .field-span-3,
    .family-tree-contribution-form .field-span-6,
    .family-tree-contribution-form .field-span-9,
    .family-tree-contribution-form .field-span-12 {
        grid-column: 1 / -1;
    }

    .family-contribution-actions,
    .family-tree-contribution-actions,
    .admin-contribution-review-actions {
        display: grid;
    }

    .family-contribution-actions .btn,
    .family-tree-contribution-actions .btn,
    .admin-contribution-review-actions .btn {
        width: 100%;
    }

    .family-contribution-edit-head,
    .admin-contribution-structured-head,
    .member-change-history-item header,
    .member-change-history-head {
        flex-direction: column;
    }

    .family-contribution-edit-grid {
        grid-template-columns: 1fr;
    }

    .family-contribution-edit-grid .field-span-6,
    .family-contribution-edit-grid .field-span-12 {
        grid-column: 1 / -1;
    }

    .family-contribution-avatar-control,
    .family-contribution-avatar-control.has-preview {
        grid-template-columns: 1fr;
    }

    .family-contribution-avatar-preview {
        width: fit-content;
    }

    .family-contribution-avatar-picker {
        grid-template-columns: 40px minmax(0, 1fr);
        padding: 12px;
    }

    .family-contribution-avatar-picker-icon {
        width: 40px;
        height: 40px;
    }

    .family-contribution-avatar-picker-action {
        grid-column: 2;
        justify-self: start;
    }

    .member-change-history-row {
        grid-template-columns: 1fr;
    }

    .member-change-history-row .history-arrow {
        min-width: 0;
        padding: 0;
    }

    .gallery-upload-options {
        grid-template-columns: 1fr;
    }

    .gallery-album-basics {
        grid-template-columns: 1fr;
    }

    .gallery-upload-form .btn {
        width: 100%;
    }

    .admin-panel-head .btn,
    .admin-form-actions .btn,
    .admin-category-form input,
    .admin-category-form .btn {
        width: 100%;
        max-width: none;
    }

    th,
    td {
        padding: 10px 8px;
    }

    .generation-tree-stage {
        padding: 24px 12px 42px;
    }

    .generation-markers-axis {
        width: 64px;
        background: linear-gradient(to right, rgba(255, 250, 241, .94) 0%, rgba(255, 250, 241, .74) 58%, rgba(255, 250, 241, 0) 100%);
    }

    .generation-axis-line {
        left: 30px;
        width: 2px;
        background: repeating-linear-gradient(to bottom, var(--gold) 0, var(--gold) 5px, transparent 5px, transparent 11px);
    }

    .generation-axis-badge {
        left: 2px;
        width: 60px;
        height: 30px;
        grid-template-columns: 16px minmax(0, 1fr) 16px;
        gap: 1px;
        padding: 0 2px;
        border-width: 2px;
        border-radius: 999px;
        background: rgba(255, 253, 248, .96);
        box-shadow: 0 4px 12px rgba(68, 40, 18, .12);
    }

    .generation-axis-label {
        font-size: 0;
    }

    .generation-axis-badge-static {
        display: flex;
        align-items: center;
        justify-content: center;
        padding-inline: 4px;
    }

    .generation-axis-static-label {
        display: block;
        width: 100%;
        font-size: 12px;
        line-height: 1;
        text-align: center;
        white-space: nowrap;
    }

    .generation-axis-jump::before {
        content: attr(data-generation-number);
        color: var(--red);
        font-size: 12px;
        font-weight: 900;
        line-height: 1;
        white-space: nowrap;
    }

    .generation-axis-nav-btn {
        width: 16px;
        height: 16px;
    }

    .generation-axis-nav-btn svg {
        width: 10px;
        height: 10px;
    }

    .generation-add-button {
        width: 32px;
        height: 32px;
    }
}

.generation-parent-chip {
    background: #fffaf1;
    color: #705b39;
    border-color: #dfc99f;
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.generation-card:not(.generation-family-card)[data-generation="1"] .generation-parent-chip,
.generation-card:not(.generation-family-card)[data-generation="2"] .generation-parent-chip,
.generation-card:not(.generation-family-card)[data-generation="3"] .generation-parent-chip {
    background: #fffaf1;
    color: #705b39;
    border-color: #dfc99f;
    box-shadow: none;
}


.tree-card .tree-card-parent {
    display: block;
    font-size: 11px;
    color: #718096;
    margin-top: 2px;
    font-style: italic;
}

/* Tree Search styles */
.generation-view-actions {
    gap: 8px !important;
}

.tree-search-container {
    position: relative;
    width: 260px;
}

.tree-search-input {
    width: 100%;
    height: 42px;
    padding: 10px 16px 10px 38px;
    border: 1px solid #d8e0ea;
    border-radius: 6px;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2375695e' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 12px center;
    font-size: 14px;
    color: #18202c;
    outline: none;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.tree-search-input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(140, 29, 24, .1);
}

.tree-search-results {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    width: 260px;
    max-height: 280px;
    margin-top: 6px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(31, 41, 55, .15);
    display: none;
}

.tree-search-result-item {
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid #f3f4f6;
    background: #fff;
    color: inherit;
    font: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
    transition: background-color .15s ease;
}

.tree-search-result-item:last-child {
    border-bottom: none;
}

.tree-search-result-item:hover,
.tree-search-result-item:focus-visible {
    background-color: #f9fafb;
    outline: none;
}

.tree-search-result-name {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px 7px;
    font-size: 13px;
    font-weight: 700;
    color: #111827;
}

.tree-search-result-meta {
    font-size: 11px;
    color: #6b7280;
}

.tree-search-empty {
    padding: 14px;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

.tree-control-label {
    display: block;
    margin-bottom: 4px;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.tree-root-picker {
    position: relative;
    width: 330px;
    max-width: 100%;
}

.tree-root-control-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tree-root-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 5px 10px 5px 12px;
    border: 1px solid #d8e0ea;
    border-radius: 6px;
    background: #fff;
    color: #18202c;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.tree-root-trigger:hover {
    border-color: #c9a970;
    background: #fffdf8;
}

.tree-root-trigger:focus-visible,
.tree-root-picker.is-open .tree-root-trigger {
    border-color: var(--red);
    outline: none;
    box-shadow: 0 0 0 3px rgba(140, 29, 24, .1);
}

.tree-root-trigger-icon {
    flex: 0 0 auto;
    color: var(--red);
}

.tree-root-trigger-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 1px;
}

.tree-root-trigger-copy strong,
.tree-root-trigger-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-root-trigger-copy strong {
    font-size: 13px;
    line-height: 1.2;
}

.tree-root-trigger-copy small {
    color: #75695e;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
}

.tree-root-trigger-chevron {
    flex: 0 0 auto;
    color: #75695e;
    transition: transform .15s ease;
}

.tree-root-picker.is-open .tree-root-trigger-chevron {
    transform: rotate(180deg);
}

.tree-root-reset {
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border: 1px solid #e3cfc0;
    border-radius: 6px;
    background: #fff;
    color: var(--red);
    transition: border-color .15s ease, background-color .15s ease;
}

.tree-root-reset:hover,
.tree-root-reset:focus-visible {
    border-color: var(--red);
    background: #fff7f5;
    outline: none;
}

.tree-root-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 220;
    width: min(390px, calc(100vw - 48px));
    overflow: hidden;
    border: 1px solid #dfd2c6;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(51, 35, 24, .18);
}

.tree-root-popover[hidden] {
    display: none;
}

.tree-root-search-wrap {
    position: relative;
    padding: 12px;
    border-bottom: 1px solid #eee4da;
    background: #fffdf9;
}

.tree-root-search-wrap > svg {
    position: absolute;
    top: 50%;
    left: 25px;
    color: #75695e;
    pointer-events: none;
    transform: translateY(-50%);
}

.tree-root-search-wrap input {
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 8px 12px 8px 38px;
    border: 1px solid #d8c9bb;
    border-radius: 6px;
    background: #fff;
    color: #18202c;
    font-size: 13px;
}

.tree-root-search-wrap input:focus {
    border-color: var(--red);
    outline: none;
    box-shadow: 0 0 0 3px rgba(140, 29, 24, .1);
}

.tree-root-options {
    max-height: 330px;
    overflow-y: auto;
    padding: 6px;
}

.tree-root-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 7px 10px 7px calc(10px + (var(--root-depth, 0) * 8px));
    border-radius: 6px;
    color: #2f2925;
    text-decoration: none;
}

.tree-root-option[hidden] {
    display: none;
}

.tree-root-option:hover,
.tree-root-option:focus-visible {
    background: #f8f3eb;
    outline: none;
}

.tree-root-option.is-selected {
    background: #fff0ed;
    color: var(--red);
}

.tree-root-option-marker {
    display: grid;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    place-items: center;
    color: #a16e25;
}

.tree-root-option-marker:empty::before {
    width: 7px;
    height: 7px;
    border: 2px solid #c9a970;
    border-radius: 50%;
    background: #fff;
    content: '';
}

.tree-root-option-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 2px;
}

.tree-root-option-title {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 7px;
}

.tree-root-option-title.has-wife strong {
    max-width: 58%;
}

.tree-root-option-wife {
    min-width: 0;
    overflow: hidden;
    color: #8a5a1e;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-root-option-copy strong,
.tree-root-option-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-root-option-copy strong {
    font-size: 13px;
    line-height: 1.25;
}

.tree-root-option-copy small {
    color: #75695e;
    font-size: 11px;
    line-height: 1.25;
}

.tree-root-option-check {
    flex: 0 0 auto;
}

.tree-root-empty {
    margin: 0;
    padding: 24px 16px;
    color: #75695e;
    font-size: 13px;
    text-align: center;
}

@keyframes pulse-highlight {
    0% {
        box-shadow: 0 0 0 0px rgba(140, 29, 24, 0.4), 0 14px 28px rgba(31, 41, 55, .10);
        border-color: var(--red);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(140, 29, 24, 0.2), 0 14px 28px rgba(31, 41, 55, .10);
        border-color: var(--red);
    }
    100% {
        box-shadow: 0 0 0 0px rgba(140, 29, 24, 0), 0 14px 28px rgba(31, 41, 55, .10);
    }
}

.generation-card.search-highlight {
    animation: pulse-highlight 1s ease-in-out 3;
    border-color: var(--red) !important;
}

.generation-card.search-highlight .generation-spouse-row.search-spouse-highlight {
    border-color: var(--red) !important;
    background: #fff0eb !important;
    color: var(--red-dark) !important;
    box-shadow: 0 0 0 3px rgba(140, 29, 24, .16);
}

/* Fade effect for other cards and lines during search highlight */
.generation-tree-stage.has-search-highlight .generation-card:not(.search-highlight) {
    opacity: 0.3;
}

.generation-tree-stage.has-search-highlight .generation-line,
.generation-tree-stage.has-search-highlight .generation-tree-line {
    opacity: 0.15;
    transition: opacity 0.18s ease;
}

.generation-export-menu {
    position: fixed;
    z-index: 10050;
    display: grid;
    gap: 8px;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #dfc99f;
    border-radius: 12px;
    background: #fffdf8;
    box-shadow: 0 18px 42px rgba(68, 40, 18, .2);
    color: #33271f;
}

.generation-export-menu[hidden] {
    display: none !important;
}

.generation-export-menu-title {
    padding: 1px 3px 5px;
    color: #8c1d18;
    font-size: 14px;
    font-weight: 800;
}

.generation-export-option {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #e6d7bc;
    border-radius: 9px;
    background: #fff;
    color: #44372c;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.generation-export-option:hover,
.generation-export-option:focus-visible {
    border-color: #b8862f;
    background: #fff8e9;
    outline: none;
    transform: translateY(-1px);
}

.generation-export-option.is-recommended {
    border-color: rgba(47, 111, 94, .48);
    background: #f5fbf8;
}

.generation-export-option strong {
    color: #2f251d;
    font-size: 13px;
}

.generation-export-option strong span {
    display: inline-block;
    margin-left: 5px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #2f6f5e;
    color: #fff;
    font-size: 9px;
    letter-spacing: .02em;
    text-transform: uppercase;
    vertical-align: 1px;
}

.generation-export-option small {
    color: #75695c;
    font-size: 11px;
    line-height: 1.45;
}

.generation-export-menu-meta {
    padding: 3px 3px 0;
    color: #8b7764;
    font-size: 10px;
}

.generation-export-spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-right: 6px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: generation-export-spin .7s linear infinite;
    vertical-align: -2px;
}

@keyframes generation-export-spin {
    to {
        transform: rotate(360deg);
    }
}

.biography-content ul,
.rich-text-content ul {
    list-style-type: disc !important;
    margin-left: 24px !important;
    margin-top: 8px !important;
    margin-bottom: 12px !important;
}
.biography-content ol,
.rich-text-content ol {
    list-style-type: decimal !important;
    margin-left: 24px !important;
    margin-top: 8px !important;
    margin-bottom: 12px !important;
}
.biography-content li,
.rich-text-content li {
    margin-bottom: 4px !important;
    line-height: 1.6 !important;
    display: list-item !important;
    list-style: inherit !important;
}
.biography-content p,
.rich-text-content p {
    margin-bottom: 12px !important;
    line-height: 1.6 !important;
}
.biography-content blockquote,
.rich-text-content blockquote {
    border-left: 4px solid #cbd5e1 !important;
    padding-left: 16px !important;
    color: #475569 !important;
    font-style: italic !important;
    margin-bottom: 12px !important;
}

.ck-editor__editable_inline {
    min-height: 300px !important;
}

.rich-text-content figure.table {
    overflow-x: auto;
    margin: 22px 0;
}

.rich-text-content figure.image,
.rich-text-content figure.media {
    margin: 26px 0;
}

.rich-text-content img,
.rich-text-editor-field .ck-content img {
    max-width: 100%;
    height: auto !important;
}

.rich-text-content figure.image img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 10px;
}

.rich-text-content figure.image figcaption {
    margin-top: 9px;
    color: var(--muted);
    font-size: 14px;
    font-style: italic;
    line-height: 1.5;
    text-align: center;
}

.rich-text-editor-field .ck-content figure.image figcaption {
    font-style: italic;
}

.rich-text-media-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
}

.rich-text-media-frame iframe,
.rich-text-media-frame video {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: contain;
}

.rich-text-content table {
    width: 100%;
    border-collapse: collapse;
}

.rich-text-content th,
.rich-text-content td {
    padding: 10px 12px;
    border: 1px solid var(--line);
    text-align: left;
}

.rich-text-content a {
    color: var(--red);
    text-decoration: underline;
}

.rich-text-editor-field {
    min-width: 0;
}

.rich-text-editor-field > label {
    display: block;
    margin-bottom: 8px;
}

.rich-text-editor-field > .field-help,
.rich-text-editor-field > small {
    display: block;
    margin-top: 8px;
}

.rich-text-editor-field .ck.ck-editor {
    width: 100%;
    min-width: 0;
}

.rich-text-editor-field .ck.ck-editor__top {
    position: sticky;
    top: var(--rich-text-sticky-top, 74px);
    z-index: 1200;
}

.rich-text-editor-field .ck.ck-editor__top .ck-sticky-panel__content {
    background: #fff;
    box-shadow: 0 5px 14px rgba(24, 31, 42, .12);
}

/* CKEditor switches this inner panel to position: fixed once typing starts.
   Keep that focused state below the fixed admin navigation as well. */
.rich-text-editor-field .ck.ck-editor__top .ck-sticky-panel__content.ck-sticky-panel__content_sticky {
    top: var(--rich-text-sticky-top, 74px) !important;
    z-index: 1200 !important;
}

.rich-text-editor-field .ck.ck-toolbar {
    border-color: var(--line) !important;
    border-radius: 8px 8px 0 0 !important;
}

.rich-text-editor-field .ck-toolbar__items {
    flex-wrap: wrap !important;
}

.rich-text-editor-field .ck-editor__editable_inline {
    min-height: 300px !important;
    border-color: var(--line) !important;
    border-radius: 0 0 8px 8px !important;
    box-shadow: none;
}

.rich-text-editor-field-compact .ck-editor__editable_inline {
    min-height: 190px !important;
}

.rich-text-editor-field .ck-editor__editable_inline.ck-focused {
    border-color: var(--red) !important;
    box-shadow: 0 0 0 2px rgba(140, 29, 24, .12) !important;
}

.rich-text-content > :first-child,
.home-announcement-message > :first-child,
.donation-note-rendered > :first-child {
    margin-top: 0 !important;
}

.rich-text-content > :last-child,
.home-announcement-message > :last-child,
.donation-note-rendered > :last-child {
    margin-bottom: 0 !important;
}

.home-announcement-message {
    max-width: 860px;
    margin-top: 10px;
    color: #6e6055;
    font-size: 15px;
    line-height: 1.65;
}

.home-announcement-message h2,
.home-announcement-message h3,
.home-announcement-message h4 {
    margin: 14px 0 6px;
    color: #7e1915;
    font-size: 1.08em;
}

.home-announcement-message img,
.home-announcement-message video,
.home-announcement-message iframe {
    max-height: 420px;
}

.donation-note-rendered {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 620px) {
    .rich-text-editor-field .ck-editor__editable_inline {
        min-height: 240px !important;
    }

    .rich-text-editor-field-compact .ck-editor__editable_inline {
        min-height: 170px !important;
    }
}

/* Slideshow Hero Adjustments */
.hero.slider-container {
    position: relative;
    min-height: calc(100vh - 74px);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
    display: block; /* Overrides display: grid since children will be positioned absolutely */
}

.hero-slides {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 74px);
}

.hero-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 1;
    transition: opacity 0.8s ease-in-out;
    display: grid;
    align-items: center;
    pointer-events: none; /* Disable mouse events on inactive slide content */
}

.hero-slide.active {
    opacity: 1;
    z-index: 2;
    pointer-events: auto; /* Enable mouse events on active slide content */
}

/* Clickable entire slide */
.hero-slide-link {
    position: absolute;
    inset: 0;
    display: block;
    z-index: 5;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Hide gradient overlay to show full colors */
.hero.slider-container .hero-media::after {
    display: none;
}

.hero-slide-link:hover .hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.08); /* Subtle dark overlay on hover */
    display: block !important;
}

/* Slider Controls */
.slider-prev,
.slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(47, 37, 29, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    user-select: none;
}

.slider-prev:hover,
.slider-next:hover {
    background: var(--red);
    border-color: var(--red);
    box-shadow: 0 4px 12px rgba(140, 29, 24, 0.3);
}

.slider-prev {
    left: 24px;
}

.slider-next {
    right: 24px;
}

.slider-dots {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 10px;
}

.slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-dot:hover {
    background: rgba(255, 255, 255, 0.7);
}

.slider-dot.active {
    background: var(--gold);
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(184, 134, 47, 0.5);
}

@media (max-width: 768px) {
    .hero.slider-container {
        min-height: 0;
        aspect-ratio: 12 / 5;
    }

    .hero.slider-container .hero-slides {
        height: 100%;
        min-height: 0;
    }

    .hero.slider-container .hero-media img {
        object-position: center;
    }

    .slider-prev,
    .slider-next {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }
    
    .slider-prev {
        left: 12px;
    }
    
    .slider-next {
        right: 12px;
    }
    
    .slider-dots {
        bottom: 10px;
        gap: 8px;
    }

    .slider-dot {
        width: 8px;
        height: 8px;
    }
}

/* Homepage announcements */
.home-announcement-section {
    scroll-margin-top: 92px;
    padding: 38px 0 42px;
    border-bottom: 0;
    background: var(--paper);
}

.home-announcement-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.home-announcement-heading .eyebrow {
    margin: 0 0 3px;
}

.home-announcement-heading h2 {
    margin: 0;
    color: var(--red);
    font-family: var(--family-tree-font);
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1.25;
}

.home-announcement-count {
    flex: 0 0 auto;
    padding: 5px 11px;
    border: 1px solid #ddcba9;
    border-radius: 999px;
    background: rgba(255, 255, 255, .82);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.home-announcement-list {
    display: grid;
    gap: 12px;
}

.home-announcement-card {
    --announcement-accent: var(--green);
    --announcement-soft: #eaf4f0;
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 36px;
    align-items: start;
    gap: 16px;
    padding: 20px 18px 20px 20px;
    overflow: hidden;
    border: 1px solid #e7d7bd;
    border-left: 4px solid var(--announcement-accent);
    border-radius: 14px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 10px 28px rgba(68, 40, 18, .07);
    transition: opacity .22s ease, transform .22s ease, box-shadow .22s ease;
}

.home-announcement-card:hover {
    box-shadow: 0 14px 34px rgba(68, 40, 18, .11);
}

.home-announcement-card.type-event {
    --announcement-accent: #a86f16;
    --announcement-soft: #fff3da;
}

.home-announcement-card.type-important {
    --announcement-accent: var(--red);
    --announcement-soft: #fbe9e7;
}

.home-announcement-card.is-dismissing {
    opacity: 0;
    transform: translateY(-8px);
}

.home-announcement-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--announcement-soft);
    color: var(--announcement-accent);
}

.home-announcement-icon svg {
    width: 24px;
    height: 24px;
}

.home-announcement-content {
    min-width: 0;
}

.home-announcement-type {
    display: block;
    margin-bottom: 3px;
    color: var(--announcement-accent);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.home-announcement-content h3 {
    margin: 0;
    color: var(--ink);
    font-size: 19px;
    line-height: 1.35;
}

.home-announcement-content p {
    max-width: 900px;
    margin: 7px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.home-announcement-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 11px;
    color: var(--announcement-accent);
    font-size: 14px;
    font-weight: 800;
}

.home-announcement-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.home-announcement-dismiss {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #8a8179;
    cursor: pointer;
    transition: color .2s ease, background .2s ease;
}

.home-announcement-dismiss:hover,
.home-announcement-dismiss:focus-visible {
    background: #f3ede5;
    color: var(--red);
    outline: none;
}

.home-announcement-dismiss svg {
    width: 18px;
    height: 18px;
}

/* Announcement admin list */
.announcement-admin-copy {
    min-width: 260px;
}

.announcement-admin-copy strong,
.announcement-admin-copy span,
.announcement-schedule-cell span {
    display: block;
}

.announcement-admin-copy span,
.announcement-schedule-cell {
    color: var(--muted);
    font-size: 13px;
}

.announcement-admin-copy span {
    margin-top: 4px;
    line-height: 1.5;
}

.announcement-schedule-cell {
    min-width: 180px;
}

.announcement-type-badge.type-info {
    background: #e8f5ef;
    color: #24704f;
}

.announcement-type-badge.type-event {
    background: #fff3da;
    color: #89580c;
}

.announcement-type-badge.type-important {
    background: #fbe9e7;
    color: var(--red);
}

.badge-active {
    background: #e8f5ef;
    color: #24704f;
}

.badge-upcoming {
    background: #eaf1ff;
    color: #345d9d;
}

.badge-expired {
    background: #f1f3f5;
    color: #66707c;
}

@media (max-width: 768px) {
    .home-announcement-section {
        padding: 30px 0 34px;
    }

    .home-announcement-heading {
        align-items: start;
    }

    .home-announcement-card {
        grid-template-columns: 42px minmax(0, 1fr) 30px;
        gap: 12px;
        padding: 17px 12px 17px 15px;
    }

    .home-announcement-icon {
        width: 42px;
        height: 42px;
        border-radius: 10px;
    }

    .home-announcement-icon svg {
        width: 21px;
        height: 21px;
    }

    .home-announcement-content h3 {
        font-size: 17px;
    }
}

/* Account notification center */
.site-account-cluster {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.site-notification-button {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(247, 208, 138, .5);
    border-radius: 10px;
    background: rgba(255, 255, 255, .08);
    color: #f7d08a;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025);
    transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}

.site-notification-button:hover,
.site-notification-button:focus-visible {
    border-color: #f7d08a;
    background: rgba(255, 255, 255, .16);
    color: #fff3d6;
    box-shadow: 0 8px 20px rgba(68, 10, 10, .14), inset 0 0 0 1px rgba(255, 255, 255, .06);
    outline: none;
}

.site-notification-button svg {
    width: 22px;
    height: 22px;
}

.site-notification-label {
    display: none;
}

.site-notification-count {
    position: absolute;
    top: -7px;
    right: -7px;
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 4px;
    border: 2px solid var(--red);
    border-radius: 999px;
    background: #f7d08a;
    color: #711411;
    box-shadow: 0 3px 8px rgba(68, 10, 10, .24);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.account-notification-page {
    min-height: calc(100vh - 74px);
    padding: 42px 0 64px;
    background:
        radial-gradient(circle at 15% 0, rgba(195, 145, 65, .08), transparent 30%),
        linear-gradient(180deg, #fbf7ef 0%, #f6efe3 100%);
}

.account-notification-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}

.account-notification-hero,
.account-notification-hero-copy,
.account-notification-summary,
.account-notification-toolbar,
.account-notification-list,
.account-notification-item {
    min-width: 0;
}

.account-notification-hero {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 28px;
    overflow: hidden;
    padding: 31px 34px;
    border: 1px solid #d9c49f;
    border-radius: 14px;
    background: linear-gradient(128deg, #8d1d18 0%, #711411 46%, #57100e 100%);
    box-shadow: 0 16px 34px rgba(81, 30, 19, .14);
}

.account-notification-hero::before,
.account-notification-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    border: 1px solid rgba(245, 207, 135, .16);
    border-radius: 50%;
}

.account-notification-hero::before {
    width: 220px;
    height: 220px;
    top: -142px;
    right: 28%;
}

.account-notification-hero::after {
    width: 150px;
    height: 150px;
    right: -64px;
    bottom: -92px;
}

.account-notification-hero-copy {
    max-width: 650px;
}

.account-notification-eyebrow {
    display: block;
    margin-bottom: 7px;
    color: #f3ce86;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.account-notification-hero h1 {
    margin: 0;
    color: #fff9ee;
    font-family: var(--family-tree-font), Georgia, serif;
    font-size: clamp(28px, 3vw, 39px);
    line-height: 1.18;
}

.account-notification-hero p {
    max-width: 620px;
    margin: 10px 0 0;
    color: rgba(255, 249, 238, .78);
    font-size: 15px;
    line-height: 1.6;
}

.account-notification-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(95px, 1fr));
    gap: 9px;
}

.account-notification-summary > div {
    min-width: 100px;
    padding: 13px 14px;
    border: 1px solid rgba(244, 207, 136, .24);
    border-radius: 10px;
    background: rgba(255, 250, 240, .08);
    text-align: center;
}

.account-notification-summary strong,
.account-notification-summary span {
    display: block;
}

.account-notification-summary strong {
    color: #f6d38f;
    font-family: var(--family-tree-font), Georgia, serif;
    font-size: 27px;
    line-height: 1;
}

.account-notification-summary span {
    margin-top: 6px;
    color: rgba(255, 249, 238, .74);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.account-notification-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px;
    border: 1px solid #e2d3ba;
    border-radius: 12px;
    background: rgba(255, 254, 250, .88);
    box-shadow: 0 8px 22px rgba(77, 45, 22, .05);
}

.account-notification-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.account-notification-tabs a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 8px;
    color: #62554b;
    font-size: 13px;
    font-weight: 800;
}

.account-notification-tabs a:hover,
.account-notification-tabs a:focus-visible {
    background: #f6eddf;
    color: var(--red);
    outline: none;
}

.account-notification-tabs a.is-active {
    background: #911e19;
    color: #fff;
}

.account-notification-tabs b {
    display: grid;
    place-items: center;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(101, 78, 56, .1);
    font-size: 10px;
    line-height: 1;
}

.account-notification-tabs a.is-active b {
    background: rgba(255, 255, 255, .18);
}

.account-notification-mark-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #d5bd96;
    border-radius: 8px;
    background: #fffaf0;
    color: #7b1b17;
    font-size: 13px;
    font-weight: 850;
    white-space: nowrap;
    cursor: pointer;
}

.account-notification-mark-all:hover:not(:disabled),
.account-notification-mark-all:focus-visible:not(:disabled) {
    border-color: #ad7c37;
    background: #fff4de;
    outline: none;
}

.account-notification-mark-all:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.account-notification-mark-all svg {
    width: 18px;
    height: 18px;
}

.account-notification-list {
    display: grid;
    gap: 10px;
}

.account-notification-item {
    --notification-accent: #806d5d;
    --notification-soft: #f2ece4;
    position: relative;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) 12px;
    align-items: start;
    gap: 17px;
    padding: 20px 22px;
    border: 1px solid #e3d5bf;
    border-radius: 12px;
    background: rgba(255, 254, 251, .93);
    box-shadow: 0 8px 24px rgba(72, 42, 20, .045);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.account-notification-item:hover {
    border-color: #d1b98f;
    box-shadow: 0 13px 28px rgba(72, 42, 20, .08);
    transform: translateY(-1px);
}

.account-notification-item.is-unread {
    border-left: 4px solid var(--notification-accent);
    background: linear-gradient(90deg, var(--notification-soft) 0, rgba(255, 254, 251, .97) 150px);
}

.account-notification-item.type-announcement {
    --notification-accent: #96231d;
    --notification-soft: #fbe9e6;
}

.account-notification-item.type-news {
    --notification-accent: #a34d1f;
    --notification-soft: #fbefe5;
}

.account-notification-item.type-family_update {
    --notification-accent: #2e7254;
    --notification-soft: #e8f4ee;
}

.account-notification-item.type-family_rejected {
    --notification-accent: #a12d27;
    --notification-soft: #fceae8;
}

.account-notification-item.type-gallery_update {
    --notification-accent: #386a91;
    --notification-soft: #eaf2f8;
}

.account-notification-item.type-honor {
    --notification-accent: #a77917;
    --notification-soft: #fbf4dc;
}

.account-notification-item.type-donation {
    --notification-accent: #19845c;
    --notification-soft: #e7f5ef;
}

.account-notification-item.type-website_update {
    --notification-accent: #6552a3;
    --notification-soft: #f0edfa;
}

.account-notification-item.type-clan_anniversary {
    --notification-accent: #a06a17;
    --notification-soft: #fff2d8;
}

.account-notification-item.type-memorial {
    --notification-accent: #7d334c;
    --notification-soft: #f7eaf0;
}

.account-notification-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 1px solid color-mix(in srgb, var(--notification-accent) 20%, transparent);
    border-radius: 14px;
    background: var(--notification-soft);
    color: var(--notification-accent);
}

.account-notification-icon svg {
    width: 25px;
    height: 25px;
}

.account-notification-content {
    min-width: 0;
}

.account-notification-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 5px;
}

.account-notification-type,
.account-notification-unread-label {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.account-notification-type {
    background: var(--notification-soft);
    color: var(--notification-accent);
}

.account-notification-unread-label {
    background: #941f1a;
    color: #fff;
}

.account-notification-meta time {
    color: #8a7d71;
    font-size: 12px;
    font-weight: 700;
}

.account-notification-content h2 {
    margin: 0;
    color: #2a201a;
    font-family: var(--family-tree-font), Georgia, serif;
    font-size: 20px;
    line-height: 1.35;
}

.account-notification-content > p {
    max-width: 880px;
    margin: 7px 0 0;
    color: #65584d;
    font-size: 14px;
    line-height: 1.65;
}

.account-notification-event {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 9px;
    color: #766657;
    font-size: 12px;
    font-weight: 750;
}

.account-notification-event svg {
    width: 16px;
    height: 16px;
    color: var(--notification-accent);
}

.account-notification-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 11px;
    color: var(--notification-accent);
    font-size: 13px;
    font-weight: 900;
}

.account-notification-action:hover,
.account-notification-action:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
    outline: none;
}

.account-notification-status-dot {
    display: block;
    width: 9px;
    height: 9px;
    margin-top: 8px;
    border-radius: 50%;
    background: transparent;
}

.account-notification-item.is-unread .account-notification-status-dot {
    background: var(--notification-accent);
    box-shadow: 0 0 0 4px var(--notification-soft);
}

.account-notification-empty {
    display: grid;
    justify-items: center;
    padding: 58px 24px;
    border: 1px dashed #d6c2a1;
    border-radius: 14px;
    background: rgba(255, 254, 250, .75);
    text-align: center;
}

.account-notification-empty > div {
    display: grid;
    place-items: center;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #f6ead7;
    color: #9a6a23;
}

.account-notification-empty svg {
    width: 32px;
    height: 32px;
}

.account-notification-empty h2 {
    margin: 16px 0 0;
    font-size: 21px;
}

.account-notification-empty p {
    margin: 7px 0 16px;
    color: var(--muted);
}

@media (max-width: 960px) {
    .site-account-cluster {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-left: 0;
    }

    .site-notification-button {
        width: 100%;
        height: 46px;
        justify-content: flex-start;
        gap: 11px;
        padding: 0 13px;
        border-color: var(--line);
        border-radius: 8px;
        background: #fff;
        color: var(--ink);
        font-weight: 800;
    }

    .site-notification-label {
        display: inline;
    }

    .site-notification-count {
        position: static;
        margin-left: auto;
        border: 0;
    }

    .account-notification-hero {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .account-notification-summary {
        width: 100%;
    }

    .account-notification-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .account-notification-toolbar form,
    .account-notification-mark-all {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .account-notification-page {
        padding: 22px 0 42px;
    }

    .account-notification-container {
        gap: 14px;
    }

    .account-notification-hero {
        gap: 21px;
        padding: 25px 20px;
        border-radius: 12px;
    }

    .account-notification-hero h1 {
        font-size: 29px;
    }

    .account-notification-hero p {
        font-size: 13.5px;
    }

    .account-notification-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .account-notification-summary > div {
        min-width: 0;
        padding: 11px 6px;
    }

    .account-notification-summary strong {
        font-size: 23px;
    }

    .account-notification-summary span {
        font-size: 9px;
        white-space: normal;
    }

    .account-notification-toolbar {
        padding: 9px;
    }

    .account-notification-tabs {
        margin-right: -2px;
        padding-bottom: 2px;
    }

    .account-notification-item {
        grid-template-columns: 44px minmax(0, 1fr);
        gap: 13px;
        padding: 17px 15px;
    }

    .account-notification-icon {
        width: 43px;
        height: 43px;
        border-radius: 12px;
    }

    .account-notification-icon svg {
        width: 22px;
        height: 22px;
    }

    .account-notification-content h2 {
        font-size: 17px;
    }

    .account-notification-content > p {
        font-size: 13.5px;
    }

    .account-notification-status-dot {
        position: absolute;
        top: 13px;
        right: 13px;
    }
}

@media (max-width: 480px) {
    .home-announcement-count {
        display: none;
    }

    .home-announcement-card {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .home-announcement-icon {
        width: 38px;
        height: 38px;
    }

    .home-announcement-dismiss {
        position: absolute;
        top: 10px;
        right: 9px;
    }

    .home-announcement-content {
        padding-right: 25px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-announcement-card {
        transition: none;
    }
}

/* Homepage announcement redesign: compact notice board */
.home-announcement-section {
    padding: 26px 0;
    background: var(--paper);
}

.home-announcement-board {
    display: grid;
    grid-template-columns: 205px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid #dfceb2;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(74, 41, 19, .09);
}

.home-announcement-heading {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    margin: 0;
    padding: 24px;
    overflow: hidden;
    background: linear-gradient(145deg, #941f1a 0%, #681411 100%);
    color: #fff;
}

.home-announcement-heading::before,
.home-announcement-heading::after {
    content: "";
    position: absolute;
    z-index: -1;
    border: 1px solid rgba(247, 208, 138, .2);
    border-radius: 50%;
}

.home-announcement-heading::before {
    width: 142px;
    height: 142px;
    right: -76px;
    top: -72px;
}

.home-announcement-heading::after {
    width: 88px;
    height: 88px;
    right: -47px;
    bottom: -50px;
}

.home-announcement-heading-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 2px;
    border: 1px solid rgba(247, 208, 138, .4);
    border-radius: 12px;
    background: rgba(247, 208, 138, .13);
    color: #f7d08a;
}

.home-announcement-heading-icon svg {
    width: 21px;
    height: 21px;
}

.home-announcement-heading .eyebrow {
    margin: 0;
    color: #f7d08a;
    font-size: 11px;
    letter-spacing: .08em;
}

.home-announcement-heading h2 {
    margin: 0;
    color: #fff;
    font-size: 26px;
    line-height: 1.15;
}

.home-announcement-count {
    margin-top: 8px;
    padding: 4px 9px;
    border-color: rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .82);
    font-size: 11px;
}

.home-announcement-list {
    display: block;
    min-width: 0;
}

.home-announcement-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 17px;
    min-height: 154px;
    padding: 22px 22px 22px 24px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid #eee3d2;
    border-left: 0;
    border-radius: 0;
    background: linear-gradient(90deg, var(--announcement-soft) 0, #fff 92px, #fff 100%);
    box-shadow: none;
    transition: opacity .22s ease, transform .22s ease, background-color .22s ease;
}

.home-announcement-card:last-child {
    border-bottom: 0;
}

.home-announcement-card:hover {
    background-color: #fffdf9;
    box-shadow: none;
}

.home-announcement-card.is-dismissing {
    opacity: 0;
    transform: translateX(10px);
}

.home-announcement-icon {
    width: 46px;
    height: 46px;
    border: 1px solid rgba(140, 29, 24, .12);
    border-radius: 13px;
}

.home-announcement-icon svg {
    width: 22px;
    height: 22px;
}

.home-announcement-type {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--announcement-soft);
    font-size: 10px;
}

.home-announcement-content h3 {
    font-size: 19px;
    line-height: 1.35;
}

.home-announcement-content p {
    max-width: 780px;
    margin-top: 5px;
    font-size: 14px;
    line-height: 1.6;
}

.home-announcement-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    margin-left: 8px;
}

.home-announcement-link {
    justify-content: center;
    min-height: 40px;
    margin: 0;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--announcement-accent);
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
    box-shadow: 0 7px 16px rgba(90, 35, 20, .16);
    transition: transform .2s ease, filter .2s ease;
}

.home-announcement-link:hover {
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    filter: brightness(.95);
}

.home-announcement-dismiss {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    background: #f5f0e9;
}

@media (max-width: 900px) {
    .home-announcement-board {
        grid-template-columns: 170px minmax(0, 1fr);
    }

    .home-announcement-heading {
        padding: 20px;
    }

    .home-announcement-heading h2 {
        font-size: 22px;
        white-space: nowrap;
    }

    .home-announcement-card {
        grid-template-columns: 44px minmax(0, 1fr);
        min-height: 0;
        padding: 20px;
    }

    .home-announcement-actions {
        grid-column: 2;
        justify-content: flex-start;
        margin: 0;
    }
}

@media (max-width: 680px) {
    .home-announcement-section {
        padding: 20px 0;
    }

    .home-announcement-board {
        grid-template-columns: 1fr;
        border-radius: 16px;
    }

    .home-announcement-heading {
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr) auto;
        align-items: center;
        justify-content: initial;
        gap: 12px;
        min-height: 78px;
        padding: 15px 18px;
    }

    .home-announcement-heading-icon {
        grid-row: 1;
        margin: 0;
    }

    .home-announcement-heading .eyebrow {
        font-size: 10px;
    }

    .home-announcement-heading h2 {
        font-size: 21px;
        white-space: normal;
    }

    .home-announcement-count {
        margin: 0;
    }

    .home-announcement-card {
        background: linear-gradient(135deg, var(--announcement-soft) 0, #fff 125px, #fff 100%);
    }
}

@media (max-width: 480px) {
    .home-announcement-section .container {
        width: min(100% - 24px, 1160px);
    }

    .home-announcement-heading {
        grid-template-columns: 38px minmax(0, 1fr);
        min-height: 72px;
        padding: 13px 15px;
    }

    .home-announcement-heading-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .home-announcement-count {
        display: none;
    }

    .home-announcement-card {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 12px;
        padding: 17px 15px;
    }

    .home-announcement-icon {
        width: 38px;
        height: 38px;
        border-radius: 11px;
    }

    .home-announcement-content {
        padding-right: 0;
    }

    .home-announcement-content h3 {
        font-size: 17px;
    }

    .home-announcement-content p {
        font-size: 13.5px;
    }

    .home-announcement-actions {
        position: static;
        grid-column: 2;
        flex-wrap: wrap;
    }

    .home-announcement-link {
        min-height: 36px;
        padding: 7px 12px;
        font-size: 12px;
    }

    .home-announcement-dismiss {
        position: static;
        width: 34px;
        height: 34px;
    }
}

/* Homepage announcement: selected heritage notice board */
.home-announcement-section {
    padding: 30px 0;
    border-bottom: 0;
    background: var(--paper);
}

.home-announcement-section .container {
    width: min(1160px, calc(100% - 32px));
}

.home-announcement-board {
    position: relative;
    isolation: isolate;
    display: block;
    overflow: hidden;
    border: 1px solid #d2aa68;
    border-radius: 7px;
    background:
        linear-gradient(#c9a46b 0 0) left 13px top 13px / 22px 1px no-repeat,
        linear-gradient(#c9a46b 0 0) left 13px top 13px / 1px 22px no-repeat,
        linear-gradient(#c9a46b 0 0) right 13px top 13px / 22px 1px no-repeat,
        linear-gradient(#c9a46b 0 0) right 13px top 13px / 1px 22px no-repeat,
        linear-gradient(#c9a46b 0 0) left 13px bottom 13px / 22px 1px no-repeat,
        linear-gradient(#c9a46b 0 0) left 13px bottom 13px / 1px 22px no-repeat,
        linear-gradient(#c9a46b 0 0) right 13px bottom 13px / 22px 1px no-repeat,
        linear-gradient(#c9a46b 0 0) right 13px bottom 13px / 1px 22px no-repeat,
        radial-gradient(circle at 18% 8%, rgba(192, 145, 74, .07), transparent 31%),
        linear-gradient(103deg, #fffaf0 0%, #fffdf9 52%, #fff9ed 100%);
    box-shadow: 0 15px 34px rgba(83, 49, 21, .09);
}

.home-announcement-board::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 8px;
    border: 1px solid rgba(199, 157, 91, .7);
    pointer-events: none;
}

.home-announcement-heading {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 0;
    margin: 0;
    padding: 27px 34px 2px 156px;
    overflow: visible;
    background: transparent;
    color: #941f1a;
}

.home-announcement-heading::before,
.home-announcement-heading::after {
    content: none;
}

.home-announcement-heading-icon,
.home-announcement-heading .eyebrow {
    display: none;
}

.home-announcement-heading h2 {
    margin: 0;
    color: #941f1a;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .11em;
    text-transform: uppercase;
    white-space: nowrap;
}

.home-announcement-heading-ornament {
    position: relative;
    display: block;
    width: 35px;
    height: 1px;
    background: linear-gradient(90deg, #caa66b, rgba(202, 166, 107, .15));
}

.home-announcement-heading-ornament::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 1px;
    width: 7px;
    height: 7px;
    border: 1px solid #caa66b;
    transform: translate(-50%, -50%) rotate(45deg);
}

.home-announcement-heading-ornament.is-reversed {
    transform: scaleX(-1);
}

.home-announcement-list {
    position: relative;
    z-index: 1;
    display: block;
    min-width: 0;
}

.home-announcement-card {
    position: relative;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    align-items: center;
    gap: 28px;
    min-height: 166px;
    padding: 15px 34px 29px 55px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid rgba(211, 177, 123, .42);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transition: opacity .22s ease, transform .22s ease;
}

.home-announcement-card:last-child {
    border-bottom: 0;
}

.home-announcement-card:hover {
    background: transparent;
    box-shadow: none;
}

.home-announcement-card.is-dismissing {
    opacity: 0;
    transform: translateX(10px);
}

.home-announcement-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 82px;
    height: 82px;
    border: 2px solid #d4a95f;
    border-radius: 50%;
    background: linear-gradient(145deg, #aa271f 0%, #761713 100%);
    color: #f4cf88;
    box-shadow:
        0 0 0 5px #f7e9cc,
        0 0 0 7px rgba(202, 158, 88, .75),
        0 10px 20px rgba(105, 36, 21, .15);
}

.home-announcement-icon::before {
    content: "";
    position: absolute;
    inset: 7px;
    border: 1px solid rgba(244, 207, 136, .72);
    border-radius: 50%;
}

.home-announcement-icon::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 50%;
    width: 5px;
    height: 5px;
    background: #f4cf88;
    transform: translateX(-50%) rotate(45deg);
}

.home-announcement-icon svg {
    position: relative;
    z-index: 1;
    width: 34px;
    height: 34px;
}

.home-announcement-content {
    min-width: 0;
}

.home-announcement-type {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: 10px;
    padding: 5px 13px;
    border: 1px solid #cf9f4f;
    border-radius: 999px;
    background: linear-gradient(180deg, #a52b22 0%, #861b17 100%);
    color: #f5cf87;
    font-size: 10.5px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .07em;
    text-transform: uppercase;
    box-shadow: 0 2px 0 rgba(118, 23, 19, .12);
}

.home-announcement-content h3 {
    margin: 0;
    color: #7e1915;
    font-family: var(--family-tree-font), Georgia, serif;
    font-size: clamp(21px, 1.7vw, 27px);
    font-weight: 700;
    line-height: 1.28;
}

.home-announcement-content p {
    max-width: 860px;
    margin: 10px 0 0;
    color: #6e6055;
    font-size: 15px;
    line-height: 1.65;
}

.home-announcement-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin: 0 4px 0 12px;
}

.home-announcement-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    margin: 0;
    padding: 10px 21px;
    border: 1px solid #ba782f;
    border-radius: 999px;
    background: linear-gradient(180deg, #a4211c 0%, #861713 100%);
    color: #fff4da;
    font-family: var(--family-tree-font), Georgia, serif;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(111, 26, 20, .17);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.home-announcement-link:hover,
.home-announcement-link:focus-visible {
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 11px 22px rgba(111, 26, 20, .22);
    filter: brightness(1.04);
}

.home-announcement-dismiss {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 1px solid #dfcaa4;
    background: rgba(255, 250, 240, .76);
    color: #8d7d6e;
}

.home-announcement-dismiss:hover,
.home-announcement-dismiss:focus-visible {
    border-color: #bd9558;
    background: #fff8eb;
    color: #8c1d18;
}

@media (max-width: 1050px) {
    .home-announcement-heading {
        padding-left: 132px;
    }

    .home-announcement-card {
        grid-template-columns: 74px minmax(0, 1fr);
        gap: 22px;
        padding: 17px 29px 29px 42px;
    }

    .home-announcement-icon {
        width: 68px;
        height: 68px;
    }

    .home-announcement-icon svg {
        width: 29px;
        height: 29px;
    }

    .home-announcement-actions {
        grid-column: 2;
        justify-content: flex-start;
        margin: 3px 0 0;
    }
}

@media (max-width: 680px) {
    .home-announcement-section {
        padding: 20px 0;
    }

    .home-announcement-section .container {
        width: min(100% - 28px, 1450px);
    }

    .home-announcement-board {
        border-radius: 6px;
    }

    .home-announcement-heading {
        display: flex;
        min-height: 0;
        padding: 23px 24px 8px;
    }

    .home-announcement-heading h2 {
        font-size: 13px;
        white-space: nowrap;
    }

    .home-announcement-heading-ornament {
        width: 25px;
    }

    .home-announcement-card {
        grid-template-columns: 62px minmax(0, 1fr);
        gap: 18px;
        min-height: 0;
        padding: 14px 24px 28px 30px;
        background: transparent;
    }

    .home-announcement-icon {
        width: 58px;
        height: 58px;
        box-shadow:
            0 0 0 4px #f7e9cc,
            0 0 0 6px rgba(202, 158, 88, .75),
            0 8px 16px rgba(105, 36, 21, .13);
    }

    .home-announcement-icon svg {
        width: 25px;
        height: 25px;
    }

    .home-announcement-type {
        margin-bottom: 8px;
        padding: 4px 10px;
        font-size: 9.5px;
    }

    .home-announcement-content h3 {
        font-size: 19px;
    }

    .home-announcement-content p {
        margin-top: 8px;
        font-size: 13.5px;
        line-height: 1.6;
    }

    .home-announcement-actions {
        position: static;
        grid-column: 2;
        flex-wrap: wrap;
        gap: 9px;
        margin-top: 3px;
    }

    .home-announcement-link {
        min-height: 39px;
        padding: 8px 15px;
        font-size: 13px;
    }

    .home-announcement-dismiss {
        position: static;
        width: 39px;
        height: 39px;
    }
}

@media (max-width: 430px) {
    .home-announcement-section .container {
        width: min(100% - 24px, 1160px);
    }

    .home-announcement-heading {
        justify-content: center;
        padding: 22px 16px 9px;
    }

    .home-announcement-card {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 15px;
        padding: 14px 24px 29px;
        text-align: center;
    }

    .home-announcement-content {
        padding-right: 0;
    }

    .home-announcement-type {
        margin-right: auto;
        margin-left: auto;
    }

    .home-announcement-content h3 {
        font-size: 18px;
    }

    .home-announcement-actions {
        grid-column: 1;
        justify-content: center;
    }
}

/* Intro Section Styling */
.intro-grid {
    align-items: center;
}

.intro-media-box {
    display: flex;
    justify-content: center;
    align-items: center;
}

.intro-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: 0 20px 40px rgba(47, 37, 29, 0.12);
    background: var(--paper);
}

@media (max-width: 768px) {
    .intro-grid {
        grid-template-columns: 1fr !important; /* Switch to single column on mobile */
        gap: 32px;
    }
    
    .intro-img {
        max-width: 100%;
    }
}

/* Anniversary Countdown Section */
.anniversary-countdown-section {
    background: var(--paper);
    padding: 50px 0;
}

.countdown-ceremonial-layout {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) 88px;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
}

.ancestral-couplet {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-width: 0;
    min-height: 100%;
    padding: 18px 9px;
    overflow: hidden;
    border: 2px solid #b8862f;
    border-radius: 12px;
    background: linear-gradient(155deg, #9b211b 0%, #781612 56%, #5f100e 100%);
    color: #f7d58c;
    box-shadow: 0 16px 34px rgba(92, 29, 20, .16), inset 0 0 28px rgba(64, 5, 4, .18);
}

.ancestral-couplet::before {
    content: "";
    position: absolute;
    inset: 7px;
    z-index: -1;
    border: 1px solid rgba(247, 213, 140, .55);
    border-radius: 8px;
    pointer-events: none;
}

.ancestral-couplet::after {
    content: "";
    position: absolute;
    z-index: -2;
    width: 130px;
    height: 130px;
    right: -94px;
    top: -72px;
    border: 1px solid rgba(247, 213, 140, .16);
    border-radius: 50%;
}

.ancestral-couplet-logo {
    position: absolute;
    top: 22px;
    left: 50%;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: translateX(-50%);
}

.ancestral-couplet-logo::before {
    content: "";
    display: block;
    width: 25px;
    height: 25px;
    background: #f7d58c;
    -webkit-mask: url('../img/favi.svg') center / contain no-repeat;
    mask: url('../img/favi.svg') center / contain no-repeat;
}

.ancestral-couplet-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    font-family: 'Lora', Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: .025em;
    text-align: center;
    text-shadow: 0 2px 7px rgba(38, 4, 3, .45);
}

.ancestral-couplet-text span {
    display: block;
}

.ancestral-couplet-mark {
    color: #dcae55;
    font-size: 9px;
    line-height: 1;
}

.countdown-card-wrapper {
    background: #fffdf9;
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 12px;
    width: 100%;
    max-width: none;
    margin: 0;
    box-shadow: 0 16px 40px rgba(110, 74, 24, 0.07);
    position: relative;
    overflow: hidden;
}



.countdown-card-inner {
    border: 1px dashed var(--gold);
    border-radius: 10px;
    padding: 40px 24px;
    background: linear-gradient(180deg, rgba(246, 239, 227, 0.25) 0%, rgba(255, 253, 248, 0.5) 100%);
    position: relative;
    text-align: center;
}

.countdown-card-inner::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    width: 16px;
    height: 16px;
    border-top: 2px solid var(--red);
    border-left: 2px solid var(--red);
}

.countdown-card-inner::after {
    content: '';
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 16px;
    height: 16px;
    border-bottom: 2px solid var(--red);
    border-right: 2px solid var(--red);
}

.countdown-corner-tr {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 16px;
    height: 16px;
    border-top: 2px solid var(--red);
    border-right: 2px solid var(--red);
}

.countdown-corner-bl {
    position: absolute;
    bottom: 12px;
    left: 12px;
    width: 16px;
    height: 16px;
    border-bottom: 2px solid var(--red);
    border-left: 2px solid var(--red);
}

.countdown-header {
    margin-bottom: 28px;
}

.countdown-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: var(--gold);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.countdown-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 32px;
    color: var(--red);
    margin: 0 0 10px 0;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.countdown-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--red) 50%, var(--gold) 80%, transparent);
    margin: 12px auto 0;
}

.countdown-subtitle {
    font-family: 'Lora', Georgia, serif;
    font-size: 16px;
    color: var(--muted);
    margin-top: 12px;
    margin-bottom: 0;
    font-style: italic;
}

.countdown-timer {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.countdown-timer[hidden] {
    display: none !important;
}

.countdown-item {
    background: #ffffff;
    border: 1px solid var(--line);
    border-bottom: 3px solid var(--gold);
    border-radius: 12px;
    width: 90px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(110, 74, 24, 0.04);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.countdown-item:hover {
    transform: translateY(-4px);
    border-bottom-color: var(--red);
    box-shadow: 0 12px 28px rgba(140, 29, 24, 0.1);
}

.countdown-number {
    font-family: 'Lora', Georgia, serif;
    font-size: 38px;
    font-weight: 700;
    color: var(--red);
    line-height: 1;
    margin-bottom: 2px;
    font-variant-numeric: tabular-nums;
}

.countdown-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.anniversary-today-state {
    display: grid;
    grid-template-columns: 160px minmax(0, 430px);
    align-items: center;
    justify-content: center;
    gap: 32px;
    min-height: 170px;
    margin: 2px auto 0;
}

.anniversary-today-state[hidden] {
    display: none !important;
}

.anniversary-incense-art svg {
    display: block;
    width: 150px;
    height: 170px;
    overflow: visible;
}

.anniversary-incense-art .smoke {
    fill: none;
    stroke: #ad9b8d;
    stroke-width: 3;
    stroke-linecap: round;
    opacity: .65;
}

.anniversary-incense-art .incense-stick {
    fill: none;
    stroke: #d39a39;
    stroke-width: 3;
    stroke-linecap: round;
}

.anniversary-today-copy {
    min-width: 0;
    text-align: left;
}

.anniversary-today-kicker {
    display: inline-block;
    margin-bottom: 7px;
    color: #8a611d;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.anniversary-today-copy > p {
    margin: 0 0 17px;
    color: var(--red);
    font: italic 700 18px/1.55 'Lora', Georgia, serif;
}

.anniversary-incense-action {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
}

.anniversary-incense-button {
    min-width: 190px;
    border: 0;
    cursor: pointer;
    white-space: nowrap;
}

.anniversary-incense-button.is-lit {
    background: #6d5b46;
    cursor: default;
}

.anniversary-incense-action small {
    color: var(--muted);
}

.anniversary-incense-message {
    display: block;
    min-height: 17px;
    color: #7e221c;
    font-size: 11px;
    line-height: 1.45;
}

.countdown-detail-actions {
    display: flex;
    justify-content: center;
    margin-top: 26px;
}

.countdown-detail-link {
    gap: 8px;
}

.countdown-detail-link span {
    transition: transform .2s ease;
}

.countdown-detail-link:hover span {
    transform: translateX(3px);
}

.anniversary-detail-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 82% 20%, rgba(225, 183, 94, .24), transparent 28%),
        linear-gradient(135deg, var(--red), #3d241d);
}

.anniversary-detail-hero .eyebrow {
    color: #f7d58c;
}

.anniversary-detail-page {
    background: var(--paper);
}

.intro-actions {
    display: flex;
    margin-top: 22px;
}

.introduction-detail-page .article-cover {
    aspect-ratio: 16 / 10;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(47, 37, 29, 0.12);
}

.introduction-detail-page .article-body > .eyebrow {
    margin-bottom: 10px;
}

.introduction-detail-page .article-body h1 {
    margin-top: 0;
}

.introduction-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.anniversary-detail-body {
    max-width: 900px;
}

.anniversary-detail-content,
.anniversary-detail-empty {
    margin-top: 0;
    padding: clamp(22px, 4vw, 42px);
    border: 1px solid var(--line);
    border-top: 4px solid var(--gold);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
}

.anniversary-detail-content > :first-child,
.anniversary-detail-empty > :first-child {
    margin-top: 0;
}

.anniversary-detail-content > :last-child,
.anniversary-detail-empty > :last-child {
    margin-bottom: 0 !important;
}

.anniversary-detail-back {
    display: inline-flex;
    gap: 8px;
    margin-top: 24px;
}

@keyframes countdownPulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

@media (prefers-reduced-motion: no-preference) {
    .anniversary-today-state .smoke-a {
        animation: anniversarySmoke 3.2s ease-in-out infinite;
    }

    .anniversary-today-state .smoke-b {
        animation: anniversarySmoke 3.2s ease-in-out .8s infinite reverse;
    }

    @keyframes anniversarySmoke {
        50% { transform: translateX(4px); opacity: .25; }
    }
}

@media (max-width: 1050px) {
    .countdown-ceremonial-layout {
        grid-template-columns: 72px minmax(0, 1fr) 72px;
        gap: 12px;
    }

    .ancestral-couplet {
        padding-inline: 7px;
    }

    .ancestral-couplet-text {
        gap: 6px;
        font-size: 17px;
    }
}

@media (max-width: 800px) {
    .countdown-ceremonial-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .ancestral-couplet {
        flex-direction: row;
        gap: 9px;
        min-height: 62px;
        padding: 12px 14px;
        border-radius: 10px;
    }

    .ancestral-couplet-logo {
        position: static;
        flex: 0 0 auto;
        width: 30px;
        height: 30px;
        transform: none;
    }

    .ancestral-couplet-logo::before {
        width: 18px;
        height: 18px;
    }

    .ancestral-couplet-mark {
        display: none;
    }

    .ancestral-couplet-left {
        grid-column: 1;
        grid-row: 1;
    }

    .ancestral-couplet-right {
        grid-column: 2;
        grid-row: 1;
    }

    .ancestral-couplet-text {
        flex-direction: row;
        justify-content: center;
        gap: 5px;
        font-size: 15px;
        white-space: nowrap;
    }

    .countdown-card-wrapper {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
    }
}

@media (max-width: 576px) {
    .anniversary-countdown-section {
        padding: 34px 0;
    }

    .ancestral-couplet {
        gap: 4px;
        min-height: 54px;
        padding: 10px 8px;
    }

    .ancestral-couplet-text {
        gap: 3px;
        font-size: 13px;
    }

    .ancestral-couplet-mark {
        display: none;
    }

    .countdown-card-wrapper {
        padding: 6px;
    }
    .countdown-card-inner {
        padding: 30px 12px;
    }
    .countdown-timer {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 7px;
    }
    .countdown-item {
        width: 100%;
        min-width: 0;
        height: 82px;
    }
    .countdown-number {
        font-size: 26px;
    }
    .countdown-label {
        font-size: 9px;
    }
    .countdown-title {
        font-size: 26px;
    }

    .anniversary-today-state {
        grid-template-columns: 1fr;
        gap: 2px;
        min-height: 0;
    }

    .anniversary-incense-art svg {
        width: 132px;
        height: 142px;
        margin: 0 auto;
    }

    .anniversary-today-copy {
        text-align: center;
    }

    .anniversary-today-copy > p {
        margin-bottom: 14px;
        font-size: 16px;
    }

    .anniversary-incense-action {
        align-items: center;
    }

    .anniversary-incense-button {
        width: min(100%, 230px);
    }
}

@media (max-width: 360px) {
    .ancestral-couplet {
        gap: 3px;
        padding: 8px 4px;
    }

    .ancestral-couplet-logo {
        width: 24px;
        height: 24px;
    }

    .ancestral-couplet-logo::before {
        width: 14px;
        height: 14px;
    }

    .ancestral-couplet-text {
        gap: 2px;
        font-size: 11px;
    }
}

/* Công đức */
.badge-closed,
.donation-status-closed {
    background: #e8e7e4;
    color: #57534e;
}

.donation-status-published {
    background: #dcfce7;
    color: #166534;
}

.public-donation-home-section {
    padding-top: 18px;
    background:
        radial-gradient(circle at top right, rgba(184, 134, 47, .12), transparent 34%),
        var(--paper);
}

.public-donation-home-card {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(340px, .88fr);
    gap: 28px;
    padding: clamp(22px, 3.2vw, 36px);
    border: 1px solid #e6d4b8;
    border-radius: 14px;
    background: linear-gradient(135deg, #fffaf0 0%, #ffffff 58%, #fbf2e4 100%);
    box-shadow: var(--shadow);
}

.public-donation-home-intro h2,
.public-donation-detail h2,
.public-donation-campaign-card h2 {
    margin: 0;
    line-height: 1.25;
}

.public-donation-home-intro > p:not(.eyebrow) {
    max-width: 680px;
    margin: 14px 0 0;
    color: var(--muted);
}

.donation-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.donation-home-stat-grid {
    grid-template-columns: minmax(0, 1.45fr) repeat(2, minmax(0, .7fr));
    gap: 10px;
    margin: 18px 0;
}

.donation-home-stat-grid .donation-stat-card:first-child {
    grid-column: auto;
}

.donation-home-stat-grid .donation-stat-card:first-child strong {
    white-space: nowrap;
}

.donation-home-stat-grid .donation-stat-card {
    padding: 14px 16px;
}

.donation-home-stat-grid .donation-stat-card strong {
    font-size: clamp(19px, 2vw, 25px);
}

.donation-home-bank {
    display: grid;
    grid-template-columns: minmax(155px, .72fr) minmax(0, 1.28fr);
    gap: 14px 18px;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #dfc28e;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 248, 232, .94), rgba(255, 255, 255, .94));
}

.donation-home-bank-identity,
.donation-home-bank-account {
    display: grid;
    align-content: center;
    min-width: 0;
}

.donation-home-bank-identity > span,
.donation-home-bank-account > span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.donation-home-bank-identity > strong {
    margin-top: 3px;
    color: var(--ink);
    font-size: 15px;
}

.donation-home-bank small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.donation-home-bank-account {
    padding-left: 18px;
    border-left: 1px solid #ead9bd;
}

.donation-home-account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    margin-top: 2px;
}

.donation-home-account-row > strong {
    min-width: 0;
    color: var(--red-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: clamp(20px, 2vw, 25px);
    font-variant-numeric: tabular-nums;
    letter-spacing: .035em;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.donation-home-copy-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
}

.donation-home-copy-button svg {
    width: 14px;
    height: 14px;
}

.donation-home-bank > .donation-copy-status {
    grid-column: 1 / -1;
    min-height: 0;
    margin: 0;
}

.donation-home-bank > .donation-copy-status:empty {
    display: none;
}

.donation-stat-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, .86);
}

.donation-stat-card strong,
.donation-stat-card span {
    display: block;
}

.donation-stat-card strong {
    color: var(--red);
    font-size: clamp(20px, 2.2vw, 28px);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.donation-stat-card span {
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.donation-home-progress-summary {
    max-width: none;
    margin: 0 0 18px;
}

.donation-home-progress-summary > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.donation-progress {
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #eadfce;
}

.donation-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold), var(--red));
}

.donation-home-progress-summary small,
.public-donation-campaign-card small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
}

.public-donation-recent {
    align-self: stretch;
    padding: 20px;
    border: 1px solid rgba(140, 29, 24, .12);
    border-radius: 12px;
    background: #fff;
}

.donation-recent-heading,
.donation-recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.donation-recent-heading {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.donation-recent-heading h3 {
    margin: 0;
}

.donation-recent-heading span,
.donation-recent-item span,
.donation-recent-empty {
    color: var(--muted);
    font-size: 13px;
}

.donation-recent-list {
    display: grid;
}

.donation-recent-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0e7da;
}

.donation-recent-item:last-child {
    border-bottom: 0;
}

.donation-recent-item > div,
.donation-recent-item strong,
.donation-recent-item span {
    min-width: 0;
}

.donation-recent-item > div strong,
.donation-recent-item > div span {
    display: block;
}

.donation-recent-item > strong {
    flex: 0 0 auto;
    color: var(--red);
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.public-donation-hero {
    background:
        linear-gradient(120deg, rgba(58, 24, 20, .12), rgba(58, 24, 20, .44)),
        linear-gradient(135deg, var(--red), #3d241d);
}

.public-donation-section {
    background: #fbf8f2;
}

.public-donation-layout {
    display: grid;
    grid-template-columns: minmax(290px, 340px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.public-donation-campaign-panel {
    position: sticky;
    top: 92px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(68, 40, 18, .07);
}

.donation-campaign-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.donation-campaign-panel-heading .eyebrow {
    margin-bottom: 5px;
}

.donation-campaign-panel-heading h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
}

.donation-campaign-total,
.donation-campaign-group-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--wash);
    color: var(--red-dark);
    font-size: 13px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.donation-campaign-helper {
    margin: 12px 0 20px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.donation-campaign-mobile-picker {
    display: none;
}

.donation-campaign-group + .donation-campaign-group {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.donation-campaign-group-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.donation-campaign-group-heading h3,
.donation-campaign-group-heading strong {
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.donation-campaign-archive > summary {
    margin-bottom: 0;
    cursor: pointer;
    list-style: none;
}

.donation-campaign-archive > summary::-webkit-details-marker {
    display: none;
}

.donation-campaign-archive > summary > span:first-child {
    display: grid;
    gap: 2px;
}

.donation-campaign-archive > summary small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.donation-campaign-archive > summary::after {
    content: "⌄";
    order: 3;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    transition: transform .18s ease;
}

.donation-campaign-archive[open] > summary::after {
    transform: rotate(180deg);
}

.donation-campaign-archive[open] > summary {
    margin-bottom: 10px;
}

.public-donation-campaign-list {
    display: grid;
    gap: 10px;
}

.public-donation-campaign-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(68, 40, 18, .06);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.public-donation-campaign-card:hover,
.public-donation-campaign-card.active {
    border-color: rgba(140, 29, 24, .48);
    box-shadow: 0 14px 30px rgba(68, 40, 18, .12);
    transform: translateY(-2px);
}

.public-donation-campaign-card.active {
    background: linear-gradient(135deg, #fffaf6, #fff);
    box-shadow: inset 3px 0 0 var(--red), 0 10px 24px rgba(68, 40, 18, .1);
}

.donation-campaign-card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.donation-campaign-selected {
    color: var(--red);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.public-donation-campaign-card h2 {
    font-size: 17px;
}

.public-donation-campaign-card .donation-campaign-card-dates {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.donation-campaign-summary {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding: 12px 0 10px;
}

.donation-campaign-summary strong {
    color: var(--red);
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

.donation-campaign-summary span {
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

.public-donation-detail {
    min-width: 0;
    margin-top: 0;
    padding: clamp(22px, 4vw, 38px);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
}

.public-donation-detail .donation-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.public-donation-detail .donation-stat-card strong {
    overflow-wrap: normal;
    word-break: normal;
}

.donation-campaign-dates {
    margin: 8px 0 0;
    color: var(--muted);
}

.donation-campaign-description {
    margin-top: 18px;
    padding: 16px 18px;
    border-left: 3px solid var(--gold);
    background: #fffaf0;
    color: #574a3f;
}

.donation-transfer-card {
    margin: 24px 0;
    padding: clamp(18px, 3vw, 28px);
    border: 1px solid #dfc28e;
    border-radius: 12px;
    background: linear-gradient(135deg, #fffaf0 0%, #fff 58%, #fff8eb 100%);
    box-shadow: 0 14px 34px rgba(88, 54, 21, .09);
}

.donation-transfer-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 18px;
    border-bottom: 1px solid #ead9bd;
}

.donation-transfer-icon {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
}

.donation-transfer-icon svg {
    width: 22px;
    height: 22px;
}

.donation-transfer-heading .eyebrow {
    margin-bottom: 4px;
}

.donation-transfer-heading h3 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(20px, 2.3vw, 27px);
}

.donation-transfer-heading p:last-child {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.donation-transfer-layout {
    display: grid;
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
    gap: 26px;
    align-items: start;
    padding-top: 22px;
}

.donation-transfer-layout.without-qr {
    grid-template-columns: 1fr;
}

.donation-transfer-qr {
    margin: 0;
    text-align: center;
}

.donation-transfer-qr > a:first-child {
    display: block;
    overflow: hidden;
    aspect-ratio: 1;
    padding: 10px;
    border: 1px solid #dcc398;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(68, 40, 18, .08);
}

.donation-transfer-qr img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.donation-transfer-qr figcaption {
    margin-top: 9px;
    color: var(--muted);
    font-size: 12px;
}

.donation-qr-download {
    margin-top: 11px;
}

.donation-transfer-details dl {
    display: grid;
    gap: 0;
    margin: 0;
    border: 1px solid #ead9bd;
    border-radius: 10px;
    background: rgba(255, 255, 255, .9);
}

.donation-transfer-details dl > div {
    display: grid;
    grid-template-columns: minmax(135px, .38fr) minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    min-height: 58px;
    padding: 12px 16px;
    border-bottom: 1px solid #efe2cf;
}

.donation-transfer-details dl > div:last-child {
    border-bottom: 0;
}

.donation-transfer-details dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.donation-transfer-details dd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    margin: 0;
    color: var(--ink);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.donation-transfer-details dd strong {
    color: var(--red-dark);
    font-size: 17px;
    letter-spacing: .02em;
}

.donation-copy-button {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid rgba(140, 29, 24, .35);
    border-radius: 7px;
    background: #fff;
    color: var(--red);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.donation-copy-button:hover,
.donation-copy-button:focus-visible {
    border-color: var(--red);
    background: #fff5f1;
}

.donation-transfer-note-only {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid #ead9bd;
    border-radius: 10px;
    background: #fff;
}

.donation-transfer-note-only > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.donation-transfer-note-only .donation-copy-button {
    justify-self: start;
}

.donation-transfer-qr-only {
    margin: 0;
    color: #574a3f;
    line-height: 1.65;
}

.donation-transfer-safety {
    display: grid;
    gap: 4px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #f4ead8;
    color: #60461e;
    font-size: 12px;
    line-height: 1.5;
}

.donation-copy-status {
    min-height: 20px;
    margin: 8px 0 0;
    color: #18794e;
    font-size: 12px;
    font-weight: 700;
}

.donation-filter-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin: 26px 0 18px;
    padding: 18px;
    border-radius: 9px;
    background: var(--wash);
}

.donation-filter-actions {
    display: flex;
    gap: 8px;
}

.donation-table-wrap {
    border: 1px solid var(--line);
    border-radius: 9px;
}

.donation-table th:nth-child(1),
.donation-table td:nth-child(1) {
    width: 64px;
    text-align: center;
}

.donation-table th:nth-child(4),
.donation-table td:nth-child(4) {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.donation-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 22px;
    color: var(--muted);
    font-weight: 700;
}

.public-donation-empty {
    padding: 50px 24px;
    border: 1px dashed #d4c2a8;
    border-radius: 12px;
    background: #fff;
    text-align: center;
}

.public-donation-empty h2 {
    margin-top: 0;
    color: var(--ink);
}

@media (max-width: 1120px) {
    .public-donation-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .public-donation-campaign-panel {
        position: static;
    }

    .public-donation-campaign-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .public-donation-home-card {
        grid-template-columns: 1fr;
    }

    .donation-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .donation-filter-form {
        grid-template-columns: 1fr 1fr;
    }

    .donation-filter-actions {
        grid-column: 1 / -1;
    }

    .donation-transfer-layout {
        grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
        gap: 18px;
    }
}

@media (max-width: 620px) {
    .public-donation-home-section {
        padding-top: 10px;
    }

    .public-donation-home-card,
    .public-donation-detail {
        padding: 20px 16px;
        border-radius: 9px;
    }

    .public-donation-recent {
        padding: 18px 16px;
    }

    .donation-home-bank {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .donation-home-bank-account {
        padding: 12px 0 0;
        border-top: 1px solid #ead9bd;
        border-left: 0;
    }

    .donation-home-account-row {
        align-items: flex-start;
    }

    .public-donation-campaign-list,
    .donation-filter-form {
        grid-template-columns: 1fr;
    }

    .donation-home-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .donation-home-stat-grid .donation-stat-card:first-child {
        grid-column: 1 / -1;
    }

    .public-donation-campaign-panel {
        padding: 18px 16px;
    }

    .donation-campaign-mobile-picker {
        display: grid;
        gap: 7px;
    }

    .donation-campaign-mobile-picker label {
        color: var(--ink);
        font-size: 13px;
        font-weight: 800;
    }

    .donation-campaign-mobile-picker > div {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .donation-campaign-mobile-picker select {
        min-width: 0;
    }

    .public-donation-campaign-panel > .donation-campaign-group {
        display: none;
    }

    .donation-campaign-archive > summary::after {
        content: none;
    }

    .donation-filter-actions {
        grid-column: auto;
        flex-direction: column;
    }

    .donation-filter-actions .btn {
        width: 100%;
    }

    .donation-table-wrap {
        overflow: visible;
        border: 0;
    }

    .donation-table,
    .donation-table tbody,
    .donation-table tr,
    .donation-table td {
        display: block;
        width: 100%;
    }

    .donation-table thead {
        display: none;
    }

    .donation-table tr {
        margin-bottom: 12px;
        padding: 10px 14px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
    }

    .donation-table td,
    .donation-table td:nth-child(1),
    .donation-table td:nth-child(4) {
        display: flex;
        justify-content: space-between;
        gap: 18px;
        padding: 9px 0;
        border-bottom: 1px dashed #eadfce;
        text-align: right;
        white-space: normal;
    }

    .donation-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
        text-align: left;
        text-transform: uppercase;
    }

    .donation-table td:last-child {
        border-bottom: 0;
    }

    .donation-table .empty-table-cell {
        display: block;
        text-align: center;
    }

    .donation-table .empty-table-cell::before {
        display: none;
    }

    .donation-transfer-card {
        padding: 18px 14px;
    }

    .donation-transfer-layout {
        grid-template-columns: 1fr;
    }

    .donation-transfer-qr {
        width: min(100%, 280px);
        margin-inline: auto;
    }

    .donation-transfer-details dl > div {
        grid-template-columns: 1fr;
        gap: 5px;
        align-items: start;
    }

    .donation-transfer-details dd {
        width: 100%;
    }

    .donation-pagination,
    .donation-recent-heading,
    .donation-recent-item,
    .donation-campaign-summary {
        align-items: flex-start;
    }

    .donation-pagination {
        flex-wrap: wrap;
    }
}

/* Biểu so sánh góp ý trong trang chỉnh sửa thành viên */
.member-edit-contribution-card {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #f0dfce;
    border-radius: 8px;
    background: #fffdf6;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.member-edit-contribution-card .eyebrow {
    font-weight: 700;
    font-size: 12px;
}

.contribution-card-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contribution-card-content .meta-item {
    font-size: 13px;
    line-height: 1.4;
}

.contribution-card-content .meta-label {
    display: block;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 2px;
}

.contribution-card-content .content-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
}

.contribution-card-content .content-text {
    margin: 0;
    font-size: 13px;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-word;
}

.contribution-card-content .reference-box {
    border-left: 3px solid #3b82f6;
}

.member-edit-proposed-fields {
    display: grid;
    gap: 8px;
}

.member-edit-proposed-field {
    display: grid;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid #efb4ae;
    border-radius: 8px;
    background: #fff1f0;
    color: #7f1d1d;
    font-size: 13px;
}

.member-edit-proposed-field strong {
    color: #991b1b;
    font-size: 11px;
    text-transform: uppercase;
}

.member-change-history {
    display: grid;
    gap: 16px;
    align-self: start;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow);
}

.member-change-history-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.member-change-history-head h3,
.member-change-history-head p {
    margin: 0;
}

.member-change-history-head > span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.member-change-history-list {
    display: grid;
    gap: 14px;
}

.member-change-history-item {
    display: grid;
    gap: 16px;
    padding: 20px;
    border: 1px solid #eadfce;
    border-radius: 12px;
    background: #fffdf9;
    box-shadow: 0 4px 12px rgba(184, 134, 47, 0.04);
}

.member-change-history-item.is-reverted {
    opacity: .6;
    background: #f8fafc;
    border-color: #cbd5e1;
}

.member-change-history-item header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eadfce;
}

.member-change-history-item header strong {
    color: var(--red);
    font-size: 15px;
    font-weight: 800;
}

.member-change-history-item header span {
    color: var(--muted);
    font-size: 13px;
    margin-left: 8px;
}

.member-change-history-fields {
    display: grid;
    gap: 0;
    border: 1px solid #eadfce;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.member-change-history-row {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px dashed #eadfce;
}

.member-change-history-row:last-child {
    border-bottom: none;
}

.member-change-history-row span {
    padding: 8px 12px;
    border-radius: 8px;
    word-break: break-word;
    font-size: 14px;
}

.member-change-history-row .history-field {
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    text-align: center;
}

.member-change-history-row .history-old {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fee2e2;
    text-decoration: line-through;
}

.member-change-history-row .history-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-weight: 700;
    font-size: 16px;
    padding: 0;
}

.member-change-history-row .history-new {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #dcfce7;
    font-weight: 600;
}

@media (max-width: 620px) {
    .member-change-history-head,
    .member-change-history-item header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .member-change-history-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 12px 8px;
    }

    .member-change-history-row .history-arrow {
        min-width: 0;
        padding: 4px 0;
        transform: rotate(90deg);
    }
}

/* Tô màu xanh cho các ô thông tin đề xuất có thay đổi */
input.is-modified,
select.is-modified,
textarea.is-modified {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

/* Flash Modal Popup Styles */
.flash-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    transition: opacity 0.25s ease;
    animation: flashFadeIn 0.25s ease forwards;
}

.flash-modal-card {
    position: relative;
    width: 100%;
    max-width: 600px;
    padding: 40px 30px 30px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    text-align: center;
    transition: all 0.25s ease;
    animation: flashScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.flash-modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
}

.flash-modal-icon svg {
    width: 42px;
    height: 42px;
}

.flash-modal-icon.icon-success {
    background: #ecfdf5;
    color: #10b981;
}

.flash-modal-icon.icon-danger,
.flash-modal-icon.icon-error {
    background: #fef2f2;
    color: #ef4444;
}

.flash-modal-icon.icon-warning,
.flash-modal-icon.icon-info {
    background: #fffbeb;
    color: #f59e0b;
}

.flash-modal-card h2 {
    margin: 0 0 16px;
    font-size: 30px;
    font-weight: 900;
    color: var(--ink);
    line-height: 1.15;
}

.flash-modal-message {
    margin: 0 0 30px;
    font-size: 20px;
    line-height: 1.55;
    color: var(--muted);
}

.btn-flash-close {
    width: 100%;
    min-height: 58px;
    border-radius: 10px;
    font-size: 19px;
    font-weight: 700;
    background: var(--red);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-flash-close:hover {
    background: var(--red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(140, 29, 24, 0.2);
}

@keyframes flashFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes flashScaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Member Edit Tab Styling */
.member-edit-tabs button {
    border: 1px solid #eadfce !important;
    color: var(--muted) !important;
    background: transparent !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.member-edit-tabs button:hover {
    background: var(--wash) !important;
    color: var(--red) !important;
}

.member-edit-tabs button.is-active {
    background: var(--red) !important;
    color: #ffffff !important;
    border-color: var(--red) !important;
    box-shadow: none !important;
}

.member-edit-tabs button.is-active .badge {
    background: #ffffff !important;
    color: var(--red) !important;
}

/* Custom Confirm Modal Styles */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    transition: opacity 0.2s ease;
    animation: flashFadeIn 0.2s ease forwards;
}

.confirm-modal-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    padding: 36px 28px 26px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
    transition: all 0.2s ease;
    animation: flashScaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.confirm-modal-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fffbeb;
    color: #f59e0b;
}

.confirm-modal-icon svg {
    width: 38px;
    height: 38px;
}

.confirm-modal-card h2 {
    margin: 0 0 14px;
    font-size: 28px;
    font-weight: 900;
    color: var(--ink);
    line-height: 1.18;
}

.confirm-modal-message {
    margin: 0 0 28px;
    font-size: 19px;
    line-height: 1.55;
    color: var(--muted);
}

.confirm-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.confirm-modal-actions button {
    width: 100%;
    min-height: 52px;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-confirm-cancel {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
}

.btn-confirm-cancel:hover {
    background: #e2e8f0 !important;
    color: #334155 !important;
}

.btn-confirm-ok {
    background: var(--red) !important;
    color: #fff !important;
    border: 1px solid var(--red) !important;
}

.btn-confirm-ok:hover {
    background: var(--red-dark) !important;
    border-color: var(--red-dark) !important;
}

/* Nút thêm con của phối ngẫu khi bật chế độ đóng góp */
@media (max-width: 620px) {
    .flash-modal-card,
    .confirm-modal-card {
        max-width: calc(100vw - 28px);
        padding: 30px 18px 22px;
    }

    .flash-modal-icon {
        width: 72px;
        height: 72px;
        margin-bottom: 18px;
    }

    .flash-modal-card h2,
    .confirm-modal-card h2 {
        font-size: 25px;
    }

    .flash-modal-message,
    .confirm-modal-message {
        font-size: 18px;
    }

    .btn-flash-close,
    .confirm-modal-actions button {
        min-height: 54px;
        font-size: 17px;
    }
}

.generation-spouse-add-button-contribution {
    position: relative;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    margin-left: 2px;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    vertical-align: middle;
    
    /* Ẩn theo mặc định */
    opacity: 0;
    pointer-events: none;
    transform: scale(0.6);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.generation-spouse-feedback-button {
    position: relative;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-left: 2px;
    padding: 0;
    border: 1px solid rgba(140, 29, 24, .24);
    border-radius: 50%;
    background: #fffdf8;
    color: #8c1d18;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(140, 29, 24, .10);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.6);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.generation-spouse-feedback-button svg {
    display: block;
}

.contribution-mode .generation-spouse-add-button-contribution,
.contribution-mode .generation-spouse-feedback-button {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.generation-spouse-add-button-contribution:hover {
    background: #059669;
    transform: scale(1.18) !important;
}

.generation-spouse-feedback-button:hover,
.generation-spouse-feedback-button:focus-visible {
    border-color: #8c1d18;
    background: #8c1d18;
    color: #fff;
    outline: none;
    transform: scale(1.12) !important;
}

/* Ẩn mặc định các nút + nhánh (generation-add-form) trên trang khách */
body:not(.admin-body) .generation-add-form {
    display: none;
}

/* Chỉ hiện khi bật chế độ đóng góp */
body:not(.admin-body) .contribution-mode .generation-add-form {
    display: flex;
    animation: flashFadeIn 0.25s ease forwards;
}

/* PWA install and notification controls */
.pwa-install-btn {
    position: fixed;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
    z-index: 1100;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid rgba(184, 134, 47, 0.42);
    border-radius: 999px;
    padding: 8px 16px 8px 8px;
    overflow: hidden;
    isolation: isolate;
    color: var(--red-dark);
    background: rgba(255, 253, 248, 0.96);
    box-shadow: 0 12px 26px rgba(68, 40, 18, 0.14), 0 2px 8px rgba(68, 40, 18, 0.08);
    backdrop-filter: blur(12px);
    cursor: pointer;
    font-size: 14.5px;
    font-weight: 800;
    line-height: 1.2;
    transform-origin: center;
    transition:
        transform 0.22s ease,
        filter 0.22s ease,
        background-position 0.35s ease,
        box-shadow 0.22s ease;
}

.pwa-install-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(120deg, transparent 2%, rgba(184, 134, 47, 0.18) 44%, transparent 74%);
    opacity: 0;
    transform: translateX(-120%);
    pointer-events: none;
}

.pwa-install-btn::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    border: 1px solid rgba(184, 134, 47, 0.44);
    opacity: 0;
    transform: scale(0.98);
    pointer-events: none;
}

.pwa-install-btn[hidden],
.pwa-install-tip[hidden],
.pwa-install-guide[hidden] {
    display: none !important;
}

.pwa-install-btn.is-attention {
    animation: pwa-install-pulse 2.3s ease-in-out 2;
}

.pwa-install-btn.is-attention::before {
    animation: pwa-install-shine 2.3s ease-in-out 2;
}

.pwa-install-btn.is-attention::after {
    animation: pwa-install-ring 2.3s ease-in-out 2;
}

.pwa-install-btn__icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(140, 29, 24, 0.18);
    color: #fff;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.pwa-install-btn.is-attention .pwa-install-btn__icon {
    animation: pwa-install-icon-bob 0.95s ease-in-out infinite;
}

.pwa-install-btn__icon svg {
    width: 17px;
    height: 17px;
    display: block;
}

.pwa-install-btn__text {
    flex: 0 0 auto;
    display: inline-block;
    max-width: calc(100vw - 92px);
    overflow: visible;
    white-space: nowrap;
}

.pwa-install-btn:hover,
.pwa-install-btn:focus-visible {
    outline: none;
    border-color: rgba(184, 134, 47, 0.72);
    color: var(--red);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(68, 40, 18, 0.18), 0 0 0 4px rgba(184, 134, 47, 0.12);
}

.pwa-install-btn--notify {
    right: auto;
    left: 16px;
    color: var(--ink);
}

.pwa-install-btn--notify .pwa-install-btn__icon {
    color: #fff;
    border-color: rgba(184, 134, 47, 0.24);
    background: linear-gradient(135deg, var(--gold), #956b25);
}

.pwa-install-tip {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
    z-index: 1250;
    width: max-content;
    max-width: min(92vw, 520px);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px 10px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    background: rgba(47, 37, 29, 0.94);
    box-shadow: 0 14px 30px rgba(47, 37, 29, 0.26);
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.45;
    text-align: left;
    transform: translateX(-50%);
}

.pwa-install-tip__icon {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff4d6;
    background: rgba(184, 134, 47, 0.36);
}

.pwa-install-tip__icon svg {
    width: 15px;
    height: 15px;
    display: block;
}

body.pwa-install-guide-open {
    overflow: hidden;
}

.pwa-install-guide {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(18px, env(safe-area-inset-top, 0px)) 16px max(18px, env(safe-area-inset-bottom, 0px));
    background: rgba(31, 22, 18, 0.62);
    backdrop-filter: blur(5px);
}

.pwa-install-guide__panel {
    position: relative;
    width: min(100%, 460px);
    max-height: 100%;
    overflow: auto;
    padding: 24px;
    border: 1px solid rgba(184, 134, 47, 0.3);
    border-radius: 22px;
    color: var(--ink);
    background: #fffdf8;
    box-shadow: 0 28px 70px rgba(30, 18, 12, 0.32);
    overscroll-behavior: contain;
}

.pwa-install-guide__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    color: #5f554e;
    background: rgba(71, 51, 39, 0.08);
    cursor: pointer;
    font: 500 26px/1 sans-serif;
}

.pwa-install-guide__close:hover,
.pwa-install-guide__close:focus-visible {
    outline: none;
    color: var(--red-dark);
    background: rgba(140, 29, 24, 0.12);
    box-shadow: 0 0 0 4px rgba(140, 29, 24, 0.1);
}

.pwa-install-guide__heading {
    display: flex;
    align-items: center;
    gap: 13px;
    padding-right: 40px;
}

.pwa-install-guide__app-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    box-shadow: 0 8px 18px rgba(140, 29, 24, 0.2);
}

.pwa-install-guide__app-icon svg {
    width: 24px;
    height: 24px;
}

.pwa-install-guide__eyebrow {
    display: block;
    margin-bottom: 2px;
    color: #956b25;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pwa-install-guide__heading h2 {
    margin: 0;
    color: var(--red-dark);
    font-size: clamp(21px, 5vw, 26px);
    line-height: 1.2;
}

.pwa-install-guide__description {
    margin: 18px 0 14px;
    color: #5f554e;
    font-size: 14.5px;
    line-height: 1.55;
}

.pwa-install-guide__steps {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pwa-install-guide__steps li {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 11px;
    align-items: start;
    padding: 12px;
    border: 1px solid rgba(184, 134, 47, 0.2);
    border-radius: 14px;
    background: rgba(255, 250, 238, 0.82);
}

.pwa-install-guide__step-number {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    background: var(--red-dark);
    font-size: 14px;
    font-weight: 900;
}

.pwa-install-guide__steps strong,
.pwa-install-guide__steps small {
    display: block;
}

.pwa-install-guide__steps strong {
    margin: 1px 0 3px;
    color: #3f332c;
    font-size: 14.5px;
    line-height: 1.35;
}

.pwa-install-guide__steps small {
    color: #756a62;
    font-size: 12.5px;
    line-height: 1.45;
}

.pwa-install-guide__note {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    color: #6f531f;
    background: rgba(184, 134, 47, 0.12);
    font-size: 12.5px;
    line-height: 1.45;
}

.pwa-install-guide__done {
    width: 100%;
    min-height: 46px;
    margin-top: 16px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    box-shadow: 0 9px 18px rgba(140, 29, 24, 0.18);
    cursor: pointer;
    font: inherit;
    font-size: 14.5px;
    font-weight: 900;
}

.pwa-install-guide__done:hover,
.pwa-install-guide__done:focus-visible {
    outline: none;
    filter: brightness(1.08);
    box-shadow: 0 9px 18px rgba(140, 29, 24, 0.2), 0 0 0 4px rgba(140, 29, 24, 0.12);
}

@keyframes pwa-install-pulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 12px 26px rgba(68, 40, 18, 0.14), 0 2px 8px rgba(68, 40, 18, 0.08);
    }
    50% {
        transform: translateY(-1px);
        box-shadow: 0 16px 34px rgba(68, 40, 18, 0.2), 0 0 0 5px rgba(184, 134, 47, 0.12);
    }
}

@keyframes pwa-install-shine {
    0%,
    24% {
        opacity: 0;
        transform: translateX(-120%);
    }
    44%,
    100% {
        opacity: 0.82;
        transform: translateX(130%);
    }
}

@keyframes pwa-install-ring {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    35% {
        opacity: 0.65;
        transform: scale(1.02);
    }
    100% {
        opacity: 0;
        transform: scale(1.08);
    }
}

@keyframes pwa-install-icon-bob {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-1px) scale(1.08);
    }
}

@media (max-width: 640px) {
    .pwa-install-btn {
        right: 12px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
        width: 44px;
        min-width: 44px;
        min-height: 44px;
        gap: 0;
        padding: 7px;
        border-radius: 50%;
        font-size: 13px;
    }

    .pwa-install-btn--notify {
        right: auto;
        left: 12px;
    }

    .pwa-install-btn__icon {
        width: 28px;
        height: 28px;
    }

    .pwa-install-btn__text {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .pwa-install-tip__icon {
        width: 22px;
        height: 22px;
    }

    .pwa-install-tip {
        left: 12px;
        right: 12px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 66px);
        width: auto;
        max-width: none;
        font-size: 12.5px;
        transform: none;
    }

    .pwa-install-guide {
        align-items: flex-end;
        padding: max(12px, env(safe-area-inset-top, 0px)) 0 0;
    }

    .pwa-install-guide__panel {
        width: 100%;
        max-height: calc(100dvh - max(12px, env(safe-area-inset-top, 0px)));
        padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px));
        border-width: 1px 0 0;
        border-radius: 22px 22px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-install-btn,
    .pwa-install-btn::before,
    .pwa-install-btn::after,
    .pwa-install-btn__icon,
    .pwa-install-guide {
        animation: none !important;
        transition: none !important;
    }
}

/* Ghim thanh công cụ phả hệ khi cuộn chuột */
.generation-tree-builder .admin-head.slim {
    position: sticky;
    top: 74px;
    z-index: 18; /* Dưới .site-header có z-index: 20 */
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid #d8e0ea;
}

.admin-body .generation-tree-builder .admin-head.slim {
    position: static !important;
    background: transparent !important;
    box-shadow: none !important;
    border-bottom: none !important;
}

/* Đảm bảo các trường bên trái trong lưới đóng góp luôn bắt đầu dòng mới và chiếm 6 cột trên desktop. */
@media (min-width: 621px) {
    .family-contribution-edit-grid .field-full_name,
    .family-contribution-edit-grid .field-gender,
    .family-contribution-edit-grid .field-birth_place,
    .family-contribution-edit-grid .field-death_date {
        grid-column: 1 / span 6;
    }
}

/* Responsive phả đồ toolbar */
.generation-tree-builder .admin-head.slim {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 16px !important;
    flex-wrap: wrap !important;
}

.generation-tree-builder .tree-toolbar {
    display: flex !important;
    align-items: flex-end !important;
    gap: 16px !important;
    flex-wrap: wrap !important;
    margin: 0 !important;
    width: auto !important;
    justify-content: flex-start !important;
    text-align: left !important;
}

.generation-tree-builder .generation-view-actions {
    display: flex !important;
    align-items: flex-end !important;
    gap: 8px !important;
    margin: 0 !important;
    flex-wrap: wrap !important;
}

@media (max-width: 768px) {
    .pedigree-hero-inner,
    .pedigree-tree-shell {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .generation-tree-builder {
        gap: 10px !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow-x: clip !important;
    }

    .generation-tree-builder .admin-head.slim {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 8px 10px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .generation-tree-builder .tree-toolbar {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .generation-tree-builder .tree-toolbar label {
        min-width: 0 !important;
        width: auto !important;
        gap: 0 !important;
        font-size: 0 !important;
    }

    .generation-tree-builder .tree-toolbar .tree-search-container {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .generation-tree-builder .tree-toolbar .tree-search-input,
    .generation-tree-builder .tree-root-trigger {
        height: 38px !important;
    }

    .generation-tree-builder .tree-toolbar .tree-search-input {
        padding: 8px 12px 8px 36px !important;
        font-size: 13px !important;
    }

    .generation-tree-builder .tree-toolbar .tree-search-results {
        left: 0 !important;
        right: auto !important;
        width: min(100%, 320px) !important;
        max-height: 240px !important;
    }

    .generation-tree-builder .tree-toolbar .generation-role-filters {
        align-self: end !important;
        width: auto !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
        padding: 2px !important;
    }

    .generation-tree-builder .tree-toolbar .generation-role-filter {
        min-height: 38px !important;
        height: 38px !important;
        width: 38px !important;
        min-width: 38px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    .generation-tree-builder .tree-toolbar .generation-role-filter .generation-role-filter-label,
    .generation-tree-builder .tree-toolbar .generation-role-filter .generation-role-filter-count {
        display: none !important;
    }

    .generation-tree-builder .tree-toolbar .generation-role-filter svg {
        margin: 0 !important;
    }

    .generation-tree-builder .tree-toolbar .tree-root-picker {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .generation-tree-builder .tree-control-label,
    .generation-tree-builder .tree-root-trigger-copy small {
        display: none !important;
    }

    .generation-tree-builder .tree-root-trigger {
        flex: 1;
        gap: 8px !important;
        padding: 5px 8px 5px 10px !important;
    }

    .generation-tree-builder .tree-root-trigger-copy strong {
        font-size: 13px !important;
    }

    .generation-tree-builder .tree-root-reset {
        width: 38px !important;
        height: 38px !important;
        flex: 0 0 38px !important;
    }

    .generation-tree-builder .tree-root-popover {
        width: 100% !important;
        max-height: min(68vh, 420px) !important;
    }

    .generation-tree-builder .tree-root-search-wrap {
        padding: 8px !important;
    }

    .generation-tree-builder .tree-root-search-wrap > svg {
        left: 20px !important;
    }

    .generation-tree-builder .tree-root-options {
        max-height: min(54vh, 330px) !important;
    }

    .generation-tree-builder .generation-view-actions {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        gap: 6px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scrollbar-width: thin !important;
    }

    .generation-tree-builder .generation-view-actions .btn {
        width: auto !important;
        flex: 1 1 0 !important;
        justify-content: center !important;
        min-width: 0 !important;
        min-height: 42px !important;
        height: auto !important;
        padding: 8px !important;
        gap: 0 !important;
        font-size: 0 !important;
        line-height: 1.2 !important;
    }

    .generation-tree-builder .generation-view-actions .btn-group {
        flex: 0 0 auto !important;
        margin-right: 0 !important;
    }

    .generation-tree-builder .generation-view-actions .toolbar-dropdown-container {
        flex: 1 1 0 !important;
        min-width: 0 !important;
    }

    .generation-tree-builder .generation-view-actions .toolbar-dropdown-toggle {
        width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
    }

    .generation-tree-builder .generation-view-actions svg {
        width: 18px !important;
        height: 18px !important;
        margin-right: 0 !important;
    }

    .generation-tree-builder .generation-view-actions .generation-action-label,
    .generation-tree-builder .generation-view-actions .btn:has(svg) {
        font-size: 0 !important;
    }

    .generation-tree-builder .kinship-panel {
        margin: 0 10px !important;
        padding: 12px !important;
    }

    .generation-tree-builder .kinship-tools {
        margin: 0 -12px !important;
        padding: 0 12px 10px !important;
    }

    .generation-tree-builder .kinship-slots,
    .generation-tree-builder .kinship-answer-summary,
    .generation-tree-builder .kinship-detail-layout,
    .generation-tree-builder .kinship-answer-card {
        grid-template-columns: 1fr !important;
    }

    .generation-tree-builder .kinship-alt-list {
        grid-column: 1 !important;
    }

    .generation-tree-builder .kinship-picker-grid {
        grid-template-columns: 1fr !important;
    }

    .generation-tree-builder .kinship-picker-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }

    .generation-tree-builder .kinship-swap,
    .generation-tree-builder .kinship-reset {
        width: 100% !important;
        height: 38px !important;
        transform: none;
    }

    .generation-tree-builder .kinship-swap svg {
        transform: rotate(90deg);
    }

    .generation-tree-builder .kinship-swap:hover,
    .generation-tree-builder .kinship-reset:hover {
        transform: translateY(-1px);
    }

    .generation-tree-builder .kinship-answer-term {
        font-size: 25px !important;
    }

    .generation-tree-builder .generation-tree-stage {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 560px !important;
        height: clamp(420px, calc(100svh - 230px), 680px) !important;
        min-height: 420px !important;
        max-height: 680px !important;
    }
}

@media (max-width: 520px) {
    .generation-tree-builder .tree-toolbar {
        grid-template-columns: 1fr !important;
    }

    .generation-tree-builder .tree-toolbar .generation-role-filters {
        display: flex !important;
        flex-direction: row !important;
        width: auto !important;
    }

    .generation-tree-builder .tree-toolbar .generation-role-filter {
        width: 38px !important;
        min-width: 38px !important;
        justify-content: center !important;
    }

}

/* Floating Back-To-Top Button for Member Edit Panel */
.back-to-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--red, #881c1c);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    z-index: 1000;
}

.back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top-btn:hover {
    background: #6b1212;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Hide contribution instructions in overview mode */
.generation-tree-stage.is-overview .contribution-tip-box {
    display: none !important;
}

/* Comparison Mode Glowing Borders */
.generation-card.is-comparison-added {
    border: 2px solid #22c55e !important;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.45) !important;
}
.generation-card.is-comparison-modified {
    border: 2px solid #eab308 !important;
    box-shadow: 0 0 14px rgba(234, 179, 8, 0.45) !important;
}

/* --- MEMBER PROFILE SPECIFIC PHẢ ĐỒ CARD STYLE --- */
.member-profile-card {
    --node-accent: #8c1d18;
    --node-gold: #b8862f;
    --node-corner: rgba(140, 29, 24, .88);
    --node-paper: #fffdf8;
    --node-paper-warm: #fff7e9;
    --node-frame-inset: 12px;
    --node-corner-size: 13px;
    --node-corner-thickness: 2px;
    --node-dash-color: rgba(184, 134, 47, .36);
    --node-dash-thickness: 1px;
    --node-dash-start: calc(var(--node-frame-inset) + var(--node-corner-size));
    --node-dash-length: calc(100% - var(--node-frame-inset) - var(--node-frame-inset) - var(--node-corner-size) - var(--node-corner-size));
    
    position: sticky !important;
    top: 96px !important;
    padding: 28px 22px;
    border: 1px solid #dfc99f !important;
    border-top: 4px solid var(--node-accent) !important;
    border-radius: 12px !important;
    background:
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(180deg, rgba(255, 255, 255, .70), rgba(255, 255, 255, 0) 44%),
        linear-gradient(135deg, var(--node-paper), var(--node-paper-warm)) !important;
    box-shadow:
        0 13px 28px rgba(68, 40, 18, .12),
        inset 0 0 0 1px rgba(255, 255, 255, .76) !important;
    color: #2f251d;
}

.member-profile-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(to right, var(--node-dash-color) 0 4px, transparent 4px 8px) left var(--node-dash-start) top var(--node-frame-inset) / var(--node-dash-length) var(--node-dash-thickness) no-repeat,
        repeating-linear-gradient(to right, var(--node-dash-color) 0 4px, transparent 4px 8px) left var(--node-dash-start) bottom var(--node-frame-inset) / var(--node-dash-length) var(--node-dash-thickness) no-repeat,
        repeating-linear-gradient(to bottom, var(--node-dash-color) 0 4px, transparent 4px 8px) left var(--node-frame-inset) top var(--node-dash-start) / var(--node-dash-thickness) var(--node-dash-length) no-repeat,
        repeating-linear-gradient(to bottom, var(--node-dash-color) 0 4px, transparent 4px 8px) right var(--node-frame-inset) top var(--node-dash-start) / var(--node-dash-thickness) var(--node-dash-length) no-repeat;
    pointer-events: none;
}

.member-profile-card.is-living {
    --node-accent: #2f6f5e !important;
    --node-corner: #2f6f5e !important;
    border-color: rgba(47, 111, 94, 0.45) !important;
    border-top-color: #2f6f5e !important;
}

.member-profile-card.is-deceased {
    --node-accent: var(--red) !important;
    --node-corner: var(--red) !important;
    border-color: rgba(140, 29, 24, 0.45) !important;
    border-top-color: var(--red) !important;
}

.member-profile-card img {
    border: 3px solid #dfc99f !important;
    box-shadow: 0 4px 12px rgba(68, 40, 18, .12) !important;
    border-radius: 50% !important;
    width: 150px !important;
    height: 150px !important;
}

.member-profile-card h1 {
    font-size: 24px !important;
    font-weight: 800 !important;
    color: #2f251d;
    margin: 14px 0 6px !important;
    font-family: var(--family-tree-font) !important;
}

.member-profile-card .muted {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 12px;
    font-style: italic;
}

.member-profile-card .badge {
    display: inline-block;
    background: #ffeec9 !important;
    color: #8c1d18 !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    padding: 4px 14px !important;
    border-radius: 20px !important;
    border: 1px solid #dfc99f !important;
}

/* Individual death-anniversary reminders */
.memorial-reminder-section { background: var(--paper); padding: 0 0 56px; }
.memorial-reminder-card { max-width: 980px; margin: 0 auto; padding: 28px; border: 2px solid var(--gold); border-radius: 16px; background: #fffdf9; box-shadow: 0 16px 40px rgba(110,74,24,.07); }
.memorial-reminder-heading { text-align: center; margin-bottom: 22px; }
.memorial-reminder-heading h2 { margin: 0; color: var(--red); font: 700 28px/1.25 'Lora',Georgia,serif; }
.memorial-reminder-heading p { margin: 9px 0 0; color: var(--muted); }
.memorial-lotus-mark { display: block; width: 136px; height: 38px; margin: 0 auto 4px; fill: rgba(157,33,27,.08); stroke: #b98325; stroke-width: 1.6; stroke-linejoin: round; }
.memorial-lotus-mark .lotus-line { fill: none; stroke-width: 1.2; }
.memorial-list { display: grid; gap: 14px; }
.memorial-item { display: grid; grid-template-columns: 112px minmax(0,1fr) auto; align-items: center; gap: 20px; padding: 18px 20px 18px 12px; border: 1px solid #e7d7bd; border-radius: 14px; background: linear-gradient(105deg,#fffaf0,#fff 48%); position: relative; overflow: hidden; }
.memorial-item.is-today { border-color: var(--red); box-shadow: inset 4px 0 var(--red); }
.memorial-incense-art svg { display: block; width: 100%; height: 126px; overflow: visible; }
.memorial-incense-art .smoke { fill: none; stroke: #ad9b8d; stroke-width: 3; stroke-linecap: round; opacity: .65; }
.memorial-incense-art .incense-stick { fill: none; stroke: #d39a39; stroke-width: 3; stroke-linecap: round; }
.memorial-content { display: flex; align-items: center; gap: 16px; min-width: 0; }
.memorial-date-badge { flex: 0 0 66px; text-align: center; overflow: hidden; border: 1px solid #dfc89f; border-radius: 10px; background: white; }
.memorial-date-badge strong { display: block; padding: 7px 4px 3px; color: var(--red); font: 700 26px/1 'Lora',serif; }
.memorial-date-badge span { display: block; padding: 4px; background: #f4e8d2; color: #735227; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.memorial-copy { min-width: 0; }
.memorial-status { display: inline-block; margin-bottom: 5px; color: #8a611d; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.memorial-copy h3 { margin: 0 0 5px; color: #3e2418; font: 700 21px/1.25 'Lora',serif; }
.memorial-copy p { margin: 0; color: var(--muted); line-height: 1.55; }
.memorial-action { min-width: 190px; text-align: center; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.memorial-incense-button { width: 100%; border: 0; cursor: pointer; white-space: nowrap; }
.memorial-incense-button.is-lit { background: #6d5b46; cursor: default; }
.memorial-relation-button { width: 100%; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #bd8425; background: #fffdf9; color: #7c541d; box-shadow: none; white-space: nowrap; }
.memorial-relation-button:hover:not(:disabled) { border-color: var(--red); background: #fff7e9; color: var(--red); transform: translateY(-1px); }
.memorial-relation-button[aria-expanded="true"] { border-color: #8f1f1a; background: #f9ecdb; color: #8f1f1a; }
.memorial-relation-button:disabled { border-color: #d8cdbd; background: #f7f3ed; color: #938778; cursor: not-allowed; opacity: 1; }
.memorial-action small { display: block; margin: 0; color: var(--muted); }
.memorial-action-message { display: block; min-height: 17px; margin-top: 4px; color: #7e221c; font-size: 11px; }
.memorial-relation-result { grid-column: 2 / -1; display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 12px; align-items: start; margin-top: -2px; padding: 14px 16px; border: 1px solid #dfc28c; border-radius: 12px; background: linear-gradient(105deg,#fff8e9,#fffdf9); color: #4b3424; text-align: left; }
.memorial-relation-result[hidden] { display: none !important; }
.memorial-relation-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #f1dfbc; color: #8f1f1a; }
.memorial-relation-copy { min-width: 0; }
.memorial-relation-copy > span { display: block; margin-bottom: 3px; color: #8a611d; font-size: 11px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.memorial-relation-copy p { margin: 0; color: #493022; line-height: 1.5; }
.memorial-relation-copy p b { color: var(--red); font-family: 'Lora',Georgia,serif; font-size: 17px; }
.memorial-relation-copy small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.45; }
.memorial-relation-copy em { display: block; margin-top: 7px; color: #786651; font-size: 11px; line-height: 1.45; }

@media (max-width: 720px) {
    .memorial-reminder-card { padding: 16px 10px; }
    .memorial-item { grid-template-columns: 78px minmax(0,1fr); gap: 10px; padding: 14px 12px; }
    .memorial-incense-art svg { height: 104px; }
    .memorial-content { gap: 10px; }
    .memorial-date-badge { flex-basis: 56px; }
    .memorial-date-badge strong { font-size: 22px; }
    .memorial-action { grid-column: 1 / -1; min-width: 0; display: grid; grid-template-columns: minmax(150px,1fr) 1fr; align-items: center; gap: 8px; }
    .memorial-action small { margin: 0; text-align: left; }
    .memorial-action-message { grid-column: 1 / -1; }
    .memorial-relation-result { grid-column: 1 / -1; grid-template-columns: 34px minmax(0,1fr); gap: 10px; padding: 12px; }
    .memorial-relation-icon { width: 34px; height: 34px; }
}

@media (max-width: 480px) {
    .memorial-action { grid-template-columns: 1fr; }
    .memorial-action-message { grid-column: 1; }
    .memorial-action small { text-align: center; }
}

@media (prefers-reduced-motion: no-preference) {
    .memorial-item.is-today .smoke-a { animation: memorialSmoke 3.2s ease-in-out infinite; }
    .memorial-item.is-today .smoke-b { animation: memorialSmoke 3.2s ease-in-out .8s infinite reverse; }
    @keyframes memorialSmoke { 50% { transform: translateX(4px); opacity: .25; } }
}

.member-social-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 12px;
}

.member-social-link {
    --social-color: #475569;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(71, 85, 105, .22);
    border-radius: 50%;
    background: rgba(255, 255, 255, .82);
    color: var(--social-color);
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(68, 40, 18, .08);
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.member-social-link svg {
    width: 18px;
    height: 18px;
    display: block;
}

.member-social-link:hover,
.member-social-link:focus-visible {
    background: var(--social-color);
    border-color: var(--social-color);
    color: #ffffff;
    transform: translateY(-1px);
}

.member-social-link-facebook { --social-color: #1877f2; }
.member-social-link-zalo { --social-color: #0068ff; }
.member-social-link-messenger { --social-color: #7b3ff2; }
.member-social-link-instagram { --social-color: #c13584; }
.member-social-link-threads { --social-color: #111827; }
.member-social-link-tiktok { --social-color: #111827; }
.member-social-link-youtube { --social-color: #ff0000; }
.member-social-link-x { --social-color: #111827; }
.member-social-link-linkedin { --social-color: #0a66c2; }
.member-social-link-github { --social-color: #24292f; }
.member-social-link-telegram { --social-color: #229ed9; }
.member-social-link-whatsapp { --social-color: #25d366; }
.member-social-link-website { --social-color: #8c1d18; }

/* --- INFO PANEL OVERRIDES --- */
.info-panel {
    background: linear-gradient(135deg, #fffdf9, #fff7ea) !important;
    border: 1px solid #eadcc8 !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 20px rgba(68, 40, 18, .06) !important;
    padding: 26px !important;
}

.info-panel h2 {
    font-family: var(--family-tree-font) !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    letter-spacing: 0;
    color: #8c1d18;
    margin-bottom: 18px !important;
}

/* --- RELATION CARD (MINI-NODE) STYLE --- */
.member-node-card {
    --node-accent: #8c1d18;
    --node-gold: #b8862f;
    --node-corner: rgba(140, 29, 24, .88);
    --node-paper: #fffdf8;
    --node-paper-warm: #fff7e9;
    --node-frame-inset: 8px;
    --node-corner-size: 10px;
    --node-corner-thickness: 1.5px;
    --node-dash-color: rgba(184, 134, 47, .25);
    --node-dash-thickness: 1px;
    --node-dash-start: calc(var(--node-frame-inset) + var(--node-corner-size));
    --node-dash-length: calc(100% - var(--node-frame-inset) - var(--node-frame-inset) - var(--node-corner-size) - var(--node-corner-size));

    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid #dfc99f;
    border-top: 3px solid var(--node-accent);
    border-radius: 8px;
    background:
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(180deg, rgba(255, 255, 255, .70), rgba(255, 255, 255, 0) 44%),
        linear-gradient(135deg, var(--node-paper), var(--node-paper-warm));
    box-shadow:
        0 4px 10px rgba(68, 40, 18, .06),
        inset 0 0 0 1px rgba(255, 255, 255, .76);
    color: #2f251d;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.member-node-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(to right, var(--node-dash-color) 0 3px, transparent 3px 6px) left var(--node-dash-start) top var(--node-frame-inset) / var(--node-dash-length) var(--node-dash-thickness) no-repeat,
        repeating-linear-gradient(to right, var(--node-dash-color) 0 3px, transparent 3px 6px) left var(--node-dash-start) bottom var(--node-frame-inset) / var(--node-dash-length) var(--node-dash-thickness) no-repeat,
        repeating-linear-gradient(to bottom, var(--node-dash-color) 0 3px, transparent 3px 6px) left var(--node-frame-inset) top var(--node-dash-start) / var(--node-dash-thickness) var(--node-dash-length) no-repeat,
        repeating-linear-gradient(to bottom, var(--node-dash-color) 0 3px, transparent 3px 6px) right var(--node-frame-inset) top var(--node-dash-start) / var(--node-dash-thickness) var(--node-dash-length) no-repeat;
    pointer-events: none;
}

.member-node-card.is-living {
    --node-accent: #2f6f5e !important;
    --node-corner: #2f6f5e !important;
    border-color: rgba(47, 111, 94, 0.45) !important;
    border-top-color: #2f6f5e !important;
}

.member-node-card.is-deceased {
    --node-accent: var(--red) !important;
    --node-corner: var(--red) !important;
    border-color: rgba(140, 29, 24, 0.45) !important;
    border-top-color: var(--red) !important;
}

.member-node-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 16px rgba(68, 40, 18, .12),
        inset 0 0 0 1px rgba(255, 255, 255, .76);
}

.member-node-label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    line-height: 1.2;
}

.member-profile-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(to right, var(--node-dash-color) 0 4px, transparent 4px 8px) left var(--node-dash-start) top var(--node-frame-inset) / var(--node-dash-length) var(--node-dash-thickness) no-repeat,
        repeating-linear-gradient(to right, var(--node-dash-color) 0 4px, transparent 4px 8px) left var(--node-dash-start) bottom var(--node-frame-inset) / var(--node-dash-length) var(--node-dash-thickness) no-repeat,
        repeating-linear-gradient(to bottom, var(--node-dash-color) 0 4px, transparent 4px 8px) left var(--node-frame-inset) top var(--node-dash-start) / var(--node-dash-thickness) var(--node-dash-length) no-repeat,
        repeating-linear-gradient(to bottom, var(--node-dash-color) 0 4px, transparent 4px 8px) right var(--node-frame-inset) top var(--node-dash-start) / var(--node-dash-thickness) var(--node-dash-length) no-repeat;
    pointer-events: none;
}

.member-profile-card.is-living {
    --node-accent: #2f6f5e !important;
    --node-corner: #2f6f5e !important;
    border-color: rgba(47, 111, 94, 0.45) !important;
    border-top-color: #2f6f5e !important;
}

.member-profile-card.is-deceased {
    --node-accent: var(--red) !important;
    --node-corner: var(--red) !important;
    border-color: rgba(140, 29, 24, 0.45) !important;
    border-top-color: var(--red) !important;
}

.member-profile-card img {
    border: 3px solid #dfc99f !important;
    box-shadow: 0 4px 12px rgba(68, 40, 18, .12) !important;
    border-radius: 50% !important;
    width: 150px !important;
    height: 150px !important;
}

.member-profile-card h1 {
    font-size: 24px !important;
    font-weight: 800 !important;
    color: #2f251d;
    margin: 14px 0 6px !important;
    font-family: var(--family-tree-font) !important;
}

.member-profile-card .muted {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 12px;
    font-style: italic;
}

.member-profile-card .badge {
    display: inline-block;
    background: #ffeec9 !important;
    color: #8c1d18 !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    padding: 4px 14px !important;
    border-radius: 20px !important;
    border: 1px solid #dfc99f !important;
}

/* --- INFO PANEL OVERRIDES --- */
.info-panel {
    background: linear-gradient(135deg, #fffdf9, #fff7ea) !important;
    border: 1px solid #eadcc8 !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 20px rgba(68, 40, 18, .06) !important;
    padding: 26px !important;
}

.info-panel h2 {
    font-family: var(--family-tree-font) !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    letter-spacing: 0;
    color: #8c1d18;
    margin-bottom: 18px !important;
}

/* --- RELATION CARD (MINI-NODE) STYLE --- */
.member-node-card {
    --node-accent: #8c1d18;
    --node-gold: #b8862f;
    --node-corner: rgba(140, 29, 24, .88);
    --node-paper: #fffdf8;
    --node-paper-warm: #fff7e9;
    --node-frame-inset: 8px;
    --node-corner-size: 10px;
    --node-corner-thickness: 1.5px;
    --node-dash-color: rgba(184, 134, 47, .25);
    --node-dash-thickness: 1px;
    --node-dash-start: calc(var(--node-frame-inset) + var(--node-corner-size));
    --node-dash-length: calc(100% - var(--node-frame-inset) - var(--node-frame-inset) - var(--node-corner-size) - var(--node-corner-size));

    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid #dfc99f;
    border-top: 3px solid var(--node-accent);
    border-radius: 8px;
    background:
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) top var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) left var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-size) var(--node-corner-thickness) no-repeat,
        linear-gradient(var(--node-corner) 0 0) right var(--node-frame-inset) bottom var(--node-frame-inset) / var(--node-corner-thickness) var(--node-corner-size) no-repeat,
        linear-gradient(180deg, rgba(255, 255, 255, .70), rgba(255, 255, 255, 0) 44%),
        linear-gradient(135deg, var(--node-paper), var(--node-paper-warm));
    box-shadow:
        0 4px 10px rgba(68, 40, 18, .06),
        inset 0 0 0 1px rgba(255, 255, 255, .76);
    color: #2f251d;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.member-node-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(to right, var(--node-dash-color) 0 3px, transparent 3px 6px) left var(--node-dash-start) top var(--node-frame-inset) / var(--node-dash-length) var(--node-dash-thickness) no-repeat,
        repeating-linear-gradient(to right, var(--node-dash-color) 0 3px, transparent 3px 6px) left var(--node-dash-start) bottom var(--node-frame-inset) / var(--node-dash-length) var(--node-dash-thickness) no-repeat,
        repeating-linear-gradient(to bottom, var(--node-dash-color) 0 3px, transparent 3px 6px) left var(--node-frame-inset) top var(--node-dash-start) / var(--node-dash-thickness) var(--node-dash-length) no-repeat,
        repeating-linear-gradient(to bottom, var(--node-dash-color) 0 3px, transparent 3px 6px) right var(--node-frame-inset) top var(--node-dash-start) / var(--node-dash-thickness) var(--node-dash-length) no-repeat;
    pointer-events: none;
}

.member-node-card.is-living {
    --node-accent: #2f6f5e !important;
    --node-corner: #2f6f5e !important;
    border-color: rgba(47, 111, 94, 0.45) !important;
    border-top-color: #2f6f5e !important;
}

.member-node-card.is-deceased {
    --node-accent: var(--red) !important;
    --node-corner: var(--red) !important;
    border-color: rgba(140, 29, 24, 0.45) !important;
    border-top-color: var(--red) !important;
}

.member-node-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 16px rgba(68, 40, 18, .12),
        inset 0 0 0 1px rgba(255, 255, 255, .76);
}

.member-node-label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    line-height: 1.2;
}

.member-node-name-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    line-height: 1.3;
}

.member-node-name {
    color: #2f251d;
    font-size: 14.5px;
    font-weight: 700;
}

/* Member detail: compact relationship cards shared by parents, spouses and children. */
.relation-list {
    gap: 14px;
}

.info-panel h3 {
    margin: 26px 0 14px;
    padding-top: 20px;
    border-top: 1px solid #eadcc8;
    color: #382b22;
    font-size: 18px;
    line-height: 1.3;
}

.member-node-card {
    position: relative !important;
    top: auto !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-content: center;
    gap: 8px !important;
    min-width: 0;
    min-height: 88px;
    padding: 16px 48px 16px 18px !important;
    overflow: hidden;
    border: 1px solid #ead8bd !important;
    border-top: 1px solid #ead8bd !important;
    border-left: 4px solid var(--node-accent) !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #fffefb 0%, #fff9ef 100%) !important;
    box-shadow: 0 5px 14px rgba(68, 40, 18, .07) !important;
    color: #2f251d;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease !important;
}

.member-node-card::before {
    content: none !important;
    display: none !important;
    background: none !important;
}

.member-node-card.is-living {
    --node-accent: #2f6f5e !important;
    border-color: #d9e4de !important;
    border-top-color: #d9e4de !important;
    border-left-color: #2f6f5e !important;
}

.member-node-card.is-deceased {
    --node-accent: var(--red) !important;
    border-color: #ead8bd !important;
    border-top-color: #ead8bd !important;
    border-left-color: var(--red) !important;
}

.member-node-card:hover {
    transform: translateY(-2px);
    border-color: #d6bc91 !important;
    border-left-color: var(--node-accent) !important;
    box-shadow: 0 10px 22px rgba(68, 40, 18, .12) !important;
}

.member-node-card:focus-visible {
    outline: 3px solid rgba(184, 134, 47, .25);
    outline-offset: 2px;
}

.member-node-label {
    position: static !important;
    top: auto !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    justify-self: start;
    width: fit-content;
    max-width: 100%;
    min-height: 24px;
    padding: 4px 9px !important;
    border: 1px solid #ead8bd !important;
    border-top: 1px solid #ead8bd !important;
    border-radius: 999px !important;
    background: #f9edd8 !important;
    box-shadow: none !important;
    color: #765523 !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    letter-spacing: .055em !important;
    text-transform: uppercase !important;
}

.member-node-name-wrapper {
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px !important;
    min-width: 0;
    line-height: 1.35 !important;
}

.member-node-name-wrapper > span {
    display: inline-flex;
}

.member-node-name {
    color: #2f251d !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1.3;
}

.member-node-meta {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    width: fit-content;
    color: #7b6c5d !important;
    font-size: 12px !important;
    font-weight: 600;
    line-height: 1.3;
}

.member-node-meta svg {
    flex: 0 0 auto;
    color: #a8792b;
}

.member-node-arrow {
    position: absolute;
    top: 50%;
    right: 16px;
    display: grid !important;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid #ead8bd;
    border-radius: 50%;
    background: rgba(255, 255, 255, .72);
    color: #9a6e27 !important;
    transform: translateY(-50%);
    transition: transform .18s ease, background .18s ease;
}

.member-node-card:hover .member-node-arrow {
    background: #fff;
    transform: translate(2px, -50%);
}

.member-family-panel {
    padding: 22px 24px !important;
}

.member-family-groups {
    display: grid;
    gap: 14px;
}

.member-family-group {
    display: grid;
    gap: 9px;
    padding-top: 13px;
    border-top: 1px solid #eadcc8;
}

.member-family-group:first-child {
    padding-top: 0;
    border-top: 0;
}

.member-family-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.member-family-group-head h3 {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    color: #382b22;
    font-size: 14px;
    line-height: 1.25;
}

.member-family-group-head span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border: 1px solid #eadcc8;
    border-radius: 999px;
    background: transparent;
    color: #8c1d18;
    font-size: 11px;
    font-weight: 800;
}

.member-family-panel .relation-list {
    grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
    gap: 9px;
}

.member-family-panel .member-node-card {
    min-height: 56px;
    gap: 4px !important;
    padding: 9px 32px 9px 12px !important;
    border: 1px solid #eadcc8 !important;
    border-left: 2px solid #c6a062 !important;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, .34) !important;
    box-shadow: none !important;
}

.member-family-panel .member-node-card::before {
    display: none !important;
}

.member-family-panel .member-node-card:hover {
    border-color: #d9c4a7 !important;
    border-left-color: #9b7a43 !important;
    background: rgba(255, 255, 255, .58) !important;
    transform: none !important;
}

.member-family-panel .member-node-label {
    min-height: 0;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #9a7a4b !important;
    font-size: 9px !important;
    letter-spacing: .03em;
    box-shadow: none !important;
}

.member-family-panel .member-node-name {
    font-size: 13.5px !important;
}

.member-family-panel .member-node-meta {
    gap: 5px;
    font-size: 11px !important;
}

.member-family-panel .member-node-meta svg {
    width: 12px;
    height: 12px;
}

.member-family-panel .member-node-arrow {
    right: 9px;
    width: 18px;
    height: 18px;
    border: 0 !important;
    background: transparent !important;
    color: #b58438 !important;
}

.member-family-panel .member-node-card:hover .member-node-arrow {
    background: transparent !important;
    transform: translate(1px, -50%);
}

.member-family-group.is-empty {
    gap: 6px;
}

.member-family-group.is-empty .empty {
    margin: 0;
    padding: 8px 10px;
    border: 1px dashed #ead8bd;
    border-radius: 10px;
    background: rgba(255, 250, 241, .62);
    color: #8c7a68;
    font-size: 12px;
}

.member-family-more {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eadcc8;
    text-align: left;
}

.member-family-more > summary {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    min-height: 30px;
    padding: 4px 2px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #8c1d18;
    cursor: pointer;
    font-weight: 800;
    list-style: none;
    box-shadow: none;
    transition: color .18s ease;
}

.member-family-more > summary::-webkit-details-marker {
    display: none;
}

.member-family-more > summary:hover {
    color: #6f1612;
}

.member-family-more > summary:focus-visible {
    outline: 2px solid rgba(140, 29, 24, .24);
    outline-offset: 3px;
}

.member-family-more-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    padding: 1px 7px;
    border: 1px solid #eadcc8;
    border-radius: 999px;
    background: rgba(255, 255, 255, .44);
    color: #8c1d18;
    font-size: 10px;
    line-height: 1;
}

.member-family-more-icon {
    width: 15px;
    height: 15px;
    color: #9a6e27;
    transition: transform .18s ease;
}

.member-family-more-hide {
    display: none;
}

.member-family-more[open] .member-family-more-show {
    display: none;
}

.member-family-more[open] .member-family-more-hide {
    display: inline;
}

.member-family-more[open] .member-family-more-icon {
    transform: rotate(180deg);
}

.member-family-extra-groups {
    margin-top: 14px;
}

/* --- MOBILE SPECIFIC PROFILE CARD OVERRIDES --- */
@media (max-width: 960px) {
    .member-detail-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .member-detail-toolbar .btn {
        justify-content: center;
        width: 100%;
    }

    .member-profile-card {
        position: static !important;
        margin-bottom: 20px !important;
    }

    .member-node-card {
        min-height: 84px;
        padding: 14px 44px 14px 14px !important;
    }

    .member-node-name {
        font-size: 15px !important;
    }

    .member-node-arrow {
        right: 12px;
    }

    .member-family-panel .relation-list {
        grid-template-columns: 1fr;
    }
}

/* Deceased & Living status color overrides (Main Node & Spouses) */
.generation-card.is-deceased .generation-card-main h3,
.generation-card.is-deceased .generation-card-main h3 a,
.generation-card.is-deceased .generation-card-main h3 .member-name-text {
    color: var(--red) !important;
}

.generation-card.is-living .generation-card-main h3,
.generation-card.is-living .generation-card-main h3 a,
.generation-card.is-living .generation-card-main h3 .member-name-text {
    color: var(--green) !important;
}

.generation-spouse-row.is-deceased,
.generation-spouse-row.is-deceased a {
    color: var(--red) !important;
}

.generation-spouse-row.is-living,
.generation-spouse-row.is-living a {
    color: var(--green) !important;
}

/* Hide spouse status dots completely since names are color-coded */
.generation-spouse-status {
    display: none !important;
}

/* Admin pedigree: generation-axis and life-status controls */
.generation-tree-builder .axis-toggle-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    align-self: flex-end;
    gap: 6px;
    flex: 0 0 auto;
}

.generation-tree-builder .generation-axis-toggle-btn,
.generation-tree-builder .life-status-filter-toggle {
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
}

.life-status-filter {
    position: relative;
    display: inline-flex;
}

.life-status-filter-toggle {
    position: relative;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: 6px;
    background: #ffffff;
    color: #64748b;
}

.life-status-filter-toggle:hover,
.life-status-filter.is-open .life-status-filter-toggle {
    border-color: #94a3b8;
    background: #f8fafc;
    color: #334155;
}

.life-status-filter-toggle.is-filtered {
    box-shadow: 0 0 0 3px rgba(140, 29, 24, .10);
}

.life-status-filter-toggle[data-active-life-status="living"] {
    border-color: #2f6f5e;
    color: #2f6f5e;
}

.life-status-filter-toggle[data-active-life-status="deceased"] {
    border-color: var(--red);
    color: var(--red);
}

.life-status-filter-indicator {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 7px;
    height: 7px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .18);
}

.life-status-filter-toggle[data-active-life-status="living"] .life-status-filter-indicator {
    background: #2f6f5e;
}

.life-status-filter-toggle[data-active-life-status="deceased"] .life-status-filter-indicator {
    background: var(--red);
}

.life-status-filter-menu[hidden] {
    display: none !important;
}

.life-status-filter-menu {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    z-index: 1005;
    width: 224px;
    max-width: calc(100vw - 32px);
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid #d8e0ea;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
}

.life-status-filter-menu::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 15px;
    width: 9px;
    height: 9px;
    border-top: 1px solid #d8e0ea;
    border-left: 1px solid #d8e0ea;
    background: #ffffff;
    transform: rotate(45deg);
}

.life-status-filter-option {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 42px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 6px 10px 6px 7px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #94a3b8;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.life-status-filter-option:hover,
.life-status-filter-option:focus-visible {
    border-color: #cbd5e1;
    background: #f1f5f9;
    color: #475569;
    outline: none;
}

.life-status-filter-option-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: #e2e8f0;
    color: #94a3b8;
}

.life-status-filter-option-label {
    min-width: 0;
}

.life-status-filter-count {
    font-size: 11px;
    font-weight: 800;
    opacity: .86;
}

.life-status-filter-option.is-active {
    border-color: #475569;
    background: #475569;
    color: #ffffff;
    box-shadow: 0 5px 12px rgba(71, 85, 105, .18);
}

.life-status-filter-option.is-active[data-life-status-filter-option="living"] {
    border-color: #2f6f5e;
    background: #2f6f5e;
    box-shadow: 0 5px 12px rgba(47, 111, 94, .22);
}

.life-status-filter-option.is-active[data-life-status-filter-option="deceased"] {
    border-color: var(--red);
    background: var(--red);
    box-shadow: 0 5px 12px rgba(140, 29, 24, .22);
}

.life-status-filter-option.is-active .life-status-filter-option-icon {
    background: rgba(255, 255, 255, .16);
    color: #ffffff;
}

/* Matching people stay vivid; non-matching people remain visible in gray. */
.generation-tree-line.is-life-filter-muted {
    opacity: .3;
    stroke: #cbd5e1;
}

.generation-card.is-life-filter-muted {
    opacity: .22;
    filter: grayscale(1);
    border-color: #d1d5db !important;
    border-top-color: #94a3b8 !important;
    background: #f1f5f9;
    box-shadow: none;
}

.generation-card.is-life-filter-muted h3,
.generation-card.is-life-filter-muted h3 a,
.generation-card.is-life-filter-muted h3 .member-name-text,
.generation-card.is-life-filter-muted p,
.generation-card.is-life-filter-muted .generation-chip,
.generation-card.is-life-filter-muted .generation-spouse-row,
.generation-card.is-life-filter-muted .generation-spouse-row a {
    color: #94a3b8 !important;
}

.generation-card.is-life-filter-match:not(.is-role-filter-muted) {
    z-index: 6;
    box-shadow:
        0 0 0 4px rgba(47, 111, 94, .10),
        0 18px 34px rgba(31, 41, 55, .16);
}

.generation-card.is-life-filter-host-muted {
    --node-accent: #94a3b8 !important;
    --node-corner: #cbd5e1 !important;
    border-color: #d1d5db !important;
    border-top-color: #94a3b8 !important;
    background: #f8fafc;
}

.generation-card.is-life-filter-host-muted > .generation-card-top,
.generation-card.is-life-filter-host-muted > .generation-card-body {
    opacity: .26;
    filter: grayscale(1);
}

.generation-spouse-row.is-life-filter-person-muted,
.generation-spouse-row.is-life-filter-person-muted a {
    color: #94a3b8 !important;
}

.generation-spouse-row.is-life-filter-person-muted {
    opacity: .22;
    filter: grayscale(1);
    border-color: #cbd5e1 !important;
    background: #f1f5f9 !important;
    box-shadow: none !important;
}

.generation-spouse-row.is-life-filter-person-match {
    opacity: 1;
    filter: none;
    box-shadow: 0 0 0 3px rgba(47, 111, 94, .10);
}

@media (max-width: 768px) {
    .generation-tree-builder .axis-toggle-container {
        align-self: start;
    }

    .generation-tree-builder .generation-axis-toggle-btn,
    .generation-tree-builder .life-status-filter-toggle {
        height: 38px;
        min-height: 38px;
    }
}

/* Search/Filter Toolbar Toggle Button (Desktop hidden) */
.tree-tools-toggle-btn {
    display: none !important;
}

.tree-tools-mobile-head {
    display: none;
}

@media (max-width: 768px) {
    /* Show toggle button on mobile */
    .tree-tools-toggle-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        min-width: 42px;
        padding: 6px 10px;
    }
    
    /* Hide the tree-toolbar on mobile by default */
    .generation-tree-builder .tree-toolbar {
        display: none !important;
    }
    
    /* When tools panel is toggled open, show it as a vertical column block */
    .generation-tree-builder .tree-toolbar.is-open {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 10px !important;
        margin-bottom: 8px !important;
    }

    .generation-tree-builder .tree-tools-mobile-head {
        order: -100;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 38px;
        padding: 0 0 8px;
        border-bottom: 1px solid #ead8c0;
        color: var(--red);
        box-sizing: border-box;
    }

    .generation-tree-builder .tree-tools-mobile-head strong {
        font-size: 14px;
        line-height: 1.3;
    }

    .generation-tree-builder .tree-tools-mobile-close {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        display: inline-grid;
        place-items: center;
        padding: 0;
        border: 1px solid var(--red);
        border-radius: 8px;
        background: #fff;
        color: var(--red);
        font: inherit;
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
    }
    
    /* Make toolbar inner elements stretch to full width in column layout */
    .generation-tree-builder .tree-toolbar.is-open label,
    .generation-tree-builder .tree-toolbar.is-open .tree-search-container,
    .generation-tree-builder .tree-toolbar.is-open .generation-role-filters,
    .generation-tree-builder .tree-toolbar.is-open .tree-root-picker {
        width: 100% !important;
        max-width: none !important;
        grid-column: span 2 !important;
        align-self: stretch !important;
    }
    
    /* Restore labels font-size in open state so it's readable */
    .generation-tree-builder .tree-toolbar.is-open label {
        font-size: 12px !important;
        gap: 4px !important;
    }
    
    /* Keep role filter buttons side-by-side as icons in vertical layout */
    .generation-tree-builder .tree-toolbar.is-open .generation-role-filters {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
    }
}

/* Signed-in account: correct the family-tree profile link. */
.account-link-shell {
    min-height: 72vh;
    padding: 36px 0 64px;
    background: radial-gradient(circle at 50% 0, rgba(184,134,47,.12), transparent 34%), var(--paper);
}

.account-link-container { width: min(1040px, calc(100% - 32px)); }

.account-link-back {
    display: inline-flex;
    margin-bottom: 18px;
    color: #76572d;
    font-size: 14px;
    font-weight: 800;
}

.account-link-back:hover { color: var(--red); }

.account-link-heading {
    max-width: 720px;
    margin: 0 auto 24px;
    text-align: center;
}

.account-link-heading .eyebrow { color: #9a681f; }

.account-link-heading h1 {
    margin: 6px 0 10px;
    color: var(--red);
    font: 700 clamp(29px,4vw,40px)/1.2 'Lora',Georgia,serif;
}

.account-link-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

.account-link-card {
    display: grid;
    gap: 20px;
    padding: clamp(20px,4vw,36px);
    border: 1px solid #dfc28c;
    border-radius: 18px;
    background: #fffdf9;
    box-shadow: 0 18px 44px rgba(91,57,20,.1);
}

.account-link-alert,
.account-link-notice {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 15px;
    border-radius: 10px;
}

.account-link-alert {
    border: 1px solid #e3a7a2;
    background: #fff0ef;
    color: #861f1a;
}

.account-link-alert strong,
.account-link-alert span { display: block; }

.account-link-alert span {
    margin-top: 2px;
    color: #6e403d;
    font-size: 13px;
}

.account-link-notice {
    border: 1px solid #ead7b4;
    background: #fff8e9;
    color: #7f5a20;
}

.account-link-notice svg {
    flex: 0 0 auto;
    margin-top: 1px;
}

.account-link-notice p {
    margin: 0;
    color: #6d5941;
    font-size: 13px;
    line-height: 1.55;
}

.account-link-notice strong { color: #493422; }

.account-link-current {
    display: grid;
    grid-template-columns: auto 52px minmax(0,1fr) auto;
    align-items: center;
    gap: 13px;
    padding: 16px;
    border: 1px solid #dfcda9;
    border-radius: 12px;
    background: linear-gradient(105deg,#fff7e7,#fffdf9 62%);
}

.account-link-status {
    align-self: start;
    padding: 5px 8px;
    border-radius: 999px;
    background: #8f1f1a;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.account-link-person-avatar {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px solid #d6ad65;
    border-radius: 50%;
    background: #f3dfb8;
    color: #8f1f1a;
    font: 800 20px/1 'Lora',Georgia,serif;
}

.account-link-person-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-link-person-avatar [hidden] { display: none !important; }

.account-link-person-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.account-link-person-copy small {
    color: #8b631e;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.account-link-person-copy strong {
    overflow: visible;
    overflow-wrap: anywhere;
    color: #3f291d;
    font: 700 19px/1.3 'Lora',Georgia,serif;
    text-overflow: clip;
    white-space: normal;
}

.account-link-person-copy > span {
    color: var(--muted);
    font-size: 13px;
}

.account-link-person-copy > span b { font-weight: 700; }

.account-link-current > a {
    padding: 8px 10px;
    border: 1px solid #d9b775;
    border-radius: 7px;
    color: #7f571c;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.account-link-current > a:hover {
    border-color: var(--red);
    color: var(--red);
}

.account-link-picker-grid {
    display: grid;
    grid-template-columns: minmax(0,1.15fr) minmax(280px,.85fr);
    gap: 18px;
}

.account-link-picker,
.account-link-preview {
    position: relative;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.social-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.social-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.account-link-step {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f0d9ac;
    color: #8f1f1a;
    font-weight: 900;
}

.account-link-picker h2,
.account-link-preview h2 {
    margin: 0 38px 4px 0;
    color: #432c20;
    font: 700 19px/1.3 'Lora',Georgia,serif;
}

.account-link-picker > div > p,
.account-link-preview-heading p {
    margin: 0 34px 16px 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.account-link-picker label {
    position: relative;
    display: grid;
    gap: 7px;
    margin-top: 14px;
    color: #493426;
    font-size: 13px;
    font-weight: 900;
}

.account-link-picker input,
.account-link-picker select,
.account-link-picker textarea {
    width: 100%;
    border-radius: 9px;
    background-color: #fffdf9;
}

.account-link-picker select { min-height: 50px; }

.account-link-picker .account-member-suggestions {
    position: absolute;
    top: 76px;
    right: 0;
    left: 0;
    z-index: 8;
}

.account-link-preview { background: #fffbf4; }

.account-link-preview-person {
    display: grid;
    grid-template-columns: 52px minmax(0,1fr);
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    padding: 16px;
    border: 1px solid #dfc28c;
    border-radius: 10px;
    background: #fff;
}

.account-link-selection-message {
    min-height: 40px;
    margin: 12px 0 0;
    padding: 9px 11px;
    border-radius: 8px;
    background: #f6f0e7;
    color: #746555;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
}

.account-link-selection-message.is-ready {
    background: #edf6ef;
    color: #2d6543;
}

.account-link-confirm {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 16px;
    border: 1px solid #ddc9a5;
    border-radius: 10px;
    background: #fffaf0;
    cursor: pointer;
}

.account-link-confirm input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    accent-color: var(--red);
}

.account-link-confirm strong,
.account-link-confirm small { display: block; }

.account-link-confirm strong {
    color: #463126;
    font-size: 14px;
}

.account-link-confirm small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.account-link-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.account-link-actions .btn {
    min-width: 160px;
    min-height: 48px;
}

.account-link-actions .btn:disabled {
    border-color: #cfc5b7;
    background: #cfc5b7;
    color: #fff;
    cursor: not-allowed;
}

.account-link-support {
    margin: -4px 0 0;
    color: #7a6a59;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.account-link-request-pending {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    padding: 18px 20px;
    border: 1px solid #d9bf87;
    border-radius: 14px;
    background: linear-gradient(110deg, #fff7e5, #fffdf8 70%);
    box-shadow: 0 12px 30px rgba(91, 57, 20, .08);
}

.account-link-request-pending-head {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.account-link-request-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 50%;
    background: rgba(184, 134, 47, .14);
    color: #9a681f;
}

.account-link-request-icon svg {
    width: 24px;
    height: 24px;
}

.account-link-request-pending .eyebrow {
    margin: 0;
    color: #99681d;
    font-size: 10px;
}

.account-link-request-pending h2 {
    margin: 2px 0;
    color: #4a2d1f;
    font: 700 19px/1.25 'Lora', Georgia, serif;
}

.account-link-request-pending p,
.account-link-request-pending-actions > span {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.account-link-request-pending-actions {
    display: grid;
    justify-items: end;
    gap: 7px;
}

.account-link-review-list {
    display: grid;
    gap: 16px;
}

.account-link-review-card {
    overflow: hidden;
    border: 1px solid #dfd1bc;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(46, 34, 24, .06);
}

.account-link-review-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border-bottom: 1px solid #eee3d3;
    background: #fffaf2;
}

.account-link-review-card-head > div:first-child {
    min-width: 0;
}

.account-link-review-card-head .eyebrow {
    margin: 0 0 3px;
    color: #9a681f;
    font-size: 10px;
}

.account-link-review-card-head h3 {
    margin: 0;
    color: #3f291d;
    font: 700 19px/1.25 'Lora', Georgia, serif;
}

.account-link-review-card-head p {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 13px;
}

.account-link-review-comparison {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    padding: 18px 20px;
}

.account-link-review-comparison > div {
    display: grid;
    align-content: center;
    gap: 3px;
    min-width: 0;
    padding: 14px 15px;
    border: 1px solid #e4ddd3;
    border-radius: 10px;
    background: #faf8f5;
}

.account-link-review-comparison > div.is-requested {
    border-color: #bcd4c7;
    background: #f0f8f3;
}

.account-link-review-comparison small {
    color: #96713a;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.account-link-review-comparison strong {
    overflow-wrap: anywhere;
    color: #3f291d;
    font-size: 15px;
}

.account-link-review-comparison span {
    color: var(--muted);
    font-size: 12px;
}

.account-link-review-arrow {
    display: grid;
    place-items: center;
    color: var(--red);
    font-size: 25px !important;
    font-weight: 900;
}

.account-link-review-relation-note {
    margin: 0 20px 18px;
    padding: 12px 14px;
    border-left: 3px solid #b8862f;
    background: #fff9ec;
}

.account-link-review-relation-note strong {
    color: #72501f;
    font-size: 12px;
}

.account-link-review-relation-note p {
    margin: 3px 0 0;
    color: #65513d;
    font-size: 13px;
    line-height: 1.5;
}

.account-link-review-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 20px;
    border-top: 1px solid #eee3d3;
    background: #fcfaf7;
}

.account-link-review-footer > span {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.account-link-review-actions,
.account-link-review-reject-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-link-review-reject-form input {
    width: min(280px, 30vw);
    min-height: 42px;
}

.account-link-review-actions .btn {
    min-height: 42px;
    white-space: nowrap;
}

.account-link-review-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    min-height: 160px;
    padding: 24px;
    border: 1px dashed #d9cbb7;
    border-radius: 12px;
    background: #fcfaf6;
    color: var(--muted);
}

.account-link-review-empty > span {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    background: #eaf5ee;
    color: var(--green);
    font-weight: 900;
}

.account-link-review-empty strong {
    color: #3f382f;
}

.account-link-review-empty p {
    margin: 3px 0 0;
}

@media (max-width: 760px) {
    .account-link-shell { padding: 24px 0 44px; }
    .account-link-container { width: min(calc(100% - 20px),1040px); }
    .account-link-card { gap: 16px; padding: 16px 12px; border-radius: 14px; }
    .account-link-current { grid-template-columns: 46px minmax(0,1fr); }
    .account-link-status { grid-column: 1 / -1; justify-self: start; }
    .account-link-current .account-link-person-avatar { width: 46px; height: 46px; }
    .account-link-current > a { grid-column: 2; justify-self: start; }
    .account-link-picker-grid { grid-template-columns: 1fr; }
    .account-link-picker, .account-link-preview { padding: 17px 14px; }
    .account-link-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .account-link-actions .btn { min-width: 0; }
    .account-link-request-pending { grid-template-columns: 1fr; padding: 16px; }
    .account-link-request-pending-actions { justify-items: start; }
    .account-link-review-card-head { align-items: stretch; flex-direction: column; gap: 10px; }
    .account-link-review-card-head .badge { align-self: flex-start; }
    .account-link-review-comparison { grid-template-columns: 1fr; }
    .account-link-review-arrow { transform: rotate(90deg); }
    .account-link-review-footer,
    .account-link-review-actions,
    .account-link-review-reject-form { align-items: stretch; flex-direction: column; }
    .account-link-review-footer > span { white-space: normal; }
    .account-link-review-actions { width: 100%; }
    .account-link-review-actions form,
    .account-link-review-reject-form input,
    .account-link-review-actions .btn { width: 100%; }
}

@media (max-width: 430px) {
    .account-link-actions { grid-template-columns: 1fr; }
    .account-link-heading p { font-size: 14px; }
}

/* Thành viên đóng góp hình ảnh qua Google Drive */
.gallery-contribution-section {
    position: relative;
    overflow: hidden;
    border-top: 1px solid #eadfce;
    border-bottom: 1px solid #eadfce;
    background:
        radial-gradient(circle at 92% 8%, rgba(184, 134, 47, .13), transparent 30%),
        linear-gradient(135deg, #fffaf1 0%, #f8f1e6 100%);
}

.gallery-contribution-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.gallery-contribution-heading h2 {
    margin: 2px 0 8px;
    color: #4a241d;
    font-family: "Noto Serif", serif;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.16;
}

.gallery-contribution-heading p:last-child {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
}

.gallery-contribution-drive-badge,
.gallery-ready-state,
.gallery-review-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid #ddcba8;
    border-radius: 999px;
    background: rgba(255, 255, 255, .74);
    color: #725729;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.gallery-ready-state.is-ready {
    border-color: #b9d9c9;
    background: #edf8f2;
    color: #27634d;
}

.gallery-ready-state.is-unavailable {
    border-color: #ecc3bd;
    background: #fff1ef;
    color: #96352f;
}

.gallery-contribution-login {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 28px;
    border: 1px solid #dfcfb5;
    border-radius: 14px;
    background: rgba(255, 255, 255, .8);
    box-shadow: 0 16px 40px rgba(74, 45, 20, .07);
}

.gallery-contribution-login strong { font-size: 20px; }
.gallery-contribution-login p { margin: 4px 0 0; color: var(--muted); }

.gallery-contribution-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(320px, .88fr);
    gap: 22px;
    align-items: start;
}

.gallery-contribution-form,
.gallery-contribution-history {
    border: 1px solid #e1d3bd;
    border-radius: 16px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 18px 48px rgba(77, 45, 18, .08);
}

.gallery-contribution-form { padding: 24px; }
.gallery-contribution-history { overflow: hidden; }

.gallery-contribution-history > .gallery-contribution-form-head {
    padding: 24px 24px 18px;
    border-bottom: 1px solid #eee2d1;
}

.gallery-contribution-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.gallery-contribution-form-head > div:first-child {
    display: flex;
    align-items: center;
    gap: 11px;
}

.gallery-contribution-form-head h3 { margin: 0; font-size: 19px; }
.gallery-contribution-form-head > span:last-child { color: var(--muted); font-size: 12px; }

.gallery-step {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
}

.gallery-contribution-warning {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #edc6be;
    border-radius: 8px;
    background: #fff4f1;
    color: #8a332e;
    font-size: 13px;
    font-weight: 700;
}

.gallery-upload-dropzone {
    display: grid;
    width: 100%;
    min-height: 184px;
    place-items: center;
    align-content: center;
    gap: 6px;
    padding: 24px;
    border: 1.5px dashed #cba96e;
    border-radius: 12px;
    background: #fffcf7;
    color: #52392d;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.gallery-upload-dropzone:hover,
.gallery-upload-dropzone.is-dragover {
    border-color: var(--red);
    background: #fff6e9;
    transform: translateY(-1px);
}

.gallery-upload-dropzone:disabled { cursor: not-allowed; opacity: .58; transform: none; }
.gallery-upload-dropzone > span:last-child { color: var(--muted); font-size: 12px; }

.gallery-upload-icon {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 3px;
    place-items: center;
    border-radius: 50%;
    background: #f2e2c5;
    color: var(--red);
}

.gallery-upload-icon svg { width: 25px; height: 25px; }

.gallery-selected-file {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #dfd1bd;
    border-radius: 10px;
    background: #fff;
}

.gallery-selected-file-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gallery-selected-file-head strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.gallery-selected-file-head span {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.gallery-selected-file-head .text-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--red);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.gallery-selected-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}

.gallery-selected-item-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    position: relative;
}

.gallery-selected-item-card img,
.gallery-selected-item-card video {
    width: 48px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background: #1e293b;
    flex: 0 0 48px;
}

.gallery-selected-item-info {
    flex: 1 1 auto;
    min-width: 0;
}

.gallery-selected-item-info strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1e293b;
}

.gallery-selected-item-info span {
    display: block;
    font-size: 11px;
    color: #64748b;
}

.gallery-selected-item-remove {
    padding: 4px 8px;
    border: 0;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.gallery-selected-item-remove:hover {
    color: #ef4444;
    background: #fee2e2;
}

.gallery-contribution-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 18px;
}

.gallery-contribution-fields label { font-size: 13px; }
.gallery-contribution-note { grid-column: 1 / -1; }

.gallery-upload-progress { margin-top: 18px; }
.gallery-upload-progress > div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.gallery-upload-progress progress { display: block; width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; background: #eadfce; }
.gallery-upload-progress progress::-webkit-progress-bar { background: #eadfce; }
.gallery-upload-progress progress::-webkit-progress-value { background: linear-gradient(90deg, var(--gold), var(--red)); }
.gallery-upload-progress progress::-moz-progress-bar { background: linear-gradient(90deg, var(--gold), var(--red)); }

.gallery-upload-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 14px;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 13px;
    line-height: 1.4;
}

.gallery-upload-warning[hidden] {
    display: none !important;
}

.gallery-upload-warning svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    color: #ea580c;
}

.gallery-upload-feedback {
    margin-top: 14px;
    padding: 11px 13px;
    border-radius: 8px;
    background: #f2eee8;
    color: #574a3e;
    font-size: 13px;
    font-weight: 700;
}

.gallery-upload-feedback[data-type="error"] { background: #fff0ee; color: #9c332d; }
.gallery-upload-feedback[data-type="success"] { background: #eaf7ef; color: #286348; }
.gallery-contribution-submit { width: 100%; margin-top: 18px; }
.gallery-contribution-submit:disabled { border-color: #cfc6bb; background: #cfc6bb; cursor: not-allowed; }
.gallery-contribution-consent { margin: 8px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

.gallery-history-list { max-height: 628px; overflow: auto; }
.gallery-history-item { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 13px; padding: 15px 18px; border-bottom: 1px solid #eee3d3; }
.gallery-history-item:last-child { border-bottom: 0; }
.gallery-history-item img { width: 82px; height: 74px; border-radius: 8px; object-fit: cover; background: #eee7dc; }
.gallery-history-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.gallery-history-title-row strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.gallery-history-item p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.gallery-history-item small { display: block; margin-top: 5px; color: #9a3d35; line-height: 1.35; }

.gallery-status {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.2;
    text-transform: uppercase;
}

.gallery-status-pending { background: #fff1cf; color: #845e12; }
.gallery-status-approved { background: #e5f5eb; color: #266046; }
.gallery-status-rejected { background: #fde8e5; color: #983832; }
.gallery-history-empty,
.gallery-review-empty { padding: 42px 24px; color: var(--muted); text-align: center; }
.gallery-history-empty strong,
.gallery-review-empty strong { display: block; color: var(--ink); font-size: 16px; }
.gallery-history-empty p,
.gallery-review-empty p { margin: 5px auto 0; max-width: 360px; font-size: 13px; }

/* Admin xét duyệt đóng góp ảnh */
.gallery-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.gallery-review-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.gallery-review-image { position: relative; display: block; height: 300px; overflow: hidden; background: #211b18; }
.gallery-review-image > a { display: block; width: 100%; height: 100%; }
.gallery-review-image img,
.gallery-review-image video { width: 100%; height: 100%; object-fit: contain; }
.gallery-review-image span { position: absolute; right: 12px; bottom: 12px; padding: 6px 9px; border-radius: 6px; background: rgba(42, 31, 24, .82); color: #fff; font-size: 11px; font-weight: 800; }
.gallery-review-card-body { padding: 17px; }
.gallery-review-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.gallery-review-meta strong,
.gallery-review-meta span { display: block; }
.gallery-review-meta span,
.gallery-review-meta time,
.gallery-review-original { color: var(--muted); font-size: 11px; }
.gallery-review-original { margin: 9px 0 14px; }
.gallery-review-approve { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gallery-review-approve label,
.gallery-review-reject { font-size: 12px; }
.gallery-review-description,
.gallery-review-approve .btn { grid-column: 1 / -1; }
.gallery-review-reject { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
.gallery-review-reject .btn { white-space: nowrap; }

.gallery-drive-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.gallery-drive-overview > div { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: #fffaf2; }
.gallery-drive-overview span,
.gallery-drive-overview strong { display: block; }
.gallery-drive-overview span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.gallery-drive-overview strong { margin-top: 5px; overflow-wrap: anywhere; }
.gallery-drive-form code { overflow-wrap: anywhere; }
.gallery-drive-disconnect { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
    .gallery-contribution-layout { grid-template-columns: 1fr; }
    .gallery-history-list { max-height: 440px; }
    .gallery-review-grid { grid-template-columns: 1fr; }
    .gallery-drive-overview { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .gallery-contribution-heading { align-items: flex-start; flex-direction: column; }
    .gallery-contribution-login { align-items: stretch; flex-direction: column; padding: 20px; }
    .gallery-contribution-login .btn { text-align: center; }
    .gallery-contribution-form { padding: 16px; }
    .gallery-contribution-history > .gallery-contribution-form-head { padding: 18px 16px 14px; }
    .gallery-contribution-form-head { align-items: flex-start; }
    .gallery-contribution-form-head .gallery-ready-state { white-space: normal; text-align: center; }
    .gallery-upload-dropzone { min-height: 160px; padding: 18px 12px; }
    .gallery-upload-dropzone > span:last-child { max-width: 270px; }
    .gallery-contribution-fields { grid-template-columns: 1fr; }
    .gallery-contribution-note { grid-column: auto; }
    .gallery-history-item { grid-template-columns: 66px minmax(0, 1fr); padding: 13px 14px; }
    .gallery-history-item img,
    .gallery-history-item .gallery-media-placeholder.is-compact { width: 66px; height: 64px; }
    .gallery-history-title-row { display: block; }
    .gallery-history-title-row .gallery-status { margin-top: 4px; }
    .gallery-review-image { height: 230px; }
    .gallery-review-meta { display: block; }
    .gallery-review-meta time { display: block; margin-top: 4px; }
    .gallery-review-approve { grid-template-columns: 1fr; }
    .gallery-review-description,
    .gallery-review-approve .btn { grid-column: auto; }
    .gallery-review-reject { grid-template-columns: 1fr; }
}

/* Grouped Batch Contribution Review UX */
.gallery-batch-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gallery-batch-card {
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.gallery-batch-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.gallery-batch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.gallery-batch-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gallery-batch-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8c1d18, #601410);
    color: #ffffff;
    font-size: 17px;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(140, 29, 24, 0.25);
}

.gallery-batch-user strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.gallery-batch-user span {
    display: block;
    font-size: 13px;
    color: #64748b;
}

.gallery-batch-mode-toggle {
    display: inline-flex;
    gap: 4px;
    margin-top: 6px;
    padding: 3px;
    border-radius: 8px;
    background: #f1f5f9;
}

.gallery-batch-mode-toggle .btn-mode {
    padding: 4px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.gallery-batch-mode-toggle .btn-mode.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gallery-batch-select-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.gallery-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.gallery-select-all-label input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.gallery-batch-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 12px;
    margin: 14px 0;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
}

.gallery-batch-thumb-item {
    position: relative;
    width: 100%;
    height: 105px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #0f172a;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.gallery-batch-thumb-item a {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery-batch-thumb-item img,
.gallery-batch-thumb-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-batch-thumb-item:not(.is-selected) {
    opacity: 0.45;
    filter: grayscale(80%);
    border-color: #cbd5e1;
}

.gallery-batch-thumb-item.is-selected {
    border-color: #22c55e;
    box-shadow: 0 0 0 1px #22c55e;
}

.gallery-thumb-checkbox {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 5;
    cursor: pointer;
}

.gallery-thumb-checkbox input {
    display: none;
}

.thumb-checkmark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1.5px solid #ffffff;
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.gallery-thumb-checkbox input:checked + .thumb-checkmark {
    background: #22c55e;
    border-color: #ffffff;
}

.gallery-thumb-quick-reject {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 5;
}

.thumb-reject-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.85);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.gallery-batch-thumb-item:hover .thumb-reject-btn {
    opacity: 1;
}

.thumb-reject-btn:hover {
    transform: scale(1.15);
    background: #dc2626;
}

.gallery-detail-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.gallery-detail-item-row {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 14px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.detail-item-preview img,
.detail-item-preview video {
    width: 100px;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    background: #0f172a;
}

.detail-fields-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.detail-fields-row input {
    flex: 2;
}

.detail-fields-row select {
    flex: 1;
}

.detail-single-reject-form {
    display: flex;
    gap: 10px;
}

.detail-single-reject-form input {
    flex: 1;
}

.gallery-batch-thumb-trigger {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.admin-lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.admin-lightbox-modal[hidden] {
    display: none !important;
}

.admin-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
}

.admin-lightbox-box {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 92vw;
    max-height: 90vh;
}

.admin-lightbox-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 85vw;
    max-height: 75vh;
    min-width: 200px;
    min-height: 200px;
}

.admin-lightbox-stage.is-loading::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fef08a;
    border-radius: 50%;
    animation: admin-lightbox-spin 0.8s linear infinite;
    z-index: 5;
}

@keyframes admin-lightbox-spin {
    to { transform: rotate(360deg); }
}

.admin-lightbox-stage img,
.admin-lightbox-stage video {
    max-width: 85vw;
    max-height: 75vh;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.admin-lightbox-stage.is-loading img {
    opacity: 0.5;
}

.admin-lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.admin-lightbox-close:hover {
    background: rgba(239, 68, 68, 0.9);
}

.admin-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    font-size: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.15s ease, transform 0.15s ease;
    z-index: 25;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.admin-lightbox-prev { left: 8px; }
.admin-lightbox-next { right: 8px; }

@media (min-width: 992px) {
    .admin-lightbox-prev { left: -64px; }
    .admin-lightbox-next { right: -64px; }
}

.admin-lightbox-nav:hover {
    background: rgba(15, 23, 42, 0.95);
    border-color: #ffffff;
    transform: translateY(-50%) scale(1.1);
}

.admin-lightbox-caption {
    margin-top: 14px;
    text-align: center;
    color: #ffffff;
    width: 100%;
}

.admin-lightbox-caption strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #fef08a;
    word-break: break-word;
}

.admin-lightbox-caption span {
    display: block;
    font-size: 12px;
    color: #cbd5e1;
    margin-top: 2px;
}

.admin-lightbox-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

.admin-lightbox-actions-row .btn {
    font-size: 12px;
    padding: 8px 14px;
    white-space: normal;
    text-align: center;
}

.admin-lightbox-actions-row .btn-success.is-checked {
    background: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

.admin-lightbox-actions-row .btn-outline-warning.is-unchecked {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid #f59e0b;
    color: #fbbf24;
}

.gallery-batch-thumb-video {
    position: relative;
    width: 100%;
    height: 100%;
}

.gallery-batch-video-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.gallery-batch-file-size {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
}

.gallery-batch-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.gallery-batch-form-grid .full-width {
    grid-column: 1 / -1;
}

.gallery-batch-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.gallery-batch-buttons .btn {
    padding: 10px 24px;
    font-weight: 700;
    background: #8c1d18;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.gallery-batch-buttons .btn:hover {
    background: #731713;
}

.gallery-batch-reject-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #e2e8f0;
}

.gallery-batch-reject-form input {
    flex: 1;
}

/* Mobile Responsiveness for Batch Contribution Card */
@media (max-width: 768px) {
    .gallery-batch-card {
        padding: 14px;
    }

    .gallery-batch-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .gallery-batch-user {
        width: 100%;
    }

    .gallery-batch-meta {
        text-align: left;
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .auth-register-prompt {
        margin: 14px 0 8px;
        text-align: center;
        font-size: 14px;
        color: var(--muted);
    }

    .auth-register-prompt .auth-register-link {
        color: var(--red);
        font-weight: 800;
        text-decoration: underline;
        text-underline-offset: 3px;
        margin-left: 3px;
        transition: color .18s ease;
    }

    .auth-register-prompt .auth-register-link:hover {
        color: var(--red-dark);
        text-decoration: none;
    }

    .auth-shell .auth-card > p:last-child {
        margin: 8px 0 0;
        text-align: center;
    }

    @media (max-width: 640px) {
        .auth-shell {
            padding: 36px 12px;
        }
    }

    .gallery-batch-mode-toggle {
        width: 100%;
        display: flex;
        margin-top: 6px;
    }

    .gallery-batch-mode-toggle .btn-mode {
        flex: 1;
        text-align: center;
        padding: 6px 8px;
    }

    .gallery-batch-select-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .gallery-batch-thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
        gap: 8px;
        max-height: 250px;
    }

    .gallery-batch-thumb-item {
        height: 85px;
    }

    .gallery-batch-form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .gallery-batch-buttons {
        justify-content: stretch;
    }

    .gallery-batch-buttons .btn {
        width: 100%;
    }

    .gallery-batch-reject-form {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-batch-reject-form .btn {
        width: 100%;
    }

    .gallery-detail-item-row {
        grid-template-columns: 80px minmax(0, 1fr);
        gap: 10px;
    }

    .detail-item-preview img,
    .detail-item-preview video {
        width: 80px;
        height: 68px;
    }

    .detail-fields-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Redesigned Gallery Contribution Toggle Button in Hero */
.page-hero-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
}
.page-hero-content {
    flex: 1;
}
@keyframes gold-glow-pulse {
    0% {
        box-shadow: 0 0 8px rgba(247, 208, 138, 0.4), 0 4px 15px rgba(247, 208, 138, 0.25);
    }
    50% {
        box-shadow: 0 0 20px rgba(247, 208, 138, 0.85), 0 6px 25px rgba(247, 208, 138, 0.45);
    }
    100% {
        box-shadow: 0 0 8px rgba(247, 208, 138, 0.4), 0 4px 15px rgba(247, 208, 138, 0.25);
    }
}

.btn-hero-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f7d08a;
    border: 1px solid #f7d08a;
    color: var(--red);
    font-size: 15px;
    font-weight: 700;
    padding: 14px 36px;
    border-radius: 50px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    animation: gold-glow-pulse 2s infinite ease-in-out;
    white-space: nowrap;
    cursor: pointer;
    min-height: 48px;
}
.btn-hero-action:hover {
    background: #fff2ce;
    border-color: #fff2ce;
    color: var(--red);
    transform: translateY(-2px);
    animation-play-state: paused;
    box-shadow: 0 0 25px rgba(247, 208, 138, 0.9), 0 8px 30px rgba(247, 208, 138, 0.5);
}
.btn-hero-action:active {
    transform: translateY(0);
}
.btn-hero-action svg {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
}
.btn-hero-action.is-active {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    animation: none;
    box-shadow: 0 4px 15px rgba(140, 29, 24, 0.25);
}
.btn-hero-action.is-active:hover {
    background: var(--red-dark);
    border-color: var(--red-dark);
    color: #fff;
    transform: translateY(-2px);
}
@media (max-width: 768px) {
    .page-hero-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    .btn-hero-action {
        width: 100%;
        box-sizing: border-box;
        font-size: 14px;
        padding: 10px 24px;
        min-height: 42px;
    }
    .btn-hero-action svg {
        width: 16px;
        height: 16px;
    }
}

/* Modern Heritage Media Card & Contributor Box Redesign */
.media-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.media-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.media-type-overlay-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 6;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    pointer-events: none;
}

.media-card figcaption,
.media-card-caption {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    padding: 14px 16px !important;
    background: #ffffff !important;
}

.media-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-card-contributor-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.media-card-contributor-box .contributor-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.media-card-contributor-box .contributor-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8c1d18, #601410);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 2px 5px rgba(140, 29, 24, 0.25);
    flex-shrink: 0;
    overflow: hidden;
}

.media-card-contributor-box .contributor-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.media-card-contributor-box .contributor-name-text {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-card-contributor-box .contributor-role-tag {
    font-size: 11px;
    font-weight: 600;
    color: #8c1d18;
    background: #fdf2f2;
    padding: 2px 9px;
    border-radius: 12px;
    border: 1px solid #fecaca;
    flex-shrink: 0;
}

/* Custom Web Modal Confirmation Dialog System */
.custom-web-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.custom-web-modal[hidden] {
    display: none !important;
}

.custom-web-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
}

.custom-web-modal-box {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 440px;
    padding: 28px 24px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
    border: 1px solid #f1f5f9;
    animation: customModalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes customModalPop {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.custom-web-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.custom-web-modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
}

.custom-web-modal-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
    font-size: 26px;
    margin-bottom: 14px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.custom-web-modal-title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.custom-web-modal-msg {
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
    margin: 0 0 22px 0;
}

.custom-web-modal-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.custom-web-modal-actions .btn {
    flex: 1;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 10px;
}

/* Keep every admin grid track inside the viewport; wide tables/tabs scroll in
   their own wrappers instead of widening the entire page on mobile. */
body.admin-body .admin-main,
body.admin-body .admin-page-content {
    grid-template-columns: minmax(0, 1fr);
}

body.admin-body .admin-page-content > * {
    min-width: 0;
    max-width: 100%;
}

/* Shared flash notifications: compact, non-blocking toasts in the screen corner. */
.flash-toast-stack {
    position: fixed;
    right: max(18px, env(safe-area-inset-right, 0px));
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
    z-index: 200000;
    width: min(500px, calc(100vw - 36px));
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.flash-toast {
    --flash-accent: #2563eb;
    --flash-icon-bg: #eff6ff;
    position: relative;
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 30px;
    align-items: center;
    gap: 12px;
    padding: 16px 14px 16px 16px;
    border: 1px solid rgba(15, 23, 42, .08);
    border-left: 5px solid var(--flash-accent);
    border-radius: 12px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 16px 38px rgba(15, 23, 42, .18), 0 3px 10px rgba(15, 23, 42, .08);
    box-sizing: border-box;
    opacity: 0;
    transform: translate3d(24px, 12px, 0) scale(.98);
    transition: opacity .25s ease, transform .25s cubic-bezier(.16, 1, .3, 1);
    pointer-events: auto;
}

.flash-toast.is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.flash-toast.is-leaving {
    opacity: 0;
    transform: translate3d(calc(100% + 30px), 0, 0) scale(.98);
}

.flash-toast-success {
    --flash-accent: #10b981;
    --flash-icon-bg: #ecfdf5;
}

.flash-toast-danger,
.flash-toast-error {
    --flash-accent: #ef4444;
    --flash-icon-bg: #fef2f2;
}

.flash-toast-warning {
    --flash-accent: #f59e0b;
    --flash-icon-bg: #fffbeb;
}

.flash-toast-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--flash-accent);
    background: var(--flash-icon-bg);
}

.flash-toast-icon svg {
    width: 22px;
    height: 22px;
}

.flash-toast-content {
    min-width: 0;
}

.flash-toast-content strong {
    display: block;
    margin: 0 0 4px;
    color: #1e293b;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
}

.flash-toast-content p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.flash-toast-close {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #94a3b8;
    background: transparent;
    font: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.flash-toast-close:hover,
.flash-toast-close:focus-visible {
    color: #334155;
    background: #f1f5f9;
    outline: none;
}

@media (max-width: 620px) {
    .flash-toast-stack {
        left: 12px;
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
        width: auto;
    }

    .flash-toast {
        grid-template-columns: 38px minmax(0, 1fr) 28px;
        gap: 10px;
        padding: 13px 10px 13px 13px;
    }

    .flash-toast-icon {
        width: 38px;
        height: 38px;
    }

    .flash-toast-content strong {
        font-size: 15px;
    }

    .flash-toast-content p {
        font-size: 13px;
    }
}
