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

:root {
  --primary:        #1e3a5f;
  --primary-hover:  #162d4a;
  --primary-light:  #2d5986;
  --primary-soft:   #e8f0fb;
  --accent:         #f59e0b;
  --accent-light:   #fef3c7;
  --success:        #059669;
  --success-soft:   #d1fae5;
  --warning:        #d97706;
  --warning-soft:   #fef3c7;
  --danger:         #dc2626;
  --danger-soft:    #fee2e2;
  --info:           #0284c7;
  --info-soft:      #e0f2fe;
  --bg:             #f0f4f8;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --border-dark:    #cbd5e1;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --text-light:     #94a3b8;
  --sidebar-w:      260px;
  --header-h:       64px;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:         0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-md:      0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-lg:      0 20px 25px -5px rgba(0,0,0,0.10), 0 10px 10px -5px rgba(0,0,0,0.04);
  --transition:     all 0.2s ease;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
  overscroll-behavior-x: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
  overscroll-behavior-x: none;
}

/* ===== BACK BUTTON — list pages (inside page-header-left) ===== */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem 0.45rem 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 0.65rem;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}
.back-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary);
  transform: translateX(-2px);
}

/* ===== BACK NAV — above hero/detail pages (standalone, prominent) ===== */
.back-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.1rem 0.55rem 0.85rem;
  margin-bottom: 0.85rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}
.back-nav:hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary);
  transform: translateX(-3px);
}
.back-nav-arrow {
  font-size: 1.05rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.15s;
}
.back-nav:hover .back-nav-arrow { transform: translateX(-2px); }

.hidden { display: none !important; }
.w-full { width: 100%; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  background: linear-gradient(-45deg, #0f172a, #1e3a5f, #1a3a6e, #0d2444);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
}

@keyframes gradientShift {
  0%,100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.login-bg-anim {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(245,158,11,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(59,130,246,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.1);
  animation: loginSlideUp 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes loginSlideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.login-logo svg { flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15)); }

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.login-logo p {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.login-error {
  background: var(--danger-soft);
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-left: 4px solid var(--danger);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.field-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.25rem; }
.field-group label { font-size: 0.875rem; font-weight: 600; color: var(--text); }

.field-group input,
.field-group select,
.field-group textarea {
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: var(--transition);
  width: 100%;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}

.field-group input::placeholder { color: var(--text-light); }
.field-group textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

.password-field { position: relative; }
.password-field input { padding-right: 5rem; }
.pwd-toggle {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 0.8rem; font-weight: 600;
  color: var(--primary-light); cursor: pointer; padding: 0.25rem 0.5rem;
}

.btn-login {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.3px;
  margin-top: 0.5rem;
}

.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(30,58,95,0.3); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* ===== OVERLAY / MODAL ===== */
.overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

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

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.75rem;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.3s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
}

.modal-large { max-width: 760px; }
.modal-xl    { max-width: 920px; }

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon { font-size: 2.5rem; text-align: center; margin-bottom: 0.75rem; }
.modal-card h2 { font-size: 1.3rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; text-align: center; }
.modal-card > p { color: var(--text-muted); font-size: 0.9rem; text-align: center; margin-bottom: 1.5rem; }

.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: var(--bg); border: none; border-radius: 50%;
  width: 32px; height: 32px; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }

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

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s ease, transform 0.3s ease;
}

