/* ================================================================
   Patient Chat — EXTREME Glassmorphism Design System v5.0
   Level: Apple Vision Pro + Windows 11 Mica + Nebula
   - Living orb backgrounds with independent animations
   - Multi-layer noise texture for glass realism
   - Edge refraction lines on every glass surface
   - Neon glow micro-interactions
   - Mica multi-layer depth system
   ================================================================ */

/* ─── Design Tokens ─── */
:root {
  /* Background — near-transparent to show orbs through */
  --bg-base: #020612;
  --bg-primary: rgba(6, 10, 24, 0.3);
  --bg-secondary: rgba(8, 14, 30, 0.22);
  --bg-tertiary: rgba(12, 20, 42, 0.25);
  --bg-elevated: rgba(18, 28, 54, 0.3);
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(100, 170, 255, 0.16);
  --bg-active-strong: rgba(100, 170, 255, 0.26);

  /* GLASS — Extreme Tokens */
  --glass-bg: rgba(6, 10, 24, 0.18);
  --glass-bg-light: rgba(10, 16, 34, 0.14);
  --glass-bg-medium: rgba(8, 14, 28, 0.28);
  --glass-bg-strong: rgba(4, 8, 18, 0.32);
  --glass-blur: blur(48px);
  --glass-blur-light: blur(32px);
  --glass-blur-strong: blur(72px);
  --glass-blur-ultra: blur(100px);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-light: rgba(255, 255, 255, 0.06);
  --glass-border-strong: rgba(255, 255, 255, 0.16);
  --glass-border-bright: rgba(255, 255, 255, 0.22);
  --glass-shine: linear-gradient(135deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0.04) 35%, transparent 55%);
  --glass-shine-strong: linear-gradient(135deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.06) 35%, transparent 55%);
  --glass-shine-edge: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.04) 25%, transparent 50%);
  --glass-inner-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -1px 0 rgba(0,0,0,0.12);
  --glass-inner-glow: inset 0 0 40px rgba(100,170,255,0.04);
  --glass-refraction: 0 1px 0 rgba(255,255,255,0.1);
  --glass-depth-1: rgba(255,255,255,0.03);
  --glass-depth-2: rgba(255,255,255,0.05);
  --glass-depth-3: rgba(255,255,255,0.08);

  /* Noise texture — SVG inline for real glass grain */
  --glass-noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");

  /* Text */
  --text-primary: #f0f4f8;
  --text-secondary: #94a8c8;
  --text-muted: #506080;
  --text-inverse: #020612;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-default: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  /* Brand */
  --brand-primary: #6aabff;
  --brand-primary-hover: #4d94ff;
  --brand-secondary: #38bdf8;
  --brand-gradient: linear-gradient(135deg, #6aabff 0%, #38bdf8 40%, #a78bfa 100%);
  --brand-gradient-soft: linear-gradient(135deg, rgba(106,171,255,0.25), rgba(56,189,248,0.25));
  --brand-glow: 0 0 30px rgba(106, 171, 255, 0.25);
  --brand-glow-strong: 0 0 50px rgba(106, 171, 255, 0.35);
  --brand-glow-ultra: 0 0 80px rgba(106, 171, 255, 0.2);

  /* Semantic */
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-danger: #f87171;
  --color-info: #38bdf8;

  /* Patient temperature */
  --temp-hot: #f87171;
  --temp-warm: #fbbf24;
  --temp-cool: #60a5fa;
  --temp-cold: #94a3b8;

  /* Sizes */
  --sidebar-w: 280px;
  --detail-w: 380px;
  --header-h: 56px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --duration-fast: 0.15s;
  --duration-normal: 0.3s;
  --duration-slow: 0.5s;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.45);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.55);
  --shadow-glow-blue: 0 0 40px rgba(106,171,255,0.2);
  --shadow-glow-red: 0 0 30px rgba(248,113,113,0.2);
  --shadow-glass: 0 8px 40px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
  --shadow-glass-hover: 0 12px 50px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.14), 0 0 50px rgba(106,171,255,0.1);
}

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

html, body {
  height: 100%; overflow: hidden;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', system-ui, sans-serif;
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  position: relative;
}

/* ═══════════════════════════════════════════════════════════
   LIVING ORB BACKGROUND — Multi-layer Nebula System
   Each orb animates independently for organic movement
   ═══════════════════════════════════════════════════════════ */

/* Layer 1: Primary blue orb — slow large drift */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 18% 22%, rgba(106,171,255,0.14) 0%, transparent 72%),
    radial-gradient(ellipse 55% 50% at 82% 72%, rgba(167,139,250,0.11) 0%, transparent 72%),
    radial-gradient(ellipse 50% 45% at 52% 48%, rgba(56,189,248,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 40% 35% at 72% 15%, rgba(248,113,113,0.05) 0%, transparent 68%),
    radial-gradient(ellipse 45% 40% at 30% 80%, rgba(52,211,153,0.04) 0%, transparent 70%);
  animation: nebulaDrift 30s ease-in-out infinite alternate;
}

/* Layer 2: Noise texture overlay for fine glass grain */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: var(--glass-noise);
  background-repeat: repeat;
  background-size: 512px 512px;
  opacity: 0.5;
  mix-blend-mode: soft-light;
}

@keyframes nebulaDrift {
  0% {
    background-position: 0% 0%, 100% 100%, 50% 50%, 72% 15%, 30% 80%;
    filter: hue-rotate(0deg) brightness(1);
  }
  25% {
    background-position: 8% 12%, 88% 82%, 56% 42%, 68% 22%, 35% 74%;
  }
  50% {
    background-position: 4% 8%, 94% 90%, 48% 54%, 76% 10%, 28% 85%;
    filter: hue-rotate(5deg) brightness(1.02);
  }
  75% {
    background-position: 10% 5%, 86% 86%, 54% 46%, 70% 18%, 32% 78%;
  }
  100% {
    background-position: 3% 10%, 92% 88%, 50% 50%, 74% 14%, 30% 82%;
    filter: hue-rotate(10deg) brightness(1);
  }
}

/* Living orb containers — independent animated DOM elements */
.orb {
  position: fixed; border-radius: 50%; pointer-events: none; z-index: 0;
  filter: blur(80px);
  mix-blend-mode: screen;
  will-change: transform;
}
.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(106,171,255,0.18) 0%, transparent 70%);
  top: -10%; left: -5%;
  animation: orbFloat1 22s ease-in-out infinite;
}
.orb-2 {
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(167,139,250,0.14) 0%, transparent 70%);
  bottom: -8%; right: -5%;
  animation: orbFloat2 28s ease-in-out infinite;
}
.orb-3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(56,189,248,0.1) 0%, transparent 70%);
  top: 40%; left: 35%;
  animation: orbFloat3 25s ease-in-out infinite;
}
.orb-4 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(248,113,113,0.08) 0%, transparent 70%);
  top: 10%; right: 15%;
  animation: orbFloat4 20s ease-in-out infinite;
}
.orb-5 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(52,211,153,0.06) 0%, transparent 70%);
  bottom: 20%; left: 10%;
  animation: orbFloat5 32s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(60px, 40px) scale(1.1); }
  50%  { transform: translate(30px, 80px) scale(0.95); }
  75%  { transform: translate(70px, 20px) scale(1.05); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes orbFloat2 {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(-50px, -30px) scale(1.08); }
  50%  { transform: translate(-80px, -60px) scale(0.92); }
  75%  { transform: translate(-30px, -50px) scale(1.04); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes orbFloat3 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(40px, -50px) scale(1.12); }
  66%  { transform: translate(-30px, 40px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes orbFloat4 {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  50%  { transform: translate(-40px, 50px) scale(1.15) rotate(5deg); }
  100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}
@keyframes orbFloat5 {
  0%   { transform: translate(0, 0) scale(1); }
  40%  { transform: translate(50px, -30px) scale(1.06); }
  70%  { transform: translate(-20px, -50px) scale(0.94); }
  100% { transform: translate(0, 0) scale(1); }
}

/* Scrollbar — glass-thin */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }
::selection { background: rgba(106,171,255,0.35); }

/* ─── Reusable Glass Mixin via utility ─── */
.glass-surface {
  position: relative;
}
/* Noise texture layer for all glass surfaces */
.glass-surface::before,
.sidebar::before,
.main-panel::before,
.detail-panel::before,
.modal-content::before,
.search-panel::before {
  content: ''; position: absolute; inset: 0;
  background-image: var(--glass-noise);
  background-repeat: repeat;
  background-size: 256px 256px;
  opacity: 0.3;
  pointer-events: none;
  border-radius: inherit;
  mix-blend-mode: overlay;
  z-index: 0;
}

/* ─── Layout Shell ─── */
.app-layout {
  display: flex; height: 100vh; width: 100%;
  position: relative; z-index: 1;
  gap: 1px;
}

/* ═══════════════════════════════════════════════
   SIDEBAR — Ultra Frosted Glass Panel (Mica Layer 1)
   ═══════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-strong) saturate(1.8) brightness(1.05);
  -webkit-backdrop-filter: var(--glass-blur-strong) saturate(1.8) brightness(1.05);
  border-right: 1px solid var(--glass-border);
  display: flex; flex-direction: column;
  transition: transform var(--duration-slow) var(--ease-out);
  z-index: 40; position: relative;
  overflow: hidden;
}
/* Top refraction edge — prismatic rainbow */
.sidebar::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 5%, 
    rgba(106,171,255,0.3) 20%, 
    rgba(167,139,250,0.25) 40%, 
    rgba(56,189,248,0.3) 60%, 
    rgba(255,255,255,0.2) 80%, 
    transparent 95%);
  z-index: 3;
  opacity: 0;
  animation: refractionPulse 8s ease-in-out infinite;
}
/* Mica shine overlay */
.sidebar::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--glass-shine);
  pointer-events: none; z-index: 1;
}

@keyframes refractionPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.sidebar-header {
  height: var(--header-h); padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--glass-border-light);
  flex-shrink: 0; position: relative; z-index: 2;
}
.hospital-name {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
}
.hospital-name .logo {
  width: 34px; height: 34px; border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: white;
  box-shadow: var(--brand-glow), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: all var(--duration-normal) var(--ease-spring);
  position: relative; overflow: hidden;
}
.hospital-name .logo::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, transparent 50%);
  border-radius: inherit;
}
.hospital-name .logo:hover {
  transform: scale(1.12) rotate(-5deg);
  box-shadow: var(--brand-glow-strong), inset 0 1px 0 rgba(255,255,255,0.35);
}

.sidebar-actions { display: flex; gap: 2px; position: relative; z-index: 2; }
.sidebar-actions button,
.icon-btn {
  width: 32px; height: 32px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast);
  font-size: 13px;
  position: relative;
}
.sidebar-actions button:hover, .icon-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 12px rgba(106,171,255,0.06);
}

/* Sidebar Search — Glass Input */
.sidebar-search { padding: 10px 12px; flex-shrink: 0; position: relative; z-index: 2; }
.sidebar-search .search-icon {
  position: absolute; left: 24px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 11px; pointer-events: none;
}
.sidebar-search input {
  width: 100%; padding: 8px 12px 8px 34px;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg); color: var(--text-primary); font-size: 12.5px;
  outline: none;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--glass-inner-shadow);
}
.sidebar-search input::placeholder { color: var(--text-muted); }
.sidebar-search input:focus {
  border-color: rgba(106,171,255,0.5);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 4px rgba(106,171,255,0.1), 0 0 30px rgba(106,171,255,0.08), var(--glass-inner-shadow);
}

/* Channel List */
.channel-list { flex: 1; overflow-y: auto; padding: 6px 0; position: relative; z-index: 2; }

.channel-category { margin-bottom: 2px; }
.channel-category-header {
  padding: 10px 16px 4px; font-size: 10.5px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  transition: color var(--duration-fast);
}
.channel-category-header:hover { color: var(--text-secondary); }
.channel-category-header .chevron {
  font-size: 9px; transition: transform var(--duration-normal) var(--ease-out);
}
.channel-category-header .chevron.collapsed { transform: rotate(-90deg); }

/* Channel Items — Frosted Glass Cards with Neon Edge */
.channel-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; margin: 2px 8px;
  border-radius: var(--radius-md);
  cursor: pointer; font-size: 13.5px; color: var(--text-secondary);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  border: 1px solid transparent;
}
.channel-item::after {
  content: ''; position: absolute; inset: 0;
  border-radius: inherit;
  opacity: 0;
  background: var(--glass-shine);
  transition: opacity var(--duration-normal);
  pointer-events: none;
}
.channel-item:hover {
  background: rgba(255,255,255,0.07);
  border-color: var(--glass-border);
  color: var(--text-primary);
  box-shadow: var(--glass-inner-shadow), 0 0 15px rgba(106,171,255,0.04);
}
.channel-item:hover::after { opacity: 1; }
.channel-item.active {
  background: rgba(106,171,255,0.16);
  border-color: rgba(106,171,255,0.28);
  color: white; font-weight: 600;
  box-shadow: 
    inset 0 0 35px rgba(106,171,255,0.08),
    0 0 25px rgba(106,171,255,0.1),
    var(--glass-inner-shadow);
}
.channel-item.active::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 50%; border-radius: 0 4px 4px 0;
  background: var(--brand-gradient);
  box-shadow: 0 0 20px rgba(106,171,255,0.7), 0 0 40px rgba(106,171,255,0.3);
  animation: activeGlow 3s ease-in-out infinite alternate;
}
/* Refraction line on active channel */
.channel-item.active::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px; opacity: 1;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
}

