/* =========================================================
   Wycmar Apartments – Custom Design System
   ========================================================= */

:root {
  --slate: #0F2041;
  --slate-dark: #0A1730;
  --slate-soft: #2A3D63;
  --taupe: #C5A059;
  --taupe-soft: #D6BC85;
  --bg: #FAFAFA;
  --card: #ffffff;
  --warm: #EDE6D6;
  --gold: #C5A059;
  --border: #E2E8F0;
  --text: #1D2E4F;
  --muted: #1D2E4F;
  --good: #3F7D5E;
  --bad: #EF4444;
  --input-text: #6B7280;
  --tint-gold: #FBF3E2;
  --tint-gold-border: #F0E2C8;
  --tint-blue: #EAF0FF;
  --tint-blue-border: #D8E3FA;
  --tint-green: #E4F3EA;
  --tint-red: #FBE9E9;
  --tier-red-text: #8a3a32;
  --tier-red-border: #F3AEAE;
  --tier-green-text: #3f6a52;
  --tier-green-border: #9FCCB0;
  --tier-blue-text: #445072;
  --tier-blue-border: #AEB7CB;
  --tier-amber-text: #92400E;
  --tier-amber-bg: #FEF3C7;
  --tier-amber-border: #F0D48A;
  --overdue-tier-early: #B45309;
  --overdue-tier-mid: #C2410C;
  --shadow: 0 4px 14px rgba(15, 32, 65, 0.07);
  --shadow-lg: 0 10px 28px rgba(15, 32, 65, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* =========================================================
   BASE RESETS
   ========================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* =========================================================
   SCROLLBAR
   ========================================================= */
::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--taupe-soft); }
::-webkit-scrollbar-button { display: none; }
::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* =========================================================
   LAYOUT
   ========================================================= */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  background: var(--slate);
  color: #e6ebf2;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.25s ease;
  flex-shrink: 0;
  z-index: 250;
}
.sidebar-header {
  display: flex;
  justify-content: center;
  padding: 12px 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
}
.sidebar-header img { max-width: 100%; width: 160px; height: auto; display: block; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-section-title {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a98ad;
  margin: 14px 12px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #cdd5e2;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active {
  background: rgba(161, 142, 128, 0.18);
  color: #fff;
  border-left: 3px solid var(--taupe);
  padding-left: 9px;
}
.nav-item i { width: 18px; text-align: center; font-size: 16px; opacity: 0.9; }
.nav-badge {
  background: var(--bad);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 999px;
  margin-left: auto;
  line-height: 18px;
  height: 18px;
}
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}
.user-profile { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--slate), var(--taupe));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { display: block; font-weight: 600; font-size: 13px; color: #e6ebf2; }
.user-role { display: block; font-size: 11px; color: #8a98ad; }
.logout-btn {
  color: #8a98ad;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.logout-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--slate);
}
.mobile-menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--warm);
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--slate);
  border: 1px solid var(--border);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.notification-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--slate);
  cursor: pointer;
  transition: 0.15s;
  border: 1px solid transparent;
}
.notification-icon:hover { background: var(--border); }
.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bad);
  border: 2px solid #fff;
}

.dashboard-wrapper { padding: 24px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* =========================================================
   CARDS & GRID
   ========================================================= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card.textured { background-image: repeating-linear-gradient(135deg, rgba(161, 142, 128, 0.05) 0 1px, transparent 1px 14px); }
.card.dotted { background-image: radial-gradient(rgba(161, 142, 128, 0.18) 1px, transparent 1px); background-size: 14px 14px; }
.grid { display: grid; gap: 16px; }

.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* =========================================================
   STAT CARDS
   ========================================================= */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s;
}
.stat-icon {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--tint-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--taupe);
  font-size: 18px;
}
.stat-icon.icon-red   { background: var(--tint-red);   color: var(--bad); }
.stat-icon.icon-green { background: var(--tint-green); color: var(--good); }
.stat-icon.icon-blue  { background: var(--tint-blue);  color: var(--slate); }
.stat-icon.icon-gold  { background: var(--tint-gold);  color: var(--taupe); }
.stat-icon.icon-amber { background: var(--tier-amber-bg); color: var(--tier-amber-text); }
.stat-title {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 6px;
}
.stat-value { font-size: 26px; font-weight: 700; color: var(--slate-dark); }
.stat-subtext {
  font-size: 16px;
  color: var(--muted);
  margin-top: 4px;
  word-break: break-word;
  line-height: 1.4;
  max-height: 4.2em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.stat-card .stat-value.income-color { color: #2327AF; }

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e8f0ea;
  color: var(--good);
}
.trend-badge.trend-negative { background: #f5dad6; color: var(--bad); }
.trend-badge.trend-amber { background: var(--tier-amber-bg); color: var(--tier-amber-text); }

/* Metrics grid — dashboard uses 4 cols desktop, 2 tablet/mobile */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 20px;
  margin-bottom: 20px;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 13px;
  background: var(--slate);
  color: #fff;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
  border: 1px solid transparent;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(66, 81, 104, 0.22); background: #384659; }
.btn-secondary { background: var(--tint-gold); color: var(--slate-dark); border-color: var(--tint-gold-border); }
.btn-secondary:hover { background: var(--tint-gold-border); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06); }
.btn-taupe { background: var(--taupe); color: #fff; }
.btn-taupe:hover { background: #8d7b6e; }
.btn-ghost { background: transparent; color: var(--slate); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--tint-gold); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.btn-navy { background: var(--slate); color: #fff; }
.btn-navy:hover { background: var(--slate-soft); }
.btn-cancel { background: var(--tint-gold); color: var(--slate-dark); border-color: var(--tint-gold-border); }
.btn-cancel:hover { background: var(--tint-gold-border); }
.btn-block { width: 100%; }
.btn-outline-secondary { background: transparent; color: var(--slate); border: 1px solid var(--border); }
.btn-outline-secondary:hover { background: var(--tint-gold); }
.btn-light { background: #f8fafc; color: var(--slate-dark); border: 1px solid var(--border); }
.btn-light:hover { background: var(--tint-gold); }

.btn-quick-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--slate);
  color: #fff;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  transition: 0.15s;
  border: 1px solid transparent;
}
.btn-quick-primary:hover { background: var(--slate-soft); transform: translateY(-1px); }
.btn-quick-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--warm);
  color: var(--slate-dark);
  border-radius: 9px;
  font-weight: 500;
  font-size: 13px;
  border: 1px solid var(--border);
  transition: 0.15s;
}
.btn-quick-secondary:hover { background: var(--border); }

.quick-actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }

/* =========================================================
   INPUTS
   ========================================================= */
.input, .select {
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--input-text);
  outline: none;
  transition: 0.15s;
  width: 100%;
  font-size: 14px;
}
.input:focus, .select:focus { border-color: var(--taupe); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7787' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--slate-dark); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* =========================================================
   TABLES
   ========================================================= */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}
.modern-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.modern-table th, .modern-table td {
  padding: 12px 14px;
  text-align: left;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.modern-table th {
  background: var(--tint-blue);
  color: var(--slate-dark);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  border-bottom: 2px solid var(--tint-blue-border);
}
.modern-table tbody tr:hover { background: var(--tint-blue); }
.modern-table tbody tr:last-child td { border-bottom: none; }
.modern-table tfoot th,
.modern-table tfoot td {
  font-weight: 700;
  font-size: 15px;
  background: var(--tint-gold);
  border-top: 2px solid var(--tint-gold-border);
  padding: 14px 14px;
}
.modern-table tfoot tr th:first-child,
.modern-table tfoot tr td:first-child {
  font-weight: 700;
  font-size: 15px;
}

/* =========================================================
   BADGES & CHIPS
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge-paid { background: var(--tint-green); color: var(--tier-green-text); border-color: #cfe0d4; }
.badge-overdue { background: var(--tint-red); color: var(--tier-red-text); border-color: #f5c6c0; }
.badge-partial { background: #fbf0d8; color: #7a5b1a; border-color: #f5e0b0; }
.badge-pending { background: #eee6da; color: #6b5a3f; }
.badge-occupied { background: #e8f0ea; color: var(--tier-green-text); }
.badge-vacant { background: #f0e6d8; color: #8a6b3a; }
.badge-reserved { background: var(--tint-blue); color: var(--tier-blue-text); }
.badge-done      { background: var(--tint-green);    color: var(--tier-green-text);    border-color: #cfe0d4; }
.badge-warning   { background: var(--tier-amber-bg); color: var(--tier-amber-text);    border-color: var(--tier-amber-border); }

.chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 12px;
  color: var(--slate-dark);
  cursor: pointer;
  transition: 0.15s;
}
.chip:hover { border-color: var(--taupe); }
.chip.active { background: var(--slate); color: #fff; border-color: var(--slate); }

/* =========================================================
   PANELS
   ========================================================= */
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
}
.panel-title { font-weight: 700; color: var(--slate-dark); font-size: 15px; }
.panel-subtitle { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.panel-content { padding: 16px 20px; }

/* Bright panels */
.panel.panel-bright-red   { background: var(--card); border-left: 3px solid var(--tier-red-border); }
.panel.panel-bright-amber { background: var(--card); border-left: 3px solid var(--tier-amber-border); }
.panel.panel-bright-green { background: var(--card); border-left: 3px solid var(--tier-green-border); }

.panel.panel-bright-red .list-item,
.panel.panel-bright-amber .list-item,
.panel.panel-bright-green .list-item {
  background: transparent;
  border-radius: 0;
  margin-bottom: 0;
  padding: 12px 4px;
  border-bottom: 1px solid #f1f5f9;
}
.panel.panel-bright-red .list-item:nth-child(odd),
.panel.panel-bright-amber .list-item:nth-child(odd),
.panel.panel-bright-green .list-item:nth-child(odd) { background: transparent; }
.panel.panel-bright-red .list-item:last-child,
.panel.panel-bright-amber .list-item:last-child,
.panel.panel-bright-green .list-item:last-child { border-bottom: none; }

.panel-content.upcoming-events-list { padding-top: 4px; }

/* Empty To-Do safety net */
.panel.panel-bright-amber .panel-content:empty { display: none; }

/* =========================================================
   LIST ITEMS
   ========================================================= */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.list-item:last-child { border-bottom: none; }
.list-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--warm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate);
  font-size: 16px;
  flex-shrink: 0;
}
.list-icon.gold { background: var(--gold); color: #fff; }
.list-icon.avatar-initials {
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.list-content { flex: 1; }
.list-title { font-weight: 600; color: var(--slate-dark); }
.list-desc { font-size: 12px; color: var(--muted); }
.list-action { font-weight: 700; color: var(--slate-dark); }

/* =========================================================
   PAGE HEADER
   ========================================================= */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.page-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
}
.page-header-icon.icon-gold  { color: var(--taupe); }
.page-header-icon.icon-blue  { color: var(--slate); }
.page-header-icon.icon-green { color: var(--good); }
.page-header-icon.icon-red   { color: var(--bad); }
.page-title { font-size: 22px; font-weight: 700; color: var(--slate-dark); }
.page-subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* =========================================================
   SEARCH
   ========================================================= */
.search-container { position: relative; margin-bottom: 20px; }
.search-input {
  width: 100%;
  padding: 0.65rem 1.2rem 0.65rem 2.8rem;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.9rem;
  color: var(--text);
  transition: all 0.25s ease;
}
.search-input:focus {
  outline: none;
  border-color: var(--taupe);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.15);
}
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

