/* ============================================================
   ConnectUs v1.0 — Design System
   Campus-exclusive social platform
   Stack: Bootstrap 5 + Custom CSS
   ============================================================ */

/* ── 1. Design Tokens ─────────────────────────────────────── */
:root {
  /* Brand palette */
  --cu-indigo-900: #12103A;
  --cu-indigo-800: #1E1B4B;
  --cu-indigo-700: #2D2A5E;
  --cu-indigo-600: #3B3870;
  --cu-indigo-400: #6B68A8;
  --cu-indigo-200: #B0AEDB;
  --cu-indigo-100: #D8D7EE;
  --cu-indigo-50:  #F0EFFA;

  --cu-teal-900: #042C28;
  --cu-teal-700: #0D6B61;
  --cu-teal-600: #0D9488;
  --cu-teal-500: #14B8A6;
  --cu-teal-200: #99E6DE;
  --cu-teal-100: #CCFBF6;
  --cu-teal-50:  #F0FDFB;

  /* Semantic */
  --cu-red:    #EF4444;
  --cu-red-bg: #FEE2E2;
  --cu-amber:  #F59E0B;
  --cu-amber-bg: #FEF3C7;
  --cu-green:  #22C55E;
  --cu-green-bg: #DCFCE7;
  --cu-purple: #8B5CF6;
  --cu-purple-bg: #EDE9FE;

  /* WhatsApp-style sent-bubble tint */
  --wa-mine-bg: #DCF8C6;
  --wa-mine-text: #1C1B1A;
  --wa-chat-bg: #EAE3D5;

  /* Surfaces */
  --surface-page:   #F4F3F0;
  --surface-card:   #FFFFFF;
  --surface-raised: #FFFFFF;
  --surface-muted:  #F0EEE9;

  /* Text */
  --text-primary:   #1C1B1A;
  --text-secondary: #5C5B57;
  --text-muted:     #9B9A96;
  --text-inverse:   #FFFFFF;

  /* Borders */
  --border-default: rgba(0,0,0,0.08);
  --border-strong:  rgba(0,0,0,0.15);

  /* Sidebar */
  --sidebar-bg:       var(--cu-indigo-800);
  --sidebar-hover:    rgba(255,255,255,0.07);
  --sidebar-active:   rgba(20,184,166,0.18);
  --sidebar-text:     rgba(255,255,255,0.55);
  --sidebar-text-hi:  rgba(255,255,255,0.9);
  --sidebar-border:   rgba(255,255,255,0.08);

  /* Sizes */
  --sidebar-width: 230px;
  --topbar-height: 60px;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   18px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-card:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-raised: 0 4px 12px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-modal:  0 16px 48px rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.08);

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
}

/* ── 2. Base Reset ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--surface-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  overflow-x: hidden;
  max-width: 100vw;
}

a { color: var(--cu-teal-700); text-decoration: none; }
a:hover { color: var(--cu-teal-600); }

img { max-width: 100%; }

::selection {
  background: var(--cu-teal-100);
  color: var(--cu-teal-900);
}

/* ── 3. Layout Shell ──────────────────────────────────────── */
.cu-layout {
  display: flex;
  min-height: 100vh;
}

.cu-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
}

.cu-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── 4. Sidebar ───────────────────────────────────────────── */
.cu-sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.cu-logo-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
}

.cu-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--cu-teal-500);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: #fff;
  flex-shrink: 0;
}

.cu-logo-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.cu-logo-tagline {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Sidebar user card */
.cu-sidebar-user {
  padding: 14px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

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

.cu-sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cu-sidebar-user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.38);
}

/* Sidebar nav */
.cu-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  scrollbar-width: none;
}

.cu-sidebar-nav::-webkit-scrollbar { display: none; }

.cu-nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 10px 10px 4px;
}

.cu-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 13.5px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
  user-select: none;
  text-decoration: none;
}

.cu-nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-hi);
}

.cu-nav-item.active {
  background: var(--sidebar-active);
  color: var(--cu-teal-500);
  font-weight: 500;
}

.cu-nav-item i {
  font-size: 17px;
  flex-shrink: 0;
}

.cu-nav-badge {
  margin-left: auto;
  background: var(--cu-teal-500);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.cu-nav-badge.danger { background: var(--cu-red); }

/* Sidebar bottom */
.cu-sidebar-bottom {
  padding: 12px 10px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.cu-sidebar-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.38);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  border: none;
  background: none;
  text-decoration: none;
}

