/* ================================================================
   Property Bazar Gwalior CRM — Shared Design System
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,600;0,9..144,700&family=JetBrains+Mono:wght@400;500&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
  --bg:           #F7F3EE;
  --surface:      #FFFFFF;
  --surface2:     #FDF9F5;
  --border:       #E8E0D5;
  --text:         #2C2318;
  --muted:        #9A8A78;
  --accent:       #C17B3F;
  --green:        #5E9E82;
  --yellow:       #D4A017;
  --red:          #D96B6B;
  --blue:         #5B82C4;
  --purple:       #8B6BAE;
  --sidebar-bg:   #2C2318;
  --sidebar-text: #F7F3EE;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
select, input, textarea { font-family: inherit; }

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  position: fixed;
  left: 0; top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 26px 24px 22px;
  border-bottom: 1px solid rgba(247,243,238,0.07);
}

.sidebar-logo-mark {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 18px; font-weight: 700;
  color: white;
  margin-bottom: 12px;
}

.sidebar-name {
  font-family: 'Fraunces', serif;
  font-size: 16px; font-weight: 600;
  color: var(--sidebar-text);
  line-height: 1.3;
}

.sidebar-tagline {
  font-size: 11px;
  color: rgba(247,243,238,0.4);
  margin-top: 3px;
}

.sidebar-nav { flex: 1; padding: 14px 0; }

.nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(247,243,238,0.28);
  padding: 14px 24px 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 20px 11px 21px;
  color: rgba(247,243,238,0.58);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.17s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-link:hover {
  background: rgba(255,255,255,0.05);
  color: rgba(247,243,238,0.88);
}

.nav-link.active {
  background: rgba(193,123,63,0.13);
  color: #E8A96C;
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(247,243,238,0.07);
  display: flex; align-items: center; gap: 11px;
}

.sf-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: white;
  flex-shrink: 0;
}

.sf-name {
  font-size: 12.5px; font-weight: 600;
  color: rgba(247,243,238,0.88);
  line-height: 1.2;
}

.sf-role {
  font-size: 10px; font-weight: 600;
  background: rgba(193,123,63,0.2);
  color: #E8A96C;
  padding: 2px 7px;
  border-radius: 20px;
  display: inline-block;
  margin-top: 3px;
}

/* ── Main Wrapper ── */
.main-wrapper {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top Header ── */
.top-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 64px;
  padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}

.page-title {
  font-family: 'Fraunces', serif;
  font-size: 21px; font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}

.title-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 500;
  background: var(--bg);
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.header-right { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 17px;
  transition: all 0.18s; position: relative;
  color: var(--muted);
}
.icon-btn:hover { background: var(--bg); border-color: var(--muted); }

.notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--surface);
}

.header-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
  cursor: pointer;
  border: 2.5px solid rgba(193,123,63,0.25);
  transition: border-color 0.18s;
}
.header-avatar:hover { border-color: var(--accent); }

/* ── Page Content ── */
.page-content { padding: 32px; flex: 1; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(44,35,24,0.05);
}

.card-pad { padding: 24px; }

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.card-title {
  font-family: 'Fraunces', serif;
  font-size: 15px; font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  font-size: 12px; color: var(--muted); margin-top: 2px;
}

/* ── KPI Row ── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(44,35,24,0.05);
  padding: 22px 22px 20px;
  position: relative; overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.kpi-card:hover { box-shadow: 0 6px 24px rgba(44,35,24,0.1); transform: translateY(-2px); }

.kpi-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
}
.kpi-blue::before   { background: var(--blue); }
.kpi-green::before  { background: var(--green); }
.kpi-amber::before  { background: var(--yellow); }
.kpi-red::before    { background: var(--red); }
.kpi-purple::before { background: var(--purple); }

.kpi-icon { font-size: 22px; margin-bottom: 14px; }

.kpi-value {
  font-family: 'Fraunces', serif;
  font-size: 33px; font-weight: 700;
  color: var(--text); line-height: 1;
  margin-bottom: 6px;
}

.kpi-label {
  font-size: 12.5px; color: var(--muted); font-weight: 500;
}

.kpi-sub {
  font-size: 11.5px; color: var(--muted);
  margin-top: 6px; display: flex; align-items: center; gap: 4px;
}
.up   { color: var(--green); }
.down { color: var(--red); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13.5px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #A8692E; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(193,123,63,0.32); }

.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--surface2); border-color: var(--muted); }

.btn-ghost { background: transparent; color: var(--accent); padding: 6px 10px; }
.btn-ghost:hover { background: rgba(193,123,63,0.08); border-radius: 6px; }

.btn-sm  { padding: 6px 14px; font-size: 12px; border-radius: 6px; }
.btn-xs  { padding: 4px 10px; font-size: 11px; border-radius: 5px; }

.btn-red   { background: var(--red);    color: white; }
.btn-green { background: var(--green);  color: white; }
.btn-blue  { background: var(--blue);   color: white; }
.btn-red:hover   { background: #c05050; }
.btn-green:hover { background: #4d8b71; }
.btn-blue:hover  { background: #4a71b3; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(193,123,63,0.1);
}
.form-control::placeholder { color: var(--muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.input-note {
  font-size: 11.5px; color: var(--muted);
  margin-top: 5px; font-style: italic;
}

/* ── Pill Selector (styled radio buttons) ── */
.pill-selector { display: flex; gap: 8px; flex-wrap: wrap; }

