:root {
    --ink: #102033;
    --muted: #5e6b7a;
    --line: #dde6ef;
    --brand: #1267b2;
    --brand-dark: #0b4c86;
    --accent: #18a999;
    --bg: #f7fafc;
    --white: #fff;
    --danger: #b42318;
    --success: #157347;
    --warning: #9a6700;
    --shadow: 0 16px 40px rgba(16, 32, 51, .1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
    background: var(--bg);
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-dark);
}

.site-header,
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px min(5vw, 64px);
    background: var(--white);
    border-bottom: 1px solid var(--line);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    display: inline-flex;
    align-items: center;
    color: var(--ink);
    flex: 0 0 auto;
}

.brand img {
    display: block;
    width: auto;
    height: 58px;
    max-width: 150px;
    object-fit: contain;
}

.site-nav,
.site-footer nav,
.subnav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.site-nav a,
.subnav a {
    color: var(--ink);
    font-weight: 650;
}

.nav-toggle {
    display: none;
}

.section {
    width: min(1180px, 92vw);
    margin: 0 auto;
    padding: 64px 0;
}

.section.narrow {
    width: min(760px, 92vw);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
    gap: 42px;
    align-items: center;
    min-height: 640px;
}

.eyebrow {
    color: var(--brand);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .78rem;
}

h1,
h2,
h3 {
    line-height: 1.12;
    margin: 0 0 16px;
}

h1 {
    font-size: clamp(2.35rem, 5vw, 4.6rem);
}

h2 {
    font-size: clamp(1.8rem, 3vw, 2.75rem);
}

p {
    margin: 0 0 16px;
}

.lead {
    color: var(--muted);
    font-size: 1.16rem;
    max-width: 720px;
}

.lead.full-width {
    max-width: none;
}

.hero-panel,
.card,
.table-wrap,
.form-panel,
.pricing-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero-panel,
.card,
.form-panel,
.pricing-card {
    padding: 28px;
}

.hero-panel ul,
.check-list {
    display: grid;
    gap: 12px;
    padding: 0;
    margin: 18px 0 0;
    list-style: none;
}

.hero-panel li,
.check-list li {
    padding-left: 28px;
    position: relative;
}

.hero-panel li::before,
.check-list li::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    position: absolute;
    left: 0;
    top: .48em;
}

.button,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    padding: 12px 18px;
    background: var(--brand);
    color: var(--white) !important;
    font: inherit;
    font-weight: 800;
    line-height: 1.15;
    cursor: pointer;
    min-height: 42px;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
    background: var(--brand-dark);
    color: var(--white);
}

.button.secondary {
    background: var(--ink);
}

.button.ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink) !important;
}

.button.small {
    padding: 8px 12px;
    min-height: 34px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

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

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

.app-shell {
    width: min(1320px, 94vw);
    margin: 0 auto;
    padding: 34px 0 56px;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
}

.app-sidebar {
    position: sticky;
    top: 102px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(16, 32, 51, .08);
    overflow: hidden;
}

.app-sidebar-heading {
    display: grid;
    gap: 4px;
    padding: 18px 18px 16px;
    background: #eef5fb;
    border-bottom: 1px solid var(--line);
}

.app-sidebar-heading span {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 750;
}

.app-sidebar-heading strong {
    font-size: 1rem;
}

.app-menu {
    display: grid;
    padding: 10px;
}

.app-menu-group {
    display: grid;
    gap: 4px;
}

.app-menu-link,
.app-menu-children a {
    display: block;
    border-radius: 7px;
    color: var(--ink);
    font-weight: 800;
}

.app-menu-link {
    padding: 11px 12px;
}

.app-menu-link:hover,
.app-menu-link.current,
.app-menu-group.active > .app-menu-link {
    background: var(--brand);
    color: var(--white);
}

.app-menu-children {
    display: grid;
    gap: 3px;
    margin: 0 0 8px 14px;
    padding-left: 12px;
    border-left: 2px solid var(--line);
}

.app-menu-children a {
    padding: 8px 10px;
    color: var(--muted);
    font-size: .92rem;
}

.app-menu-children a:hover,
.app-menu-children a.current {
    background: #eef5fb;
    color: var(--brand-dark);
}

.app-content {
    min-width: 0;
}

.app-content-header {
    margin-bottom: 22px;
}

.app-content-header h1 {
    font-size: clamp(1.7rem, 2.4vw, 2.35rem);
    margin-bottom: 10px;
}

.content-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.content-toolbar .filters {
    flex: 1;
    margin-bottom: 0;
}

.violations-toolbar {
    flex-wrap: wrap;
}

.violations-toolbar .violations-filters {
    flex: 1 1 720px;
}

.violations-filters label {
    min-width: 136px;
}

.violations-filters label:first-child {
    flex: 1.4 1 220px;
}

.violations-toolbar .button,
.violations-filters button,
.violations-filters .button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.violations-toolbar > .button {
    margin-left: auto;
}

.content-toolbar.align-right {
    justify-content: flex-end;
}

.price {
    font-size: 4rem;
    font-weight: 900;
    margin: 10px 0;
}

.price span {
    color: var(--muted);
    font-size: 1.1rem;
    font-weight: 700;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
    background: var(--white);
}

th,
td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: #f1f6fb;
    color: #33475f;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

tbody tr:hover {
    background: #f8fbfe;
}

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

.table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 10px;
    min-height: auto;
    background: var(--white);
    color: var(--brand-dark);
    font-size: .86rem;
    font-weight: 800;
    cursor: pointer;
}

