body {
    margin: 0;
    font-family: "Segoe UI", sans-serif;
    background: #f3f4f6;
    color: #0f172a;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background: linear-gradient(135deg, #0f766e, #155e75);
    color: #fff;
}

.topbar h1,
.topbar p {
    margin: 0;
}

.topbar nav {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.topbar a,
.topbar button {
    color: #fff;
    text-decoration: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
}

.topbar .active {
    font-weight: 700;
    text-decoration: underline;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px;
    box-sizing: border-box;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.market-summary .card p:last-child {
    margin-bottom: 0;
}

.card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
    margin-bottom: 20px;
}

.auth-card {
    max-width: 420px;
    margin: 40px auto;
}

.wide-card {
    max-width: 760px;
}

.stack,
.filters {
    display: grid;
    gap: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.filters {
    grid-template-columns: minmax(0, 1fr) 140px 160px;
    align-items: end;
}

.search-field {
    min-width: 0;
}

label span {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
}

input,
select,
button,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    box-sizing: border-box;
}

textarea {
    font: inherit;
    resize: vertical;
}

button {
    background: #0f766e;
    color: #fff;
    font-weight: 700;
}

.secondary-button {
    background: #e2e8f0;
    color: #0f172a;
}

.metric {
    font-size: 44px;
    font-weight: 700;
    margin: 10px 0;
}

.alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
    vertical-align: top;
}

.property-row {
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.property-row:hover,
.property-row:focus {
    background: #ecfeff;
    outline: none;
}

.property-row.is-active {
    background: #ccfbf1;
}

.inline-form {
    margin: 0;
}

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

.checkbox-field input {
    width: auto;
}

.checkbox-field span {
    margin-bottom: 0;
}

.filter-checkbox {
    align-self: end;
    min-height: 46px;
}

.advanced-filters {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    padding-top: 8px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.section-header h2,
.section-header p {
    margin: 0;
}

.section-header p {
    margin-top: 6px;
    color: #475569;
}

.section-note {
    font-size: 13px;
}

.text-link {
    color: #0f766e;
    text-decoration: none;
    font-weight: 600;
}

.property-map {
    min-height: 420px;
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(180deg, #dbeafe, #f8fafc);
    border: 1px solid #cbd5e1;
}

.property-map-canvas {
    display: block;
    width: 100%;
    height: 420px;
}

.is-hidden {
    display: none;
}

.map-status {
    margin: 14px 0 0;
    color: #475569;
    font-size: 14px;
}

.map-legend {
    margin-top: 14px;
    display: grid;
    gap: 6px;
}

.legend-title {
    font-size: 13px;
    color: #334155;
    font-weight: 700;
}

.legend-scale {
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, #16a34a 0%, #facc15 50%, #dc2626 100%);
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #64748b;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    background: #0f766e;
    color: #fff;
    font-weight: 700;
}

.pagination-link.is-disabled {
    pointer-events: none;
    background: #cbd5e1;
    color: #475569;
}

.pagination-status {
    color: #475569;
    font-size: 14px;
}

.action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    background: #0f766e;
    color: #fff;
    font-weight: 700;
}

.secondary-action-link {
    background: #e2e8f0;
    color: #0f172a;
}

.muted-action-link {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

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

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    text-decoration: none;
    background: #e2e8f0;
    color: #0f172a;
    border: 0;
    font-size: 16px;
    cursor: pointer;
}

.danger-action {
    background: #fee2e2;
    color: #991b1b;
}

.success-action {
    background: #dcfce7;
    color: #166534;
}

.listing-details summary {
    cursor: pointer;
    color: #0f766e;
    font-weight: 700;
}

.listing-details-grid {
    display: grid;
    gap: 10px;
    margin-top: 10px;
    min-width: 360px;
}

.listing-details-full {
    white-space: pre-wrap;
    word-break: break-word;
}

.empty-state {
    padding: 20px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    color: #64748b;
    background: #f8fafc;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.history-panel {
    margin-top: 20px;
}

.history-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    background: #fff;
}

.detail-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    background: #fcfffe;
}

.detail-card h3 {
    margin: 0 0 14px;
    font-size: 16px;
}

.detail-items {
    display: grid;
    gap: 12px;
}

.detail-item {
    display: grid;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.detail-value {
    font-size: 14px;
    color: #0f172a;
    word-break: break-word;
}

.mobile-card-list {
    display: none;
    gap: 12px;
}

.mobile-result-card {
    border: 1px solid #dbe4ee;
    border-radius: 14px;
    padding: 14px;
    background: #fcfffe;
    display: grid;
    gap: 12px;
    height: 100%;
}

.mobile-result-card__header {
    display: grid;
    gap: 4px;
}

.mobile-result-card__header h3 {
    margin: 0;
    font-size: 16px;
}

.mobile-result-card__header span {
    color: #475569;
    font-size: 13px;
}

.mobile-result-card__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 10px;
    align-content: start;
}

.mobile-result-card__label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.mobile-result-card__actions {
    margin-top: auto;
    padding-top: 6px;
}

.chart-summary-grid {
    margin-bottom: 16px;
}

.chart-panel {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    padding: 12px;
    overflow: hidden;
}

.chart-canvas {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 320px;
}

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

.neighborhood-editor-panel {
    display: grid;
    gap: 14px;
}

.neighborhood-editor-map-wrap {
    display: grid;
    gap: 12px;
}

.admin-section-links {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

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

.admin-inner-card {
    background: #fcfffe;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
}

.admin-inner-card h2,
.admin-inner-card p {
    margin-top: 0;
}

@media (max-width: 1180px) {
    .container {
        padding: 20px;
    }

    .card {
        padding: 20px;
    }

    .property-map,
    .property-map-canvas {
        min-height: 360px;
        height: 360px;
    }

    table {
        min-width: 860px;
    }
}

@media (max-width: 900px) {
    .topbar {
        padding: 18px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .topbar nav {
        width: 100%;
        gap: 10px;
    }

    .topbar a,
    .topbar button {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    .container {
        padding: 16px;
    }

    .card {
        padding: 18px;
        border-radius: 14px;
    }

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

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

    .advanced-filters {
        grid-template-columns: 1fr 1fr;
    }

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

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

    .neighborhood-editor-grid {
        grid-template-columns: 1fr;
    }

    .admin-users-grid {
        grid-template-columns: 1fr;
    }

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

    .pagination-link,
    .action-link {
        width: 100%;
    }

    .property-map,
    .property-map-canvas {
        min-height: 320px;
        height: 320px;
    }

    table {
        min-width: 760px;
    }

    th,
    td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .row-actions {
        flex-wrap: nowrap;
    }

    .icon-action {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 14px;
    }

    .topbar {
        padding: 16px;
    }

    .container {
        padding: 12px;
    }

    .card {
        padding: 16px;
        margin-bottom: 16px;
    }

    .metric {
        font-size: 34px;
    }

    .advanced-filters {
        grid-template-columns: 1fr;
    }

    .property-map,
    .property-map-canvas {
        min-height: 280px;
        height: 280px;
    }

    .chart-canvas {
        height: 280px;
    }

    .mobile-card-list {
        display: grid;
    }

    .table-wrap {
        display: none;
    }

    .detail-card {
        padding: 16px;
    }

    input,
    select,
    button,
    textarea {
        min-height: 44px;
    }

    .mobile-result-card__grid {
        grid-template-columns: 1fr;
    }

    .mobile-result-card__actions {
        justify-content: flex-start;
    }
}