.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 1.25rem 0 1rem; }
.sidebar.collapsed .sidebar-collapse-btn { margin-left: 0; transform: rotate(180deg); }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.7rem; }
.sidebar.collapsed .nav-icon { width: auto; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .btn-logout { padding: 0.6rem; display: flex; justify-content: center; }
.sidebar.collapsed .logout-icon { display: inline; }
.sidebar.collapsed ~ .main-content { margin-left: 64px; }

.sidebar-collapse-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: var(--transition);
  line-height: 1;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

.logout-icon { display: none; font-size: 1rem; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 0.5rem;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 1rem; font-weight: 800; color: #fff; line-height: 1.2; }
.brand-sub  { font-size: 0.7rem; color: rgba(255,255,255,0.55); margin-top: 1px; }

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }

.nav-item.active {
  background: rgba(245,158,11,0.2);
  color: #fff;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

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

.unread-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.unread-badge.hidden { display: none; }

.feedback-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: rgba(245,158,11,0.15);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-sm);
  color: #fbbf24;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.feedback-btn:hover { background: rgba(245,158,11,0.25); color: #fff; }
.sidebar.collapsed .feedback-btn { justify-content: center; padding: 0.65rem; }

/* ===== INBOX ===== */
.inbox-list { display: flex; flex-direction: column; gap: 0.75rem; }
.inbox-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  cursor: pointer;
  transition: var(--transition);
}
.inbox-item:hover { box-shadow: var(--shadow); border-color: var(--primary); }
.inbox-item.unread { border-left: 3px solid var(--primary); background: #f0f4ff; }
.inbox-item-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 0.1rem; }
.inbox-item-body { flex: 1; min-width: 0; }
.inbox-item-from { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.15rem; }
.inbox-item-subject { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.inbox-item-preview { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item-time { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 38px; height: 38px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--primary);
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 0.875rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: rgba(255,255,255,0.5); }

.btn-logout {
  width: 100%;
  padding: 0.6rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(220,38,38,0.3); border-color: rgba(220,38,38,0.5); color: #fff; }

/* ===== MOBILE HEADER ===== */
.mobile-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--primary);
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.hamburger { background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; padding: 0.25rem; }
.mobile-brand { flex: 1; font-size: 1rem; font-weight: 800; color: #fff; }
.mobile-avatar { width: 32px; height: 32px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; color: var(--primary); }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s ease;
  overflow-x: hidden;
  min-width: 0;
}

.page-container {
  flex: 1;
  padding: 2rem 2.5rem;
  width: 100%;
  animation: pageIn 0.3s ease;
  overflow-x: hidden;
  min-width: 0;
}

/* No max-width cap on page-container — content fills the full area beside the sidebar */

@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.page-header-left p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.page-header-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

/* ===== DASHBOARD 3-COLUMN GRID (Inbox | Search | Takeover  /  Stats  /  Appts | Cases | Events) ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-areas:
    "inbox    search    takeover"
    "week     week      week"
    "pending  pending   pending"
    "stats    stats     stats"
    "mycases  cases     events";
  gap: 1.25rem;
  align-items: start;
}

.da-inbox    { grid-area: inbox; }
.da-search   { grid-area: search; }
.da-takeover { grid-area: takeover; display: flex; flex-direction: column; gap: 1rem; }
.da-pending  { grid-area: pending; display: flex; flex-direction: column; gap: 1rem; }
.da-stats    { grid-area: stats; margin: 0; }
.da-week     { grid-area: week; }
.da-mycases  { grid-area: mycases; }
.da-cases    { grid-area: cases; }
.da-events   { grid-area: events; }

/* ─── Week strip two-panel layout ─── */
.week-two-panel { display: flex; gap: 16px; align-items: start; }
.week-left-panel  { flex: 0 0 65%; position: static; border-top: 3px solid #112A47; }
.week-right-panel { flex: 1;       position: static; border-top: 3px solid #C8902E; }
.week-strip { display: flex; padding: 0.5rem; gap: 0; }
.week-day-col {
  flex: 1;
  border-right: 1px solid var(--border);
  padding: 0.4rem;
  min-height: 80px;
}
.week-day-col:last-child { border-right: none; }
.week-day-today { background: #EAF1FB; }
.week-day-header { display: flex; flex-direction: column; align-items: center; margin-bottom: 0.4rem; gap: 1px; }
.week-day-name { font-size: 0.66rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.week-day-num  { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.week-day-today .week-day-num { color: #112A47; }
.week-appt-chip {
  background: #EAF1FB;
  border-left: 3px solid #112A47;
  border-radius: 3px;
  padding: 2px 4px;
  margin-bottom: 3px;
  cursor: pointer;
  font-size: 0.66rem;
  line-height: 1.35;
}
.week-appt-chip:hover { opacity: 0.8; }
.week-appt-time { display: block; color: #112A47; font-weight: 700; }
.week-appt-name { display: block; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 72px; }
.week-day-empty { font-size: 0.68rem; color: var(--text-muted); text-align: center; padding: 0.6rem 0; }
.week-upcoming-list { padding: 0.25rem 0; }
@media (max-width: 900px) {
  .week-two-panel { flex-direction: column; }
  .week-left-panel, .week-right-panel { flex: none; width: 100%; }
}

/* Old layout kept as alias in case other code still references it */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1.85fr 1fr;
  gap: 1.75rem;
  align-items: start;
}

/* Inbox preview item */
.inbox-preview-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.inbox-preview-item:hover { background: var(--bg); }
.inbox-preview-item.unread { background: var(--primary-soft); }
.inbox-preview-item .ipv-from {
  font-weight: 700; font-size: 0.88rem; color: var(--primary);
  display: flex; justify-content: space-between; gap: 0.5rem; align-items: center;
}
.inbox-preview-item .ipv-time { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.inbox-preview-item .ipv-subject { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.inbox-preview-item .ipv-body {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.events-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: sticky;
  top: 2rem;
}

.events-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.events-panel-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.events-list { padding: 0.5rem 0; max-height: 520px; overflow-y: auto; }

.event-item {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  transition: var(--transition);
}
.event-item:last-child { border-bottom: none; }
.event-item:hover { background: var(--bg); }

.event-date-badge {
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  text-align: center;
  min-width: 42px;
  flex-shrink: 0;
}
.event-date-badge .ev-month { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8; }
.event-date-badge .ev-day   { font-size: 1.1rem; font-weight: 800; line-height: 1.1; }

.event-body { flex: 1; min-width: 0; }
.event-title { font-size: 0.875rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-note  { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }

.event-add-form {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: none;
  flex-direction: column;
  gap: 0.5rem;
}
.event-add-form.open { display: flex; }
.event-add-form input, .event-add-form textarea {
  width: 100%;
  padding: 0.45rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text);
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

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

.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}

.stat-card.blue::before   { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card.amber::before  { background: linear-gradient(90deg, var(--accent), #fbbf24); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--success), #10b981); }
.stat-card.purple::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

.stat-card-icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  display: block;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.3rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.card-subtitle {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ===== SECTION HEADER (within forms) ===== */
.section-header {
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: 0;
}

.section-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

/* ===== FORM GRID ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.1rem;
}

.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.col-full { grid-column: 1 / -1; }

/* ===== BUTTONS ===== */
button, .btn { font-family: inherit; cursor: pointer; transition: var(--transition); border: none; outline: none; }

.btn-primary {
  padding: 0.65rem 1.25rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(30,58,95,0.25); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  padding: 0.65rem 1.25rem;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-secondary:hover { background: var(--bg); border-color: var(--border-dark); }

/* Org filter tab buttons (Clients page) */
.btn-tab-filter {
  padding: 0.4rem 1rem;
  background: var(--surface);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.btn-tab-filter:hover { background: var(--bg); color: var(--text); }
.btn-tab-filter.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }

.btn-danger {
  padding: 0.65rem 1.25rem;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1.5px solid #fca5a5;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

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

.btn-success {
  padding: 0.65rem 1.25rem;
  background: var(--success);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-success:hover { background: #047857; transform: translateY(-1px); }

.btn-sm { padding: 0.4rem 0.8rem !important; font-size: 0.8rem !important; }
.btn-icon { padding: 0.5rem !important; border-radius: var(--radius-sm) !important; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-active    { background: var(--success-soft); color: #065f46; }
.badge-pending   { background: var(--warning-soft); color: #78350f; }
.badge-hold      { background: #fed7aa; color: #c2410c; }          /* orange — On Hold */
.badge-info      { background: var(--info-soft); color: #075985; } /* blue — Completed */
.badge-referred  { background: #ede9fe; color: #5b21b6; }          /* purple — Referred */
.badge-red       { background: #fee2e2; color: #b91c1c; }          /* red — Unable to Reach / No Show */
.badge-closed    { background: var(--border); color: var(--text-muted); } /* gray — Declined / Ineligible */
.badge-charcoal  { background: #1e293b; color: #f1f5f9; }          /* dark — Closed */
.badge-approved  { background: var(--success-soft); color: #065f46; }
.badge-denied    { background: var(--danger-soft); color: #991b1b; }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  transition: var(--transition);
}

.search-bar:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(30,58,95,0.08);
}

.search-bar input {
  flex: 1;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
}

.search-bar input::placeholder { color: var(--text-light); }

/* ===== CLIENT LIST ===== */
.client-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  gap: 1rem;
}

.client-list-item:last-child { border-bottom: none; }
.client-list-item:hover { background: var(--bg); }

.client-avatar {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.client-info { flex: 1; min-width: 0; }
.client-name { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.client-meta { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ===== CASE CARDS ===== */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.case-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  cursor: pointer;
  transition: var(--transition);
}

.case-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.case-card.active-case { border-left-color: var(--success); }
.case-card.pending-case { border-left-color: var(--accent); }
.case-card.closed-case { border-left-color: var(--text-muted); }
.case-card.hold-case { border-left-color: #7c3aed; }

.case-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.85rem;
  gap: 0.5rem;
}

.case-card-id { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; }
.case-card-date { font-size: 0.75rem; color: var(--text-light); white-space: nowrap; }

.case-row { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.case-row:last-child { border-bottom: none; }
.case-row-label { font-weight: 600; color: var(--text-muted); }
.case-row-value { color: var(--text); text-align: right; max-width: 60%; }

.services-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }

.service-tag {
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.add-case-card {
  background: linear-gradient(135deg, #f8faff, #eef2ff);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 2px dashed var(--border-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  cursor: pointer;
  transition: var(--transition);
  gap: 0.75rem;
  text-align: center;
}

.add-case-card:hover { border-color: var(--primary-light); background: linear-gradient(135deg, #eef2ff, #e8f0fb); transform: translateY(-2px); }
.add-case-card .plus { font-size: 2rem; color: var(--primary-light); }
.add-case-card span { font-size: 0.9rem; font-weight: 600; color: var(--primary); }

/* ===== FA CARDS ===== */
.fa-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  cursor: pointer;
  transition: var(--transition);
}

.fa-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.fa-card.approved { border-left-color: var(--success); }
.fa-card.denied { border-left-color: var(--danger); }

/* ===== NOTES ===== */
.note-item {
  background: #f8faff;
  border-left: 3px solid var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}

.note-meta { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.4rem; display: flex; gap: 0.75rem; align-items: center; }
.note-author { font-weight: 700; color: var(--primary); }
.note-text { font-size: 0.9rem; color: var(--text); line-height: 1.5; }

/* ===== PROFILE HEADER ===== */
.profile-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, #3d7cc9 100%);
  border-radius: var(--radius);
  padding: 2rem;
  color: #fff;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.profile-hero::before {
  content: '';
  position: absolute; top: -50%; right: -10%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(245,158,11,0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.profile-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }

.profile-avatar-large {
  width: 64px; height: 64px;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
}

.profile-name { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.profile-sub  { font-size: 0.875rem; opacity: 0.8; margin-top: 0.25rem; }

.profile-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.profile-meta-item { }
.profile-meta-label { font-size: 0.7rem; opacity: 0.65; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.profile-meta-value { font-size: 0.9rem; font-weight: 600; margin-top: 0.1rem; }

/* ===== TABS ===== */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  gap: 0;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.tab-btn:hover:not(.active) { color: var(--text); background: var(--bg); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== FPL TABLE ===== */
.fpl-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.fpl-table th { background: var(--primary); color: #fff; padding: 0.75rem 1rem; text-align: left; font-weight: 700; position: sticky; top: 0; }
.fpl-table th:not(:first-child) { text-align: right; }
.fpl-table td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); }
.fpl-table td:not(:first-child) { text-align: right; }
.fpl-table tr:hover td { background: var(--bg); }
.fpl-table tr:nth-child(even) td { background: #fafbfc; }
.fpl-table tr:nth-child(even):hover td { background: var(--bg); }
.fpl-table td:first-child { font-weight: 700; }

/* ===== ADMIN TABLE ===== */
.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  gap: 1rem;
  flex-wrap: wrap;
}

.user-row.admin-row { border-left-color: var(--accent); }

/* ===== ACTIVE CASES DASHBOARD CARDS ===== */
.dash-case-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.dash-case-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dash-case-card h4 { font-size: 0.95rem; font-weight: 700; color: var(--primary); margin-bottom: 0.25rem; }
.dash-case-card p  { font-size: 0.82rem; color: var(--text-muted); }

/* ===== INLINE EDIT ===== */
.inline-edit-btn {
  padding: 0.3rem 0.6rem;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(30,58,95,0.2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.inline-edit-btn:hover { background: var(--primary); color: #fff; }

/* ===== CHECKBOX GROUPS ===== */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.check-item:hover { border-color: var(--primary-light); background: var(--primary-soft); }
.check-item input[type="checkbox"] { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.check-item label { font-size: 0.875rem; cursor: pointer; line-height: 1.4; }
.check-item label strong { display: block; font-size: 0.9rem; color: var(--primary); }

/* ===== FPL INDICATOR ===== */
.fpl-bar {
  background: var(--warning-soft);
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

/* ===== ACCOUNT CREDENTIAL ITEM ===== */
.account-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 0.4rem; }
.empty-state p { font-size: 0.9rem; max-width: 300px; margin: 0 auto; }

/* ===== LOADING ===== */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 2rem auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 260px;
  max-width: 360px;
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  border-left: 4px solid var(--primary-light);
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); background: #1a0a0a; }
.toast.warning { border-left-color: var(--accent); }

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

@keyframes toastOut {
  to { opacity: 0; transform: translateX(110%); }
}

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }
.divider-label { text-align: center; position: relative; margin: 1.5rem 0; }
.divider-label::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.divider-label span { background: var(--surface); padding: 0 1rem; position: relative; font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

/* ===== DETAIL ROWS ===== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.detail-item { }
.detail-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 0.2rem; }
.detail-value { font-size: 0.9rem; font-weight: 600; color: var(--text); }

/* ===== MODAL SECTION ===== */
.fa-section { margin-bottom: 1.25rem; }
.fa-section .section-body .form-grid { margin-bottom: 0.5rem; }

/* ===== NOTICE BANNER ===== */
.notice-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--warning-soft);
  border: 1px solid #fde68a;
  border-left: 4px solid var(--accent);
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: #78350f;
  margin-bottom: 1.25rem;
}

.disclaimer-box {
  background: var(--danger-soft);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  font-size: 0.82rem;
  color: #7f1d1d;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* ===== APPOINTMENTS ===== */
.sched-cell {
  display: inline-block;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.sched-cell.on  { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.sched-cell.off { background: #f1f5f9; color: #94a3b8; border: 1px solid #e2e8f0; }
.sched-cell:hover { opacity: 0.75; transform: scale(1.05); }

.appt-dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 0.5rem;
}
.appt-dash-card:hover { box-shadow: var(--shadow); }
.appt-dash-time { font-size: 0.8rem; font-weight: 800; color: var(--primary); min-width: 60px; }
.appt-dash-info { flex: 1; min-width: 0; }
.appt-dash-name { font-size: 0.88rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-dash-sub  { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ===== CHAT ===== */
.chat-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 4rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  transition: var(--transition);
  opacity: 0.6;
}
.chat-icon-btn:hover { background: var(--border); opacity: 1; }

.chat-hdr-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid var(--border-dark);
  background: var(--surface);
  color: var(--text-muted);
  transition: var(--transition);
  white-space: nowrap;
}
.chat-hdr-btn:hover { background: var(--bg); color: var(--text); border-color: var(--primary); }
.chat-hdr-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.chat-hdr-btn.primary:hover { background: var(--primary-light); border-color: var(--primary-light); }

.chat-room-list { flex: 1; overflow-y: auto; }

.chat-room-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.chat-room-item:hover { background: var(--surface); }
.chat-room-item.active { background: #eef2ff; border-left: 3px solid var(--primary); }
.chat-room-item.unread .chat-room-name { font-weight: 800; }

.chat-room-icon { font-size: 1.2rem; flex-shrink: 0; }
.chat-room-info { flex: 1; min-width: 0; }
.chat-room-name { font-size: 0.9rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-room-preview { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0.1rem; }

.chat-unread-dot {
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex-shrink: 0;
}

.chat-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem;
}

.chat-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--surface);
}
.chat-header-name { font-weight: 800; font-size: 1rem; color: var(--text); }
.chat-header-sub  { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chat-date-divider {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  font-weight: 600;
}

.chat-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.chat-msg-row.me { flex-direction: row-reverse; }

.chat-msg-avatar {
  width: 30px; height: 30px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
}

.chat-msg-bubble-wrap { max-width: 70%; display: flex; flex-direction: column; }
.chat-msg-row.me .chat-msg-bubble-wrap { align-items: flex-end; }

.chat-msg-name { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.2rem; padding-left: 0.6rem; }

.chat-msg-bubble {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}
.chat-msg-bubble.me {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  border-radius: 16px 16px 4px 16px;
}

.chat-msg-time { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.2rem; padding: 0 0.4rem; }

.chat-input-bar {
  display: flex;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
  max-height: 120px;
  min-height: 40px;
  line-height: 1.4;
  background: var(--bg);
  transition: border-color 0.2s;
}
.chat-input:focus { outline: none; border-color: var(--primary); }

.chat-send-btn {
  width: 40px; height: 40px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.chat-send-btn:hover { background: var(--primary-light); }

/* ===== PROGRAM PREVIEW (LOCKED) MODE ===== */
/* When a non-assigned staff views Sessions/Attendance/Materials/Notes/Reports
   the content is shown but visibly "locked" — washed out, low opacity,
   crossed with a subtle diagonal pattern, with an inline banner on top. */
.tab-preview-mode {
  position: relative;
}
.tab-preview-mode > *:not(.preview-banner) {
  opacity: 0.45;
  filter: grayscale(0.4);
  pointer-events: none;
  user-select: none;
}
.tab-preview-mode::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg,
    rgba(30,58,95,0.03) 0px, rgba(30,58,95,0.03) 14px,
    transparent 14px, transparent 28px);
  pointer-events: none;
  z-index: 1;
}
.preview-banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--accent-light) 0%, #fff 100%);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  opacity: 1 !important;
  filter: none !important;
  pointer-events: auto !important;
  user-select: text;
  position: relative;
  z-index: 2;
}

/* ===== RESTRICTED TAB BLUR OVERLAY ===== */
.tab-restricted-wrap {
  position: relative;
  min-height: 320px;
  border-radius: var(--radius);
  overflow: hidden;
}
.tab-restricted-blur {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}
.tab-restricted-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  gap: 0.85rem;
  z-index: 10;
}
.tab-restricted-pill {
  background: #112A47;
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 0.65rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  box-shadow: 0 2px 12px rgba(17,42,71,0.25);
}
.tab-restricted-pill:hover:not(:disabled) { opacity: 0.88; }
.tab-restricted-pill.pending {
  background: #C8902E;
  cursor: default;
}
.tab-restricted-sub {
  font-size: 0.82rem;
  color: #64748b;
  max-width: 300px;
  text-align: center;
  line-height: 1.5;
}

/* My Classroom tab action pills */
.mycls-pill-incident,
.mycls-pill-report {
  border: none;
  border-radius: 100px;
  padding: 0.55rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.mycls-pill-incident {
  background: #dc2626;
  color: #fff;
}
.mycls-pill-incident:hover { opacity: 0.85; }
.mycls-pill-report {
  background: #112A47;
  color: #fff;
}
.mycls-pill-report:hover { opacity: 0.85; }

/* ===== CLICKABLE DASHBOARD STAT CARDS ===== */
.stat-card.stat-clickable {
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}
.stat-card.stat-clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 24px -10px rgba(0,0,0,0.18);
}
.stat-card.stat-clickable::after {
  content: '→';
  position: absolute;
  right: 0.85rem;
  bottom: 0.85rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.stat-card.stat-clickable:hover::after {
  opacity: 0.7;
  transform: translateX(3px);
}

/* ===== ADMIN EXPORT CENTER ===== */
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.65rem;
}
.export-option {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.export-option:hover { border-color: var(--primary-light); background: var(--bg); }
.export-option input[type="checkbox"] {
  width: 18px; height: 18px;
  flex-shrink: 0; margin-top: 2px;
  cursor: pointer;
  accent-color: var(--primary);
}
.export-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.export-icon { font-size: 1.5rem; flex-shrink: 0; }
.export-text { flex: 1; min-width: 0; }
.export-label { font-weight: 700; font-size: 0.95rem; line-height: 1.2; }
.export-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; line-height: 1.3; }

/* ===== DELETED CASES (admin-only) ===== */
.deleted-cases-section {
  margin-top: 2rem;
  padding: 0;
  background: var(--surface);
  border: 1.5px dashed var(--border-dark);
  border-radius: var(--radius);
}
.deleted-cases-section summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 700;
  color: var(--text);
  user-select: none;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.deleted-cases-section summary::-webkit-details-marker { display: none; }
.deleted-cases-section summary:hover { background: var(--bg); }
.deleted-cases-hint {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.deleted-cases-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 0.5rem 1.1rem 1.1rem;
}
.case-card.case-card-deleted {
  opacity: 0.78;
  border-style: dashed;
  border-color: var(--border-dark);
  background: var(--bg);
  filter: grayscale(0.3);
}
.case-card.case-card-deleted:hover { opacity: 1; }
.deleted-pill {
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: auto;
}

/* =====================================================
   LearnU eCourses — catalog + course landing + lesson player
   ===================================================== */

/* Guest mode + student mode: tighten the chrome */
body.guest-mode .sidebar-nav .nav-group-header { display: none; }
body.guest-mode .feedback-btn { display: none; }
body.student-mode .feedback-btn { display: none; }

/* Lesson immersive mode: hide sidebar, full-bleed */
body.learnu-lesson-mode .sidebar { display: none; }
body.learnu-lesson-mode .main-content { margin-left: 0; }
body.learnu-lesson-mode .page-container { padding: 0; max-width: none; }
body.learnu-lesson-mode .mobile-header { display: none; }

/* ===== CATALOG HERO ===== */
.learnu-hero {
  position: relative;
  padding: 3rem 2rem 2.5rem;
  margin-bottom: 2rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(135deg, #FEF9E7 0%, #FCE7C0 100%);
}
.learnu-hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.5) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(217,119,6,0.15) 0%, transparent 50%);
}
.learnu-hero-content { position: relative; }
.learnu-eyebrow {
  font-size: 0.78rem; font-weight: 800; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 0.6rem;
}
.learnu-hero-title {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 900; line-height: 1.05;
  color: var(--text); letter-spacing: -0.02em;
  margin: 0; max-width: 18ch;
}
.learnu-hero-title .word { display: inline-block; margin-right: 0.25em; }
.learnu-hero-sub {
  margin-top: 0.85rem; font-size: 1.05rem; color: var(--text-muted);
  max-width: 540px;
}

/* ===== CATEGORY FILTER CHIPS ===== */
.learnu-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.learnu-chip {
  padding: 0.45rem 1rem; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text); font-weight: 600; font-size: 0.85rem;
  cursor: pointer; transition: all 0.2s ease; font-family: inherit;
}
.learnu-chip:hover { transform: translateY(-1px); border-color: var(--primary); }
.learnu-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== COURSE GRID + CARD ===== */
.learnu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.learnu-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid var(--border);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.learnu-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 32px -12px rgba(0,0,0,0.18);
  border-color: var(--primary-light);
}
.learnu-card-cover {
  position: relative; height: 140px;
  background: linear-gradient(135deg, #FEF9E7 0%, #FCE7C0 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.learnu-card-cover-deco {
  font-size: 6rem; font-weight: 900; opacity: 0.18;
  font-family: 'Inter', sans-serif; user-select: none;
}
.learnu-card-cat {
  position: absolute; top: 0.85rem; left: 0.85rem;
  background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
  padding: 0.25rem 0.7rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--primary);
}
.learnu-card-body { padding: 1.1rem 1.25rem 1.25rem; display: flex; flex-direction: column; flex: 1; gap: 0.5rem; }
.learnu-card-meta { font-size: 0.74rem; color: var(--text-muted); letter-spacing: 0.4px; text-transform: uppercase; font-weight: 700; }
.learnu-card-title { font-size: 1.2rem; font-weight: 800; color: var(--text); line-height: 1.2; margin: 0.2rem 0 0; }
.learnu-card-desc { color: var(--text-muted); font-size: 0.875rem; line-height: 1.4; flex: 1; }
.learnu-card-partners { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.learnu-partner-pill {
  background: var(--bg); color: var(--text-muted);
  padding: 0.2rem 0.6rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600;
}
.learnu-card-start {
  font-weight: 800; color: var(--primary); font-size: 0.9rem;
  margin-top: 0.4rem;
}
.learnu-card-progress { margin-top: 0.4rem; }
.learnu-card-progress-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; font-weight: 600; }
.learnu-progress-track {
  width: 100%; height: 6px; background: var(--bg);
  border-radius: 999px; overflow: hidden;
}
.learnu-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--success) 0%, var(--primary) 100%);
  border-radius: 999px; transition: width 0.5s ease;
}

/* ===== COURSE LANDING ===== */
.learnu-course-hero {
  padding: 3rem 2rem 2.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  position: relative;
}
.learnu-back {
  background: rgba(255,255,255,0.6); backdrop-filter: blur(8px);
  border: 1.5px solid var(--border-dark); border-radius: 999px;
  padding: 0.35rem 0.85rem; font-size: 0.85rem; font-weight: 600;
  color: var(--text); cursor: pointer; margin-bottom: 1rem;
  font-family: inherit; transition: var(--transition);
}
.learnu-back:hover { background: var(--surface); transform: translateX(-2px); }
.learnu-course-title {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 900;
  line-height: 1.05; letter-spacing: -0.02em;
  margin: 0.5rem 0; max-width: 20ch;
}
.learnu-course-desc { font-size: 1.05rem; color: var(--text-muted); max-width: 640px; line-height: 1.5; }
.learnu-course-body { padding: 0 0.25rem; }
.learnu-section-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 1rem; }
.learnu-lesson-list { display: flex; flex-direction: column; gap: 0.65rem; }
.learnu-lesson-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.2s ease;
}
.learnu-lesson-row:hover {
  border-color: var(--primary-light);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}
.learnu-lesson-num {
  font-weight: 900; font-size: 1.4rem;
  color: var(--accent); min-width: 2.5rem;
  font-variant-numeric: tabular-nums;
}
.learnu-lesson-name { font-weight: 700; font-size: 1rem; color: var(--text); }
.learnu-lesson-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.learnu-lesson-arrow { font-size: 1.3rem; color: var(--text-muted); flex-shrink: 0; transition: transform 0.2s; }
.learnu-lesson-row:hover .learnu-lesson-arrow { transform: translateX(4px); color: var(--primary); }

/* ===== LESSON PLAYER ===== */
.learnu-lesson { min-height: 100vh; display: flex; flex-direction: column; }
.learnu-lesson-bar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: rgba(255,255,255,0.7); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.learnu-exit {
  background: transparent; border: none; font-weight: 700; color: var(--text);
  cursor: pointer; font-family: inherit; padding: 0.3rem 0.6rem; border-radius: 6px;
  transition: var(--transition);
}
.learnu-exit:hover { background: var(--bg); }
.learnu-lesson-context { flex: 1; min-width: 0; }
.learnu-course-name { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.learnu-lesson-name-bar { font-weight: 800; font-size: 0.95rem; color: var(--text); margin-top: 0.1rem; }
.learnu-lesson-progress { width: 200px; max-width: 30%; }
.learnu-guest-banner {
  padding: 0.6rem 1.5rem; background: var(--warning-soft);
  color: var(--warning); font-size: 0.85rem;
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem;
  border-bottom: 1px solid #fde68a;
}
.learnu-stage {
  flex: 1; max-width: 800px; margin: 0 auto; width: 100%;
  padding: 3rem 1.5rem 2rem; display: flex; align-items: center; justify-content: center;
}
.learnu-controls {
  display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.7); backdrop-filter: blur(12px);
  position: sticky; bottom: 0; z-index: 50;
}
.learnu-counter { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.learnu-controls .btn-primary, .learnu-controls .btn-secondary { padding: 0.55rem 1.4rem; }

/* ===== BLOCK BASE ===== */
.block { width: 100%; max-width: 720px; }

/* HERO block */
.block-hero { text-align: center; padding: 1rem; }
.block-hero .hero-eyebrow {
  font-size: 0.85rem; font-weight: 800; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 1rem;
}
.block-hero .hero-title {
  font-size: clamp(2rem, 6vw, 4rem); font-weight: 900;
  line-height: 1.05; letter-spacing: -0.03em; margin: 0;
}
.block-hero .hero-word { display: inline-block; margin-right: 0.2em; }
.block-hero .hero-subtitle {
  margin-top: 1.25rem; font-size: 1.2rem; color: var(--text-muted);
}

/* CONCEPT block */
.block-concept .concept-headline {
  font-size: clamp(1.6rem, 4vw, 2.5rem); font-weight: 900;
  letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 1rem;
}
.block-concept .concept-body { font-size: 1.1rem; color: var(--text); line-height: 1.55; margin-bottom: 1.25rem; }
.block-concept .concept-bullets { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.block-concept .concept-bullets li {
  position: relative; padding: 0.65rem 1rem 0.65rem 2.25rem;
  background: rgba(255,255,255,0.5); border-radius: var(--radius-sm);
  font-size: 1rem; line-height: 1.4; font-weight: 500;
}
.block-concept .concept-bullets li::before {
  content: '→'; position: absolute; left: 1rem; color: var(--accent); font-weight: 900;
}

/* COMPARISON block */
.block-comparison {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.5rem;
  align-items: stretch;
}
.cmp-col { background: rgba(255,255,255,0.6); padding: 1.5rem; border-radius: var(--radius); }
.cmp-col h3 {
  font-size: 1.4rem; font-weight: 900; margin: 0 0 0.85rem;
  letter-spacing: -0.01em;
}
.cmp-col ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.cmp-col li { padding: 0.5rem 0.75rem; background: #fff; border-radius: 6px; font-size: 0.95rem; }
.cmp-left h3 { color: var(--success); }
.cmp-right h3 { color: var(--primary); }
.cmp-vs {
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.6rem; color: var(--accent);
  font-family: 'Inter', sans-serif;
}

/* SCENARIO block */
.block-scenario .scenario-eyebrow {
  font-size: 0.78rem; font-weight: 800; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.65rem;
}
.block-scenario .scenario-question {
  font-size: clamp(1.4rem, 3.5vw, 2rem); font-weight: 800;
  letter-spacing: -0.01em; line-height: 1.25; margin: 0 0 1.5rem;
}
.scenario-options { display: flex; flex-direction: column; gap: 0.65rem; }
.scenario-option {
  text-align: left; padding: 1rem 1.25rem;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer; font-family: inherit;
  font-size: 1rem; font-weight: 600; color: var(--text);
  transition: all 0.2s ease;
}
.scenario-option:hover:not(:disabled) {
  border-color: var(--primary); transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}
.scenario-option.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.scenario-option:disabled { cursor: default; opacity: 0.6; }
.scenario-option.selected { opacity: 1; }
.scenario-feedback {
  margin-top: 1.5rem; padding: 1.25rem 1.4rem;
  background: var(--success-soft); border-left: 4px solid var(--success);
  border-radius: var(--radius-sm);
}
.scenario-feedback-label {
  font-size: 0.75rem; font-weight: 800; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--success); margin-bottom: 0.4rem;
}
.scenario-feedback p { margin: 0; line-height: 1.5; color: var(--text); }

/* QUIZ block */
.block-quiz .quiz-eyebrow {
  font-size: 0.78rem; font-weight: 800; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.65rem;
}
.block-quiz .quiz-question {
  font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 800;
  margin: 0 0 1.25rem; line-height: 1.3;
}
.quiz-choices { display: flex; flex-direction: column; gap: 0.55rem; }
.quiz-choice {
  display: flex; align-items: center; gap: 0.85rem;
  text-align: left; padding: 0.85rem 1.1rem;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer; font-family: inherit;
  font-size: 0.95rem; font-weight: 600; color: var(--text);
  transition: all 0.2s ease;
}
.quiz-choice:hover:not(:disabled) { border-color: var(--primary); transform: translateX(2px); }
.quiz-choice-letter {
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--bg); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; flex-shrink: 0;
}
.quiz-choice.correct { background: var(--success-soft); border-color: var(--success); }
.quiz-choice.correct .quiz-choice-letter { background: var(--success); color: #fff; }
.quiz-choice.incorrect { background: var(--danger-soft); border-color: var(--danger); }
.quiz-choice.incorrect .quiz-choice-letter { background: var(--danger); color: #fff; }
.quiz-choice.shows-correct:not(.correct) { background: var(--success-soft); border-color: var(--success); opacity: 0.7; }
.quiz-feedback {
  margin-top: 1.25rem; padding: 1rem 1.25rem;
  border-radius: var(--radius-sm); border-left: 4px solid var(--success);
  background: var(--success-soft);
}
.quiz-feedback.wrong { background: var(--danger-soft); border-color: var(--danger); }
.quiz-feedback-badge {
  font-weight: 800; font-size: 0.85rem; margin-bottom: 0.35rem;
  color: var(--success);
}
.quiz-feedback.wrong .quiz-feedback-badge { color: var(--danger); }
.quiz-feedback p { margin: 0; line-height: 1.5; }

/* REFLECTION block */
.block-reflection .reflection-eyebrow {
  font-size: 0.78rem; font-weight: 800; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.65rem;
}
.block-reflection .reflection-prompt {
  font-size: clamp(1.4rem, 3.5vw, 2rem); font-weight: 800;
  letter-spacing: -0.01em; line-height: 1.3; margin: 0 0 1.25rem;
}
.reflection-input {
  width: 100%; min-height: 160px; padding: 1rem 1.25rem;
  border: 2px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 1rem; resize: vertical;
  line-height: 1.5; background: var(--surface);
  transition: border-color 0.2s;
}
.reflection-input:focus { outline: none; border-color: var(--primary); }
.reflection-hint { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.5rem; }

/* CERTIFICATE block */
.block-certificate { text-align: center; padding: 1rem; }
.cert-card {
  position: relative; padding: 3rem 2rem 2.5rem;
  background: linear-gradient(180deg, #FFFEF7 0%, #FEF9E7 100%);
  border: 3px solid #d97706; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: 640px; margin: 0 auto;
}
.cert-laurel-left, .cert-laurel-right {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 4rem; color: #d97706; opacity: 0.45;
}
.cert-laurel-left { left: 1rem; }
.cert-laurel-right { right: 1rem; }
.cert-eyebrow {
  font-size: 0.85rem; font-weight: 800; letter-spacing: 3px;
  text-transform: uppercase; color: #d97706; margin-bottom: 1.25rem;
}
.cert-name {
  font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 900;
  letter-spacing: -0.02em; color: var(--text); margin: 0.4rem 0;
}
.cert-text { font-size: 0.95rem; color: var(--text-muted); margin: 0.5rem 0; }
.cert-course {
  font-size: clamp(1.4rem, 3.5vw, 1.9rem); font-weight: 800;
  color: var(--primary); margin: 0.5rem 0;
}
.cert-date { font-size: 0.9rem; color: var(--text-muted); margin-top: 1rem; }
.cert-issuer { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.85rem; font-weight: 600; letter-spacing: 1px; }
.cert-cta { margin-top: 1.5rem; }

/* Mobile adjustments for lesson player */
@media (max-width: 767px) {
  .learnu-hero { padding: 2rem 1.25rem; }
  .learnu-course-hero { padding: 2rem 1.25rem; }
  .learnu-stage { padding: 2rem 1rem 1.5rem; }
  .learnu-controls { padding: 0.85rem 1rem; gap: 0.5rem; }
  .learnu-lesson-progress { display: none; }
  .block-comparison { grid-template-columns: 1fr; }
  .cmp-vs { padding: 0.5rem 0; transform: rotate(90deg); }
  .cert-laurel-left, .cert-laurel-right { display: none; }
}

/* ===== SIDEBAR NAV GROUPS (collapsible) ===== */
.nav-group {
  margin: 0.45rem 0 0.1rem;
}
.nav-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.85rem 0.3rem;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
}
.nav-group-header:hover { color: rgba(255,255,255,0.85); }
.nav-group-chevron {
  font-size: 0.55rem;
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.nav-group.collapsed .nav-group-chevron { transform: rotate(-90deg); }

.nav-group-items {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.25s ease;
}
.nav-group.collapsed .nav-group-items { max-height: 0; }

/* When sidebar is in icon-only collapsed mode, group headers hide and
   all items show as a flat list (with tooltips on hover) */
.sidebar.collapsed .nav-group-header { display: none; }
.sidebar.collapsed .nav-group-items { max-height: none !important; }
.sidebar.collapsed .nav-group { margin: 0; }

/* ===== FAMILY MEMBERS ===== */
.fam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.fam-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: box-shadow 0.15s;
}
.fam-card:hover { box-shadow: var(--shadow-md); }
.fam-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.fam-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-dark);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.fam-avatar.linked {
  background: var(--primary-soft);
  border-color: var(--primary-light);
  color: var(--primary);
}
.fam-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fam-rel-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 20px;
  margin-top: 0.2rem;
  letter-spacing: 0.2px;
}
.fam-remove-btn {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 0.9rem; padding: 0.1rem 0.3rem;
  border-radius: 4px;
  transition: var(--transition);
  flex-shrink: 0;
}
.fam-remove-btn:hover { background: var(--danger-soft); color: var(--danger); }
.fam-notes {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.35rem 0.65rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--border-dark);
}
.fam-contact {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.fam-stats {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.fam-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  flex: 1;
  min-width: 0;
}
.fam-stat-num   { font-weight: 800; font-size: 1.1rem; color: var(--primary); line-height: 1; }
.fam-stat-label { font-size: 0.68rem; color: var(--text-muted); text-align: center; margin-top: 0.15rem; white-space: nowrap; }
.fam-no-profile {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.65rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-dark);
}
.fam-card-body { flex: 1; }
.fam-card-footer {
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
  margin-top: 0.1rem;
}
.fam-search-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}
.fam-search-row:hover { background: var(--bg); }

/* Family suggestions */
.fam-suggestions-section {
  background: var(--primary-soft);
  border: 1px solid var(--primary-border, rgba(29,94,107,0.2));
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.fam-suggestions-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 0.75rem;
}
.fam-suggestion-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.fam-suggestion-card:last-child { border-bottom: none; }
.fam-suggestion-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.fam-suggestion-info { flex: 1; min-width: 0; }
.fam-suggestion-name { font-weight: 700; font-size: 0.9rem; }
.fam-suggestion-addr { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.fam-sugg-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-top: 0.25rem;
}
.fam-sugg-badge--fuzzy   { background: #fef3c7; color: #92400e; }
.fam-sugg-badge--possible { background: #fee2e2; color: #991b1b; }
.fam-suggestion-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.fam-suggestion-notice {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.75rem 0;
  margin-bottom: 1rem;
}
.fam-addr-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
  margin-left: 0.3rem;
}

/* ===== MENTION DROPDOWN ===== */
.mention-dropdown {
  position: fixed;
  z-index: 10000;
  background: var(--surface);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
  display: none;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  transition: background 0.12s;
}
.mention-item:hover { background: var(--bg); }
.mention-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.7rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mention-name { font-weight: 600; font-size: 0.875rem; line-height: 1.2; }
.mention-sub  { font-size: 0.75rem; color: var(--text-muted); }
.mention-highlight {
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-soft);
  border-radius: 3px;
  padding: 0 2px;
}

/* @ button in chat input bar */
.chat-at-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 0.5rem;
  height: 36px;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.chat-at-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ===== TAKEOVER WIDGETS ===== */
.takeover-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.takeover-item:last-child { border-bottom: none; }
.takeover-case-info .case-ref  { font-weight: 700; font-size: 0.875rem; color: var(--primary); }
.takeover-case-info .case-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.takeover-actions { display: flex; gap: 0.4rem; flex-shrink: 0; align-items: center; }

/* =====================================================
   RESPONSIVE TIERS — 3 breakpoints
   - Desktop ultra-wide (>=1600px) : center with max-width
   - Desktop (1281–1599px)         : full bleed, default
   - Laptop  (1025–1280px)         : default
   - Tablet  (768–1024px)          : compact 2-col, smaller padding
   - Mobile  (<768px)              : 1-col, hamburger, fullscreen modals
   ===================================================== */

/* ===== GLOBAL OVERFLOW GUARD ===== */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
  overscroll-behavior-x: none;
}
img, video { max-width: 100%; height: auto; }
/* Tables: containment wrapper makes them scroll internally */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; width: 100%; }
/* Flex/grid children never force parent wider */
.flex-row, .form-grid, .page-header-actions, .stats-grid { min-width: 0; }

/* ===== MOBILE SIDEBAR CLOSE BUTTON ===== */
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  margin-left: auto;
  line-height: 1;
  transition: background 0.15s;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ===== DESKTOP ULTRA-WIDE: nothing extra — page fills full content area ===== */

/* ===== TABLET: 768–1024px ===== */
@media (max-width: 1024px) and (min-width: 768px) {
  .page-container { padding: 1.5rem 1.5rem; }
  .page-header-left h1 { font-size: 1.45rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .dashboard-layout { grid-template-columns: 1fr; gap: 1.25rem; }
  .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .profile-meta-grid { grid-template-columns: repeat(2, 1fr); }
  .cases-grid { grid-template-columns: repeat(2, 1fr); }
  .fam-grid   { grid-template-columns: repeat(2, 1fr); }
  .chat-shell { grid-template-columns: 220px 1fr; }
  .events-panel { position: static; }

  /* Dashboard tablet layout: Search full width, then Inbox + Takeover, then pending, stats, then 3 stacked */
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "search    search"
      "inbox     takeover"
      "week      week"
      "pending   pending"
      "stats     stats"
      "mycases   mycases"
      "cases     cases"
      "events    events";
  }
}

/* ===== MOBILE: <768px ===== */
@media (max-width: 767px) {
  /* ── Sidebar: slide-in overlay ── */
  .sidebar { transform: translateX(-100%); width: 85%; max-width: 300px; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.35); }
  .sidebar.collapsed { width: 85%; max-width: 300px; }
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .user-info { display: inline; }
  .sidebar.collapsed ~ .main-content { margin-left: 0; }

  /* ── Sticky sidebar header with X button ── */
  .sidebar-brand {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--primary);
    padding-right: 0.6rem;
    margin-bottom: 0;
  }
  .sidebar-collapse-btn { display: none; }
  .sidebar-close-btn { display: flex; }

  /* ── Main content: becomes sole scroll container on mobile ── */
  .main-content {
    display: block;           /* override desktop flex */
    margin-left: 0;
    margin-top: var(--header-h);
    padding-top: 0;
    min-height: unset;        /* override desktop min-height: 100vh */
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));  /* dynamic viewport (iOS address bar aware) */
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain none;       /* allow vertical, block horizontal */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;                     /* OS-level: vertical pan only */
  }
  .mobile-header { display: flex; }

  /* Page chrome */
  .page-container { padding: 0.85rem 0.75rem; }
  .page-header { flex-direction: column; align-items: stretch; gap: 0.75rem; margin-bottom: 1.25rem; }
  .page-header-left h1 { font-size: 1.3rem; }
  .page-header-left p { font-size: 0.82rem; }
  .page-header-actions { width: 100%; flex-direction: column; }
  .page-header-actions > *:not(.back-btn) { width: 100%; justify-content: center; }

  /* Stats: 2 columns up to 420px, then 1 */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; margin-bottom: 1.25rem; }
  .stat-card { padding: 0.85rem 0.95rem; }
  .stat-value { font-size: 1.4rem; }
  .stat-card-icon { font-size: 1.3rem; }
  .stat-label { font-size: 0.68rem; }

  /* Layouts collapse */
  .dashboard-layout { grid-template-columns: 1fr; gap: 1rem; }

  /* Dashboard mobile order: Search → Stats → Inbox → Takeover → Week → Pending → MyCases → Active Cases → Events */
  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "search"
      "stats"
      "inbox"
      "takeover"
      "week"
      "pending"
      "mycases"
      "cases"
      "events";
    gap: 1rem;
  }
  .form-grid,
  .form-grid.cols-2,
  .form-grid.cols-3,
  .form-grid.cols-4 { grid-template-columns: 1fr; gap: 0.6rem; }
  .cases-grid, .fam-grid { grid-template-columns: 1fr; }
  .profile-meta-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .profile-hero { padding: 1.1rem 1rem; }
  .profile-hero-top { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .profile-name { font-size: 1.15rem; }
  .profile-avatar-large { width: 46px; height: 46px; font-size: 0.9rem; }
  .profile-sub { font-size: 0.8rem; word-break: break-all; }

  /* Tabs scroll horizontally instead of wrapping */
  .tab-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.82rem;
    padding: 0.55rem 0.85rem;
  }

  /* Cards & sections: smaller padding */
  .card { padding: 1rem; }
  .section-body { padding: 1rem; }
  .section-header { padding: 0.65rem 1rem; font-size: 0.85rem; }

  /* Chat: fullscreen layout */
  .chat-shell {
    grid-template-columns: 1fr;
    height: calc(100vh - var(--header-h) - 1.5rem);
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }
  .chat-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 35vh;
    overflow-y: auto;
  }
  .chat-input { font-size: 0.95rem; }

  /* Modals: full screen */
  .modal-card {
    width: 95vw;
    max-width: 95vw;
    max-height: 92vh;
    padding: 1.25rem 1rem;
    overflow-y: auto;
  }
  .modal-large, .modal-xl { width: 95vw; max-width: 95vw; }

  /* Tables: scroll inside card, never overflow page */
  .card table, .section-body table {
    font-size: 0.78rem;
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }

  /* Hard width clamp on all block containers */
  .card, .section-body, .form-grid, .stats-grid, .dashboard-grid, .page-header,
  .page-container, .modal-card { max-width: 100%; overflow-x: hidden; box-sizing: border-box; }

  /* Word-wrap everywhere — no text can push layout wider */
  p, span, h1, h2, h3, h4, label, td, th, li, a {
    word-break: break-word;
    overflow-wrap: break-word;
  }
  /* Long URLs / emails / codes */
  .profile-sub, .case-row-value, .card-subtitle { word-break: break-all; }

  /* Family / donor cards inside grids */
  .fam-card { padding: 0.9rem 1rem; }

  /* Appointment rows: stack vertically */
  .appt-dash-card { flex-wrap: wrap; }
}

/* ===== EXTRA SMALL: <420px ===== */
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .profile-meta-grid { grid-template-columns: 1fr; }
  .page-container { padding: 0.6rem 0.6rem; }
  .modal-card { padding: 1rem 0.85rem; }
  .page-header-left h1 { font-size: 1.15rem; }
}

/* ===== CASE TEAM ===== */
.team-member-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.45rem;
}
.team-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}
.team-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.team-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.team-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== CHAT MY CASES PANEL ===== */
.chat-section-divider {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 0.65rem 0.9rem 0.3rem;
  border-top: 1px solid var(--border);
  margin-top: 0.35rem;
}
.chat-case-item {
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  border-radius: 6px;
  margin: 0.1rem 0.35rem;
  transition: background 0.15s;
}
.chat-case-item:hover { background: var(--bg); }
.chat-case-badge {
  font-size: 0.67rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}
.chat-case-badge.active    { background: #d1fae5; color: #065f46; }
.chat-case-badge.pending   { background: #fef3c7; color: #92400e; }
.chat-case-badge.on-hold   { background: #fee2e2; color: #991b1b; }
.chat-case-badge.completed,
.chat-case-badge.closed    { background: #f1f5f9; color: var(--text-muted); }

/* ===== PROGRAM PLANNING / ACTIVITIES ===== */
.activity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.activity-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.activity-status-confirmed { border-left: 3px solid #1e40af; }
.activity-status-draft      { border-left: 3px solid #94a3b8; }
.activity-status-completed  { border-left: 3px solid #059669; }
.activity-status-cancelled  { border-left: 3px solid #ef4444; }

/* ===== CLASSROOM CARD ===== */
.classroom-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.classroom-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(30,58,95,0.1);
  transform: translateY(-2px);
}

/* ===== ATTENDANCE TOGGLE BUTTONS ===== */
.att-toggle {
  min-width: 115px;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: center;
}
.att-toggle:hover { border-color: var(--border-dark); background: var(--bg); }
.att-toggle[data-status="Present"] { background: #dcfce7; border-color: #22c55e; color: #15803d; }
.att-toggle[data-status="Present"]:hover { background: #bbf7d0; }
.att-toggle[data-status="Absent"]  { background: #fee2e2; border-color: #ef4444; color: #dc2626; }
.att-toggle[data-status="Absent"]:hover  { background: #fecaca; }

/* ── Attendance toggle switch (binary present/absent) ── */
.att-switch { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }
.att-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.att-switch-slider {
  display: inline-block; width: 44px; height: 24px;
  background: #d1d5db; border-radius: 12px; cursor: pointer;
  transition: background 0.18s; position: relative;
}
.att-switch-slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: left 0.18s;
}
.att-switch input:checked + .att-switch-slider { background: #22c55e; }
.att-switch input:checked + .att-switch-slider::after { left: 22px; }
.att-switch input:disabled + .att-switch-slider { opacity: 0.5; cursor: not-allowed; }

.att-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1rem; background: var(--surface);
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.att-row + .att-row { border-top: 1px solid var(--border); }
.att-row.is-present { background: #f0fdf4; border-left-color: #22c55e; }

/* Absent/Present pill */
.att-pill {
  width: 90px; padding: 0.32rem 0; flex-shrink: 0; text-align: center;
  border: none; border-radius: 20px; cursor: pointer;
  font-weight: 700; font-size: 0.78rem; letter-spacing: 0.02em;
  color: #fff; transition: background 0.15s, transform 0.08s;
}
.att-pill:active { transform: scale(0.96); }
.att-pill-absent  { background: #ef4444; }
.att-pill-present { background: #22c55e; }

.att-search {
  flex: 1;
  min-width: 160px;
  padding: 0.38rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.att-search:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }

.att-mark-all-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.att-mark-all-btn:hover { background: var(--bg); }
.att-mark-all-btn[data-state="present"] { border-color: #22c55e; color: #15803d; background: #f0fdf4; }
.att-mark-all-btn[data-state="absent"]  { border-color: #ef4444; color: #dc2626; background: #fff5f5; }
.att-mark-all-btn[data-state="clear"]   { border-color: var(--text-muted); color: var(--text-muted); background: var(--bg); }

/* ===== CURRICULUM TAB ===== */

.curr-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.curr-quarter-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Curriculum List/Calendar controls row */
.curr-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.curr-view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.curr-view-btn {
  padding: 0.4rem 0.9rem; background: var(--surface); color: var(--text-muted);
  border: none; font-size: 0.82rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.curr-view-btn + .curr-view-btn { border-left: 1px solid var(--border); }
.curr-view-btn.active { background: #112A47; color: #fff; }

/* Month-grid calendar */
.curr-cal { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.curr-cal-header {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 1.5rem;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
}
.curr-cal-title { font-size: 1.05rem; font-weight: 800; color: var(--primary); min-width: 190px; text-align: center; }
.curr-cal-nav {
  width: 32px; height: 32px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; font-size: 1.1rem; cursor: pointer; color: var(--text); line-height: 1;
}
.curr-cal-nav:hover { background: var(--bg); }
.curr-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.curr-cal-dowrow { background: var(--bg); border-bottom: 1px solid var(--border); }
.curr-cal-dowcell { padding: 0.4rem; text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.curr-cal-cell {
  min-height: 92px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 3px 4px 5px; position: relative; overflow: hidden;
}
.curr-cal-grid > .curr-cal-cell:nth-child(7n) { border-right: none; }
.curr-cal-out { background: #f8fafc; }
.curr-cal-out .curr-cal-daynum { color: #cbd5e1; }
.curr-cal-today { background: #eff6ff; }
.curr-cal-today .curr-cal-daynum { color: #2563eb; font-weight: 800; }
.curr-cal-daynum { font-size: 0.75rem; color: var(--text-muted); text-align: right; padding: 0 2px; font-weight: 600; }
.curr-cal-skip { font-size: 0.68rem; color: #94a3b8; font-style: italic; margin-top: 4px; padding: 0 2px; }
.curr-cal-event {
  position: relative; display: block; width: 100%; text-align: left; margin-top: 2px; padding: 3px 5px;
  background: var(--bg); border: none; border-left: 3px solid #64748b; border-radius: 3px;
  cursor: default; font-family: inherit; overflow: hidden;
}
.curr-cal-event:hover { background: #e8eef6; }
.curr-cal-edit-btn {
  position: absolute; top: 2px; right: 2px; background: none; border: none; cursor: pointer;
  font-size: 0.7rem; padding: 1px 3px; border-radius: 3px; opacity: 0; transition: opacity 0.15s;
}
.curr-cal-event:hover .curr-cal-edit-btn { opacity: 1; }
.curr-cal-edit-btn:hover { background: rgba(0,0,0,0.08); }
.curr-cal-ev-title { font-size: 0.72rem; font-weight: 700; color: var(--text); line-height: 1.25; display: flex; align-items: center; gap: 3px; }
.curr-cal-ev-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.curr-cal-ev-sub { font-size: 0.68rem; color: var(--text-muted); line-height: 1.2; margin-top: 1px; }
.curr-cal-ev-flag { font-size: 0.64rem; font-weight: 700; color: #b45309; line-height: 1.2; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.02em; }
@media (max-width: 640px) {
  .curr-cal-cell { min-height: 64px; }
  .curr-cal-ev-sub, .curr-cal-ev-flag { display: none; }
}
.curr-q-pill {
  padding: 0.35rem 1rem;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.curr-q-pill.active {
  background: #112A47;
  border-color: #112A47;
  color: #fff;
}
.curr-q-pill:hover:not(.active) {
  border-color: #112A47;
  color: #112A47;
}

.curr-session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.curr-session-card:hover { box-shadow: var(--shadow); }
.curr-session-card.curr-current { border-left: 4px solid #C8902E; }
.curr-session-card.curr-past    { border-left: 4px solid #22c55e; opacity: 0.88; }

.curr-card-header {
  background: #112A47;
  color: #fff;
  padding: 0.65rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.curr-session-meta {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
}
.curr-session-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

.curr-badge-current {
  background: #C8902E;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.curr-badge-done {
  background: #22c55e;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.curr-icon-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 0.8rem;
  padding: 0.18rem 0.4rem;
  cursor: pointer;
  transition: background 0.12s;
}
.curr-icon-btn:hover { background: rgba(255,255,255,0.25); }
.curr-delete-btn:hover { background: rgba(239,68,68,0.5); }

.curr-card-body {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.curr-field {
  display: flex;
  gap: 0.5rem;
  font-size: 0.875rem;
  align-items: flex-start;
}
.curr-field-label {
  font-weight: 700;
  color: var(--primary);
  min-width: 76px;
  flex-shrink: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 0.08rem;
}
.curr-field-val { color: var(--text); line-height: 1.45; }
.curr-notes .curr-field-val { color: var(--text-muted); font-style: italic; }

.curr-card-footer {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.curr-file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
  align-items: center;
}
.curr-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.22rem 0.6rem;
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  max-width: 220px;
  transition: border-color 0.12s;
}
.curr-file-chip:hover { border-color: var(--primary); }
.curr-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.curr-chip-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.curr-chip-del:hover { color: #ef4444; }
.curr-file-uploading {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}
.curr-upload-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
  padding: 0.22rem 0.65rem;
  border: 1.5px dashed var(--primary);
  border-radius: 20px;
  transition: background 0.12s;
  flex-shrink: 0;
}
.curr-upload-label:hover { background: var(--primary-soft); }

@media (max-width: 600px) {
  .curr-card-header   { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
  .curr-field         { flex-direction: column; gap: 0.1rem; }
  .curr-field-label   { min-width: unset; }
}

.curr-day-toggle {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  font-family: inherit;
  user-select: none;
}
.curr-day-toggle.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.curr-day-toggle:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== FOOD PANTRY ===== */

/* Stat row */
.fp-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.fp-stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-dark);
}
.fp-stat-card.fp-stat-accent { border-left-color: var(--primary); }
.fp-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.fp-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

/* Filter bar */
.fp-filter-bar {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.fp-filter-field { display: flex; flex-direction: column; }
.fp-filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

/* Card list */
.fp-list { display: flex; flex-direction: column; gap: 0.6rem; }
.fp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.fp-card:hover { box-shadow: var(--shadow); border-color: var(--border-dark); }
.fp-card-main  { flex: 1; min-width: 0; }
.fp-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.fp-client-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}
.fp-client-link:hover { text-decoration: underline; }
.fp-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.fp-meta-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}
.fp-meta-item {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.fp-card-actions { display: flex; align-items: center; flex-shrink: 0; }

/* Badges */
.fp-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.fp-badge-blue  { background: var(--info-soft);    color: var(--info);    }
.fp-badge-green { background: var(--success-soft); color: var(--success); }

/* Slide-in panel */
.fp-panel-backdrop {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease;
}
.fp-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 601;
  width: min(660px, 100vw);
  background: var(--surface);
  box-shadow: -8px 0 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.fp-panel.fp-panel-open { transform: translateX(0); }
.fp-panel-inner { display: flex; flex-direction: column; height: 100%; }
.fp-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.fp-panel-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.fp-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
}
.fp-panel-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

/* "Click cancel" hint */
.fp-close-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.35rem;
  background: var(--accent-light);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  flex-shrink: 0;
}

/* Section headings inside panel */
.fp-section-head,
.fp-sec-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 1.5rem 0 0.9rem;
}
.fp-section-head:first-child,
.fp-sec-head:first-child { margin-top: 0; }
.fp-sec-head-text {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.fp-sec-head-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* View panel fields */
.fp-view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.5rem;
  margin-bottom: 0.5rem;
}
.fp-view-field { margin-bottom: 0.6rem; }
.fp-view-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-light);
  margin-bottom: 0.15rem;
}
.fp-view-value { font-size: 0.9rem; color: var(--text); }
.fp-notes-box {
  font-size: 0.9rem;
  background: var(--bg);
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  margin-bottom: 0.5rem;
}

/* Items table (view) */
.fp-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.fp-items-table th {
  text-align: left;
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.fp-items-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.fp-items-table tr:last-child td { border-bottom: none; }

/* Items editor (intake/edit) */
.fp-items-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.fp-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}
.fp-item-remove {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
  line-height: 1;
  padding: 0;
}
.fp-item-remove:hover { border-color: #ef4444; color: #ef4444; }

/* Pickup/Delivery type toggle */
.fp-type-toggle {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.fp-toggle-opt {
  flex: 1;
  text-align: center;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  background: var(--surface);
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.fp-toggle-opt input[type=radio] { display: none; }
.fp-toggle-opt.active {
  background: var(--primary);
  color: #fff;
}
.fp-toggle-opt:not(:last-child) { border-right: 1.5px solid var(--border); }

/* Responsive */
@media (max-width: 640px) {
  .fp-stats-row { grid-template-columns: 1fr; gap: 0.6rem; }
  .fp-filter-bar { flex-direction: column; align-items: stretch; }
  .fp-card { flex-direction: column; align-items: flex-start; }
  .fp-card-actions { align-self: flex-end; }
  .fp-view-grid { grid-template-columns: 1fr; }
  .fp-panel { width: 100vw; }
  .fp-item-row { flex-wrap: wrap; }
  .fp-item-row .form-input { min-width: 0; }
}

/* ===== FOOD PANTRY REDESIGN ===== */

/* Card grids */
.fp-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 1100px) { .fp-card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .fp-card-grid { grid-template-columns: 1fr; } }

/* Client pickup card */
.fp-pickup-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: default;
}
.fp-pickup-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.10);
}
.fp-pickup-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.1rem;
}
.fp-pickup-date { font-size: 0.82rem; color: var(--text-muted); }
.fp-pickup-hh  { font-size: 0.82rem; color: var(--text-muted); }
.fp-items-text {
  font-size: 0.82rem;
  color: var(--text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.fp-items-text.expanded { display: block; -webkit-line-clamp: unset; overflow: visible; }
.fp-see-more {
  background: none; border: none; padding: 0;
  font-size: 0.78rem; color: var(--primary); cursor: pointer;
  font-weight: 600; text-decoration: underline;
}
.fp-income-badge {
  display: inline-block;
  font-size: 0.72rem; font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.fp-pickup-footer {
  font-size: 0.75rem; color: var(--text-light);
  margin-top: auto; padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}
.fp-pickup-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }

/* Partner collection card */
.fp-coll-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fp-coll-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.10); }
.fp-coll-header { display: flex; align-items: center; gap: 0.75rem; }
.fp-partner-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.fp-partner-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.fp-coll-date { font-size: 0.82rem; color: var(--text-muted); }
.fp-item-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.fp-item-chip {
  background: var(--primary-soft); color: var(--primary);
  font-size: 0.75rem; font-weight: 600;
  padding: 0.18rem 0.55rem; border-radius: 999px;
}
.fp-coll-notes { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }
.fp-coll-footer {
  font-size: 0.75rem; color: var(--text-light);
  padding-top: 0.5rem; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto;
}
.fp-coll-actions { display: flex; gap: 0.4rem; }

/* Premium stats row */
.fp-stats-row-2 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .fp-stats-row-2 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .fp-stats-row-2 { grid-template-columns: 1fr; } }
.fp-stat2-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.fp-stat2-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.fp-stat2-label {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin-bottom: 0.2rem;
}
.fp-stat2-value {
  font-size: 1.75rem; font-weight: 800;
  color: var(--text); line-height: 1;
}

/* Pill tab switcher */
.fp-tab-bar {
  display: flex;
  gap: 0.4rem;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  width: fit-content;
  margin-bottom: 1.25rem;
}
.fp-tab-btn {
  padding: 0.45rem 1.1rem;
  border-radius: 8px;
  font-size: 0.875rem; font-weight: 600;
  border: none; background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.fp-tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.fp-tab-count {
  display: inline-block;
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.72rem; font-weight: 700;
  padding: 0.05rem 0.45rem; border-radius: 999px;
  margin-left: 0.3rem;
}
.fp-tab-btn.active .fp-tab-count {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Filter toolbar */
.fp-toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1.1rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.fp-toolbar-search {
  position: relative;
  flex: 2; min-width: 160px;
}
.fp-toolbar-search input {
  padding-left: 2rem;
  width: 100%;
}
.fp-toolbar-search .fp-search-icon {
  position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.85rem; pointer-events: none;
}
.fp-clear-link {
  font-size: 0.8rem; color: var(--text-muted);
  background: none; border: none; cursor: pointer;
  text-decoration: underline; white-space: nowrap;
  align-self: flex-end; padding: 0.45rem 0;
}
.fp-clear-link:hover { color: var(--text); }

/* ===== DISTRIBUTION DAY ===== */

/* Third button - amber accent */
.fp-dist-event-btn {
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.fp-dist-event-btn:hover { background: #d97706; transform: translateY(-1px); }

/* Distribution event card */
.fp-event-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  border-top: 4px solid #f59e0b;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fp-event-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.10); }
.fp-event-loc { font-size: 1rem; font-weight: 700; color: var(--text); }
.fp-event-date { font-size: 0.82rem; color: var(--text-muted); }
.fp-event-notes { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }
.fp-event-footer {
  font-size: 0.75rem; color: var(--text-light);
  padding-top: 0.5rem; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto;
}

/* Geolocation UI */
.fp-geolocate-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.fp-geolocate-btn:hover { border-color: var(--primary); color: var(--primary); }
.fp-geo-status {
  font-size: 0.8rem; margin-top: 0.4rem; min-height: 1.1rem;
  color: var(--text-muted);
}
.fp-geo-error   { color: #ef4444; }
.fp-geo-loading { color: var(--text-muted); }
.fp-geo-success { color: #22c55e; }
.fp-geo-warn    { color: #f59e0b; }

/* Smart item builder */
.fp-dist-item-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.fp-dir-top {
  display: flex; gap: 0.5rem; align-items: center;
}
.fp-dir-top .fp-dir-name { flex: 1; }
.fp-remove-dir {
  background: none; border: 1.5px solid var(--border);
  border-radius: 6px; width: 32px; height: 32px;
  cursor: pointer; font-size: 0.85rem; color: var(--text-muted);
  flex-shrink: 0; transition: border-color 0.15s, color 0.15s;
}
.fp-remove-dir:hover { border-color: #ef4444; color: #ef4444; }
.fp-dir-pkg-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.fp-dir-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.fp-pkg-pill {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; color: var(--text-muted);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.fp-pkg-pill.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.fp-meas-toggle {
  display: flex; gap: 0.35rem; margin-bottom: 0.45rem;
}
.fp-meas-btn {
  padding: 0.22rem 0.7rem;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; color: var(--text-muted);
  transition: all 0.12s;
}
.fp-meas-btn.active {
  border-color: #f59e0b; background: #fef3c7; color: #92400e;
}
.fp-meas-weight, .fp-meas-qty {
  display: flex; gap: 0.5rem;
}
.fp-meas-weight input, .fp-meas-qty input { flex: 2; }
.fp-meas-weight select, .fp-meas-qty select { flex: 1; }
.fp-add-dist-item {
  background: none; border: 1.5px dashed var(--border);
  border-radius: 8px; padding: 0.5rem 1rem;
  font-size: 0.85rem; color: var(--text-muted);
  cursor: pointer; width: 100%; text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.fp-add-dist-item:hover { border-color: var(--primary); color: var(--primary); }

/* Zip badge on pickup cards */
.fp-zip-badge {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0.08rem 0.4rem;
  font-weight: 600;
  letter-spacing: .03em;
  margin-left: 0.35rem;
  vertical-align: middle;
}

/* Add item row button for dist events */
.fp-dir-measure { display: flex; flex-direction: column; }

/* ===== FORM UI OVERHAUL ===== */

/* Panel top-border accents per modal type */
.fp-panel-pickup    { border-top: 4px solid #22c55e; }
.fp-panel-collection { border-top: 4px solid #3b82f6; }
.fp-panel-event     { border-top: 4px solid #f59e0b; }

/* "Add item" dashed button (pickup + collection) */
.fp-add-item-btn {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.fp-add-item-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Clear signature button */
.fp-clear-sig-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.fp-clear-sig-btn:hover { border-color: var(--text-muted); color: var(--text); }

/* Signature canvas wrapper */
.fp-sig-wrap {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #f9fafb;
}
.fp-sig-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.fp-sig-footer {
  margin-top: 0.45rem;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .fp-panel-pickup, .fp-panel-collection, .fp-panel-event { border-top-width: 3px; }
}

/* ===== FORM SECTION CARDS ===== */

/* Dark-navy section block (form + view) */
.fp-form-section {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.9rem;
}
.fp-form-section:last-child { margin-bottom: 0; }
.fp-form-sec-hdr {
  background: #1e293b;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0.6rem 1.1rem;
}
.fp-form-sec-body {
  background: #fff;
  padding: 1rem 1.1rem 0.6rem;
}
/* Slight tint on dark-mode / themed backgrounds */
.fp-form-sec-body .form-grid { margin-bottom: 0.65rem; }

/* Read-only view field grid inside section body */
.fp-view-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.5rem;
}
@media (max-width: 500px) { .fp-view-field-grid { grid-template-columns: 1fr; } }

/* Search group (attached input + button) */
.fp-search-group {
  display: flex;
  flex: 2;
  min-width: 180px;
}
.fp-search-group .form-input {
  flex: 1;
  border-right: none !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
.fp-search-btn {
  background: #1e293b;
  color: #fff;
  border: 1.5px solid #1e293b;
  border-left: none;
  border-radius: 0 8px 8px 0;
  padding: 0 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}
.fp-search-btn:hover { background: #334155; }

/* ===== GRANT TRACKER ===== */
.gt-page-title { font-family: Georgia, 'Times New Roman', serif; }

.gt-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1100px) { .gt-card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .gt-card-grid { grid-template-columns: 1fr; } }

.gt-program-section { margin-bottom: 2rem; }
.gt-program-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #112A47;
  padding: 0.4rem 0;
  border-bottom: 2px solid #112A47;
  border-color: #112A47;
  opacity: 0.85;
  margin-bottom: 0.85rem;
}

.gt-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border-left: 4px solid transparent;
}
.gt-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(17,42,71,0.1); }
.gt-card.gt-urgent  { border-left-color: #dc2626; }
.gt-card.gt-warning { border-left-color: #f59e0b; }

.gt-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.35rem; }
.gt-card-name { font-weight: 700; font-size: 0.92rem; color: var(--text); line-height: 1.3; }
.gt-card-funder { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.gt-card-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem; font-size: 0.76rem; color: var(--text-muted); }
.gt-card-meta .gt-deadline.gt-urgent  { color: #dc2626; font-weight: 600; }
.gt-card-meta .gt-deadline.gt-warning { color: #d97706; font-weight: 600; }

/* Status dot pill — replaces solid .gt-status-badge */
.gt-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--dot-color);
  display: inline-block;
  flex-shrink: 0;
}
.gt-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
  background: #f1f5f9; color: #1e293b;
  white-space: nowrap;
}

/* Form pill row & pill buttons */
.gt-pill-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.gt-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 500;
  border: 1.5px solid #cbd5e1; background: #fff; color: #334155; cursor: pointer;
  transition: all 0.12s;
}
.gt-pill:hover { border-color: #112A47; color: #112A47; }
.gt-pill.gt-pill-selected { background: #112A47; color: #fff; border-color: #112A47; }
.gt-pill.gt-pill-selected .gt-dot { box-shadow: 0 0 0 1.5px rgba(255,255,255,0.5); }

.gt-empty-card {
  background: var(--card-bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm, 10px);
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.gt-empty-card a {
  color: #112A47;
  cursor: pointer;
  text-decoration: underline;
  background: none;
}

/* Grant detail panel */
.gt-panel {
  position: fixed;
  top: 0; right: -480px;
  width: 460px; max-width: 100vw;
  height: 100vh;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transition: right 0.25s ease;
  overflow: hidden;
}
.gt-panel.gt-panel-open { right: 0; }
.gt-panel-header {
  padding: 1.1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.gt-panel-title { font-weight: 700; font-size: 1rem; flex: 1; color: var(--text); }
.gt-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}
.gt-panel-field { margin-bottom: 1rem; }
.gt-panel-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.gt-panel-field .gt-field-val {
  font-size: 0.9rem;
  color: var(--text);
}
.gt-field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}
.gt-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 399;
  display: none;
}
.gt-panel-overlay.gt-overlay-open { display: block; }

/* ===== HUB GRIDS ===== */
.hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 0.5rem;
}
.hub-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-top: 0.5rem;
}
@media (max-width: 1024px) {
  .hub-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .hub-grid   { grid-template-columns: 1fr; }
  .hub-grid-3 { grid-template-columns: 1fr; }
}

/* ===== HUB CARDS ===== */
.hub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  padding: 28px 24px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.hub-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
/* Navy variant (Programs) */
.hub-card-navy { border-top: 3px solid #112A47; }
/* Gold variant (Donations) */
.hub-card-gold { border-top: 3px solid #C8902E; }

.hub-card-icon {
  font-size: 52px;
  line-height: 1;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin: 0 auto 0.85rem;
}
.hub-card-navy .hub-card-icon { background: #EAF1FB; }
.hub-card-gold .hub-card-icon { background: #FDF3E0; }

.hub-card-title {
  font-weight: 700;
  font-size: 17px;
  color: #112A47;
  margin-bottom: 0.4rem;
}
.hub-card-desc {
  font-size: 13px;
  color: #6B6457;
  line-height: 1.45;
}
.hub-note {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* Floating Request Supplies button */
.supply-float-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.75rem;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #112A47;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.65rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(17,42,71,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.supply-float-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(17,42,71,0.45); }

/* Supply tab separator */
.tab-sep { display: inline-block; margin: 0 0.35rem; color: var(--border); user-select: none; }
.tab-btn.supply-tab { border-left: 2px solid #fbbf24; margin-left: 0.25rem; }

/* ===== FILE UPLOAD WIDGET ===== */
.fu-widget { }

.fu-dropzone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 1.5rem 1rem;
  text-align: center;
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
  cursor: default;
}
.fu-dropzone.fu-dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.fu-drop-icon { font-size: 2rem; margin-bottom: 0.25rem; }
.fu-drop-label { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 0.1rem; }
.fu-drop-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.4rem; }

.fu-queue-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 0.4rem;
}

.fu-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.fu-thumb-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}
.fu-thumb-img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: opacity 0.15s;
}
.fu-thumb-img:hover { opacity: 0.85; }
.fu-thumb-meta {
  padding: 0.4rem 0.5rem;
  padding-right: 1.8rem;
}
.fu-thumb-name {
  font-size: 0.75rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fu-thumb-sub { font-size: 0.68rem; color: var(--text-muted); }

.fu-pdf-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.75rem; }
.fu-pdf-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.fu-pdf-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.fu-pdf-link:hover { text-decoration: underline; }

.fu-delete-btn {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: rgba(255,255,255,0.85);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.fu-thumb-card:hover .fu-delete-btn,
.fu-pdf-row .fu-delete-btn {
  opacity: 1;
  position: static;
  width: auto;
  height: auto;
  background: none;
  font-size: 0.85rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.fu-delete-btn:hover { color: var(--danger); }

/* Lightbox */
.fu-lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  cursor: pointer;
}
.fu-lb-img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  cursor: default;
}
.fu-lb-name {
  color: #fff;
  margin-top: 0.75rem;
  font-size: 0.88rem;
  opacity: 0.8;
  max-width: 80vw;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.fu-lb-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.fu-lb-close:hover { background: rgba(255,255,255,0.28); }

/* Section divider used in upload areas */
.fu-section-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1rem 0 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   UNIFIED CALENDAR  (.ucal-*)
═══════════════════════════════════════════════════════════ */

.ucal-page { display: flex; flex-direction: column; gap: 1.5rem; }

/* Controls row */
.ucal-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.ucal-month-nav { display: flex; align-items: center; gap: 0.5rem; }
.ucal-month-title { font-size: 1.05rem; font-weight: 800; min-width: 12rem; text-align: center; color: var(--text); }
.ucal-filter-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ucal-filter-tab {
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ucal-filter-tab:hover { border-color: var(--primary); color: var(--primary); }
.ucal-filter-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Calendar grid */
.ucal-grid-wrap { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.ucal-dow-row, .ucal-week-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.ucal-dow-cell {
  padding: 0.45rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ucal-day-cell {
  min-height: 90px;
  padding: 0.35rem 0.4rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}
.ucal-day-cell:nth-child(7n) { border-right: none; }
.ucal-week-row:last-child .ucal-day-cell { border-bottom: none; }
.ucal-day-out { opacity: 0.38; }
.ucal-day-today { background: var(--primary-tint, rgba(29,78,216,0.07)); }
.ucal-day-today .ucal-daynum {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
}
.ucal-day-weekend { background: var(--bg); }
.ucal-daynum { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.25rem; line-height: 1; }

/* Chips */
.ucal-chip {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  transition: opacity 0.12s;
}
.ucal-chip:hover { opacity: 0.82; }
.ucal-chip-time { font-weight: 600; opacity: 0.88; }
.ucal-more-chip { font-size: 0.65rem; font-weight: 700; color: var(--primary); cursor: pointer; padding: 1px 3px; border-radius: 3px; }
.ucal-more-chip:hover { text-decoration: underline; }

/* Side panel */
.ucal-panel-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 299; }
.ucal-panel-overlay.visible { display: block; }
.ucal-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: min(420px, 92vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transition: right 0.25s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.10);
}
.ucal-panel.open { right: 0; }
.ucal-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ucal-panel-body { flex: 1; overflow-y: auto; padding: 1.25rem; }
.ucal-detail-row { display: flex; justify-content: space-between; align-items: center; padding: 0.45rem 0; border-bottom: 1px solid var(--border); font-size: 0.83rem; gap: 0.75rem; }
.ucal-detail-row > span:first-child { color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.ucal-detail-row > span:last-child, .ucal-detail-row > a { text-align: right; font-weight: 600; word-break: break-word; }

/* List section */
.ucal-list-section { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.ucal-list-tabs { display: flex; border-bottom: 2px solid var(--border); background: var(--bg); overflow-x: auto; }
.ucal-list-tab {
  padding: 0.7rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.ucal-list-tab:hover { color: var(--primary); }
.ucal-list-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.ucal-list-content { padding: 1rem 1.25rem; max-height: 520px; overflow-y: auto; }

/* Upcoming / item list */
.ucal-date-group-header {
  font-size: 0.75rem; font-weight: 800; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.65rem 0 0.3rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}
.ucal-date-group-header:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.ucal-upcoming-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.5rem; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.12s; }
.ucal-upcoming-item:hover { background: var(--bg); }
.ucal-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ucal-item-title { font-size: 0.85rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.ucal-item-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }

/* Color legend */
.ucal-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; padding: 0.6rem 0.25rem; min-height: 1.5rem; }
.ucal-legend-item { display: flex; align-items: center; gap: 0.4rem; }
.ucal-legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.ucal-legend-label { font-size: 0.76rem; font-weight: 600; color: var(--text-muted); }

/* Error banner */
.ucal-err-banner { align-items: center; gap: 0.75rem; background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; border-radius: var(--radius-sm); padding: 0.6rem 1rem; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.5rem; }

/* Schedule grid cells */
.sched-cell { font-size: 0.68rem; font-weight: 700; border-radius: 4px; padding: 3px 5px; }
.sched-cell.on { background: rgba(34,197,94,0.12); color: #166534; }
.sched-cell.off { background: var(--bg); color: var(--text-muted); }

/* Mobile: list-only, bottom sheet */
@media (max-width: 768px) {
  .ucal-grid-wrap { display: none; }
  .ucal-controls { flex-direction: column; align-items: flex-start; }
  .ucal-month-title { min-width: auto; }
  .ucal-panel {
    top: auto;
    bottom: -100%;
    right: 0;
    width: 100%;
    height: 80vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    transition: bottom 0.25s cubic-bezier(0.4,0,0.2,1);
  }
  .ucal-panel.open { bottom: 0; right: 0; }
  .ucal-list-content { max-height: 60vh; }
}