@keyframes activeGlow {
  0% { box-shadow: 0 0 16px rgba(106,171,255,0.6), 0 0 30px rgba(106,171,255,0.2); }
  100% { box-shadow: 0 0 24px rgba(106,171,255,0.8), 0 0 50px rgba(106,171,255,0.3); }
}

.channel-item .channel-icon {
  width: 18px; text-align: center; font-size: 12px; flex-shrink: 0;
  opacity: 0.5; transition: opacity var(--duration-fast);
}
.channel-item.active .channel-icon { opacity: 1; }
.channel-item .channel-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-item .unread-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--color-danger); color: white;
  border-radius: var(--radius-full); font-size: 10.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: badgePop 0.3s var(--ease-spring);
  box-shadow: 0 0 16px rgba(248,113,113,0.5), inset 0 1px 0 rgba(255,255,255,0.25);
}
@keyframes badgePop { 0% { transform: scale(0); } 100% { transform: scale(1); } }

/* DM Section */
.sidebar-dm-section { border-top: 1px solid var(--glass-border-light); padding-top: 4px; }
.dm-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; margin: 2px 8px; border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--duration-fast);
  border: 1px solid transparent;
}
.dm-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--glass-border-light);
  box-shadow: var(--glass-inner-shadow);
}

.status-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 9px; height: 9px; border-radius: var(--radius-full);
  border: 2px solid rgba(4, 8, 18, 0.9);
}
.status-online { background: var(--color-success); box-shadow: 0 0 12px rgba(52,211,153,0.7); }
.status-away { background: var(--color-warning); box-shadow: 0 0 8px rgba(251,191,36,0.4); }
.status-dnd { background: var(--color-danger); box-shadow: 0 0 8px rgba(248,113,113,0.4); }
.status-offline { background: var(--text-muted); }

/* Status Bar — Bottom Glass Strip */
.status-bar {
  height: 40px; padding: 0 12px;
  border-top: 1px solid var(--glass-border-light);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-muted); flex-shrink: 0;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(20px);
  position: relative; z-index: 2;
}
.my-status {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--duration-fast);
  border: 1px solid transparent;
}
.my-status:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--glass-border-light);
}

/* ═══════════════════════════════════════════════
   MAIN PANEL — Frosted Glass (Mica Layer 2)
   ═══════════════════════════════════════════════ */
.main-panel {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur) saturate(1.5) brightness(1.02);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.5) brightness(1.02);
  position: relative;
}
.main-panel::before {
  content: ''; position: absolute; inset: 0;
  background-image: var(--glass-noise);
  background-repeat: repeat; background-size: 256px;
  opacity: 0.2; pointer-events: none;
  mix-blend-mode: overlay; z-index: 0;
}

/* Chat Header — Heavy Frosted Bar */
.chat-header {
  height: var(--header-h); padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--glass-border-light);
  background: rgba(4, 8, 18, 0.3);
  backdrop-filter: var(--glass-blur-strong) saturate(1.8);
  -webkit-backdrop-filter: var(--glass-blur-strong) saturate(1.8);
  flex-shrink: 0; position: relative; z-index: 5;
}
/* Refraction line — prismatic shimmer */
.chat-header::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(106,171,255,0.12) 30%, 
    rgba(167,139,250,0.08) 50%, 
    rgba(56,189,248,0.1) 70%, 
    transparent);
  animation: headerRefraction 12s linear infinite;
}
@keyframes headerRefraction {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.chat-header-left { display: flex; align-items: center; gap: 10px; }
.channel-title {
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 6px;
}
.member-count {
  font-size: 11.5px; color: var(--text-muted);
  padding: 3px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  box-shadow: var(--glass-inner-shadow);
  backdrop-filter: blur(8px);
}
.chat-header-right { display: flex; gap: 2px; }
.chat-header-right button {
  width: 34px; height: 34px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  transition: all var(--duration-normal);
  position: relative;
}
.chat-header-right button:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  box-shadow: var(--glass-inner-shadow), 0 0 15px rgba(106,171,255,0.05);
}
.chat-header-right button.active {
  color: var(--brand-primary);
  background: rgba(106,171,255,0.14);
  box-shadow: 0 0 20px rgba(106,171,255,0.12), var(--glass-inner-shadow);
}
/* Neon pulse on active header buttons */
.chat-header-right button.active::after {
  content: ''; position: absolute; inset: -2px;
  border-radius: inherit;
  border: 1px solid rgba(106,171,255,0.3);
  animation: neonPulse 2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes neonPulse {
  0%, 100% { opacity: 0.4; box-shadow: 0 0 8px rgba(106,171,255,0.1); }
  50% { opacity: 1; box-shadow: 0 0 16px rgba(106,171,255,0.2); }
}

/* Pinned Bar */
.pinned-bar {
  padding: 8px 20px;
  background: rgba(106,171,255,0.07);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--glass-border-light);
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-secondary);
  cursor: pointer; transition: all var(--duration-fast);
}
.pinned-bar i { color: var(--brand-primary); font-size: 11px; }
.pinned-bar:hover { background: rgba(106,171,255,0.12); }

/* ═══════════════════════════════════════════════
   MESSAGES — Premium Chat Experience v3.0
   ═══════════════════════════════════════════════ */
.messages-container {
  flex: 1; overflow-y: auto; padding: 16px 24px 16px;
  display: flex; flex-direction: column; gap: 2px;
  position: relative; z-index: 1;
}

/* Date separator — Glass Pill with refraction */
.date-separator {
  display: flex; align-items: center; gap: 16px; padding: 20px 0 16px;
}
.date-separator::before, .date-separator::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(to right, transparent, var(--glass-border), transparent);
}
.date-separator span {
  font-size: 11px; color: var(--text-muted); white-space: nowrap;
  font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  padding: 5px 18px;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  box-shadow: var(--glass-inner-shadow);
  position: relative;
}
/* Micro refraction on pill */
.date-separator span::after {
  content: ''; position: absolute; top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  border-radius: inherit;
}

/* ─── Message Group — Premium Bubble Design ─── */
.message-group {
  display: flex; gap: 10px; padding: 8px 12px;
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  border: 1px solid transparent;
  margin: 1px 0;
}
.message-group:hover {
  background: rgba(255,255,255,0.035);
  border-color: var(--glass-border-light);
  box-shadow: var(--glass-inner-shadow), 0 0 24px rgba(106,171,255,0.02);
}
.message-group:hover .message-actions { opacity: 1; pointer-events: auto; }
.message-group.consecutive:hover .message-time { opacity: 1 !important; }

/* ─── My Message (owner) — Distinguished Style ─── */
.message-group.is-mine {
  background: rgba(106,171,255,0.04);
  border-color: rgba(106,171,255,0.06);
  flex-direction: row;
}
.message-group.is-mine:hover {
  background: rgba(106,171,255,0.08);
  border-color: rgba(106,171,255,0.14);
  box-shadow: var(--glass-inner-shadow), 0 0 30px rgba(106,171,255,0.05);
}
/* Subtle left accent for my messages */
.message-group.is-mine::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 2px; border-radius: 2px;
  background: var(--brand-gradient);
  opacity: 0.5;
}

/* ─── Urgent Message — Red Glow ─── */
.message-group.is-urgent {
  background: rgba(248,113,113,0.04);
  border-color: rgba(248,113,113,0.1);
}
.message-group.is-urgent::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, #f87171, #dc2626);
  box-shadow: 0 0 12px rgba(248,113,113,0.4);
}
.message-group.is-urgent:hover {
  background: rgba(248,113,113,0.07);
  border-color: rgba(248,113,113,0.18);
}

/* ─── Pinned Message Indicator ─── */
.message-group.is-pinned {
  background: rgba(251,191,36,0.03);
  border-color: rgba(251,191,36,0.06);
}

/* ─── Avatar Container — Status Ring ─── */
.msg-avatar-wrap {
  position: relative; flex-shrink: 0;
  cursor: pointer;
}
/* Online status ring around avatar */
.msg-avatar-wrap .avatar-status-ring {
  position: absolute; inset: -3px;
  border-radius: 13px;
  border: 2px solid transparent;
  transition: all 0.3s var(--ease-out);
  pointer-events: none;
}
.msg-avatar-wrap .avatar-status-ring.online {
  border-color: rgba(52,211,153,0.5);
  box-shadow: 0 0 8px rgba(52,211,153,0.2);
}
.msg-avatar-wrap .avatar-status-ring.away {
  border-color: rgba(251,191,36,0.4);
}
.msg-avatar-wrap .avatar-status-ring.dnd {
  border-color: rgba(248,113,113,0.4);
}
/* Avatar hover card trigger */
.msg-avatar-wrap:hover .avatar-hover-card {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}

/* ─── Avatar Hover Mini Profile ─── */
.avatar-hover-card {
  position: absolute; left: 0; top: calc(100% + 8px);
  z-index: 50; width: 220px;
  background: rgba(8, 14, 28, 0.85);
  backdrop-filter: blur(60px) saturate(1.8);
  -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-glass), 0 0 60px rgba(0,0,0,0.3);
  opacity: 0; transform: translateY(6px);
  transition: all 0.25s var(--ease-out);
  pointer-events: none;
}
.avatar-hover-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(106,171,255,0.3), transparent);
}
.avatar-hover-card .hover-name {
  font-size: 14px; font-weight: 700; margin-bottom: 2px;
}
.avatar-hover-card .hover-role {
  font-size: 11px; color: var(--brand-primary); font-weight: 600;
  padding: 2px 10px; border-radius: var(--radius-full);
  background: rgba(106,171,255,0.1); border: 1px solid rgba(106,171,255,0.15);
  display: inline-block; margin-bottom: 6px;
}
.avatar-hover-card .hover-detail {
  font-size: 11.5px; color: var(--text-muted);
  display: flex; align-items: center; gap: 5px; margin-top: 3px;
}

.message-body { flex: 1; min-width: 0; }

/* ─── Message Header — Clean & Readable ─── */
.message-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 3px;
}
.message-author {
  font-size: 13.5px; font-weight: 700; color: var(--text-primary);
  letter-spacing: -0.01em;
}
/* Color-code author by role */
.message-author.role-owner { color: #a78bfa; }
.message-author.role-admin { color: #60a5fa; }
.message-author.role-manager { color: #34d399; }
.message-author.role-team_lead { color: #fbbf24; }

.message-position {
  font-size: 10px; color: var(--text-muted);
  padding: 2px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border-light);
  border-radius: var(--radius-full);
  box-shadow: var(--glass-inner-shadow);
  backdrop-filter: blur(6px);
  letter-spacing: 0.2px;
}
.message-time {
  font-size: 10.5px; color: var(--text-muted);
  opacity: 0.7; transition: opacity 0.15s;
}
.message-group:hover .message-time { opacity: 1; }

/* Pinned icon */
.pin-indicator {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; color: var(--color-warning);
  padding: 1px 8px; border-radius: var(--radius-full);
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.15);
}

/* ─── Message Content — Better Typography ─── */
.message-content {
  font-size: 14px; line-height: 1.75; color: var(--text-primary);
  word-break: break-word;
  letter-spacing: -0.005em;
}
.message-content a {
  color: var(--brand-primary); text-decoration: none;
  border-bottom: 1px solid rgba(106,171,255,0.3);
  padding-bottom: 1px;
  transition: all 0.15s;
}
.message-content a:hover {
  border-bottom-color: var(--brand-primary);
  text-shadow: 0 0 12px rgba(106,171,255,0.2);
}

/* Urgent badge inline */
.urgent-inline-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-full);
  background: rgba(248,113,113,0.12); color: var(--color-danger);
  border: 1px solid rgba(248,113,113,0.2);
  font-size: 11px; font-weight: 700;
  animation: urgentInlinePulse 2s ease-in-out infinite;
}
@keyframes urgentInlinePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(248,113,113,0.1); }
  50% { box-shadow: 0 0 18px rgba(248,113,113,0.3); }
}

/* Confirm badge inline */
.confirm-inline-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-full);
  background: rgba(251,191,36,0.1); color: var(--color-warning);
  border: 1px solid rgba(251,191,36,0.18);
  font-size: 11px; font-weight: 700;
}

