:root {
    --crm-bg: #f6f8fb;
    --crm-surface: #ffffff;
    --crm-surface-muted: #f8fafc;
    --crm-border: #d9e0ea;
    --crm-ink: #122033;
    --crm-muted: #5e6b7c;
    --crm-navy: #0c2238;
    --crm-navy-soft: #163450;
    --crm-gold: #b9903f;
    --crm-gold-soft: #fbf5e8;
    --crm-success: #1f8a5b;
    --crm-success-soft: #e8f6ef;
    --crm-warning: #966b12;
    --crm-warning-soft: #fff5dc;
    --crm-danger: #b42318;
    --crm-danger-soft: #fef0ee;
    --crm-radius: 8px;
    --sidebar-width: 284px;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--crm-bg);
    color: var(--crm-ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1,
h2,
h3 {
    color: var(--crm-ink);
    letter-spacing: 0;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

a {
    color: var(--crm-navy);
}

.btn,
.form-control,
.form-select,
.input-group-text {
    border-radius: var(--crm-radius);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 650;
}

.btn-primary {
    --bs-btn-bg: var(--crm-navy);
    --bs-btn-border-color: var(--crm-navy);
    --bs-btn-hover-bg: var(--crm-navy-soft);
    --bs-btn-hover-border-color: var(--crm-navy-soft);
    --bs-btn-focus-shadow-rgb: 12, 34, 56;
}

.btn-outline-secondary {
    --bs-btn-color: var(--crm-ink);
    --bs-btn-border-color: var(--crm-border);
    --bs-btn-hover-bg: var(--crm-surface-muted);
    --bs-btn-hover-border-color: #c7d1df;
    --bs-btn-hover-color: var(--crm-ink);
}

.form-label {
    color: var(--crm-ink);
    font-size: 0.86rem;
    font-weight: 700;
}

.form-control,
.form-select,
.input-group-text {
    border-color: var(--crm-border);
    color: var(--crm-ink);
}

.input-group-text {
    background: var(--crm-surface-muted);
    color: var(--crm-muted);
}

.form-control::placeholder {
    color: #68778a;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--crm-gold);
    box-shadow: 0 0 0 0.2rem rgba(185, 144, 63, 0.18);
}

.text-muted {
    color: var(--crm-muted) !important;
}

.auth-page {
    min-height: 100vh;
    background: var(--crm-bg);
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 420px);
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 28px;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.app-sidebar {
    position: sticky;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    flex: 0 0 var(--sidebar-width);
    flex-direction: column;
    gap: 22px;
    padding: 22px;
    background: var(--crm-navy);
    color: #f7f9fc;
}

.app-offcanvas {
    --bs-offcanvas-width: min(88vw, 320px);
    background: var(--crm-navy);
    color: #f7f9fc;
}

.app-offcanvas .offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.app-offcanvas .btn-close {
    filter: invert(1) grayscale(1);
}

.app-offcanvas .offcanvas-body {
    display: flex;
    flex-direction: column;
    padding: 18px;
}

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

.brand-mark {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: var(--crm-radius);
    background: var(--crm-gold);
    color: #111827;
    font-size: 0.84rem;
    font-weight: 800;
}

.brand-title,
.brand-subtitle {
    display: block;
}

.brand-title {
    max-width: 176px;
    overflow: hidden;
    color: #ffffff;
    font-weight: 760;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-subtitle {
    margin-top: 2px;
    color: #b8c4d3;
    font-size: 0.82rem;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 10px 12px;
    border-radius: var(--crm-radius);
    color: #c7d3e2;
    text-decoration: none;
    transition: background-color 180ms ease, color 180ms ease;
}

.sidebar-link i {
    width: 20px;
    color: var(--crm-gold);
    font-size: 1rem;
}

.sidebar-link:hover,
.sidebar-link:focus-visible,
.sidebar-link.is-active {
    background: var(--crm-navy-soft);
    color: #ffffff;
}

.sidebar-link.is-active {
    outline: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-link.is-disabled {
    cursor: not-allowed;
    opacity: 0.56;
}

.sidebar-link-copy {
    display: grid;
    gap: 2px;
}

.sidebar-link-label {
    font-weight: 720;
    line-height: 1.2;
}

.sidebar-link-hint {
    color: #a7b5c7;
    font-size: 0.8rem;
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--crm-radius);
}

.profile-avatar {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--crm-gold-soft);
    color: var(--crm-navy);
    font-weight: 800;
}

.profile-copy {
    min-width: 0;
    display: grid;
}

.profile-name {
    overflow: hidden;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-role {
    color: #a7b5c7;
    font-size: 0.82rem;
}

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

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: 68px;
    align-items: center;
    gap: 14px;
    padding: 12px clamp(16px, 3vw, 32px);
    background: var(--crm-surface);
    border-bottom: 1px solid var(--crm-border);
}

.topbar-copy {
    display: grid;
    gap: 1px;
}

.topbar-context {
    color: var(--crm-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.topbar-copy strong {
    color: var(--crm-ink);
    line-height: 1.2;
}

.icon-button {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--crm-border);
    background: var(--crm-surface);
}

.menu-lines,
.menu-lines::before,
.menu-lines::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--crm-ink);
    border-radius: 999px;
    content: "";
}

.menu-lines {
    position: relative;
}

.menu-lines::before,
.menu-lines::after {
    position: absolute;
    left: 0;
}

.menu-lines::before {
    top: -6px;
}

.menu-lines::after {
    top: 6px;
}

.app-main {
    padding: clamp(18px, 3vw, 32px);
}

.content-wrap {
    width: min(100%, 1240px);
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.page-heading-copy {
    max-width: 74ch;
}

.page-heading h1 {
    margin: 0 0 6px;
    font-size: 1.7rem;
    font-weight: 780;
    line-height: 1.2;
}

.page-heading p {
    margin: 0;
    color: var(--crm-muted);
}

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

.stat-card {
    display: flex;
    min-height: 112px;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
}

.stat-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border-radius: var(--crm-radius);
    background: var(--crm-gold-soft);
    color: var(--crm-navy);
}

.stat-icon-success {
    background: var(--crm-success-soft);
    color: var(--crm-success);
}

.stat-icon-gold {
    background: var(--crm-gold-soft);
    color: var(--crm-warning);
}

.stat-icon-danger {
    background: var(--crm-danger-soft);
    color: var(--crm-danger);
}

.stat-label {
    color: var(--crm-muted);
    font-size: 0.86rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.stat-value {
    color: var(--crm-ink);
    font-size: 1.9rem;
    font-weight: 780;
    line-height: 1.1;
}

.dashboard-workspace {
    display: grid;
    grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.45fr);
    gap: 18px;
    align-items: start;
}

.user-dashboard-stat {
    min-height: 124px;
}

.dashboard-action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px;
}