.table-action:hover {
    border-color: var(--brand);
    background: #eef5fb;
}

.table-action.danger {
    border-color: #ffd0cc;
    color: var(--danger) !important;
}

.table-action.danger:hover {
    border-color: var(--danger);
    background: #fff2f0;
}

.table-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.table-actions form {
    display: inline;
    margin: 0;
}

.record-link {
    color: var(--brand-dark);
    text-decoration: none;
}

.record-link:hover {
    color: var(--brand);
    text-decoration: underline;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #33475f;
}

.sort-link.active,
.sort-link:hover {
    color: var(--brand-dark);
}

.sort-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    font-size: .62rem;
    line-height: 1;
}

.sort-icon.neutral {
    border: 1px solid #c9d6e2;
    color: #7b8da1;
    background: var(--white);
}

.sort-icon.active {
    background: var(--brand);
    color: var(--white);
}

.empty-state {
    color: var(--muted);
    text-align: center;
    padding: 28px 16px;
}

.nowrap {
    white-space: nowrap;
}

.announcements-table th:nth-child(1),
.announcements-table td:nth-child(1) {
    width: 145px;
}

.announcements-table th:nth-child(2),
.announcements-table td:nth-child(2) {
    width: 210px;
}

.announcements-table th:nth-child(3),
.announcements-table td:nth-child(3) {
    width: auto;
}

.documents-table th:nth-child(1),
.documents-table td:nth-child(1) {
    width: 145px;
}

.documents-table th:nth-child(2),
.documents-table td:nth-child(2) {
    width: 26%;
}

.documents-table th:nth-child(3),
.documents-table td:nth-child(3) {
    width: 155px;
}

.documents-table th:nth-child(5),
.documents-table td:nth-child(5) {
    width: 95px;
}

.payment-history-table th:nth-child(1),
.payment-history-table td:nth-child(1) {
    width: 120px;
}

.payment-history-table th:nth-child(2),
.payment-history-table td:nth-child(2) {
    width: 150px;
}

.payment-history-table th:nth-child(3),
.payment-history-table td:nth-child(3) {
    width: 130px;
}

.payment-history-table th:nth-child(4),
.payment-history-table td:nth-child(4) {
    width: auto;
}

.violations-table th:nth-child(1),
.violations-table td:nth-child(1) {
    width: 210px;
}

.violations-table th:nth-child(3),
.violations-table td:nth-child(3) {
    width: 105px;
}

.violations-table th:nth-child(4),
.violations-table td:nth-child(4) {
    width: 145px;
}

.violations-table th:nth-child(5),
.violations-table td:nth-child(5) {
    width: 90px;
}

.resident-picker {
    margin-bottom: 18px;
}

.resident-results {
    margin-bottom: 20px;
}

.selected-record {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--accent);
    border-radius: 8px;
    background: #f2fbf9;
}

.selected-record strong {
    color: var(--ink);
}

.selected-record span {
    color: var(--muted);
    font-weight: 750;
}

form {
    display: grid;
    gap: 16px;
}

.form-panel h2 {
    margin: 8px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 1.15rem;
}

.form-panel h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.form-section {
    display: grid;
    gap: 16px;
}

.settings-section {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--brand);
    border-radius: 8px;
    background: #f8fbfe;
}

.settings-section + .settings-section {
    margin-top: 4px;
    border-left-color: var(--accent);
}

.settings-section h2 {
    margin: 0;
    font-size: 1.15rem;
}

.settings-section-heading {
    display: grid;
    gap: 4px;
}

.settings-section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: .94rem;
}

.address-section {
    padding: 18px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--brand);
    border-radius: 8px;
    background: #f8fbfe;
}

.address-section h2 {
    margin: 0;
    padding: 0;
    border: 0;
}

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

label {
    display: grid;
    gap: 6px;
    color: var(--ink);
    font-weight: 750;
}

