/* ─────────────────────────────────────────────────────────────────────────────
   Roomie Admin Panel — Brand Design System
   Brand: Plus Jakarta Sans · #DF4513 primary · #FBAA12 secondary · #FFF9F8 bg
───────────────────────────────────────────────────────────────────────────── */

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

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

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --primary:       #DF4513;
  --primary-hover: #C43C10;
  --primary-light: #FDF0EC;
  --primary-mid:   rgba(223,69,19,.12);
  --secondary:     #FBAA12;
  --secondary-light: #FFF8E6;
  --bg:            #FFF9F8;
  --card:          #FFFFFF;
  --border:        #F0EAE8;
  --border-mid:    #E8E0DD;
  --text:          #1A1A1A;
  --text-muted:    #666666;
  --text-faint:    #999999;
  --success:       #22C55E;
  --success-light: #DCFCE7;
  --danger:        #EF4444;
  --danger-light:  #FEE2E2;
  --blue:          #3B82F6;
  --blue-light:    #DBEAFE;
  --sidebar-w:     252px;
  --topbar-h:      64px;
  --radius:        14px;
  --radius-sm:     9px;
  --radius-xs:     6px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.05);
  --shadow-md:     0 8px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
  --transition:    all .18s ease;
}

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #DDD; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #BBB; }

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(223,69,19,.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 110%, rgba(251,170,18,.07) 0%, transparent 60%);
  padding: 24px;
}

.login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 48px 44px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md), 0 0 0 1px var(--border);
}

.login-logo {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.login-wordmark {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
  line-height: 1;
}

.login-subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: .3px;
}

/* ── Form elements ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #FEFEFE;
  transition: var(--transition);
  outline: none;
  font-family: inherit;
  font-weight: 500;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-faint); font-weight: 400; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(223,69,19,.10);
  background: #fff;
}

.form-group select { cursor: pointer; }
.form-group textarea { resize: vertical; min-height: 100px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
  letter-spacing: -.1px;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(223,69,19,.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(223,69,19,.32);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
  box-shadow: 0 2px 8px rgba(251,170,18,.25);
}
.btn-secondary:hover {
  background: #E89E0F;
  box-shadow: 0 4px 14px rgba(251,170,18,.32);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-mid);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: #D5CBC7; }

.btn-outline-primary {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(223,69,19,.2);
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-danger { background: var(--danger-light); color: var(--danger); border-color: rgba(239,68,68,.15); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success { background: var(--success-light); color: #16A34A; border-color: rgba(34,197,94,.15); }
.btn-success:hover { background: var(--success); color: #fff; }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: var(--radius-sm); }

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 14px;
  text-align: center;
  min-height: 18px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════════════════════════ */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo img {
  height: 36px;
  width: auto;
  object-fit: contain;
  height: 36px;
  width: auto;
  object-fit: contain;
}

.sidebar-logo .brand-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border-mid);
  padding: 1px 7px;
  border-radius: 20px;
  letter-spacing: .3px;
  display: inline-block;
  width: fit-content;
}

.sidebar-nav {
  padding: 14px 10px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-faint);
  padding: 10px 10px 5px;
  margin-top: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: var(--transition);
  position: relative;
}

.nav-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: var(--transition);
  background: transparent;
}

.nav-link:hover {
  background: var(--bg);
  color: var(--text);
}
.nav-link:hover .nav-icon { background: var(--bg); }

.nav-link.active {
  background: var(--primary);
  color: #fff;
}
.nav-link.active .nav-icon {
  background: rgba(255,255,255,.2);
}

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;       /* keeps topbar sticky within this column */
  height: 100vh;
}

/* ── Top Bar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  flex-shrink: 0;         /* never squish — always full 64 px */
  z-index: 50;
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.page-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.3px;
  line-height: 1;
}

/* keep old class working too (used on a few pages as topbar subtitle) */
.topbar-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.3px;
  line-height: 1;
}

.page-date,
.topbar-date {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 500;
}

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

.admin-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
}

.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.admin-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAGE CONTENT
═══════════════════════════════════════════════════════════════════════════ */
.page-content {
  flex: 1;
  overflow-y: auto;       /* scrollable content area, not the whole page */
  padding: 28px;
  background: var(--bg);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header-left h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
}

.page-header-left p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 3px;
  font-weight: 500;
}

.page-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-top: 3.5px solid var(--accent-color, var(--primary));
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  background: var(--accent-color, var(--primary));
  opacity: .04;
  border-radius: 50%;
}

.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-icon-wrap {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--accent-bg, var(--primary-light));
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1.5px;
  line-height: 1;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
  font-weight: 500;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 20px;
}

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

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

.card-header-left h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.2px;
}