/* Patient Tag — Neon Glass Chip with pulse */
.patient-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(106,171,255,0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--brand-secondary);
  border: 1px solid rgba(56,189,248,0.25);
  padding: 3px 14px; border-radius: var(--radius-full);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--glass-inner-shadow), 0 0 15px rgba(56,189,248,0.06);
  position: relative;
}
.patient-tag::after {
  content: ''; position: absolute; inset: -1px;
  border-radius: inherit;
  border: 1px solid transparent;
  transition: all var(--duration-normal);
  pointer-events: none;
}
.patient-tag:hover {
  background: rgba(106,171,255,0.2);
  border-color: rgba(56,189,248,0.45);
  box-shadow: 0 0 30px rgba(56,189,248,0.18), 0 0 60px rgba(56,189,248,0.06), var(--glass-inner-shadow);
  transform: translateY(-1px);
}
.patient-tag:hover::after {
  border-color: rgba(56,189,248,0.2);
  box-shadow: 0 0 20px rgba(56,189,248,0.1);
}
.patient-tag i { font-size: 10px; }

.mention {
  color: var(--brand-primary); font-weight: 600; cursor: pointer;
  padding: 1px 4px; border-radius: 4px;
  background: rgba(106,171,255,0.08);
  transition: background 0.15s;
}
.mention:hover {
  background: rgba(106,171,255,0.18);
  text-decoration: none;
}

/* Confirm Request — Glass Warning Card */
.message-confirm {
  margin-top: 10px; padding: 14px 18px;
  background: rgba(251,191,36,0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(251,191,36,0.15);
  border-left: 3px solid var(--color-warning);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--glass-inner-shadow), inset 0 0 25px rgba(251,191,36,0.03);
}
.confirm-info {
  font-size: 12px; color: var(--color-warning); font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.confirm-btn {
  padding: 8px 24px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: var(--text-inverse); border: none;
  border-radius: var(--radius-full); font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
  box-shadow: 0 4px 16px rgba(251,191,36,0.3), inset 0 1px 0 rgba(255,255,255,0.25);
  position: relative; overflow: hidden;
  letter-spacing: 0.3px;
}
.confirm-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 50%);
}
.confirm-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 24px rgba(251,191,36,0.45), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* ─── Read & Reactions Row — Inline Layout ─── */
.message-footer-row {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
  flex-wrap: wrap;
}

/* Read Status — v5.5.3: Slack-style with patient-care urgency coloring */
.message-read-status {
  font-size: 10.5px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-full);
  transition: all var(--duration-fast);
  border: 1px solid transparent;
  font-weight: 500;
}
.message-read-status:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--glass-border-light);
  transform: translateY(-1px);
}
/* All read: subtle green, low attention */
.message-read-status.read-all {
  color: #4ade80;
  opacity: 0.55;
}
.message-group:hover .message-read-status.read-all { opacity: 0.85; }

/* Partial read: amber, catches eye */
.message-read-status.read-partial {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
  opacity: 0.95;
}
.message-read-status.read-partial:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.4);
}

/* Urgent + partial: red pulse, impossible to miss */
.message-read-status.read-warn {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
  opacity: 1;
  animation: pulse-read-warn 2s ease-in-out infinite;
}
.message-read-status.read-warn:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.5);
}
@keyframes pulse-read-warn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); }
  50% { box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15); }
}

/* Reactions — Glass Chips with hover glow */
.message-reactions { display: flex; flex-wrap: wrap; gap: 4px; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  font-size: 13px; cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
  box-shadow: var(--glass-inner-shadow);
}
.reaction-chip:hover {
  border-color: rgba(106,171,255,0.35);
  transform: scale(1.12);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 20px rgba(106,171,255,0.12), var(--glass-inner-shadow);
}
.reaction-chip.active {
  background: rgba(106,171,255,0.16);
  border-color: rgba(106,171,255,0.4);
  box-shadow: 0 0 25px rgba(106,171,255,0.18), var(--glass-inner-shadow);
}
.reaction-chip .count { font-size: 10.5px; color: var(--text-secondary); font-weight: 600; }

/* Message Actions — Frosted Glass Toolbar */
.message-actions {
  position: absolute; top: -16px; right: 10px;
  display: flex; gap: 1px; opacity: 0; pointer-events: none;
  background: rgba(8, 14, 28, 0.82);
  backdrop-filter: var(--glass-blur-strong) saturate(1.6);
  -webkit-backdrop-filter: var(--glass-blur-strong) saturate(1.6);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-md); padding: 3px;
  box-shadow: var(--shadow-glass);
  transition: all 0.2s var(--ease-spring);
  z-index: 10;
}
/* Shine on actions bar */
.message-actions::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 50%;
  background: var(--glass-shine);
  border-radius: inherit; pointer-events: none;
}
.message-actions button {
  width: 30px; height: 28px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 12px; transition: all var(--duration-fast);
  position: relative;
}
.message-actions button:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text-primary);
  box-shadow: 0 0 12px rgba(106,171,255,0.06);
}

/* ─── Image Messages — Gallery Style ─── */
.message-image-grid {
  display: grid; gap: 4px; margin-top: 10px; max-width: 480px;
}
.message-image-grid.single { grid-template-columns: 1fr; max-width: 380px; }
.message-image-grid.double { grid-template-columns: 1fr 1fr; }
.message-image-grid.multi { grid-template-columns: 1fr 1fr; }

.message-image {
  border-radius: var(--radius-lg); overflow: hidden; cursor: pointer;
  position: relative;
  background: rgba(255,255,255,0.02);
  aspect-ratio: 4/3;
  border: 1px solid var(--glass-border);
  transition: all var(--duration-normal) var(--ease-out);
}
.message-image img {
  transition: transform 0.4s var(--ease-out);
}
.message-image:hover {
  border-color: rgba(106,171,255,0.4);
  box-shadow: 0 4px 30px rgba(106,171,255,0.14), 0 0 60px rgba(0,0,0,0.2);
}
.message-image:hover img {
  transform: scale(1.05);
}
/* Hover overlay with zoom icon */
.message-image::after {
  content: '\f00e'; font-family: 'Font Awesome 5 Free'; font-weight: 900;
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3);
  color: white; font-size: 24px;
  opacity: 0; transition: opacity 0.25s;
  border-radius: inherit;
  pointer-events: none;
}
.message-image:hover::after { opacity: 1; }

.message-image .image-badge {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: white;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: var(--glass-inner-shadow);
  z-index: 1;
}
/* Image type label */
.message-image .image-type-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(16px);
  color: white;
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 1; text-transform: uppercase;
}

/* ─── File Message — Card Style ─── */
.message-file {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  margin-top: 8px; max-width: 380px; cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--glass-inner-shadow);
  position: relative; overflow: hidden;
}
.message-file::after {
  content: ''; position: absolute; inset: 0;
  background: var(--glass-shine);
  pointer-events: none; opacity: 0;
  transition: opacity var(--duration-normal);
}
.message-file:hover {
  border-color: rgba(106,171,255,0.35);
  background: rgba(255,255,255,0.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glass-hover);
}
.message-file:hover::after { opacity: 1; }
.message-file .file-icon {
  font-size: 24px; color: var(--brand-primary);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(106,171,255,0.08);
  border-radius: var(--radius-md);
  border: 1px solid rgba(106,171,255,0.12);
}
.message-file .file-info { flex: 1; }
.message-file .file-name { font-size: 13px; font-weight: 600; }
.message-file .file-size { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.message-file .file-download-icon {
  color: var(--text-muted); font-size: 12px;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.message-file:hover .file-download-icon {
  color: var(--brand-primary);
  background: rgba(106,171,255,0.1);
}

/* System Message */
.system-message { text-align: center; padding: 8px 0; }
.system-content {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 18px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border-light);
  border-radius: var(--radius-full);
  font-size: 11.5px; color: var(--text-muted);
  box-shadow: var(--glass-inner-shadow);
  font-weight: 500;
}
.system-content i { font-size: 10px; }

/* ═══════════════════════════════════════════════
   MESSAGE INPUT — Premium Glass Bar v3.0
   ═══════════════════════════════════════════════ */
.message-input-area {
  padding: 10px 24px 14px;
  border-top: 1px solid var(--glass-border-light);
  background: rgba(4, 8, 18, 0.32);
  backdrop-filter: var(--glass-blur-strong) saturate(1.6);
  -webkit-backdrop-filter: var(--glass-blur-strong) saturate(1.6);
  flex-shrink: 0;
  position: relative; z-index: 2;
}
/* Top refraction line */
.message-input-area::before {
  content: ''; position: absolute; top: -1px; left: 3%; right: 3%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(106,171,255,0.1), rgba(167,139,250,0.06), transparent);
}

.message-input-wrapper {
  display: flex; align-items: flex-end; gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl); padding: 6px 12px;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--glass-inner-shadow), var(--glass-inner-glow);
  position: relative;
}
/* Shine overlay on input */
.message-input-wrapper::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--glass-shine);
  border-radius: inherit; pointer-events: none;
  opacity: 0.4;
  transition: opacity var(--duration-normal);
}
.message-input-wrapper:focus-within {
  border-color: rgba(106,171,255,0.5);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 
    0 0 0 4px rgba(106,171,255,0.08),
    0 0 40px rgba(106,171,255,0.1),
    var(--glass-inner-shadow),
    var(--glass-inner-glow);
}
.message-input-wrapper:focus-within::before { opacity: 0.7; }

.message-input-tools { display: flex; gap: 1px; flex-shrink: 0; position: relative; z-index: 1; }
.message-input-tools button {
  width: 36px; height: 36px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: all var(--duration-fast);
}
.message-input-tools button:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}
.urgent-btn { color: var(--color-danger) !important; }
.urgent-btn:hover { 
  background: rgba(248,113,113,0.14) !important; 
  box-shadow: 0 0 16px rgba(248,113,113,0.12);
}

.message-input-text {
  flex: 1; min-height: 36px; max-height: 120px;
  background: transparent; border: none; color: var(--text-primary);
  font-size: 14px; line-height: 1.5; resize: none; outline: none;
  font-family: inherit; position: relative; z-index: 1;
}
.message-input-text::placeholder { color: var(--text-muted); }

.send-btn {
  width: 36px; height: 36px; border: none; border-radius: var(--radius-md);
  background: var(--brand-gradient); color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
  transition: all var(--duration-normal) var(--ease-spring);
  box-shadow: var(--brand-glow), inset 0 1px 0 rgba(255,255,255,0.3);
  position: relative; overflow: hidden; z-index: 1;
}
.send-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, transparent 50%);
  border-radius: inherit;
}
.send-btn:hover {
  transform: scale(1.14);
  box-shadow: var(--brand-glow-strong), inset 0 1px 0 rgba(255,255,255,0.35), 0 0 30px rgba(106,171,255,0.2);
}
.send-btn:active { transform: scale(0.92); }
.send-btn:disabled { opacity: 0.2; cursor: default; transform: none; box-shadow: none; }

/* ═══════════════════════════════════════════════
   DETAIL PANEL — Frosted Glass (Mica Layer 3)
   ═══════════════════════════════════════════════ */
.detail-panel {
  width: var(--detail-w); min-width: var(--detail-w);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-strong) saturate(1.8) brightness(1.03);
  -webkit-backdrop-filter: var(--glass-blur-strong) saturate(1.8) brightness(1.03);
  border-left: 1px solid var(--glass-border);
  display: flex; flex-direction: column;
  transition: all var(--duration-slow) var(--ease-out);
  position: relative; overflow: hidden;
}
/* Prismatic refraction edge */
.detail-panel::before {
  content: ''; position: absolute; top: 0; left: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, 
    rgba(106,171,255,0.25) 0%, 
    rgba(167,139,250,0.2) 25%, 
    rgba(56,189,248,0.18) 50%, 
    rgba(52,211,153,0.12) 75%, 
    transparent 100%);
  z-index: 1;
  animation: refractionPulse 8s ease-in-out infinite;
}
.detail-panel::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--glass-shine);
  pointer-events: none;
}
.detail-panel.hidden { width: 0; min-width: 0; overflow: hidden; border: none; }

.detail-header {
  height: var(--header-h); padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--glass-border-light); flex-shrink: 0;
  position: relative; z-index: 2;
}
.detail-title { font-size: 14px; font-weight: 700; }
.detail-header button {
  width: 30px; height: 30px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast);
}
.detail-header button:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.detail-content { flex: 1; overflow-y: auto; position: relative; z-index: 2; }

