@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #fdf6f0;
    --card: #fffaf7;
    --text: #1c1c1c;
    --muted: #5f5a56;
    --line: #dccfc3;
    --accent: #8b1e1e;
    --accent-dark: #6f1717;
    --danger: #8b1e1e;
    --gold: #bfa18c;
    --shadow: 0 8px 28px rgba(28, 28, 28, 0.08);
}

* {
    box-sizing: border-box;
}

img, video {
    max-width: 100%;
    height: auto;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(circle at 8% 2%, rgba(191, 161, 140, 0.18), transparent 38%),
        linear-gradient(180deg, #fef9f4 0%, var(--bg) 24%, var(--bg) 100%);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: min(1200px, 92vw);
    margin: 0 auto;
}

.topbar {
    background: rgba(253, 246, 240, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
    gap: 1rem;
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.125rem;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
    object-fit: contain;
    box-shadow: 0 1px 4px rgba(28,28,28,0.10);
    padding: 2px;
}

.brand-text-wrap {
    display: inline-flex;
    flex-direction: column;
}

.brand-text {
    color: var(--text);
}

.sc-brand-sub {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    display: block;
    margin-top: -2px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--accent);
}

.nav-portal-link {
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent) !important;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.nav-portal-link:hover {
    background: var(--accent);
    color: #fff !important;
}

.page {
    padding: 3rem 0;
}

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 3rem;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 110px;
    background: var(--bg);
    border-right: 1px solid var(--line);
    padding-right: 1.5rem;
}

