:root {
    color-scheme: light;
    --ink: #162642;
    --muted: #62708d;
    --line: #d9e0eb;
    --panel: #ffffff;
    --surface: #eef3f8;
    --brand: #214a84;
    --brand-dark: #142f5d;
    --success: #1f7a4d;
    --danger: #a63c3c;
    --gold: #b58b60;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--surface);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button,
a,
input,
select,
textarea,
.rich-editor {
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

:focus-visible {
    outline: 3px solid rgba(33, 74, 132, 0.2);
    outline-offset: 2px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    min-height: 100vh;
    padding: 30px 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-right: 1px solid var(--line);
}

.admin-brand {
    display: grid;
    gap: 12px;
    margin-bottom: 38px;
    font-weight: 700;
    color: var(--brand-dark);
}

.admin-brand img,
.auth-logo {
    width: 178px;
    max-width: 100%;
    height: auto;
}

.admin-nav {
    display: grid;
    gap: 10px;
}

.admin-nav a {
    padding: 13px 16px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 600;
}

.admin-nav a:hover,
.admin-nav a.is-active {
    background: #edf4fb;
    color: var(--brand-dark);
}

.admin-nav a.is-active {
    box-shadow: inset 3px 0 0 var(--gold);
}

.admin-main {
    min-width: 0;
    padding: 32px clamp(24px, 4vw, 54px) 48px;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    display: block;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
}

h1 {
    margin-top: 4px;
    font-size: clamp(1.8rem, 3vw, 2.35rem);
}

h2 {
    font-size: 1.2rem;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--ink);
}

.admin-profile-copy {
    display: grid;
    gap: 2px;
    justify-items: end;
}

.admin-profile-copy span {
    font-weight: 800;
}

.admin-profile small {
    color: var(--muted);
}

.logout-form {
    margin: 0;
}

.logout-form button {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--brand);
    cursor: pointer;
    font-weight: 700;
}

.logout-form button:hover {
    border-color: #b9c7da;
    background: #f7f9fc;
}

.dashboard-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 20px;
    padding: clamp(24px, 4vw, 38px);
    border-radius: 12px;
    background:
        radial-gradient(circle at 92% 18%, rgba(181, 139, 96, 0.25), transparent 28%),
        linear-gradient(135deg, var(--brand-dark), var(--brand));
    color: #ffffff;
    box-shadow: 0 18px 42px rgba(20, 47, 93, 0.18);
}

.dashboard-kicker,
.panel-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.dashboard-intro h2 {
    font-size: clamp(1.55rem, 3vw, 2.25rem);
}

.dashboard-intro p {
    margin: 10px 0 0;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.55;
}

.dashboard-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 10px;
}

.dashboard-intro .primary-btn {
    background: #ffffff;
    color: var(--brand-dark);
}

.dashboard-intro .secondary-btn {
    border-color: rgba(255, 255, 255, 0.36);
    background: transparent;
    color: #ffffff;
}

.admin-page-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 20px;
    padding: 26px 28px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 28px rgba(22, 38, 66, 0.04);
}

.admin-page-intro h2 {
    color: var(--brand-dark);
    font-size: clamp(1.35rem, 2.2vw, 1.8rem);
}