/* Patient Card — Premium Glass with Neon Edge */
.patient-card {
  margin: 16px; padding: 22px;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(36px) saturate(1.6);
  -webkit-backdrop-filter: blur(36px) saturate(1.6);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-2xl);
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-glass);
}
.patient-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--brand-gradient);
  box-shadow: 0 0 25px rgba(106,171,255,0.35);
}
.patient-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--glass-shine-strong);
  pointer-events: none;
}
.patient-card .patient-name {
  font-size: 17px; font-weight: 800;
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
  position: relative; z-index: 1;
}
.patient-meta {
  margin-top: 12px; display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--text-secondary);
  position: relative; z-index: 1;
}
.meta-item { display: flex; align-items: center; gap: 8px; }
.meta-label { color: var(--text-muted); min-width: 56px; font-size: 12px; font-weight: 600; }
.patient-temp {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 12px; border-radius: var(--radius-full); font-size: 12px; font-weight: 700;
  backdrop-filter: blur(10px);
  border: 1px solid transparent;
  box-shadow: var(--glass-inner-shadow);
}
.patient-temp.hot {
  background: rgba(248,113,113,0.14); color: var(--temp-hot);
  border-color: rgba(248,113,113,0.28);
  box-shadow: 0 0 14px rgba(248,113,113,0.1), var(--glass-inner-shadow);
}
.patient-temp.warm {
  background: rgba(251,191,36,0.14); color: var(--temp-warm);
  border-color: rgba(251,191,36,0.28);
}
.patient-temp.cool {
  background: rgba(96,165,250,0.14); color: var(--temp-cool);
  border-color: rgba(96,165,250,0.28);
}

.patient-crm-link {
  margin-top: 16px; padding: 12px 14px;
  background: rgba(106,171,255,0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(106,171,255,0.2);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--brand-primary); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--duration-normal);
  position: relative; z-index: 1;
  box-shadow: var(--glass-inner-shadow);
}
.patient-crm-link:hover {
  background: rgba(106,171,255,0.16);
  border-color: rgba(106,171,255,0.35);
  box-shadow: 0 0 35px rgba(106,171,255,0.15), var(--glass-inner-shadow);
  transform: translateY(-1px);
}

/* Thread Timeline */
.thread-timeline { padding: 8px 16px; }
.timeline-item {
  display: flex; gap: 10px; padding: 10px 0;
  border-left: 2px solid var(--glass-border);
  margin-left: 8px; padding-left: 18px; position: relative;
}
.timeline-item::before {
  content: ''; position: absolute; left: -5px; top: 16px;
  width: 8px; height: 8px; border-radius: var(--radius-full);
  background: var(--brand-primary);
  box-shadow: 0 0 16px rgba(106,171,255,0.7), 0 0 30px rgba(106,171,255,0.3);
}
.timeline-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.timeline-content { flex: 1; font-size: 13px; line-height: 1.6; }
.timeline-channel {
  font-size: 11px; color: var(--brand-secondary); font-weight: 600;
  margin-bottom: 2px;
}

/* File Explorer */
.file-explorer { padding: 12px; }
.file-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.file-tab {
  padding: 7px 16px; border-radius: var(--radius-full); font-size: 12.5px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary); cursor: pointer; white-space: nowrap;
  transition: all var(--duration-normal) var(--ease-out);
  font-weight: 500;
  box-shadow: var(--glass-inner-shadow);
}
.file-tab.active {
  background: rgba(106,171,255,0.16);
  border-color: rgba(106,171,255,0.38);
  color: white;
  box-shadow: 0 0 22px rgba(106,171,255,0.16), var(--glass-inner-shadow);
}
.file-tab:hover:not(.active) {
  background: rgba(255,255,255,0.07);
  border-color: var(--glass-border-strong);
}

.file-folder { margin: 4px 0; }
.file-folder-header {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border-radius: var(--radius-md); cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--duration-fast);
  border: 1px solid transparent;
}
.file-folder-header:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--glass-border-light);
  color: var(--text-primary);
}
.file-folder-header i { color: var(--color-warning); }

.file-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0;
}
.file-thumb {
  aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden;
  background: rgba(255,255,255,0.02); cursor: pointer; position: relative;
  border: 1px solid var(--glass-border);
  transition: all var(--duration-normal) var(--ease-out);
}
.file-thumb:hover {
  border-color: rgba(106,171,255,0.35);
  transform: scale(1.04);
  box-shadow: 0 0 28px rgba(106,171,255,0.12);
}
.file-thumb-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 4px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  font-size: 10px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Directory */
.directory { padding: 12px; }
.dept-group { margin-bottom: 12px; }
.dept-header {
  padding: 6px 8px; font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--glass-border-light); margin-bottom: 4px;
}
.staff-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-md); cursor: pointer;
  transition: all var(--duration-fast);
  border: 1px solid transparent;
}
.staff-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--glass-border-light);
  box-shadow: var(--glass-inner-shadow);
}
.staff-info { flex: 1; }
.staff-name { font-size: 13px; font-weight: 600; }
.staff-position { font-size: 11px; color: var(--text-muted); }
.staff-location {
  font-size: 11px; color: var(--brand-secondary);
  display: flex; align-items: center; gap: 4px;
}

/* ═══════════════════════════════════════════════
   BOARD VIEW — Glass Card Grid with Depth
   ═══════════════════════════════════════════════ */
.board-container { flex: 1; overflow-y: auto; padding: 20px; position: relative; z-index: 1; }
.board-header-bar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
}
.board-filters { display: flex; gap: 6px; }
.board-filter-btn {
  padding: 7px 18px; border-radius: var(--radius-full); font-size: 12.5px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary); cursor: pointer; font-weight: 500;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--glass-inner-shadow);
}
.board-filter-btn.active {
  background: rgba(106,171,255,0.16);
  border-color: rgba(106,171,255,0.38);
  color: white;
  box-shadow: 0 0 22px rgba(106,171,255,0.16), var(--glass-inner-shadow);
}
.board-filter-btn:hover:not(.active) {
  background: rgba(255,255,255,0.07);
  border-color: var(--glass-border-strong);
}

.board-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px;
}
.board-card {
  padding: 22px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--glass-inner-shadow);
  position: relative; overflow: hidden;
}
.board-card::before {
  content: ''; position: absolute; top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  opacity: 0; transition: opacity var(--duration-normal);
}
.board-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--glass-shine-strong);
  pointer-events: none; opacity: 0;
  transition: opacity var(--duration-normal);
}
.board-card:hover {
  border-color: rgba(106,171,255,0.28);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glass-hover);
}
.board-card:hover::before { opacity: 1; }
.board-card:hover::after { opacity: 1; }
.board-card.must-read { border-left: 3px solid var(--color-danger); }
.board-card.pinned { border-left: 3px solid var(--color-warning); }
.card-category {
  font-size: 10.5px; font-weight: 700; padding: 4px 12px;
  border-radius: var(--radius-full); display: inline-block; margin-bottom: 10px;
  letter-spacing: 0.3px;
  backdrop-filter: blur(10px); border: 1px solid transparent;
  box-shadow: var(--glass-inner-shadow);
}
.card-category.notice {
  background: rgba(106,171,255,0.12); color: var(--brand-primary);
  border-color: rgba(106,171,255,0.2);
}
.card-category.manual {
  background: rgba(52,211,153,0.12); color: var(--color-success);
  border-color: rgba(52,211,153,0.2);
}
.card-category.free {
  background: rgba(255,255,255,0.05); color: var(--text-secondary);
  border-color: var(--glass-border);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.card-excerpt {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-footer {
  margin-top: 14px; display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-muted);
}
.card-footer .unread-dot {
  width: 8px; height: 8px; border-radius: var(--radius-full);
  background: var(--brand-primary);
  box-shadow: 0 0 14px rgba(106,171,255,0.7);
  animation: neonPulse 2s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════
   IMAGE VIEWER — Full glass overlay
   ═══════════════════════════════════════════════ */
.image-viewer-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(50px) saturate(1.6);
  -webkit-backdrop-filter: blur(50px) saturate(1.6);
  display: flex; flex-direction: column;
  animation: viewerFadeIn 0.25s var(--ease-out);
}
@keyframes viewerFadeIn { from { opacity: 0; } to { opacity: 1; } }

.image-viewer-header {
  height: 56px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; color: white;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.viewer-title { font-size: 14px; font-weight: 600; }
.image-viewer-header button {
  width: 36px; height: 36px; border: none; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(16px);
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast);
  border: 1px solid rgba(255,255,255,0.1);
}
.image-viewer-header button:hover { background: rgba(255,255,255,0.14); }

.image-viewer-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border: none; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast); font-size: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: var(--glass-inner-shadow);
}
.viewer-nav:hover { background: rgba(255,255,255,0.16); transform: translateY(-50%) scale(1.08); }
.viewer-nav.prev { left: 20px; }
.viewer-nav.next { right: 20px; }

.image-viewer-toolbar {
  height: 64px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.image-viewer-toolbar button {
  padding: 9px 20px; border: none; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(20px);
  color: white; cursor: pointer;
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500;
  transition: all var(--duration-fast);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: var(--glass-inner-shadow);
}
.image-viewer-toolbar button:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 0 20px rgba(106,171,255,0.08), var(--glass-inner-shadow);
}

/* ═══════════════════════════════════════════════
   URGENT CALL OVERLAY
   ═══════════════════════════════════════════════ */
.urgent-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: linear-gradient(145deg, rgba(220,38,38,0.92), rgba(185,28,28,0.92));
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: white; text-align: center;
  animation: urgentSlideIn 0.3s var(--ease-out);
}
@keyframes urgentSlideIn { from { transform: scale(1.05); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.urgent-overlay .urgent-icon {
  font-size: 72px; margin-bottom: 20px;
  animation: urgentPulse 1s ease-in-out infinite;
  filter: drop-shadow(0 0 50px rgba(255,255,255,0.35));
}
@keyframes urgentPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }

.urgent-overlay .urgent-title { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.urgent-overlay .urgent-message { font-size: 18px; margin-top: 8px; font-weight: 500; opacity: 0.9; }
.urgent-overlay .urgent-caller { font-size: 14px; opacity: 0.6; margin-top: 8px; }
.urgent-overlay .urgent-ack-btn {
  margin-top: 36px; padding: 16px 60px; font-size: 17px; font-weight: 800;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(16px);
  color: #dc2626; border: none;
  border-radius: var(--radius-xl); cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.5);
  letter-spacing: 0.5px;
}
.urgent-overlay .urgent-ack-btn:hover { transform: scale(1.05); }
.urgent-overlay .urgent-ack-btn:active { transform: scale(0.97); }

/* ═══════════════════════════════════════════════
   MODALS — Ultra Frosted Glass with Edge Glow
   ═══════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,0.38);
  backdrop-filter: blur(14px) saturate(1.6);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  display: flex; align-items: center; justify-content: center;
  animation: viewerFadeIn 0.15s var(--ease-out);
}
.modal-content {
  background: rgba(8, 14, 28, 0.58);
  backdrop-filter: var(--glass-blur-ultra) saturate(2);
  -webkit-backdrop-filter: var(--glass-blur-ultra) saturate(2);
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-2xl); max-width: 480px; width: 92%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-xl), 0 0 100px rgba(0,0,0,0.25);
  animation: modalSlideUp 0.3s var(--ease-out);
  position: relative; overflow: hidden;
}
/* Top refraction — rainbow prismatic line */
.modal-content::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 3%, 
    rgba(106,171,255,0.35) 25%, 
    rgba(167,139,250,0.3) 50%, 
    rgba(56,189,248,0.35) 75%, 
    transparent 97%);
  z-index: 1;
}
.modal-content::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--glass-shine-strong);
  pointer-events: none;
}
@keyframes modalSlideUp { from { transform: translateY(20px) scale(0.96); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

.modal-header {
  padding: 18px 22px; border-bottom: 1px solid var(--glass-border-light);
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-header button {
  width: 30px; height: 30px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast);
}
.modal-header button:hover { background: rgba(255,255,255,0.1); }
.modal-body { padding: 22px; position: relative; z-index: 1; }
.modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--glass-border-light);
  display: flex; justify-content: flex-end; gap: 8px;
  position: relative; z-index: 1;
}

.btn {
  padding: 10px 24px; border: none; border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
  letter-spacing: 0.2px;
  position: relative; overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--brand-gradient); color: white;
  box-shadow: var(--brand-glow), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, transparent 50%);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--brand-glow-strong), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn-secondary {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  box-shadow: var(--glass-inner-shadow);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-danger {
  background: linear-gradient(135deg, #f87171, #dc2626);
  color: white;
  box-shadow: var(--shadow-glow-red), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-danger::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
}

/* ═══════════════════════════════════════════════
   SEARCH — Frosted Glass Panel
   ═══════════════════════════════════════════════ */
.search-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0,0,0,0.32);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 10vh;
}
.search-panel {
  width: 92%; max-width: 620px;
  background: rgba(8, 14, 28, 0.52);
  backdrop-filter: var(--glass-blur-ultra) saturate(2);
  -webkit-backdrop-filter: var(--glass-blur-ultra) saturate(2);
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl), var(--brand-glow-ultra);
  overflow: hidden;
  max-height: 65vh; display: flex; flex-direction: column;
  animation: modalSlideUp 0.2s var(--ease-out);
  position: relative;
}
.search-panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 3%, rgba(106,171,255,0.3) 30%, rgba(255,255,255,0.25) 50%, 
    rgba(56,189,248,0.3) 70%, transparent 97%);
  z-index: 1;
}
.search-panel::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--glass-shine-strong);
  pointer-events: none;
}
.search-input-bar {
  padding: 16px 20px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--glass-border-light);
  position: relative; z-index: 1;
}
.search-input-bar i { color: var(--text-muted); font-size: 15px; }
.search-input-bar input {
  flex: 1; background: transparent; border: none;
  color: var(--text-primary); font-size: 16px; outline: none;
  font-weight: 500;
}
.search-input-bar input::placeholder { color: var(--text-muted); }
.search-filters {
  padding: 8px 18px; display: flex; gap: 6px;
  border-bottom: 1px solid var(--glass-border-light);
  position: relative; z-index: 1;
}
.search-results { flex: 1; overflow-y: auto; padding: 4px 0; position: relative; z-index: 1; }
.search-result-item {
  padding: 10px 20px; cursor: pointer;
  transition: all var(--duration-fast);
  display: flex; gap: 12px;
  border-bottom: 1px solid var(--glass-border-light);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(255,255,255,0.06); }