.cu-sidebar-icon-btn:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
}

.cu-sidebar-icon-btn i { font-size: 17px; }

/* ── 5. Top Bar ───────────────────────────────────────────── */
.cu-topbar {
  height: var(--topbar-height);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.cu-topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.cu-search {
  flex: 1;
  max-width: 320px;
  position: relative;
}

.cu-search-input {
  width: 100%;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  padding: 8px 14px 8px 36px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.cu-search-input::placeholder { color: var(--text-muted); }

.cu-search-input:focus {
  border-color: var(--cu-teal-500);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.12);
}

.cu-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.cu-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cu-topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast);
  background: none;
  border: none;
}

.cu-topbar-btn:hover { background: var(--surface-muted); }
.cu-topbar-btn i { font-size: 19px; }

.cu-notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cu-red);
  border: 2px solid var(--surface-card);
}

/* ── 6. Emergency Banner ──────────────────────────────────── */
.cu-emergency-bar {
  background: #7F1D1D;
  color: #fff;
  padding: 9px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  border-bottom: 1px solid rgba(0,0,0,0.15);
}

.cu-emergency-bar i { font-size: 16px; color: #FCA5A5; flex-shrink: 0; }

.cu-emergency-close {
  margin-left: auto;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}

.cu-emergency-close:hover { color: #fff; }

/* ── 7. Content Area ──────────────────────────────────────── */
.cu-content {
  flex: 1;
  padding: 20px 24px;
}

.cu-content-centered {
  max-width: 680px;
  margin: 0 auto;
}

.cu-content-wide {
  max-width: 900px;
  margin: 0 auto;
}

.cu-two-col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

/* ── 8. Cards ─────────────────────────────────────────────── */
.cu-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.cu-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cu-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.cu-card-action {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--cu-teal-700);
  cursor: pointer;
  font-weight: 500;
}

.cu-card-action:hover { color: var(--cu-teal-600); }

.cu-card-body { padding: 16px 18px; }

/* ── 9. Avatar System ─────────────────────────────────────── */
.cu-avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--cu-indigo-100);
  color: var(--cu-indigo-700);
}

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

.cu-avatar-xs  { width: 24px; height: 24px; font-size: 9px; }
.cu-avatar-sm  { width: 32px; height: 32px; font-size: 11px; }
.cu-avatar-md  { width: 42px; height: 42px; font-size: 14px; }
.cu-avatar-lg  { width: 56px; height: 56px; font-size: 18px; }
.cu-avatar-xl  { width: 80px; height: 80px; font-size: 26px; }