.dashboard-empty-state {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 42px 18px;
    text-align: center;
}

.dashboard-empty-state i {
    color: var(--crm-gold);
    font-size: 2rem;
}

.dashboard-empty-state h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 760;
}

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

.attention-list {
    display: grid;
}

.attention-item {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1.1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--crm-border);
}

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

.attention-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.attention-tags span {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--crm-warning-soft);
    color: var(--crm-warning);
    font-size: 0.78rem;
    font-weight: 720;
}

.attention-complete {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px;
    color: var(--crm-success);
    font-weight: 720;
}

.data-panel,
.form-section {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    border-bottom: 1px solid var(--crm-border);
}

.panel-header h2,
.section-heading h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 760;
}

.panel-header p,
.section-heading p {
    margin: 3px 0 0;
    color: var(--crm-muted);
    font-size: 0.9rem;
}

.panel-meta {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    padding: 6px 9px;
    border-radius: 999px;
    background: var(--crm-gold-soft);
    color: #74530c;
    font-size: 0.78rem;
    font-weight: 760;
}

.status-chart {
    display: grid;
    gap: 16px;
    padding: 18px;
}

.status-row {
    display: grid;
    gap: 8px;
}

.status-row-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.9rem;
}

.status-row-label span {
    color: var(--crm-muted);
    font-weight: 700;
}

.status-track {
    overflow: hidden;
    height: 9px;
    border-radius: 999px;
    background: #e8edf4;
}

.status-bar {
    display: block;
    min-width: 4px;
    height: 100%;
    border-radius: inherit;
    background: var(--crm-navy);
}

.status-bar.is-available {
    background: var(--crm-success);
}

.status-bar.is-sold {
    background: var(--crm-gold);
}

.status-bar.is-pending {
    background: #244b9b;
}

.status-bar.is-draft {
    background: #7d8a9b;
}

.database-table {
    min-width: 860px;
    color: var(--crm-ink);
}

.database-table thead th {
    border-bottom: 1px solid var(--crm-border);
    background: var(--crm-surface-muted);
    color: #465568;
    font-size: 0.78rem;
    font-weight: 780;
    text-transform: uppercase;
}

.database-table > :not(caption) > * > * {
    padding: 0.88rem 1rem;
    border-color: var(--crm-border);
}

.table-title {
    color: var(--crm-ink);
    font-weight: 740;
    line-height: 1.25;
}

.table-subtitle {
    margin-top: 2px;
    color: var(--crm-muted);
    font-size: 0.84rem;
}

.crm-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 28px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 760;
}

.crm-badge {
    background: var(--crm-gold-soft);
    color: #74530c;
}

.status-draft {
    background: var(--crm-warning-soft);
    color: var(--crm-warning);
}

.status-pending_review {
    background: #eef3ff;
    color: #244b9b;
}

.status-published {
    background: var(--crm-success-soft);
    color: var(--crm-success);
}

.status-archived {
    background: var(--crm-danger-soft);
    color: var(--crm-danger);
}