.result-icon {
  width: 34px; height: 34px; border-radius: var(--radius-md);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); flex-shrink: 0;
  box-shadow: var(--glass-inner-shadow);
}
.result-body { flex: 1; min-width: 0; }
.result-title { font-size: 13.5px; font-weight: 600; }
.result-meta { font-size: 11.5px; color: var(--text-muted); }
.result-preview {
  font-size: 13px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.result-preview mark {
  background: rgba(106,171,255,0.35); color: var(--text-primary);
  border-radius: 2px; padding: 0 2px;
}

/* ═══ Popups — Glass ═══ */
.emoji-picker {
  position: absolute; z-index: 50;
  background: rgba(8, 14, 28, 0.8);
  backdrop-filter: var(--glass-blur-strong) saturate(1.8);
  -webkit-backdrop-filter: var(--glass-blur-strong) saturate(1.8);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg); padding: 8px; width: 260px;
  box-shadow: var(--shadow-glass);
  animation: modalSlideUp 0.15s var(--ease-out);
}
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-grid button {
  width: 100%; aspect-ratio: 1; border: none; border-radius: var(--radius-sm);
  background: transparent; cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast) var(--ease-spring);
}
.emoji-grid button:hover { background: rgba(255,255,255,0.12); transform: scale(1.25); }

.read-detail-popup {
  position: absolute; z-index: 60;
  background: rgba(8, 14, 28, 0.85);
  backdrop-filter: var(--glass-blur-strong) saturate(1.8);
  -webkit-backdrop-filter: var(--glass-blur-strong) saturate(1.8);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg); padding: 14px; width: 240px;
  box-shadow: var(--shadow-glass);
  animation: modalSlideUp 0.15s var(--ease-out);
}
.read-section { margin-bottom: 10px; }
.read-section-title { font-size: 11px; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; letter-spacing: 0.3px; }
.read-user { font-size: 12.5px; padding: 3px 0; display: flex; align-items: center; gap: 6px; }
.read-check { color: var(--color-success); }
.unread-user { color: var(--text-muted); }

.status-dropdown {
  position: absolute; bottom: 100%; left: 0; margin-bottom: 8px;
  background: rgba(8, 14, 28, 0.85);
  backdrop-filter: var(--glass-blur-strong) saturate(1.8);
  -webkit-backdrop-filter: var(--glass-blur-strong) saturate(1.8);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg); padding: 6px; width: 200px;
  box-shadow: var(--shadow-glass); z-index: 50;
  animation: modalSlideUp 0.15s var(--ease-out);
}
.status-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; transition: all var(--duration-fast);
  border: 1px solid transparent;
}
.status-option:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--glass-border-light);
}

/* ═══ UTILITIES ═══ */
.loading-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--glass-border);
  border-top-color: var(--brand-primary);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast — Frosted Glass with neon edge */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 180;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 13px 24px; border-radius: var(--radius-lg);
  background: rgba(8, 14, 28, 0.75);
  backdrop-filter: var(--glass-blur-strong) saturate(1.8);
  -webkit-backdrop-filter: var(--glass-blur-strong) saturate(1.8);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--shadow-glass);
  font-size: 13.5px; font-weight: 500;
  animation: toastSlide 0.3s var(--ease-out);
  display: flex; align-items: center; gap: 8px;
  position: relative; overflow: hidden;
}
.toast::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}
.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-danger); }
.toast.info { border-left: 3px solid var(--brand-primary); }
@keyframes toastSlide { from { transform: translateX(100%) scale(0.95); opacity: 0; } to { transform: translateX(0) scale(1); opacity: 1; } }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* Empty State */
.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); gap: 8px; padding: 40px 20px;
}
.empty-state i { font-size: 40px; opacity: 0.12; }
.empty-state .empty-title { font-size: 15px; font-weight: 700; color: var(--text-secondary); }
.empty-state .empty-desc { font-size: 13px; text-align: center; max-width: 280px; line-height: 1.6; }

/* ═══ POLLING INDICATOR ═══ */
.poll-indicator {
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.3s;
  color: var(--text-muted);
}
.poll-indicator.active {
  color: var(--color-success);
  animation: pollBlink 2s ease-in-out infinite;
}
@keyframes pollBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ═══ MARKUP TOOL BUTTONS ═══ */
.markup-tool-btn {
  width: 32px; height: 32px; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; background: rgba(255,255,255,0.05);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all 0.2s;
}
.markup-tool-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
  color: white;
}
.markup-tool-btn.active {
  background: rgba(106,171,255,0.25);
  border-color: rgba(106,171,255,0.5);
  color: white;
  box-shadow: 0 0 12px rgba(106,171,255,0.15);
}

/* ═══ DRAG AND DROP ZONE ═══ */
.messages-container.drag-over {
  outline: 2px dashed var(--brand-primary) !important;
  outline-offset: -4px;
  background: rgba(106,171,255,0.04);
}

/* ═══════════════════════════════════════════════
   MICRO-INTERACTIONS & SCROLL ANIMATIONS v3.0
   - IntersectionObserver entry animations
   - Message send/receive transitions
   - Ripple effects, skeleton loading
   - Enhanced hover states & spring physics
   ═══════════════════════════════════════════════ */

/* ─── Scroll-triggered Entry Animations ─── */
.msg-enter {
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out);
}
.msg-enter.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* Staggered entry for consecutive messages */
.msg-enter:nth-child(2) { transition-delay: 0.04s; }
.msg-enter:nth-child(3) { transition-delay: 0.08s; }
.msg-enter:nth-child(4) { transition-delay: 0.12s; }
.msg-enter:nth-child(5) { transition-delay: 0.16s; }

/* Board card stagger entry */
.board-card.msg-enter { transform: translateY(24px) scale(0.95); }
.board-card.msg-enter.visible { transform: translateY(0) scale(1); }
.board-grid .board-card.msg-enter:nth-child(1) { transition-delay: 0.05s; }
.board-grid .board-card.msg-enter:nth-child(2) { transition-delay: 0.10s; }
.board-grid .board-card.msg-enter:nth-child(3) { transition-delay: 0.15s; }
.board-grid .board-card.msg-enter:nth-child(4) { transition-delay: 0.20s; }
.board-grid .board-card.msg-enter:nth-child(5) { transition-delay: 0.25s; }
.board-grid .board-card.msg-enter:nth-child(6) { transition-delay: 0.30s; }

/* ─── New Message Slide-in ─── */
@keyframes msgSlideIn {
  0% { opacity: 0; transform: translateX(-16px) translateY(10px) scale(0.96); }
  60% { opacity: 1; transform: translateX(2px) translateY(0) scale(1.01); }
  100% { opacity: 1; transform: translateX(0) translateY(0) scale(1); }
}
.msg-new {
  animation: msgSlideIn 0.5s var(--ease-spring) forwards;
}

/* Sent by me — slide from right */
@keyframes msgSendPop {
  0% { opacity: 0; transform: translateY(12px) scale(0.92); }
  50% { transform: translateY(-2px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.msg-sent {
  animation: msgSendPop 0.4s var(--ease-spring) forwards;
}

/* ─── Ripple Effect ─── */
.ripple-container {
  position: relative;
  overflow: hidden;
}
@keyframes rippleEffect {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0.35; }
  100% { transform: translate(-50%, -50%) scale(4); opacity: 0; }
}
.ripple {
  position: absolute;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(106,171,255,0.4) 0%, transparent 70%);
  pointer-events: none;
  animation: rippleEffect 0.6s var(--ease-out) forwards;
  z-index: 5;
}

/* ─── Channel Switch Transition ─── */
@keyframes channelFadeIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.channel-transition {
  animation: channelFadeIn 0.35s var(--ease-out) forwards;
}

/* ─── Enhanced Hover Micro-interactions ─── */
/* Channel items — tilt on hover */
.channel-item {
  transform-origin: left center;
  will-change: transform, background;
}
.channel-item:hover {
  transform: translateX(3px);
}
.channel-item:active {
  transform: translateX(1px) scale(0.98);
  transition-duration: 0.08s;
}
.channel-item.active:hover {
  transform: translateX(2px);
}

/* Header buttons — bounce on hover */
.chat-header-right button {
  will-change: transform;
}
.chat-header-right button:hover {
  transform: translateY(-1px);
}
.chat-header-right button:active {
  transform: translateY(1px) scale(0.92);
  transition-duration: 0.06s;
}

/* Message hover — subtle lift */
.message-group {
  will-change: transform, background;
}
.message-group:hover {
  transform: translateX(2px);
}

/* Board cards — 3D tilt micro-interaction */
.board-card {
  will-change: transform, box-shadow;
  transform-style: preserve-3d;
  perspective: 800px;
}
.board-card:hover {
  transform: translateY(-4px) rotateX(1deg);
}
.board-card:active {
  transform: translateY(-2px) scale(0.98);
  transition-duration: 0.08s;
}

/* Patient tag — pulse glow on hover */
.patient-tag {
  will-change: transform, box-shadow;
}
.patient-tag:hover {
  transform: translateY(-2px) scale(1.03);
}
.patient-tag:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.08s;
}

/* Send button — heartbeat when enabled */
@keyframes sendReady {
  0%, 100% { box-shadow: var(--brand-glow), inset 0 1px 0 rgba(255,255,255,0.3); }
  50% { box-shadow: var(--brand-glow-strong), inset 0 1px 0 rgba(255,255,255,0.35), 0 0 40px rgba(106,171,255,0.25); }
}
.send-btn:not(:disabled) {
  animation: sendReady 2.5s ease-in-out infinite;
}
.send-btn:not(:disabled):hover {
  animation: none;
}

