/* ═══ Natalie Erster CRM · Private Client Ledger ═══ */

:root {
  --paper: #F6F2EA;
  --paper-2: #EFE9DD;
  --card: #FDFBF6;
  --ink: #1E1A14;
  --ink-2: #4A4238;
  --ink-3: #8A8072;
  --line: #E2DACB;
  --line-2: #D2C8B4;
  --brass: #A9853B;
  --brass-deep: #8A6B2A;
  --brass-soft: #F0E6CE;
  --ember: #C24E2E;
  --ember-soft: #F6E0D6;
  --amber: #C98F2C;
  --amber-soft: #F5E8CC;
  --frost: #5B7A8C;
  --frost-soft: #DFE8EC;
  --sage: #5E7355;
  --sage-soft: #E2E8DC;
  --night: #17140F;
  --night-2: #221E17;
  --night-line: #353025;
  --night-ink: #D8D0BF;
  --shadow-lg: 0 24px 64px -20px rgba(30, 26, 20, .35);
  --shadow-md: 0 10px 30px -12px rgba(30, 26, 20, .22);
  --shadow-sm: 0 3px 10px -3px rgba(30, 26, 20, .14);
  --r: 14px;
  --font-d: "Fraunces", Georgia, serif;
  --font-b: "Figtree", "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-b);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  background-image: radial-gradient(ellipse 80% 60% at 70% -10%, rgba(169,133,59,.07), transparent 60%);
  min-height: 100vh;
}
::selection { background: var(--brass-soft); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
a { color: inherit; }

/* ── Login ─────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: var(--night);
  background-image:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(169,133,59,.16), transparent 65%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.012) 3px 4px);
}
.login-card {
  width: min(400px, 92vw); text-align: center;
  background: var(--night-2); border: 1px solid var(--night-line);
  border-radius: 20px; padding: 52px 44px 44px;
  box-shadow: var(--shadow-lg);
  animation: rise .7s cubic-bezier(.2,.9,.3,1) both;
}
.login-monogram, .brand-monogram {
  width: 58px; height: 58px; margin: 0 auto 20px;
  display: grid; place-items: center;
  font-family: var(--font-d); font-weight: 600; font-size: 22px;
  color: var(--brass); border: 1.5px solid var(--brass);
  border-radius: 50%;
  letter-spacing: .04em;
}
.login-title {
  font-family: var(--font-d); font-weight: 500; font-size: 30px;
  color: #F2ECDE; letter-spacing: .01em;
}
.login-sub {
  color: #9A9080; font-size: 12.5px; letter-spacing: .22em;
  text-transform: uppercase; margin: 10px 0 34px;
}
.login-card input {
  width: 100%; padding: 13px 16px; border-radius: 10px;
  border: 1px solid var(--night-line); background: #14110C; color: #EFE9DC;
  outline: none; text-align: center; letter-spacing: .12em; font-size: 15px;
  transition: border-color .2s;
}
.login-card input:focus { border-color: var(--brass); }
.login-card button {
  width: 100%; margin-top: 14px; padding: 13px;
  background: var(--brass); color: #171307; border: none; border-radius: 10px;
  font-weight: 700; font-size: 14px; letter-spacing: .14em; text-transform: uppercase;
  transition: background .2s, transform .15s;
}
.login-card button:hover { background: #C09A48; transform: translateY(-1px); }
.login-err { color: #E08A6E; font-size: 13px; margin-top: 12px; min-height: 18px; }
.login-hint { color: #B8AE9C; font-size: 13px; margin-bottom: 12px; }
#loginCode { letter-spacing: .45em; font-size: 19px; font-weight: 700; }
.trust-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: #9A9080; font-size: 12.5px; margin-top: 12px; cursor: pointer;
}
.trust-row input { width: auto; accent-color: var(--brass); }

/* ── Shell ─────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--night); color: var(--night-ink);
  display: flex; flex-direction: column;
  padding: 26px 18px 20px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 26px; text-decoration: none; cursor: pointer; }
.brand:hover .brand-name { color: var(--brass); }
.brand:hover .brand-monogram { border-color: #C09A48; color: #C09A48; }
.brand-monogram { width: 44px; height: 44px; margin: 0; font-size: 17px; }
.brand-name { display: block; font-family: var(--font-d); font-size: 16.5px; font-weight: 500; color: #F0EADC; line-height: 1.15; }
.brand-tag { display: block; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: #8F8676; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px; text-decoration: none;
  color: #A79D8B; font-weight: 500; font-size: 14px;
  transition: background .18s, color .18s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #E8E1D1; }
.nav-item.active { background: rgba(169,133,59,.16); color: var(--brass); }
.nav-ic { font-size: 13px; width: 17px; text-align: center; opacity: .85; }
.nav-count {
  margin-left: auto; background: var(--ember); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 8px;
}
.nav-count:empty { display: none; }
.nav-divider { height: 1px; background: var(--night-line); margin: 14px 8px 12px; }
.nav-label { font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; color: #6E665A; font-weight: 700; padding: 0 12px 7px; }
#navCamps { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
#navCamps .nav-item { font-size: 13px; }
#navCamps .nav-count { background: var(--night-line); color: #C9C0AE; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.ghost-btn {
  background: none; border: none; color: #857C6B; text-align: left;
  padding: 8px 12px; font-size: 13px; border-radius: 8px;
  transition: color .15s, background .15s;
}
.ghost-btn:hover { color: #E8E1D1; background: rgba(255,255,255,.05); }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 32px; position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.search-wrap { flex: 1; max-width: 480px; }
#globalSearch {
  width: 100%; padding: 10px 16px; border-radius: 24px;
  border: 1px solid var(--line-2); background: var(--card); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#globalSearch:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(169,133,59,.13); }
.topbar-right { margin-left: auto; }
.brass-btn {
  background: var(--ink); color: var(--paper); border: none;
  padding: 10px 20px; border-radius: 24px; font-weight: 600; font-size: 13.5px;
  transition: background .2s, transform .15s; box-shadow: var(--shadow-sm);
}
.brass-btn:hover { background: var(--brass-deep); transform: translateY(-1px); }

.view { padding: 30px 32px 80px; max-width: 1280px; }

/* ── Shared headings ───────────────────────────── */
.page-title { font-family: var(--font-d); font-size: 32px; font-weight: 500; letter-spacing: .005em; }
.page-sub { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.page-head { margin-bottom: 26px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-label {
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; margin-bottom: 12px;
}

/* ── Cards / stat tiles ────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-sm);
}
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-tile { padding: 20px 22px; position: relative; overflow: hidden; }
.stat-tile[data-nav] { cursor: pointer; transition: transform .18s, box-shadow .18s; }
.stat-tile[data-nav]:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-tile .stat-label { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.stat-tile .stat-value { font-family: var(--font-d); font-size: 40px; font-weight: 500; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-tile .stat-foot { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.stat-tile.tile-hot { border-top: 3px solid var(--ember); }
.stat-tile.tile-hot .stat-value { color: var(--ember); }
.stat-tile.tile-brass { border-top: 3px solid var(--brass); }
.stat-tile.tile-due .stat-value { color: var(--brass-deep); }

.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; align-items: start; }
@media (max-width: 1020px) { .grid-2 { grid-template-columns: 1fr; } }
.pad { padding: 22px 24px; }

/* ── Charts ────────────────────────────────────── */
.chart-wrap { overflow-x: auto; }
.bar-chart { display: flex; flex-direction: column; gap: 9px; }
.bar-line { display: grid; grid-template-columns: 128px 1fr 44px; gap: 12px; align-items: center; cursor: pointer; border-radius: 6px; padding: 2px 4px; transition: background .15s; }
.bar-line:hover { background: var(--paper-2); }
.bar-line .bar-name { font-size: 13px; color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 16px; border-radius: 0 4px 4px 0; background: transparent; position: relative; }
.bar-fill {
  height: 100%; border-radius: 0 4px 4px 0; background: var(--brass);
  min-width: 2px; transform-origin: left; animation: growX .8s cubic-bezier(.2,.8,.25,1) both;
}
.bar-line .bar-num { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); text-align: right; }
.bar-fill.f-ember { background: var(--ember); }
.bar-fill.f-amber { background: var(--amber); }
.bar-fill.f-frost { background: var(--frost); }
.bar-fill.f-muted { background: var(--line-2); }
.bar-fill.f-sage { background: var(--sage); }

.donut-flex { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; }
.donut-legend .lg-row { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.lg-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.lg-num { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; padding-left: 18px; }
.donut-svg .seg { transition: opacity .2s; cursor: pointer; }
.donut-svg .seg:hover { opacity: .8; }

/* ── Lead table ────────────────────────────────── */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filter-row select {
  padding: 8px 30px 8px 14px; border-radius: 20px; border: 1px solid var(--line-2);
  background: var(--card); outline: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238A8072' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.filter-row .result-count { color: var(--ink-3); font-size: 13px; margin-left: auto; }
.chip-btn {
  border: 1px solid var(--line-2); background: var(--card); border-radius: 20px;
  padding: 7px 15px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: all .15s;
}
.chip-btn:hover { border-color: var(--brass); color: var(--brass-deep); }
.chip-btn.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.lead-table { width: 100%; border-collapse: collapse; }
.lead-table th {
  text-align: left; font-size: 11px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line-2); cursor: pointer; user-select: none; white-space: nowrap;
}
.lead-table th:hover { color: var(--brass-deep); }
.lead-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.lead-table tbody tr { cursor: pointer; transition: background .13s; animation: rowIn .45s cubic-bezier(.2,.8,.3,1) both; }
.lead-table tbody tr:hover { background: var(--paper-2); }
.lead-addr { font-weight: 600; white-space: nowrap; }
.lead-owner { color: var(--ink-2); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-muted { color: var(--ink-3); font-size: 13px; white-space: nowrap; }

.status-pill {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  border-radius: 20px; padding: 3px 11px; white-space: nowrap;
  background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line-2);
}
.status-pill.s-new { background: #fff; }
.status-pill.s-appointment, .status-pill.s-listing_agreement { background: var(--brass-soft); color: var(--brass-deep); border-color: #DFC98F; }
.status-pill.s-active_listing, .status-pill.s-in_escrow { background: var(--sage-soft); color: #3F5236; border-color: #C4CFBB; }
.status-pill.s-closed { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.status-pill.s-not_interested, .status-pill.s-do_not_contact { background: #EFEAE2; color: #9A9082; text-decoration: line-through; }

.temp-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.temp-dot { width: 8px; height: 8px; border-radius: 50%; }
.temp-hot .temp-dot { background: var(--ember); box-shadow: 0 0 0 0 rgba(194,78,46,.5); animation: pulse 1.8s infinite; }
.temp-hot { color: var(--ember); }
.temp-warm .temp-dot { background: var(--amber); }
.temp-warm { color: #9A6E1F; }
.temp-cold .temp-dot { background: var(--frost); }
.temp-cold { color: var(--frost); }
.temp-none { color: var(--ink-3); font-weight: 500; }
.temp-none .temp-dot { background: var(--line-2); }

/* ── Drawer (record detail) ────────────────────── */
.drawer-scrim {
  position: fixed; inset: 0; background: rgba(23,20,15,.42); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(660px, 96vw); z-index: 90;
  background: var(--paper); box-shadow: var(--shadow-lg);
  transform: translateX(103%); transition: transform .42s cubic-bezier(.25,.9,.3,1);
  overflow-y: auto; border-left: 1px solid var(--line-2);
}
.drawer.open { transform: translateX(0); }
.drawer-inner { padding: 30px 32px 60px; }

/* staggered load-in for record sections */
.drawer.open .stagger { animation: rise .55s cubic-bezier(.2,.85,.3,1) both; }
.drawer.open .stagger:nth-child(1) { animation-delay: .04s; }
.drawer.open .stagger:nth-child(2) { animation-delay: .11s; }
.drawer.open .stagger:nth-child(3) { animation-delay: .18s; }
.drawer.open .stagger:nth-child(4) { animation-delay: .25s; }
.drawer.open .stagger:nth-child(5) { animation-delay: .32s; }
.drawer.open .stagger:nth-child(6) { animation-delay: .39s; }
.drawer.open .stagger:nth-child(7) { animation-delay: .46s; }
.drawer.open .stagger:nth-child(8) { animation-delay: .53s; }

.drawer-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.drawer-title { font-family: var(--font-d); font-size: 27px; font-weight: 500; line-height: 1.2; }
.drawer-owner { color: var(--ink-2); font-size: 15px; margin-top: 3px; }
.x-btn {
  margin-left: auto; background: none; border: 1px solid var(--line-2); color: var(--ink-2);
  width: 34px; height: 34px; border-radius: 50%; font-size: 19px; line-height: 1; flex: none;
  transition: all .15s;
}
.x-btn:hover { border-color: var(--ink); color: var(--ink); transform: rotate(90deg); }

.drawer-controls { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 22px; align-items: center; }
.drawer-controls select { padding: 8px 30px 8px 13px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--card); outline: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238A8072' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; font-weight: 600; }
.temp-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; background: var(--card); }
.temp-seg button { border: none; background: none; padding: 8px 13px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); transition: all .15s; }
.temp-seg button.on-hot { background: var(--ember); color: #fff; }
.temp-seg button.on-warm { background: var(--amber); color: #fff; }
.temp-seg button.on-cold { background: var(--frost); color: #fff; }

.action-row { display: flex; gap: 9px; flex-wrap: wrap; }
.act-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2); background: var(--card); border-radius: 9px;
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  text-decoration: none; transition: all .15s;
}
.act-btn:hover { border-color: var(--brass); color: var(--brass-deep); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.act-btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.act-btn.primary:hover { background: var(--brass-deep); border-color: var(--brass-deep); }

.d-section { margin-top: 24px; }
.d-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (max-width: 560px) { .field-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; margin-bottom: 4px; }
.field input {
  width: 100%; padding: 8px 11px; border: 1px solid transparent; background: transparent;
  border-radius: 8px; outline: none; transition: all .15s; font-size: 14px;
}
.field input:hover { background: var(--paper-2); }
.field input:focus { background: #fff; border-color: var(--brass); }
.field input { border-bottom: 1px dashed var(--line-2); border-radius: 8px 8px 0 0; }
.notes-inline {
  width: 100%; min-height: 46px; padding: 8px 11px; resize: vertical; font-size: 14px;
  background: transparent; border: 1px solid transparent; outline: none;
  border-bottom: 1px dashed var(--line-2); border-radius: 8px 8px 0 0; transition: all .15s;
}
.notes-inline:hover { background: var(--paper-2); }
.notes-inline:focus { background: #fff; border-color: var(--brass); }

.links-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.src-link {
  font-size: 12.5px; font-weight: 700; text-decoration: none; padding: 6px 12px;
  border-radius: 20px; border: 1px solid var(--line-2); color: var(--ink-2);
  transition: all .15s; background: var(--card);
}
.src-link:hover { border-color: var(--brass); color: var(--brass-deep); }
.src-link.primary { background: var(--brass); border-color: var(--brass); color: #201b10; }
.src-link.primary:hover { background: var(--brass-deep); border-color: var(--brass-deep); color: #fff; }
/* sold-comp lightbox: aerial hero + facts */
.modal.sale-lightbox { width: min(680px, 100%); }
.sale-hero { position: relative; border-radius: 12px; overflow: hidden; background: #E8E4DA; }
.sale-hero-map { width: 100%; height: 260px; border: 0; display: block; }
.sale-hero-price {
  position: absolute; left: 12px; bottom: 12px; z-index: 2;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 15px;
  padding: 5px 12px; border-radius: 20px; border: 1.5px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.4); font-variant-numeric: tabular-nums;
}

.comp-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); font-size: 13.5px; align-items: baseline; }
.comp-row:last-child { border-bottom: none; }
.comp-addr { font-weight: 600; }
.comp-meta { color: var(--ink-3); font-size: 12.5px; }
.comp-price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* benchmark row — the area median, set apart from individual sales */
.comp-row--median {
  margin: -2px -10px 4px; padding: 8px 10px;
  background: var(--brass-wash, rgba(169, 133, 59, .09));
  border: none; border-left: 3px solid var(--brass); border-radius: 6px;
}
.comp-row--median .comp-addr { color: var(--brass-deep); letter-spacing: .01em; text-transform: uppercase; font-size: 11.5px; font-weight: 700; }
.comp-row--median .comp-meta { color: var(--brass-deep); opacity: .8; }
.comp-row--median .comp-price { color: var(--brass-deep); font-size: 14.5px; }

/* ── Lead full page ────────────────────────────── */
.back-link {
  display: inline-block; font-size: 12px; font-weight: 700; color: var(--ink-3);
  text-decoration: none; margin-bottom: 14px; letter-spacing: .12em; text-transform: uppercase;
  transition: color .15s;
}
.back-link:hover { color: var(--brass-deep); }
.lead-topnav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.lead-topnav .back-link { margin-bottom: 0; }
.lead-count { font-size: 12px; color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 4px; }
.lead-topnav .mini-btn { padding: 6px 13px; font-size: 12.5px; background: var(--card); }
.mini-btn:disabled { opacity: .4; cursor: default; }
.mini-btn:disabled:hover { border-color: var(--line-2); color: var(--ink-2); }
.lead-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.lead-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 22px; align-items: start; }
@media (max-width: 1020px) { .lead-grid { grid-template-columns: 1fr; } }
.map-card { overflow: hidden; }
.map-card iframe { width: 100%; height: 320px; border: 0; display: block; }
.mini-map { position: relative; height: 320px; overflow: hidden; background: #E8E4DA; }
.map-tile { position: absolute; width: 256px; height: 256px; pointer-events: none; user-select: none; }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }
.map-pin {
  position: absolute; transform: translate(-50%, -90%); font-size: 27px; z-index: 5;
  pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45));
}
.map-sold {
  position: absolute; transform: translate(-50%, -50%); z-index: 4;
  background: var(--ink); color: #fff; border: 1.5px solid #fff; border-radius: 12px;
  padding: 2px 8px; font-size: 11px; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: background .15s, transform .15s;
}
.map-sold:hover { background: var(--brass-deep); transform: translate(-50%, -50%) scale(1.12); z-index: 6; }
.map-attr {
  position: absolute; right: 4px; bottom: 3px; z-index: 5; font-size: 10px; color: #444;
  background: rgba(255,255,255,.75); padding: 0 5px; border-radius: 3px; text-decoration: none;
}
/* draggable / zoomable mini-map */
.map-interactive { cursor: grab; touch-action: none; user-select: none; }
.map-interactive.grabbing { cursor: grabbing; }
.map-world { position: absolute; inset: 0; }
.map-ctrls { position: absolute; top: 8px; right: 8px; z-index: 7; display: flex; flex-direction: column; gap: 4px; }
.map-zbtn {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); background: rgba(255,255,255,.94); color: var(--ink);
  border-radius: 7px; font-size: 16px; line-height: 1; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.map-zbtn:hover { background: #fff; border-color: var(--brass); }
.map-foot { display: flex; gap: 8px; padding: 12px 14px; flex-wrap: wrap; }
.view-anim .stagger { animation: rise .5s cubic-bezier(.2,.85,.3,1) both; }
.view-anim div > .stagger:nth-of-type(2) { animation-delay: .09s; }
.view-anim div > .stagger:nth-of-type(3) { animation-delay: .17s; }

/* timeline */
.tl { list-style: none; }
.tl li { display: flex; gap: 13px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl li:last-child { border-bottom: none; }
.tl-ic {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper-2); font-size: 13px; border: 1px solid var(--line-2);
}
.tl-body { flex: 1; min-width: 0; }
.tl-text { font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.tl-date { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.tl-del { opacity: 0; background: none; border: none; color: var(--ink-3); font-size: 15px; transition: opacity .15s; }
.tl li:hover .tl-del { opacity: .7; }

.note-compose { display: flex; flex-direction: column; gap: 9px; }
.note-compose textarea {
  width: 100%; min-height: 66px; padding: 11px 13px; border-radius: 10px; resize: vertical;
  border: 1px solid var(--line-2); background: #fff; outline: none;
}
.note-compose textarea:focus { border-color: var(--brass); }
.note-type-row { display: flex; gap: 7px; align-items: center; }
.note-type-row .chip-btn { padding: 5px 12px; font-size: 12px; }
.note-type-row .brass-btn { margin-left: auto; padding: 8px 18px; }

/* reminders */
.rem-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); }
.rem-row:last-child { border-bottom: none; }
.rem-check { width: 19px; height: 19px; accent-color: var(--brass-deep); cursor: pointer; flex: none; }
.rem-title { font-weight: 600; font-size: 14px; }
.rem-due { font-size: 12.5px; color: var(--ink-3); }
.rem-due.overdue { color: var(--ember); font-weight: 700; }
.rem-row.done .rem-title { text-decoration: line-through; color: var(--ink-3); }
.rem-note { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; white-space: pre-wrap; opacity: .9; }
.cal-ev { cursor: pointer; }
.rem-actions { margin-left: auto; display: flex; gap: 6px; }
.mini-btn { background: none; border: 1px solid var(--line-2); border-radius: 7px; padding: 4px 9px; font-size: 11.5px; font-weight: 700; color: var(--ink-2); transition: all .15s; text-decoration: none; }
.mini-btn:hover { border-color: var(--brass); color: var(--brass-deep); }

/* ── Calendar ──────────────────────────────────── */
.cal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.cal-title { font-family: var(--font-d); font-size: 22px; font-weight: 500; min-width: 180px; }
.cal-nav-btn { border: 1px solid var(--line-2); background: var(--card); border-radius: 8px; width: 34px; height: 34px; font-size: 15px; transition: all .15s; }
.cal-nav-btn:hover { border-color: var(--brass); color: var(--brass-deep); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--line); border-top: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.cal-dow { padding: 8px 10px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); background: var(--paper-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 96px; background: var(--card); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 7px 8px; cursor: pointer; transition: background .15s; position: relative; }
.cal-cell:hover { background: var(--paper-2); }
.cal-cell.other { background: var(--paper); color: var(--ink-3); }
.cal-cell.today .cal-daynum { background: var(--ink); color: var(--paper); }
.cal-daynum { font-size: 12.5px; font-weight: 700; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-ev { font-size: 11.5px; font-weight: 600; background: var(--brass-soft); color: var(--brass-deep); border-radius: 5px; padding: 2px 7px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.done { opacity: .45; text-decoration: line-through; }
.cal-ev.overdue { background: var(--ember-soft); color: var(--ember); }

/* week + day views */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--line); border-top: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.week-col { min-height: 320px; background: var(--card); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 9px 8px; cursor: pointer; transition: background .15s; }
.week-col:hover { background: var(--paper-2); }
.week-col.today { background: #FBF6EA; }
.week-head { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 9px; display: flex; align-items: center; gap: 7px; }
.week-col.today .cal-daynum { background: var(--ink); color: var(--paper); }
.week-empty { color: var(--line-2); font-size: 13px; }
.week-col .cal-ev { white-space: normal; margin-top: 5px; }
.day-grid { border-top: 1px solid var(--line); }
.day-row { display: flex; gap: 14px; border-bottom: 1px solid var(--line); padding: 10px 6px; min-height: 46px; cursor: pointer; transition: background .15s; }
.day-row:hover { background: var(--paper-2); }
.day-hour { flex: 0 0 62px; font-size: 12px; font-weight: 700; color: var(--ink-3); padding-top: 4px; }
.day-evs { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.day-evs .cal-ev { font-size: 13px; padding: 6px 13px; white-space: normal; margin-top: 0; }

/* ── Modal ─────────────────────────────────────── */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(23,20,15,.5); z-index: 120;
  display: none; place-items: center; padding: 20px;
}
.modal-scrim.open { display: grid; }
.modal {
  background: var(--paper); border-radius: 18px; width: min(560px, 100%);
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  padding: 28px 30px; animation: rise .35s cubic-bezier(.2,.9,.3,1) both;
}
.modal h3 { font-family: var(--font-d); font-size: 22px; font-weight: 500; margin-bottom: 4px; }
.modal .m-sub { color: var(--ink-3); font-size: 13.5px; margin-bottom: 18px; }
.modal label { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; margin: 13px 0 5px; }
.modal input[type=text], .modal input[type=password], .modal input[type=email], .modal input[type=date], .modal input[type=time], .modal input[type=datetime-local], .modal select, .modal textarea {
  width: 100%; padding: 10px 13px; border-radius: 9px; border: 1px solid var(--line-2);
  background: #fff; outline: none;
}
.modal textarea { min-height: 110px; resize: vertical; }
.modal input:focus, .modal textarea:focus, .modal select:focus { border-color: var(--brass); }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }
.modal-actions .cancel { background: none; border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 18px; font-weight: 600; color: var(--ink-2); }
.modal-actions .brass-btn { border-radius: 9px; }
.lead-picker { position: relative; }
.lead-picker-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: #fff; border: 1px solid var(--line-2); border-radius: 9px; margin-top: 3px; box-shadow: var(--shadow-md); max-height: 230px; overflow-y: auto; display: none; }
.lead-picker-results.open { display: block; }
.lp-item { display: block; width: 100%; text-align: left; border: none; background: none; padding: 9px 13px; font-size: 13.5px; cursor: pointer; border-bottom: 1px solid var(--line); }
.lp-item:last-child { border-bottom: none; }
.lp-item:hover { background: var(--paper-2); }
.lp-owner { color: var(--ink-3); font-size: 12.5px; }
.lp-empty { padding: 10px 13px; color: var(--ink-3); font-size: 13px; }
.comp-pick { display: flex; gap: 9px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 13.5px; }
.comp-pick input { accent-color: var(--brass-deep); }
.hint-box { background: var(--brass-soft); border: 1px solid #E4D3A6; color: #6B5320; border-radius: 10px; padding: 12px 15px; font-size: 13px; margin-top: 14px; word-break: break-all; }

/* ── AI widget ─────────────────────────────────── */
.ai-fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 110;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--ink); color: var(--brass); border: 1px solid var(--brass-deep);
  display: grid; place-items: center; box-shadow: var(--shadow-md);
  transition: transform .2s, background .2s;
}
.ai-fab:hover { transform: translateY(-2px) scale(1.05); background: var(--night-2); }
.ai-panel {
  position: fixed; right: 26px; bottom: 92px; z-index: 115;
  width: min(390px, calc(100vw - 40px)); height: min(540px, calc(100vh - 130px));
  background: var(--card); border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: var(--shadow-lg); display: none; flex-direction: column; overflow: hidden;
  animation: rise .3s cubic-bezier(.2,.9,.3,1) both;
}
.ai-panel.open { display: flex; }
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); background: var(--night); color: #EFE9DC; }
.ai-head strong { font-family: var(--font-d); font-weight: 500; font-size: 16px; }
.ai-sub { display: block; font-size: 11px; color: #8F8676; margin-top: 1px; }
.ai-head .x-btn { border-color: var(--night-line); color: #A79D8B; }
.ai-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ai-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; white-space: pre-wrap; word-wrap: break-word; animation: rise .3s both; }
.ai-msg.user { align-self: flex-end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; }
.ai-msg.bot { align-self: flex-start; background: var(--paper-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-msg.thinking { color: var(--ink-3); font-style: italic; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; }
.ai-chip {
  border: 1px solid var(--brass); background: var(--brass-soft); color: var(--brass-deep);
  border-radius: 20px; padding: 5px 12px; font-size: 12px; font-weight: 700; transition: all .15s;
}
.ai-chip:hover { background: var(--brass); color: #fff; }
.ai-form { display: flex; border-top: 1px solid var(--line); }
.ai-form input { flex: 1; border: none; outline: none; padding: 14px 16px; background: transparent; font-size: 14px; }
.ai-form button { border: none; background: none; color: var(--brass-deep); font-size: 19px; font-weight: 700; padding: 0 18px; transition: transform .15s; }
.ai-form button:hover { transform: translateX(2px); }

/* ── Toasts ────────────────────────────────────── */
.toast-rack { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: var(--paper); border-radius: 10px; padding: 11px 20px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-md);
  animation: rise .3s both;
}
.toast.err { background: var(--ember); }

/* ── Empty / skeleton ──────────────────────────── */
.empty { text-align: center; color: var(--ink-3); padding: 48px 20px; }
.empty .empty-ic { font-size: 30px; margin-bottom: 10px; opacity: .5; }
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--paper-2) 25%, #E8E1D2 50%, var(--paper-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }

/* view transition */
.view > .view-anim { animation: rise .45s cubic-bezier(.2,.85,.3,1) both; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(194,78,46,.45); } 70% { box-shadow: 0 0 0 7px rgba(194,78,46,0); } 100% { box-shadow: 0 0 0 0 rgba(194,78,46,0); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 100; height: auto; bottom: 0; top: auto; left: 0; right: 0;
    flex-direction: row; align-items: center; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 2px; }
  .brand, .sidebar-foot, .nav-divider, .nav-label, #navCamps { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; gap: 0; }
  .nav-item { flex-direction: column; gap: 3px; font-size: 10px; padding: 6px 5px; text-align: center; }
  .nav-count { position: absolute; transform: translate(14px, -6px); margin: 0; }
  .nav-item { position: relative; }
  .view { padding: 18px 14px 130px; }
  .topbar { padding: 10px 14px; }
  .page-title { font-size: 25px; }
  .stat-tile .stat-value { font-size: 30px; }
}

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar-right { order: 1; margin-left: auto; }
  .search-wrap { order: 2; flex-basis: 100%; max-width: none; }
  .brass-btn, .topbar .chip-btn { padding: 8px 13px; font-size: 12.5px; white-space: nowrap; }
  .ai-fab { bottom: 86px; right: 16px; width: 48px; height: 48px; }
  .ai-panel { right: 10px; left: 10px; width: auto; bottom: 142px; height: min(480px, calc(100vh - 220px)); }
  .toast-rack { bottom: 88px; width: calc(100vw - 24px); }
  .toast { text-align: center; }
  .lead-head { flex-direction: column; }
  .map-card iframe { height: 240px; }
  .modal { padding: 20px 18px; }
  .bar-line { grid-template-columns: 96px 1fr 38px; gap: 8px; }
  .bar-line .bar-name { font-size: 12px; }
  .lead-table td, .lead-table th { padding: 10px 9px; font-size: 13px; }
  .field-grid { grid-template-columns: 1fr; }
  .action-row .act-btn { padding: 8px 11px; font-size: 12.5px; }
}