/* Avatar color variants */
.cu-av-teal   { background: rgba(20,184,166,0.15); color: var(--cu-teal-700); }
.cu-av-indigo { background: rgba(107,104,168,0.15); color: var(--cu-indigo-600); }
.cu-av-amber  { background: rgba(245,158,11,0.15);  color: #92400E; }
.cu-av-pink   { background: rgba(236,72,153,0.15);  color: #9D174D; }
.cu-av-green  { background: rgba(34,197,94,0.15);   color: #166534; }
.cu-av-purple { background: rgba(139,92,246,0.15);  color: #5B21B6; }

/* Online indicator */
.cu-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.cu-online-dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--cu-green);
  border: 2px solid var(--surface-card);
}

.cu-online-dot.offline { background: var(--text-muted); }

/* ── 10. Buttons ──────────────────────────────────────────── */
.cu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), opacity var(--transition-fast);
  border: none;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.cu-btn i { font-size: 16px; }

.cu-btn-primary {
  background: var(--cu-teal-500);
  color: #fff;
}

.cu-btn-primary:hover { background: var(--cu-teal-600); color: #fff; }

.cu-btn-secondary {
  background: var(--surface-muted);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.cu-btn-secondary:hover { background: var(--border-default); }

.cu-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.cu-btn-ghost:hover { background: var(--surface-muted); color: var(--text-primary); }

.cu-btn-danger {
  background: var(--cu-red);
  color: #fff;
}

.cu-btn-danger:hover { opacity: 0.88; }

.cu-btn-indigo {
  background: var(--cu-indigo-800);
  color: #fff;
}

.cu-btn-indigo:hover { background: var(--cu-indigo-700); }

.cu-btn-sm { padding: 6px 13px; font-size: 12px; }
.cu-btn-xs { padding: 4px 10px; font-size: 11px; }
.cu-btn-lg { padding: 11px 24px; font-size: 15px; }

/* ── 11. Badges / Pills ───────────────────────────────────── */
.cu-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}

.cu-badge-teal    { background: var(--cu-teal-100);    color: var(--cu-teal-700); }
.cu-badge-amber   { background: var(--cu-amber-bg);    color: #92400E; }
.cu-badge-red     { background: var(--cu-red-bg);      color: #991B1B; }
.cu-badge-green   { background: var(--cu-green-bg);    color: #166534; }
.cu-badge-indigo  { background: var(--cu-indigo-50);   color: var(--cu-indigo-600); }
.cu-badge-purple  { background: var(--cu-purple-bg);   color: #5B21B6; }
.cu-badge-muted   { background: var(--surface-muted);  color: var(--text-secondary); border: 1px solid var(--border-default); }

/* Priority */
.cu-priority-emergency { background: #FEE2E2; color: #991B1B; }
.cu-priority-important { background: #FEF9C3; color: #854D0E; }
.cu-priority-normal    { background: var(--surface-muted); color: var(--text-muted); border: 1px solid var(--border-default); }

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

.cu-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.cu-label-optional {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

.cu-input,
.cu-select,
.cu-textarea {
  width: 100%;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 9px 13px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  font-family: inherit;
}

.cu-input::placeholder,
.cu-textarea::placeholder { color: var(--text-muted); }

.cu-input:focus,
.cu-select:focus,
.cu-textarea:focus {
  border-color: var(--cu-teal-500);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.12);
}

.cu-input.error { border-color: var(--cu-red); }
.cu-input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }

.cu-input-icon-wrap { position: relative; }

.cu-input-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.cu-input-icon + .cu-input { padding-left: 38px; }

/* ── Add to Home Screen banner ─────────────────────────────── */
#cu-a2hs-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: -100px;
  z-index: 9998;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  padding: 12px 12px 12px 14px;
  opacity: 0;
  transition: bottom 0.3s ease, opacity 0.3s ease;
}
#cu-a2hs-banner.cu-a2hs-show {
  bottom: 16px;
  opacity: 1;
}
.cu-a2hs-icon img {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  flex-shrink: 0;
  display: block;
}
.cu-a2hs-body { flex: 1; min-width: 0; }
.cu-a2hs-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.cu-a2hs-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.cu-a2hs-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.cu-a2hs-install {
  background: var(--cu-teal-500);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.cu-a2hs-install:hover { background: var(--cu-teal-600); }
.cu-a2hs-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  line-height: 1;
  border-radius: 50%;
}
.cu-a2hs-dismiss:hover { background: var(--surface-muted); }

@media (max-width: 480px) {
  #cu-a2hs-banner { left: 8px; right: 8px; }
  .cu-a2hs-title { font-size: 13px; }
}

.cu-textarea { resize: vertical; min-height: 90px; }

.cu-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.cu-error-msg {
  font-size: 12px;
  color: var(--cu-red);
  margin-top: 4px;
}

.cu-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239B9A96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

/* ── 13. News Feed ────────────────────────────────────────── */
.cu-compose-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

.cu-compose-input {
  flex: 1;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.cu-compose-input:hover { background: #ebe9e3; }

.cu-compose-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cu-compose-action-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  background: none; border: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.cu-compose-action-btn:hover { background: var(--surface-muted); color: var(--cu-teal-500); }
.cu-compose-action-btn i { font-size: 18px; }

.cu-post-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.cu-post-header {
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cu-post-author-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.cu-post-author-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.cu-post-more {
  margin-left: auto;
  color: var(--text-muted);
  cursor: pointer;
  background: none; border: none;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.cu-post-more:hover { background: var(--surface-muted); }
.cu-post-more i { font-size: 18px; }

.cu-post-body {
  padding: 0 16px 12px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.65;
}

.cu-post-media {
  width: 100%;
  background: var(--surface-muted);
  overflow: hidden;
}

.cu-post-media img,
.cu-post-media video {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 400px;
}

.cu-post-actions {
  padding: 6px 12px;
  border-top: 1px solid var(--border-default);
  display: flex;
  gap: 2px;
}

.cu-post-action {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  background: none; border: none;
  font-family: inherit;
}

.cu-post-action:hover { background: var(--surface-muted); color: var(--text-primary); }
.cu-post-action.liked { color: var(--cu-red); }
.cu-post-action i { font-size: 17px; }

/* ── 14. Messenger ────────────────────────────────────────── */
.cu-messenger {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - var(--topbar-height) - 40px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-card);
  background: var(--surface-card);
}

.cu-chat-list {
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
}

.cu-chat-list-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-default);
}

.cu-chat-list-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

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

.cu-chat-list-scroll::-webkit-scrollbar { width: 4px; }
.cu-chat-list-scroll::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }

.cu-chat-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-default);
}

.cu-chat-item:hover { background: var(--surface-muted); }
.cu-chat-item.active { background: var(--cu-teal-50); border-left: 3px solid var(--cu-teal-500); }

.cu-chat-item-info { flex: 1; min-width: 0; }

.cu-chat-item-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.cu-chat-item-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cu-chat-item-preview.typing { color: var(--cu-teal-600); font-style: italic; }

.cu-chat-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.cu-chat-item-time {
  font-size: 11px;
  color: var(--text-muted);
}

.cu-unread-count {
  background: var(--cu-teal-500);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* Chat window */
.cu-chat-window {
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
}

.cu-chat-topbar {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.cu-chat-partner-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.cu-chat-partner-status {
  font-size: 12px;
  color: var(--cu-green);
}

.cu-chat-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.cu-chat-action-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  background: none; border: none;
  transition: background var(--transition-fast);
}

.cu-chat-action-btn:hover { background: var(--surface-muted); }
.cu-chat-action-btn i { font-size: 18px; }

/* Messages area */
.cu-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: var(--wa-chat-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cu-messages::-webkit-scrollbar { width: 4px; }
.cu-messages::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }

.cu-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.cu-msg.mine { flex-direction: row-reverse; }

.cu-msg-bubble {
  max-width: min(320px, 72vw);
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.55;
}

.cu-msg.theirs .cu-msg-bubble {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 4px 14px 14px 14px;
  color: var(--text-primary);
}

.cu-msg.mine .cu-msg-bubble {
  background: var(--wa-mine-bg);
  color: var(--wa-mine-text);
  border-radius: 14px 4px 14px 14px;
}

.cu-msg-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.cu-msg.mine .cu-msg-meta { flex-direction: row-reverse; }

.cu-msg-meta i { font-size: 13px; color: var(--cu-teal-500); }

.cu-msg-date-divider {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 0;
  position: relative;
}

.cu-msg-date-divider::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: var(--border-default);
  z-index: 0;
}

.cu-msg-date-divider span {
  background: var(--surface-page);
  padding: 0 12px;
  position: relative;
  z-index: 1;
}

/* Typing indicator */
.cu-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 4px 14px 14px 14px;
  width: fit-content;
}

.cu-typing-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: cu-bounce 1.3s infinite;
}

.cu-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.cu-typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes cu-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Media message */
.cu-msg-media {
  max-width: min(220px, 68vw);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
}

.cu-msg-media img { width: 100%; display: block; }

/* File message */
.cu-msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  max-width: min(240px, 72vw);
}

