:root {
    --primary: #7a3e3e;
    --primary-deep: #5f2f2f;
    --accent: #e8d7c7;
    --surface: rgba(255, 250, 246, 0.92);
    --surface-strong: #fffdfb;
    --text: #241c1b;
    --muted: #685b57;
    --line: rgba(122, 62, 62, 0.18);
    --shadow: 0 24px 60px rgba(48, 25, 25, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(232, 215, 199, 0.95), transparent 34%),
        radial-gradient(circle at bottom right, rgba(122, 62, 62, 0.28), transparent 30%),
        linear-gradient(135deg, #f7efe9 0%, #f3e8df 48%, #efe4db 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(122, 62, 62, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(122, 62, 62, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
    pointer-events: none;
}

.page-shell {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-panel {
    position: relative;
    z-index: 1;
}

.dashboard-shell {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.eyebrow {
    margin: 0 0 0.75rem;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

h2 {
    margin: 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    line-height: 0.95;
}

h2 {
    font-size: clamp(2.2rem, 5vw, 3rem);
}

.card-heading p,
.footnote,
.form-row a,
.checkbox-row,
label {
    font-size: 0.98rem;
    line-height: 1.6;
}

.login-panel {
    width: clamp(320px, 62vw, 840px);
}

.login-card {
    overflow: hidden;
    padding: 0 2rem 2rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 28px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-strong) 100%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.dashboard-card {
    width: min(100%, 1120px);
    overflow: hidden;
    padding: 0 2.2rem 2.2rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 28px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-strong) 100%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.dashboard-top {
    margin: 0 -2.2rem 1.75rem;
    padding: 1.35rem 2.2rem 1rem;
}

.dashboard-contact {
    margin: 0.95rem 0 0;
    color: #f7efe9;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.6;
    text-align: center;
}

.card-top {
    margin: 0 -2rem 0.875rem;
    padding: 1.2rem 2rem 0.9rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
}

.brand-mark {
    display: block;
    width: min(100%, 220px);
    margin: 0 auto;
    filter: brightness(0) invert(1);
}

.card-heading {
    color: var(--text);
    text-align: center;
}

.card-heading p {
    margin: 0.75rem 0 0;
    color: var(--text);
}

.login-form {
    display: grid;
    gap: 0.9rem;
}

.auth-status {
    min-height: 1.5rem;
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.auth-status[data-tone="pending"] {
    color: var(--muted);
}

.auth-status[data-tone="success"] {
    color: #215f3d;
}

.auth-status[data-tone="error"] {
    color: #9a2d2d;
}

label {
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    font: inherit;
    color: var(--text);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(122, 62, 62, 0.12);
    transform: translateY(-1px);
}

.form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0.25rem 0 0.5rem;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 500;
    color: var(--muted);
}

.checkbox-row input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--primary);
}

.form-row a {
    color: var(--primary);
    text-decoration: none;
}

button {
    margin-top: 0.35rem;
    padding: 1rem 1.2rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
    color: #fff;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 18px 28px rgba(122, 62, 62, 0.28);
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 30px rgba(122, 62, 62, 0.35);
    filter: saturate(1.05);
}

button:disabled {
    cursor: wait;
    opacity: 0.8;
    transform: none;
    box-shadow: 0 14px 24px rgba(122, 62, 62, 0.24);
}

.footnote {
    margin: 1.25rem 0 0;
    color: var(--muted);
    text-align: center;
}

.dashboard-summary {
    margin: 0.65rem 0 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
}

.dashboard-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
}

.dashboard-header h1 {
    margin: 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(2.3rem, 4vw, 3.4rem);
    line-height: 0.95;
}

.dashboard-menu {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.1rem;
    margin: 1.8rem 0 0;
}

.dashboard-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 184px;
    padding: 1.35rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.76);
    color: #f8f2ec;
    text-align: center;
    box-shadow: 0 16px 26px rgba(122, 62, 62, 0.08);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.dashboard-tile[href] {
    text-decoration: none;
}

.dashboard-tile[role="link"] {
    cursor: pointer;
}

.dashboard-tile[role="link"]:focus-visible,
.dashboard-tile[href]:focus-visible {
    outline: 3px solid rgba(139, 115, 85, 0.5);
    outline-offset: 4px;
}

.dashboard-tile:hover {
    transform: translateY(-4px);
    border-color: rgba(122, 62, 62, 0.32);
    box-shadow: 0 22px 32px rgba(122, 62, 62, 0.14);
}

