:root {
    --purple: #4B1853;
    --purple-light: #6b3a7d;
    --purple-deep: #3a1040;
    --gold: #b27f2c;
    --gold-light: #d4a84e;
    --tmg-gradient: linear-gradient(134deg, #4b1853 0%, #b27f2c 95%, #a87c2c 100%);
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --bg: #f7f7f7;
    --card-bg: #fff;
    --text: #222;
    --text-muted: #717171;
    --border: #e0e0e0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,.12);
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 15px; } }

body {
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--purple); text-decoration: none; }
a:hover { color: var(--purple-light); text-decoration: underline; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--purple);
    color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.15);
}
.sidebar-brand a {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
}
.sidebar-logo {
    width: 32px;
    height: 32px;
    filter: brightness(0) invert(1);
}

.sidebar-nav {
    list-style: none;
    padding: 12px 0;
    margin: 0;
    flex: 1;
}
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,.75);
    font-size: .95rem;
    transition: all .15s;
    text-decoration: none;
}
.sidebar-nav li a:hover,
.sidebar-nav li.active a {
    background: rgba(255,255,255,.12);
    color: #fff;
}
.sidebar-nav li.active a {
    border-left: 3px solid var(--gold);
    padding-left: 17px;
}
.sidebar-nav li a i { width: 20px; text-align: center; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.15);
    font-size: .85rem;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user i { font-size: 1.2rem; }

/* ── Page Content Wrapper ── */
#page-content-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: margin-left .25s ease;
}

/* ── Topbar ── */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar .btn-link { color: var(--text); font-size: 1.2rem; }
.topbar-greeting { font-weight: 600; font-size: 1.05rem; }

/* ── Content Area ── */
.content-area { padding: 24px; max-width: 1200px; }

/* ── Toggle Sidebar (mobile) ── */
#wrapper.toggled .sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
#wrapper.toggled #page-content-wrapper { margin-left: 0; width: 100%; }

@media (max-width: 768px) {
    .sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
    #page-content-wrapper { margin-left: 0; width: 100%; }
    #wrapper.toggled .sidebar { margin-left: 0; }
    #wrapper.toggled #page-content-wrapper { margin-left: var(--sidebar-width); }
}

/* ── Page Header ── */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-weight: 700; margin-bottom: 4px; }

/* ── Stat Cards ── */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow-hover); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}
.bg-purple  { background: var(--purple); }
.bg-blue    { background: #2980b9; }
.bg-green   { background: #27ae60; }
.bg-gold    { background: var(--gold); }
.bg-red     { background: #e74c3c; }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--text-muted); font-size: .85rem; }

/* ── Section Cards ── */
.section-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.section-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.text-purple { color: var(--purple) !important; }

/* ── Property Cards ── */
.property-card-link { text-decoration: none !important; color: inherit; }
.property-card {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow .2s, transform .2s;
    background: var(--card-bg);
}
.property-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.property-card-img {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: #e0e0e0;
    position: relative;
}
.property-card-status {
    position: absolute;
    top: 12px;
    right: 12px;
}

.property-card-body { padding: 16px; }
.property-card-body h6 {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.property-card-meta {
    display: flex;
    gap: 12px;
    color: var(--text-muted);
    font-size: .85rem;
}
.property-card-meta i { margin-right: 3px; }

/* ── Detail Grid ── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.detail-item.full-width { grid-column: 1 / -1; }
.detail-label {
    display: block;
    font-size: .8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 2px;
}
.detail-value { font-weight: 500; }
.rate-value { font-size: 1.2rem; color: var(--purple); }
.rate-value small { font-size: .75rem; color: var(--text-muted); margin-left: 2px; }

/* ── Finance Breakdown ── */
.finance-breakdown { }
.finance-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: .95rem;
}
.finance-row:last-child { border-bottom: none; }
.total-row { border-top: 2px solid var(--text); margin-top: 4px; padding-top: 12px; }

.payout-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--purple);
    margin-bottom: 8px;
}

/* ── Booking Mini Card ── */
.booking-card {
    display: block;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background .15s;
    color: inherit;
    text-decoration: none;
}
.booking-card:hover { background: var(--bg); text-decoration: none; color: inherit; }

/* ── Listing Banner ── */
.listing-banner {
    height: 300px;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius);
}

/* ── Tables ── */
.table th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-top: none;
}
.table td { vertical-align: middle; }

/* ── Badges ── */
.badge-lg { font-size: .9rem; padding: 6px 14px; }
.badge-success { background: #27ae60; }
.badge-primary { background: var(--purple); }
.badge-warning { background: var(--gold); color: #fff; }
.badge-danger  { background: #e74c3c; }
.badge-secondary { background: #95a5a6; }

/* ── Calendar ── */
.calendar-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: .85rem;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

#calendar .fc-daygrid-event { font-size: .75rem; padding: 1px 4px; border-radius: 4px; }
#calendar .fc-toolbar-title { font-size: 1.2rem; font-weight: 600; }
#calendar .fc-button-primary {
    background: var(--purple) !important;
    border-color: var(--purple) !important;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }

/* ── Buttons ── */
.btn-primary {
    background: var(--purple);
    border-color: var(--purple);
    color: #fff;
}
.btn-primary:hover { background: var(--purple-light); border-color: var(--purple-light); }

.btn-outline-primary {
    color: var(--purple);
    border-color: var(--purple);
}
.btn-outline-primary:hover { background: var(--purple); color: #fff; }

/* ── Landing Page ── */
.public-wrapper { min-height: 100vh; }

.landing-hero {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--purple) 0%, #2c0d33 100%);
    color: #fff;
    text-align: center;
    padding: 48px 24px;
}
.landing-content { max-width: 560px; }
.landing-logo { width: 64px; height: 64px; margin-bottom: 16px; filter: brightness(0) invert(1); }
.landing-hero h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 12px; }
.landing-subtitle { font-size: 1.1rem; color: rgba(255,255,255,.8); margin-bottom: 32px; }

.landing-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.landing-actions .btn { min-width: 160px; }
.landing-actions .btn-outline-primary {
    color: #fff;
    border-color: rgba(255,255,255,.6);
}
.landing-actions .btn-outline-primary:hover {
    background: rgba(255,255,255,.15);
    border-color: #fff;
    color: #fff;
}

.landing-features { padding: 48px 0; background: var(--card-bg); }
.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--purple);
    margin-bottom: 12px;
}
.landing-features h5 { font-weight: 600; }
.landing-features p { color: var(--text-muted); font-size: .9rem; }

.landing-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: .85rem;
}
.landing-footer a { color: var(--purple); }

/* ── Description ── */
.description-content {
    max-height: 300px;
    overflow-y: auto;
    font-size: .9rem;
    line-height: 1.6;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