.cu-msg-file i { font-size: 24px; color: var(--cu-red); }
.cu-msg-file-name { font-size: 12.5px; font-weight: 500; color: var(--text-primary); }
.cu-msg-file-size { font-size: 11px; color: var(--text-muted); }

/* Chat input */
.cu-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-card);
  flex-shrink: 0;
}

.cu-chat-attach {
  display: flex;
  gap: 2px;
}

.cu-chat-attach-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  background: none; border: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.cu-chat-attach-btn:hover { background: var(--surface-muted); color: var(--cu-teal-500); }
.cu-chat-attach-btn i { font-size: 18px; }

.cu-chat-input {
  flex: 1;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  resize: none;
  font-family: inherit;
  max-height: 100px;
  transition: border-color var(--transition-fast);
}

.cu-chat-input:focus { border-color: var(--cu-teal-500); }
.cu-chat-input::placeholder { color: var(--text-muted); }

.cu-send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--cu-teal-500);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.cu-send-btn:hover { background: var(--cu-teal-600); transform: scale(1.05); }
.cu-send-btn i { font-size: 16px; color: #fff; }

/* ── 15. Broadcasts ───────────────────────────────────────── */
.cu-broadcast-list-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-default);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.cu-broadcast-list-item:hover { background: var(--surface-muted); }
.cu-broadcast-list-item:last-child { border-bottom: none; }