.dashboard-tile h2 {
    margin: 0;
    color: inherit;
    font-size: clamp(1.3rem, 2vw, 1.7rem);
    line-height: 1.05;
}

.dashboard-tile p {
    margin: 0.85rem 0 0;
    color: inherit;
    font-size: 1rem;
    line-height: 1.6;
}

.dashboard-tile--metric p {
    font-size: clamp(1.55rem, 2.6vw, 2.1rem);
    font-weight: 700;
    line-height: 1.05;
}

.dashboard-tile--action {
    background: linear-gradient(180deg, rgba(255, 248, 242, 0.88) 0%, rgba(255, 255, 255, 0.92) 100%);
}

.dashboard-tile--accounts {
    background: #1B3A5C;
}

.dashboard-tile--closed-cases {
    background: #4A5D73;
}

.dashboard-tile--pre-arrangements-active {
    background: #8B7355;
}

.dashboard-tile--pending-closure {
    background: #8B7355;
}

.dashboard-tile--first-call {
    background: #7A3E3E;
}

.dashboard-tile--pre-arrangements-create {
    background: #A89A84;
    color: #221b17;
}

.dashboard-tile--search {
    background: #6E7A88;
}

.dashboard-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 1.8rem;
}

.firstcall-content {
    padding: 0 0 2rem;
}

.search-content {
    padding: 0 0 2rem;
}

.accounts-content {
    padding: 0 0 2rem;
}

/* Space adjacent action buttons on the Active Accounts screen */
.accounts-actions button + button {
    margin-left: 0.75rem;
}

/* Status checkbox group on firstcall page */
.firstcall-status-group {
    display: inline-flex;
    gap: 0.75rem;
    align-items: center;
    border: 0;
    padding: 0;
    margin-left: 0.75rem;
}

.firstcall-status-group .checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    color: var(--muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.search-form {
    margin-top: 1.5rem;
}

.search-type-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9rem;
    margin: 0;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(139, 115, 85, 0.2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.74);
}

.search-type-group legend {
    padding: 0 0.35rem;
    color: var(--primary-deep);
    font-weight: 700;
}

.search-type-option {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-right: 0.75rem;
    color: var(--primary-deep);
    font-weight: 600;
}

.search-type-option input {
    width: 1rem;
    height: 1rem;
    margin: 0;
}

.search-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.search-field {
    display: grid;
    gap: 0.4rem;
}

.search-actions {
    display: flex;
    gap: 0.9rem;
    margin-top: 1.25rem;
}

.search-action-button {
    min-width: 9rem;
    margin-top: 0;
    background: #6E7A88;
    box-shadow: 0 18px 28px rgba(110, 122, 136, 0.24);
}

.search-action-button:hover {
    box-shadow: 0 20px 30px rgba(110, 122, 136, 0.32);
}

.search-action-button:disabled {
    box-shadow: 0 14px 24px rgba(110, 122, 136, 0.2);
}

.search-results-wrap {
    margin-top: 1rem;
}

.search-results-table {
    min-width: 760px;
}

.search-results-selector {
    width: 4.25rem;
    text-align: center;
}

.search-results-selector input {
    width: 1rem;
    height: 1rem;
    margin: 0;
}

.search-select-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

.search-select-button {
    min-width: 9rem;
    margin-top: 0;
    background: #1B3A5C;
    box-shadow: 0 18px 28px rgba(27, 58, 92, 0.24);
}

.search-select-button:hover {
    box-shadow: 0 20px 30px rgba(27, 58, 92, 0.32);
}

.search-select-button:disabled {
    box-shadow: 0 14px 24px rgba(27, 58, 92, 0.2);
}

.accounts-subtitle {
    margin: 0.8rem 0 0;
    color: #b9b1a7;
    font-size: 1rem;
    font-style: italic;
    text-align: left;
}

