:root {
    --bg: #f8f4eb;
    --surface: #ffffff;
    --ink: #161616;
    --muted: #6f6a62;
    --line: #ded6c9;
    --gold: #c99700;
    --gold-dark: #8a6600;
    --red: #c73546;
    --green: #217a4a;
    --shadow: 0 16px 40px rgba(24, 18, 8, 0.08);
}

* {
    box-sizing: border-box;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    padding: 12px clamp(16px, 4vw, 42px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.topbar form {
    margin: 0;
}

.brand {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.brand strong,
.brand small {
    display: block;
}

.brand small,
.eyebrow,
.muted,
.empty {
    color: var(--muted);
}

.account {
    flex: 0 1 auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.email-route-form,
.mode-reset-group {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.email-route-form label {
    flex: 0 0 344px;
    width: 344px;
    min-width: 0;
}

.mode-form label {
    flex: 0 0 292px;
    width: 292px;
    min-width: 0;
}

.account .icon-button {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
}

.account input,
.account select,
.account .icon-button {
    height: 42px;
    min-height: 42px;
}

main {
    width: min(1180px, calc(100% - 32px));
    margin: 26px auto 48px;
}

.notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    background: #fff7d8;
    border: 1px solid #e4c65c;
    border-radius: 8px;
}

.summary {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: clamp(20px, 4vw, 34px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

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

h1 {
    margin-bottom: 8px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.08;
}

h2 {
    margin-bottom: 0;
    font-size: 22px;
}

h3 {
    margin-bottom: 4px;
    font-size: 18px;
}

.eyebrow {
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.status {
    display: grid;
    place-items: center;
    min-width: 190px;
    padding: 18px;
    color: #fff;
    border-radius: 8px;
}

.status span {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.status strong {
    font-size: 32px;
}

.status.due {
    background: var(--red);
}

.status.paid {
    background: var(--green);
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 18px;
    align-items: start;
}

.panel {
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    color: var(--ink);
    background: #f0ece4;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.pill.ok {
    color: var(--green);
    background: #e9f7ef;
    border-color: #b9dfc9;
}

.pill.warn {
    color: #8c2430;
    background: #fff0f2;
    border-color: #f0bdc5;
}

.pill.alert {
    color: #6f2500;
    background: #fff1df;
    border-color: #e7b26f;
}

.pill.neutral {
    color: #55504a;
    background: #f7f5f1;
    border-color: #d8d0c2;
}

.facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 20px;
}

.facts div {
    padding: 14px;
    background: #fbfaf7;
    border: 1px solid var(--line);
    border-radius: 8px;
}

dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

dd {
    margin: 4px 0 0;
    font-weight: 800;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.primary,
.icon-button,
input,
select,
textarea {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

input,
select,
textarea {
    width: 100%;
    color: var(--ink);
    background: #fff;
}

input,
select {
    padding: 0 12px;
}

textarea {
    min-width: 0;
    padding: 10px 12px;
    resize: vertical;
}

.primary,
.icon-button {
    cursor: pointer;
    font-weight: 800;
}

.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    color: #161206;
    background: var(--gold);
    border-color: var(--gold-dark);
    text-decoration: none;
}

.icon-button {
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
}

.inline-action-form {
    margin: 0;
}

.small-button {
    min-height: 34px;
    padding: 0 10px;
    color: #161206;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.process-rent-button {
    display: inline-grid;
    place-items: center;
    min-width: 82px;
    min-height: 42px;
    padding: 4px 10px;
    line-height: 1.05;
}

.billing-mail-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    text-decoration: none;
}

.billing-mail-link:hover {
    border-color: var(--gold-dark);
}

.small-button:hover {
    border-color: var(--gold-dark);
}

.receipt {
    padding: 16px;
    background: #ecf8f1;
    border: 1px solid #b9dfc9;
    border-radius: 8px;
}

.receipt p:last-child {
    margin-bottom: 0;
}

.download-link {
    margin-top: 12px;
}

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

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.wide,
.support-form button {
    grid-column: 1 / -1;
}

.requests {
    margin-top: 18px;
}

.request-list {
    display: grid;
    gap: 12px;
}

.request {
    padding: 16px;
    background: #fbfaf7;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.request div,
.request footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.request div span,
.request footer {
    color: var(--muted);
    font-size: 13px;
}

.request p {
    margin: 10px 0;
}

.admin-shell {
    display: grid;
    grid-template-columns: 238px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.admin-sidebar {
    position: sticky;
    top: 92px;
    display: grid;
    gap: 8px;
    padding: 16px;
    background: #181818;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 14px;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.admin-logo img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.admin-logo strong,
.admin-logo span {
    display: block;
}

.admin-logo span {
    color: #bbb;
    font-size: 13px;
}

.admin-nav {
    padding: 11px 12px;
    color: #e9e9e9;
    text-decoration: none;
    border-radius: 6px;
}

.admin-nav.active,
.admin-nav:hover {
    color: #161206;
    background: var(--gold);
}

.admin-workspace {
    min-width: 0;
}

.admin-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding: 24px;
    color: #fff;
    background: #242424;
    border: 1px solid #393939;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.admin-hero .eyebrow,
.admin-hero p {
    color: #cfcfcf;
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.metric {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.admin-sidepanels {
    display: grid;
    gap: 18px;
}

.admin-panel {
    box-shadow: none;
}

.admin-request-list {
    display: grid;
    gap: 14px;
}

.admin-request {
    padding: 16px;
    background: #fbfaf7;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.admin-request header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.admin-request header strong,
.admin-request header span {
    display: block;
}

.admin-request header div span {
    color: var(--muted);
    font-size: 13px;
}

.mini-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.mini-facts div {
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.mini-facts dd {
    word-break: break-word;
}

.note-thread {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}

.note {
    padding: 12px;
    background: #eef6ff;
    border: 1px solid #bdd8f2;
    border-radius: 6px;
}

.note p {
    margin: 6px 0;
}

.note span {
    color: var(--muted);
    font-size: 13px;
}

.admin-note-form {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 12px;
    align-items: end;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.admin-note-form button {
    grid-column: 1 / -1;
    justify-self: start;
}

.available-units {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.available-unit-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.available-unit-list div {
    padding: 12px;
    background: #fbfaf7;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.available-unit-list strong,
.available-unit-list span {
    display: block;
}

.available-unit-list span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.property-map-panel {
    margin-bottom: 18px;
}

.map-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.map-legend strong {
    color: var(--ink);
}

.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.map-legend i {
    width: 12px;
    height: 12px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 3px;
}

.map-legend .map-open-request {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: #063f7a;
    background: #fff;
    border: 3px solid #1e88e5;
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
    line-height: 1;
}

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

.map-building {
    padding: 14px;
    background: #f7f5f1;
    border: 2px solid #d8d0c2;
    border-radius: 8px;
}

.map-building h3 {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

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

.map-unit {
    position: relative;
    display: grid;
    place-items: center;
    height: 54px;
    border: 2px solid rgba(0, 0, 0, 0.16);
    border-radius: 4px;
    color: #161616;
    font-weight: 900;
}

.unit-number {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    border-radius: 999px;
}

.map-unit.has-open-request .unit-number {
    color: #063f7a;
    background: rgba(255, 255, 255, 0.82);
    border: 3px solid #1e88e5;
}

.map-unit::after {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    z-index: 5;
    width: max-content;
    max-width: 220px;
    padding: 7px 9px;
    color: #fff;
    background: #161616;
    border-radius: 6px;
    box-shadow: var(--shadow);
    content: attr(data-tenant);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    opacity: 0;
    pointer-events: none;
    text-align: center;
    transform: translate(-50%, 4px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.map-unit:hover::after,
.map-unit:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.map-paid {
    background: #38b45a;
}

.map-pending-available {
    background: linear-gradient(to bottom right, #38b45a 0 49%, #ffffff 49% 51%, #8f949b 51% 100%);
}

.map-pending {
    background: #ffd029;
}

.map-late {
    background: #e04b4b;
}

.map-notice {
    color: #fff;
    background: #7f1722;
}

.map-vacant {
    background: #8f949b;
}

.facts.stacked {
    grid-template-columns: 1fr;
    margin-bottom: 12px;
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.admin-table th,
.admin-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-table td {
    font-weight: 700;
}

@media (max-width: 1080px) {
    .topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .account {
        justify-content: flex-end;
        width: 100%;
    }
}

@media (max-width: 860px) {
    .account {
        align-items: stretch;
        flex-direction: column;
    }

    .email-route-form,
    .mode-reset-group {
        align-items: flex-end;
        flex-direction: row;
    }

    .email-route-form label,
    .mode-form label {
        flex: 1;
        width: auto;
        min-width: 0;
    }
}

@media (max-width: 760px) {
    .topbar,
    .summary,
    .admin-hero,
    .admin-request header,
    .request div,
    .request footer {
        align-items: stretch;
        flex-direction: column;
    }

    .grid,
    .facts,
    .support-form,
    .admin-shell,
    .admin-metrics,
    .admin-grid,
    .admin-note-form,
    .mini-facts,
    .available-unit-list,
    .property-map {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
    }

    .admin-actions {
        justify-content: flex-start;
    }

    .status {
        min-width: 0;
    }
}
