body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #fff8ed 0%, #f7f2e9 30%, #fffaf3 100%);
    color: #2d2a27;
}

* {
    box-sizing: border-box;
}

header {
    background: linear-gradient(135deg, #234f43 0%, #2d6a55 55%, #438064 100%);
    color: #fffdf9;
    box-shadow: 0 5px 20px rgba(35, 65, 51, 0.18);
}

.family-banner {
    height: 61px;
    background-color: #d7e0c5;
    background-image: url("../images/fambanner.JPG");
    background-repeat: repeat-x;
    background-position: center;
}

.topnav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.brand {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff7df;
}

.navlinks {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.6rem;
}

.navlinks a {
    color: #fefaf3;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.navlinks a:hover {
    background: rgba(255, 245, 210, 0.18);
    transform: translateY(-1px);
}

.navlinks a:focus-visible {
    outline: 2px solid #f5c66a;
    outline-offset: 2px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    color: #2d2a27;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 3vw, 2.8rem);
}

.page-subtitle {
    margin: 0.25rem 0 0;
    color: #695e55;
    font-size: 1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.card {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid #e4d8c4;
    border-radius: 14px;
    padding: 0.9rem 1rem 0.7rem;
    box-shadow: 0 6px 16px rgba(58, 49, 37, 0.06);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 0.35rem;
    color: #3d362f;
    font-size: 1.08rem;
}

.card .value {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0.25rem 0 0;
    color: #4e5b43;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.55rem;
    background: transparent;
    border: none;
    border-radius: 12px;
    overflow: visible;
    box-shadow: none;
}

.table th,
.table td {
    padding: 0.7rem 0.7rem;
    border: 1px solid #e6d9c4;
    text-align: left;
    vertical-align: middle;
    background: rgba(255, 255, 255, 0.7);
}

.table th {
    background: #efe3d1;
    color: #3d362f;
    font-weight: 700;
    border-bottom: 1px solid #d9c7a7;
}

.table tbody tr {
    box-shadow: 0 2px 10px rgba(64, 51, 38, 0.04);
}

.table tbody tr:nth-child(even) td {
    background: rgba(249, 245, 238, 0.9);
}

button, .button {
    --btn-height: 1.8rem;
    --btn-padding-x: 0.7rem;
    --btn-font-size: 0.78rem;

    background: linear-gradient(180deg, #c47a3f 0%, #a85b35 100%);
    color: #fffdf8;
    border: none;
    border-radius: 999px;
    padding: 0.28rem var(--btn-padding-x);
    min-height: var(--btn-height);
    line-height: 1.15;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: var(--btn-font-size);
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 3px 8px rgba(151, 81, 47, 0.18);
}

button:hover, .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(140, 103, 56, 0.22);
    text-decoration: none;
}

button.secondary,
.button.secondary {
    background: linear-gradient(180deg, #809171 0%, #67785d 100%);
    box-shadow: 0 4px 10px rgba(84, 95, 76, 0.18);
}

button.danger,
.button.danger {
    background: linear-gradient(180deg, #d45d4f 0%, #b53d35 100%);
    border: 0;
    box-shadow: 0 4px 10px rgba(146, 58, 50, 0.18);
}

button.danger:hover,
.button.danger:hover {
    box-shadow: 0 6px 14px rgba(146, 58, 50, 0.22);
}

form {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid #e4d8c4;
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: 0 8px 22px rgba(58, 49, 37, 0.05);
}

form.inline-form {
    display: inline-block;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    vertical-align: middle;
}

form.inline-form button,
form.inline-form .button {
    margin: 0;
    vertical-align: middle;
}

.action-row,
.toolbar-row,
.page-header,
.panel-header {
    gap: 0.5rem;
}

.table td.announcement-top-cell,
.table th.announcement-top-cell {
    vertical-align: top !important;
}

.family-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1rem;
}

.family-card-item {
    background: #fffdfb;
    border: 3px solid #c99b65;
    border-left: 8px solid #8c6239;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(62, 49, 36, 0.08);
    overflow: hidden;
}

.family-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0.95rem;
    background: linear-gradient(180deg, #f3e3ce 0%, #eadac0 100%);
    border-bottom: 2px solid #d5b58c;
}

.family-card-title {
    margin: 0;
    color: #2d2a27;
    font-size: 1.35rem;
    font-weight: 700;
}

.family-card-body {
    padding: 1rem 1rem 1.1rem;
}

.family-card-meta {
    margin: 0.2rem 0;
    line-height: 1.35;
    color: #4d453f;
    font-size: 0.9rem;
}

.address-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
}

.address-text {
    flex: 1;
}

.map-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: rgba(112, 134, 95, 0.12);
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.map-pin:hover {
    background: rgba(112, 134, 95, 0.18);
    text-decoration: none;
}

.family-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0;
}

.family-member-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.family-card-table {
    margin-top: 0.75rem;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
}

.family-card-table th,
.family-card-table td {
    padding: 0.4rem 0.5rem;
    border: none;
    background: transparent;
    box-shadow: none;
    vertical-align: middle;
}

.family-card-table thead th {
    background: #efe3d1;
    border-bottom: 1px solid #d9c7a7;
    font-size: 0.8rem;
    text-transform: none;
}

.family-card-table tbody td {
    border-bottom: 1px solid rgba(198, 176, 148, 0.45);
}

.family-card-table tbody tr:last-child td {
    border-bottom: none;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: #3d362f;
}

input, select, textarea {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid #d2c0a6;
    border-radius: 10px;
    background: #fffdf9;
    color: #2d2a27;
    font: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(143, 110, 71, 0.25);
    border-color: #ad7a43;
}

textarea {
    min-height: 160px;
    resize: vertical;
}

h1, h2, h3 {
    color: #2d2a27;
}

h1, h2 {
    font-family: Georgia, "Times New Roman", serif;
}

.small-note {
    color: #675d55;
    font-size: 0.9rem;
}

.announcement-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.25rem !important;
    margin-top: 1rem !important;
}