.accounts-status {
    min-height: 1.5rem;
    margin: 0.6rem 0 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.accounts-status[data-tone="pending"] {
    color: var(--muted);
}

.accounts-status[data-tone="success"] {
    color: #215f3d;
}

.accounts-status[data-tone="error"] {
    color: #9a2d2d;
}

.accounts-table-wrap {
    margin-top: 1.5rem;
    overflow-x: auto;
    border: 1px solid rgba(139, 115, 85, 0.2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.accounts-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.accounts-table thead {
    background: linear-gradient(135deg, rgba(27, 58, 92, 0.96) 0%, rgba(74, 93, 115, 0.96) 100%);
}

.accounts-table th,
.accounts-table td {
    padding: 0.95rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(139, 115, 85, 0.14);
}

.accounts-table th {
    color: #fffaf4;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.accounts-table tbody tr:nth-child(even) {
    background: rgba(248, 242, 236, 0.7);
}

.accounts-table tbody tr:hover {
    background: rgba(168, 154, 132, 0.12);
}

.accounts-empty {
    color: #6c6258;
    font-style: italic;
    text-align: center;
}

.accounts-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

.firstcall-divider {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.6rem 1.25rem;
    border-radius: 0;
    background: #8B7355;
    color: #fffaf4;
    text-align: center;
}

.firstcall-divider span {
    display: block;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(1.15rem, 1.9vw, 1.5rem);
    font-weight: 600;
    letter-spacing: 0.03em;
}

.firstcall-subtitle {
    margin: 0.8rem 0 0;
    color: #b9b1a7;
    font-size: 1rem;
    font-style: italic;
    text-align: left;
}

.firstcall-accordion {
    display: grid;
    gap: 0.9rem;
    margin-top: 1.5rem;
}

.firstcall-save-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 0.75rem;
}

.firstcall-save-actions-primary {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.firstcall-save-status {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.firstcall-save-status[data-tone="success"] {
    color: #215f3d;
}

.firstcall-save-status[data-tone="error"] {
    color: #9a2d2d;
}

.firstcall-save-button {
    min-width: 9rem;
    margin-top: 0;
    background: #1B3A5C;
    color: #fff;
    box-shadow: 0 18px 28px rgba(27, 58, 92, 0.24);
}

.firstcall-save-button:hover {
    box-shadow: 0 20px 30px rgba(27, 58, 92, 0.32);
}

.firstcall-save-button:disabled {
    box-shadow: 0 14px 24px rgba(27, 58, 92, 0.2);
}

.firstcall-convert-button {
    background: #7A3E3E;
    margin-right: auto;
    box-shadow: 0 18px 28px rgba(122, 62, 62, 0.24);
}

.firstcall-convert-button:hover {
    box-shadow: 0 20px 30px rgba(122, 62, 62, 0.32);
}

.firstcall-convert-button:disabled {
    box-shadow: 0 14px 24px rgba(122, 62, 62, 0.2);
}

.firstcall-return-button {
    min-width: 11rem;
    background: #f4ede4;
    color: #1B3A5C;
    box-shadow: none;
    border: 1px solid rgba(27, 58, 92, 0.2);
}

.firstcall-return-button:hover {
    box-shadow: none;
    background: #ede2d3;
}

body[data-page-title="First Call"] .firstcall-return-button {
    background: #6E7A88;
    color: #fff;
    border-color: rgba(110, 122, 136, 0.28);
}

body[data-page-title="First Call"] .firstcall-return-button:hover {
    background: #63707d;
}

body[data-page-title="First Call"] .firstcall-report-library-button {
    background: #6E7A88;
    color: #fff;
    border-color: rgba(110, 122, 136, 0.28);
}

body[data-page-title="First Call"] .firstcall-report-library-button:hover {
    background: #63707d;
}

.firstcall-accordion-item {
    display: grid;
    gap: 0;
}

.firstcall-accordion-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 0.6rem 1.25rem;
    border: 0;
    border-radius: 0;
    background: #8B7355;
    color: #fffaf4;
    font: inherit;
    font-weight: 700;
    text-align: left;
    box-shadow: none;
}

.firstcall-accordion-trigger::after {
    content: "+";
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1;
}

.firstcall-accordion-trigger[aria-expanded="true"]::after {
    content: "-";
}

.firstcall-accordion-trigger span {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(1.08rem, 1.75vw, 1.35rem);
    letter-spacing: 0.02em;
}

.firstcall-accordion-trigger:hover,
.firstcall-accordion-trigger:focus-visible {
    filter: brightness(1.04);
    transform: none;
    box-shadow: none;
}

.firstcall-accordion-trigger:focus-visible {
    outline: 3px solid rgba(139, 115, 85, 0.28);
    outline-offset: 3px;
}

.firstcall-accordion-panel {
    overflow: hidden;
    border: 1px solid rgba(139, 115, 85, 0.28);
    border-top: 0;
    background: rgba(255, 255, 255, 0.78);
}

.firstcall-accordion-panel[hidden] {
    display: none;
}

.firstcall-accordion-panel.is-open {
    animation: firstcall-accordion-open 220ms ease;
}

.firstcall-accordion-body {
    min-height: 3.5rem;
    padding: 1.15rem 1.5rem;
}

.firstcall-form-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.firstcall-form-table tbody {
    display: grid;
    gap: 0.9rem;
}

.firstcall-form-table tr {
    display: grid;
    gap: 0.9rem;
}

.firstcall-form-table tr.military-service-row {
    gap: 1.6rem;
}

.decedent-form-table tr:nth-child(1) {
    grid-template-columns: minmax(0, 1fr);
}

.decedent-form-table tr:nth-child(2) {
    grid-template-columns: repeat(4, max-content);
}

.decedent-form-table tr:nth-child(3) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.decedent-form-table tr:nth-child(4) {
    grid-template-columns: minmax(0, 1fr);
}

.decedent-form-table tr:nth-child(5) {
    grid-template-columns: minmax(0, 1.45fr) max-content max-content;
}

.decedent-form-table tr:nth-child(6) {
    grid-template-columns: minmax(0, 1fr);
}

.vital-form-table tr:nth-child(1) {
    grid-template-columns: minmax(0, 1fr);
}

.vital-form-table tr:nth-child(2),
.vital-form-table tr:nth-child(3) {
    grid-template-columns: minmax(0, 1.45fr) max-content max-content minmax(0, 1.25fr);
}

.vital-form-table tr:nth-child(4) {
    grid-template-columns: max-content minmax(0, 1fr);
}

.vital-form-table tr:nth-child(5) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vital-form-table tr:nth-child(6) {
    grid-template-columns: max-content minmax(0, 1fr);
}

.vital-form-table tr:nth-child(7) {
    grid-template-columns: minmax(0, 1fr) max-content;
}

.vital-form-table tr:nth-child(8) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vital-form-table tr:nth-child(9) {
    grid-template-columns: repeat(3, max-content);
}

.vital-form-table tr:nth-child(10),
.vital-form-table tr:nth-child(11),
.vital-form-table tr:nth-child(13) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.vital-form-table tr:nth-child(12) {
    grid-template-columns: minmax(0, 1.45fr) max-content max-content minmax(0, 1.25fr);
}

.biographical-form-table tr:nth-child(1) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.biographical-form-table tr:nth-child(2) {
    grid-template-columns: minmax(0, 1fr);
}

.relatives-form-table tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-details-form-table tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.final-disposition-form-table tr:nth-child(1) {
    grid-template-columns: repeat(3, max-content);
}

.final-disposition-form-table tr:nth-child(2) {
    grid-template-columns: max-content max-content;
}

.final-disposition-form-table tr:nth-child(3) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.final-disposition-form-table tr:nth-child(4),
.final-disposition-form-table tr:nth-child(9) {
    grid-template-columns: max-content max-content max-content minmax(0, 1fr);
}

.final-disposition-form-table tr:nth-child(5) {
    grid-template-columns: minmax(0, 1fr) max-content max-content minmax(0, 1fr);
}

.final-disposition-form-table tr:nth-child(6) {
    grid-template-columns: minmax(0, 1fr);
}

.final-disposition-form-table tr:nth-child(7) {
    grid-template-columns: minmax(0, 1fr);
}

.miscellaneous-form-table tr:nth-child(1),
.miscellaneous-form-table tr:nth-child(2),
.miscellaneous-form-table tr:nth-child(3) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.miscellaneous-form-table tr:nth-child(4) {
    grid-template-columns: minmax(0, 1fr) max-content max-content max-content;
}

.miscellaneous-form-table tr:nth-child(5) {
    grid-template-columns: minmax(0, 1fr) max-content minmax(0, 1fr);
}

.shipping-form-table tr:nth-child(1),
.shipping-form-table tr:nth-child(2) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shipping-form-table tr:nth-child(3) {
    grid-template-columns: minmax(0, 1fr);
}

.clerical-form-table tr {
    grid-template-columns: minmax(0, 1fr);
}

.memoranda-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
    gap: 1.25rem;
    align-items: start;
}

.memoranda-panel {
    min-width: 0;
}

.memoranda-heading {
    margin: 0 0 0.8rem;
    color: var(--primary-deep);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.45rem;
    line-height: 1;
}

.memoranda-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(122, 62, 62, 0.16);
    border-radius: 18px;
    overflow: hidden;
}

.memoranda-table th,
.memoranda-table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid rgba(122, 62, 62, 0.12);
    text-align: left;
    vertical-align: middle;
}