.cu-broadcast-list-item.unread { background: var(--cu-teal-50); }

.cu-bc-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.cu-bc-dept    { background: var(--cu-indigo-50);  color: var(--cu-indigo-600); }
.cu-bc-library { background: var(--cu-amber-bg);   color: #92400E; }
.cu-bc-place   { background: var(--cu-green-bg);   color: #166534; }
.cu-bc-accounts{ background: var(--cu-red-bg);     color: #991B1B; }
.cu-bc-club    { background: var(--cu-purple-bg);  color: #5B21B6; }
.cu-bc-college { background: var(--cu-teal-100);   color: var(--cu-teal-700); }
.cu-bc-emergency{ background: #FEE2E2; color: #7F1D1D; }

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

.cu-bc-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cu-bc-meta { font-size: 12px; color: var(--text-muted); }

.cu-unread-marker {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cu-teal-500);
  flex-shrink: 0;
}

/* Broadcast detail */
.cu-bc-detail-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.cu-bc-big-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.cu-bc-detail-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.35;
}

.cu-bc-detail-meta { font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; }

.cu-target-pills { display: flex; gap: 5px; flex-wrap: wrap; }

.cu-target-pill {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--cu-indigo-50);
  color: var(--cu-indigo-600);
  font-weight: 500;
}

.cu-bc-body {
  padding: 20px 24px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.75;
}

.cu-bc-attachment {
  margin: 0 24px 20px;
  padding: 12px 16px;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.cu-bc-attachment:hover { background: #e8e6e0; }

.cu-bc-attachment i.file-icon { font-size: 26px; color: var(--cu-red); }
.cu-bc-attachment-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.cu-bc-attachment-size { font-size: 12px; color: var(--text-muted); }

.cu-bc-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.cu-read-progress {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--cu-teal-700);
  font-weight: 600;
}

/* ── 16. Profile ──────────────────────────────────────────── */
.cu-profile-cover {
  height: 160px;
  background: linear-gradient(135deg, var(--cu-indigo-800) 0%, var(--cu-teal-700) 100%);
  position: relative;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.cu-profile-cover-edit {
  position: absolute;
  bottom: 12px; right: 14px;
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 6px 11px;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  backdrop-filter: blur(4px);
}

.cu-profile-avatar-section {
  padding: 0 22px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: -40px;
  margin-bottom: 12px;
}

.cu-profile-avatar-wrap-lg {
  position: relative;
  flex-shrink: 0;
}

.cu-profile-avatar-lg {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 4px solid var(--surface-card);
  overflow: hidden;
  background: var(--cu-teal-500);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: #fff;
}

.cu-profile-info-section { padding: 0 22px 18px; }

.cu-profile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.cu-profile-roll {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.cu-profile-bio {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 12px;
}

.cu-skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.cu-skill-tag {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.cu-profile-links {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.cu-profile-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--cu-teal-700);
  cursor: pointer;
  text-decoration: none;
}

.cu-profile-link i { font-size: 15px; }
.cu-profile-link:hover { color: var(--cu-teal-600); }

.cu-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border-default);
  margin: 0 22px;
  padding: 14px 0 0;
  text-align: center;
}

.cu-profile-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.cu-profile-stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── 17. Admin Dashboard ──────────────────────────────────── */
.cu-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.cu-stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}

.cu-stat-card-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 10px;
}

.cu-stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.cu-stat-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.cu-stat-change {
  font-size: 12px;
  margin-top: 4px;
}

.cu-stat-change.up   { color: #16A34A; }
.cu-stat-change.down { color: var(--cu-red); }

/* Pending approval table */
.cu-table {
  width: 100%;
  border-collapse: collapse;
}

.cu-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-muted);
}

.cu-table td {
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-default);
  vertical-align: middle;
}

.cu-table tr:last-child td { border-bottom: none; }
.cu-table tbody tr:hover td { background: var(--surface-muted); }

/* ── 18. Notifications ────────────────────────────────────── */
.cu-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-default);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.cu-notif-item:hover { background: var(--surface-muted); }
.cu-notif-item.unread { background: var(--cu-teal-50); }

.cu-notif-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.cu-notif-text {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.5;
}