.admin-page-intro p {
    max-width: 720px;
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.form-page-intro {
    align-items: flex-start;
}

.list-panel {
    overflow: hidden;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.metric-card,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 32px rgba(22, 38, 66, 0.06);
}

.metric-card {
    position: relative;
    padding: 22px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.metric-card:hover {
    border-color: #bfcddd;
    box-shadow: 0 16px 36px rgba(22, 38, 66, 0.1);
    transform: translateY(-2px);
}

.metric-card span,
.muted {
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin: 8px 0 7px;
    color: var(--brand-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
}

.metric-card small {
    color: #7a879d;
    line-height: 1.4;
}

.metric-card-published {
    border-top: 3px solid var(--success);
}

.metric-card-draft {
    border-top: 3px solid var(--gold);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
    gap: 20px;
}

.panel {
    padding: 26px;
}

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

.primary-btn,
.secondary-btn,
.actions a,
.actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}

.primary-btn {
    background: var(--brand);
    color: #ffffff;
}

.primary-btn:hover {
    background: var(--brand-dark);
    box-shadow: 0 8px 18px rgba(20, 47, 93, 0.18);
}

.secondary-btn {
    border-color: var(--line);
    background: #ffffff;
    color: var(--brand);
}

.secondary-btn:hover {
    border-color: #b8c7da;
    background: #f5f8fc;
}

.status-list,
.activity-list {
    display: grid;
    gap: 0;
}

.status-list div,
.activity-item {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.quick-link-list {
    display: grid;
    gap: 10px;
}

.quick-link-list > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fbfcfe;
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.quick-link-list > a:hover {
    border-color: #b8c8dc;
    background: #f3f7fb;
}

.quick-link-list span {
    display: grid;
    gap: 5px;
}

.quick-link-list strong {
    color: var(--brand-dark);
}

.quick-link-list small {
    color: var(--muted);
    font-weight: 400;
    line-height: 1.45;
}

.quick-link-list b {
    color: var(--gold);
    font-size: 2rem;
    font-weight: 400;
}

.activity-item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 13px;
    padding: 14px 0;
}

.activity-item:first-child {
    padding-top: 0;
}

.activity-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.activity-marker {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 4px rgba(181, 139, 96, 0.14);
}

.activity-item > div {
    min-width: 0;
}

.activity-item span:not(.activity-marker),
.activity-item p,
td small {
    display: block;
    color: var(--muted);
}

.activity-item span:not(.activity-marker) {
    margin-top: 3px;
    font-size: 0.78rem;
}

.activity-item p {
    margin: 7px 0 0;
    font-size: 0.9rem;
    line-height: 1.45;
}

.dashboard-empty {
    padding: 28px;
    border: 1px dashed #c7d2e1;
    border-radius: 9px;
    background: #f8fafc;
    text-align: center;
}

.dashboard-empty p {
    margin: 7px 0 0;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    margin: 0 -26px;
}

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

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

th {
    background: #f6f8fb;
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

tbody tr {
    transition: background-color 0.16s ease;
}

tbody tr:hover {
    background: #f9fbfd;
}

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

th:first-child,
td:first-child {
    padding-left: 26px;
}

th:last-child,
td:last-child {
    padding-right: 26px;
}

td > strong:first-child {
    color: var(--brand-dark);
}

td small {
    margin-top: 4px;
    line-height: 1.35;
}

.status-pill {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e9f4ee;
    color: var(--success);
    font-weight: 800;
}

.status-draft,
.status-inactive {
    background: #f4efe8;
    color: #8a633d;
}

.status-archived,
.status-off_market,
.status-suspended {
    background: #fff0f0;
    color: var(--danger);
}

.status-under_offer {
    background: #fff6dd;
    color: #8b6500;
}

.status-sold {
    background: #edf0f4;
    color: #526079;
}

.status-active,
.status-published,
.status-for_sale {
    background: #e9f4ee;
    color: var(--success);
}

.publish-pill {
    background: #edf4fb;
    color: var(--brand);
}

.mini-badge,
.type-label {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f0e8df;
    color: #805d39;
    font-size: 0.7rem;
    font-weight: 800;
}

.type-label {
    margin-top: 0;
    background: #edf3fa;
    color: var(--brand);
    font-size: 0.76rem;
}

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

.actions form {
    margin: 0;
}

.actions a,
.actions button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.82rem;
}

.actions a {
    border-color: var(--line);
    background: #ffffff;
    color: var(--brand);
}

.actions a:hover {
    background: #edf4fb;
}

.actions button {
    background: #fff1f1;
    color: var(--danger);
}

.actions button:hover {
    background: #f9dddd;
}

.admin-empty-state {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: clamp(40px, 8vw, 80px) 24px;
    border: 1px dashed #c9d4e2;
    border-radius: 9px;
    background: #f8fafc;
    text-align: center;
}

.admin-empty-state strong {
    color: var(--brand-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
}

.admin-empty-state p {
    max-width: 480px;
    margin: 0 0 6px;
    color: var(--muted);
}

.admin-pagination {
    margin-top: 24px;
}

.admin-pagination:empty {
    display: none;
}

.admin-pagination .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-pagination .pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #ffffff;
    color: var(--brand);
    font-weight: 700;
}

.admin-pagination .pagination .active a,
.admin-pagination .pagination a:hover {
    border-color: var(--brand);
    background: var(--brand);
    color: #ffffff;
}

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

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

.admin-form-panel {
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(24px, 4vw, 38px);
    gap: 20px 22px;
}

.compact-form-panel {
    max-width: 820px;
}

label,
.rte-field {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-weight: 700;
}

label > small,
.rte-field > small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.45;
}

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

.checkbox-label input {
    width: 18px;
    min-height: 18px;
}

input,
select,
textarea,
.rich-editor {
    width: 100%;
    min-height: 44px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
}

input:hover,
select:hover,
textarea:hover,
.rich-editor:hover {
    border-color: #b9c7d9;
}

input:focus,
select:focus,
textarea:focus,
.rich-editor:focus {
    border-color: var(--brand);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(33, 74, 132, 0.11);
}

input[type="file"] {
    padding: 8px;
    background: #f8fafc;
    color: var(--muted);
}

input[type="file"]::file-selector-button {
    min-height: 36px;
    margin-right: 12px;
    padding: 0 13px;
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
}

textarea,
.rich-editor {
    min-height: 140px;
    resize: vertical;
}

.rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rte-toolbar button {
    min-width: 40px;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f7f9fc;
    cursor: pointer;
    font-weight: 800;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-actions-sticky {
    position: sticky;
    bottom: 14px;
    z-index: 5;
    margin: 10px -12px -12px;
    padding: 16px 18px;
    border: 1px solid rgba(217, 224, 235, 0.92);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 35px rgba(22, 38, 66, 0.14);
    backdrop-filter: blur(10px);
}

.form-section-title {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 20px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}

.admin-form-panel .form-section-title:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.form-section-title > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #edf3fa;
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 900;
}

.form-section-title h2 {
    color: var(--brand-dark);
    font-size: 1.25rem;
}

.form-section-title p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 400;
    line-height: 1.45;
}