/* Reaction chips — wobble */
@keyframes reactionPop {
  0% { transform: scale(0.5) rotate(-15deg); }
  60% { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.reaction-chip {
  will-change: transform;
}
.reaction-chip:active {
  animation: reactionPop 0.35s var(--ease-spring);
}

/* File thumbnail — zoom on hover with glow border */
.file-thumb {
  will-change: transform;
}
.file-thumb:hover {
  transform: scale(1.06);
  z-index: 2;
}
.file-thumb:active {
  transform: scale(0.98);
  transition-duration: 0.08s;
}

/* ─── Skeleton Loading ─── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.03) 0%,
    rgba(255,255,255,0.08) 40%,
    rgba(255,255,255,0.03) 80%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-md);
}
.skeleton-msg {
  display: flex; gap: 12px; padding: 10px; margin: 4px 0;
}
.skeleton-avatar {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
}
.skeleton-content { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.skeleton-line { height: 12px; border-radius: 6px; }
.skeleton-line:nth-child(1) { width: 35%; }
.skeleton-line:nth-child(2) { width: 85%; }
.skeleton-line:nth-child(3) { width: 60%; }

/* ─── Enhanced Toast Animation ─── */
@keyframes toastEnter {
  0% { transform: translateX(120%) scale(0.85) rotate(2deg); opacity: 0; filter: blur(4px); }
  50% { transform: translateX(-8px) scale(1.02) rotate(-0.5deg); opacity: 1; filter: blur(0); }
  100% { transform: translateX(0) scale(1) rotate(0deg); opacity: 1; filter: blur(0); }
}
@keyframes toastExit {
  0% { transform: translateX(0) scale(1); opacity: 1; }
  100% { transform: translateX(120%) scale(0.85); opacity: 0; filter: blur(4px); }
}
.toast {
  animation: toastEnter 0.5s var(--ease-spring) forwards;
}
.toast.exiting {
  animation: toastExit 0.35s var(--ease-out) forwards;
}
/* Toast progress bar */
.toast-progress {
  position: absolute; bottom: 0; left: 0; height: 2px;
  background: var(--brand-gradient);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: toastProgressShrink 3s linear forwards;
}
@keyframes toastProgressShrink {
  0% { width: 100%; }
  100% { width: 0%; }
}

/* ─── Unread Badge Enhanced Pop ─── */
@keyframes badgePopEnhanced {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  50% { transform: scale(1.3) rotate(10deg); opacity: 1; }
  70% { transform: scale(0.9) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.unread-badge {
  animation: badgePopEnhanced 0.5s var(--ease-spring);
}
/* Glow breathing on unread badge */
@keyframes badgeGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(248,113,113,0.4), inset 0 1px 0 rgba(255,255,255,0.25); }
  50% { box-shadow: 0 0 22px rgba(248,113,113,0.7), inset 0 1px 0 rgba(255,255,255,0.3); }
}
.unread-badge {
  animation: badgePopEnhanced 0.5s var(--ease-spring), badgeGlow 2s ease-in-out infinite 0.5s;
}

/* ─── Date Separator Slide ─── */
.date-separator.msg-enter {
  opacity: 0;
  transform: scaleX(0.6);
}
.date-separator.msg-enter.visible {
  opacity: 1;
  transform: scaleX(1);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-spring);
}

/* ─── Pinned Bar Slide ─── */
@keyframes pinnedBarSlide {
  0% { transform: translateY(-100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
.pinned-bar {
  animation: pinnedBarSlide 0.35s var(--ease-out);
}

/* ─── Modal Backdrop Blur Transition ─── */
.modal-backdrop {
  animation: backdropFadeIn 0.2s var(--ease-out);
}
@keyframes backdropFadeIn {
  0% { backdrop-filter: blur(0); background: transparent; }
  100% { backdrop-filter: blur(14px) saturate(1.6); background: rgba(0,0,0,0.38); }
}

/* ─── Image Viewer Enhanced Zoom ─── */
@keyframes viewerImageZoom {
  0% { opacity: 0; transform: scale(0.85); filter: blur(8px); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
.image-viewer-body img {
  animation: viewerImageZoom 0.4s var(--ease-out);
}
.viewer-nav { will-change: transform; }
.viewer-nav:hover {
  transform: translateY(-50%) scale(1.12);
}
.viewer-nav:active {
  transform: translateY(-50%) scale(0.95);
  transition-duration: 0.08s;
}

/* ─── Focus Ring Glow ─── */
input:focus, textarea:focus, select:focus {
  outline: none;
}
/* Enhanced input glow animation */
@keyframes focusGlow {
  0% { box-shadow: 0 0 0 0px rgba(106,171,255,0); }
  100% { box-shadow: 0 0 0 4px rgba(106,171,255,0.1), 0 0 30px rgba(106,171,255,0.08); }
}

/* ─── Sidebar Active Channel Indicator Enhanced ─── */
.channel-item.active::before {
  animation: activeGlow 3s ease-in-out infinite alternate, activeSlideIn 0.3s var(--ease-spring);
}
@keyframes activeSlideIn {
  0% { height: 0; opacity: 0; }
  100% { height: 50%; opacity: 1; }
}

/* ─── Typing Indicator Dots ─── */
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-6px); opacity: 1; }
}
.typing-indicator span:nth-child(1) { animation: typingDot 1.2s infinite 0s; }
.typing-indicator span:nth-child(2) { animation: typingDot 1.2s infinite 0.15s; }
.typing-indicator span:nth-child(3) { animation: typingDot 1.2s infinite 0.3s; }

/* ─── Confirm Button Pulse ─── */
@keyframes confirmPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(251,191,36,0.3), inset 0 1px 0 rgba(255,255,255,0.25); }
  50% { box-shadow: 0 4px 24px rgba(251,191,36,0.5), inset 0 1px 0 rgba(255,255,255,0.3), 0 0 40px rgba(251,191,36,0.15); }
}
.confirm-btn {
  animation: confirmPulse 2s ease-in-out infinite;
}
.confirm-btn:hover {
  animation: none;
}

/* ─── Detail Panel Slide Animation ─── */
.detail-panel.force-show {
  animation: detailSlideIn 0.4s var(--ease-out);
}
@keyframes detailSlideIn {
  0% { opacity: 0; transform: translateX(30px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ─── Patient Card Hover Tilt ─── */
.patient-card {
  transition: all var(--duration-normal) var(--ease-out);
  will-change: transform;
}
.patient-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glass-hover);
}

/* ─── Timeline Item Stagger ─── */
.timeline-item.msg-enter {
  opacity: 0;
  transform: translateX(-12px);
}
.timeline-item.msg-enter.visible {
  opacity: 1;
  transform: translateX(0);
}
.timeline-item:nth-child(1).msg-enter { transition-delay: 0.05s; }
.timeline-item:nth-child(2).msg-enter { transition-delay: 0.10s; }
.timeline-item:nth-child(3).msg-enter { transition-delay: 0.15s; }
.timeline-item:nth-child(4).msg-enter { transition-delay: 0.20s; }
.timeline-item:nth-child(5).msg-enter { transition-delay: 0.25s; }

/* ─── Empty State Float Animation ─── */
@keyframes emptyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.empty-state i, .empty-state > div:first-child {
  animation: emptyFloat 4s ease-in-out infinite;
}

/* ─── Scroll Shadow Indicators ─── */
.messages-container {
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 2%,
    black 98%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 2%,
    black 98%,
    transparent 100%
  );
}

/* ─── Message Actions Toolbar Enhanced ─── */
.message-actions {
  transform: translateY(4px);
}
.message-group:hover .message-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition: all 0.25s var(--ease-spring);
}
.message-actions button:active {
  transform: scale(0.85);
  transition-duration: 0.06s;
}

/* ─── Sidebar Search Expand Animation ─── */
.sidebar-search input:focus {
  transform: scaleX(1.02);
}

/* ─── Icon Button Press Effect ─── */
.icon-btn:active, .sidebar-actions button:active {
  transform: scale(0.85);
  transition-duration: 0.06s;
}

/* ─── Status Dot Breathing ─── */
.status-online {
  animation: statusBreath 3s ease-in-out infinite;
}
@keyframes statusBreath {
  0%, 100% { box-shadow: 0 0 8px rgba(52,211,153,0.5); }
  50% { box-shadow: 0 0 16px rgba(52,211,153,0.9); }
}

/* ─── Logo Hover Spin ─── */
.hospital-name .logo:hover {
  transform: scale(1.12) rotate(-8deg);
  animation: logoGlow 0.6s ease-out;
}
@keyframes logoGlow {
  0% { box-shadow: var(--brand-glow); }
  50% { box-shadow: 0 0 50px rgba(106,171,255,0.5), inset 0 1px 0 rgba(255,255,255,0.4); }
  100% { box-shadow: var(--brand-glow-strong), inset 0 1px 0 rgba(255,255,255,0.35); }
}

/* ─── File Message Hover Shimmer ─── */
.message-file::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  transition: left 0.5s ease;
  pointer-events: none;
}
.message-file:hover::before {
  left: 100%;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1100px) {
  .detail-panel:not(.force-show) { display: none; }
}

@media (max-width: 768px) {
  /* ─── Root: Override vars for mobile ─── */
  :root {
    --sidebar-w: 85vw;
    --header-h: 52px;
    --radius-lg: 14px;
    --radius-xl: 18px;
  }

  /* ─── Layout: Full mobile stack ─── */
  .app-layout { gap: 0; }

  /* ─── Sidebar: Slide drawer ─── */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 50;
    width: var(--sidebar-w); min-width: var(--sidebar-w);
    max-width: 320px;
    transform: translateX(-100%);
    backdrop-filter: blur(28px) saturate(1.5);
    -webkit-backdrop-filter: blur(28px) saturate(1.5);
    transition: transform 0.35s var(--ease-out);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 60px rgba(0,0,0,0.6);
  }
  .sidebar-header { height: 52px; padding: 0 12px; }
  .hospital-name { font-size: 14px; gap: 8px; }
  .hospital-name .logo { width: 30px; height: 30px; font-size: 13px; }
  .sidebar-actions button { width: 36px; height: 36px; font-size: 14px; }
  .sidebar-search { padding: 8px 10px; }
  .sidebar-search input { padding: 10px 12px 10px 34px; font-size: 14px; }
  .channel-item {
    padding: 11px 12px; margin: 2px 6px; font-size: 14px;
    min-height: 44px; /* iOS touch target */
  }
  .channel-item .channel-icon { font-size: 13px; }
  .dm-item { padding: 10px 12px; min-height: 44px; }
  .status-bar { padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0)); }

  /* ─── Overlay ─── */
  .mobile-menu-btn { display: flex !important; }
  .mobile-overlay {
    position: fixed; inset: 0; z-index: 45;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  /* ─── Detail panel: Full screen slide ─── */
  .detail-panel {
    position: fixed; right: 0; top: 0; bottom: 0; z-index: 55;
    width: 100% !important; min-width: 100% !important;
    transform: translateX(100%);
    background: rgba(4, 8, 18, 0.96);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    transition: transform 0.35s var(--ease-out);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .detail-panel.force-show { transform: translateX(0); }

  /* ─── Main panel mobile ─── */
  .main-panel {
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
  }

  /* ─── Chat header: compact mobile ─── */
  .chat-header {
    height: 52px; padding: 0 8px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    gap: 4px;
  }
  .chat-header-left { gap: 4px; }
  .chat-header-left .channel-title { font-size: 14px; }
  .chat-header-left .member-count { font-size: 11px; }
  .chat-header-right { gap: 0; }
  .chat-header-right button { width: 38px; height: 38px; font-size: 14px; }

  /* ─── Messages: Mobile optimized bubbles ─── */
  .messages-container { padding: 8px 8px 4px; }
  .message-group {
    padding: 10px 10px; margin: 2px 0;
    border-radius: var(--radius-lg);
  }
  .message-group .msg-avatar-wrap { display: none; }
  .msg-header { padding-left: 0; }
  .msg-header .msg-name { font-size: 13px; }
  .msg-body { padding-left: 0; font-size: 14px; line-height: 1.6; }
  .message-group.mine-message { padding-right: 10px; }

  /* ─── Message actions: Hidden on mobile (use longpress) ─── */
  .message-actions {
    display: none !important;
  }

  /* ─── Message images: Bigger on mobile ─── */
  .message-image-grid { max-width: 100%; }
  .message-image-grid.single { max-width: 100%; }

  /* ─── Message file attachments ─── */
  .message-file { padding: 10px 12px; }

  /* ─── Reactions: Larger touch targets ─── */
  .reaction-chip { padding: 5px 10px; font-size: 14px; }
  .reaction-chip .count { font-size: 11px; }

  /* ─── Input area: Mobile optimized ─── */
  .message-input-area {
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .message-input-wrapper {
    padding: 5px 8px;
    border-radius: var(--radius-xl);
  }
  .message-input-tools button { width: 38px; height: 38px; font-size: 16px; }
  .message-input-text { font-size: 16px; min-height: 38px; /* prevents iOS zoom */ }
  .send-btn { width: 40px; height: 40px; font-size: 15px; }
  /* Hide desktop keyboard hints on mobile */
  .message-input-area > div:last-child { display: none !important; }

  /* ─── Pinned bar ─── */
  .pinned-bar { padding: 8px 12px; font-size: 12px; }

  /* ─── Thread panel: full-screen on mobile ─── */
  .thread-panel { width: 100% !important; }
  .thread-overlay { backdrop-filter: blur(4px); }

  /* ─── Modals: Bottom sheet on mobile ─── */
  .modal-content, .invite-modal, .create-channel-modal, .search-modal {
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important; max-width: 100% !important;
    max-height: 90vh !important;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0 !important;
    animation: bottomSheetUp 0.35s var(--ease-out) !important;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .modal-content::after, .invite-modal::after {
    content: '';
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.2);
    z-index: 10;
  }

  /* ─── Login card: Full width ─── */
  .login-card {
    width: 100%; max-width: 100%;
    border-radius: 0;
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column; justify-content: center;
  }
  .login-card::before { display: none; }
  .login-header { padding: 32px 24px 20px; }
  .login-user-list { max-height: 50vh; }
  .login-user-item { padding: 14px 16px; min-height: 52px; }
  .login-tabs { padding: 0 20px; }
  .login-tab { padding: 13px 0; font-size: 14px; }
  .login-body { padding: 0 20px 20px; }
  .login-footer { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0)); }

  /* ─── Register form ─── */
  .reg-input { padding: 12px 14px; font-size: 16px; /* prevents iOS zoom */ }
  .reg-btn { padding: 14px; font-size: 15px; min-height: 48px; }
  .reg-row { flex-direction: column; gap: 14px; }

  /* ─── Toast: Full width ─── */
  .toast-container {
    top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0));
    right: 8px; left: 8px;
  }
  .toast { width: 100%; }

  /* ─── Emoji picker: Bottom sheet ─── */
  .emoji-picker {
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    top: auto !important;
    max-width: 100% !important;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0 !important;
    animation: bottomSheetUp 0.3s var(--ease-out) !important;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  /* ─── Status dropdown: Bottom sheet ─── */
  .status-dropdown {
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    top: auto !important;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0 !important;
    animation: bottomSheetUp 0.3s var(--ease-out) !important;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  /* ─── Board: Mobile grid ─── */
  .board-grid { grid-template-columns: 1fr !important; padding: 8px; gap: 8px; }
  .board-card { padding: 14px; }

  /* ─── Search modal: Top sheet on mobile ─── */
  .search-modal {
    top: 0 !important; bottom: auto !important;
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl) !important;
    animation: modalSlideDown 0.3s var(--ease-out) !important;
    max-height: 80vh !important;
    padding-top: env(safe-area-inset-top, 0);
  }

  /* ─── Date separator ─── */
  .date-separator span { font-size: 11px; padding: 3px 10px; }

  /* ─── Image viewer: Edge-to-edge ─── */
  .image-viewer { padding: 0; }
  .image-viewer img { border-radius: 0; max-height: 80vh; }

  /* ─── Empty state ─── */
  .empty-state { padding: 40px 20px; }

  /* ─── Mobile longpress action sheet ─── */
  .mobile-action-sheet {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    background: rgba(8, 14, 28, 0.96);
    backdrop-filter: blur(40px) saturate(1.8);
    -webkit-backdrop-filter: blur(40px) saturate(1.8);
    border-top: 1px solid var(--glass-border-bright);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
    animation: bottomSheetUp 0.3s var(--ease-out);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
  }
  .mobile-action-sheet::before {
    content: '';
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.2);
  }
  .mobile-action-sheet-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 20px;
    font-size: 15px; color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
    min-height: 48px;
  }
  .mobile-action-sheet-item:active {
    background: rgba(106,171,255,0.12);
  }
  .mobile-action-sheet-item i {
    width: 22px; text-align: center; font-size: 15px;
    color: var(--text-secondary);
  }
  .mobile-action-sheet-item.danger { color: var(--color-danger); }
  .mobile-action-sheet-item.danger i { color: var(--color-danger); }
  .mobile-action-sheet-cancel {
    margin-top: 4px; padding-top: 4px;
    border-top: 1px solid var(--border-subtle);
  }

  /* ─── Pull-to-refresh indicator ─── */
  .pull-to-refresh {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%) translateY(-40px);
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(8, 14, 28, 0.8);
    border: 1px solid var(--glass-border);
    color: var(--brand-primary); font-size: 14px;
    transition: transform 0.3s var(--ease-out), opacity 0.3s;
    opacity: 0; z-index: 5;
  }
  .pull-to-refresh.visible { opacity: 1; transform: translateX(-50%) translateY(8px); }
  .pull-to-refresh.loading i { animation: spin 0.7s linear infinite; }

  /* ─── Swipe back indicator ─── */
  .swipe-back-indicator {
    position: fixed; left: 0; top: 50%; transform: translateY(-50%) translateX(-100%);
    width: 28px; height: 56px;
    background: rgba(106,171,255,0.2);
    border-radius: 0 14px 14px 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--brand-primary); font-size: 12px;
    transition: transform 0.2s var(--ease-out);
    z-index: 100;
  }
  .swipe-back-indicator.visible { transform: translateY(-50%) translateX(0); }
}

