:root {
    --app-primary: #1565a8;
    --app-primary-dark: #0f4d82;
    --app-primary-light: #e8f1f9;
    --app-accent: #146c43;
    --app-bg: #e8ecf1;
    --app-surface: #ffffff;
    --app-sidebar: #f7f9fc;
    --app-text: #2a3544;
    --app-muted: #6b7c93;
    --app-border: #d4dce6;
    --app-border-light: #e8edf3;
    --app-success: #1d7a4a;
    --app-danger: #c53030;
    --app-warning: #b45309;
    --app-radius: 6px;
    --app-shadow: 0 1px 3px rgba(30, 50, 80, .07);
    --app-shadow-md: 0 4px 14px rgba(30, 50, 80, .09);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--app-text);
    background: var(--app-bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--app-primary); text-decoration: none; }
a:hover { color: var(--app-primary-dark); text-decoration: underline; }


.admin-body { min-height: 100vh; }
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 252px;
    flex-shrink: 0;
    background: var(--app-sidebar);
    border-right: 1px solid var(--app-border);
    display: flex;
    flex-direction: column;
}

.admin-brand {
    padding: 1rem 1.1rem;
    background: var(--app-surface);
}
.admin-brand__logo {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 800 / 500;
    margin: 0;
    object-fit: contain;
    object-position: top center;
}
.admin-brand strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--app-primary-dark);
    letter-spacing: -.01em;
}
.admin-brand span {
    font-size: .74rem;
    color: var(--app-muted);
    margin-top: .2rem;
    display: block;
    line-height: 1.3;
    max-width: 13rem;
}

.admin-nav {
    flex: 1;
    padding: .5rem 0;
    overflow-y: auto;
}

.admin-nav__section {
    margin: .85rem .85rem .35rem;
    padding: 0 .15rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--app-muted);
    line-height: 1.3;
}
.admin-nav__section:first-child {
    margin-top: .35rem;
}

.admin-nav__link {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem 1rem;
    margin: 1px .45rem;
    color: var(--app-text);
    text-decoration: none;
    font-size: .86rem;
    border-radius: var(--app-radius);
    border-left: 3px solid transparent;
    transition: background .12s, color .12s, border-color .12s;
}
.admin-nav__link:hover {
    background: var(--app-primary-light);
    color: var(--app-primary-dark);
    text-decoration: none;
}
.admin-nav__link.is-active {
    background: var(--app-primary-light);
    color: var(--app-primary-dark);
    font-weight: 600;
    border-left-color: var(--app-primary);
}

.admin-nav__icon {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-muted);
}
.admin-nav__link:hover .admin-nav__icon,
.admin-nav__link.is-active .admin-nav__icon { color: var(--app-primary); }

.admin-nav__group {
    margin: 1px .45rem;
}
.admin-nav__group > summary {
    list-style: none;
    cursor: pointer;
}
.admin-nav__group > summary::-webkit-details-marker {
    display: none;
}
.admin-nav__link--parent {
    justify-content: flex-start;
}
.admin-nav__link--parent .admin-nav__label {
    flex: 1;
    min-width: 0;
}
.admin-nav__link .admin-nav__label {
    flex: 1;
    min-width: 0;
}
.admin-nav__caret {
    margin-left: auto;
    font-size: .68rem;
    color: var(--app-muted);
    transition: transform .15s ease;
}
.admin-nav__group[open] .admin-nav__caret {
    transform: rotate(180deg);
}
.admin-nav__sub {
    padding: .15rem 0 .35rem .35rem;
    margin-left: 1.55rem;
    border-left: 2px solid var(--app-border-light);
}
.admin-nav__sublink {
    display: block;
    padding: .38rem .65rem;
    margin: 1px 0;
    border-radius: calc(var(--app-radius) - 2px);
    color: var(--app-text);
    text-decoration: none;
    font-size: .82rem;
    font-weight: 500;
    transition: background .12s, color .12s;
}
.admin-nav__sublink:hover {
    background: var(--app-primary-light);
    color: var(--app-primary-dark);
    text-decoration: none;
}
.admin-nav__sublink.is-active {
    background: var(--app-primary-light);
    color: var(--app-primary-dark);
    font-weight: 700;
}

.admin-icon {
    display: block;
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-nav__icon .admin-icon {
    width: 1.05rem;
    height: 1.05rem;
}

.admin-sidebar__foot {
    border-top: 1px solid var(--app-border-light);
    padding: .45rem 0 .65rem;
    background: var(--app-surface);
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--app-bg);
}

.admin-topbar {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
    padding: .85rem 1.35rem;
    box-shadow: var(--app-shadow);
}
.admin-topbar h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--app-primary-dark);
}

.admin-content {
    padding: 1.15rem 1.35rem 1.75rem;
}


.card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 1.1rem 1.2rem;
    margin-bottom: 1rem;
    box-shadow: var(--app-shadow);
}
.card h2 {
    margin: 0 0 .85rem;
    font-size: .98rem;
    font-weight: 600;
    color: var(--app-primary-dark);
    padding-bottom: .55rem;
    border-bottom: 1px solid var(--app-border-light);
}
.card h3 {
    font-size: .92rem;
    font-weight: 600;
    color: var(--app-text);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (min-width: 901px) {
    .admin-sidebar__head {
        display: block;
        border-bottom: none;
    }

    .admin-sidebar__head .admin-brand {
        border-bottom: 3px solid var(--app-primary);
    }

    .admin-sidebar__close {
        display: none !important;
    }
}


.admin-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    color: var(--app-primary-dark);
    cursor: pointer;
    flex-shrink: 0;
}

.admin-menu-toggle__bars {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 1.15rem;
    height: 1rem;
}

.admin-menu-toggle__bar {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .2s ease, opacity .2s ease, width .2s ease;
}

.admin-menu-toggle.is-active .admin-menu-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.admin-menu-toggle.is-active .admin-menu-toggle__bar:nth-child(2) {
    opacity: 0;
}

.admin-menu-toggle.is-active .admin-menu-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.admin-sidebar__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
    background: var(--app-surface);
    border-bottom: 3px solid var(--app-primary);
}

.admin-sidebar__head .admin-brand {
    flex: 1;
    min-width: 0;
    border-bottom: none;
}