.cu-notif-text strong { font-weight: 600; }
.cu-notif-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── 19. Auth Pages ───────────────────────────────────────── */
.cu-auth-page {
  min-height: 100vh;
  background: var(--cu-indigo-800);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.cu-auth-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(20,184,166,0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(107,104,168,0.15) 0%, transparent 50%);
  pointer-events: none;
}

.cu-auth-card {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  padding: 36px 36px 32px;
  box-shadow: var(--shadow-modal);
  position: relative;
  z-index: 1;
}

.cu-auth-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 28px;
}

.cu-auth-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cu-auth-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 26px;
}

.cu-divider {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: 22px 0;
}

/* ── 20. Utilities ────────────────────────────────────────── */
.cu-flex       { display: flex; }
.cu-flex-center{ display: flex; align-items: center; }
.cu-gap-xs     { gap: 4px; }
.cu-gap-sm     { gap: 8px; }
.cu-gap-md     { gap: 12px; }
.cu-gap-lg     { gap: 16px; }
.cu-gap-xl     { gap: 24px; }
.cu-mt-sm      { margin-top: 8px; }
.cu-mt-md      { margin-top: 14px; }
.cu-mt-lg      { margin-top: 22px; }
.cu-mb-sm      { margin-bottom: 8px; }
.cu-mb-md      { margin-bottom: 14px; }
.cu-mb-lg      { margin-bottom: 22px; }
.cu-ml-auto    { margin-left: auto; }
.cu-text-muted { color: var(--text-muted); }
.cu-text-sm    { font-size: 12px; }
.cu-fw-600     { font-weight: 600; }
.cu-truncate   { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-sr-only    { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── 21. Scrollbar Global ─────────────────────────────────── */
::-webkit-scrollbar        { width: 5px; height: 5px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── 22. Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .cu-sidebar {
    transform: translateX(-230px);
    width: 230px;
    transition: transform var(--transition-base);
  }

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

  .cu-main { margin-left: 0; }

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

  .cu-messenger {
    grid-template-columns: 1fr;
    height: calc(100dvh - var(--topbar-height));
    border-radius: 0;
    border: none;
  }

  /* WhatsApp-style single-pane nav: show ONE of list/chat at a time,
     driven by the server (cu-list-active / cu-chat-active), not JS. */
  .cu-chat-list { display: flex; }
  .cu-chat-window { display: none; }
  .cu-messenger.cu-chat-active .cu-chat-list { display: none; }
  .cu-messenger.cu-chat-active .cu-chat-window { display: flex; }

  .cu-messages { padding: 10px 12px; }
  .cu-chat-list-header { padding: 12px; }
  .cu-chat-topbar { padding: 10px 12px; }
  .cu-chat-input-area { padding: 8px 10px; }
  .cu-msg-bubble { max-width: 78vw; }
  .cu-msg-media { max-width: 72vw; }

  .cu-content { padding: 16px; }

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

/* Messenger page fills the viewport edge-to-edge on mobile — no page padding */
@media (max-width: 768px) {
  .cu-content-messenger { padding: 0 !important; }
}

@media (max-width: 480px) {
  .cu-auth-card { padding: 24px 20px; }
  .cu-stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ── 23. Animations ───────────────────────────────────────── */
@keyframes cu-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cu-fade-in { animation: cu-fade-in 0.2s ease; }

@keyframes cu-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.cu-pulse { animation: cu-pulse 1.8s ease-in-out infinite; }

/* ── 24. Dark Mode ────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --surface-page:   #0F0F0E;
    --surface-card:   #1A1A18;
    --surface-raised: #1A1A18;
    --surface-muted:  #252522;
    --text-primary:   #EEEDE9;
    --text-secondary: #9B9A96;
    --text-muted:     #6B6A66;
    --border-default: rgba(255,255,255,0.08);
    --border-strong:  rgba(255,255,255,0.14);
    --cu-indigo-50:   #1A1936;
    --cu-teal-50:     #0A1F1C;
    --cu-teal-100:    #0D2E29;
    --cu-amber-bg:    #2A1F08;
    --cu-red-bg:      #2A0F0F;
    --cu-green-bg:    #0A2010;
    --cu-purple-bg:   #1A1030;
    --wa-mine-bg:     #005C4B;
    --wa-mine-text:   #E9EDEF;
    --wa-chat-bg:     #0B141A;
  }
}