@keyframes bottomSheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes bottomSheetDown {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}
@keyframes modalSlideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 769px) {
  .mobile-menu-btn { display: none !important; }
  .mobile-overlay { display: none !important; }
  .mobile-action-sheet { display: none !important; }
  .pull-to-refresh { display: none !important; }
  .swipe-back-indicator { display: none !important; }
}

/* ─── Touch device optimizations ─── */
@media (hover: none) and (pointer: coarse) {
  /* Ensure all interactive elements meet 44px minimum touch target */
  button, .channel-item, .dm-item, .login-user-item, .invite-list-item {
    min-height: 44px;
  }
  /* Disable hover effects that cause sticky states on touch */
  .channel-item:hover, .dm-item:hover {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
  .channel-item:hover::after { opacity: 0; }
  .channel-item.active { 
    background: rgba(106,171,255,0.16);
    border-color: rgba(106,171,255,0.28);
  }
  /* Hide avatar hover cards on touch */
  .avatar-hover-card { display: none !important; }
  /* Larger tap targets for message actions */
  .reaction-chip { min-height: 32px; }
}

/* ============================================================
   v2.3 — Feature Wiring: Thread, Edit, Mention, DM, Forward, Board
   ============================================================ */

/* --- Message Edit Inline --- */
.message-edit-area { margin-top: 4px; }
.edit-textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(106,171,255,0.4);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  font-family: inherit;
  min-height: 40px;
  transition: border-color 0.2s;
}
.edit-textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(106,171,255,0.12);
}
.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}
.edit-actions .btn-sm {
  padding: 4px 12px;
  font-size: 11px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  transition: all 0.15s;
}
.edit-actions .btn-sm.btn-secondary {
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
}
.edit-actions .btn-sm.btn-primary {
  background: var(--brand-gradient);
  color: white;
  border-color: transparent;
}
.edit-actions kbd {
  padding: 1px 4px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  font-size: 9px;
  font-family: inherit;
  margin-left: 4px;
}

/* --- Thread Count Bar --- */
.thread-count-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--brand-primary);
  background: rgba(106,171,255,0.06);
  border: 1px solid rgba(106,171,255,0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  width: fit-content;
}
.thread-count-bar:hover {
  background: rgba(106,171,255,0.12);
  border-color: rgba(106,171,255,0.2);
  transform: translateX(2px);
}
.thread-count-bar i:first-child { font-size: 10px; }

/* --- Mention Dropdown --- */
.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.4);
  padding: 6px;
  z-index: 100;
  margin-bottom: 4px;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.mention-item:hover, .mention-item.selected {
  background: rgba(106,171,255,0.12);
}

/* --- Thread Panel (overlay) --- */
.thread-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: flex-end;
}
.thread-panel {
  width: 420px;
  max-width: 100%;
  height: 100%;
  background: rgba(10, 15, 28, 0.97);
  backdrop-filter: blur(60px) saturate(1.8);
  border-left: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s var(--ease-spring);
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.thread-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.thread-panel-header button {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.15s;
}
.thread-panel-header button:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}
.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.thread-parent-msg {
  background: rgba(106,171,255,0.04);
  border-bottom: 1px solid rgba(106,171,255,0.1);
}
.thread-reply {
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.15s;
}
.thread-reply:hover {
  background: rgba(255,255,255,0.02);
}
.thread-input-area {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 8px;
}

/* --- Forward Channel Item --- */
.forward-channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13.5px;
}
.forward-channel-item:hover {
  background: rgba(106,171,255,0.1);
}

/* --- Deleted Message --- */
.deleted-msg .message-body {
  opacity: 0.4;
}

/* --- Typing Indicator --- */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
}
.typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand-primary);
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.32s; }
@keyframes typingBounce {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* --- DM channel in sidebar --- */
.channel-item .dm-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-secondary);
  margin-left: 4px;
}

/* --- Board Comment --- */
#comment-input::placeholder {
  color: var(--text-muted);
}

/* --- More message actions --- */
.message-actions button {
  width: 26px;
  height: 26px;
  font-size: 11px;
}
/* ═══════════════════════════════════════════════════════════
   v3.0 — LOGIN SCREEN (D: Login UI)
   ═══════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--bg-base);
  overflow: auto;
}
.login-card {
  width: 92%; max-width: 420px;
  background: rgba(8, 14, 28, 0.6);
  backdrop-filter: blur(60px) saturate(2);
  -webkit-backdrop-filter: blur(60px) saturate(2);
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl), 0 0 80px rgba(106,171,255,0.08);
  animation: modalSlideUp 0.5s var(--ease-out);
  position: relative;
}
.login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--brand-gradient);
  box-shadow: 0 0 30px rgba(106,171,255,0.4);
}
.login-card::after {
  content: ''; position: absolute; inset: 0;
  background: var(--glass-shine-strong);
  pointer-events: none;
}
.login-header {
  text-align: center; padding: 40px 30px 24px;
  position: relative; z-index: 1;
}
.login-logo {
  width: 64px; height: 64px; border-radius: 20px;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: white;
  margin: 0 auto 16px;
  box-shadow: var(--brand-glow-strong), inset 0 1px 0 rgba(255,255,255,0.3);
  position: relative;
}
.login-logo::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 50%);
  border-radius: inherit;
}
.login-header h1 {
  font-size: 24px; font-weight: 800; letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.login-header p {
  font-size: 14px; color: var(--text-muted);
}
.login-body {
  padding: 0 24px 24px;
  position: relative; z-index: 1;
}
.login-label {
  font-size: 12px; color: var(--text-muted); font-weight: 600;
  margin-bottom: 12px; letter-spacing: 0.3px;
}
.login-user-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 360px; overflow-y: auto;
}
.login-user-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}
.login-user-item:hover {
  background: rgba(106,171,255,0.1);
  border-color: rgba(106,171,255,0.3);
  transform: translateX(4px);
  box-shadow: 0 0 24px rgba(106,171,255,0.08);
}
.login-user-item:active {
  transform: translateX(2px) scale(0.98);
}
.login-user-info { flex: 1; min-width: 0; }
.login-user-name { font-size: 14px; font-weight: 700; }
.login-user-role { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.login-loading {
  text-align: center; padding: 40px 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 13px;
}
.login-error {
  text-align: center; padding: 30px 0;
  color: var(--color-danger); font-size: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.login-error i { font-size: 32px; opacity: 0.6; }
.login-footer {
  margin-top: 20px;
  font-size: 12px; color: var(--text-muted); text-align: center;
  display: flex; gap: 6px; justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   v3.1 — LOGIN TABS & REGISTER FORM
   ═══════════════════════════════════════════════════════════ */
.login-tabs {
  display: flex; padding: 0 24px; gap: 4px;
  position: relative; z-index: 1;
}
.login-tab {
  flex: 1; padding: 11px 0; border: none;
  background: transparent; color: var(--text-muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: all var(--duration-normal) var(--ease-out);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-bottom: 2px solid transparent;
}
.login-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.03); }
.login-tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  background: rgba(106,171,255,0.06);
}

/* Register form */
.register-form { padding: 0; }
.reg-step-indicator {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-bottom: 20px; padding: 0 8px;
}
.reg-step {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); font-weight: 600;
}
.reg-step span {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border-default);
  font-size: 11px; font-weight: 700;
}
.reg-step.active { color: var(--brand-primary); }
.reg-step.active span {
  background: var(--brand-primary); color: white;
  border-color: var(--brand-primary);
  box-shadow: 0 0 12px rgba(106,171,255,0.4);
}
.reg-step.done { color: var(--color-success); }
.reg-step.done span {
  background: var(--color-success); color: white;
  border-color: var(--color-success);
}
.reg-step-line {
  width: 40px; height: 2px;
  background: var(--border-default);
  border-radius: 1px;
  transition: background var(--duration-normal);
}
.reg-step-line.done { background: var(--color-success); }

.reg-section { display: flex; flex-direction: column; gap: 14px; }
.reg-field { display: flex; flex-direction: column; gap: 5px; }
.reg-field label {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  display: flex; align-items: center; gap: 5px;
}
.reg-field label i { font-size: 11px; opacity: 0.7; }
.reg-input {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px; font-family: inherit;
  outline: none;
  transition: all var(--duration-normal) var(--ease-out);
}
.reg-input:focus {
  border-color: var(--brand-primary);
  background: rgba(106,171,255,0.06);
  box-shadow: 0 0 0 3px rgba(106,171,255,0.12);
}
.reg-input::placeholder { color: var(--text-muted); }
.reg-input[readonly] { opacity: 0.6; cursor: not-allowed; }
select.reg-input {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a8c8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.reg-help {
  font-size: 11px; color: var(--text-muted); margin-top: -2px;
  padding-left: 2px;
}
.reg-row { display: flex; gap: 12px; }
.reg-btn {
  width: 100%; padding: 12px;
  border: none; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--duration-normal) var(--ease-out);
}
.reg-btn.primary {
  background: var(--brand-gradient);
  color: white;
  box-shadow: var(--brand-glow);
}
.reg-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--brand-glow-strong);
}
.reg-btn.primary:active { transform: translateY(0) scale(0.98); }
.reg-btn.primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.reg-btn.secondary {
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  font-weight: 500;
}
.reg-btn.secondary:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.reg-error {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: var(--radius-md);
  color: var(--color-danger); font-size: 13px;
}
.reg-loading {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 20px; color: var(--text-muted); font-size: 13px;
}

/* Invite badge on register */
.reg-invite-info {
  margin-bottom: 16px;
  padding: 14px;
  background: rgba(106,171,255,0.06);
  border: 1px solid rgba(106,171,255,0.15);
  border-radius: var(--radius-lg);
}
.reg-invite-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--brand-primary);
  margin-bottom: 8px;
}
.reg-invite-badge i { font-size: 16px; }
.reg-invite-detail {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 12px; color: var(--text-secondary);
}
.reg-invite-detail span {
  display: flex; align-items: center; gap: 4px;
}
.reg-invite-detail i { font-size: 10px; opacity: 0.7; }