/* =========================================================
   FEE CARD
   ========================================================= */
.vacant-mobile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 12px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.vacant-mobile-card:hover {
  box-shadow: 0 8px 20px rgba(15, 32, 65, 0.1);
  transform: translateY(-2px);
}
.fee-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.fee-box { background: var(--card); border: 1px solid var(--border); padding: 10px 8px; border-radius: var(--radius-sm); text-align: center; }
.fee-icon { display: block; font-size: 0.8rem; color: var(--taupe); margin-bottom: 4px; }
.fee-label { font-size: 0.65rem; font-weight: 700; color: var(--muted); text-transform: uppercase; display: block; }
.fee-val { font-weight: 700; color: var(--slate-dark); font-size: 0.85rem; }
.total-box { background: var(--card); border: 2px solid var(--slate); padding: 12px; border-radius: var(--radius-sm); text-align: center; margin-top: 12px; }
.total-box .fee-label { color: var(--muted); }
.total-val { font-size: 1.3rem; font-weight: 900; color: var(--slate-dark); display: block; }
.total-due-cell { color: var(--good); font-weight: 700; }

/* =========================================================
   MODALS
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 78, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.modal {
  background: #fff;
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal-lg { max-width: 760px; }
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { font-size: 16px; color: var(--slate-dark); font-weight: 700; }
.modal-head .close {
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: 0.15s;
}
.modal-head .close:hover { background: var(--warm); }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--tint-gold);
  border-radius: 0 0 14px 14px;
}
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--warm);
  border: none;
  color: var(--slate-dark);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}
.modal-close:hover { background: var(--bad); color: #fff; transform: rotate(90deg); }
.modal-close i { font-size: 16px; }

/* =========================================================
   PAGINATION
   ========================================================= */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 20px 0; }
.pagination .page-item .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--slate);
  font-weight: 500;
  transition: 0.15s;
}
.pagination .page-item.active .page-link { background: var(--slate); color: #fff; border-color: var(--slate); }
.pagination .page-item .page-link:hover { background: var(--warm); }

.pagination-custom { display: flex; justify-content: center; gap: 4px; padding: 0; list-style: none; }
.pagination-custom .page-item .page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 10px;
  border-radius: 8px; border: 1px solid var(--border);
  color: var(--slate); font-weight: 600; text-decoration: none;
  transition: 0.15s;
}
.pagination-custom .page-item .page-link:hover { background: var(--warm); }
.pagination-custom .page-item.active .page-link { background: var(--slate); color: #fff; border-color: var(--slate); }

/* =========================================================
   UTILITIES
   ========================================================= */
.muted { color: var(--muted); }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-uppercase { text-transform: uppercase; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-danger { color: var(--bad) !important; }
.list-desc.text-danger { color: var(--bad) !important; }

.py-5 { padding-top: 2rem; padding-bottom: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.mb-0 { margin-bottom: 0; }



.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.ml-auto { margin-left: auto; }
.w-100 { width: 100%; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 0.5rem; }
.font-weight-bold { font-weight: 700; }
.font-weight-normal { font-weight: 400; }
.hidden { display: none; }

.link-text { color: var(--slate); font-weight: 700; text-decoration: none; }
.link-text:hover { color: var(--taupe); }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); z-index: 90; }
.sidebar-overlay.active { display: block; }

/* =========================================================
   COLLAPSE TOGGLE
   ========================================================= */
.collapse-toggle {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--slate-dark);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.collapse-toggle i.fa-chevron-down { transition: transform 0.3s ease; }
.collapse-toggle[aria-expanded="true"] i.fa-chevron-down { transform: rotate(180deg); }
.collapse-container { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-in-out; }
.collapse-container.open { max-height: 2000px; }

/* =========================================================
   SELECT2 OVERRIDES
   ========================================================= */
.select2-container { font-family: var(--font) !important; font-size: 14px !important; }
.select2-container--default .select2-selection--single {
  height: 40px !important;
  padding: 0 !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  background: #fff !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}
.select2-container--default .select2-selection--single:hover { border-color: var(--taupe) !important; }
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--taupe) !important;
  box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.15) !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text) !important;
  font-size: 14px !important;
  font-family: var(--font) !important;
  line-height: 38px !important;
  padding: 0 12px !important;
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--muted) !important; }
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 38px !important;
  right: 8px !important;
  width: 20px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--muted) transparent transparent transparent !important;
  border-width: 6px 5px 0 5px !important;
}
.select2-container--default .select2-dropdown {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
  background: #fff !important;
  overflow: hidden !important;
  margin-top: 4px !important;
  z-index: 1060 !important;
}
.select2-container--default .select2-search--dropdown {
  padding: 8px 12px !important;
  background: var(--bg) !important;
  border-bottom: 1px solid var(--border) !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  width: 100% !important;
  padding: 8px 12px !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  background: #fff !important;
  color: var(--text) !important;
  font-family: var(--font) !important;
  font-size: 16px !important;
  transition: border-color 0.15s ease !important;
  outline: none !important;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--taupe) !important;
  box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.15) !important;
}
.select2-container--default .select2-search--dropdown .select2-search__field::placeholder { color: var(--muted) !important; }
.select2-container--default .select2-results__option {
  padding: 8px 14px !important;
  font-size: 14px !important;
  font-family: var(--font) !important;
  color: var(--text) !important;
  border-bottom: 1px solid #f1f5f9 !important;
}
.select2-container--default .select2-results__option:last-child { border-bottom: none !important; }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--slate) !important;
  color: #fff !important;
}
.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: var(--warm) !important;
  color: var(--slate-dark) !important;
}
.select2-container--default .select2-results > .select2-results__options { max-height: 220px !important; }
.select2-container--default .select2-results > .select2-results__options::-webkit-scrollbar { width: 6px !important; }
.select2-container--default .select2-results > .select2-results__options::-webkit-scrollbar-track { background: transparent !important; }
.select2-container--default .select2-results > .select2-results__options::-webkit-scrollbar-thumb {
  background: var(--border) !important;
  border-radius: 8px !important;
}
.select2-container--default .select2-results > .select2-results__options::-webkit-scrollbar-thumb:hover { background: var(--taupe-soft) !important; }
.select2-container--default .select2-results > .select2-results__options {
  scrollbar-width: thin !important;
  scrollbar-color: var(--border) transparent !important;
}
.modal .select2-container--default .select2-dropdown { z-index: 1060 !important; }
.modal .select2-container--default .select2-dropdown--below { margin-top: 4px !important; }
.select2-container--default .select2-selection--single .select2-selection__rendered .select2-selection__clear { display: none !important; }
.select2-container--default.select2-container--disabled .select2-selection--single {
  background-color: var(--bg) !important;
  opacity: 0.6 !important;
}
.select2-results__message {
  padding: 12px !important;
  text-align: center !important;
  color: var(--muted) !important;
  font-size: 14px !important;
}