.memoranda-table thead th {
    background: rgba(122, 62, 62, 0.08);
    color: var(--primary-deep);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.memoranda-table tbody tr:last-child td {
    border-bottom: 0;
}

.memoranda-checkbox-column {
    width: 3.25rem;
}

.memoranda-actions-table td:first-child,
.memoranda-actions-table th:first-child {
    text-align: center;
}

.memoranda-actions-table input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--primary);
}

.memoranda-actions-table label {
    display: inline;
    margin: 0;
    font-weight: 500;
}

.memoranda-documents-table th:nth-child(1) {
    width: 9.5rem;
}

.memoranda-documents-table th:nth-child(2) {
    width: 10rem;
}

.memoranda-documents-table input {
    min-width: 0;
}

.memoranda-date-input {
    font-variant-numeric: tabular-nums;
}

.firstcall-form-table td {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: auto;
    padding-right: 0;
    vertical-align: top;
}

.firstcall-form-table td:last-child {
    padding-right: 0;
}

.firstcall-form-table label {
    flex: 0 0 auto;
    margin-bottom: 0;
    color: var(--primary-deep);
    white-space: nowrap;
}

.firstcall-static-label {
    flex: 0 0 auto;
    color: var(--primary-deep);
    white-space: nowrap;
}

.firstcall-form-table input,
.firstcall-form-table select,
.firstcall-form-table textarea {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.firstcall-form-table textarea {
    min-height: 6rem;
    resize: vertical;
}

.firstcall-form-table .decedent-media-row td {
    align-items: flex-start;
}

.firstcall-form-table .document-upload-field,
.firstcall-form-table .document-preview-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 0;
}