.pill-opt {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.pill-opt:hover, .pill-opt.sel {
  background: rgba(193,123,63,0.09);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Badges (Status Pills) ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.2px; white-space: nowrap;
}

.badge-new         { background: #EBF1FA; color: #3B6BAE; }
.badge-followup    { background: #FDF3DC; color: #A07010; }
.badge-visit       { background: #F0EAF8; color: #6B4A9E; }
.badge-negotiation { background: #F3EDFA; color: #6B4A9E; }
.badge-booking     { background: #E6F4EE; color: #2E7D5A; }
.badge-dead        { background: #F5EEEE; color: #A04040; }
.badge-paid        { background: #E6F4EE; color: #2E7D5A; }
.badge-partial     { background: #FDF3DC; color: #A07010; }
.badge-overdue     { background: #FAEBEB; color: #9E3030; }
.badge-available   { background: #EBF1FA; color: #3B6BAE; }
.badge-booked      { background: #FDF3DC; color: #A07010; }
.badge-sold        { background: #E6F4EE; color: #2E7D5A; }
.badge-active      { background: #E6F4EE; color: #2E7D5A; }
.badge-inactive    { background: #F5EEEE; color: #A04040; }
.badge-registry    { background: #E2F5EA; color: #1A7A40; }
.badge-blocked     { background: #EFEFED; color: #6A6050; }

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(44,35,24,0.05);
}

.dt {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.dt thead tr { background: var(--surface2); }

.dt th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.dt td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}

.dt tbody tr:last-child td { border-bottom: none; }
.dt tbody tr:nth-child(even) td { background: var(--surface2); }
.dt tbody tr:hover td { background: #FFF8F2; transition: background 0.12s; }
.dt tbody tr.row-danger td  { background: #FFF1F1 !important; }
.dt tbody tr.row-success td { background: #F1FBF6 !important; }

/* ── Mono text ── */
.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 0.2px; }

/* ── Section Headers ── */
.sec-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.sec-title {
  font-family: 'Fraunces', serif;
  font-size: 15px; font-weight: 600; color: var(--text);
}

/* ── Two-column Grid Layouts ── */
.two-col-6040 { display: grid; grid-template-columns: 60% 40%; gap: 20px; margin-bottom: 28px; }
.two-col-5050 { display: grid; grid-template-columns: 1fr 1fr;  gap: 20px; margin-bottom: 28px; }
.two-col-4060 { display: grid; grid-template-columns: 40% 60%; gap: 20px; margin-bottom: 28px; }
.three-col    { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 28px; }

/* ── Activity Feed ── */
.feed-item {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.feed-item:last-child { border-bottom: none; }

.feed-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: white;
  flex-shrink: 0;
}

.feed-body { flex: 1; min-width: 0; }
.feed-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.feed-meta { font-size: 11px; color: var(--muted); margin-top: 3px; font-family: 'JetBrains Mono', monospace; }

/* ── Funnel Bars ── */
.funnel-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 11px;
}
.funnel-label { width: 108px; font-size: 12.5px; font-weight: 500; color: var(--text); flex-shrink: 0; }
.funnel-track { flex: 1; height: 26px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.funnel-fill  {
  height: 100%; border-radius: 6px;
  display: flex; align-items: center;
  padding-left: 10px;
  font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.9);
}
.funnel-count { width: 36px; text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* ── Search Bar ── */
.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-icon { position: absolute; left: 12px; font-size: 14px; color: var(--muted); pointer-events: none; }
.search-input {
  padding: 9px 14px 9px 34px;
  width: 250px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s;
}
.search-input:focus { border-color: var(--accent); }

/* ── Filter Pills Row ── */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  padding: 16px 0 0;
  margin-bottom: 20px;
}

.filter-pill {
  padding: 6px 15px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.filter-pill:hover { border-color: var(--accent); color: var(--accent); }
.filter-pill.active { background: var(--accent); border-color: var(--accent); color: white; }

.filter-select {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px; font-weight: 500;
  outline: none; cursor: pointer;
  transition: border-color 0.15s;
}
.filter-select:hover { border-color: var(--accent); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(44,35,24,0.48);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%; max-width: 600px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 72px rgba(44,35,24,0.22);
}

.modal-head {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between;
}

.modal-title {
  font-family: 'Fraunces', serif;
  font-size: 19px; font-weight: 600;
}
.modal-subtitle { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer;
  font-size: 19px; color: var(--muted);
  border: none; background: transparent;
  transition: background 0.15s; flex-shrink: 0;
}
.modal-close:hover { background: var(--surface2); }

.modal-body { padding: 24px 28px; }

.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2);
  border-radius: 0 0 16px 16px;
}

.modal-note {
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 5px;
}

/* ── Unit Grid (Inventory) ── */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.unit-card {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 14px 14px 12px;
  background: var(--surface);
  position: relative; overflow: visible;
  cursor: pointer;
  transition: all 0.18s;
  border-left: 4px solid transparent;
}
.unit-card:hover { box-shadow: 0 4px 18px rgba(44,35,24,0.1); transform: translateY(-2px); }

.unit-available { border-left-color: var(--blue); }
.unit-booked    { border-left-color: var(--yellow); }
.unit-sold      { border-left-color: var(--green); }
.unit-blocked   { border-left-color: var(--muted); }

.unit-id   { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.unit-type { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.unit-area { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.unit-price { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }

/* ── Unit Tooltip ── */
.unit-card.selected { box-shadow: 0 0 0 2.5px var(--accent), 0 6px 24px rgba(193,123,63,0.2); z-index: 10; }

.unit-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 12px); left: 50%;
  transform: translateX(-50%);
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(44,35,24,0.15);
  z-index: 20;
  font-size: 12.5px;
}

.unit-tooltip::before {
  content: '';
  position: absolute; top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 8px;
  background: var(--surface);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  border: 1px solid var(--border);
}

.unit-card.selected .unit-tooltip { display: block; }

.tt-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.tt-label { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.tt-val   { font-weight: 600; font-size: 12.5px; color: var(--text); }

/* ── Heatmap Tiles ── */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 32px;
}

.htile {
  border-radius: 10px;
  border: 1.5px solid;
  padding: 14px 14px 12px;
  position: relative; overflow: visible;
  cursor: pointer; transition: transform 0.18s;
}
.htile:hover { transform: translateY(-2px); }

.htile-green  { background: #E6F4EE; border-color: #5E9E82; }
.htile-yellow { background: #FDF3DC; border-color: #D4A017; }
.htile-red    { background: #FAEBEB; border-color: #D96B6B; }
.htile-gray   { background: #F5F5F5; border-color: #DEDEDE; }

@keyframes pulse-overdue {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,107,107,0.45); }
  50%       { box-shadow: 0 0 0 9px rgba(217,107,107,0); }
}
.htile-red { animation: pulse-overdue 2.2s ease infinite; }

.htile-unit { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.htile-name { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.htile-bal  { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600; }

.htile-green  .htile-bal { color: var(--green); }
.htile-yellow .htile-bal { color: #A07010; }
.htile-red    .htile-bal { color: var(--red); }
.htile-gray   .htile-bal { color: var(--muted); }

/* ── Tile Tooltip ── */
.htile-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 12px); left: 50%;
  transform: translateX(-50%);
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(44,35,24,0.15);
  z-index: 30; font-size: 12.5px;
}
.htile-tooltip::before {
  content: '';
  position: absolute; top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 8px;
  background: var(--surface);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  border: 1px solid var(--border);
}
.htile.hovered .htile-tooltip { display: block; }
.htile.hovered { z-index: 20; }

/* ── Drawer Panel ── */
.drawer-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }

.drawer {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(44,35,24,0.05);
  position: sticky; top: 84px;
}

.drawer-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-title { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 600; }
.drawer-sub   { font-size: 12px; color: var(--muted); margin-top: 4px; }

.drawer-body { padding: 20px 22px; }

.ledger-total-row {
  display: flex; justify-content: space-between;
  padding: 12px 0;
  border-top: 2px solid var(--border);
  margin-top: 4px;
}
.ledger-total-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ledger-total-val   { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; }
.lt-green { color: var(--green); }
.lt-red   { color: var(--red); }

.add-payment-form {
  background: var(--surface2);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 16px;
  margin-top: 16px;
}
.apf-title { font-size: 13px; font-weight: 700; margin-bottom: 14px; color: var(--text); }

/* ── Stats Mini Cards ── */
.stat-mini {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(44,35,24,0.04);
}
.stat-mini-label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.stat-mini-value {
  font-family: 'Fraunces', serif;
  font-size: 24px; font-weight: 700;
  color: var(--text); line-height: 1;
}
.stat-mini-sub { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ── Township Tabs ── */
.township-tabs {
  display: flex; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  display: inline-flex;
}
.township-tab {
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  cursor: pointer; transition: all 0.15s;
}
.township-tab.active { background: var(--accent); color: white; }
.township-tab:hover:not(.active) { background: var(--bg); color: var(--text); }

/* ── Summary Stats Bar ── */
.stats-bar {
  display: flex; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.stats-chip {
  flex: 1; padding: 14px 16px;
  border-right: 1px solid var(--border);
  text-align: center;
}
.stats-chip:last-child { border-right: none; }
.stats-chip-val {
  font-family: 'Fraunces', serif;
  font-size: 22px; font-weight: 700; line-height: 1;
  margin-bottom: 4px;
}
.stats-chip-lbl { font-size: 11.5px; color: var(--muted); font-weight: 500; }

/* ── Report Tabs ── */
.report-tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 28px;
}
.report-tab {
  padding: 12px 22px;
  font-size: 13.5px; font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.report-tab:hover { color: var(--text); }
.report-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Donut Chart ── */
.donut-wrap { display: flex; align-items: center; gap: 28px; }
.donut-ring {
  width: 180px; height: 180px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.donut-hole {
  width: 104px; height: 104px;
  background: var(--surface);
  border-radius: 50%;
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
}
.donut-center-val  { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 700; line-height: 1; }
.donut-center-lbl  { font-size: 10px; color: var(--muted); margin-top: 3px; }
.donut-legend { flex: 1; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 12.5px; }
.donut-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.donut-legend-pct  { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ── Vertical Funnel (Reports) ── */
.v-funnel { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.vf-stage {
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12.5px; font-weight: 600;
  border-radius: 6px;
  height: 50px;
  transition: opacity 0.2s;
  position: relative;
}
.vf-stage:hover { opacity: 0.85; }
.vf-label-outside {
  font-size: 11px; color: var(--muted); text-align: center; margin-bottom: 2px; font-weight: 500;
}

/* ── Settings Left Menu ── */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }

.settings-menu {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: sticky; top: 84px;
}
.settings-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px;
  font-size: 13.5px; font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: all 0.15s;
  border-left: 3px solid transparent;
}
.settings-menu-item:last-child { border-bottom: none; }
.settings-menu-item:hover { background: var(--surface2); color: var(--text); }
.settings-menu-item.active {
  background: rgba(193,123,63,0.07);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ── Action Buttons in Table ── */
.actions { display: flex; gap: 6px; align-items: center; }

/* ── Bottom Tab Bar (Mobile) ── */
.bottom-tab-bar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.tab-inner { display: flex; justify-content: space-around; align-items: stretch; }
.tab-link {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  padding: 6px 8px;
  min-height: 46px; min-width: 56px;
  font-size: 10px; font-weight: 600;
  color: var(--muted); text-decoration: none;
  transition: color 0.15s;
}
.tab-link.active { color: var(--accent); }
.tab-icon { font-size: 21px; line-height: 1; }

/* ── Utilities ── */
.text-muted  { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.mt-4  { margin-top: 4px; }  .mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mt-28 { margin-top: 28px; } .mb-20 { margin-bottom: 20px; }
.mb-28 { margin-bottom: 28px; }
.gap-8  { gap: 8px; }  .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.w-full { width: 100%; }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .unit-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1024px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .two-col-6040, .two-col-5050, .two-col-4060 { grid-template-columns: 1fr; }
  .drawer-layout { grid-template-columns: 1fr; }
  .unit-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-wrapper { margin-left: 0; padding-bottom: 72px; }
  .bottom-tab-bar { display: block; }
  .page-content { padding: 16px; }
  .top-header { height: 56px; padding: 0 16px; }
  .page-title { font-size: 18px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .three-col { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
  .heatmap-grid { grid-template-columns: repeat(3, 1fr); }
  .unit-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-layout { grid-template-columns: 1fr; }
  .modal { max-width: 100%; margin: 0; border-radius: 16px 16px 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}