.sidebar-label {
    margin: 0 0 1.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-nav {
    display: grid;
    gap: 0.5rem;
}

.sidebar-link {
    text-decoration: none;
    color: var(--muted);
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-link:hover {
    color: var(--text);
    background: #f4ebe4;
}

.sidebar-link.active {
    color: #fff7f2;
    background: var(--text);
}

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

.card {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 2.5rem;
    margin-bottom: 2rem;
    border-radius: 0;
}

.hero h1,
.card h1,
.card h2,
.card h3 {
    margin-top: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.card h1 { font-size: 2rem; }
.card h2 { font-size: 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.card h3 { font-size: 1.25rem; }

.muted {
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat.card {
    padding: 2rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--text);
    box-shadow: 4px 4px 0px 0px var(--text);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat.card:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px 0px var(--text);
}

a.stat-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.stat-link:hover h3 {
    color: var(--accent);
}

.stat h3 {
    margin: 0 0 0.5rem 0;
    font-size: 3rem;
    color: var(--text);
    font-weight: 400;
}

.stat p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

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

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

th,
td {
    text-align: left;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
}

.actions-row {
    display: flex;
    gap: 0.75rem;
}

.badge {
    display: inline-block;
    border: 1px solid var(--text);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-good {
    background: var(--text);
    color: var(--bg);
}

.badge-neutral {
    background: var(--bg);
    color: var(--text);
}

.btn,
button,
input,
select,
textarea {
    font: inherit;
    border-radius: 0;
}

.btn,
button {
    border: 1px solid var(--text);
    background: var(--bg);
    color: var(--text);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover,
button:hover {
    background: #f4ebe4;
}

.btn-primary {
    background: var(--accent);
    color: #fff7f2;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-dark);
    color: #fff7f2;
}

.btn-danger {
    background: var(--accent);
    color: #fff7f2;
    border-color: var(--accent);
}

.btn-danger:hover {
    background: #6e1818;
    color: #fff7f2;
    border-color: #6e1818;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.field span {
    font-weight: 500;
    font-size: 0.9rem;
}

.field input,
.field select,
.field textarea {
    border: 1px solid var(--line);
    padding: 0.75rem;
    background: var(--bg);
    transition: border-color 0.2s;
}

.field gmp-place-autocomplete {
    width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 30, 30, 0.12);
}

.location-tools {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.location-tools .btn {
    padding: 0.6rem 0.9rem;
    font-size: 0.82rem;
}

.property-map-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.property-map-wrap > span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.property-map {
    width: 100%;
    height: 480px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #e8e8e8;
    overflow: hidden;
}

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

/* ── Properties & Listings combined page ───────────────────────────────── */

.pl-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.pl-page-header h1 {
    margin: 0 0 0.4rem;
    font-weight: 600;
    font-size: 2rem;
    letter-spacing: -0.02em;
}

.pl-page-sub {
    margin: 0;
    font-size: 0.9rem;
    max-width: 560px;
}

.pl-empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.pl-empty-icon {
    font-size: 3rem;
    margin: 0 0 1rem;
}

.pl-empty-state h2 {
    border: none;
    margin-bottom: 0.75rem;
}

/* ── Property card ──────────────────────────────────────────────────────── */

.prop-card {
    padding: 0;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.prop-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1.75rem 2rem 1.5rem;
    border-bottom: 1px solid var(--line);
}

.prop-card-title {
    margin: 0 0 0.6rem;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    border: none;
    padding: 0;
}

.prop-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.prop-card-tools {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: flex-start;
}

/* ── Listings sub-section inside the property card ──────────────────────── */

.prop-card-listings {
    padding: 1.25rem 2rem 1.5rem;
}

.prop-listings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.prop-listings-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.prop-not-listed-label {
    color: #9b5c00;
}

.prop-listed-label {
    color: #1a6b3a;
}

.prop-listings-table {
    font-size: 0.875rem;
}

.prop-listings-table th {
    font-size: 0.7rem;
}

.prop-listing-price {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ── Units hint strip at the bottom of a property card ──────────────────── */

.prop-units-hint {
    background: #f7f1eb;
    border-top: 1px solid var(--line);
    padding: 0.7rem 2rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.prop-units-hint a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.prop-units-hint a:hover {
    text-decoration: underline;
}

/* ── Listing status badge variants ─────────────────────────────────────── */

.badge-active {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.badge-sold,
.badge-leased {
    background: var(--line);
    color: var(--muted);
    border-color: var(--line);
}

/* ── Small button variant ────────────────────────────────────────────────── */

.btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
}

.publish-intro {
    margin: -0.5rem 0 1.75rem;
    font-size: 0.9rem;
}

.listing-unit-helper {
    border: 1px dashed var(--line);
    background: #f7f1eb;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.listing-unit-helper .btn {
    margin-left: auto;
}

/* ── Units form strategy flow ───────────────────────────────────────────── */

.unit-step {
    border: 1px solid var(--line);
    padding: 1rem 1.25rem;
    background: #fcfaf8;
}

.unit-step + .unit-step {
    margin-top: 0.25rem;
}

.unit-step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.unit-step-header h2 {
    margin: 0;
    font-size: 1rem;
    border: none;
    padding: 0;
}

.unit-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff7f2;
    font-size: 0.78rem;
    font-weight: 700;
}

.unit-step-intro {
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.unit-step-grid {
    gap: 1rem 1.5rem;
}

.unit-target-summary {
    margin-top: 0.5rem;
}

.unit-media-divider {
    border-top: 1px solid var(--line);
    padding-top: 0.9rem;
    margin-top: 0.1rem;
}

.unit-media-divider strong {
    display: block;
    margin-bottom: 0.4rem;
}

.unit-publish-cta {
    border: 1px solid var(--accent);
    background: #f9ede6;
    padding: 1rem 1.1rem;
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.unit-publish-cta p {
    margin: 0.35rem 0 0;
}

.unit-publish-cta-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

@media (max-width: 760px) {
    .unit-step {
        padding: 0.85rem 0.95rem;
    }

    .unit-step-header {
        align-items: flex-start;
    }
}

/* ── Property Hub (advanced management page) ────────────────────────────── */

.hub-back {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.hub-back a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.hub-back a:hover {
    color: var(--accent);
}

.hub-header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
}

.hub-header-main h1 {
    margin-bottom: 0.75rem;
}

.hub-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.hub-location {
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
}

.hub-detail {
    font-size: 0.8rem;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 0.15rem 0.55rem;
}

.hub-desc {
    margin: 0;
    font-size: 0.9rem;
    max-width: 560px;
}

.hub-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.hub-asset-label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-right: 0.3rem;
}

/* ── Preselected asset notice (listing & unit forms) ────────────────────── */

.preselected-asset-notice {
    background: #f7f1eb;
    border: 1px solid var(--line);
    padding: 1rem 1.25rem;
    margin-bottom: 0;
}

.preselected-asset-notice > span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    display: block;
    margin-bottom: 0.35rem;
}

.preselected-asset-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.preselected-asset-notice a {
    color: var(--accent);
    font-size: 0.82rem;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.breadcrumb-link {
    color: var(--muted);
    text-decoration: none;
}

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

.breadcrumb-sep {
    color: var(--line);
    font-size: 0.9rem;
}

.breadcrumb-current {
    color: var(--text);
    font-weight: 500;
}

.alert {
    padding: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--text);
    font-weight: 500;
    font-size: 0.9rem;
}

.alert-success {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff7f2;
}

.alert-error {
    background: var(--bg);
    color: var(--text);
    border-style: dashed;
}

.user-pill {
    border: 1px solid var(--text);
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.inline-form {
    display: inline;
}

.link-btn {
    border: 0;
    background: transparent;
    color: var(--text);
    font-weight: 500;
    padding: 0;
    text-decoration: underline;
}

.link-btn:hover {
    background: transparent;
    color: var(--accent);
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    width: 100%;
    padding-right: 5.9rem;
    border-radius: 0.6rem;
    background: #fff;
}

.pw-toggle {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    transform: translateY(-50%);
    min-width: 5rem;
    height: 2rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0 0.55rem;
    background: #fff;
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(28, 28, 28, 0.08);
}

.pw-toggle .pw-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pw-toggle .pw-icon-hide {
    display: none;
}

.pw-toggle.is-revealed .pw-icon-show {
    display: none;
}

.pw-toggle.is-revealed .pw-icon-hide {
    display: inline-flex;
}

.pw-toggle svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pw-toggle:hover,
.pw-toggle:focus-visible {
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 30, 30, 0.14);
}

.auth-card {
    max-width: 520px;
    margin: 4rem auto;
    border: 1px solid var(--text);
    box-shadow: 10px 10px 0px 0px rgba(28, 28, 28, 0.85);
    background: linear-gradient(180deg, #fffdfb 0%, #fff7f1 100%);
    padding: 2.2rem;
}

.auth-card .field span {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.auth-card .btn-primary {
    min-height: 2.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

@media (max-width: 480px) {
    .password-wrap input {
        padding-right: 4.95rem;
    }

    .pw-toggle {
        min-width: 4.2rem;
        font-size: 0.66rem;
        padding: 0 0.42rem;
    }
}

.auth-meta {
    margin-top: 1.2rem;
    text-align: center;
    font-size: 0.92rem;
}

.role-hero {
    background: var(--text);
    color: var(--bg);
    border: none;
}

.role-hero h1 {
    color: var(--bg);
}

.role-hero .muted {
    color: #a0a0a0;
}

/* ── Image Gallery ──────────────────────────────────────────────────────── */

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.image-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.image-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 4px;
    background: #f4f4f4;
    display: block;
}

.image-card form {
    margin: 0;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.image-card .order-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.9em;
    font-weight: 500;
}

.image-card .order-input {
    width: 70px;
    padding: 0.35rem 0.5rem;
}

.image-card .caption-input {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.5rem;
}

.image-meta {
    font-size: 0.85em;
    margin: auto 0 0 0;
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding-right: 0;
        padding-bottom: 1.5rem;
    }

    .sidebar-nav {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

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

    .topbar-inner {
        min-height: 64px;
        flex-direction: column;
        padding: 1rem 0;
        gap: 1rem;
    }
}