.card-header-left p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  padding: 11px 22px;
  text-align: left;
  background: #FDFAF9;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr { transition: background .12s; }
tbody tr:hover td { background: #FDFAF9; }

/* ── User cell ───────────────────────────────────────────────────────────── */
.td-user { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1.5px solid rgba(223,69,19,.12);
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-name { font-weight: 700; font-size: 13.5px; color: var(--text); }
.user-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; font-weight: 500; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: -.1px;
}

.badge-active   { background: var(--success-light); color: #16A34A; }
.badge-banned   { background: var(--danger-light);  color: var(--danger); }
.badge-pending  { background: #FEF3C7; color: #D97706; }
.badge-inactive { background: var(--bg); color: var(--text-faint); border: 1px solid var(--border-mid); }
.badge-sent     { background: var(--primary-light); color: var(--primary); }

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-wrap { position: relative; }

.search-wrap input {
  width: 240px;
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  background: var(--card);
  outline: none;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  transition: var(--transition);
}

.search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(223,69,19,.09);
  width: 280px;
}

.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 14px;
  pointer-events: none;
}

/* ── Notifications ───────────────────────────────────────────────────────── */
.notif-form { padding: 22px; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: var(--shadow-md);
  animation: toastIn .22s cubic-bezier(.34,1.56,.64,1);
  max-width: 340px;
}

.toast.success { background: #16A34A; }
.toast.error   { background: var(--danger); }

@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}

.empty-icon { font-size: 44px; margin-bottom: 14px; opacity: .7; }
.empty-state h4 { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; font-weight: 500; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border-mid);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }
.loading-row td { text-align: center; padding: 40px; border-bottom: none; }

/* ── Dashboard grid ──────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .16s ease;
  backdrop-filter: blur(2px);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-md), 0 0 0 1px var(--border);
  animation: modalIn .22s cubic-bezier(.34,1.56,.64,1);
}

@keyframes modalIn {
  from { transform: scale(.94) translateY(10px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

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

.modal-header h3 { font-size: 16px; font-weight: 800; letter-spacing: -.2px; }

.modal-close {
  background: var(--bg);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xs);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 5px 8px;
  transition: var(--transition);
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); border-color: rgba(239,68,68,.2); }

.modal-body { padding: 22px 24px; max-height: 70vh; overflow-y: auto; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Detail rows ─────────────────────────────────────────────────────────── */
.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); width: 130px; flex-shrink: 0; font-weight: 600; font-size: 12.5px; padding-top: 1px; }
.detail-value { font-weight: 600; flex: 1; color: var(--text); }

/* ── Notification history ────────────────────────────────────────────────── */
.notif-history-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}

.notif-history-item:last-child { border-bottom: none; }
.notif-history-item:hover { background: #FDFAF9; }

.notif-dot {
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.notif-history-item h4 { font-size: 13.5px; font-weight: 700; }
.notif-history-item p  { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; font-weight: 500; }
.notif-meta { margin-left: auto; text-align: right; font-size: 11.5px; color: var(--text-faint); flex-shrink: 0; font-weight: 500; }

/* ── Phone preview mock ──────────────────────────────────────────────────── */
.phone-notif {
  background: linear-gradient(135deg, #1A1A2E 0%, #2D1B14 100%);
  border-radius: 18px;
  padding: 18px;
  max-width: 320px;
  margin: 0 auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
}

.phone-notif-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}

.phone-notif-app-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.phone-notif-app-name { font-size: 12px; color: rgba(255,255,255,.6); font-weight: 600; }
.phone-notif-time { margin-left: auto; font-size: 11px; color: rgba(255,255,255,.4); }
.phone-notif-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; color: #fff; }
.phone-notif-body  { font-size: 13px; color: rgba(255,255,255,.7); line-height: 1.4; }

/* ── Info box ────────────────────────────────────────────────────────────── */
.info-box {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.info-box.warning {
  background: #FFF8E6;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.info-box.info {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(223,69,19,.15);
}

/* ── Recipient count chip ────────────────────────────────────────────────── */
.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--secondary-light);
  border: 1px solid rgba(251,170,18,.25);
  color: #92400E;
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ── Modal — large variant ───────────────────────────────────────────────── */
.modal-lg {
  max-width: 680px;
}

/* ── User Profile Modal ──────────────────────────────────────────────────── */
.modal-user-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.user-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid rgba(223,69,19,.15);
  box-shadow: 0 4px 12px rgba(223,69,19,.12);
}

.user-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.modal-user-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
  line-height: 1.1;
}

.modal-user-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 5px;
}