.admin-sidebar__close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin: .85rem .65rem 0 0;
    padding: 0;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: #fff;
    color: var(--app-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.admin-overlay {
    display: none;
}

@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }

    .admin-shell {
        display: block;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .admin-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1040;
        background: rgba(15, 23, 42, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity .22s ease, visibility .22s ease;
    }

    .admin-overlay.is-visible {
        opacity: 1;
        visibility: visible;
    }

    .admin-overlay[hidden] {
        display: block !important;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    body.admin-nav-open { overflow: hidden; }

    .admin-menu-toggle { display: inline-flex; }

    .admin-sidebar__close { display: inline-flex; }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(300px, 92vw);
        height: 100vh;
        height: 100dvh;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform .25s ease;
        border-right: 1px solid var(--app-border);
        border-bottom: none;
        box-shadow: 4px 0 24px rgba(15, 23, 42, 0.18);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        pointer-events: none;
        visibility: hidden;
    }

    .admin-sidebar.is-open {
        transform: translateX(0);
        pointer-events: auto;
        visibility: visible;
    }

    .admin-nav {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: .35rem;
    }

    .admin-sidebar__foot {
        flex-shrink: 0;
        padding-bottom: max(.65rem, env(safe-area-inset-bottom));
    }

    .admin-main {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .admin-topbar {
        display: flex;
        align-items: center;
        gap: .65rem;
        padding: .7rem .85rem;
        padding-top: max(.7rem, env(safe-area-inset-top));
    }

    .admin-topbar h1 {
        font-size: 1rem;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-content {
        padding: .85rem .75rem 1rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .admin-brand span { max-width: none; }

    .admin-platform-footer.platform-footer {
        padding-left: max(.75rem, env(safe-area-inset-left));
        padding-right: max(.75rem, env(safe-area-inset-right));
    }

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

    .form-row-pair {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .55rem;
    }

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

    .toolbar > .btn,
    .toolbar > form,
    .toolbar .search-box {
        width: 100%;
    }

    .search-box {
        flex-direction: column;
        width: 100%;
    }

    .search-box input { min-width: 0; width: 100%; }

    .community-tabs { gap: .35rem; }
    .community-tabs .btn {
        flex: 1 1 calc(50% - .2rem);
        justify-content: center;
        font-size: .78rem;
        padding: .4rem .55rem;
    }

    .comm-filter__tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .comm-filter__tab {
        justify-content: center;
        padding: .5rem .55rem;
        font-size: .78rem;
    }

    .filter-context__clear {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }

    table.data { font-size: .8rem; }
    table.data th,
    table.data td { padding: .45rem .5rem; }

    .table-wrap {
        margin: 0 -.15rem;
        -webkit-overflow-scrolling: touch;
    }

    .table-actions {
        white-space: normal;
        flex-direction: column;
        align-items: stretch;
        min-width: 9rem;
    }

    .table-actions .btn,
    .table-actions form,
    .table-actions .payment-row-form {
        width: 100%;
    }

    .invoice-list-actions__quick {
        flex-direction: column;
    }

    .invoice-list-actions__payment,
    .invoice-list-actions__payment.is-partial,
    .invoice-list-actions__payment.is-paid {
        grid-template-columns: 1fr;
    }

    .invoice-list-actions__payment .payment-method-select {
        display: block;
    }

    .invoice-list-actions__payment .btn {
        width: 100%;
    }

    .invoice-list-actions__payment:not(.is-partial) .payment-partial-input {
        display: none !important;
    }

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

    .payment-row-form select,
    .payment-row-form input,
    .payment-row-form .btn {
        width: 100%;
    }

    .payment-row-form .payment-partial-input,
    .payment-row-form.is-partial .payment-partial-input {
        display: block;
        width: 100%;
    }

    .dash-hero {
        flex-direction: column;
        align-items: stretch;
        padding: .95rem 1rem;
    }

    .dash-hero__actions {
        flex-direction: column;
        width: 100%;
    }

    .dash-hero__actions .btn { width: 100%; }

    .dash-widgets { grid-template-columns: 1fr; }

    .dash-widget { min-height: auto; }

    .dash-list a {
        flex-direction: column;
        align-items: flex-start;
        gap: .2rem;
    }

    .dash-list a span { white-space: normal; }

    .card { padding: .9rem .85rem; }

    .plan-map-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .plan-map-toolbar__left {
        flex-direction: column;
        align-items: stretch;
    }

    .plan-filter-label { flex-wrap: wrap; }

    .block-thumb-grid {
        grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    }

    .plan-map-canvas {
        min-height: 260px;
        height: min(52vh, 520px);
    }

    .svg-plan-viewport {
        height: clamp(260px, 55vh, 480px);
    }

    .svg-plan-base {
        width: auto;
    }

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

    input:not([type="radio"]):not([type="checkbox"]),
    select,
    textarea { font-size: 16px; }

    .login-wrap {
        flex-direction: column;
        justify-content: center;
        padding: 1rem .85rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        gap: 1rem;
    }

    .login-card { width: 100%; max-width: 400px; }

    .login-card__head {
        padding: 1.35rem 1.15rem 1.25rem;
    }

    .login-card__logo,
    .login-card__head .app-logo {
        width: 68px;
        height: 68px;
    }

    .login-card__company {
        font-size: 1.45rem;
    }

    .login-card__head h1 {
        font-size: .82rem;
        letter-spacing: .06em;
    }

    .login-card__body {
        padding: 1.15rem 1.1rem 1.25rem;
    }
}

@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr 1fr; }

    .btn { min-height: 2.5rem; }

    .btn-sm { min-height: 2.15rem; }
}


.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .45rem .9rem;
    border-radius: var(--app-radius);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: .86rem;
    font-weight: 500;
    text-decoration: none;
    line-height: 1.3;
    transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--app-primary);
    color: #fff;
    border-color: var(--app-primary-dark);
}
.btn-primary:hover {
    background: var(--app-primary-dark);
    color: #fff;
}

.btn-secondary {
    background: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}
.btn-secondary:hover {
    background: #f4f7fa;
    border-color: #b8c5d4;
    color: var(--app-text);
}

.btn-danger {
    background: var(--app-danger);
    color: #fff;
    border-color: #9b2222;
}
.btn-danger:hover { background: #9b2222; color: #fff; }

.btn-sm {
    padding: .28rem .55rem;
    font-size: .8rem;
}


.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}
.form-grid > * { min-width: 0; }
.form-grid .full { grid-column: 1 / -1; }

.deceased-photo-preview {
    display: flex;
    align-items: flex-end;
    gap: .75rem;
    margin-top: .55rem;
    flex-wrap: wrap;
}

.deceased-photo-preview img {
    width: 160px;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--app-border, #e2e8f0);
    background: #f8fafc;
}

