/* ============================================================
   SocietyDesk - Main Stylesheet
   Developed by Chirag Solutions
   Mobile-first | Production Grade
   ============================================================ */

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

/* ── CSS VARIABLES (Chirag Solutions Brand) ─────────────────── */
:root {
  --cs-blue-dark:    #0D2B5E;
  --cs-blue-mid:     #1565C0;
  --cs-blue:         #1E88E5;
  --cs-blue-light:   #42A5F5;
  --cs-cyan:         #29B6F6;
  --cs-cyan-light:   #E1F5FE;

  --success:         #2E7D32;
  --success-light:   #E8F5E9;
  --warning:         #E65100;
  --warning-light:   #FFF3E0;
  --danger:          #C62828;
  --danger-light:    #FFEBEE;
  --info:            #0277BD;
  --info-light:      #E1F5FE;

  --bg:              #F4F6FA;
  --bg-card:         #FFFFFF;
  --border:          #E0E7F0;
  --border-dark:     #C5D0E0;

  --text:            #1A2236;
  --text-secondary:  #5A6A82;
  --text-muted:      #8A99AE;
  --text-white:      #FFFFFF;

  --sidebar-width:   260px;
  --topbar-height:   64px;
  --bottomnav-height: 64px;
  --radius-sm:       6px;
  --radius:          10px;
  --radius-lg:       16px;
  --radius-xl:       24px;
  --shadow-sm:       0 1px 3px rgba(13,43,94,.08);
  --shadow:          0 4px 16px rgba(13,43,94,.10);
  --shadow-lg:       0 8px 32px rgba(13,43,94,.15);
  --transition:      0.2s ease;
  --font:            'Inter', system-ui, -apple-system, sans-serif;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cs-blue); text-decoration: none; }
a:hover { color: var(--cs-blue-dark); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
h5 { font-size: .875rem; font-weight: 600; }
.text-sm   { font-size: .8125rem; }
.text-xs   { font-size: .75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

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

/* Sidebar (Admin/SuperAdmin) */
.sidebar {
  width: var(--sidebar-width);
  background: var(--cs-blue-dark);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo img { height: 36px; width: auto; filter: brightness(0) invert(1); }
.sidebar-logo-text { color: var(--text-white); font-size: .8rem; opacity: .7; }
.sidebar-section { padding: 12px 0; }
.sidebar-section-title {
  padding: 0 20px 6px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.4);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.75);
  font-size: .875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
}
.sidebar-link:hover,
.sidebar-link.active {
  color: var(--text-white);
  background: rgba(255,255,255,.08);
  border-left-color: var(--cs-cyan);
}
.sidebar-link .icon {
  width: 18px;
  text-align: center;
  font-size: 1rem;
  opacity: .9;
}
.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
}