.spec-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.spec-inline span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 7px;
    border: 1px solid var(--crm-border);
    border-radius: 999px;
    color: var(--crm-muted);
    font-size: 0.78rem;
    font-weight: 680;
}

.empty-table-cell {
    padding: 34px 18px !important;
    color: var(--crm-muted);
    text-align: center;
}

.filter-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1.4fr) repeat(5, minmax(150px, 1fr)) auto;
    gap: 14px;
    align-items: end;
    padding: 18px;
}

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

.filter-search {
    min-width: 260px;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.management-table-wrap {
    min-height: 280px;
}

.property-owner-table {
    min-width: 980px;
}

.table-thumb {
    width: 64px;
    height: 48px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface-muted);
    color: var(--crm-muted);
}

.table-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.action-group {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
    gap: 18px;
    align-items: start;
}

.detail-gallery-panel {
    overflow: hidden;
}

.detail-hero-image {
    min-height: 420px;
    background: var(--crm-surface-muted);
}

.detail-hero-image img,
.gallery-strip img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-placeholder {
    min-height: 420px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    color: var(--crm-muted);
}

.image-placeholder i {
    font-size: 2rem;
}

.gallery-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--crm-border);
}

.gallery-strip img {
    height: 86px;
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
}

.detail-summary {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.detail-summary div,
.spec-grid div,
.location-list div {
    padding: 12px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface-muted);
}

.detail-summary span,
.spec-grid dt,
.location-list dt {
    display: block;
    margin-bottom: 4px;
    color: var(--crm-muted);
    font-size: 0.78rem;
    font-weight: 760;
}

.detail-summary strong,
.spec-grid dd,
.location-list dd {
    margin: 0;
    color: var(--crm-ink);
    font-weight: 760;
}

.spec-grid,
.location-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 18px;
}

.location-list div:last-child {
    grid-column: 1 / -1;
}

.spec-grid .spec-grid-wide {
    grid-column: 1 / -1;
}

.facility-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px;
}

.facility-pill-list > span {
    display: inline-grid;
    gap: 3px;
    align-items: start;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--crm-gold-soft);
    color: #74530c;
    font-size: 0.86rem;
    font-weight: 720;
}

.facility-pill-list > span small {
    max-width: 280px;
    color: #6c5114;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.35;
}

.data-entry-form {
    display: grid;
    gap: 18px;
}

.form-section {
    padding: 18px;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--crm-border);
}

.section-heading i {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    border-radius: var(--crm-radius);
    background: var(--crm-gold-soft);
    color: #74530c;
}

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

.facility-card {
    display: grid;
    gap: 10px;
    align-content: start;
}

.facility-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface-muted);
    font-weight: 650;
}

.facility-note-field {
    padding: 10px 12px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: #ffffff;
}

.facility-note-field .form-label {
    margin-bottom: 6px;
    font-size: 0.78rem;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.existing-image-manager,
.gallery-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.gallery-uploader {
    display: grid;
    gap: 14px;
}

.existing-image-item {
    overflow: hidden;
    display: grid;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface-muted);
}

.existing-image-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.existing-image-meta {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    color: var(--crm-muted);
    font-size: 0.82rem;
    font-weight: 680;
}

.cover-label {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--crm-gold-soft);
    color: #74530c;
    font-size: 0.75rem;
    font-weight: 760;
}

.image-preview-item {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    background: var(--crm-surface-muted);
}

.image-preview-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.image-preview-item span {
    display: block;
    overflow: hidden;
    padding: 8px;
    color: var(--crm-muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(12, 34, 56, 0.86);
    color: #ffffff;
    font-size: 1rem;
    line-height: 1;
}

.form-submit-bar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 0 0;
    background: var(--crm-bg);
}

.table-panel,
.form-panel {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
}

.table-panel-header {
    padding: 18px;
    border-bottom: 1px solid var(--crm-border);
}

.form-panel {
    padding: 20px;
}

.badge {
    font-weight: 700;
}

@media (max-width: 1199.98px) {
    .filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filter-search {
        grid-column: 1 / -1;
    }
}

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

    .content-wrap {
        width: 100%;
    }

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

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

    .attention-item {
        grid-template-columns: 1fr;
        align-items: start;
    }
}

@media (max-width: 767.98px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }

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

    .filter-actions {
        flex-direction: column;
    }

    .filter-actions .btn,
    .dashboard-action-grid .btn,
    .page-actions .btn,
    .form-submit-bar .btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .app-topbar {
        min-height: 62px;
    }

    .app-main {
        padding: 16px;
    }

    .page-heading {
        flex-direction: column;
    }

    .page-actions {
        width: 100%;
    }

    .page-heading h1 {
        font-size: 1.45rem;
    }

    .panel-header,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-section {
        padding: 16px;
    }

    .form-submit-bar {
        flex-direction: column-reverse;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