.deceased-photo-preview a {
    font-size: .85rem;
    font-weight: 600;
    color: var(--app-primary, #146c43);
}

.form-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.form-row-pair {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.form-row-pair > .form-field {
    min-width: 0;
}

input[type="date"],
input[type="datetime-local"],
input[type="time"] {
    min-width: 0;
    max-width: 100%;
    display: block;
}

label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    margin-bottom: .2rem;
    color: var(--app-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

input:not([type="radio"]):not([type="checkbox"]),
select,
textarea {
    width: 100%;
    padding: .45rem .6rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    font: inherit;
    font-size: .9rem;
    color: var(--app-text);
    background: #fff;
    transition: border-color .12s, box-shadow .12s;
}

input[type="radio"],
input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    flex-shrink: 0;
    accent-color: var(--app-primary);
    vertical-align: middle;
}

input:not([type="radio"]):not([type="checkbox"]):focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px rgba(21, 101, 168, .15);
}

input[type="radio"]:focus,
input[type="checkbox"]:focus {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;
    box-shadow: none;
}
textarea { min-height: 84px; resize: vertical; }

.field-hint {
    font-size: .78rem;
    color: var(--app-muted);
    margin: .25rem 0 0;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.help-box {
    background: #f0f5fa;
    border: 1px solid #c5d4e4;
    border-radius: var(--app-radius);
    padding: .9rem 1rem;
    margin-bottom: 1rem;
    font-size: .88rem;
    line-height: 1.5;
    color: #3d4f63;
}
.help-box strong { color: var(--app-primary-dark); }
.help-box ol { margin: .45rem 0 0 1.1rem; padding: 0; }


.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .86rem;
}
table.data th,
table.data td {
    padding: .5rem .65rem;
    border-bottom: 1px solid var(--app-border-light);
    text-align: left;
    vertical-align: middle;
}
table.data th {
    background: #f4f7fa;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--app-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--app-border);
}
table.data tbody tr:hover td { background: #fafbfd; }
table.data tbody tr:last-child td { border-bottom: none; }


.badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 4px;
    font-size: .72rem;
    font-weight: 600;
    border: 1px solid transparent;
}
.status-free { background: #e8f6ee; color: #166534; border-color: #b7e4c7; }
.status-reserved { background: #fef6e7; color: #92400e; border-color: #fcd9a0; }
.status-occupied { background: #fdecec; color: #991b1b; border-color: #f5b5b5; }

.alert {
    padding: .65rem .9rem;
    border-radius: var(--app-radius);
    margin-bottom: 1rem;
    font-size: .88rem;
}
.alert-success { background: #edf7f1; color: #14532d; border: 1px solid #b7e4c7; }
.alert-error { background: #fdf2f2; color: #991b1b; border: 1px solid #f5b5b5; }
.alert-info { background: #eef4fb; color: #1a4f82; border: 1px solid #b8d4ef; }


.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}
.stat-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: .85rem 1rem;
    box-shadow: var(--app-shadow);
}
.stat-card strong {
    display: block;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--app-primary);
    line-height: 1.2;
}
.stat-card span {
    color: var(--app-muted);
    font-size: .8rem;
}


.dash-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.1rem 1.25rem;
    background: linear-gradient(135deg, #f0f5fa 0%, #fff 100%);
    border-left: 4px solid var(--app-primary);
}
.dash-hero h2 { margin: 0 0 .25rem; font-size: 1.15rem; color: var(--app-primary-dark); }
.dash-hero p { margin: 0; font-size: .95rem; color: var(--app-muted); font-weight: 500; }
.dash-hero__actions { display: flex; gap: .5rem; flex-wrap: wrap; }


.dash-search {
    position: relative;
    margin-bottom: 1.15rem;
}
.dash-search__icon {
    position: absolute;
    left: .8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--app-muted);
    pointer-events: none;
}
.dash-search input.dash-search__input {
    width: 100%;
    padding: .7rem 1rem .7rem 2.75rem;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    font-size: .95rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.dash-search__input:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.dash-search__results {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, .18);
    padding: .3rem;
}
.dash-search__group-title {
    padding: .45rem .6rem .25rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--app-muted);
}
.dash-search__item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: .45rem .6rem;
    border-radius: 7px;
    text-decoration: none;
}
.dash-search__item:hover {
    background: #eff6ff;
}
.dash-search__item-label {
    font-size: .88rem;
    font-weight: 600;
    color: var(--app-text);
}
.dash-search__item-sub {
    font-size: .76rem;
    color: var(--app-muted);
}
.dash-search__empty {
    padding: .7rem .8rem;
    font-size: .85rem;
    color: var(--app-muted);
}


.dash-attention {
    margin-bottom: 1.15rem;
    padding: 1rem 1.15rem;
    border-left: 4px solid #f59e0b;
}
.dash-attention__title {
    margin: 0 0 .7rem;
    font-size: 1rem;
    color: var(--app-primary-dark);
}
.dash-attention__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: .6rem;
}
.dash-attention__item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .75rem;
    border: 1px solid var(--app-border);
    border-radius: 9px;
    background: #fff;
    text-decoration: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.dash-attention__item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
}
.dash-attention__count {
    flex: 0 0 auto;
    min-width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .4rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: .95rem;
    color: #fff;
    background: #64748b;
}
.dash-attention__item--danger .dash-attention__count { background: #dc2626; }
.dash-attention__item--warn .dash-attention__count { background: #f59e0b; }
.dash-attention__item--info .dash-attention__count { background: #2563eb; }
.dash-attention__label {
    flex: 1 1 auto;
    font-size: .86rem;
    font-weight: 600;
    color: var(--app-text);
}
.dash-attention__arrow {
    color: var(--app-muted);
    font-size: 1rem;
}


.dash-section { margin-bottom: 1.25rem; }
.dash-section__title {
    margin: 0 0 .6rem;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--app-muted);
    border-bottom: 1px solid var(--app-border);
    padding-bottom: .35rem;
}

.dash-kpi {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
    margin-bottom: 1.15rem;
}
@media (max-width: 900px) { .dash-kpi { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .dash-kpi { grid-template-columns: 1fr; } }

.dash-kpi__item {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: .9rem 1rem;
    text-align: center;
    box-shadow: var(--app-shadow);
}
.dash-kpi__num {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--app-primary);
    line-height: 1.2;
}
.dash-kpi__item--money .dash-kpi__num { font-size: 1.15rem; }
.dash-kpi__lbl { font-size: .78rem; color: var(--app-muted); margin-top: .2rem; display: block; }

.dash-burial-strip {
    padding: .75rem .95rem;
    margin-bottom: 1rem;
}

.dash-burial-strip .comm-filter {
    margin-bottom: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.dash-burial-details--inline {
    margin-top: .65rem;
    padding-top: .65rem;
    border-top: 1px solid var(--app-border-light);
    width: 100%;
}

.dash-burial-details--inline:not([open]) {
    width: 100%;
}

.dash-burial-strip__top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .65rem .85rem;
}

.dash-burial-strip__label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--app-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.dash-burial-strip__items {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    flex: 1;
}

.dash-burial-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .28rem .55rem .28rem .35rem;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: #fafbfc;
    text-decoration: none;
    color: inherit;
    font-size: .84rem;
}

.dash-burial-pill:hover {
    border-color: var(--app-primary);
}

.dash-burial-pill strong {
    font-size: .92rem;
    color: var(--app-primary);
}

.dash-burial-details {
    margin-left: auto;
    width: 100%;
}

.dash-burial-details:not([open]) {
    width: auto;
}

.dash-burial-details summary {
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    color: var(--app-primary);
    list-style: none;
    user-select: none;
}

.dash-burial-details summary::-webkit-details-marker {
    display: none;
}

.dash-burial-details summary::after {
    content: " ▾";
    font-size: .75rem;
}

.dash-burial-details[open] summary::after {
    content: " ▴";
}

.dash-burial-details__empty {
    margin: .55rem 0 0;
    font-size: .82rem;
}

.dash-burial-details__table {
    margin-top: .55rem;
    max-height: 200px;
    overflow: auto;
}

.dash-block-table {
    font-size: .82rem;
}

.dash-block-table th,
.dash-block-table td {
    padding: .35rem .5rem;
}

.dash-block-table th.num,
.dash-block-table td.num {
    text-align: right;
    width: 5.5rem;
    white-space: nowrap;
}

.dash-block-table td a {
    color: inherit;
    text-decoration: none;
}

.dash-block-table td a:hover strong {
    color: var(--app-primary);
}

@media (max-width: 700px) {
    .dash-burial-details {
        width: 100%;
        margin-left: 0;
    }
}

.dash-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.dash-widget {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: 1rem 1.1rem;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .12s;
    margin-bottom: 0;
    min-height: 6.5rem;
}
.dash-widget:hover {
    border-color: var(--app-primary);
    box-shadow: var(--app-shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}
.dash-widget__icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--app-primary-light);
    border-radius: var(--app-radius);
    color: var(--app-primary);
}
.dash-widget__icon .admin-icon {
    width: 1.2rem;
    height: 1.2rem;
    color: var(--app-primary);
}
.dash-widget__body { flex: 1; min-width: 0; }
.dash-widget__title {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--app-muted);
    margin-bottom: .15rem;
}
.dash-widget__value {
    display: block;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--app-primary-dark);
    line-height: 1.2;
}
.dash-widget__value--money { font-size: 1.1rem; }
.dash-widget__value--sm { font-size: 1.05rem; }
.dash-widget__meta {
    display: block;
    font-size: .8rem;
    color: var(--app-muted);
    margin-top: .25rem;
    line-height: 1.35;
}
.dash-widget__tags { margin-top: .4rem; display: flex; flex-wrap: wrap; gap: .25rem; }
.dash-widget__arrow {
    flex-shrink: 0;
    color: var(--app-border);
    font-size: 1.1rem;
    align-self: center;
    transition: color .12s, transform .12s;
}
.dash-widget:hover .dash-widget__arrow { color: var(--app-primary); transform: translateX(2px); }

.dash-recent { margin-bottom: 1rem; }
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li { border-bottom: 1px solid var(--app-border-light); }
.dash-list li:last-child { border-bottom: none; }
.dash-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .55rem 0;
    text-decoration: none;
    color: inherit;
    font-size: .88rem;
}
.dash-list a:hover { color: var(--app-primary); }
.dash-list a span { color: var(--app-muted); font-size: .82rem; white-space: nowrap; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.toolbar .btn.btn-primary { box-shadow: none; }

.search-box { display: flex; gap: .45rem; }
.search-box input { min-width: 200px; }

.table-actions {
    white-space: nowrap;
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    align-items: center;
}
.inline-form { display: inline; margin: 0; }
.text-muted { color: var(--app-muted); font-size: .84rem; }
.input-sm {
    padding: .22rem .4rem;
    font-size: .8rem;
    border-radius: 4px;
    border: 1px solid var(--app-border);
}

.stock-readonly {
    padding: .45rem .65rem;
    background: #f4f7fa;
    border: 1px solid var(--app-border-light);
    border-radius: var(--app-radius);
    font-weight: 600;
    font-size: .9rem;
}
.movement-type-in { color: var(--app-success); font-weight: 600; }
.movement-type-out { color: var(--app-danger); font-weight: 600; }


.login-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(20, 108, 67, 0.14), transparent 55%),
        linear-gradient(165deg, #e9eef4 0%, #dfe7ef 45%, #d5e0ea 100%);
    padding: 1.25rem 1rem 1rem;
    gap: 1.25rem;
}
.login-shell {
    width: 100%;
    display: flex;
    justify-content: center;
}
.login-card {
    background: #fff;
    width: min(420px, 100%);
    border-radius: 16px;
    padding: 0;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7) inset,
        0 18px 48px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(15, 23, 42, 0.08);
    overflow: hidden;
}
.login-card__head {
    background: linear-gradient(165deg, #1a8052 0%, #146c43 48%, #0d5234 100%);
    color: #fff;
    padding: 1.65rem 1.5rem 1.5rem;
    text-align: center;
}
.login-card__brand {
    display: flex;
    justify-content: center;
    margin: 0 auto .75rem;
}
.login-card__logo,
.login-card__head .app-logo {
    width: 76px;
    height: 76px;
    object-fit: contain;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.14);
    padding: .4rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}
