:root {
    --sidebar-w: 240px;
    --sidebar-bg: #1a231f;
    --sidebar-text: #a8a190;
    --accent: #1a6b4f;
    --accent-dark: #134f3a;
    --accent-soft: #e6efe9;
    --gold: #c9a24b;
    --ink: #221f1a;
    --ink-soft: #4a4438;
    --muted: #8c8476;
    --border: #e7e1d3;
    --bg: #f8f5ee;
    --surface: #ffffff;
}

/* ── Fonts ── */
body, .form-control, .form-select, .btn, table, input, select, textarea {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
h1, h2, h3, .font-display,
.sidebar-brand span, .stat-value, .property-card-price, .login-card h1,
.page-header h1, .pipeline-card .card-name {
    font-family: 'Fraunces', Georgia, serif;
    letter-spacing: -.01em;
}

/* ── Quick-add floating button ── */
.quick-add-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    box-shadow: 0 10px 24px rgba(26,107,79,.35);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1030;
    transition: transform .15s, background .15s;
}
.quick-add-fab:hover { transform: scale(1.06); background: var(--accent-dark); color: #fff; }

body {
    background: var(--bg);
    margin: 0;
    color: var(--ink);
}

/* ── Sidebar ── */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transition: transform .2s;
    border-right: 1px solid rgba(201,162,75,.12);
}

