/* ============================================
   RENTAL MANAGER — ENTERPRISE DESIGN SYSTEM v2
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ---- DESIGN TOKENS ---- */
:root {
  --bg: #f0f2f8;
  --sidebar: #0d1b3e;
  --sidebar-hover: rgba(255, 255, 255, .07);
  --sidebar-active-bg: rgba(37, 99, 235, .18);
  --sidebar-active-border: rgba(37, 99, 235, .5);
  --panel: #ffffff;
  --panel-raised: #f8faff;
  --line: #e2e8f5;
  --line-strong: #c8d4ec;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --orange: #d97706;
  --orange-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;
  --yellow: #ca8a04;
  --yellow-soft: #fefce8;
  --sh-sm: 0 1px 3px rgba(10, 20, 50, .06), 0 1px 2px rgba(10, 20, 50, .04);
  --sh: 0 4px 16px rgba(10, 20, 50, .08), 0 1px 4px rgba(10, 20, 50, .04);
  --sh-lg: 0 10px 40px rgba(10, 20, 50, .12), 0 4px 12px rgba(10, 20, 50, .06);
  --r: 12px;
  --r-sm: 8px;
  --r-lg: 16px;
  --r-full: 999px;
  --tx: 150ms ease;
}

/* ---- RESET ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  overflow-x: hidden; /* prevent any element from causing horizontal scroll */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.15rem;
  font-weight: 800;
}

h3 {
  font-size: 0.95rem;
}

p {
  margin: 0;
}

/* ---- CONTROLS ---- */
button,
input,
select,
textarea {
  font: inherit;
  border-radius: var(--r-sm);
  transition: var(--tx);
}

button {
  align-items: center;
  background: var(--blue);
  border: 1.5px solid var(--blue);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 700;
  gap: 6px;
  justify-content: center;
  min-height: 38px;
  padding: 8px 16px;
  white-space: nowrap;
}

button:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

button:active {
  transform: scale(.98);
}

button.ghost {
  background: var(--panel);
  border-color: var(--line-strong);
  color: var(--text-2);
  font-weight: 600;
}

button.ghost:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

button.danger {
  background: var(--red-soft);
  border-color: #fca5a5;
  color: var(--red);
  font-weight: 700;
}

button.danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

button.success {
  background: var(--green-soft);
  border-color: #a7f3d0;
  color: var(--green);
}