.label-text {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.required-note {
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
    font-weight: 750;
}

.required-marker {
    color: var(--danger);
    font-weight: 900;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 11px 12px;
    font: inherit;
    color: var(--ink);
    background: var(--white);
}

input[type="checkbox"] {
    width: auto;
}

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

.filters .filter-checkbox {
    flex: 0 0 auto;
    min-width: auto;
    padding-bottom: 11px;
}

textarea {
    min-height: 130px;
    resize: vertical;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
}

.filters label {
    min-width: 190px;
    flex: 1;
}

.status {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 800;
    font-size: .82rem;
    background: #e8f5ed;
    color: var(--success);
}

.status.open,
.status.past_due {
    background: #fff2f0;
    color: var(--danger);
}

.status.pending {
    background: #fff7e6;
    color: var(--warning);
}

.status.in_process {
    background: #fff7e6;
    color: var(--warning);
}

.status.ready_for_inspection {
    background: #eef5fb;
    color: var(--brand-dark);
}

.status-update-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.detail-panel {
    display: grid;
    gap: 22px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
}

.balance-panel {
    margin-bottom: 18px;
}

.balance-negative {
    color: var(--danger);
}

.balance-positive {
    color: var(--success);
}

.amount-negative {
    color: var(--danger);
}

.amount-positive {
    color: var(--success);
}

.due-date-list,
.due-date-row {
    display: grid;
    gap: 12px;
}

.due-date-row {
    grid-template-columns: minmax(150px, 1fr) minmax(100px, 140px) minmax(120px, 160px) auto;
    align-items: end;
}

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

.detail-grid > div,
.detail-block {
    display: grid;
    gap: 6px;
}

.detail-grid small {
    color: var(--muted);
    font-weight: 700;
}

.detail-label {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.preserve-lines {
    margin: 0;
    white-space: pre-wrap;
}

.violation-detail-image {
    display: block;
    width: min(100%, 720px);
    max-height: 520px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: contain;
    background: #f8fafc;
}

.flash {
    width: min(1180px, 92vw);
    margin: 20px auto 0;
    padding: 14px 16px;
    border-radius: 8px;
    background: #e8f5ed;
    color: var(--success);
    font-weight: 750;
}

.flash.error {
    background: #fff2f0;
    color: var(--danger);
}

.form-error {
    position: relative;
    margin-bottom: 20px;
    padding: 18px 18px 18px 54px;
    border: 2px solid #d92d20;
    border-left-width: 8px;
    border-radius: 8px;
    background: #fff1f0;
    color: #7a271a;
    box-shadow: 0 12px 28px rgba(180, 35, 24, .16);
    font-weight: 850;
}

.form-error::before {
    content: "!";
    position: absolute;
    left: 18px;
    top: 50%;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #d92d20;
    color: var(--white);
    font-size: .95rem;
    font-weight: 900;
    line-height: 22px;
    text-align: center;
    transform: translateY(-50%);
}

.import-errors {
    margin-bottom: 20px;
    padding: 20px;
    border: 2px solid #d92d20;
    border-left-width: 8px;
    border-radius: 8px;
    background: #fff1f0;
    color: #7a271a;
    box-shadow: 0 12px 28px rgba(180, 35, 24, .16);
}

.import-errors h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.import-errors p {
    font-weight: 800;
}

.import-errors ul {
    margin: 12px 0 0;
    padding-left: 22px;
}

.import-errors li + li {
    margin-top: 6px;
}

.import-instructions {
    box-shadow: none;
    margin-bottom: 18px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.pagination a {
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 12px;
    background: var(--white);
}

.pagination a.active {
    background: var(--brand);
    color: var(--white);
    border-color: var(--brand);
}

.pagination a.arrow {
    font-weight: 900;
}

.site-footer {
    align-items: flex-start;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    margin-top: 36px;
}

.site-footer p {
    color: var(--muted);
    margin: 4px 0 0;
}

.footer-brand {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.footer-brand img {
    display: block;
    width: min(180px, 50vw);
    height: auto;
}

.footer-brand p {
    font-size: .92rem;
    text-align: center;
}

@media (max-width: 820px) {
    .site-header {
        align-items: flex-start;
        gap: 14px;
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .brand img {
        height: 48px;
        max-width: 126px;
    }

    .site-footer {
        gap: 18px;
    }

    .footer-brand img {
        width: min(150px, 56vw);
    }

    .nav-toggle {
        display: inline-flex;
        margin-left: auto;
        background: var(--ink);
    }

    .site-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-top: 12px;
    }

    .site-nav.open {
        display: flex;
    }

    .site-header {
        flex-wrap: wrap;
    }

    .hero,
    .grid,
    .dashboard-grid,
    .form-grid,
    .detail-grid,
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-shell {
        width: min(100% - 28px, 720px);
        padding-top: 22px;
        gap: 18px;
    }

    .app-sidebar {
        position: static;
    }

    .app-menu {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 12px;
    }

    .app-menu-group {
        min-width: 190px;
    }

    .due-date-row {
        grid-template-columns: 1fr;
    }

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

    .violations-toolbar > .button {
        margin-left: 0;
    }

    .hero {
        min-height: auto;
        padding-top: 48px;
    }
}
