:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #17212b;
    background: #f3f6f5;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
}

button,
input,
select {
    font: inherit;
}

.page-shell {
    width: min(100% - 32px, 980px);
    margin: 0 auto;
    padding: 38px 0 64px;
}

.page-header,
.section-heading,
.list-heading,
.location-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.page-header {
    margin-bottom: 26px;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 8px;
    border: 1px solid #e0e8e3;
    border-radius: 12px;
    background: #fff;
}

.nav-button {
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #40564a;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
}

.nav-button:hover,
.nav-button.is-active {
    border-color: #cfe5d4;
    background: #edf7ef;
    color: #14532d;
}

.nav-button:focus-visible {
    outline: 3px solid #86efac;
    outline-offset: 2px;
}

.eyebrow,
.step {
    margin: 0 0 6px;
    color: #15803d;
    font-size: .75rem;
    font-weight: 750;
    letter-spacing: .1em;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(1.7rem, 5vw, 2.2rem);
    letter-spacing: -.035em;
}

h2 {
    margin-bottom: 0;
    font-size: 1.2rem;
}

.subtitle,
.muted {
    margin-bottom: 0;
    color: #61716a;
    line-height: 1.55;
}

.card {
    margin-bottom: 20px;
    padding: clamp(20px, 4vw, 28px);
    border: 1px solid #e0e8e3;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 26px rgb(22 46 32 / 5%);
}

.section-heading {
    margin-bottom: 22px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field {
    display: grid;
    gap: 7px;
    min-width: 0;
    color: #34443b;
    font-size: .92rem;
    font-weight: 650;
}

.field-full {
    grid-column: 1 / -1;
}

.field input,
.field select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cbd7cf;
    border-radius: 8px;
    background: #fff;
    color: #17212b;
}

.field input:focus,
.field select:focus {
    border-color: #15803d;
    outline: 3px solid rgb(21 128 61 / 15%);
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-field input {
    width: 20px;
    min-height: 20px;
    margin: 0;
    accent-color: #166534;
}

.location-box {
    min-height: 74px;
    padding: 14px;
    border: 1px solid #dfe8e2;
    border-radius: 10px;
    background: #f8faf8;
}

.field-label {
    font-weight: 700;
}

.location-value {
    margin: 4px 0 0;
    font-size: .88rem;
    overflow-wrap: anywhere;
}

.button {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid #166534;
    border-radius: 8px;
    background: #166534;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.button:hover:not(:disabled) {
    background: #14532d;
}

.button:focus-visible {
    outline: 3px solid #86efac;
    outline-offset: 2px;
}

.button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.button-secondary,
.button-quiet {
    border-color: #b6c8bc;
    background: #fff;
    color: #14532d;
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
    background: #f0f7f2;
}

.privacy-note {
    margin: -4px 0 18px;
    padding: 12px 14px;
    border-left: 3px solid #72b889;
    background: #f3faf5;
    color: #40564a;
    font-size: .9rem;
    line-height: 1.55;
}

#qr-scanner {
    --qr-color: #166534;
    margin-bottom: 20px;
}

.resident-form {
    padding-top: 4px;
}

.resident-property-picker {
    margin-bottom: 16px;
}

.button-danger {
    border-color: #b42318;
    background: #b42318;
    color: #fff;
}

.button-danger:hover:not(:disabled) {
    background: #912018;
}

.form-message {
    min-height: 1.4em;
    margin: 0;
    color: #52665a;
    font-size: .9rem;
}

.form-message[data-state="error"] {
    color: #b42318;
}

.form-message[data-state="success"] {
    color: #166534;
}

.list-heading {
    margin-bottom: 18px;
}

.list-property,
.active-property-label,
.account-note {
    margin: 8px 0 0;
}

.account-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #edf1ee;
}

.account-table-wrap {
    margin-top: 22px;
}

.button-small {
    min-height: 36px;
    padding: 6px 10px;
    font-size: .85rem;
}

.toast {
    position: fixed;
    z-index: 20;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    width: min(440px, calc(100vw - 32px));
    padding: 15px 18px;
    border: 1px solid #a7d6b3;
    border-radius: 12px;
    background: #f0faf2;
    box-shadow: 0 12px 36px rgb(22 46 32 / 18%);
    color: #14532d;
    font-weight: 650;
    line-height: 1.45;
    animation: toast-enter .18s ease-out;
}

.toast[data-state="error"] {
    border-color: #efb4ad;
    background: #fff4f2;
    color: #9f2017;
}

@keyframes toast-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.count-badge {
    display: inline-grid;
    min-width: 26px;
    height: 26px;
    place-items: center;
    margin-left: 5px;
    border-radius: 999px;
    background: #e8f4eb;
    color: #166534;
    font-size: .8rem;
    vertical-align: 2px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #e2e9e4;
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf1ee;
    font-size: .9rem;
}

th {
    background: #f7faf8;
    color: #48594e;
    font-size: .82rem;
}

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

.empty-row {
    padding: 22px;
    color: #718078;
    text-align: center;
}

.login-card {
    max-width: 460px;
    margin: 40px auto;
}

.login-card h2 {
    margin-bottom: 8px;
}

.login-card > .muted {
    margin-bottom: 20px;
}

[hidden] {
    display: none !important;
}

@media (max-width: 620px) {
    .page-shell {
        width: min(100% - 24px, 980px);
        padding-top: 24px;
    }

    .page-header {
        align-items: flex-start;
    }

    .page-header .button {
        flex: 0 0 auto;
        padding-inline: 12px;
    }

    .app-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 6px;
    }

    .nav-button {
        padding-inline: 8px;
        font-size: .9rem;
    }

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

    .field-full {
        grid-column: auto;
    }

    .location-box,
    .list-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .location-box .button,
    .list-heading .button {
        width: 100%;
    }

    .account-table-wrap table {
        min-width: 520px;
    }

    #residents-view .table-wrap table {
        min-width: 760px;
    }

    .toast {
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        width: calc(100vw - 24px);
    }
}