/* ── Profile sections ────────────────────────────────────────────────────── */
.profile-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.profile-section-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.profile-bio {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  font-style: italic;
  line-height: 1.6;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

/* ── Info grid ───────────────────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
  width: 100%;
}

/* canonical cell names */
.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
}

.info-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

/* legacy aliases — keep existing markup working */
.info-cell  { display: flex; flex-direction: column; gap: 4px; }
.info-cell-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #999; }
.info-cell-value { font-size: 14px; font-weight: 500; color: var(--text); word-break: break-word; }

/* ── Tag group ───────────────────────────────────────────────────────────── */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.modal-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.modal-tag-orange {
  background: var(--secondary-light);
  color: #92400E;
  border: 1px solid rgba(251,170,18,.25);
}

.modal-tag-blue {
  background: var(--blue-light);
  color: #1D4ED8;
  border: 1px solid rgba(59,130,246,.2);
}

.modal-tag-gray {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border-mid);
}

/* ── Lifestyle badges ────────────────────────────────────────────────────── */
.lifestyle-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 4px;
}

.lifestyle-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(223,69,19,.15);
}

.lifestyle-badge-yes {
  background: var(--success-light);
  color: #16A34A;
  border-color: rgba(34,197,94,.2);
}

.lifestyle-badge-no {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(239,68,68,.15);
}

.lifestyle-badge-neutral {
  background: var(--bg);
  color: var(--text-faint);
  border-color: var(--border-mid);
}

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-track {
  height: 7px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width .4s ease;
}

/* ── Charts ──────────────────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
  min-width: 0;
}

.chart-card {
  min-width: 0;
  overflow: hidden;
}

.chart-card .card-body {
  padding: 16px 20px 20px;
  position: relative;
  height: 220px;
  min-width: 0;
}

.chart-card canvas {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 1100px) {
  .charts-row {
    grid-template-columns: 1fr 1fr;
  }
  .charts-row .chart-card:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
}

/* card-title / card-subtitle aliases (used in chart cards) */
.card-title    { font-size: 15px; font-weight: 800; color: var(--text); letter-spacing: -.2px; }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
  background: #FDFAF9;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-group select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 32px 8px 12px;
  border: 1.5px solid #E5E0DE;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #1A1A1A;
  background-color: #FFFFFF;
  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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  font-family: inherit;
  height: 36px;
  min-width: 130px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-group select:hover {
  border-color: #DF4513;
}

.filter-group select:focus {
  outline: none;
  border-color: #DF4513;
  box-shadow: 0 0 0 3px rgba(223,69,19,.12);
}

.filter-group select option {
  font-weight: 400;
  color: #1A1A1A;
}

.filter-bar .btn-ghost {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid #E5E0DE;
  border-radius: 8px;
  background: white;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-bar .btn-ghost:hover {
  border-color: #DF4513;
  color: #DF4513;
  background: #FFF0EB;
}

.filter-results {
  font-size: 13px;
  font-weight: 500;
  color: #DF4513;
  background: #FFF0EB;
  padding: 4px 10px;
  border-radius: 6px;
  display: none;
}

.filter-results:not(:empty) {
  display: block;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .search-wrap input { width: 200px; }
  .search-wrap input:focus { width: 220px; }
}

@media (max-width: 700px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .page-content { padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── Chat bubbles (Reports conversation viewer) ──────────────────────────── */
.conv-viewer {
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 14px;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
}
.msg-reporter {
  align-self: flex-start;
  background: #FFFFFF;
  border: 1px solid var(--border-mid);
  border-bottom-left-radius: 4px;
}
.msg-target {
  align-self: flex-end;
  background: var(--primary-light);
  border: 1px solid rgba(223,69,19,.15);
  border-bottom-right-radius: 4px;
}
.msg-sender {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-faint);
  margin-bottom: 3px;
}
.msg-text { color: var(--text); font-weight: 500; }
.msg-time { font-size: 10px; color: var(--text-faint); margin-top: 3px; text-align: right; }

/* ── Repeat offender badge ───────────────────────────────────────────────── */
.offender-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid rgba(251,191,36,.3);
}
.offender-badge.danger {
  background: #FEE2E2;
  color: var(--danger);
  border-color: rgba(239,68,68,.2);
}

/* ── Admin notes textarea ────────────────────────────────────────────────── */
.admin-notes-textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.admin-notes-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-mid);
}

/* ── Copy-id ────────────────────────────────────────────────────────────── */
.copy-id {
  font-family: monospace;
  font-size: 11px;
  color: var(--primary);
  cursor: pointer;
  word-break: break-all;
}
.copy-id:hover { text-decoration: underline; }

/* ── Case number ────────────────────────────────────────────────────────── */
.case-num {
  font-family: monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-faint);
  white-space: nowrap;
}