.sidebar-brand {
    padding: 1.35rem 1.15rem;
    border-bottom: 1px solid rgba(201,162,75,.14);
    display: flex; align-items: center; gap: .7rem;
}
.sidebar-brand .brand-icon {
    width: 36px; height: 36px; border-radius: 9px;
    background: var(--gold); display: flex;
    align-items: center; justify-content: center;
    font-size: 1rem; color: #24301f; flex-shrink: 0;
}
.sidebar-brand span { font-weight: 600; font-size: 1.08rem; color: #f6f3ea; }
.sidebar-brand .agency-name { display: block; font-weight: 400; font-size: .72rem; color: #8c8474; font-family: 'Inter', sans-serif; letter-spacing: 0; }

.sidebar-nav { flex: 1; padding: .75rem 0; list-style: none; margin: 0; }
.sidebar-nav .nav-section {
    font-size: .65rem; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: #6b6656;
    padding: 1.1rem 1.15rem .4rem;
}
.sidebar-nav li a {
    display: flex; align-items: center; gap: .65rem;
    padding: .58rem 1.15rem; color: var(--sidebar-text);
    text-decoration: none; font-size: .87rem;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.sidebar-nav li a:hover { color: #f6f3ea; background: rgba(201,162,75,.08); }
.sidebar-nav li a.active {
    color: #fff; background: rgba(201,162,75,.14);
    border-left-color: var(--gold);
}
.sidebar-nav li a i { width: 18px; text-align: center; font-size: .95rem; }

.sidebar-footer {
    padding: 1rem 1.15rem;
    border-top: 1px solid rgba(201,162,75,.14);
    display: flex; align-items: center; gap: .65rem;
    font-size: .82rem; color: var(--sidebar-text);
}
.sidebar-footer .user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--gold); color: #24301f;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.sidebar-footer .user-name { font-weight: 500; color: #f0ece0; font-size: .84rem; }

.logout-btn {
    display: flex; align-items: center;
    padding: .6rem 1.15rem;
    color: #a8a190; text-decoration: none;
    font-size: .84rem;
    border-top: 1px solid rgba(201,162,75,.08);
    transition: all .15s;
}
.logout-btn:hover { color: #e18b6f; background: rgba(225,139,111,.08); }
.logout-btn.account-link:hover { color: var(--gold); background: rgba(201,162,75,.1); }

/* ── Main ── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }

.page-header {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 1.15rem 1.75rem;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; font-weight: 600; color: var(--ink); margin: 0; }

.content-body { padding: 1.75rem; }

/* ── Flash ── */
.flash-wrap { padding: .75rem 1.75rem 0; }
.alert-success { background: var(--accent-soft); color: var(--accent-dark); border-color: rgba(26,107,79,.2); }

/* ── Stat cards ── */
.stat-card {
    background: var(--surface); border-radius: 14px;
    padding: 1.25rem 1.3rem;
    box-shadow: 0 1px 2px rgba(34,31,26,.05), 0 1px 12px rgba(34,31,26,.04);
    border: 1px solid var(--border);
    display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
    width: 46px; height: 46px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.stat-value { font-size: 1.85rem; font-weight: 600; color: var(--ink); line-height: 1; }
.stat-label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 500; margin-top: .3rem; font-family: 'Inter', sans-serif; }

/* ── Cards ── */
.crm-card {
    background: var(--surface); border-radius: 14px;
    box-shadow: 0 1px 2px rgba(34,31,26,.05), 0 1px 12px rgba(34,31,26,.04);
    border: 1px solid var(--border);
    overflow: hidden;
}
.crm-card-header {
    padding: .9rem 1.3rem; border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: .92rem; color: var(--ink);
    display: flex; align-items: center; justify-content: space-between;
    font-family: 'Fraunces', Georgia, serif;
}

/* ── Lead status badges (buyer + seller pipeline) ── */
.status-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .22rem .7rem; border-radius: 20px;
    font-size: .74rem; font-weight: 600;
    font-family: 'Inter', sans-serif;
}
.status-new                { background: #efece1; color: #6b6656; }
.status-contacted          { background: #e3edf1; color: #3c6f8a; }
.status-viewing            { background: #f8e9dc; color: #b5622f; }
.status-offer               { background: #f0e6f2; color: #7c5295; }
.status-closed              { background: var(--accent-soft); color: var(--accent-dark); }
.status-lost                { background: #f7e5e0; color: #b34c3c; }

/* ── Listing status badges (properties) ── */
.listing-active       { background: var(--accent-soft); color: var(--accent-dark); }
.listing-under_offer  { background: #f8e9dc; color: #b5622f; }
.listing-sold         { background: #efece1; color: #6b6656; }
.listing-withdrawn    { background: #f7e5e0; color: #b34c3c; }

/* ── Activity type badges ── */
.outcome-badge {
    display: inline-block; padding: .2rem .6rem;
    border-radius: 20px; font-size: .72rem; font-weight: 600;
    font-family: 'Inter', sans-serif;
}
.outcome-call     { background: #e3edf1; color: #3c6f8a; }
.outcome-viewing  { background: #f8e9dc; color: #b5622f; }
.outcome-note     { background: #efece1; color: #6b6656; }
.outcome-email    { background: #f0e6f2; color: #7c5295; }

/* ── Table ── */
.table-crm th {
    font-size: .73rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .06em; color: var(--muted); border-top: none;
    background: #f5f1e7; white-space: nowrap;
    font-family: 'Inter', sans-serif;
}
.table-crm td { vertical-align: middle; font-size: .875rem; }
.table-crm tbody tr { cursor: pointer; }
.table-crm tbody tr:hover td { background: #f9f7f0; }
.table-crm tbody tr.row-selected td { background: #d8ebe1 !important; font-weight: 600; }
.table-crm tbody tr.row-selected { box-shadow: inset 4px 0 0 var(--accent); }

/* ── Pipeline ── */
.pipeline-board {
    display: flex; gap: .85rem; overflow-x: auto;
    padding-bottom: 1rem; align-items: flex-start;
}
.pipeline-col {
    min-width: 215px; width: 215px; flex-shrink: 0;
    background: #f2eee2; border-radius: 12px;
    padding: .7rem;
    max-height: calc(100vh - 140px); overflow-y: auto;
}
.pipeline-col-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .35rem .25rem .65rem;
    font-size: .75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-soft);
    font-family: 'Inter', sans-serif;
}
.col-count {
    background: #e2dcc8; color: var(--ink-soft);
    border-radius: 20px; padding: .1rem .5rem;
    font-size: .72rem; font-weight: 700;
}
.pipeline-card {
    background: var(--surface); border-radius: 10px;
    padding: .75rem .8rem; margin-bottom: .5rem;
    box-shadow: 0 1px 2px rgba(34,31,26,.07);
    border-left: 3px solid transparent;
    cursor: grab; transition: box-shadow .15s;
    font-size: .84rem; position: relative;
}
.pipeline-card:active { cursor: grabbing; }
.pipeline-card:hover { box-shadow: 0 6px 16px rgba(34,31,26,.12); }
.pipeline-card .card-name { font-weight: 600; color: var(--ink); margin-bottom: .2rem; font-size: .95rem; }
.pipeline-card .card-meta { color: var(--muted); font-size: .78rem; font-family: 'Inter', sans-serif; }
.pipeline-col.drag-target { background: var(--accent-soft); outline: 2px dashed var(--accent); }

/* ── Property cards ── */
.property-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
    gap: 1.1rem;
}
.property-card {
    background: var(--surface); border-radius: 14px; overflow: hidden;
    box-shadow: 0 1px 2px rgba(34,31,26,.05), 0 1px 12px rgba(34,31,26,.04);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit; display: block; transition: transform .15s, box-shadow .15s;
}
.property-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(34,31,26,.12); color: inherit; }
.property-card-thumb {
    height: 112px; background: linear-gradient(135deg,#1a231f,#1a6b4f);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.4); font-size: 2rem;
}
.property-card-body { padding: .9rem 1.05rem; }
.property-card-price { font-weight: 600; font-size: 1.1rem; color: var(--ink); }
.property-card-title { font-size: .85rem; color: var(--ink-soft); margin: .2rem 0; font-family: 'Inter', sans-serif; }
.property-card-meta { font-size: .76rem; color: var(--muted); font-family: 'Inter', sans-serif; }

/* ── Activity log ── */
.call-entry {
    border-left: 3px solid var(--border); padding: .7rem 1.05rem;
    margin-bottom: .45rem; background: #f9f7f0; border-radius: 0 10px 10px 0;
    font-size: .85rem;
}
.call-entry.oc-call    { border-left-color: #3c6f8a; }
.call-entry.oc-viewing { border-left-color: #b5622f; }
.call-entry.oc-note    { border-left-color: #a39c8c; }
.call-entry.oc-email   { border-left-color: #7c5295; }

/* ── Forms ── */
.form-card {
    background: var(--surface); border-radius: 14px;
    box-shadow: 0 1px 2px rgba(34,31,26,.05), 0 1px 12px rgba(34,31,26,.04);
    border: 1px solid var(--border);
    padding: 1.6rem;
}
.form-label { font-weight: 500; font-size: .875rem; color: var(--ink-soft); }
.form-control, .form-select {
    font-size: .875rem;
    border-color: var(--border);
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26,107,79,.15);
}

/* ── Buttons (brand override, applied via .btn-brand) ── */
.btn-brand, .btn-primary.btn-brand {
    background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-brand:hover, .btn-primary.btn-brand:hover {
    background: var(--accent-dark); border-color: var(--accent-dark); color: #fff;
}
.btn-outline-secondary { border-color: var(--border); color: var(--ink-soft); }
.btn-outline-secondary:hover { background: #f2eee2; border-color: var(--border); color: var(--ink); }

/* ── Login / signup page ── */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(150deg, #1a231f 0%, #1a6b4f 100%);
}
.login-card {
    background: var(--surface); border-radius: 18px; padding: 2.75rem;
    width: 100%; max-width: 400px;
    box-shadow: 0 30px 70px rgba(0,0,0,.35);
}
.login-logo {
    width: 54px; height: 54px; border-radius: 13px;
    background: var(--gold); display: flex;
    align-items: center; justify-content: center;
    font-size: 1.5rem; color: #24301f; margin: 0 auto 1.25rem;
}
.login-card h1 { font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

/* ── Days since contact ── */
.days-badge {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .18rem .55rem; border-radius: 20px;
    font-size: .72rem; font-weight: 600; white-space: nowrap;
    font-family: 'Inter', sans-serif;
}
.days-fresh   { background: var(--accent-soft); color: var(--accent-dark); }
.days-ok      { background: #dcebe0; color: #1f5c44; }
.days-warm    { background: #f8ecd2; color: #8a6a1f; }
.days-stale   { background: #f8e9dc; color: #b5622f; }
.days-cold    { background: #f7e5e0; color: #b34c3c; }
.days-never   { background: #efece1; color: var(--muted); }

/* ── Hot flag ── */
.hot-btn {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; opacity: .2; padding: 2px 4px;
    border-radius: 4px; transition: opacity .15s, transform .15s;
    line-height: 1;
}
.hot-btn:hover { opacity: .6; transform: scale(1.2); }
.hot-btn-on { opacity: 1 !important; }
.hot-row { background: #fbf1da !important; }
.hot-row:hover { background: #f8ecd2 !important; }

.hot-filter-label {
    display: inline-flex; align-items: center;
    padding: .25rem .7rem; border-radius: 20px;
    font-size: .8rem; font-weight: 600; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--muted); transition: all .15s; white-space: nowrap;
    text-decoration: none;
}
.hot-filter-label:hover { border-color: var(--gold); color: #8a6a1f; }
.hot-filter-label.active { background: #f8ecd2; border-color: var(--gold); color: #8a6a1f; }

/* ── Quick-add / row highlight, admin toolkit ── */
.table-crm tbody tr.row-selected td { background: #d8ebe1 !important; }

/* ── Utilities ── */
.text-muted-sm { color: var(--muted); font-size: .78rem; font-family: 'Inter', sans-serif; }
.fw-600 { font-weight: 600; }
.btn-icon { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; }