/* ═══════════════════════════════════════════════════════════
   v3.1 — INVITE MODAL
   ═══════════════════════════════════════════════════════════ */
.invite-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 92%; max-width: 520px; max-height: 85vh;
  background: rgba(8, 14, 28, 0.92);
  backdrop-filter: blur(60px) saturate(2);
  -webkit-backdrop-filter: blur(60px) saturate(2);
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-2xl);
  overflow: hidden; z-index: 210;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl), 0 0 80px rgba(106,171,255,0.08);
  animation: modalSlideUp 0.35s var(--ease-out);
}
.invite-modal::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: var(--brand-gradient);
  box-shadow: 0 0 30px rgba(106,171,255,0.4);
}
.invite-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0; position: relative; z-index: 1;
}
.invite-modal-header h2 {
  font-size: 18px; font-weight: 800; letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 8px;
}
.invite-modal-header h2 i { color: var(--brand-primary); font-size: 16px; }
.invite-modal-body {
  padding: 16px 24px 24px;
  overflow-y: auto; flex: 1;
  position: relative; z-index: 1;
}
.invite-tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
}
.invite-tab {
  flex: 1; padding: 9px 0; border: none;
  background: rgba(255,255,255,0.03);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-out);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent;
}
.invite-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.invite-tab.active {
  color: var(--brand-primary);
  background: rgba(106,171,255,0.08);
  border-color: rgba(106,171,255,0.2);
}
.invite-create-form { display: flex; flex-direction: column; gap: 14px; }
.invite-empty {
  text-align: center; padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center;
}

/* Invite success card */
.invite-success {
  text-align: center; padding: 8px 0 4px;
  animation: modalSlideUp 0.3s var(--ease-out);
}
.invite-success-icon {
  font-size: 36px; color: var(--color-success);
  margin-bottom: 8px;
  animation: badgePop 0.5s var(--ease-spring);
}
.invite-success-title {
  font-size: 15px; font-weight: 700; margin-bottom: 16px;
}
.invite-code-card {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 10px;
}
.invite-code-big {
  font-size: 28px; font-weight: 800; letter-spacing: 2px;
  color: var(--brand-primary);
  padding: 12px 20px;
  background: rgba(106,171,255,0.08);
  border: 1px solid rgba(106,171,255,0.2);
  border-radius: var(--radius-lg);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.invite-copy-btn {
  width: 38px; height: 38px; border: none;
  background: rgba(106,171,255,0.12);
  color: var(--brand-primary); border-radius: var(--radius-md);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast);
}
.invite-copy-btn:hover {
  background: rgba(106,171,255,0.2);
  transform: scale(1.05);
}
.invite-link-card {
  display: flex; gap: 6px; margin-bottom: 10px;
}
.invite-link-input {
  flex: 1; padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: 12px;
  outline: none; font-family: inherit;
}
.invite-expire-info {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 5px;
}

/* Invite list */
.invite-list { display: flex; flex-direction: column; gap: 8px; }
.invite-list-item {
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal);
}
.invite-list-item:hover { background: rgba(255,255,255,0.04); }
.invite-list-item.used { border-color: rgba(52,211,153,0.15); }
.invite-list-item.revoked { opacity: 0.5; }
.invite-list-item.expired { opacity: 0.6; }
.invite-list-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.invite-code-display {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 14px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-primary);
}
.invite-status-badge {
  font-size: 11px; padding: 2px 8px; border-radius: var(--radius-full);
  font-weight: 600;
}
.invite-status-badge.pending { background: rgba(251,191,36,0.12); color: var(--color-warning); }
.invite-status-badge.used { background: rgba(52,211,153,0.12); color: var(--color-success); }
.invite-status-badge.revoked { background: rgba(248,113,113,0.12); color: var(--color-danger); }
.invite-status-badge.expired { background: rgba(148,168,200,0.12); color: var(--text-muted); }
.invite-list-meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 11px; color: var(--text-muted);
}
.invite-list-meta span { display: flex; align-items: center; gap: 3px; }
.invite-list-meta i { font-size: 9px; }
.invite-used-by {
  margin-top: 6px; font-size: 12px;
  color: var(--color-success);
  display: flex; align-items: center; gap: 4px;
}
.invite-list-actions {
  display: flex; gap: 6px; margin-top: 8px;
}
.invite-action-btn {
  padding: 5px 10px; border: none;
  background: rgba(255,255,255,0.05); color: var(--text-secondary);
  border-radius: var(--radius-sm); font-size: 11px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; gap: 4px;
  transition: all var(--duration-fast);
}
.invite-action-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.invite-action-btn.danger:hover { background: rgba(248,113,113,0.15); color: var(--color-danger); }

/* Small spinner variant */
.loading-spinner.small {
  width: 16px; height: 16px;
  border-width: 2px;
}

/* ═══════════════════════════════════════════════════════════
   v3.0 — OFFLINE / ERROR BANNERS (F: Resilience)
   ═══════════════════════════════════════════════════════════ */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 300;
  padding: 10px 20px;
  background: linear-gradient(90deg, rgba(245,158,11,0.95), rgba(217,119,6,0.95));
  color: white; font-size: 13px; font-weight: 600;
  text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  animation: bannerSlideDown 0.3s var(--ease-out);
  backdrop-filter: blur(16px);
}
.offline-banner.hiding {
  animation: bannerSlideUp 0.4s var(--ease-out) forwards;
}
@keyframes bannerSlideDown {
  from { transform: translateY(-100%); } to { transform: translateY(0); }
}
@keyframes bannerSlideUp {
  from { transform: translateY(0); } to { transform: translateY(-100%); }
}

.connection-error-banner {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 300;
  padding: 10px 20px;
  background: linear-gradient(90deg, rgba(239,68,68,0.92), rgba(185,28,28,0.92));
  color: white; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
  animation: bannerSlideDown 0.3s var(--ease-out);
  backdrop-filter: blur(16px);
}

/* ═══════════════════════════════════════════════════════════
   v3.0 — MENTION HIGHLIGHT (E: Notifications)
   ═══════════════════════════════════════════════════════════ */
.message-group.is-mentioned {
  background: rgba(106,171,255,0.08);
  border-color: rgba(106,171,255,0.15);
}
.message-group.is-mentioned::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 2px; border-radius: 2px;
  background: var(--brand-gradient);
  box-shadow: 0 0 12px rgba(106,171,255,0.6);
}
.mention-badge {
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--brand-primary); color: white;
  border-radius: var(--radius-full); font-size: 9px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 10px rgba(106,171,255,0.5);
  animation: badgePop 0.3s var(--ease-spring);
}

/* (E) Unread preview on sidebar channel hover */
.channel-item .unread-preview {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 12px; color: var(--text-secondary);
  max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: var(--shadow-glass);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  z-index: 60;
}
.channel-item:hover .unread-preview { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   v3.0 — PERFORMANCE: Reduced Blur on Mobile (B)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* (B) Disable orb animations on mobile for perf */
  .orb { display: none !important; }
  body::before { animation: none !important; }
  /* (B) Remove all unnecessary backdrop-filters on mobile */
  .reaction-chip, .patient-tag, .message-file, .system-content,
  .sidebar-search input, .message-input-wrapper {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* ═══ Notification Settings Modal (Phase 3) ═══ */
.notif-setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.notif-setting-row label { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.notif-setting-row label i { width: 16px; text-align: center; opacity: 0.6; }
.toggle-switch {
  position: relative; display: inline-block; width: 40px; height: 22px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(255,255,255,0.15); border-radius: 22px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: ""; position: absolute; height: 16px; width: 16px;
  left: 3px; bottom: 3px; background: white; border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--primary, #3b82f6);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* Rate limit toast styling */
.toast.rate-limited { border-left: 4px solid #f59e0b; }

/* ═══ Phase 4: Tools Dropdown ═══ */
.tools-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-primary, #e2e8f0);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.tools-dd-item:hover {
  background: rgba(255,255,255,0.06);
}
.tools-dd-item i { font-size: 13px; text-align: center; }

/* ═══ Phase 4: Export Button ═══ */
.export-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-primary, #e2e8f0);
  text-align: left;
}
.export-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}

/* ═══ Phase 4: Schedule Badge ═══ */
#sched-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  font-size: 9px;
  font-weight: 700;
  color: white;
  background: var(--brand-secondary, #06b6d4);
  border-radius: 7px;
  margin-left: 2px;
}
#sched-count-badge:empty { display: none; }

/* ═══ Settings Modal ═══ */
.settings-tabs, .settings-tabs-row {
  display: flex; gap: 4px; padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.settings-tab, .admin-tab {
  padding: 7px 14px; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; background: transparent;
  color: var(--text-muted); font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 6px;
}
.settings-tab:hover, .admin-tab:hover {
  background: rgba(255,255,255,0.06); color: var(--text-primary);
}
.settings-tab.active, .admin-tab.active {
  background: rgba(106,171,255,0.15); color: #6aabff;
  border-color: rgba(106,171,255,0.3);
}
.settings-form { display: flex; flex-direction: column; gap: 12px; }
.settings-avatar-section {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06); border-radius: 12px;
  margin-bottom: 4px;
}
.reg-success {
  color: var(--color-success); font-size: 13px; padding: 8px;
  background: rgba(52,211,153,0.1); border-radius: 8px;
  display: flex; align-items: center; gap: 6px;
}
.login-form-section { padding: 0 4px; }

/* ═══ Admin Panel ═══ */
.admin-stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.admin-stat-card {
  padding: 16px; text-align: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px; transition: all 0.15s;
}
.admin-stat-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
}
.admin-stat-card.online { border-color: rgba(52,211,153,0.3); }
.admin-stat-number {
  font-size: 28px; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, #6aabff, #38bdf8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.admin-stat-card.online .admin-stat-number {
  background: linear-gradient(135deg, #34d399, #22c55e);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.admin-stat-label { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.admin-member-list { display: flex; flex-direction: column; gap: 6px; }
.admin-member-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05); border-radius: 10px;
  gap: 10px;
}
.admin-member-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.admin-member-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.admin-role-select {
  padding: 4px 8px; font-size: 11.5px;
  background: rgba(255,255,255,0.06); color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 6px;
  cursor: pointer;
}
.admin-action-btn {
  width: 28px; height: 28px; border: none; border-radius: 6px;
  background: transparent; cursor: pointer; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.admin-action-btn.danger { color: var(--text-muted); }
.admin-action-btn.danger:hover { color: var(--color-danger); background: rgba(248,113,113,0.15); }
.admin-action-btn.success { color: var(--text-muted); }
.admin-action-btn.success:hover { color: var(--color-success); background: rgba(52,211,153,0.15); }

.admin-audit-list { display: flex; flex-direction: column; gap: 4px; }
.admin-audit-row {
  display: grid; grid-template-columns: 130px 1fr auto auto;
  gap: 10px; align-items: center;
  padding: 8px 10px; font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.admin-audit-time { color: var(--text-muted); font-size: 11px; }
.admin-audit-badge {
  padding: 2px 8px; background: rgba(106,171,255,0.1);
  color: #6aabff; border-radius: 4px; font-size: 10.5px; font-weight: 600;
}
.admin-hospital-stats {
  display: flex; gap: 16px; padding: 12px;
  background: rgba(255,255,255,0.03); border-radius: 8px;
  font-size: 13px; color: var(--text-secondary);
}
.admin-hospital-stats i { color: var(--brand-primary); margin-right: 4px; }

@media (max-width: 640px) {
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-audit-row { grid-template-columns: 100px 1fr auto; }
  .admin-audit-ip { display: none; }
  .admin-member-row { flex-direction: column; align-items: stretch; }
  .admin-member-actions { justify-content: flex-end; }
}

/* ═══ Legal / Agreement ═══ */
.login-footer-links {
  display: block;
  margin-top: 4px;
}
.login-footer-links a {
  color: rgba(106,171,255,0.7);
  text-decoration: none;
  font-size: 11.5px;
  transition: color 0.15s;
}
.login-footer-links a:hover {
  color: #6aabff;
  text-decoration: underline;
}

.reg-agreement {
  margin: 14px 0 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
}
.reg-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary, #94a8c8);
  cursor: pointer;
  line-height: 1.5;
}
.reg-checkbox {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  accent-color: #6aabff;
  cursor: pointer;
  border-radius: 4px;
}
.reg-checkbox-label a {
  color: #6aabff;
  text-decoration: none;
  font-weight: 600;
}
.reg-checkbox-label a:hover {
  text-decoration: underline;
}
.reg-checkbox-label em {
  font-style: normal;
  color: #f87171;
  font-size: 11.5px;
  font-weight: 600;
}

/* (B) Prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .orb { display: none !important; }
}