/* =========================================================
   RESPONSIVE SEARCH FILTER GRID
   ========================================================= */
.search-filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.search-filter-grid .field { min-width: 0; }
.search-filter-grid .btn-group { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }

@media (min-width: 1025px) {
  .search-filter-grid { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
}
@media (max-width: 1024px) {
  .search-filter-grid { grid-template-columns: 1fr 1fr 1fr; }
  .search-filter-grid .field:first-child { grid-column: span 3; }
  .search-filter-grid .btn-group { grid-column: span 3; justify-content: flex-end; }
}
@media (max-width: 640px) {
  .search-filter-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .search-filter-grid .field:first-child { grid-column: span 2; }
  .search-filter-grid .btn-group {
    grid-column: span 2;
    justify-content: stretch;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .search-filter-grid .btn-group .btn { flex: 1; min-width: 80px; justify-content: center; }
  .search-filter-grid .field { width: 100%; }
}
@media (max-width: 400px) {
  .search-filter-grid { grid-template-columns: 1fr; gap: 8px; }
  .search-filter-grid .field:first-child { grid-column: span 1; }
  .search-filter-grid .btn-group { grid-column: span 1; flex-direction: column; gap: 6px; }
  .search-filter-grid .btn-group .btn { width: 100%; }
}

/* =========================================================
   REUSABLE LIST CARDS
   ========================================================= */
.list-card-container { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.list-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow 0.2s ease;
}
.list-card:hover { box-shadow: var(--shadow); }
.list-card-horizontal { display: flex; align-items: center; gap: 16px; }
.list-card-horizontal .list-card-thumb {
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
}
.list-card-horizontal .list-card-thumb-placeholder {
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.5rem;
}
.list-card-horizontal .list-card-body { flex: 1; min-width: 0; }
.list-card-horizontal .list-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}
.list-card-horizontal .list-card-title { font-weight: 700; color: var(--slate-dark); font-size: 1rem; }
.list-card-horizontal .list-card-title a { color: var(--slate-dark); text-decoration: none; }
.list-card-horizontal .list-card-title a:hover { color: var(--taupe); }
.list-card-horizontal .list-card-stats { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.list-card-horizontal .list-card-stats .stat-old { color: var(--muted); font-size: 0.9rem; }
.list-card-horizontal .list-card-stats .stat-new { font-weight: 700; color: var(--slate-dark); font-size: 1.1rem; }
.list-card-horizontal .list-card-stats .stat-arrow { color: var(--muted); font-size: 0.8rem; }
.list-card-horizontal .list-card-meta { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.list-card-horizontal .list-card-meta div { margin: 2px 0; }
.list-card-horizontal .list-card-right { text-align: right; flex-shrink: 0; }
.list-card-horizontal .list-card-badge { display: inline-block; }
.list-card-horizontal .list-card-amount { color: var(--good); font-weight: 700; font-size: 1.1rem; margin-top: 4px; }
.list-card-horizontal .list-card-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.list-card-units { font-size: 1.1rem; font-weight: 700; padding: 4px 12px; }

/* =========================================================
   PAYMENT CARDS
   ========================================================= */
.payment-mobile-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.payment-mobile-card:nth-child(odd) { background: #F8FAFC; border-color: #E2E8F0; }
.payment-mobile-card:active { transform: scale(0.98); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); }
.payment-mobile-card .row-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #EDF2F7;
}
.payment-mobile-card .row-item:last-child { border-bottom: none; }
.payment-mobile-card .label { color: #64748b; font-weight: 500; font-size: 14px; }
.payment-mobile-card .value { font-weight: 700; color: #1e293b; font-size: 14px; }
.payment-mobile-card .value.amount { color: var(--good); font-size: 18px; font-weight: 800; }
.payment-mobile-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.panel .list-item:last-child { margin-bottom: 0; }

/* =========================================================
   DASHBOARD ENHANCEMENTS
   ========================================================= */
.greeting-card {
  background: var(--slate);
  color: #fff;
  border: none;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 10px;
}
.greeting-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 20px,
    rgba(255, 255, 255, 0.04) 20px,
    rgba(255, 255, 255, 0.04) 21px
  );
  pointer-events: none;
}
.greeting-card .content {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.greeting-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.greeting-card .greeting-text { display: flex; flex-direction: column; }
.greeting-card .greeting-sub {
  font-size: 1.05rem;
  font-weight: 600;
  opacity: 0.95;
  color: #fff;
}

.overdue-card .list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.overdue-card .list-item:last-child { border-bottom: none; }
.overdue-card .tenant-info { font-weight: 600; color: var(--slate-dark); }
.overdue-card .tenant-info .house { color: var(--muted); font-weight: 400; font-size: 13px; }
.overdue-card .balance { font-weight: 700; color: var(--bad); }
.overdue-card .days {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 10px;
  border-radius: 999px;
}

.badge-caretaker { background: #dcfce7 !important; color: #166534 !important; border-color: #bbf7d0 !important; }
.badge-management { background: #dbeafe !important; color: #1e40af !important; border-color: #bfdbfe !important; }

.vacant-list { font-size: 14px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.vacant-list .tag {
  display: inline-block;
  background: var(--bg);
  padding: 1px 8px;
  border-radius: 999px;
  margin: 2px 3px 2px 0;
  font-weight: 600;
  color: var(--slate-dark);
}

@media (min-width: 769px) {
  .mobile-only { display: none !important; }
}
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
}

.house-badge {
  display: inline-block;
  background: var(--bg);
  color: var(--slate-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 4px;
  margin-right: 4px;
}
.tenant-name { font-weight: 600; }
.panel .list-item .list-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Overdue row meta */
.overdue-row { align-items: flex-start; }
.overdue-row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}
.overdue-row-balance { color: var(--bad); text-align: right; flex-shrink: 0; }
.overdue-days-text { font-size: 12px; white-space: nowrap; }
.overdue-days-text.tier-amber  { color: var(--overdue-tier-early); }
.overdue-days-text.tier-orange { color: var(--overdue-tier-mid); }
.overdue-days-text.tier-red    { color: var(--tier-red-text); }

.todo-role-badge {
  font-size: 9px;
  padding: 2px 8px;
  flex-shrink: 0;
  align-self: center;
}

/* Upcoming event tiers */
.upcoming-event.tier-urgent { border-left: 3px solid var(--tier-red-border); }
.upcoming-event.tier-soon   { border-left: 3px solid var(--tier-green-border); }
.upcoming-event.tier-later  { border-left: 3px solid var(--tier-blue-border); }
.upcoming-event.tier-urgent .upcoming-event-icon { background: var(--tint-red);   color: var(--tier-red-text); }
.upcoming-event.tier-soon   .upcoming-event-icon { background: var(--tint-green); color: var(--tier-green-text); }
.upcoming-event.tier-later  .upcoming-event-icon { background: var(--tint-blue);  color: var(--tier-blue-text); }
.upcoming-event.tier-urgent .due-label { color: var(--tier-red-text);   font-weight: 600; }
.upcoming-event.tier-soon   .due-label { color: var(--tier-green-text); font-weight: 600; }
.upcoming-event.tier-later  .due-label { color: var(--tier-blue-text);  font-weight: 600; }

/* =========================================================
   DASH TWO COLUMN
   ========================================================= */
.dash-two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* =========================================================
   VIEW-ALL LINK
   ========================================================= */
.view-all-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: transparent;
  transition: all 0.2s ease;
}
.view-all-link:hover {
  background: var(--slate);
  color: #fff;
  border-color: var(--slate);
  text-decoration: none;
}

/* =========================================================
   DASH ACTIONS
   ========================================================= */
.dash-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dash-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 9px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  flex: 1 1 auto;
  min-width: 120px;
  justify-content: center;
}
.dash-action-btn--primary { font-weight: 600; }

/* =========================================================
   UPCOMING EVENTS
   ========================================================= */
.upcoming-events-list { display: flex; flex-wrap: wrap; gap: 12px; }
.upcoming-event {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  flex: 1 1 220px;
  min-width: 0;
}
.upcoming-event-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--slate);
  flex-shrink: 0;
}
.upcoming-event-info { min-width: 0; }
.upcoming-event-title { font-weight: 600; color: var(--slate-dark); }
.upcoming-event-meta {
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.upcoming-event-date { display: inline-flex; align-items: center; gap: 4px; }
.upcoming-event-badge { margin-left: auto; flex-shrink: 0; }

/* =========================================================
   MISSING WATER / VACANT TAG
   ========================================================= */
.stat-card.missing-water .stat-value { color: var(--bad) !important; }
.stat-card.missing-water .stat-subtext {
  color: #6366F1 !important;
  -webkit-line-clamp: unset;
  max-height: unset;
  overflow: visible;
  white-space: normal;
}
.stat-card.missing-water .stat-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.stat-title-count { letter-spacing: normal; font-size: 12px; }
.stat-card.missing-water .stat-icon { background: #fbecec !important; color: #D64045 !important; }
.stat-card.missing-water .stat-icon i { color: #D64045 !important; }

.house-pill {
  display: inline-block;
  background: #fbecec;
  color: var(--bad);
  border-radius: 999px;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* =========================================================
   NOTICE GIVEN – reuses missing-water card pattern
   ========================================================= */
.stat-card.notice-given .stat-subtext {
  -webkit-line-clamp: unset;
  max-height: unset;
  overflow: visible;
  white-space: normal;
}
.stat-card.notice-given .stat-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.notice-next {
  display: block;
  width: 100%;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.4;
}
.notice-next strong { color: var(--slate-dark); }

/* =========================================================
   OVERDUE LOAD MORE
   ========================================================= */
.overdue-load-more { display: none; text-align: center; padding: 10px 0; }
.overdue-load-more .btn-load-more {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 8px 24px;
  font-weight: 600;
  color: var(--slate);
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 44px;
}
.overdue-load-more .btn-load-more:active { transform: scale(0.96); }

/* =========================================================
   HIDE FAB
   ========================================================= */
.fab-container { display: none !important; }

/* =========================================================
   UNRECORDED RECURRING EXPENSES
   ========================================================= */
.panel-subtitle-amber {
  color: #da883c !important;
  font-weight: 600;
}
.unrecorded-expenses-panel .panel-content-tight {
  padding-top: 4px !important;
}
.unrecorded-expenses-panel .panel-header {
  padding-bottom: 4px !important;
}

/* =========================================================
   TOUCH-SAFE STAT-CARD LINKS
   ========================================================= */
.touch-safe-link {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  border-radius: 6px;
  padding: 0 2px;
  transition: background-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.touch-safe-link:active,
.touch-safe-link.is-pressed {
  background-color: rgba(15, 32, 65, 0.08);
  color: var(--slate);
}
@media (hover: hover) {
  .touch-safe-link:hover {
    color: var(--taupe);
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

/* =========================================================
   TOUCH-FRIENDLY TARGETS
   ========================================================= */
.btn,
.nav-item,
.clickable-row,
.collapse-toggle,
.modal-close,
.mobile-menu-toggle,
.notification-icon,
button[type="submit"],
button[type="reset"],
.pagination .page-link {
  min-height: 44px !important;
  min-width: 44px !important;
  touch-action: manipulation !important;
}

/* =========================================================
   INPUTS — colour only; size handled by @media below
   ========================================================= */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="email"],
input[type="password"],
input[type="tel"],
select,
textarea {
  color: var(--input-text) !important;
}
/* =========================================================
   MOBILE MENU TOGGLE — "Menu" label next to the hamburger icon
   ========================================================= */

/* The label is hidden by default on desktop — the whole button is
   hidden on desktop anyway, but this keeps the markup inert. */
.mobile-menu-label {
    display: none;
}

@media (max-width: 980px) {
    /* Topbar: keep everything on a single row. */
    .topbar {
        flex-wrap: nowrap;
        align-items: center;
        gap: 10px;
    }

    /* Left cluster: menu button + greeting. Greeting is the only part
       allowed to shrink. */
    .topbar-left {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Compact pill: icon + "Menu" with breathing room. */
    .mobile-menu-toggle {
        width: auto;
        height: 40px;
        min-width: 0;
        padding: 0 14px;
        gap: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .mobile-menu-toggle i {
        font-size: 15px;
        line-height: 1;
        display: inline-flex;
        align-items: center;
    }
    .mobile-menu-label {
        display: inline-block;
        font-size: 14px;
        font-weight: 600;
        color: var(--slate);
        letter-spacing: 0.02em;
        line-height: 1;
    }

    /* Greeting text truncates rather than pushing anything to a new row. */
    .topbar-left > span {
        flex: 1 1 auto;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Right cluster (Logout etc.) never wraps or shrinks. */
    .topbar-right {
        flex: 0 0 auto;
        margin-left: 0;
        gap: 8px;
    }
    .topbar-right .btn {
        white-space: nowrap;
    }
}

/* Narrow phones: shrink the label and greeting a touch more. */
@media (max-width: 420px) {
    .topbar {
        gap: 8px;
        padding: 8px 12px;
    }
    .topbar-left {
        gap: 8px;
    }
    .mobile-menu-toggle {
        padding: 0 10px;
        gap: 8px;
        height: 38px;
    }
    .mobile-menu-label {
        font-size: 13px;
    }
    .topbar-left > span {
        font-size: 13px;
    }
    .topbar-right .btn {
        padding: 6px 12px;
        font-size: 13px;
        min-height: 38px;
    }
}

/* Very narrow phones: hide the "Menu" word but keep the icon. */
@media (max-width: 340px) {
    .mobile-menu-label {
        display: none;
    }
    .mobile-menu-toggle {
        padding: 0 12px;
    }
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================= */
@media (max-width: 980px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 248px;
    z-index: 250;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    padding: 10px 14px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-header { padding: 4px 0 10px; margin-bottom: 4px; }
  .sidebar-header img { width: 130px; }
  .nav-section-title { margin: 6px 12px 4px; }
  .mobile-menu-toggle { display: flex; }
  .topbar-left span { font-size: 0.8rem; }
  .dashboard-wrapper { padding: 16px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .cols-2 { grid-template-columns: 1fr; }
  .cols-3 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .quick-actions-row .btn-quick-primary,
  .quick-actions-row .btn-quick-secondary { flex: 1 1 auto; justify-content: center; }
  .dash-two-col { grid-template-columns: 1fr; }
  .list-card-container { grid-template-columns: 1fr; }
  .list-card-horizontal .list-card-thumb,
  .list-card-horizontal .list-card-thumb-placeholder { height: 80px; }
  .list-card-horizontal { gap: 12px; }
  .list-card-horizontal .list-card-stats { flex-wrap: wrap; }
  .list-card-horizontal .list-card-stats .stat-new { font-size: 1.2rem; font-weight: 800; }
  .list-card-horizontal .list-card-stats .stat-old { font-size: 0.85rem; }
  .list-card-horizontal .list-card-meta {
    font-size: 0.7rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
  }
  .list-card-horizontal .list-card-meta div { display: inline; }
  .list-card-horizontal .list-card-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
    width: 100%;
    justify-content: space-between;
  }
  .list-card-units { font-size: 0.95rem; padding: 3px 10px; }
  .list-card-horizontal .list-card-amount { font-size: 1rem; margin-top: 0; }
  .list-card-horizontal .list-card-header { gap: 4px; }
  .desktop-table { display: none; }
  .mobile-payments { display: block; }
}

@media (max-width: 768px) {
  body { font-size: 16px !important; line-height: 1.6 !important; }
  h1, .h1 { font-size: 20px !important; }
  h2, .h2 { font-size: 18px !important; }
  h3, .h3, .modal-head h3, .panel-title { font-size: 16px !important; }
  h4, .h4 { font-size: 15px !important; }
  h5, .h5 { font-size: 14px !important; }
  h6, .h6 { font-size: 13px !important; }
  .nav-item { font-size: 15px !important; padding: 12px 14px !important; }
  .nav-section-title { font-size: 11px !important; }
  .sidebar .user-name { font-size: 15px !important; }
  .sidebar .user-role { font-size: 13px !important; }
  .topbar-left, .topbar-left span { font-size: 15px !important; }
  .topbar .btn { font-size: 14px !important; }
  .card, .panel { font-size: 15px !important; }
  .panel-subtitle { font-size: 13px !important; }
  .input, .select, .form-control {
    font-size: 16px !important;
    min-height: 48px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
  /* Placeholders must also be 16px — some browsers size them independently
     of the input and iOS still zooms if only the input is 16px. */
  .input::placeholder,
  .select::placeholder,
  .form-control::placeholder,
  input::placeholder,
  textarea::placeholder {
    font-size: 16px !important;
    opacity: 1 !important;
  }
  .mobile-menu-toggle, .notification-icon { font-size: 20px !important; }
  .sidebar .nav-item i { font-size: 18px !important; }
  .field label, .form-label { font-size: 14px !important; }
  .field, .form-group { margin-bottom: 16px !important; }
  .btn { font-size: 15px !important; min-height: 48px !important; padding: 10px 16px !important; }
  .btn-sm { font-size: 13px !important; min-height: 36px !important; padding: 6px 12px !important; }
  .modern-table th, .modern-table td { font-size: 14px !important; padding: 10px 12px !important; }
  .modern-table th { font-size: 13px !important; }
  .stat-title { font-size: 13px !important; }
  .stat-value { font-size: 22px !important; }
  .stat-subtext { font-size: 14px !important; }
  .trend-badge { font-size: 12px !important; }
  .badge { font-size: 12px !important; padding: 4px 10px !important; }
  .list-item { padding: 12px 0 !important; }
  .list-title { font-size: 15px !important; }
  .list-desc { font-size: 13px !important; }
  .list-action { font-size: 15px !important; }
  .modal-head h3 { font-size: 17px !important; }
  .modal-body { font-size: 15px !important; padding: 16px 18px !important; }
  .modal-close { font-size: 20px !important; width: 44px !important; height: 44px !important; }
  .pagination .page-link {
    font-size: 14px !important;
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 10px !important;
  }
  .payment-mobile-card .label { font-size: 15px !important; }
  .payment-mobile-card .value { font-size: 15px !important; }
  .payment-mobile-card .row-item { padding: 10px 0 !important; }
  .vacant-list .tag { font-size: 14px !important; padding: 3px 12px !important; }
  .house-pill { font-size: 14px !important; padding: 4px 12px !important; margin: 0 6px 6px 0 !important; }
  .search-box-wrapper input { font-size: 12px !important; min-height: 48px !important; }

  /* Mobile-only collapsible behaviour */
  .panel .panel-header {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .panel .panel-header .panel-toggle {
    transition: transform 0.3s ease;
    display: inline-block;
    margin-left: 8px;
    font-size: 0.8rem;
    color: var(--muted);
  }
  .panel.collapsed .panel-toggle { transform: rotate(-90deg); }
  .panel.collapsed .panel-content { display: none !important; }
  .panel .panel-content { transition: max-height 0.3s ease; overflow: hidden; }

  /* Panel list-title wrapping */
  .panel .list-item .list-title {
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
  }
  .payment-mobile-card .value {
    word-break: break-word;
    text-align: right;
    max-width: 65%;
  }
  .payment-mobile-card .row-item { flex-wrap: wrap; gap: 4px; }
  .payment-mobile-card .row-item .label { flex-shrink: 0; }

  /* Overdue load more */
  .overdue-load-more { display: block; }
  .overdue-extra-item { display: none !important; }
  .overdue-extra-item.visible { display: flex !important; }

  /* Upcoming event stacking */
  .upcoming-event { flex: 1 1 100%; }
  .upcoming-event-title { font-size: 13.5px; }

  /* Overdue row wrapping */
  .overdue-row .list-content { min-width: 0; }
  .overdue-row .list-title,
  .overdue-row .list-desc { word-break: break-word; }
  .overdue-row-balance { font-size: 14px; }

  /* Larger stat icons on mobile */
  .stat-card .stat-icon {
    width: 34px !important;
    height: 34px !important;
    font-size: 16px !important;
    border-radius: 10px !important;
    top: 12px !important;
    right: 12px !important;
  }
  .stat-card { padding-right: 48px !important; }

  /* 3 badges per row – house pills & vacant tags */
  .stat-subtext,
  .vacant-list {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    margin-top: 4px !important;
  }
  .stat-subtext .house-pill,
  .vacant-list .tag {
    flex: 0 0 calc(33.333% - 4px) !important;
    max-width: calc(33.333% - 4px) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 2px 0 !important;
    padding: 2px 8px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
    text-align: center !important;
    border-radius: 999px !important;
    background: #fbecec !important;
    color: var(--bad) !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
  }
}

@media (min-width: 769px) {
  .overdue-extra-item { display: flex !important; }
  .desktop-table { display: block; }
  .mobile-payments { display: none; }
}

@media (max-width: 640px) {
  .greeting-card .actions .btn-quick-primary,
  .greeting-card .actions .btn-quick-secondary {
    flex: 1;
    justify-content: center;
    font-size: 12px;
    padding: 8px 12px;
  }
  .fee-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 560px) {
  .topbar { padding: 8px 12px; }
  .topbar-left span { font-size: 0.75rem; }
  .topbar-right .notification-icon { width: 34px; height: 34px; }
  .dashboard-wrapper { padding: 12px; }
  .modal { max-width: 100%; }

  .stat-card { padding: 12px 10px 12px 12px; padding-right: 44px; }
  .stat-card .stat-icon {
    width: 30px !important;
    height: 30px !important;
    font-size: 14px !important;
    border-radius: 9px !important;
    top: 10px !important;
    right: 10px !important;
  }
  .stat-title { font-size: 10px; letter-spacing: 0.05em; }
  .stat-value { font-size: 18px; }
  .stat-card .stat-subtext { font-size: 11px; line-height: 1.4; }
  .trend-badge { margin-bottom: 6px; font-size: 10px; padding: 2px 8px; }
}

@media (max-width: 480px) {
  body { font-size: 15px !important; }
  h1, .h1 { font-size: 18px !important; }
  h2, .h2 { font-size: 16px !important; }
  h3, .h3, .modal-head h3, .panel-title { font-size: 15px !important; }
  .stat-value { font-size: 20px !important; }
  .stat-title { font-size: 12px !important; }
  .stat-subtext { font-size: 13px !important; }
  .btn { font-size: 14px !important; padding: 10px 14px !important; }
  /* Inputs stay at 16px on mobile so iOS never auto-zooms */
  .input, .select, .form-control {
    font-size: 16px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
  .modern-table th, .modern-table td { font-size: 13px !important; padding: 8px 8px !important; }
  .payment-mobile-card .label, .payment-mobile-card .value { font-size: 14px !important; }
  .topbar-left, .topbar-left span { font-size: 14px !important; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash-actions { gap: 8px; }
  .dash-action-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    font-size: 13px;
    padding: 10px 8px;
  }
  .dash-action-btn--primary { order: -1; flex: 1 1 100%; }
}

@media (max-width: 420px) {
  .dashboard-wrapper { padding: 10px; }
  .metrics-grid { gap: 10px; }
  .greeting-card { padding: 16px; }
  .panel-header { padding: 14px 16px; }
  .panel-content { padding: 14px 16px; }
  .stat-card { padding: 10px 8px 10px 10px; padding-right: 40px; }
  .stat-card .stat-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 13px !important;
    top: 8px !important;
    right: 8px !important;
  }
  .stat-value { font-size: 16px; }
  .stat-title { font-size: 9.5px; }
  .stat-card .stat-subtext { font-size: 10.5px; }
}

@media (max-width: 400px) {
  .list-card-container { gap: 10px; }
  .list-card-horizontal .list-card-thumb,
  .list-card-horizontal .list-card-thumb-placeholder { height: 100px; }
}

/* =========================================================
   MOBILE INPUT OVERRIDE — 16px everywhere on small screens
   (prevents iOS auto-zoom on tap)
   ========================================================= */
@media (max-width: 768px) {
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="month"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="search"],
  input:not([type]),
  select,
  textarea,
  .input,
  .select,
  .form-control {
    font-size: 16px !important;
  }

  input::placeholder,
  select::placeholder,
  textarea::placeholder,
  .input::placeholder,
  .select::placeholder,
  .form-control::placeholder {
    font-size: 16px !important;
    opacity: 1 !important;
  }
}