button.success:hover {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

button.sm {
  font-size: 0.78rem;
  min-height: 32px;
  padding: 5px 12px;
}

button.xs {
  font-size: 0.72rem;
  min-height: 27px;
  padding: 3px 9px;
}

button[disabled],
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

input,
select,
textarea {
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  color: var(--text);
  min-height: 40px;
  padding: 9px 12px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
  outline: none;
}

input::placeholder {
  color: var(--muted);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.72rem;
  font-weight: 700;
  gap: 6px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---- APP SHELL ---- */
.app {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  background: var(--sidebar);
  color: #e2e8f5;
  display: flex;
  flex-direction: column;
  height: 100vh;
  left: 0;
  padding: 0;
  position: fixed;
  top: 0;
  transition: transform var(--tx);
  width: 220px;
  z-index: 20;
}

.sidebar-brand {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 10px;
  padding: 18px 16px 16px;
}

.sidebar-logo {
  align-items: center;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 9px;
  color: #fff;
  display: flex;
  flex: 0 0 34px;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.sidebar-brand-text strong {
  color: #fff;
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
}

.sidebar-brand-text span {
  color: rgba(255, 255, 255, .38);
  font-size: 0.66rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1px;
  padding: 8px 10px;
  overflow-y: auto;
  min-height: 0;
}

.nav-group-label {
  color: rgba(255, 255, 255, .28);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: .09em;
  padding: 12px 8px 3px;
  text-transform: uppercase;
}

.nav-item {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(255, 255, 255, .5);
  cursor: pointer;
  display: flex;
  font-size: 0.8rem;
  font-weight: 500;
  gap: 9px;
  justify-content: flex-start;
  min-height: 38px;
  padding: 8px 10px;
  text-align: left;
  transition: all var(--tx);
  width: 100%;
}

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255, 255, 255, .9);
}

.nav-item.active {
  background: rgba(59,130,246,.22);
  color: #93c5fd;
  font-weight: 600;
}

.nav-item .ni { flex: 0 0 18px; font-size: 0.95rem; text-align: center; }
.ni-svg { flex: 0 0 16px; height: 16px; width: 16px; opacity: .75; }
.nav-item:hover .ni-svg, .nav-item.active .ni-svg { opacity: 1; }

/* Sidebar monthly summary card */
.sidebar-month-summary {
  background: rgba(255,255,255,.06);
  border-radius: 12px;
  flex-shrink: 0;
  margin: 0 10px 12px;
  padding: 14px 14px 12px;
}
.sms-title {
  color: rgba(255,255,255,.55);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: .06em;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.sms-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.sms-rate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
  margin-bottom: 10px;
}
.sms-lbl { color: rgba(255,255,255,.45); font-size: 0.72rem; }
.sms-val { font-size: 0.85rem; font-weight: 700; color: #fff; }
.sms-green { color: #4ade80; }
.sms-orange { color: #fb923c; }
.sms-rate { color: #4ade80; font-size: 1.35rem; font-weight: 900; }
.sms-btn {
  background: rgba(255,255,255,.1);
  border: none;
  border-radius: 7px;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  min-height: 0;
  padding: 7px 12px;
  width: 100%;
  transition: background var(--tx);
  text-align: center;
}
.sms-btn:hover { background: rgba(255,255,255,.18); color: #fff; border-color: transparent; }

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .25);
  flex-shrink: 0;
  font-size: 0.7rem;
  padding: 12px 16px;
}

/* ---- WORKSPACE ---- */
.workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-left: 220px;
  min-width: 0;
}

/* ---- TOPBAR ---- */
.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--sh-sm);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  align-items: center;
  display: flex;
  gap: 12px;
}

.menu-btn {
  border: none;
  padding: 8px;
  min-height: 0;
  background: transparent;
  color: var(--muted);
}
.menu-btn:hover { background: var(--panel-raised); color: var(--text); border-color: transparent; }

.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.topbar-title h1 {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
}

.topbar-subtitle-btn {
  align-items: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 500;
  gap: 4px;
  min-height: 0;
  padding: 2px 0;
  transition: color var(--tx);
}
.topbar-subtitle-btn:hover { color: var(--blue); border-color: transparent; background: none; }

.topbar-right {
  align-items: center;
  display: flex;
  gap: 8px;
}

.topbar-search {
  position: relative;
}

.topbar-search input {
  background: var(--panel-raised);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  font-size: 0.8rem;
  min-height: 36px;
  padding: 6px 60px 6px 36px;
  width: 260px;
}

.topbar-search input:focus { background: var(--panel); }
.search-svg {
  left: 12px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-kbd {
  background: var(--panel-raised);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 600;
  padding: 2px 6px;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.topbar-icon-btn {
  align-items: center;
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  height: 36px;
  justify-content: center;
  min-height: 0;
  padding: 0;
  position: relative;
  transition: all var(--tx);
  width: 36px;
}
.topbar-icon-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.notif-badge {
  align-items: center;
  background: var(--red);
  border: 2px solid var(--panel);
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-size: 0.55rem;
  font-weight: 800;
  height: 17px;
  justify-content: center;
  min-width: 17px;
  position: absolute;
  right: -5px;
  top: -5px;
}
.topbar-add-wrap { position: relative; }
.topbar-add-btn {
  align-items: center;
  background: var(--blue);
  border: none;
  border-radius: var(--r-sm);
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  transition: background var(--tx);
}
.topbar-add-btn:hover { background: var(--blue-dark); border-color: transparent; }
.add-new-dropdown {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-lg);
  display: none;
  flex-direction: column;
  min-width: 170px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 100;
}
.add-new-dropdown.open { display: flex; }
.add-new-item {
  align-items: center;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  font-size: 0.8rem;
  font-weight: 500;
  gap: 8px;
  justify-content: flex-start;
  min-height: 34px;
  padding: 6px 10px;
  text-align: left;
  transition: background var(--tx);
  width: 100%;
}
.add-new-item:hover { background: var(--panel-raised); color: var(--blue); border-color: transparent; }

/* ---- legacy pills (hidden on dashboard, used elsewhere) ---- */
.summary-pills {
  align-items: center;
  display: flex;
  gap: 6px;
}

.pill {
  align-items: center;
  background: var(--panel-raised);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  display: flex;
  font-size: 0.75rem;
  font-weight: 700;
  gap: 6px;
  padding: 5px 12px;
  white-space: nowrap;
}

.pill .pd {
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 7px;
  height: 7px;
  width: 7px;
}

.pill-blue .pd {
  background: var(--blue);
}

.pill-green .pd {
  background: var(--green);
}

.pill-red .pd {
  background: var(--red);
}

.topbar-month label {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 0.68rem;
  font-weight: 700;
  gap: 3px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.topbar-month input[type="month"] {
  min-height: 34px;
  padding: 5px 9px;
  width: 148px;
}

.menu-btn {
  display: none;
}

.api-hidden {
  display: none !important;
}

/* ---- MAIN ---- */
.main {
  flex: 1;
  padding: 22px 26px 56px;
  overflow-y: auto;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-head {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.screen-title h2 {
  font-size: 1.2rem;
  margin-bottom: 3px;
}

.screen-title p {
  color: var(--muted);
  font-size: 0.82rem;
}

.head-actions {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- STAT CARDS GRID ---- */
.stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 20px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}

.stat-card-hd {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.stat-icon {
  align-items: center;
  border-radius: var(--r-sm);
  display: flex;
  font-size: 1rem;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.stat-val {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
}

.stat-meta {
  color: var(--muted);
  font-size: 0.76rem;
}

.tone-blue .stat-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

.tone-blue .stat-val {
  color: var(--blue);
}

.tone-green .stat-icon {
  background: var(--green-soft);
  color: var(--green);
}

.tone-green .stat-val {
  color: var(--green);
}

.tone-red .stat-icon {
  background: var(--red-soft);
  color: var(--red);
}

.tone-red .stat-val {
  color: var(--red);
}

.tone-orange .stat-icon {
  background: var(--orange-soft);
  color: var(--orange);
}

.tone-orange .stat-val {
  color: var(--orange);
}

.tone-purple .stat-icon {
  background: var(--purple-soft);
  color: var(--purple);
}

.tone-purple .stat-val {
  color: var(--purple);
}

.tone-neutral .stat-icon {
  background: var(--panel-raised);
  color: var(--muted);
}

/* ---- FILTER BAR ---- */
.filter-bar {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 16px;
}

.filter-bar input {
  flex: 1;
  min-width: 160px;
}

.filter-bar select {
  min-width: 130px;
  width: auto;
}

/* ---- CHIPS ---- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  align-items: center;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 5px;
  justify-content: center;
  min-height: 30px;
  padding: 4px 13px;
  transition: all var(--tx);
}

.chip:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

.chip.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ---- TABS ---- */
.tabs {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding: 5px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 15px;
  white-space: nowrap;
}

.tab:hover {
  background: var(--panel-raised);
  color: var(--text);
  border-color: transparent;
}

.tab.active {
  background: var(--blue-soft);
  border-color: #bfdbfe;
  color: var(--blue);
  font-weight: 700;
}

.tab-count {
  background: currentColor;
  border-radius: var(--r-full);
  color: white;
  display: inline-block;
  font-size: 0.68rem;
  min-width: 18px;
  padding: 1px 5px;
  text-align: center;
  filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

/* ---- WORKFLOW ROWS ---- */
.wlist {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.wrow {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  display: grid;
  gap: 12px;
  grid-template-columns: 2fr 1.2fr 1.1fr 1fr auto;
  padding: 14px 16px;
  transition: box-shadow var(--tx), border-left-color var(--tx);
}

.wrow:hover {
  box-shadow: var(--sh);
}

.wrow.pending {
  border-left-color: var(--red);
}

.wrow.partial {
  border-left-color: var(--orange);
}

.wrow.paid {
  border-left-color: var(--green);
}

.wrow.expiring {
  border-left-color: var(--orange);
}

.wrow.expired {
  border-left-color: var(--red);
}

.wrow.vacant {
  border-left-color: var(--yellow);
}

.wn {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 1px;
}

.ws {
  color: var(--muted);
  font-size: 0.77rem;
  margin-bottom: 3px;
}

.wl {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .03em;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.wv {
  font-size: 0.9rem;
  font-weight: 700;
}

.wacts {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

/* ---- BADGE ---- */
.badge {
  align-items: center;
  border-radius: var(--r-full);
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 800;
  gap: 4px;
  letter-spacing: .04em;
  padding: 2px 9px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge::before {
  background: currentColor;
  border-radius: 50%;
  content: '';
  display: inline-block;
  flex: 0 0 5px;
  height: 5px;
  width: 5px;
  filter: none;
}

.badge.paid,
.badge.active {
  background: var(--green-soft);
  color: var(--green);
}

.badge.partial {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge.pending {
  background: var(--red-soft);
  color: var(--red);
}

.badge.ending,
.badge.endingthismonth,
.badge.endingnextmonth,
.badge.expiring {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge.expired,
.badge.movedout {
  background: var(--red-soft);
  color: var(--red);
}

.badge.occupied {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.vacant {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.badge.neutral {
  background: var(--panel-raised);
  color: var(--muted);
}

.badge.valid {
  background: var(--green-soft);
  color: var(--green);
}

.badge.noexpiry {
  background: var(--panel-raised);
  color: var(--muted);
}

.badge.movin {
  background: #ecfeff;
  color: #0891b2;
}

/* ---- CARD ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  margin-bottom: 14px;
  padding: 20px;
}

.card-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: .05em;
  margin-bottom: 14px;
  text-transform: uppercase;
}

/* ---- FORM ---- */
.form-grid {
  display: grid;
  gap: 13px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-grid .span {
  grid-column: 1/-1;
}

.form-actions {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
  padding-top: 14px;
}

/* ---- TABLE ---- */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

table {
  border-collapse: collapse;
  min-width: 640px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--panel-raised);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  font-size: 0.835rem;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #f8fbff;
}

td strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
}

td .sub {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 1px;
}

/* ---- PROFILE ---- */
.profile-hd {
  align-items: center;
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
  border-radius: var(--r-lg);
  color: #fff;
  display: flex;
  gap: 18px;
  margin-bottom: 16px;
  padding: 22px;
  flex-wrap: wrap;
}

.profile-avatar {
  align-items: center;
  background: rgba(255, 255, 255, .2);
  border: 2px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  display: flex;
  flex: 0 0 60px;
  font-size: 1.25rem;
  font-weight: 900;
  height: 60px;
  justify-content: center;
  width: 60px;
}

.profile-info {
  flex: 1;
  min-width: 200px;
}

.profile-info h2 {
  color: #fff;
  font-size: 1.15rem;
  margin-bottom: 3px;
}

.profile-sub {
  color: rgba(255, 255, 255, .65);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pm-item {
  align-items: center;
  background: rgba(255, 255, 255, .15);
  border-radius: var(--r-sm);
  display: flex;
  font-size: 0.77rem;
  gap: 5px;
  padding: 3px 9px;
}

.profile-acts {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  padding: 20px;
}

/* ---- DETAIL ROWS ---- */
.detail-row {
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
}

.detail-row:last-child {
  border: 0;
}

.detail-row span:first-child {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.detail-row span:last-child {
  font-size: 0.87rem;
  font-weight: 700;
}

.two-col {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

/* ---- DOCUMENTS ---- */
.doc-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  padding: 11px 13px;
  transition: border-color var(--tx);
}

.doc-row:hover {
  border-color: var(--blue);
}

.doc-icon {
  align-items: center;
  background: var(--blue-soft);
  border-radius: 8px;
  color: var(--blue);
  display: flex;
  flex: 0 0 36px;
  font-size: 1rem;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.doc-info {
  flex: 1;
  min-width: 0;
}

.doc-info strong {
  display: block;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-info span {
  color: var(--muted);
  font-size: 0.75rem;
}

.doc-acts {
  align-items: center;
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ---- LEDGER TABLE ---- */
.ledger-month {
  border-bottom: 2px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.ledger-month-hd {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ledger-month-title {
  font-size: 0.9rem;
  font-weight: 800;
}

.ledger-month-stats {
  align-items: center;
  display: flex;
  gap: 14px;
  font-size: 0.8rem;
}

/* ---- MODAL ---- */
.modal {
  background: var(--panel);
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  margin: auto;
  max-height: calc(100vh - 64px);
  max-width: min(500px, calc(100vw - 32px));
  overflow-y: auto;
  padding: 0;
  width: 500px;
}

.sheet-handle {
  display: none; /* mobile bottom-sheet grabber, shown only ≤768px */
}

.modal::backdrop {
  backdrop-filter: blur(4px);
  background: rgba(8, 15, 35, .52);
}

.modal-hd {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 17px 22px;
}

.modal-hd h2 {
  font-size: 1.05rem;
  font-weight: 800;
}

.modal-close {
  align-items: center;
  background: var(--panel-raised);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 1.1rem;
  height: 30px;
  justify-content: center;
  min-height: auto;
  padding: 0;
  width: 30px;
}

.modal-close:hover {
  background: var(--red-soft);
  border-color: #fca5a5;
  color: var(--red);
}

.modal-body {
  display: grid;
  gap: 15px;
  padding: 20px 22px;
}

.modal-footer {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 22px;
}

/* ---- RENT MODAL ---- */
.rent-summary {
  background: linear-gradient(135deg, #eff6ff, #e0ecff);
  border: 1px solid #bfdbfe;
  border-radius: var(--r);
  display: grid;
  gap: 12px;
  padding: 15px;
}

.rent-summary-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr 1fr;
}

.rsi {
  text-align: center;
}

.rsi-label {
  color: var(--muted);
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.rsi-val {
  font-size: 0.95rem;
  font-weight: 800;
}

.rsi-bal .rsi-val {
  color: var(--red);
  font-size: 1.05rem;
}

.rsi-paid .rsi-val {
  color: var(--green);
}

.quick-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.qbtn {
  background: var(--blue-soft);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--r-sm);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
  min-height: 33px;
  padding: 5px 12px;
}

.qbtn:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* Rent + Water breakdown in payment modal */
.rsb-breakdown {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rsb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.rsb-label {
  color: var(--muted);
  font-weight: 500;
}

.rsb-amt {
  font-weight: 700;
}

.rsb-water {
  color: #0ea5e9;
}

.rsb-divider {
  border-top: 1px dashed var(--border);
  margin: 2px 0;
}

.rsb-total .rsb-label,
.rsb-total .rsb-amt {
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 800;
}

/* GPay screenshot parser button */
.screenshot-parse-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.screenshot-parse-btn {
  cursor: pointer;
  background: var(--surface2);
  border: 1.5px dashed var(--primary);
  border-radius: var(--r-sm);
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  transition: background .15s, border-color .15s;
  white-space: nowrap;
  user-select: none;
}

.screenshot-parse-btn:hover {
  background: #eff6ff;
  border-color: var(--blue);
}

.parse-status {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

.ps-ok  { color: var(--green); }
.ps-warn { color: var(--orange); }
.ps-err  { color: var(--red); }

.rent-extra-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
}

.rent-extra-chk {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}

.rent-extra-chk input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.rent-extra-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

.rent-extra-fields {
  display: flex;
  gap: 8px;
}

.rent-extra-fields input[type="number"] {
  flex: 0 0 120px;
}

.rent-extra-fields input[type="text"] {
  flex: 1;
}

.live-preview {
  align-items: center;
  border-radius: var(--r-sm);
  display: none;
  font-size: 0.8rem;
  font-weight: 700;
  gap: 7px;
  padding: 9px 13px;
}

.live-preview.show {
  display: flex;
}

.lp-ok {
  background: var(--green-soft);
  border: 1px solid #a7f3d0;
  color: var(--green);
}

.lp-err {
  background: var(--red-soft);
  border: 1px solid #fca5a5;
  color: var(--red);
}

/* ---- MOVEOUT WIZARD ---- */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
}

.wizard-step {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 8px;
}

.step-num {
  align-items: center;
  background: var(--line);
  border-radius: 50%;
  color: var(--muted);
  display: flex;
  flex: 0 0 28px;
  font-size: 0.8rem;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.step-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.step-line {
  background: var(--line);
  flex: 1;
  height: 2px;
  margin: 0 4px;
}

.wizard-step.active .step-num {
  background: var(--blue);
  color: #fff;
}

.wizard-step.active .step-label {
  color: var(--blue);
  font-weight: 700;
}

.wizard-step.done .step-num {
  background: var(--green);
  color: #fff;
}

.wizard-step.done .step-label {
  color: var(--green);
}

.wizard-step.done .step-line {
  background: var(--green);
}

.wizard-panel {
  display: none;
}

.wizard-panel.active {
  display: block;
}

/* ---- DEDUCTIONS ---- */
.deduction-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.settlement-row {
  align-items: center;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
}

.sr-refund {
  background: var(--green-soft);
  border-color: #a7f3d0;
}

/* ---- REPORTS ---- */
.report-section {
  margin-bottom: 28px;
}

.report-section-title {
  align-items: center;
  border-bottom: 2px solid var(--line);
  display: flex;
  font-size: 0.9rem;
  font-weight: 800;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.report-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.report-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  padding: 18px;
}

.rc-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 9px;
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.rc-icon {
  align-items: center;
  background: var(--blue-soft);
  border-radius: var(--r-sm);
  color: var(--blue);
  display: flex;
  font-size: 0.95rem;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.rc-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.rc-body {
  color: var(--text-2);
  font-size: 0.82rem;
  line-height: 1.75;
}

.rc-big {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 3px;
}

/* ---- RENT COLLECTION SUMMARY BAR ---- */
.rent-summary-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  margin-bottom: 18px;
  padding: 18px 20px;
}

.rent-summary-bar-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: .06em;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.rent-summary-kpis {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 14px;
}

.rent-kpi {
  padding: 0 16px;
  border-right: 1px solid var(--line);
}

.rent-kpi:first-child { padding-left: 0; }
.rent-kpi:last-child  { border-right: none; }

.rent-kpi-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.rent-kpi-val {
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}

.rent-kpi-val.blue  { color: var(--blue); }
.rent-kpi-val.green { color: var(--green); }
.rent-kpi-val.orange{ color: var(--orange); }

.rent-kpi-sub {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 3px;
}

.bar-track {
  background: var(--line);
  border-radius: var(--r-full);
  height: 8px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  background: var(--green);
  border-radius: var(--r-full);
  height: 100%;
  transition: width .4s ease;
}

.bar-fill.orange { background: var(--orange); }
.bar-fill.red    { background: var(--red); }

.bar-label {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 5px;
  text-align: right;
}

/* ---- STAT CARD PROGRESS ---- */
.stat-card .bar-track {
  margin-top: 6px;
}

/* ---- EXPIRY GROUP ---- */
.expiry-group {
  margin-bottom: 18px;
}

.expiry-group-title {
  align-items: center;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: flex;
  font-size: 0.78rem;
  font-weight: 800;
  gap: 8px;
  letter-spacing: .04em;
  margin-bottom: 10px;
  padding: 8px 14px;
  text-transform: uppercase;
}

.expiry-group-title.expired {
  border-color: #fca5a5;
  background: var(--red-soft);
  color: var(--red);
}

.expiry-group-title.thisweek {
  border-color: #fde68a;
  background: var(--orange-soft);
  color: var(--orange);
}

.expiry-group-title.thismonth {
  border-color: #fde68a;
  background: var(--orange-soft);
  color: var(--orange);
}

.expiry-group-title.next,
.expiry-group-title.months2,
.expiry-group-title.months3 {
  border-color: #bfdbfe;
  background: var(--blue-soft);
  color: var(--blue);
}

.expiry-group-title.movin {
  background: #ecfeff;
  border-color: #a5f3fc;
  color: #0891b2;
}

.expiry-group-title.active {
  background: var(--green-soft);
  border-color: #6ee7b7;
  color: var(--green);
}

/* ---- VACANCY PILL ---- */
.vacancy-pill {
  align-items: center;
  background: var(--yellow-soft);
  border: 1px solid #fde68a;
  border-radius: var(--r-full);
  color: var(--yellow);
  display: inline-flex;
  font-size: 0.73rem;
  font-weight: 700;
  gap: 4px;
  padding: 2px 9px;
}

/* ---- EMPTY STATE ---- */
.empty {
  align-items: center;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 36px 20px;
  text-align: center;
}

.empty .ei {
  font-size: 2rem;
  opacity: .45;
}

.empty .et {
  font-size: 0.9rem;
  font-weight: 700;
}

.empty .ed {
  font-size: 0.8rem;
}

/* ---- TOAST ---- */
.toast {
  align-items: center;
  background: #0f172a;
  border-radius: var(--r);
  bottom: 22px;
  box-shadow: var(--sh-lg);
  color: #fff;
  display: flex;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 9px;
  left: 50%;
  max-width: 420px;
  opacity: 0;
  padding: 13px 17px;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%) translateY(10px);
  transition: all .22s cubic-bezier(.34, 1.56, .64, 1);
  white-space: nowrap;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: #065f46;
}

.toast.error {
  background: #7f1d1d;
}

.toast.info {
  background: #1e3a8a;
}

.toast-undo {
  background: rgba(255, 255, 255, .16);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 10px;
  text-decoration: underline;
  white-space: nowrap;
}

.toast-undo:hover {
  background: rgba(255, 255, 255, .28);
}

.toast-undo:disabled {
  cursor: default;
  opacity: .5;
}

/* ---- UTILITY ---- */
.muted {
  color: var(--muted);
}

.t-green {
  color: var(--green);
}

.t-red {
  color: var(--red);
}

.t-blue {
  color: var(--blue);
}

.t-orange {
  color: var(--orange);
}

.fw7 {
  font-weight: 700;
}

.fw8 {
  font-weight: 800;
}

.fs-sm {
  font-size: 0.8rem;
}

.fs-xs {
  font-size: 0.73rem;
}

.mb8 {
  margin-bottom: 8px;
}

.mb14 {
  margin-bottom: 14px;
}

.mt8 {
  margin-top: 8px;
}

.flex {
  display: flex;
}

.flex-gap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flex-between {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.overflow-x {
  overflow-x: auto;
}

.text-center {
  text-align: center;
}

/* ================================================================
   ENTERPRISE DASHBOARD — NEW LAYOUT
   ================================================================ */

/* Dash topbar */
.dash-topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}
.dash-subtitle {
  color: var(--muted);
  font-size: 0.83rem;
}

/* ══════════════════════════════════════
   DASHBOARD — NEW DESIGN
   ══════════════════════════════════════ */

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

/* KPI card — flat white with icon on left */
.kpi2 {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  padding: 20px 22px 16px;
  position: relative;
}
.kpi2-body { align-items: flex-start; display: flex; gap: 14px; }
.kpi2-icon-badge {
  align-items: center;
  border-radius: 14px;
  display: flex;
  flex: 0 0 46px;
  height: 46px;
  justify-content: center;
  width: 46px;
  margin-top: 2px;
}
.kpi2-badge-green  { background: #dcfce7; color: var(--green); }
.kpi2-badge-orange { background: #ffedd5; color: var(--orange); }
.kpi2-badge-blue   { background: #dbeafe; color: var(--blue); }
.kpi2-badge-purple { background: #ede9fe; color: var(--purple); }
.kpi2-content { flex: 1; min-width: 0; }
.kpi2-label { color: var(--muted); font-size: 0.72rem; font-weight: 600; margin-bottom: 5px; }
.kpi2-val   { font-size: 2rem; font-weight: 900; line-height: 1.1; letter-spacing: -.02em; }
.kpi2-green  .kpi2-val { color: var(--green); }
.kpi2-orange .kpi2-val { color: var(--orange); }
.kpi2-blue   .kpi2-val { color: var(--blue); }
.kpi2-purple .kpi2-val { color: var(--purple); }
.kpi2-sub   { color: var(--muted); font-size: 0.73rem; margin-top: 4px; line-height: 1.6; }
.kpi2-sparkline { margin-top: 12px; }
.kpi2-water { color: #0ea5e9; font-weight: 600; display: block; margin-top: 1px; }
.kpi2-pct   { font-weight: 700; }
.pct-green  { color: var(--green); }
.pct-orange { color: var(--orange); }
.pct-red    { color: var(--red); }
.pct-blue   { color: var(--blue); }
.pct-purple { color: var(--purple); }
/* Progress bar at card bottom */
.kpi2-progbar {
  background: var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  bottom: 0; left: 0; right: 0;
  height: 4px;
  margin: 14px -22px -16px;
  overflow: hidden;
}
.kpi2-progfill {
  height: 100%;
  border-radius: inherit;
  transition: width 700ms ease;
}
/* Donut in KPI4 */
.kpi2-donut-wrap { position: absolute; right: 18px; top: 18px; }

/* ── Info Cards (enterprise 4-col) ── */
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  padding: 18px 20px 14px;
}
.kpi-card.kpi-blue  { border-left-color: var(--blue); }
.kpi-card.kpi-green { border-left-color: var(--green); }
.kpi-card.kpi-orange{ border-left-color: var(--orange); }
.kpi-card.kpi-purple{ border-left-color: #7c3aed; }
.kpi-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: .07em;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.kpi-value {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 6px;
}
.kpi-card.kpi-blue .kpi-value  { color: var(--blue); }
.kpi-card.kpi-green .kpi-value { color: var(--green); }
.kpi-card.kpi-orange .kpi-value{ color: var(--orange); }
.kpi-card.kpi-purple .kpi-value{ color: #7c3aed; }
.kpi-meta { color: var(--muted); font-size: 0.73rem; }
.kpi-sub  { margin-top: 4px; }

/* ── Info cards row (enterprise 4-column) ── */
.dash-info-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 16px;
}

/* icard = enterprise info card */
.icard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.icard-hd {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  padding: 14px 18px;
}
.icard-icon-wrap {
  align-items: center;
  border-radius: 10px;
  display: flex;
  flex: 0 0 36px;
  height: 36px;
  justify-content: center;
  width: 36px;
}
.icard-title { font-size: 0.83rem; font-weight: 800; }
.icard-stats-row {
  display: flex;
  gap: 0;
  padding: 14px 18px;
}
.icard-stat {
  flex: 1;
  min-width: 0;
}
.icard-stat-lbl {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.icard-stat-val {
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1.1;
}
.icard-stat-note { color: var(--muted); font-size: 0.65rem; margin-top: 2px; }
.icard-bold { font-size: 1.5rem; }
.icard-pct  { color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.icard-divider { border-top: 1px solid var(--line); margin: 0 18px; }
.icard-bar-wrap { padding: 0 18px 16px; }
.icard-bar-track { background: var(--line); border-radius: 99px; height: 8px; margin-bottom: 6px; overflow: hidden; }
.icard-bar-fill  { background: linear-gradient(90deg, var(--green), #34d399); border-radius: 99px; height: 100%; transition: width .5s ease; }
.icard-bar-lbl   { color: var(--muted); font-size: 0.72rem; font-weight: 600; }
/* Donut layout inside icard */
.icard-donut-layout {
  align-items: center;
  display: flex;
  gap: 12px;
  padding: 14px 18px;
}
.icard-donut-legend { flex: 1; min-width: 0; }
.icard-legend-row {
  align-items: center;
  display: flex;
  font-size: 0.77rem;
  gap: 7px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.icard-legend-row:last-child { border-bottom: none; }
.icard-dot   { border-radius: 50%; flex: 0 0 9px; height: 9px; width: 9px; }
.icard-legend-lbl { color: var(--muted); flex: 1; }
.icard-legend-val { font-weight: 700; }

/* ── Trend summary row ── */
.trend-summary-row {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0;
  grid-template-columns: repeat(4, 1fr);
}
.trend-kpi {
  border-right: 1px solid var(--line);
  padding: 10px 16px;
  text-align: center;
}
.trend-kpi:last-child { border-right: none; }
.trend-kpi-lbl { color: var(--muted); font-size: 0.65rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 3px; }
.trend-kpi-val { font-size: 0.9rem; font-weight: 800; }
.trend-kpi-val.green { color: var(--green); }
.trend-kpi-val.orange { color: var(--orange); }
.trend-kpi-val.blue { color: var(--blue); }
.trend-kpi-val.red { color: var(--red); }
.trend-kpi-note { color: var(--muted); font-size: 0.63rem; margin-top: 2px; }
.trend-svg { width: 100%; height: auto; display: block; }

/* ── Aside empty state ── */
.aside-empty { color: var(--muted); font-size: 0.78rem; padding: 10px 0; text-align: center; }

/* ── Monthly Summary rows ── */
.msrow {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 10px 18px;
}
.msrow-lbl { color: var(--muted); font-size: 0.78rem; }
.msrow-val { font-size: 0.85rem; font-weight: 700; }
.msrow-section-hd { background: var(--surface2); padding: 6px 18px; border-bottom: 1px solid var(--line); }

/* Legacy info-chip kept for safety */
.info-chip {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  text-align: center;
}
.info-chip-label { color: var(--muted); font-size: 0.63rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.info-chip-val { font-size: 0.93rem; font-weight: 800; }
.info-chip-val.ic-blue  { color: var(--blue); }
.info-chip-val.ic-green { color: var(--green); }
.info-chip-val.ic-orange{ color: var(--orange); }
.info-chip-sub { color: var(--muted); font-size: 0.63rem; }

/* ── Calendar View ── */
.cal-stat-row { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.cal-stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: 16px 18px; }
.cal-stat-icon { align-items: center; border-radius: 12px; display: flex; height: 38px; justify-content: center; margin-bottom: 10px; width: 38px; }
.cal-stat-label { color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.cal-stat-val { font-size: 1.5rem; font-weight: 900; letter-spacing: -.01em; line-height: 1.25; margin-top: 3px; }
.cal-stat-sub { color: var(--muted); font-size: 0.7rem; font-weight: 600; margin-top: 2px; }

.cal-layout { align-items: start; display: grid; gap: 16px; grid-template-columns: 1fr 330px; }
.cal-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: 18px 18px 20px; }
.cal-legend { align-items: center; color: var(--muted); display: flex; flex-wrap: wrap; font-size: 0.76rem; font-weight: 600; gap: 16px; margin-bottom: 16px; }
.cal-legend-item { align-items: center; display: flex; gap: 6px; }
.cal-dot { border-radius: 50%; box-shadow: 0 0 0 3px rgba(0,0,0,.04); display: inline-block; height: 8px; width: 8px; }
.cal-dot.received { background: var(--green); }
.cal-dot.partial  { background: var(--orange); }
.cal-dot.pending  { background: var(--red); }
.cal-dot.upcoming { background: var(--blue); }
.cal-nav { align-items: center; display: flex; gap: 12px; margin-bottom: 16px; }
.cal-nav-btn { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--fg); cursor: pointer; font-size: 0.95rem; font-weight: 700; height: 30px; line-height: 1; width: 30px; transition: background .12s, border-color .12s; }
.cal-nav-btn:hover { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); }
.cal-nav-label { font-weight: 900; font-size: 1.08rem; letter-spacing: -.01em; }
.cal-grid { background: var(--line); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 1px; grid-template-columns: repeat(7, 1fr); overflow: hidden; }
.cal-dow { background: var(--panel-2, #f8faff); color: var(--muted); font-size: 0.66rem; font-weight: 800; letter-spacing: .05em; padding: 10px 6px; text-align: center; text-transform: uppercase; }
.cal-cell { background: var(--panel); min-height: 104px; padding: 8px 7px 9px; position: relative; transition: background .12s; }
.cal-cell.empty { background: var(--panel-2, #f8faff); }
.cal-cell.today { background: var(--blue-soft); box-shadow: inset 0 0 0 2px var(--blue); z-index: 1; }
.cal-daynum { color: var(--muted); font-size: 0.75rem; font-weight: 800; }
.cal-cell.today .cal-daynum { color: var(--blue-dark); }
.cal-today-pill { background: var(--blue); border-radius: 20px; color: #fff; float: right; font-size: 0.58rem; font-weight: 800; letter-spacing: .02em; padding: 2px 8px; text-transform: uppercase; }
.cal-entries { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.cal-entry { align-items: center; background: var(--panel-2, #f8faff); border: 1px solid transparent; border-radius: 6px; cursor: pointer; display: flex; font-size: 0.67rem; gap: 5px; padding: 3px 6px; transition: border-color .12s, transform .12s; }
.cal-entry:hover { border-color: var(--line-strong); transform: translateX(1px); }
.cal-entry-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-entry-amt { color: var(--muted); font-weight: 700; white-space: nowrap; }
.cal-more { color: var(--blue); font-size: 0.64rem; font-weight: 700; margin-top: 3px; }
.cal-day-total { border-top: 1px dashed var(--line); color: var(--muted); font-size: 0.63rem; font-weight: 800; margin-top: 5px; padding-top: 4px; }
.cal-unit-chip { background: var(--line-soft, #eef2fb); border-radius: 4px; color: var(--muted); flex-shrink: 0; font-size: 0.6rem; font-weight: 800; padding: 1px 5px; }

/* Sidebar polish: count pill, status text, today breakdown */
.cal-count-pill { background: var(--blue-soft); border-radius: 20px; color: var(--blue-dark); font-size: 0.68rem; font-weight: 800; padding: 3px 10px; }
.cal-status-text { font-weight: 700; margin-left: 6px; }
.cal-status-text.due { color: var(--orange); }
.cal-status-text.ok  { color: var(--green); }
.cal-side-row { transition: background .12s; }
.cal-side-row:hover { background: var(--panel-2, #f8faff); }
.cal-today-breakdown { border-bottom: 1px solid var(--line); display: grid; gap: 4px; grid-template-columns: repeat(3, 1fr); padding: 12px 16px; }
.cal-tb-lbl { color: var(--muted); font-size: 0.62rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.cal-tb-val { font-size: 0.95rem; font-weight: 800; margin-top: 2px; }
.cal-tb-val.green  { color: var(--green); }
.cal-tb-val.orange { color: var(--orange); }

/* ── Two-column grid ── */
.dash-grid {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 330px;
}
.dash-main-col { display: flex; flex-direction: column; gap: 14px; }
.dash-aside-col { display: flex; flex-direction: column; gap: 14px; }

/* ── Dash section card ── */
.dash-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.dash-section-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
}
.dash-section-title { font-size: 0.88rem; font-weight: 800; }
.dash-section-link {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0;
}
.dash-section-link:hover { text-decoration: underline; }

/* ── Donut chart area ── */
.donut-layout {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: 140px 1fr;
  padding: 18px 20px;
}
.donut-svg { height: 130px; width: 130px; }
.donut-stat {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  font-size: 0.8rem;
  justify-content: space-between;
  padding: 7px 0;
}
.donut-stat:last-child { border-bottom: none; }
.donut-stat-lbl { align-items: center; color: var(--muted); display: flex; gap: 7px; }
.donut-dot { border-radius: 50%; flex: 0 0 8px; height: 8px; width: 8px; }
.donut-stat-val { font-weight: 700; }

/* ── Collection filter tabs ── */
.coll-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 2px;
  padding: 8px 14px 0;
}
.coll-tab {
  align-items: center;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-family: inherit;
  font-size: 0.71rem;
  font-weight: 700;
  gap: 5px;
  letter-spacing: .01em;
  margin-bottom: -1px;
  padding: 7px 11px;
  transition: color var(--tx), border-color var(--tx), background var(--tx);
  white-space: nowrap;
}
.coll-tab.active {
  border-bottom-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}
.coll-tab:hover:not(.active) { color: var(--text); background: var(--panel-raised); }
.tab-cnt {
  background: var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 18px;
  padding: 1px 5px;
  text-align: center;
}
.coll-tab.active .tab-cnt { background: var(--blue); color: #fff; }
.tab-cnt-green { background: var(--green-soft); color: var(--green); }
.tab-cnt-red   { background: var(--red-soft);   color: var(--red); }
.tab-cnt-blue  { background: var(--blue-soft);  color: var(--blue); }
.tab-cnt-teal   { background: #ecfeff; color: #0891b2; }
.tab-cnt-orange { background: #fffbeb; color: #d97706; }

/* ── Collection table ── */
.coll-table-wrap { overflow-x: auto; padding: 0 18px 12px; }
.coll-table {
  border-collapse: collapse;
  font-size: 0.78rem;
  width: 100%;
}
.coll-table th {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 9px 8px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.coll-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  vertical-align: middle;
}
.coll-table tr:last-child td { border-bottom: none; }
.coll-table tr:hover td { background: var(--panel-raised); }
.coll-empty { text-align: center; padding: 28px; color: var(--muted); font-size: 0.82rem; }
.cell-muted { color: var(--muted); font-size: 0.78rem; }
.cell-rent-val { font-weight: 700; font-size: 0.82rem; }
.cell-water-sub { font-size: 0.65rem; color: #0ea5e9; font-weight: 600; margin-top: 1px; }
.fw7 { font-weight: 700; }
.th-note { font-weight: 400; font-size: 0.58rem; text-transform: none; letter-spacing: 0; opacity: .7; }

/* ── Tenant avatar ── */
.t-av {
  align-items: center;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: 0 0 30px;
  font-size: 0.64rem;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  text-transform: uppercase;
  width: 30px;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.t-cell { align-items: center; display: flex; gap: 8px; }
.t-cell-name { font-weight: 600; font-size: 0.82rem; line-height: 1.2; }
.t-cell-review { font-size: 0.63rem; color: var(--orange); font-weight: 600; margin-top: 1px; }

/* ── Status pill (table) ── */
.st-pill {
  border-radius: var(--r-full);
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: .05em;
  padding: 2px 9px;
  text-transform: uppercase;
  white-space: nowrap;
}
.st-pill.sp-paid     { background: var(--green-soft); color: var(--green); }
.st-pill.sp-pend     { background: var(--red-soft);   color: var(--red); }
.st-pill.sp-movin    { background: #ecfeff; color: #0891b2; }
.st-pill.sp-partial  { background: var(--orange-soft); color: var(--orange); }
.st-pill.sp-upcoming { background: #eff6ff; color: var(--blue); }
.st-pill.sp-review   { background: #fff7ed; color: var(--orange); margin-left: 4px; }

/* ── Right sidebar widgets ── */
.aside-widget {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.aside-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
}
.aside-title { font-size: 0.82rem; font-weight: 700; }
.aside-link {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
}
.aside-body { padding: 10px 14px; }

/* ── Upcoming item ── */
.up-item {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 38px 1fr auto;
  padding: 9px 0;
}
.up-item:last-child { border-bottom: none; }
.up-date {
  align-items: center;
  background: var(--red-soft);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  height: 38px;
  justify-content: center;
  width: 38px;
}
.up-mo { color: var(--red); font-size: 0.5rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.up-dy { color: var(--red); font-size: 0.95rem; font-weight: 900; line-height: 1; }
.up-name { font-size: 0.8rem; font-weight: 700; }
.up-unit { color: var(--muted); font-size: 0.7rem; }
.up-amt  { font-size: 0.82rem; font-weight: 800; text-align: right; }
.up-due  { color: var(--red); font-size: 0.68rem; text-align: right; }

/* ── Monthly trend SVG ── */
.trend-svg { display: block; height: 80px; overflow: visible; width: 100%; }
.trend-legend { display: flex; gap: 14px; font-size: 0.68rem; color: var(--muted); margin-bottom: 6px; }
.trend-legend span { align-items: center; display: flex; gap: 4px; }
.trend-legend .tl-line { display: inline-block; height: 2px; width: 14px; }

/* ── Quick actions ── */
.quick-grid { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.qa-btn {
  align-items: center;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  gap: 5px;
  padding: 11px 6px;
  transition: background var(--tx), border-color var(--tx), color var(--tx);
}
.qa-btn:hover { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.qa-icon { font-size: 1.25rem; }

/* ── Sidebar brokerage card ── */
.sidebar-brokerage-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r);
  margin: 0 12px 12px;
  padding: 14px;
  text-align: center;
}
.sbc-icon { font-size: 1.4rem; margin-bottom: 4px; }
.sbc-label { color: rgba(255,255,255,.45); font-size: 0.63rem; font-weight: 700; letter-spacing: .06em; margin-bottom: 4px; text-transform: uppercase; }
.sbc-val { color: #a78bfa; font-size: 1.25rem; font-weight: 900; margin-bottom: 2px; }
.sbc-sub { color: rgba(255,255,255,.35); font-size: 0.68rem; margin-bottom: 10px; }
.sbc-btn {
  background: rgba(167,139,250,.15);
  border: 1px solid rgba(167,139,250,.3);
  border-radius: var(--r-sm);
  color: #c4b5fd;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 5px 14px;
  width: 100%;
}
.sbc-btn:hover { background: rgba(167,139,250,.25); }

/* ── Action center widget ── */
.ac-widget { background:#fff; border:1px solid #e2e8f5; border-radius:14px; box-shadow:0 1px 4px rgba(10,20,50,.06); overflow:hidden; }
.ac-head { display:flex; align-items:center; gap:10px; padding:16px 18px 12px; border-bottom:1px solid #f1f5f9; }
.ac-head-title { font-size:0.9rem; font-weight:800; flex:1; }
.ac-total-badge { background:#ef4444; color:#fff; border-radius:10px; font-size:0.68rem; font-weight:800; padding:2px 8px; }
.ac-item { display:flex; align-items:center; gap:12px; padding:12px 18px; border-bottom:1px solid #f8faff; cursor:pointer; transition:background 150ms; }
.ac-item:hover { background:#f8faff; }
.ac-item:last-child { border-bottom:none; }
.ac-icon { width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex:0 0 36px; font-size:1.1rem; }
.ac-icon-red { background:#fef2f2; color:#dc2626; }
.ac-icon-orange { background:#fffbeb; color:#d97706; }
.ac-icon-blue { background:#eff6ff; color:#2563eb; }
.ac-icon-green { background:#ecfdf5; color:#059669; }
.ac-icon-teal { background:#ecfeff; color:#0891b2; }
.ac-icon-purple { background:#f5f3ff; color:#7c3aed; }
.ac-body { flex:1; min-width:0; }
.ac-title { font-size:0.8rem; font-weight:700; color:#0f172a; }
.ac-sub { font-size:0.7rem; color:#64748b; margin-top:1px; }
.ac-badge { background:#eff6ff; color:#2563eb; border-radius:10px; font-size:0.65rem; font-weight:800; padding:2px 8px; white-space:nowrap; }
.ac-badge-red { background:#fef2f2; color:#dc2626; }
.ac-badge-orange { background:#fffbeb; color:#d97706; }
.ac-arrow { color:#cbd5e1; font-size:1rem; }
.ac-view-all { display:block; text-align:center; padding:10px; font-size:0.76rem; color:#2563eb; font-weight:600; cursor:pointer; background:none; border:none; width:100%; border-top:1px solid #f1f5f9; font-family:inherit; }
.ac-view-all:hover { background:#f8faff; }

/* ── Quick actions bar ── */
.quick-bar { background:#fff; border:1px solid #e2e8f5; border-radius:14px; box-shadow:0 1px 4px rgba(10,20,50,.06); padding:14px 18px; display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.quick-bar-title { font-size:0.8rem; font-weight:700; color:#64748b; margin-right:6px; white-space:nowrap; }
.quick-bar-btns { display:flex; gap:8px; flex-wrap:wrap; flex:1; }
.qa-bar-btn { align-items:center; background:none; border:1.5px solid #e2e8f5; border-radius:9px; color:#334155; cursor:pointer; display:inline-flex; font-size:0.77rem; font-weight:600; font-family:inherit; gap:6px; padding:7px 13px; transition:all 150ms; white-space:nowrap; }
.qa-bar-btn:hover { border-color:#2563eb; color:#2563eb; background:#eff6ff; }

/* ── Recent payment rows in aside ── */
.rp-item { align-items:center; display:flex; gap:10px; padding:9px 16px; border-bottom:1px solid #f8faff; }
.rp-item:last-child { border-bottom:none; }
.rp-av { align-items:center; border-radius:50%; color:#fff; display:flex; flex:0 0 30px; font-size:0.63rem; font-weight:800; height:30px; justify-content:center; width:30px; }
.rp-body { flex:1; min-width:0; }
.rp-name { font-size:0.78rem; font-weight:600; color:#0f172a; }
.rp-meta { font-size:0.66rem; color:#64748b; margin-top:1px; }
.rp-amt { font-size:0.82rem; font-weight:700; color:#059669; white-space:nowrap; }

/* ── Needs-review row highlight ── */
.needs-review-row td { background:#fffbeb !important; }
.sp-review { background:#fffbeb; color:#d97706; }

/* ── Vacant unit badge in aside ── */
.vacant-badge-pill { background:#fff7ed; color:#d97706; border-radius:99px; font-size:0.63rem; font-weight:800; padding:2px 9px; white-space:nowrap; }

/* ================================================================ */

.section-divider {
  border: 0;
  border-top: 1.5px solid var(--line);
  margin: 20px 0;
}

/* ================================================================ */
/* ── MOBILE BOTTOM NAV ────────────────────────────────────────── */
.mobile-bottom-nav { display: none; }

/* ── SIDEBAR BACKDROP (mobile) ───────────────────────────────── */
.sidebar-backdrop { display: none; }

/* ── MOBILE RENT CARDS ───────────────────────────────────────── */
.mobile-rent-cards { display: none; }

/* ── MOBILE RENT SECTION FILTER TABS ────────────────────────── */
/* (re-uses .coll-tabs, shown above the cards on mobile) */

/* ================================================================ */
/* ---- RESPONSIVE ---- */
@media (max-width: 1400px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-info-row { grid-template-columns: repeat(2, 1fr); }
  .trend-summary-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 920px) {
  .wrow {
    grid-template-columns: 1fr 1fr;
  }

  .topbar {
    padding: 10px 16px;
  }

  .main {
    padding: 16px 16px 40px;
  }

  .summary-pills {
    display: none;
  }
}

@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .workspace {
    margin-left: 0;
  }

  .sidebar {
    flex: 0 0 auto;
    height: 100vh;
    left: 0;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    width: 240px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-btn {
    display: flex;
  }

  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dash-kpi-row { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-info-row { grid-template-columns: 1fr 1fr; }
  .trend-summary-row { grid-template-columns: 1fr 1fr; }

  .wrow {
    grid-template-columns: 1fr;
  }

  .profile-hd {
    flex-direction: column;
    text-align: center;
  }

  .screen-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .deduction-grid {
    grid-template-columns: 1fr;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .rent-summary-grid {
    grid-template-columns: 1fr;
  }

  .topbar-search input {
    width: 180px;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-width: calc(100vw - 16px);
    width: 100%;
  }
}

/* ================================================================ */
/* ── MOBILE-SPECIFIC OVERRIDES (≤ 768px) ─────────────────────── */
@media (max-width: 768px) {

  /* Sidebar backdrop */
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 98;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  .sidebar.open ~ .sidebar-backdrop {
    opacity: 1;
    pointer-events: all;
  }

  /* Sidebar z-index above backdrop */
  .sidebar { z-index: 100; }

  /* Topbar: hide search on mobile, tighten */
  .topbar-search { display: none; }
  .topbar { min-height: 56px; padding: 0 14px; gap: 6px; }
  .topbar-title h1 { font-size: 1.05rem; }
  /* Compact add button on mobile */
  .topbar-add-wrap { position: relative; }

  /* Main: extra bottom padding for bottom nav */
  .main { padding: 14px 12px 80px; }

  /* Dashboard grid stays 1-col (already set), reduce gap */
  .dash-grid { gap: 10px; }
  .dash-kpi-row { gap: 10px; }

  /* KPI cards: slightly reduce padding */
  .kpi2 { padding: 16px 16px 12px; }
  .kpi2-val { font-size: 1.7rem; }
  .kpi2-icon-badge { width: 40px; height: 40px; }

  /* Collection table HIDDEN on mobile — replaced by cards */
  .coll-table-wrap { display: none !important; }
  /* Keep tabs visible above cards */

  /* Quick bar: wrap nicely */
  .quick-bar { flex-wrap: wrap; gap: 8px; }
  .qa-bar-btn { flex: 1 1 calc(50% - 4px); justify-content: center; padding: 10px 8px; font-size: 0.78rem; }

  /* Trend chart: allow horizontal scroll */
  .trend-svg { min-width: 260px; }
  .trend-summary-row { gap: 8px; }
  .trend-kpi { padding: 10px 12px; }
  .trend-kpi-val { font-size: 1.1rem; }

  /* Aside section on mobile (below main) */
  .dash-aside-col { gap: 10px; }

  /* Action center: compact */
  .ac-widget { padding: 14px 14px 8px; }

  /* Modals — slide up from bottom as sheet */
  .modal {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 90vh;
    overflow-y: auto;
    margin: 0 !important;
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.32, .72, 0, 1);
  }
  .modal.sheet-in {
    transform: translateY(0);
  }
  .modal.sheet-dragging {
    transition: none;
  }

  /* Drag handle grabber — mobile only */
  .sheet-handle {
    display: block;
    width: 36px;
    height: 4px;
    background: var(--line);
    border-radius: 3px;
    margin: 10px auto 0;
  }
  /* Prevent iOS font zoom on focus */
  .modal input, .modal select, .modal textarea {
    font-size: 16px !important;
  }
  /* Quick fill buttons: larger tap targets */
  .qbtn { padding: 11px 10px; font-size: 0.82rem; }
  /* Modal footer: stack on tiny screens */
  .modal-footer { gap: 10px; }

  /* Rent/filter bar: scroll horizontally */
  .filter-bar { gap: 8px; flex-wrap: wrap; }
  .filter-bar input[type="search"] { min-width: 0; flex: 1; }

  /* Profile head: stack vertically (already set but ensure) */
  .profile-hd { gap: 14px; }

  /* Tab overflow: always scroll */
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; min-height: 40px; }

  /* Screen head: already stacked */
  .head-actions { width: 100%; }

  /* ── MOBILE BOTTOM NAV ── */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 200;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, .07);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mbn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.62rem;
    font-weight: 600;
    color: #94a3b8;
    background: none;
    border: none;
    cursor: pointer;
    transition: color .15s;
    padding: 0;
    letter-spacing: .01em;
  }
  .mbn-item.active { color: var(--blue); }
  .mbn-item svg { width: 22px; height: 22px; }

  /* ── MOBILE RENT CARDS ── */
  .mobile-rent-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 0 8px;
  }
  .mrc {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .mrc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
  }
  .mrc-name { font-weight: 700; font-size: 0.95rem; color: var(--text); }
  .mrc-unit { font-size: 0.76rem; color: var(--muted); margin-top: 1px; }
  .mrc-badge {
    font-size: 0.67rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .mrc-badge.paid    { background: #dcfce7; color: #16a34a; }
  .mrc-badge.overdue { background: #fee2e2; color: #dc2626; }
  .mrc-badge.upcoming { background: #dbeafe; color: #2563eb; }
  .mrc-badge.review  { background: #fef3c7; color: #d97706; }
  .mrc-badge.new-movein { background: #ede9fe; color: #7c3aed; }
  .mrc-amounts {
    display: flex;
    gap: 18px;
    font-size: 0.8rem;
  }
  .mrc-amt-lbl { color: var(--muted); font-size: 0.7rem; margin-bottom: 2px; }
  .mrc-amt-val { font-weight: 700; color: var(--text); font-size: 0.88rem; }
  .mrc-collect-btn {
    width: 100%;
    padding: 13px 16px;
    border-radius: 10px;
    background: var(--blue);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: background .15s, transform .1s;
    text-align: center;
  }
  .mrc-collect-btn:active { transform: scale(.98); }
  .mrc-collect-btn.partial { background: #f59e0b; }
  .mrc-collect-btn:disabled { background: #e2e8f5; color: #94a3b8; cursor: default; }
  .mrc-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
  }

  /* Mobile rent section header (filter tabs + month) */
  .mobile-section-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px 10px;
    gap: 8px;
  }
  .mobile-section-hd-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
  }

  /* Ensure dash-aside shows on mobile (it's below) */
  .dash-main-col .quick-bar { margin-top: 4px; }

  /* Mobile rent section spacing inside dash-section */
  #mobileRentSection { padding: 0 14px 14px; }
  .mobile-rent-cards { padding: 0; }

  /* ── P2: DASHBOARD SCROLL FIXES ── */
  .dash-section-head { flex-wrap: wrap; gap: 6px; }
  .dash-section-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .trend-legend { display: none; }
  .coll-tab { padding: 6px 9px !important; font-size: 0.67rem !important; }
  #mobileRentSection { overflow: hidden; }

  /* ── P3: COMPACT QUICK BAR ── */
  .quick-bar { padding: 10px 14px; }
  .quick-bar-btns { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap !important; display: flex; gap: 6px; padding-bottom: 2px; }
  .qa-bar-btn { flex: 0 0 auto !important; padding: 7px 10px !important; font-size: 0.72rem !important; border-radius: 8px !important; white-space: nowrap; }
  .quick-bar-title { display: none; }

  /* ── MRC ACTIONS (Quick Pay + More) ── */
  .mrc-actions { display: flex; gap: 8px; align-items: stretch; }
  .mrc-actions .mrc-collect-btn { flex: 1; margin: 0; }
  .mrc-more-btn {
    flex: 0 0 44px; width: 44px; height: 44px; border-radius: 10px;
    border: 1.5px solid var(--line); background: var(--panel-raised);
    font-size: 1.2rem; color: var(--muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
  }
  .mrc-more-btn:active { background: var(--line); }

  /* ── IPHONE / SAFARI SPECIFIC FIXES ── */

  /* Contain entire app to viewport width */
  .app { width: 100%; max-width: 100vw; overflow-x: hidden; }
  .workspace { width: 100%; overflow-x: hidden; }

  /* Trend SVG: override JS inline height so width:100% + viewBox scales correctly */
  .trend-svg { height: auto !important; min-height: 80px; }

  /* Tables: override global 640px min-width on mobile — each wrap scrolls on its own */
  table { min-width: 0 !important; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .coll-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Topbar: prevent title from overflowing */
  .topbar-left { flex: 1; min-width: 0; overflow: hidden; }
  .topbar-title { min-width: 0; overflow: hidden; }
  .topbar-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
  .topbar-right { flex-shrink: 0; gap: 4px; }

  /* KPI: prevent large numbers from overflowing card */
  .kpi2 { overflow: hidden; }
  .kpi2-val { word-break: break-all; }
  .kpi2-sub { font-size: 0.65rem; }

  /* Dash section: no overflow */
  .dash-section { overflow: hidden; }
  .trend-summary-row .trend-kpi-val { font-size: 1rem; word-break: break-all; }

  /* iOS safe area — home indicator on iPhone X+ */
  .mobile-bottom-nav {
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .main { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

  /* Filter bar: prevent inputs from overflowing */
  .filter-bar { overflow-x: hidden; }
  .filter-bar select { min-width: 0; max-width: 100%; }

  /* Tabs: ensure they scroll horizontally, not cause page overflow */
  .coll-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Wrow (rent collection rows): allow scrolling within container */
  .wlist { overflow-x: hidden; }
  .wrow { overflow: hidden; }

  /* Modals on iOS: use dvh for better Safari support */
  .modal { max-height: 85dvh; max-height: 85vh; }

  /* Prevent cards/widgets overflowing */
  .ac-widget, .aside-widget, .kpi2 { max-width: 100%; }

  /* Reports tabs: scrollable */
  #reportTabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }

  /* Profile tabs: scrollable */
  #profileTabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  #profileTabs .tab { flex-shrink: 0; }
}

/* ── Small phones (≤ 480px) ─────────────────────────────────── */
@media (max-width: 480px) {
  .kpi2 { padding: 14px 14px 10px; }
  .kpi2-val { font-size: 1.5rem; }
  .kpi2-icon-badge { width: 36px; height: 36px; border-radius: 10px; }
  .kpi2-icon-badge svg { width: 18px; height: 18px; }
  .dash-kpi-row { gap: 8px; }

  /* Trend summary: 2 col on narrow */
  .trend-summary-row { grid-template-columns: 1fr 1fr; gap: 6px; }
  .trend-kpi-val { font-size: 1rem; }

  /* Mobile cards: slightly smaller */
  .mrc { padding: 12px 14px; }
  .mrc-name { font-size: 0.9rem; }

  /* Quick actions: full-width on tiny */
  .qa-bar-btn { flex: 1 1 100%; }

  /* Toast: wrap and fit narrow screens, keep undo button visible */
  .toast {
    white-space: normal;
    max-width: calc(100vw - 24px);
    left: 12px;
    right: 12px;
    transform: translateY(10px);
  }
  .toast.show { transform: translateY(0); }
  .toast-undo { flex-shrink: 0; }
}

/* ── Very small phones (≤ 360px) ─────────────────────────────── */
@media (max-width: 360px) {
  .dash-kpi-row { grid-template-columns: 1fr; }
  .topbar-title h1 { font-size: 0.95rem; }
}

/* ── NOTIFICATION DRAWER ──────────────────────────────── */
.notif-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 299;
  opacity: 0;
  transition: opacity .2s;
}
.notif-overlay.open { display: block; opacity: 1; }

.notif-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(360px, 100vw);
  background: var(--panel);
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  border-radius: 16px 0 0 16px;
}
.notif-drawer.open { transform: translateX(0); }

.notif-drawer-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.95rem;
}

.notif-list { flex: 1; overflow-y: auto; padding: 10px 0; }

.notif-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  cursor: pointer;
  transition: background .12s;
  font-size: 0.83rem;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover, .notif-item:active { background: var(--bg); }
.notif-item.urgent { background: #fffbf0; }
.notif-item.urgent:hover { background: #fef3c7; }
.notif-item-icon { font-size: 1.2rem; flex-shrink: 0; }
.notif-item-text { flex: 1; line-height: 1.4; }
.notif-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .notif-drawer {
    top: auto; right: 0; left: 0; bottom: 0;
    width: 100%;
    height: auto;
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .notif-drawer.open { transform: translateY(0); }
}

/* ── LOGIN SCREEN ─────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--sh-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  font-size: 2.4rem;
  margin-bottom: 6px;
}

.login-brand h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
}

.login-brand p {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}

.login-tabs {
  display: flex;
  gap: 4px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.login-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--tx);
}

.login-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--sh-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.auth-form input {
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--panel);
  transition: border-color var(--tx);
  font-family: inherit;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--blue);
}

.auth-submit {
  width: 100%;
  padding: 11px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity var(--tx);
  font-family: inherit;
}

.auth-submit:hover { opacity: .88; }
.auth-submit:disabled { opacity: .55; cursor: not-allowed; }

.auth-error {
  color: var(--red);
  font-size: 0.83rem;
  min-height: 1.1em;
  margin-bottom: 2px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px;
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--tx);
  box-sizing: border-box;
}

.google-btn:hover {
  border-color: var(--muted);
  background: var(--panel-raised);
}

.login-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 22px;
}

/* sidebar user info + logout */
.user-info {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, .5);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  width: 100%;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  cursor: pointer;
  color: rgba(255, 255, 255, .55);
  transition: all var(--tx);
  font-family: inherit;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .9);
  border-color: rgba(255, 255, 255, .3);
}
/* ── Rent Adjustments ── */
.adj-chip {
  background: var(--orange-soft);
  color: var(--orange);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.72rem;
  font-weight: 700;
}
.adj-dot {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 0.65rem;
  font-weight: 900;
  line-height: 14px;
  text-align: center;
  vertical-align: middle;
  cursor: help;
}
.adj-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.adj-row-left { flex: 1; }
.adj-row-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.adj-type-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}
.adj-amount {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.adj-period { font-size: 0.78rem; color: var(--blue); font-weight: 600; margin-bottom: 2px; }
.adj-reason { font-size: 0.78rem; color: var(--muted); }
.adj-preview {
  background: var(--blue-soft, #eff6ff);
  border: 1px solid var(--blue);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--blue);
  margin-top: 8px;
}

/* ── Payment review (portal payments needing approval) ── */
.badge.review-badge {
  background: #fff7ed;
  color: #d97706;
  border: 1px solid #fcd34d;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}
.needs-review-row {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
}
.review-note {
  display: block;
  margin-top: 4px;
  font-size: 0.76rem;
  color: #92400e;
  font-style: italic;
}
.approve-btn {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.approve-btn:hover { background: #15803d; }
.review-alert-banner {
  background: #fff7ed;
  border: 1.5px solid #f59e0b;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: #92400e;
}