.announcement-item {
    display: block !important;
    background: #fffdfb !important;
    border: 3px solid #c99b65 !important;
    border-left: 8px solid #8c6239 !important;
    border-radius: 12px !important;
    padding: 0 !important;
    box-shadow: 0 8px 20px rgba(62, 49, 36, 0.08) !important;
    overflow: hidden !important;
    margin: 0 0 1rem 0 !important;
}

.announcement-item + .announcement-item {
    margin-top: 1rem !important;
}

.announcement-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 1rem !important;
    padding: 0.75rem 0.95rem !important;
    background: linear-gradient(180deg, #f3e3ce 0%, #eadac0 100%) !important;
    border-bottom: 2px solid #d5b58c !important;
}

.announcement-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.55rem !important;
    color: #4d453f !important;
    font-size: 0.88rem !important;
}

.announcement-label {
    font-weight: 700 !important;
    color: #3c352f !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    font-size: 0.75rem !important;
}

.announcement-date {
    font-weight: 700 !important;
    color: #2d2a27 !important;
}

.announcement-separator {
    color: #9a8a7a !important;
}

.announcement-author {
    color: #5d5048 !important;
}

.announcement-body {
    padding: 1rem 1rem 1.1rem !important;
    border-top: none !important;
}

.announcement-text {
    white-space: pre-line !important;
    line-height: 1.7 !important;
    color: #2d2a27 !important;
    margin: 0 !important;
    font-size: 1rem !important;
}

.announcement-actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex-shrink: 0 !important;
}

.page-panel {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid #e4d8c4;
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: 0 8px 22px rgba(58, 49, 37, 0.05);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-title {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: #2d2a27;
    font-size: 1.6rem;
}

.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.recipient-table {
    margin-top: 0.5rem;
    border-collapse: collapse;
    border-spacing: 0;
    background: transparent;
}

.recipient-table th,
.recipient-table td {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    vertical-align: middle;
    padding: 0.38rem 0.5rem;
}

.recipient-table thead th {
    background: #efe3d1 !important;
    color: #3d362f;
    font-size: 0.8rem;
    border-bottom: 1px solid #d9c7a7 !important;
}

.recipient-table tbody tr {
    box-shadow: none;
}

.recipient-table tbody td {
    border-bottom: 1px solid rgba(198, 176, 148, 0.45) !important;
}

.recipient-table tbody tr:last-child td {
    border-bottom: none !important;
}

.recipient-table input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.status-message {
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    background: #f7efe8;
    border: 1px solid #e5c9b2;
    border-radius: 12px;
    color: #7a3d21;
    font-weight: 600;
}

.gallery-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.gallery-list-item h3 {
    margin: 0;
}

.gallery-list-item h3 a {
    color: inherit;
    text-decoration: none;
}

.gallery-list-item h3 a:hover {
    text-decoration: underline;
}

.gallery-list-actions,
.gallery-detail-actions,
.gallery-image-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gallery-image-card img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.gallery-image-card {
    width: 100%;
    max-width: 280px;
}

.gallery-image-actions {
    margin-top: 0.5rem;
}

@media (max-width: 720px) {
    .container {
        padding: 1.25rem 0.75rem 2rem;
    }

    .topnav {
        flex-direction: column;
        padding: 0.8rem 1rem 1rem;
    }

    .brand {
        font-size: 1.6rem;
    }

    .navlinks {
        justify-content: center;
        gap: 0.25rem;
    }

    .navlinks a {
        padding: 0.45rem 0.65rem;
    }

    .family-card-header,
    .gallery-list-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .family-card-actions,
    .gallery-list-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .family-card-table {
        display: block;
        width: 100%;
    }

    .family-card-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .family-card-table tbody {
        display: block;
        width: 100%;
    }

    .family-card-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
        width: 100%;
        margin-bottom: 0.75rem;
        border: 1px solid #e6d9c4;
        border-radius: 10px;
        overflow: hidden;
    }

    .family-card-table th,
    .family-card-table td {
        min-width: 0;
        padding: 0.55rem;
        overflow-wrap: anywhere;
    }

    .family-card-table tbody td {
        display: block;
        border-bottom: 1px solid rgba(198, 176, 148, 0.45);
    }

    .family-card-table tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.2rem;
        color: #695e55;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .family-card-table tbody td:last-child {
        grid-column: 1 / -1;
    }

    .family-card-table tbody td:last-child::before {
        display: none;
    }

    .family-card-table tbody td:last-child {
        border-bottom: none;
    }

    .family-card-table .family-member-actions {
        justify-content: flex-start;
    }

    .birthdays-table {
        table-layout: fixed;
        font-size: 0.78rem;
    }

    .birthdays-table th,
    .birthdays-table td {
        padding: 0.45rem 0.3rem;
        overflow-wrap: anywhere;
    }
}