.login-card__company {
    margin: 0 0 .35rem;
    font-size: clamp(1.55rem, 4vw, 1.85rem);
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.15;
    color: #fff;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
.login-card__head h1 {
    margin: 0;
    font-size: .92rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .88;
}
.login-card__body {
    padding: 1.35rem 1.45rem 1.5rem;
}
.login-field {
    margin-bottom: .95rem;
}
.login-field label {
    display: block;
    margin-bottom: .35rem;
    font-size: .88rem;
    font-weight: 600;
    color: #334155;
}
.login-field input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d4dce6;
    border-radius: 10px;
    padding: .7rem .85rem;
    font-size: 1rem;
    background: #f8fafc;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.login-field input:focus {
    outline: none;
    background: #fff;
    border-color: rgba(20, 108, 67, 0.55);
    box-shadow: 0 0 0 3px rgba(20, 108, 67, 0.12);
}
.login-field input:disabled {
    opacity: .65;
    cursor: not-allowed;
}
.login-password-wrap {
    display: flex;
    gap: .45rem;
    align-items: stretch;
}
.login-password-wrap input {
    flex: 1;
    min-width: 0;
}
.login-password-toggle {
    flex-shrink: 0;
    border: 1px solid #d4dce6;
    background: #fff;
    color: #475569;
    border-radius: 10px;
    padding: 0 .85rem;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
}
.login-password-toggle:hover:not(:disabled) {
    border-color: #94a3b8;
    color: #1e293b;
}
.login-password-toggle:disabled {
    opacity: .55;
    cursor: not-allowed;
}
.login-submit {
    width: 100%;
    margin-top: .25rem;
    min-height: 2.75rem;
    border-radius: 10px;
    font-weight: 650;
    background: linear-gradient(165deg, #1a8052 0%, #146c43 55%, #0d5234 100%);
    border: none;
}
.login-submit:hover:not(:disabled) {
    filter: brightness(1.05);
}
.login-submit:disabled {
    opacity: .55;
    cursor: not-allowed;
}
.login-back {
    display: block;
    margin-top: 1rem;
    text-align: center;
    font-size: .86rem;
    color: #64748b;
    text-decoration: none;
}
.login-back:hover {
    color: #146c43;
}


.public-body { margin: 0; font-family: inherit; background: var(--app-bg); color: var(--app-text); }
.public-header { background: var(--app-primary); color: #fff; padding: 2rem 1rem; text-align: center; }
.public-header h1 { margin: 0 0 .35rem; }
.public-header p { margin: 0; opacity: .9; }
.public-wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.search-hero { background: #fff; border-radius: var(--app-radius); padding: 1.5rem; box-shadow: var(--app-shadow-md); margin-top: -2rem; border: 1px solid var(--app-border); }
.search-hero input { font-size: 1rem; padding: .75rem .9rem; }
.results-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.results-list li a {
    display: block; padding: .75rem .9rem; border: 1px solid var(--app-border);
    border-radius: var(--app-radius); margin-bottom: .45rem; text-decoration: none; color: inherit; background: #fff;
}
.results-list li a:hover { border-color: var(--app-primary); }
.result-years { color: var(--app-muted); font-size: .88rem; }
.deceased-page { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .deceased-page { grid-template-columns: 1fr; } }
.deceased-card { background: #fff; border-radius: var(--app-radius); padding: 1.25rem; border: 1px solid var(--app-border); }
.deceased-name { font-size: 1.6rem; font-weight: 700; margin: 0 0 .25rem; }
.deceased-years { color: var(--app-muted); font-size: 1rem; margin-bottom: 1rem; }
.deceased-photo { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--app-radius); background: var(--app-border-light); }
.map-box { height: 360px; border-radius: var(--app-radius); overflow: hidden; border: 1px solid var(--app-border); }
.search-instructions { font-size: .92rem; color: var(--app-text); margin: 0 0 .75rem; line-height: 1.5; }
.search-hint { font-size: .84rem; color: var(--app-muted); margin: .45rem 0 0; }
.results-list mark { background: #fef08a; padding: 0 .1em; border-radius: 2px; }
.result-empty { padding: 1rem; color: var(--app-muted); list-style: none; }
.notices-section { margin-top: 1.5rem; }
.notices-section h2 { font-size: 1.05rem; margin-bottom: .85rem; }
.notices-grid { display: grid; gap: .75rem; }
.notice-card { background: #fff; border: 1px solid var(--app-border); border-radius: var(--app-radius); padding: 1rem; }
.notice-card h3 { margin: 0 0 .3rem; font-size: 1rem; }
.notice-meta { color: var(--app-muted); font-size: .86rem; margin: 0 0 .65rem; }
.map-box--tall { height: 420px; }
.map-legend { display: flex; gap: .85rem; flex-wrap: wrap; font-size: .8rem; color: var(--app-muted); margin-bottom: .45rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .25rem; vertical-align: middle; }
.dot-free { background: #22c55e; }
.dot-reserved { background: #eab308; }
.dot-occupied { background: #ef4444; }
.qr-block { display: flex; align-items: center; gap: .65rem; margin-top: .85rem; padding: .65rem; background: #f4f7fa; border-radius: var(--app-radius); font-size: .84rem; color: var(--app-muted); }


.plan-map-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .85rem;
    margin-bottom: .85rem;
    padding: .85rem 1rem;
}
.plan-map-toolbar__left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem 1rem;
}
.plan-upload-form { margin: 0; }
.plan-upload-btn { cursor: pointer; margin: 0; }
.plan-map-meta { font-size: .84rem; color: var(--app-muted); }
.plan-filter-label { font-size: .84rem; color: var(--app-muted); display: flex; align-items: center; gap: .45rem; }
.plan-filter-select { padding: .3rem .45rem; border-radius: var(--app-radius); border: 1px solid var(--app-border); }
.plan-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem 1rem;
    font-size: .84rem;
    color: var(--app-text);
}
.block-thumb-list {
    margin-bottom: .55rem;
    padding: .45rem .6rem;
}
.block-switcher {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: .55rem;
    padding: .55rem .7rem;
}
.block-switcher__label {
    margin: 0;
    font-size: .78rem;
    font-weight: 600;
    color: var(--app-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}
.block-switcher .block-switcher__select {
    width: auto;
    min-width: 220px;
    max-width: 100%;
    padding: .4rem .7rem;
}
.block-thumb-list__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .25rem .65rem;
    margin-bottom: .4rem;
}
.block-search {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.block-search__input {
    width: 220px;
    max-width: 60vw;
    padding: .36rem .65rem;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    font-size: .82rem;
    background: #fff;
}
.block-search__input:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.block-search__empty {
    font-size: .76rem;
    color: var(--app-muted);
}
.block-thumb-group {
    margin-bottom: .7rem;
}
.block-thumb-group:last-child {
    margin-bottom: 0;
}
.block-thumb-group__title {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0 0 .4rem;
    padding-left: .5rem;
    font-size: .8rem;
    font-weight: 700;
    border-left: 3px solid #94a3b8;
}
.block-thumb-group__title--muslim { border-left-color: #16a34a; color: #14532d; }
.block-thumb-group__title--catholic { border-left-color: #111827; color: #111827; }
.block-thumb-group__title--orthodox { border-left-color: #7c3aed; color: #5b21b6; }
.block-thumb-group__count {
    font-size: .68rem;
    font-weight: 600;
    color: var(--app-muted);
    background: #f1f5f9;
    padding: .1rem .45rem;
    border-radius: 999px;
}
.block-thumb-list__title {
    margin: 0;
    font-size: .82rem;
    font-weight: 600;
}
.block-thumb-list__hint {
    margin: 0;
    font-size: .72rem;
}
.block-thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
    gap: .4rem;
    padding: .05rem;
}
.block-thumb {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--app-border);
    border-radius: 5px;
    padding: .2rem;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.block-thumb:hover {
    border-color: #94a3b8;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .06);
}
.block-thumb.is-active {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, .25);
}
.block-thumb__img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 3px;
    overflow: hidden;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.block-thumb__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.block-thumb--no-plan .block-thumb__img {
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
}
.block-thumb__placeholder {
    font-weight: 700;
    font-size: .68rem;
    color: #64748b;
    text-align: center;
    padding: 0 .1rem;
    line-height: 1.1;
    word-break: break-word;
}
.block-thumb__label {
    font-size: .65rem;
    font-weight: 600;
    margin-top: .15rem;
    text-align: center;
    line-height: 1.1;
}
.block-thumb__sub {
    display: none;
}
.block-thumb__sub--noplan {
    display: block;
    font-size: .56rem;
    color: #b45309;
    text-align: center;
    line-height: 1.1;
    margin-top: .1rem;
}
.block-thumb__stats {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1px;
    margin-top: .18rem;
}
.block-thumb__bar {
    display: flex;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    overflow: hidden;
    background: #e2e8f0;
}
.block-thumb__bar-seg {
    height: 100%;
}
.block-thumb__bar-seg--occupied { background: #dc2626; }
.block-thumb__bar-seg--reserved { background: #eab308; }
.block-thumb__bar-seg--free { background: #16a34a; }
.block-thumb__stats-text {
    font-size: .58rem;
    color: var(--app-muted);
    text-align: center;
    line-height: 1.1;
}
.block-thumb__stats--empty {
    font-size: .56rem;
    color: #94a3b8;
    text-align: center;
    margin-top: .18rem;
}
.plan-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
    margin-right: .28rem;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,.12);
}
.plan-dot--free { background: #22c55e; }
.plan-dot--reserved { background: #eab308; }
.plan-dot--occupied { background: #ef4444; }
.plan-map-wrap { padding: 0; overflow: hidden; }
.plan-map-canvas {
    width: 100%;
    height: min(72vh, 900px);
    min-height: 420px;
    background: #dfe4ea;
}
.plan-map-empty { padding: 1.5rem; }
.plan-map-hint { font-size: .86rem; color: var(--app-muted); margin-top: .65rem; }
.plan-place-banner { margin-bottom: .85rem; display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.plan-map-popup { font-size: .88rem; line-height: 1.45; }
.plan-map-popup a { font-weight: 600; }
.community-tabs { flex-wrap: wrap; gap: .45rem; margin-bottom: .85rem; }


.comm-filter {
    padding: .75rem .95rem;
    margin-bottom: 1rem;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
}

.comm-filter__head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .35rem .75rem;
    margin-bottom: .65rem;
}

.comm-filter__label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--app-muted);
}

.comm-filter__hint {
    font-size: .84rem;
    color: var(--app-muted);
}

.comm-filter__hint strong {
    color: var(--app-text);
    font-weight: 600;
}

.comm-filter__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.comm-filter__tab {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .45rem .75rem;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: #fff;
    color: var(--app-text);
    text-decoration: none;
    font-size: .84rem;
    font-weight: 500;
    line-height: 1.2;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.comm-filter__tab:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}

.comm-filter__tab.is-active {
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
}

.comm-filter__tab.is-active.comm-filter__tab--muslim {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.comm-filter__tab.is-active.comm-filter__tab--catholic {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e40af;
}

.comm-filter__tab.is-active.comm-filter__tab--orthodox {
    border-color: #fdba74;
    background: #fff7ed;
    color: #9a3412;
}

.comm-filter__tab.is-active:not(.comm-filter__tab--muslim):not(.comm-filter__tab--catholic):not(.comm-filter__tab--orthodox) {
    border-color: var(--app-primary);
    background: var(--app-primary-light);
    color: var(--app-primary-dark);
}

.comm-filter__dot {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.comm-filter__dot--all { background: #94a3b8; }
.comm-filter__dot--muslim { background: #22c55e; }
.comm-filter__dot--catholic { background: #3b82f6; }
.comm-filter__dot--orthodox { background: #f97316; }

.comm-filter__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    padding: .05rem .4rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, .07);
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.35;
}

.comm-filter__tab.is-active .comm-filter__count {
    background: rgba(15, 23, 42, .12);
}

.comm-filter__legend {
    margin: .55rem 0 0;
    font-size: .78rem;
    line-height: 1.45;
    color: #64748b;
}

.filter-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem .75rem;
    padding: .65rem .85rem;
    margin-bottom: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 3px solid var(--app-primary);
    border-radius: var(--app-radius);
}

.filter-context__chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}

.filter-context__chip-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--app-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.filter-context__chip-value {
    font-size: .95rem;
    color: var(--app-text);
}

.filter-context__clear {
    margin-left: auto;
}

.cell-block code,
.cell-parcel code {
    display: inline-block;
    padding: .15rem .45rem;
    border-radius: 4px;
    font-size: .82rem;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cell-block code {
    background: #f1f5f9;
    color: #334155;
}

.cell-parcel code {
    background: #eef2ff;
    color: #3730a3;
}

.cell-registered {
    font-size: .82rem;
    color: var(--app-muted, #64748b);
    white-space: nowrap;
}

.cell-block small {
    display: block;
    margin-top: .15rem;
    font-size: .76rem;
    color: var(--app-muted);
}

.list-load-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .65rem;
    margin: -.35rem 0 1rem;
    padding: .85rem 1rem 1rem;
}

.list-load-more__meta {
    margin: 0;
    font-size: .84rem;
    color: var(--app-muted);
}

.list-load-more[hidden] {
    display: none !important;
}

.list-table-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
    padding-bottom: 1rem;
    margin-bottom: 1.15rem;
    border-bottom: 1px solid var(--app-border-light);
}

.list-table-head h2 {
    margin: 0;
}

.list-table-head .search-box {
    width: 100%;
    max-width: none;
    margin: 0;
}

.list-table-head + table.data {
    margin-top: .15rem;
}

.list-table-head + table.data thead th {
    border-top: none;
}

@media (min-width: 701px) {
    .list-table-head--inline {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .list-table-head--inline .search-box {
        flex: 1 1 240px;
        max-width: 440px;
        width: auto;
    }
}

@media (max-width: 700px) {
    .list-table-head {
        gap: .65rem;
        padding-bottom: .85rem;
        margin-bottom: 1rem;
    }
}

.community-pick {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: .35rem;
}

.community-pick__opt {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    padding: .5rem .85rem;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: #fff;
    user-select: none;
    line-height: 1.2;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.community-pick__opt:hover {
    border-color: #cbd5e1;
}

.community-pick__opt input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.community-pick__opt:has(input:checked) {
    border-color: var(--app-primary);
    background: var(--app-primary-light);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}

.community-pick__opt .badge {
    margin: 0;
    pointer-events: none;
}
.gender-pick__label {
    font-size: .84rem;
    font-weight: 600;
    color: var(--app-text);
}
.gender-pick__label--male {
    color: #1e40af;
}
.gender-pick__label--female {
    color: #9d174d;
}

@media (max-width: 900px) {
    .community-pick {
        flex-direction: column;
        gap: .45rem;
    }

    .community-pick__opt {
        width: 100%;
        padding: .65rem .75rem;
    }
}
.badge.comm-muslim { background: #e8f6ee; color: #166534; border-color: #b7e4c7; }
.badge.comm-catholic { background: #eef4fb; color: #1e40af; border-color: #b8d4ef; }
.badge.comm-orthodox { background: #fff4eb; color: #9a3412; border-color: #fcd9a0; }
.plan-map-tooltip {
    background: rgba(42, 53, 68, .92);
    border: none;
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
}
.leaflet-container.plan-map-canvas { font-family: inherit; }


.cemetery-map-layout {
    position: relative;
}
.plan-map-block-badge,
.plan-map-block-badge:link,
.plan-map-block-badge:visited {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    padding: .4rem .9rem .4rem .6rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #14532d, #16a34a);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(22, 163, 74, .28);
    transition: transform .12s ease, box-shadow .12s ease;
}
.plan-map-block-badge:hover,
.plan-map-block-badge:focus,
.plan-map-block-badge:active {
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(22, 163, 74, .38);
}
.plan-map-block-badge:hover .plan-map-block-badge__code,
.plan-map-block-badge:hover .plan-map-block-badge__label,
.plan-map-block-badge:hover .plan-map-block-badge__back,
.plan-map-block-badge:hover .plan-map-block-badge__community {
    color: #fff;
}
.plan-map-block-badge--catholic,
.plan-map-block-badge--catholic:link,
.plan-map-block-badge--catholic:visited {
    background: linear-gradient(135deg, #111827, #1f2937);
    box-shadow: 0 6px 18px rgba(17, 24, 39, .3);
}
.plan-map-block-badge--orthodox,
.plan-map-block-badge--orthodox:link,
.plan-map-block-badge--orthodox:visited {
    background: linear-gradient(135deg, #5b21b6, #7c3aed);
    box-shadow: 0 6px 18px rgba(124, 58, 237, .28);
}
.plan-map-block-badge__back {
    font-size: 1.35rem;
    line-height: 1;
    opacity: .85;
}
.plan-map-block-badge__info {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.plan-map-block-badge__label {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .8;
}
.plan-map-block-badge__code {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: .01em;
}
.plan-map-block-badge__community {
    padding: .2rem .55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    font-size: .74rem;
    font-weight: 600;
}
.cemetery-map-layout .plan-map-toolbar,
.cemetery-map-layout .block-thumb-list,
.cemetery-map-layout .svg-plan-bind,
.cemetery-map-layout .svg-plan-upload {
    margin-bottom: .55rem;
}
.cemetery-map-layout .card {
    margin-bottom: .55rem;
}
.cemetery-map-layout .plan-map-wrap {
    margin-bottom: 0;
}
.cemetery-map-layout .svg-plan-bind {
    padding: .65rem .85rem;
}
.cemetery-map-layout .svg-plan-bind h2 {
    margin-bottom: .5rem;
}
.svg-plan-wrap { padding: 0; overflow: hidden; }
.svg-plan-map { width: 100%; }
.svg-plan-viewport {
    position: relative;
    width: 100%;
    height: clamp(280px, 48vh, 460px);
    overflow: hidden;
    background: #1e293b;
    cursor: grab;
    touch-action: none;
}
.svg-plan-stage {
    transform-origin: 0 0;
    position: relative;
    z-index: 1;
    display: block;
    line-height: 0;
    width: max-content;
}
.svg-plan-stage .svg-plan-leaflet {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    will-change: transform;
}
.svg-plan-viewport.is-map-align-mode {
    cursor: move;
}
.svg-plan-viewport.is-map-align-mode .svg-plan-base {
    opacity: 0.62;
}
.svg-plan-viewport.is-map-align-mode .svg-plan-overlay {
    opacity: 0.35;
    pointer-events: none;
}
.svg-plan-tools__btn--save {
    background: #166534;
    color: #fff;
}
.svg-plan-tools__btn--save:hover {
    background: #15803d;
    color: #fff;
}
.svg-plan-leaflet.leaflet-container,
.svg-plan-leaflet .leaflet-container {
    width: 100%;
    height: 100%;
    background: #1e293b;
    font-family: inherit;
}
.cemetery-map-layout .svg-plan-viewport {
    height: clamp(340px, 62vh, 680px);
}


.cemetery-map-layout.is-map-expanded .plan-map-toolbar,
.cemetery-map-layout.is-map-expanded .svg-plan-bind,
.cemetery-map-layout.is-map-expanded .block-thumb-list {
    display: none;
}
.cemetery-map-layout.is-map-expanded .svg-plan-viewport {
    height: min(78vh, calc(100dvh - 7.5rem));
    max-height: none;
}
.svg-plan-tools__btn.is-active {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1d4ed8;
}
.svg-plan-tools {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--app-border);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}
.svg-plan-tools__btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    background: #fff;
    color: var(--app-primary-dark);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.plan-tool-icon {
    width: 1.12rem;
    height: 1.12rem;
    flex-shrink: 0;
    display: block;
}
.plan-hint-icon {
    width: 1.12em;
    height: 1.12em;
    display: inline-block;
    vertical-align: -0.22em;
    margin-right: 0.2em;
    color: var(--app-primary);
    opacity: 0.92;
}
.plan-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.plan-tool-btn .plan-tool-icon {
    width: 1rem;
    height: 1rem;
    opacity: 0.9;
}
.plan-tool-btn.is-active .plan-tool-icon,
.svg-plan-tools__btn.is-active .plan-tool-icon {
    color: #1d4ed8;
    opacity: 1;
}
.svg-plan-tools__btn .plan-tool-icon {
    width: 1.12rem;
    height: 1.12rem;
}
.svg-plan-bind__hint strong {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}
.svg-plan-tools__btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.svg-plan-tools__level {
    font-size: .68rem;
    font-weight: 600;
    color: var(--app-muted);
    text-align: center;
    padding-top: 2px;
}
.svg-plan-tools__rotate {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding-top: 4px;
    margin-top: 2px;
    border-top: 1px solid var(--app-border);
}
.svg-plan-tools__rotate-range {
    width: 100%;
    margin: 0;
    cursor: pointer;
    accent-color: var(--app-primary);
}
.svg-plan-tools__rotate-label {
    font-size: .68rem;
    font-weight: 700;
    color: var(--app-primary-dark);
    text-align: center;
}
.svg-plan-tools__rotate-hint {
    font-size: .68rem;
    font-weight: 700;
    color: var(--app-primary-dark);
    text-align: center;
    line-height: 1.2;
}
.svg-plan-tools__scale-row {
    display: flex;
    align-items: center;
    gap: 3px;
}
.svg-plan-tools__scale-row .svg-plan-tools__btn {
    flex: 1 1 0;
    min-width: 0;
}
.svg-plan-tools__scale-label {
    flex: 1 1 auto;
    font-size: .68rem;
    font-weight: 700;
    color: var(--app-primary-dark);
    text-align: center;
    min-width: 2.4rem;
}
.svg-plan-tools__btn--save {
    width: auto !important;
    min-height: 2rem;
    padding: 0 .35rem !important;
    font-size: .65rem !important;
    white-space: nowrap;
}
.svg-plan-viewport.is-bind-mode {
    cursor: crosshair;
}
.svg-plan-map.is-bind-mode .svg-plan-viewport:not(.is-marker-drag) {
    cursor: crosshair;
}
.svg-plan-viewport:active { cursor: grabbing; }
.svg-plan-rotate,
.svg-plan-bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}
.svg-plan-image-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    transform-origin: center center;
    line-height: 0;
    pointer-events: none;
}
.svg-plan-viewport.is-plan-align-mode {
    cursor: move;
}
.svg-plan-viewport.is-plan-align-mode.is-pan-only,
.svg-plan-viewport.is-plan-align-mode.is-pan-only:active {
    cursor: grab;
}
.svg-plan-base {
    display: block;
    width: auto;
    max-width: none;
    height: auto;
    user-select: none;
    pointer-events: none;
    vertical-align: top;
}
.svg-plan-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: visible;
}

.svg-plan-viewport.is-edit-mode:not(.is-pan-only) .svg-plan-overlay {
    pointer-events: auto;
    cursor: move;
}
.svg-plan-viewport.is-edit-mode:not(.is-pan-only) .svg-plan-overlay .svg-plan-marker,
.svg-plan-viewport.is-edit-mode:not(.is-pan-only) .svg-plan-overlay .svg-plan-hit,
.svg-plan-viewport.is-edit-mode:not(.is-pan-only) .svg-plan-overlay .svg-plan-label,
.svg-plan-viewport.is-edit-mode:not(.is-pan-only) .svg-plan-overlay .svg-plan-caption {
    pointer-events: none;
    cursor: move;
}
.svg-plan-viewport.is-edit-mode:not(.is-pan-only) .svg-plan-bg {
    pointer-events: none;
}
.svg-plan-viewport.is-edit-mode:not(.is-pan-only) {
    cursor: move;
}
.svg-marker-group-ui {
    pointer-events: none;
}
.svg-marker-bbox-frame {
    pointer-events: none;
}
.svg-marker-bbox-handle {
    pointer-events: all;
    cursor: nwse-resize;
}
.svg-marker-bbox-handle[data-handle="ne"],
.svg-marker-bbox-handle[data-handle="sw"] {
    cursor: nesw-resize;
}
.svg-plan-tools__nudge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.svg-plan-tools__nudge-row {
    display: flex;
    gap: 2px;
}
.svg-plan-tools__nudge-btn {
    min-width: 28px;
    padding: 2px 0;
    font-size: .72rem;
    line-height: 1.1;
}

.svg-plan-viewport.is-plan-align-mode:not(.is-pan-only) .svg-plan-overlay,
.svg-plan-viewport.is-plan-align-mode:not(.is-pan-only) .svg-plan-overlay * {
    pointer-events: none !important;
}
.svg-plan-overlay .svg-plan-hit--reserved {
    stroke: #a16207;
    stroke-width: 1px;
}
.svg-plan-overlay.is-bind-mode .svg-plan-label {
    pointer-events: none;
}
.svg-plan-viewport.is-bind-mode {
    cursor: crosshair;
}
.svg-plan-viewport.is-bind-mode:active {
    cursor: crosshair;
}
.svg-plan-info {
    position: absolute;
    z-index: 20;
    min-width: 260px;
    max-width: 340px;
    max-height: min(52vh, 360px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    padding: .75rem .85rem .7rem;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    box-shadow: 0 10px 32px rgba(15, 23, 42, .2);
    pointer-events: auto;
}
.svg-plan-map-hint {
    margin-bottom: 1rem;
}
.svg-plan-info[hidden] {
    display: none !important;
    pointer-events: none;
}
.svg-plan-info__head {
    position: relative;
    flex-shrink: 0;
    padding-right: 1.6rem;
    margin-bottom: .4rem;
}
.svg-plan-info__close {
    position: absolute;
    top: -.1rem;
    right: -.15rem;
    z-index: 10;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    color: var(--app-muted);
    cursor: pointer;
    padding: 0;
}
.svg-plan-info__close:hover {
    background: #f1f5f9;
    color: var(--app-text);
}
.svg-plan-info__badge {
    display: inline-block;
    width: auto;
    max-width: 100%;
    align-self: flex-start;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: .22rem .55rem;
    border-radius: 999px;
    margin-bottom: .35rem;
    white-space: nowrap;
    line-height: 1.2;
}
.svg-plan-info__badge--free { background: #dcfce7; color: #166534; }
.svg-plan-info__badge--reserved { background: #fef9c3; color: #854d0e; }
.svg-plan-info__badge--occupied { background: #fee2e2; color: #991b1b; }
.svg-plan-info__badge--empty { background: #f1f5f9; color: #475569; }
.svg-plan-info__title {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: var(--app-primary-dark);
    line-height: 1.35;
    padding-right: 0;
}
.svg-plan-info__body {
    font-size: .84rem;
    line-height: 1.45;
    color: var(--app-text);
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: .15rem;
    margin-right: -.1rem;
}
.svg-plan-info__body p { margin: 0 0 .35rem; }
.svg-plan-info__body p:last-child { margin-bottom: 0; }
.svg-plan-info__deceased {
    margin: .45rem 0;
}
.svg-plan-info__deceased ul {
    margin: .35rem 0 0;
    padding-left: 1.1rem;
}
.svg-plan-info__deceased li {
    margin-bottom: .3rem;
}
.svg-plan-info__person {
    font-weight: 600;
}
.svg-plan-info__years,
.svg-plan-info__meta {
    color: var(--app-muted);
    font-size: .82rem;
}
.svg-plan-info__actions {
    margin-top: .65rem;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    flex-shrink: 0;
}
.svg-plan-info__grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .15rem .55rem;
    margin: 0 0 .5rem;
    font-size: .82rem;
}
.svg-plan-info__grid dt {
    margin: 0;
    color: var(--app-muted);
    font-weight: 600;
}
.svg-plan-info__grid dd {
    margin: 0;
}
.svg-plan-info__grid--compact {
    margin-bottom: 0;
}
.svg-plan-info__section {
    margin: .55rem 0;
    padding-top: .5rem;
    border-top: 1px solid var(--app-border);
}
.svg-plan-info__section-title {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--app-muted);
    margin-bottom: .4rem;
}
.svg-plan-info__person-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: .5rem .6rem;
    margin-bottom: .45rem;
}
.svg-plan-info__person-card:last-child {
    margin-bottom: 0;
}
.svg-plan-info__person-name {
    font-weight: 700;
    font-size: .9rem;
    color: var(--app-primary-dark);
    margin-bottom: .35rem;
}
.svg-plan-info__person-link {
    display: inline-block;
    margin-top: .35rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--app-primary);
    text-decoration: none;
}
.svg-plan-info__person-link:hover {
    text-decoration: underline;
}
.svg-plan-info__note {
    margin: .4rem 0 0;
    font-size: .84rem;
    color: var(--app-text);
}
.svg-plan-info__note--free {
    color: #166534;
}
.svg-plan-overlay .svg-plan-hit {
    pointer-events: none;
    cursor: inherit;
}
.svg-plan-viewport:not(.is-plan-align-mode) .svg-plan-overlay .svg-plan-hit {
    pointer-events: all;
}
.svg-plan-viewport.is-edit-mode:not(.is-pan-only) .svg-plan-overlay .svg-plan-hit {
    pointer-events: all;
    cursor: grab;
}
.svg-plan-viewport.is-edit-mode.is-marker-drag .svg-plan-overlay .svg-plan-hit {
    cursor: grabbing;
}
.svg-plan-viewport.is-edit-mode .svg-plan-marker.is-active .svg-plan-hit {
    stroke-width: 1.1;
    filter: brightness(1.1);
}
.svg-plan-viewport:not(.is-edit-mode) .svg-plan-resize-hit {
    pointer-events: none;
}
.svg-plan-overlay .svg-plan-hit:active {
    cursor: inherit;
}
.svg-plan-marker.is-active .svg-plan-hit {
    stroke-width: 0.9;
    filter: brightness(1.06);
}
.svg-plan-resize-hit {
    pointer-events: all;
    fill: transparent;
    stroke: none;
    cursor: nwse-resize;
}
.svg-plan-resize-hit.svg-plan-resize-handle--w {
    cursor: ew-resize;
}
.svg-plan-resize-hit.svg-plan-resize-handle--h {
    cursor: ns-resize;
}
.svg-plan-resize-vis {
    pointer-events: none;
    fill: #fff;
    stroke: #1d4ed8;
    stroke-width: 0.5;
}
.svg-plan-marker.is-active .svg-plan-resize-vis {
    fill: #dbeafe;
    stroke: #1d4ed8;
}
.svg-plan-resize-handle {
    pointer-events: all;
}
.svg-plan-rotate-hit {
    pointer-events: all;
    fill: transparent;
    stroke: none;
    cursor: grab;
}
.svg-plan-rotate-vis {
    pointer-events: none;
}
.svg-plan-rotate-stem {
    pointer-events: none;
}
.svg-plan-viewport.is-marker-drag .svg-plan-rotate-hit {
    cursor: grabbing;
}
.svg-plan-viewport.is-marker-drag {
    cursor: grabbing;
}
.svg-plan-viewport.is-marker-drag.is-bind-mode {
    cursor: grabbing;
}
.svg-plan-overlay .svg-plan-hit--occupied {
    stroke: #991b1b;
    stroke-width: 1px;
}
.svg-plan-overlay .svg-plan-hit--occupied:hover {
    filter: brightness(1.08);
}
.svg-plan-label {
    fill: #0f172a;
    font-weight: 700;
    pointer-events: none;
    user-select: none;
    font-size: 3.5px;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 0.25px;
}
.svg-plan-caption {
    fill: #1e293b;
    font-weight: 600;
    pointer-events: none;
    user-select: none;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 0.2px;
}
.svg-plan-caption--occupied {
    fill: #7f1d1d;
}
.svg-plan-caption--reserved {
    fill: #854d0e;
}
.svg-plan-bind__hint {
    margin: 0 0 .55rem;
    font-size: .78rem;
}
.svg-plan-bind__select-hidden,
.svg-plan-bind__mode-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}
.svg-plan-bind__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem .65rem;
    margin-bottom: .5rem;
}
.svg-plan-bind__active {
    font-size: .8rem;
    font-weight: 600;
    color: var(--app-text);
    margin-right: auto;
    line-height: 1.45;
    flex: 1 1 12rem;
    min-width: 0;
}
.svg-plan-bind__person {
    color: var(--app-primary);
    text-decoration: none;
    font-weight: 700;
}
.svg-plan-bind__person:hover {
    text-decoration: underline;
}
.svg-plan-bind__hint-mini {
    font-weight: 500;
    color: var(--app-muted);
    font-size: .75rem;
}
.svg-parcel-search {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .4rem;
}
.svg-parcel-search__input {
    flex: 0 1 220px;
    max-width: 260px;
    padding: .34rem .6rem;
    border: 1px solid var(--app-border);
    border-radius: 7px;
    font-size: .82rem;
    background: #fff;
}
.svg-parcel-search__input:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.svg-parcel-search__count {
    font-size: .74rem;
    color: var(--app-muted);
    white-space: nowrap;
}
.svg-person-search {
    position: relative;
    flex: 1 1 240px;
    max-width: 340px;
}
.svg-person-search__input {
    width: 100%;
    padding: .34rem .6rem;
    border: 1px solid var(--app-border);
    border-radius: 7px;
    font-size: .82rem;
    background: #fff;
}
.svg-person-search__input:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.svg-person-search__results {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
}
.svg-person-search__item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
    padding: .4rem .6rem;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    text-align: left;
    cursor: pointer;
}
.svg-person-search__item:last-child {
    border-bottom: 0;
}
.svg-person-search__item:hover {
    background: #eff6ff;
}
.svg-person-search__name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--app-text);
}
.svg-person-search__meta {
    font-size: .72rem;
    color: var(--app-muted);
}
.svg-person-search__empty {
    padding: .5rem .6rem;
    font-size: .78rem;
    color: var(--app-muted);
}
.svg-parcel-status-filter {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-bottom: .45rem;
}
.svg-status-btn {
    padding: .24rem .55rem;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: #fff;
    color: #475569;
    font-size: .74rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.svg-status-btn:hover {
    border-color: #94a3b8;
}
.svg-status-btn.is-active {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
}
.svg-status-btn--free.is-active { background: #16a34a; border-color: #16a34a; }
.svg-status-btn--reserved.is-active { background: #ca8a04; border-color: #ca8a04; }
.svg-status-btn--occupied.is-active { background: #dc2626; border-color: #dc2626; }
.plan-map-progress {
    display: inline-flex;
    align-items: center;
    min-width: 120px;
}
.plan-map-progress__bar {
    display: flex;
    width: 130px;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #e2e8f0;
    border: 1px solid #e2e8f0;
}
.plan-map-progress__seg { height: 100%; }
.plan-map-progress__seg--occupied { background: #dc2626; }
.plan-map-progress__seg--reserved { background: #eab308; }
.plan-map-progress__seg--free { background: #16a34a; }
.svg-parcel-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .28rem;
    max-height: 132px;
    overflow: auto;
    padding: .35rem;
    margin-bottom: .55rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: #f8fafc;
    -webkit-overflow-scrolling: touch;
}
.svg-parcel-chip {
    flex: 0 0 auto;
    min-width: 2rem;
    padding: .2rem .38rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #334155;
    font-size: .68rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    transition: background .12s, border-color .12s, box-shadow .12s;
}

.svg-parcel-chip.is-free {
    background: #bbf7d0;
    border-color: #22c55e;
    color: #14532d;
}
.svg-parcel-chip.is-reserved {
    background: #fde68a;
    border-color: #eab308;
    color: #713f12;
}
.svg-parcel-chip.is-occupied {
    background: #fecaca;
    border-color: #ef4444;
    color: #7f1d1d;
}
.svg-parcel-chip.is-free:hover {
    background: #86efac;
    border-color: #16a34a;
}
.svg-parcel-chip.is-reserved:hover {
    background: #fcd34d;
    border-color: #ca8a04;
}
.svg-parcel-chip.is-occupied:hover {
    background: #fca5a5;
    border-color: #dc2626;
}
.svg-parcel-chip.is-marked {
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12);
}
.svg-parcel-chip.is-no-plan {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.4);
}
.svg-parcel-chip.is-no-plan:hover {
    background: inherit;
    border-color: inherit;
}
.svg-parcel-chip.is-no-plan.is-free:hover { background: #bbf7d0; border-color: #22c55e; }
.svg-parcel-chip.is-no-plan.is-reserved:hover { background: #fde68a; border-color: #eab308; }
.svg-parcel-chip.is-no-plan.is-occupied:hover { background: #fecaca; border-color: #ef4444; }
.svg-parcel-chip.is-active {
    font-weight: 700;
    box-shadow: 0 0 0 2px #2563eb, 0 1px 4px rgba(37, 99, 235, .22);
}
.svg-parcel-chip.is-active.is-free {
    background: #86efac;
    border-color: #16a34a;
    color: #14532d;
}
.svg-parcel-chip.is-active.is-reserved {
    background: #fcd34d;
    border-color: #d97706;
    color: #713f12;
}
.svg-parcel-chip.is-active.is-occupied {
    background: #fca5a5;
    border-color: #dc2626;
    color: #450a0a;
}
.svg-parcel-chip.is-filter-hidden {
    display: none;
}
.svg-plan-bind__row--actions {
    margin-top: 0;
}
.svg-map-status-toast {
    position: absolute;
    top: .35rem;
    left: 50%;
    z-index: 45;
    width: min(92%, 480px);
    padding: .55rem .85rem;
    border-radius: 10px;
    font-size: .86rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
    pointer-events: none;
    transform: translateX(-50%);
}
.svg-map-status-toast.is-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}
.svg-map-status-toast.is-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
.svg-map-status-toast.is-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.svg-plan-viewport.is-pan-only,
.svg-plan-viewport.is-pan-only.is-bind-mode {
    cursor: grab;
}
.svg-plan-viewport.is-pan-only:active {
    cursor: grabbing;
}
.svg-plan-tools__btn.is-active {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1d4ed8;
}
.svg-plan-tools__btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}
#svgMapPanHand.is-active,
#svgMapEdit.is-active,
#svgMapPlanAlign.is-active,
#svgBindFilterOpen.is-active {
    border-color: #2563eb;
    color: #1d4ed8;
    background: #eff6ff;
}
.deceased-parcel-pick {
    padding: .65rem .75rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: #fafbfc;
}
.deceased-parcel-pick__title {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    color: var(--app-muted);
    margin-bottom: .35rem;
}
.deceased-parcel-pick__toolbar {
    margin-bottom: .45rem;
}
.deceased-parcel-pick__blocks.block-thumb-list {
    margin-bottom: .5rem;
    padding: .35rem .45rem;
    box-shadow: none;
}
.deceased-parcel-pick__parcels {
    max-height: 148px;
}
button.block-thumb {
    font: inherit;
    text-align: center;
    cursor: pointer;
    appearance: none;
}
.svg-plan-bind {
    margin-bottom: 1rem;
    padding: .85rem 1rem;
}
.svg-plan-upload__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem;
}
.svg-plan-upload__form--inline {
    margin-top: .65rem;
    padding-top: .65rem;
    border-top: 1px solid var(--app-border);
}
.svg-plan-upload__file input[type="file"] {
    max-width: 100%;
}
.svg-plan-bind__row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1rem;
    align-items: flex-end;
}
.svg-plan-bind__row label {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--app-muted);
}

table.data tbody tr.row-highlight td { background: var(--app-primary-light); }


.invoice-lines-table { width: 100%; border-collapse: collapse; margin-top: .45rem; }
.invoice-lines-table th, .invoice-lines-table td { padding: .4rem .35rem; border-bottom: 1px solid var(--app-border-light); vertical-align: middle; }
.invoice-lines-table input, .invoice-lines-table select { width: 100%; }
.invoice-lines-table .line-total { font-weight: 600; white-space: nowrap; }
.invoice-grand-total { text-align: right; font-size: 1.05rem; font-weight: 700; margin-top: .65rem; color: var(--app-primary-dark); }
.payment-partial-wrap { display: none; margin-top: .65rem; padding: .75rem .9rem; background: #fef9ee; border: 1px solid #f0d9a8; border-radius: var(--app-radius); }
.payment-row-form { display: inline-flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.payment-row-form .payment-partial-input { display: none; width: 100px; }
.payment-row-form.is-partial .payment-partial-input { display: inline-block; }
.payment-summary-cell { font-size: .84rem; line-height: 1.35; max-width: 220px; }


table.data .col-actions,
table.data .invoice-list-actions {
    width: 1%;
    min-width: 13.5rem;
    vertical-align: top;
}
.invoice-list-actions {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    align-items: stretch;
}
.invoice-list-actions__quick {
    display: flex;
    gap: .35rem;
}
.invoice-list-actions__quick .btn {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
}
.invoice-list-actions__payment {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .35rem;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: .45rem .5rem;
    background: #f8fafc;
    border: 1px solid var(--app-border-light);
    border-radius: var(--app-radius);
}
.invoice-list-actions__payment.is-partial {
    grid-template-columns: 1fr 4.5rem 5.25rem auto;
}
.invoice-list-actions__payment.is-paid:not(.is-partial) {
    grid-template-columns: 1fr 4.5rem auto;
}
.invoice-list-actions__payment .payment-method-select {
    display: none;
}
.invoice-list-actions__payment.is-partial .payment-method-select,
.invoice-list-actions__payment.is-paid .payment-method-select {
    display: block;
}
.invoice-list-actions__payment .payment-status-select,
.invoice-list-actions__payment .payment-partial-input {
    width: 100%;
    min-width: 0;
    max-width: none;
}
.invoice-list-actions__payment .payment-partial-input {
    display: none;
}
.invoice-list-actions__payment.is-partial .payment-partial-input {
    display: block;
}
.invoice-list-actions__payment .btn {
    white-space: nowrap;
    padding-left: .65rem;
    padding-right: .65rem;
}


.checkbox-inline { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; cursor: pointer; }
.checkbox-inline input { width: auto; margin: 0; }
.audit-log-badge {
    display: inline-block;
    padding: .2rem .5rem;
    border-radius: 4px;
    background: var(--app-primary-light);
    color: var(--app-primary-dark);
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}
.audit-log-time { white-space: nowrap; font-size: .84rem; }
.pagination { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1rem; justify-content: center; }