.firstcall-form-table .document-upload-field label,
.firstcall-form-table .document-preview-title {
    margin: 0;
}

.firstcall-form-table .document-upload-input {
    flex: 0 0 auto;
}

.decedent-form-table .decedent-identity-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
    gap: 1.25rem;
    align-items: start;
    width: 100%;
}


.decedent-form-table .decedent-identity-fields {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 0.9rem;
    min-width: 0;
}

.decedent-form-table .decedent-identity-field,
.decedent-form-table .decedent-identity-fields .document-upload-field {
    display: grid;
    gap: 0.45rem;
    grid-column: 1 / -1;
    min-width: 0;
}


.decedent-form-table .decedent-identity-field-half {
    grid-column: 3 / 4;
}

/* Ensure middle and last name inputs fill their containers */
#decedent-middle-name,
#decedent-last-name {
    width: 100%;
    min-width: 0;
}

.decedent-form-table .decedent-identity-field label,
.decedent-form-table .decedent-identity-fields .document-upload-field label {
    white-space: normal;
}

.decedent-form-table .decedent-identity-field input,
.decedent-form-table .decedent-identity-fields .document-upload-input {
    width: 100%;
}

.decedent-form-table .decedent-identity-layout .document-preview-panel {
    align-self: start;
}

.document-upload-help {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.document-preview-title {
    color: var(--primary-deep);
    font-size: 0.92rem;
    font-weight: 700;
}

.document-preview-stage {
    display: grid;
    place-items: center;
    width: 500px;
    height: 375px;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid rgba(122, 62, 62, 0.18);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
}

.document-preview-image,
.document-preview-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.document-preview-image {
    object-fit: contain;
}

.firstcall-form-table .state-abbreviation-input {
    flex: 0 0 4.5rem;
    max-width: 4.5rem;
    text-transform: uppercase;
}

.firstcall-form-table .age-compact-input {
    flex: 0 0 4.75rem;
    max-width: 4.75rem;
}

.firstcall-form-table .date-compact-input {
    flex: 0 0 10.5rem;
    max-width: 10.5rem;
}

.firstcall-form-table .dob-compact-input {
    flex: 0 0 9.5rem;
    max-width: 9.5rem;
}

.firstcall-form-table .time-compact-input {
    flex: 0 0 9.75rem;
    max-width: 9.75rem;
}

.firstcall-form-table .zip-compact-input {
    flex: 0 0 7.5rem;
    max-width: 7.5rem;
}

.firstcall-form-table .final-disposition-county-cell {
    justify-self: stretch;
}

.firstcall-form-table .sex-compact-input {
    flex: 0 0 5.5rem;
    max-width: 5.5rem;
}

.firstcall-form-table .veteran-compact-select {
    flex: 0 0 5.5rem;
    max-width: 5.5rem;
}

.firstcall-form-table .war-compact-select {
    flex: 0 0 12rem;
    max-width: 12rem;
}

.firstcall-form-table .branch-compact-select {
    flex: 0 0 10rem;
    max-width: 10rem;
}

.firstcall-form-table .education-compact-select {
    flex: 0 0 13.5rem;
    max-width: 13.5rem;
}

.firstcall-form-table .ssn-compact-input {
    flex: 0 0 9rem;
    max-width: 9rem;
}

.firstcall-form-table .rank-compact-input {
    flex: 1 1 auto;
    max-width: none;
}

.firstcall-field-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.firstcall-field-group label {
    flex: 0 0 180px;
    margin-bottom: 0;
    white-space: normal;
}

.firstcall-field-group-inputs {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
    min-width: 0;
    width: 100%;
}

@keyframes firstcall-accordion-open {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .page-shell {
        padding: 1.25rem;
    }

    .dashboard-shell {
        padding: 1.25rem;
    }

    .login-panel {
        width: min(100%, 680px);
    }

    .dashboard-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .login-card {
        padding: 0 1.5rem 1.5rem;
        border-radius: 22px;
    }

    .dashboard-card {
        padding: 0 1.5rem 1.5rem;
        border-radius: 22px;
    }

    .card-top {
        margin: 0 -1.5rem 1.5rem;
        padding: 1rem 1.5rem 0.8rem;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-header button {
        width: 100%;
    }

    .dashboard-contact {
        font-size: 0.86rem;
    }

    .dashboard-menu {
        grid-template-columns: 1fr;
    }

    .dashboard-tile {
        min-height: 0;
    }

    .search-type-group {
        display: grid;
        gap: 0.75rem;
    }

    .search-form-grid {
        grid-template-columns: 1fr;
    }

    .search-actions,
    .search-select-actions {
        flex-direction: column;
    }

    .search-action-button,
    .search-select-button {
        width: 100%;
    }

    .accounts-table-wrap {
        border-radius: 16px;
    }

    .firstcall-divider span {
        font-size: 1.05rem;
    }

    .firstcall-accordion-trigger {
        padding: 0.55rem 0.9rem;
    }

    .firstcall-accordion-trigger span {
        font-size: 1rem;
    }

    .firstcall-accordion-body {
        padding: 1rem;
    }

    .firstcall-form-table,
    .firstcall-form-table tbody,
    .firstcall-form-table tr,
    .firstcall-form-table td {
        display: block;
        width: 100%;
    }

    .firstcall-form-table {
        border-spacing: 0;
    }

    .firstcall-form-table tbody {
        gap: 0.85rem;
    }

    .firstcall-form-table td {
        display: block;
        padding-right: 0;
        margin-bottom: 0.85rem;
    }

    .firstcall-form-table label {
        display: block;
        margin-bottom: 0.45rem;
        white-space: normal;
    }

    .firstcall-form-table td:last-child {
        margin-bottom: 0;
    }

    .document-preview-stage {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .firstcall-field-group-inputs {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .decedent-form-table .decedent-identity-layout {
        grid-template-columns: 1fr;
    }

    .decedent-form-table .decedent-identity-fields {
        grid-template-columns: 1fr;
    }

    .decedent-form-table .decedent-identity-field-half {
        grid-column: 1 / -1;
    }

    .firstcall-field-group {
        display: block;
    }

    .firstcall-field-group label {
        display: block;
        margin-bottom: 0.45rem;
    }

    .memoranda-layout {
        grid-template-columns: 1fr;
    }

    .memoranda-table {
        display: block;
        overflow-x: auto;
    }
}

.clergy-form-table {
    width: 100%;
    max-width: 700px;
    margin: 2rem auto;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.clergy-form-table td {
    padding: 0.5rem 1rem;
}

.clergy-form-table label {
    font-weight: 600;
    color: var(--primary-deep);
}

.clergy-form-table input {
    width: 100%;
    padding: 0.4rem;
    border-radius: 5px;
    border: 1px solid var(--line);
    font-size: 1rem;
}

.forms-library-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 1rem;
    margin: 2rem auto;
    max-width: 900px;
}
.forms-library-tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-deep);
    cursor: pointer;
    transition: box-shadow 0.2s, background 0.2s;
}
.forms-library-tile:hover, .forms-library-tile:focus {
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--primary);
    outline: none;
}