.admin-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.admin-image-item {
    display: grid;
    gap: 8px;
}

.admin-image-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
}

.admin-image-item span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-upload {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.current-upload img {
    width: min(100%, 240px);
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
}

.current-upload span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.feature-group,
.property-picker {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9fc;
}

.feature-group {
    align-content: start;
}

.property-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 360px;
    overflow-y: auto;
}

.feature-group legend {
    padding: 0 8px;
    color: var(--brand);
    font-weight: 800;
}

.notice {
    margin-bottom: 16px;
    padding: 13px 16px;
    border-radius: 8px;
    font-weight: 700;
}

.notice.success {
    background: #e8f5ee;
    color: var(--success);
}

.notice.error {
    background: #fff0f0;
    color: var(--danger);
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
    gap: 20px;
    align-items: start;
}

.settings-form {
    margin: 0;
}

.audit-panel {
    position: sticky;
    top: 24px;
}

.admin-info-box {
    padding: 16px 18px;
    border-left: 3px solid var(--brand);
    border-radius: 6px;
    background: #edf4fb;
    color: #425470;
    line-height: 1.55;
}

.auth-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(247, 250, 252, 0.82) 0%, rgba(223, 232, 243, 0.62) 100%),
        url('/assets/img/Home.webp') center / cover no-repeat;
}

.auth-panel {
    width: min(100%, 440px);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 22px 60px rgba(22, 38, 66, 0.14);
}

.auth-panel .primary-btn {
    min-height: 48px;
}

.auth-panel label {
    font-size: 0.9rem;
}

.auth-panel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.home-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9fc;
    color: var(--brand);
}

.home-icon-btn:hover {
    background: #edf4fb;
    color: var(--brand-dark);
}

.home-icon-btn svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
}

.auth-panel h1 {
    margin-top: 24px;
}

.auth-panel p,
.text-link {
    color: var(--muted);
}

.text-link {
    display: inline-block;
    margin-top: 18px;
    font-weight: 700;
}

@media (max-width: 980px) {
    .dashboard-grid,
    .metric-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .admin-shell {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .admin-sidebar {
        padding: 24px 18px;
    }

    .dashboard-intro {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .audit-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .admin-shell {
        display: block;
    }

    .admin-main,
    .admin-sidebar,
    .auth-panel {
        padding: 20px;
    }

    .admin-sidebar {
        position: static;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .admin-brand {
        margin-bottom: 20px;
    }

    .admin-brand img {
        width: 150px;
    }

    .admin-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-topbar,
    .panel-header,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-profile {
        justify-content: space-between;
        width: 100%;
    }

    .admin-profile-copy {
        justify-items: start;
    }

    .dashboard-intro {
        padding: 24px 20px;
    }

    .admin-page-intro {
        align-items: stretch;
        flex-direction: column;
        padding: 22px 20px;
    }

    .admin-page-intro > a {
        width: 100%;
    }

    .dashboard-actions,
    .dashboard-actions a {
        width: 100%;
    }

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

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

    .admin-form-panel {
        padding: 22px 18px;
    }

    .form-section-title {
        gap: 11px;
    }

    .form-actions-sticky {
        position: static;
        margin: 10px 0 0;
        box-shadow: none;
    }

    .form-actions a,
    .form-actions button {
        width: 100%;
    }

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

    .actions {
        align-items: stretch;
    }

    .actions a,
    .actions button {
        width: 100%;
    }
}
