:root {
  --bg: #f6f1e6;
  --bg-card: #fbf7ee;
  --bg-elev: #ffffff;
  --ink: #1c1814;
  --ink-soft: #4a4137;
  --ink-muted: #8a7e6c;
  --line: #e3d8c1;
  --line-soft: #ece2cc;
  --accent: #a8462a;
  --accent-soft: #d2c0a8;
  --accent-rgb: 168, 70, 42;
  --font-body: 'Manrope', sans-serif;
  --font-display: 'Fraunces', serif;
  --gold: #9b7e3d;
  --green: #2f6042;
  --green-soft: #d9e6dc;
  --red: #9b2c2c;
  --red-soft: #f0d9d4;
  --amber: #b07a17;
  --amber-soft: #f3e4c3;
  --blue: #2c5d7a;
  --blue-soft: #d2e0e8;
  --shadow: 0 1px 2px rgba(28,24,20,0.04), 0 4px 16px rgba(28,24,20,0.05);
  --shadow-lg: 0 8px 32px rgba(28,24,20,0.12);
  --radius: 6px;
  --radius-lg: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .display { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* Layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #f3ead6; padding: 28px 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { padding-bottom: 24px; border-bottom: 1px solid rgba(243,234,214,0.12); margin-bottom: 24px; }
.brand-mark { font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; }
.brand-mark em { font-style: italic; color: var(--accent-soft); font-weight: 400; }
.brand-tag { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(243,234,214,0.55); margin-top: 8px; font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section-label { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(243,234,214,0.4); margin: 16px 12px 8px; font-weight: 600; }
.nav button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); color: rgba(243,234,214,0.75); font-size: 13.5px; font-weight: 500; text-align: left; transition: all 0.15s; }
.nav button:hover { background: rgba(243,234,214,0.06); color: #f3ead6; }
.nav button.active { background: var(--accent); color: #fff; }
.nav button .count { margin-left: auto; font-size: 11px; padding: 2px 7px; border-radius: 10px; background: rgba(255,255,255,0.15); font-weight: 600; }
.nav button.active .count { background: rgba(255,255,255,0.25); }
.nav-icon { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }

.main { padding: 32px 40px 48px; max-width: 1500px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; gap: 24px; flex-wrap: wrap; }
.page-title { font-size: 34px; line-height: 1.05; }
.page-title em { font-style: italic; color: var(--accent); font-weight: 400; }
.page-subtitle { color: var(--ink-muted); margin-top: 6px; font-size: 13.5px; max-width: 540px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius); font-weight: 600; font-size: 13px; transition: all 0.15s; border: 1px solid transparent; line-height: 1; }
.btn-primary { background: var(--ink); color: #f3ead6; }
.btn-primary:hover { background: #2a241e; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #913820; }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-card); border-color: var(--ink-muted); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--red-soft); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 6px 10px; font-size: 12px; font-weight: 500; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-pad { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-family: var(--font-display); font-size: 17px; font-weight: 500; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.kpi { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); opacity: 0.85; }
.kpi:nth-child(2)::before { background: var(--gold); }
.kpi:nth-child(3)::before { background: var(--green); }
.kpi:nth-child(4)::before { background: var(--blue); }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-muted); font-weight: 600; }
.kpi-value { font-family: var(--font-display); font-size: 38px; font-weight: 500; line-height: 1; margin-top: 10px; letter-spacing: -0.02em; }
.kpi-meta { font-size: 12px; color: var(--ink-muted); margin-top: 8px; }
.kpi-meta strong { color: var(--ink-soft); font-weight: 600; }

/* Two col layout */
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-card); }
td { padding: 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle; }
tr.row-clickable { cursor: pointer; transition: background 0.1s; }
tr.row-clickable:hover { background: var(--bg-card); }
tr:last-child td { border-bottom: none; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 12px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-new { background: var(--blue-soft); color: var(--blue); }
.badge-contacted { background: var(--amber-soft); color: var(--amber); }
.badge-viewing { background: #e7dcef; color: #6a428f; }
.badge-negotiating { background: #f3e4c3; color: #9b6b17; }
.badge-won { background: var(--green-soft); color: var(--green); }
.badge-lost { background: var(--red-soft); color: var(--red); }
.badge-available { background: var(--green-soft); color: var(--green); }
.badge-reserved { background: var(--amber-soft); color: var(--amber); }
.badge-sold { background: #e0d5c4; color: var(--ink-soft); }
.badge-buyer { background: var(--bg); color: var(--accent); border: 1px solid var(--accent-soft); }
.badge-renter { background: var(--bg); color: var(--blue); border: 1px solid var(--blue-soft); }
.badge-seller { background: var(--bg); color: var(--gold); border: 1px solid #d8c79a; }
.badge-landlord { background: var(--bg); color: #6a428f; border: 1px solid #d4c2dd; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.04em; text-transform: uppercase; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); color: var(--ink); transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12); }
textarea { resize: vertical; min-height: 70px; font-family: inherit; }
select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a7e6c' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

/* Filter bar */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 240px; max-width: 380px; position: relative; }
.search-input input { padding-left: 36px; }
.search-input::before { content: ''; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a7e6c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center/contain no-repeat; pointer-events: none; }
.filter-bar select { width: auto; min-width: 130px; padding: 9px 30px 9px 12px; }
.filter-result-count { margin-left: auto; font-size: 12px; color: var(--ink-muted); font-weight: 500; }

/* Date range picker */
.date-range-picker { position: relative; }
.date-range-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 210px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: border-color 0.15s;
}
.date-range-trigger:hover,
.date-range-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}
.date-range-trigger-icon { color: var(--ink-muted); font-size: 12px; flex-shrink: 0; }
.date-range-trigger-value {
  color: var(--ink-soft);
  font-size: 12.5px;
  white-space: nowrap;
}
.date-range-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  width: 300px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
}
.date-range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.date-range-preset {
  padding: 5px 9px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
}
.date-range-preset:hover { border-color: var(--accent-soft); color: var(--accent); }
.date-range-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.date-range-month {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
}
.date-range-nav {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 18px;
}
.date-range-nav:hover { background: var(--line-soft); color: var(--ink); }
.date-range-weekdays,
.date-range-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.date-range-weekdays {
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: center;
}
.date-range-day {
  height: 32px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
}
.date-range-day.is-empty { pointer-events: none; }
.date-range-day:not(.is-empty):hover { background: var(--bg); color: var(--ink); }
.date-range-day.is-today { color: var(--accent); font-weight: 700; }
.date-range-day.is-in-range { background: rgba(var(--accent-rgb), 0.1); color: var(--accent); border-radius: 0; }
.date-range-day.is-selected { background: var(--accent); color: #fff; }
.date-range-day.is-start { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.date-range-day.is-end { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.date-range-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

/* Modal / Drawer */
.overlay { position: fixed; inset: 0; background: rgba(28,24,20,0.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; backdrop-filter: blur(2px); }
.modal { background: var(--bg-card); border-radius: var(--radius-lg); max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--bg-card); z-index: 1; }
.modal-title { font-family: var(--font-display); font-size: 22px; font-weight: 500; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--bg-card); }
.close-btn { width: 32px; height: 32px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--ink-muted); transition: all 0.15s; }
.close-btn:hover { background: var(--line-soft); color: var(--ink); }

/* Drawer */
.drawer-overlay { position: fixed; inset: 0; background: rgba(28,24,20,0.45); z-index: 100; backdrop-filter: blur(2px); }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: 540px; max-width: 95vw; background: var(--bg-card); z-index: 101; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slideIn 0.25s ease-out; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-head { padding: 22px 26px 18px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 26px; }
.drawer-section { margin-bottom: 28px; }
.drawer-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; color: var(--ink-muted); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.info-item { display: flex; flex-direction: column; gap: 3px; }
.info-label { font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.info-value { font-size: 13.5px; color: var(--ink); font-weight: 500; }

/* Activity */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line-soft); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; border: 1px solid var(--line); }
.activity-content { flex: 1; }
.activity-meta { font-size: 11px; color: var(--ink-muted); margin-bottom: 2px; }
.activity-text { font-size: 13px; color: var(--ink-soft); }
.activity-add { display: flex; gap: 8px; margin-top: 12px; }
.activity-add select { width: 130px; }
.activity-add input { flex: 1; }

/* Property cards */
.prop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.prop-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; cursor: pointer; transition: all 0.15s; position: relative; }
.prop-card:hover { border-color: var(--accent-soft); transform: translateY(-1px); box-shadow: var(--shadow); }
.prop-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.prop-type { font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.prop-title { font-family: var(--font-display); font-size: 17px; font-weight: 500; line-height: 1.25; }
.prop-loc { font-size: 12.5px; color: var(--ink-muted); margin-top: 4px; }
.prop-price { font-family: var(--font-display); font-size: 20px; font-weight: 500; color: var(--ink); margin-top: 12px; }
.prop-price-sub { font-size: 11.5px; color: var(--ink-muted); font-weight: 500; font-family: var(--font-body); }
.prop-specs { display: flex; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--ink-soft); }
.prop-specs span { display: inline-flex; align-items: center; gap: 4px; }

/* Property detail drawer */
.drawer-prop { width: 640px; }
.prop-drawer-gallery { background: var(--bg); }
.prop-drawer-hero { width: 100%; aspect-ratio: 16/10; overflow: hidden; cursor: zoom-in; background: var(--bg); position: relative; }
.prop-drawer-hero img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.2s; }
.prop-drawer-hero:hover img { opacity: 0.94; }
.prop-drawer-hero-empty { width: 100%; aspect-ratio: 16/8; background: linear-gradient(135deg, var(--bg) 0%, var(--bg-card) 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-muted); }
.prop-drawer-thumbs { display: flex; gap: 6px; padding: 10px 26px; flex-wrap: wrap; background: var(--bg-card); border-bottom: 1px solid var(--line-soft); }
.prop-drawer-thumb { width: 64px; height: 48px; border-radius: 4px; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s; }
.prop-drawer-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prop-drawer-thumb.active { border-color: var(--accent); }
.prop-drawer-thumb:hover { border-color: var(--accent-soft); }
.prop-hero-headline { padding: 18px 26px 6px; }
.prop-price-large { font-family: var(--font-display); font-size: 28px; font-weight: 500; color: var(--ink); margin: 10px 0 14px; letter-spacing: -0.01em; line-height: 1; }
.prop-price-large .sub { font-family: var(--font-body); font-size: 13px; color: var(--ink-muted); font-weight: 500; }
.prop-actions-bar { display: flex; gap: 8px; padding: 0 26px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.matched-lead-row { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); margin-bottom: 6px; background: var(--bg-elev); align-items: center; }
.matched-lead-info { flex: 1; min-width: 0; }

/* Empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-muted); }
.empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-title { font-family: var(--font-display); font-size: 19px; color: var(--ink-soft); margin-bottom: 6px; }
.empty-text { font-size: 13.5px; max-width: 340px; margin: 0 auto 16px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab { padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--ink-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: var(--ink-soft); }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #f3ead6; padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; z-index: 200; animation: toastIn 0.25s ease-out; }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Status pill button */
.status-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.status-pill { padding: 6px 12px; border-radius: 14px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink-soft); transition: all 0.12s; }
.status-pill:hover { border-color: var(--ink-muted); }
.status-pill.active { background: var(--ink); color: #f3ead6; border-color: var(--ink); }

/* Match list */
.match-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); margin-bottom: 8px; background: var(--bg-elev); }
.match-info { flex: 1; }
.match-title { font-weight: 600; font-size: 13.5px; }
.match-meta { font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; }

/* Image gallery & upload */
.img-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 12px; }
.img-thumb { position: relative; aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden; background: var(--bg); border: 1px solid var(--line); cursor: pointer; }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb.is-cover::after { content: 'COVER'; position: absolute; top: 6px; left: 6px; font-size: 9px; font-weight: 700; letter-spacing: 0.1em; color: #fff; background: var(--accent); padding: 2px 6px; border-radius: 3px; }
.img-thumb-remove { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(28,24,20,0.82); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; opacity: 1; transition: background 0.15s; border: none; cursor: pointer; z-index: 2; }
.img-thumb-remove:hover { background: var(--red); }
.img-thumb-pending { cursor: default; }
.img-upload-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 22px; border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink-muted); cursor: pointer; transition: all 0.15s; text-align: center; }
.img-upload-zone:hover { border-color: var(--accent); background: var(--bg-card); color: var(--ink-soft); }
.img-upload-zone.is-dragging { border-color: var(--accent); background: var(--bg-card); }
.img-upload-zone input { display: none; }
.img-upload-icon { font-size: 22px; margin-bottom: 6px; }
.img-upload-text { font-size: 13px; font-weight: 600; }
.img-upload-hint { font-size: 11.5px; margin-top: 2px; }
.img-uploading { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--accent); margin: 8px 0 4px; font-weight: 600; }
.img-uploading .spinner { width: 13px; height: 13px; border-width: 2px; }
.upload-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28,24,20,0.55);
  backdrop-filter: blur(2px);
}
.upload-loading-overlay[hidden] { display: none !important; }
.upload-loading-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
}
.upload-loading-title {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
}
.upload-loading-text {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 500;
}

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(28,24,20,0.92); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 40px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: var(--shadow-lg); }
.lightbox-close { position: absolute; top: 20px; right: 24px; color: #fff; font-size: 20px; background: rgba(255,255,255,0.1); border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* Property card cover image */
.prop-card-cover { width: calc(100% + 36px); margin: -18px -18px 14px; aspect-ratio: 16/10; overflow: hidden; background: var(--bg); border-bottom: 1px solid var(--line-soft); position: relative; }
.prop-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s; }
.prop-card:hover .prop-card-cover img { transform: scale(1.04); }
.prop-card-pdf-btn { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,0.95); color: var(--ink); border-radius: 50%; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,0.15); transition: all 0.15s; font-size: 13px; font-weight: 700; }
.prop-card-pdf-btn:hover { background: var(--accent); color: #fff; transform: scale(1.05); }
.prop-card-img-count { position: absolute; bottom: 10px; right: 10px; background: rgba(28,24,20,0.75); color: #fff; padding: 3px 8px; border-radius: 11px; font-size: 11px; font-weight: 600; }

/* Pipeline */
.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.pipe-col { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px; min-height: 200px; }
.pipe-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; color: var(--ink-muted); padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.pipe-count { background: var(--ink); color: #f3ead6; font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 600; letter-spacing: 0; }
.pipe-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; transition: all 0.12s; }
.pipe-card:hover { border-color: var(--accent-soft); }
.pipe-name { font-weight: 600; font-size: 13px; }
.pipe-detail { font-size: 11.5px; color: var(--ink-muted); margin-top: 3px; }

/* Helpers */
.text-muted { color: var(--ink-muted); }
.text-soft { color: var(--ink-soft); }
.mb-0 { margin-bottom: 0; }
.mt-3 { margin-top: 12px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.divider-h { width: 1px; height: 16px; background: var(--line); }

/* Auth */
.auth-body { min-height: 100vh; }
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.08), transparent 32%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.auth-brand { margin-bottom: 28px; }
.auth-brand-mark {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.auth-brand-mark em { font-style: italic; color: var(--accent); font-weight: 400; }
.auth-brand-tag {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 8px;
  font-weight: 500;
}
.auth-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
}
.auth-subtitle {
  color: var(--ink-muted);
  margin-top: 8px;
  margin-bottom: 24px;
  font-size: 13.5px;
}
.auth-alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 18px;
}
.auth-alert-success {
  background: var(--green-soft);
  color: var(--green);
}
.setup-status {
  list-style: none;
  margin: 0 0 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--ink-soft);
}
.setup-status li + li { margin-top: 6px; }
.auth-form .field:last-of-type { margin-bottom: 10px; }
.auth-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  cursor: pointer;
}
.auth-remember input { width: auto; margin: 0; }
.auth-submit { width: 100%; justify-content: center; padding: 12px 16px; }

/* Responsive */
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .main { padding: 24px 20px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: 1fr; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* Loading */
.loading-screen { display: flex; align-items: center; justify-content: center; height: 100vh; flex-direction: column; gap: 12px; color: var(--ink-muted); }
.spinner { width: 28px; height: 28px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
</style>