/* Main content area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--cs-blue);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem; font-weight: 600;
  cursor: pointer;
}
.sidebar-toggle {
  display: none;
  width: 36px; height: 36px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text);
}

/* Page content */
.page-content { padding: 24px; flex: 1; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.375rem; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.breadcrumb a { color: var(--cs-blue); }
.breadcrumb-sep { color: var(--border-dark); }

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 1rem; font-weight: 600; }
.card-body  { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--cs-blue));
}
.stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  background: var(--stat-bg, var(--cs-cyan-light));
  color: var(--stat-color, var(--cs-blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.stat-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-sub   { font-size: .75rem; color: var(--text-muted); }
.stat-up   { color: var(--success); }
.stat-down { color: var(--danger); }

/* Color variants */
.stat-card.blue   { --stat-color: var(--cs-blue);  --stat-bg: #E3F2FD; }
.stat-card.green  { --stat-color: var(--success);  --stat-bg: var(--success-light); }
.stat-card.orange { --stat-color: #E65100;          --stat-bg: var(--warning-light); }
.stat-card.red    { --stat-color: var(--danger);   --stat-bg: var(--danger-light); }
.stat-card.cyan   { --stat-color: #0277BD;          --stat-bg: var(--cs-cyan-light); }
.stat-card.purple { --stat-color: #6A1B9A;          --stat-bg: #F3E5F5; }

/* ── TABLE ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  background: #F0F4FA;
  padding: 11px 16px;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #F8FAFD; }
.table .actions { display: flex; gap: 6px; }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.required::after { content: ' *'; color: var(--danger); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: .875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--cs-blue);
  box-shadow: 0 0 0 3px rgba(30,136,229,.12);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235A6A82' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; }
.input-group { position: relative; display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group-append .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-weight: 600; pointer-events: none;
}
.input-prefix ~ .form-control { padding-left: 28px; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--cs-blue);
  color: #fff;
  border-color: var(--cs-blue);
}
.btn-primary:hover { background: var(--cs-blue-dark); border-color: var(--cs-blue-dark); color: #fff; }
.btn-dark {
  background: var(--cs-blue-dark);
  color: #fff;
  border-color: var(--cs-blue-dark);
}
.btn-dark:hover { background: #0a1f45; border-color: #0a1f45; color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--cs-blue);
  border-color: var(--cs-blue);
}
.btn-outline:hover { background: var(--cs-blue); color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #1B5E20; color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-danger:hover  { background: #8B0000; color: #fff; }
.btn-warning { background: #E65100; color: #fff; border-color: #E65100; }
.btn-ghost   { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-sm { padding: 6px 12px; font-size: .8125rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-xl { padding: 18px 36px; font-size: 1.125rem; border-radius: var(--radius-lg); }
.btn-icon { padding: 8px; width: 34px; height: 34px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; pointer-events: none; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge-success  { background: var(--success-light); color: var(--success); }
.badge-warning  { background: var(--warning-light); color: var(--warning); }
.badge-danger   { background: var(--danger-light);  color: var(--danger); }
.badge-info     { background: var(--info-light);    color: var(--info); }
.badge-secondary { background: #ECEFF4; color: var(--text-secondary); }
.badge-primary  { background: #E3F2FD; color: var(--cs-blue); }
.badge-critical { background: #4A0000; color: #fff; }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(13,43,94,.45);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: var(--bg);
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--text-muted);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body   { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  display: flex; align-items: flex-start; gap: 10px;
  font-size: .875rem;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-light); border-color: #A5D6A7; color: #1B5E20; }
.alert-danger  { background: var(--danger-light);  border-color: #EF9A9A; color: #7F0000; }
.alert-warning { background: var(--warning-light); border-color: #FFCC80; color: #BF360C; }
.alert-info    { background: var(--info-light);    border-color: #81D4FA; color: #01579B; }

/* Toast Notifications */
#toast-container {
  position: fixed; bottom: 80px; right: 20px;
  z-index: 999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  min-width: 280px; max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  font-size: .875rem;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info    { background: var(--info); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── MOBILE APP BOTTOM NAV ───────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(13,43,94,.08);
}
.bottom-nav-inner {
  display: flex;
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: color var(--transition);
  text-decoration: none;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item .nav-icon {
  font-size: 1.3rem;
  transition: transform var(--transition);
}
.bottom-nav-item.active {
  color: var(--cs-blue);
}
.bottom-nav-item.active .nav-icon {
  transform: scale(1.15);
}
.bottom-nav-item .nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 16px);
  background: var(--danger);
  color: #fff;
  font-size: .55rem;
  min-width: 16px;
  height: 16px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* ── GUARD PANEL - Big buttons ───────────────────────────────── */
.guard-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}
.guard-action-btn {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 130px;
  justify-content: center;
}
.guard-action-btn:active { transform: scale(.96); }
.guard-action-btn.green  { border-color: var(--success); color: var(--success); background: var(--success-light); }
.guard-action-btn.blue   { border-color: var(--cs-blue); color: var(--cs-blue); background: #E3F2FD; }
.guard-action-btn.yellow { border-color: #E65100; color: #E65100; background: var(--warning-light); }
.guard-action-btn.red    { border-color: var(--danger); color: var(--danger); background: var(--danger-light); }
.guard-action-icon { font-size: 2.5rem; }

/* ── STAT ROW ────────────────────────────────────────────────── */
.stat-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.stat-row .stat-card { min-width: 150px; flex-shrink: 0; }
.stat-row::-webkit-scrollbar { height: 4px; }
.stat-row::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }

/* ── AVATAR ──────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--cs-blue);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: .7rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.375rem; }

/* ── PROGRESS BAR ────────────────────────────────────────────── */
.progress { background: var(--border); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar {
  height: 100%;
  border-radius: 20px;
  background: var(--cs-blue);
  transition: width .5s ease;
}
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* ── TABS ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab-item {
  padding: 10px 20px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--transition);
}
.tab-item:hover { color: var(--cs-blue); }
.tab-item.active { color: var(--cs-blue); border-bottom-color: var(--cs-blue); }
.tab-content > div { display: none; }
.tab-content > div.active { display: block; }

/* ── FILTER BAR ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.search-input-wrap .form-control { padding-left: 38px; }

/* ── TIMELINE (Complaints / Work Orders) ─────────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 9px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute;
  left: -24px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--cs-blue);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--cs-blue);
}
.timeline-dot.success { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-dot.warning { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }
.timeline-dot.danger  { background: var(--danger);  box-shadow: 0 0 0 2px var(--danger); }
.timeline-time { font-size: .75rem; color: var(--text-muted); margin-bottom: 4px; }
.timeline-content {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px 14px;
  border: 1px solid var(--border);
  font-size: .875rem;
}

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 12px;
}
.empty-state-icon { font-size: 3rem; opacity: .5; }
.empty-state h3   { color: var(--text-secondary); }

/* ── LOGIN PAGE ──────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cs-blue-dark) 0%, var(--cs-blue-mid) 50%, var(--cs-blue) 100%);
  padding: 16px;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo img { height: 44px; margin: 0 auto; }
.auth-title { font-size: 1.5rem; font-weight: 800; text-align: center; color: var(--cs-blue-dark); margin-bottom: 4px; }
.auth-sub   { text-align: center; color: var(--text-muted); font-size: .875rem; margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: .8rem; color: var(--text-muted); }
.auth-footer a { color: var(--cs-blue); font-weight: 600; }

/* ── DROPDOWN ────────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 999;
  overflow: hidden;
  display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  padding: 10px 16px;
  font-size: .875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── MOBILE RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
  }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .page-content { padding: 16px; padding-bottom: calc(var(--bottomnav-height) + 16px); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
  .table th, .table td { padding: 10px 12px; }
  .auth-card { padding: 28px 20px; }
  .modal-body { padding: 16px; }
  .modal-header, .modal-footer { padding: 14px 16px; }
}

/* Resident mobile app: show bottom nav, no sidebar */
.app-resident .sidebar   { display: none; }
.app-resident .main-content { margin-left: 0; }
.app-resident .bottom-nav { display: flex; }
.app-resident .page-content { padding-bottom: calc(var(--bottomnav-height) + 20px); }

/* Guard panel */
.app-guard .sidebar   { display: none; }
.app-guard .main-content { margin-left: 0; }

/* ── UTILITY CLASSES ─────────────────────────────────────────── */
.d-flex  { display: flex; }
.d-grid  { display: grid; }
.d-none  { display: none; }
.d-block { display: block; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.p-0    { padding: 0 !important; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rounded { border-radius: var(--radius); }
.rounded-full { border-radius: 50%; }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--cs-blue); }
.bg-success-light { background: var(--success-light); }
.bg-danger-light  { background: var(--danger-light); }
.cursor-pointer { cursor: pointer; }
.no-select { user-select: none; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
