/* ═══════════════════════════════════════════════════════════════════
   Monitoring Dashboard v2 — Ultra-Modern Dark Glassmorphism
   ═══════════════════════════════════════════════════════════════════ */

/* ── DARK THEME (default) ──────────────────────────────────────── */
:root, [data-theme="dark"] {
  --bg-deep: #0a0a14;
  --bg-surface: rgba(18, 18, 36, 0.75);
  --bg-glass: rgba(22, 22, 44, 0.92);
  --bg-card: rgba(28, 28, 52, 0.8);
  --bg-input: rgba(255,255,255,0.04);
  --bg-input-hover: rgba(255,255,255,0.08);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #e8e8f0;
  --text-secondary: #9494b8;
  --text-muted: #5c5c80;
  --accent-cyan: #00d4ff;
  --accent-magenta: #ff3d8e;
  --accent-green: #00e676;
  --accent-amber: #ffab00;
  --accent-purple: #b388ff;
  --accent-blue: #4a90d9;
  --gradient-hero: linear-gradient(135deg, #00d4ff 0%, #b388ff 50%, #ff3d8e 100%);
  --gradient-card: linear-gradient(135deg, rgba(0,212,255,0.08), rgba(179,136,255,0.08));
  --shadow-glow-cyan: 0 0 30px rgba(0,212,255,0.15);
  --shadow-glow-magenta: 0 0 30px rgba(255,61,142,0.15);
  --orb-opacity: 0.25;
  --ai-bg: rgba(0,230,118,0.06);
  --pending-bg: rgba(255,171,0,0.08);
  --msg-bg: rgba(255,255,255,0.025);
  --hr-msg-bg: #f8f9fa;
  --hr-msg-text: #444;
  --hr-msg-sender: #333;
}

/* ── LIGHT THEME ───────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-deep: #f0f2f5;
  --bg-surface: rgba(255, 255, 255, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.92);
  --bg-card: rgba(255, 255, 255, 0.82);
  --bg-input: rgba(0,0,0,0.03);
  --bg-input-hover: rgba(0,0,0,0.06);
  --border-glass: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #7a7a9a;
  --accent-cyan: #0090b0;
  --accent-magenta: #c01850;
  --accent-green: #00a854;
  --accent-amber: #c07a00;
  --accent-purple: #7c4dff;
  --accent-blue: #2d6bb8;
  --gradient-hero: linear-gradient(135deg, #0090b0 0%, #7c4dff 50%, #c01850 100%);
  --gradient-card: linear-gradient(135deg, rgba(0,144,176,0.06), rgba(124,77,255,0.06));
  --shadow-glow-cyan: 0 0 30px rgba(0,144,176,0.2);
  --shadow-glow-magenta: 0 0 30px rgba(192,24,80,0.2);
  --orb-opacity: 0.18;
  --ai-bg: rgba(0,168,84,0.08);
  --pending-bg: rgba(192,122,0,0.1);
  --msg-bg: rgba(0,0,0,0.02);
  --hr-msg-bg: #f8f9fa;
  --hr-msg-text: #333;
  --hr-msg-sender: #111;
}

/* ── Shared design tokens ───────────────────────────────────────── */
:root {
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Ambient Background Orbs (GPU-optimized: static radial gradients, zero layer bloat) ── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  opacity: var(--orb-opacity);
  pointer-events: none;
  z-index: 0;
}
.orb-1 {
  width: 650px; height: 650px;
  background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
  top: -200px; left: -150px;
}
.orb-2 {
  width: 550px; height: 550px;
  background: radial-gradient(circle, var(--accent-magenta) 0%, transparent 70%);
  top: 40%; right: -200px;
}
.orb-3 {
  width: 450px; height: 450px;
  background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
  bottom: -150px; left: 30%;
}

/* ── Glass Container (GPU-optimized: clean semi-opaque surface, zero nested blur passes) ── */
.glass {
  height: fit-content;
  padding: 0 0 30px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}

/* Fixed Header retains lightweight blur as single top-level overlay */
.header.glass {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glass-input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  transition: var(--transition-fast);
  width: 100%;
  resize: vertical;
}
.glass-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}

select.glass-input, .glass-input[type="time"] {
  background-color: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

/* ── App Container ───────────────────────────────────────────────── */
.app-container {
  position: relative;
  max-width: 95%;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
  z-index: 1;
}

/* ── Header ──────────────────────────────────────────────────────── */
.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-xl);
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.logo {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 1.25rem;
}
.logo-icon { font-size: 1.5rem; animation: bounceIn 0.6s var(--transition-bounce); }
.logo h1 { background: var(--gradient-hero); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.version { font-size: 0.7rem; color: var(--text-muted); background: rgba(255,255,255,0.04); padding: 0.15rem 0.5rem; border-radius: 20px; }
.header-right { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; }
.notification-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 184, 77, 0.35);
  background: linear-gradient(135deg, rgba(255, 184, 77, 0.14), rgba(255, 99, 71, 0.1));
}
.notification-warning-icon {
  font-size: 1.15rem;
  line-height: 1.1;
}
.notification-warning-body {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.notification-warning-body strong {
  color: var(--text-primary);
  font-size: 0.84rem;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-amber); transition: var(--transition-smooth); }
.status-dot.connected { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.status-text { font-size: 0.75rem; color: var(--text-secondary); }
.live-badge {
  font-size: 0.65rem; font-weight: 700; padding: 0.2rem 0.6rem;
  border-radius: 20px; background: rgba(0,230,118,0.15); color: var(--accent-green);
  letter-spacing: 0.05em;
}
.notification-badge {
  font-size: 0.7rem; font-weight: 700; min-width: 22px; height: 22px;
  border-radius: 11px; background: var(--accent-magenta); color: white;
  display: flex; align-items: center; justify-content: center;
  padding: 0 0.4rem; animation: popIn 0.3s var(--transition-bounce);
}
.notification-badge.hidden { display: none; }

/* ── Theme Toggle ──────────────────────────────────────────────── */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-input);
  color: var(--text-secondary); font-size: 1.1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition-smooth);
  position: relative; overflow: hidden;
}
.theme-toggle:hover {
  background: var(--bg-input-hover);
  border-color: var(--border-hover);
  transform: rotate(15deg) scale(1.05);
}
.theme-toggle:active { transform: rotate(180deg) scale(0.95); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: transform 0.4s var(--transition-bounce), opacity 0.3s;
}
.theme-toggle .icon-sun {
  transform: translateY(30px); opacity: 0;
}
.theme-toggle .icon-moon {
  transform: translateY(0); opacity: 1;
}
[data-theme="light"] .theme-toggle .icon-sun {
  transform: translateY(0); opacity: 1;
}
[data-theme="light"] .theme-toggle .icon-moon {
  transform: translateY(-30px); opacity: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Tab Navigation ──────────────────────────────────────────────── */
.tab-nav {
  display: flex; gap: 0.25rem;
  padding: 0.35rem; margin-bottom: 1rem;
  border-radius: var(--radius-xl);
}
.tab-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 1rem; border: none; border-radius: var(--radius-lg);
  background: transparent; color: var(--text-secondary);
  font-size: 0.85rem; font-weight: 500; font-family: var(--font-sans);
  cursor: pointer; transition: var(--transition-smooth); position: relative;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.tab-btn.active {
  background: rgba(255,255,255,0.08);
  box-shadow: 0 2px 12px rgba(0,212,255,0.08);
}
.tab-btn.active::after {
  content: ''; position: absolute; bottom: 2px; left: 20%; right: 20%; height: 2px;
  background: var(--gradient-hero); border-radius: 1px;
}
.tab-icon { font-size: 1rem; }
.tab-count {
  font-size: 0.65rem; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 9px; background: rgba(255,255,255,0.1); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; padding: 0 0.3rem;
}
.tab-btn.active .tab-count { background: var(--accent-cyan); color: #000; }

/* ── Filter Bar ──────────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 1rem; margin-bottom: 1rem;
  border-radius: var(--radius-xl);
}
.filter-group { display: flex; align-items: center; gap: 0.4rem; }
.filter-group label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
/* ── Styled <select> ─────────────────────────────────────────── */
select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.4rem 2rem 0.4rem 0.7rem;
  font-size: 0.8rem; font-family: var(--font-sans); font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239494b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 12px 12px;
  min-width: 120px;
  color-scheme: dark;
}
select:hover {
  background-color: var(--bg-input-hover);
  border-color: var(--border-hover);
}
select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}
select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
  padding: 0.5rem;
}

/*input element styles*/

input:not([type="checkbox"]) {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.4rem 2rem 0.4rem 0.7rem;
  font-size: 0.8rem; font-family: var(--font-sans); font-weight: 500;
  cursor: pointer;
  color-scheme: dark;
}
#scheduleMessage {
  flex: 1;
  background: var(--bg-input); border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg); color: var(--text-primary);
  padding: 0.55rem 0.9rem; font-size: 0.85rem; font-family: var(--font-sans);
  resize: vertical; min-height: 240px; max-height: 720px; line-height: 1.4;
  transition: var(--transition-fast);
}

/* Light mode overrides */
[data-mode="light"] input {color-scheme: light;}
[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a4a6a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  color-scheme: light;
}
[data-theme="light"] select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
}
.btn-refresh {
  margin-left: auto; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border-glass); background: rgba(255,255,255,0.03);
  color: var(--text-secondary); cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: var(--transition-fast);
}
.btn-refresh:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.refresh-icon { font-size: 1.1rem; transition: var(--transition-smooth); }
.btn-refresh:active .refresh-icon { transform: rotate(180deg); }

/* ── Tab Panels ──────────────────────────────────────────────────── */
.tab-panel { display: none; animation: fadeSlideIn 0.4s var(--transition-smooth); }
.tab-panel.active { display: block; }

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

/* ── Mentions Grid ───────────────────────────────────────────────── */
.mentions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1rem;
}

.mentions-grid.grouped-rows {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.mention-group-row {
  display: grid;
  grid-template-columns: clamp(210px, 20vw, 280px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: linear-gradient(110deg, rgba(46, 185, 220, 0.09), rgba(255,255,255,0.025) 34%, rgba(255,255,255,0.015));
  animation: cardEnter 0.45s var(--transition-bounce) both;
}

.mention-group-rail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 1.15rem;
  border-right: 1px solid var(--border-glass);
  background: linear-gradient(160deg, rgba(46, 185, 220, 0.14), rgba(104, 88, 228, 0.05));
}

.mention-group-kicker,
.mention-request-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.mention-group-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
}

.mention-group-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.mention-group-count {
  font-size: 0.72rem;
  font-weight: 750;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.mention-group-latest {
  margin-top: auto;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.mention-group-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 380px));
  align-content: start;
  gap: 0.85rem;
  padding: 0.95rem;
}

.mentions-grid.grouped-rows .mention-card {
  min-width: 0;
  margin: 0;
}

.platform-label {
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  color: var(--accent-cyan);
  background: rgba(46, 185, 220, 0.12);
}

.grouped-mention-card .card-header {
  align-items: center;
}

.mention-request-label {
  margin: 0.7rem 0 0.28rem;
}

.grouped-mention-card .card-message {
  min-height: 4.3rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  overflow: hidden;
}

/* ── Mention Card (GPU-optimized: content-visibility & focused transitions) ── */
.mention-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: auto 240px;
}
.mention-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.mention-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient-hero); opacity: 0; transition: opacity 0.3s;
}
.mention-card:hover::before { opacity: 1; }

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

.mention-card.resolved { opacity: 0.7; }
.card-header {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap;
}
.platform-emoji { font-size: 1.2rem; }
.group-name { font-weight: 600; font-size: 0.85rem; flex: 1 1 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-badge {
  font-size: 0.6rem; font-weight: 700; padding: 0.15rem 0.5rem;
  border-radius: 20px; white-space: nowrap; letter-spacing: 0.03em;
}
.status-badge.new { background: rgba(231,76,60,0.2); color: #e74c3c; }
.status-badge.resolved { background: rgba(39,174,96,0.2); color: #27ae60; }
.ai-status-badge {
  font-size: 0.58rem; font-weight: 700; padding: 0.15rem 0.5rem;
  border-radius: 20px; white-space: nowrap; letter-spacing: 0.03em;
  border: 1px solid rgba(255,255,255,0.08);
}
.ai-status-badge.pending { background: rgba(243,156,18,0.18); color: #f39c12; }
.ai-status-badge.processed { background: rgba(46,204,113,0.16); color: #2ecc71; }
.ai-status-badge.excluded { background: rgba(189,195,199,0.18); color: #d5d8dc; }

.card-meta { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.5rem; }

.card-message {
  background: var(--msg-bg);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.5rem 0.7rem; margin-bottom: 0.5rem;
  font-size: 0.82rem; line-height: 1.45; color: var(--text-secondary);
  min-height: 4.3rem;
  max-height: 205px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: zoom-in;
  transition: background var(--transition-fast), border-color var(--transition-fast), max-height var(--transition-smooth);
}
.card-message:hover,
.card-message:focus-visible {
  background: var(--bg-input-hover);
  border-color: var(--accent-cyan);
  outline: none;
}
.card-message.is-expanded {
  display: block;
  max-height: max-content;
  overflow: visible;
  -webkit-line-clamp: unset;
  cursor: zoom-out;
}

.card-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }

.card-ai {
  background: var(--ai-bg);
  border-left: 3px solid var(--accent-green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.4rem 0.7rem; margin-bottom: 0.5rem;
  font-size: 0.78rem; line-height: 1.4; color: var(--text-secondary);
}
.card-ai-label {
  margin-bottom: 0.2rem;
  color: var(--text-primary);
}
.card-ai-text {
  white-space: normal;
  word-break: break-word;
}
.card-ai.is-expandable .card-ai-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}
.card-ai.is-expandable.is-expanded .card-ai-text,
.ai-followup-full .card-ai-text {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  white-space: pre-line;
}
.card-ai-toggle {
  margin-top: 0.45rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.card-ai-toggle:hover {
  color: var(--text-primary);
  text-decoration: underline;
}
.card-ai.ai-processed {
  border-left-color: var(--accent-green);
}
.card-ai.ai-excluded {
  border-left-color: #c8ccd3;
  background: rgba(255,255,255,0.05);
}
.card-ai-pending {
  background: var(--pending-bg);
  border-left: 3px solid var(--accent-amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.35rem 0.7rem; margin-bottom: 0.5rem;
  font-size: 0.72rem; color: var(--accent-amber);
}
.ai-followup-full {
  background: var(--ai-bg);
  border-left: 3px solid var(--accent-green);
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--gradient-hero);
  border: none; border-radius: var(--radius-sm); color: white;
  padding: 0.5rem 1.2rem; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; font-family: var(--font-sans);
  transition: var(--transition-fast); white-space: nowrap;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow-cyan); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass); border-radius: var(--radius-sm);
  color: var(--text-secondary); padding: 0.4rem 0.8rem; font-size: 0.75rem;
  cursor: pointer; font-family: var(--font-sans); transition: var(--transition-fast);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }

.btn-small {
  font-size: 0.72rem; padding: 0.3rem 0.6rem; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font-sans); transition: var(--transition-fast);
  border: 1px solid var(--border-glass);
  background: rgba(255,255,255,0.03); color: var(--text-secondary);
}
.btn-small:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.btn-small.danger { color: #e74c3c; border-color: rgba(231,76,60,0.3); }
.btn-small.danger:hover { background: rgba(231,76,60,0.1); }

.pulse-glow { position: relative; }
.pulse-glow::after {
  content: ''; position: absolute; inset: -3px; border-radius: inherit;
  background: var(--gradient-hero); z-index: -1; opacity: 0;
  transition: opacity var(--transition-smooth);
}
.pulse-glow:hover::after { opacity: 0.4; filter: blur(8px); }

/* ── Loading State ───────────────────────────────────────────────── */
.loading-state {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 3rem; color: var(--text-muted);
}
.loader-spinner {
  width: 40px; height: 40px; border: 3px solid var(--border-glass);
  border-top-color: var(--accent-cyan); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── HR Opinca Tab (Chat Style) ─────────────────────────────────── */
.hr-header { padding: 1rem 1.5rem; margin-bottom: 1rem; }
.hr-header-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.hr-header h2 { font-size: 1.15rem; }
.hr-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.hr-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

.hr-unread-badge {
  font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.6rem;
  border-radius: 20px; background: var(--accent-magenta); color: #fff;
  animation: popIn 0.3s var(--transition-bounce);
}
.hr-unread-badge.hidden { display: none; }

/* ── Chat Container ─────────────────────────────────────────── */
.hr-chat {
  display: flex; flex-direction: column; gap: 0.3rem;
  padding: 0 0.5rem 2rem; max-width:95%; margin: 0 auto;
  max-height: 70vh; overflow-y: auto;
  scroll-behavior: smooth;
}
.hr-chat::-webkit-scrollbar { width: 4px; }
.hr-chat::-webkit-scrollbar-track { background: transparent; }
.hr-chat::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 4px; }

/* ── Chat Bubble ────────────────────────────────────────────── */
.hr-message {
  display: flex; flex-direction: column;
  max-width: 75%; padding: 0.65rem 0.9rem;
  border-radius: 18px;
  position: relative;
  animation: msgSlideIn 0.4s var(--transition-bounce) both;
  transition: transform var(--transition-fast);
}
.hr-message:hover { transform: translateY(-1px); }

/* Left bubble (sender = others) */
.hr-message.left {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-bottom-left-radius: 4px;
  margin-right: auto;
}

/* Right bubble (sender = Mihail) */
.hr-message.right {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(179,136,255,0.12));
  border: 1px solid rgba(0,212,255,0.2);
  border-bottom-right-radius: 4px;
  margin-left: auto;
  text-align: right;
}

/* New message indicator */
.hr-message.unread::before {
  content: '\25CF';
  position: absolute;
  font-size: 0.6rem;
  color: var(--accent-magenta);
}
.hr-message.left.unread::before  { left: -14px; top: 50%; transform: translateY(-50%); }
.hr-message.right.unread::before { right: -14px; top: 50%; transform: translateY(-50%); }

.hr-msg-header {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; flex-wrap: wrap;
}
.hr-message.right .hr-msg-header { justify-content: flex-end; }
.hr-msg-sender { font-weight: 700; font-size: 0.78rem; color: var(--accent-cyan); }
.hr-message.right .hr-msg-sender { color: var(--accent-purple); }
.hr-msg-time { font-size: 0.65rem; color: var(--text-muted); }
.message-read-receipt {
  padding: 0.1rem 0.38rem;
  border-radius: 999px;
  font-size: 0.57rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.message-read-receipt.seen {
  background: rgba(0, 230, 118, 0.13);
  color: var(--accent-green);
}
.message-read-receipt.pending {
  background: rgba(255, 184, 108, 0.13);
  color: var(--accent-amber);
}
.hr-badge-new {
  font-size: 0.55rem; font-weight: 700; padding: 0.1rem 0.4rem;
  border-radius: 8px; background: var(--accent-magenta); color: #fff;
  letter-spacing: 0.05em;
}
.hr-msg-text { font-size: 0.85rem; line-height: 1.5; color: var(--text-secondary); }
.hr-message.right .hr-msg-text { color: var(--text-primary); }
.hr-msg-preview {
  margin-bottom: 0.45rem;
}
.hr-msg-preview-img {
  display: block;
  width: min(240px, 100%);
  max-height: 240px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.04);
}
.hr-msg-media {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-muted);
  word-break: break-word;
}

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

/* ── HR Send Bar ───────────────────────────────────────────── */
.hr-send-bar {
  display: flex; flex-direction: column; gap: 0.65rem;
  padding: 0.7rem 1rem; margin: 1rem 0.5rem 0;
  border-radius: var(--radius-xl);
  position: sticky; bottom: 0;
}
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  width: 100%;
}
.hr-send-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  background: var(--bg-input); border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg); color: var(--text-primary);
  padding: 0.55rem 0.9rem; font-size: 0.85rem; font-family: var(--font-sans);
  resize: none; min-height: 40px; max-height: 120px; line-height: 1.4;
  writing-mode: horizontal-tb;
  transition: var(--transition-fast);
}
.hr-send-input:focus {
  outline: none; border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}
.composer-attach-btn,
.composer-remove-btn {
  flex-shrink: 0;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-radius: 14px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.composer-attach-btn {
  width: 42px;
  height: 42px;
  font-size: 1rem;
}
.composer-remove-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 0.6rem;
  font-size: 0.95rem;
}
.composer-attach-btn:hover,
.composer-remove-btn:hover {
  border-color: rgba(0, 212, 255, 0.35);
  transform: translateY(-1px);
}
.composer-attachment {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  border: 1px dashed rgba(0, 212, 255, 0.35);
  border-radius: var(--radius-lg);
  background: rgba(0, 212, 255, 0.06);
}
.composer-attachment-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-primary);
}
.composer-attachment-list {
  width: 100%;
  display: flex;
  flex-wrap:wrap;
  flex-direction: row;
  gap: 0.55rem;
}
.composer-attachment-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.45rem 0.5rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.composer-attachment-preview {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.composer-attachment-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.composer-attachment-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.composer-attachment-meta strong,
.composer-attachment-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-attachment-meta strong {
  font-size: 0.82rem;
  color: var(--text-primary);
}
.composer-attachment-meta span {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.hr-send-bar .btn-primary { flex-shrink: 0; padding: 0.5rem 1rem; font-size: 0.8rem; }
.hr-send-bar .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Direct Chats Tab */
.direct-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.direct-sidebar {
  padding: 1rem;
  max-height: 82vh;
  overflow: hidden;
}
.direct-sidebar-head {
  margin-bottom: 0.8rem;
}
.direct-sidebar-head h2 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}
.direct-sidebar-head p {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.direct-chat-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: calc(82vh - 90px);
  overflow-y: auto;
  padding-right: 0.2rem;
}
.direct-chat-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  content-visibility: auto;
  contain-intrinsic-size: auto 68px;
}
.direct-chat-item:hover,
.direct-chat-item.active {
  border-color: rgba(0, 212, 255, 0.3);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}
.direct-chat-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.direct-chat-name {
  flex: 1;
  font-size: 0.84rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.direct-chat-preview {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
}
.direct-chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.45rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}
.direct-unread-pill {
  min-width: 22px;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-magenta);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
}
.direct-main {
  min-width: 0;
}

@media (max-width: 1100px) {
  .direct-layout {
    grid-template-columns: 1fr;
  }

  .direct-sidebar {
    max-height: none;
  }

  .direct-chat-list {
    max-height: 320px;
  }
}

/* ── Work Timer (mentions) ──────────────────────────────────── */
.timer-bar {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  padding: 0.35rem 0.6rem; margin-bottom: 0.4rem;
  background: rgba(0,212,255,0.08); border-radius: var(--radius-sm);
  font-size: 0.75rem; font-family: var(--font-mono);
}
.timer-bar .timer-icon { font-size: 1rem; }
.timer-bar .timer-clock { font-weight: 700; color: var(--accent-cyan); min-width: 58px; }
.timer-bar .timer-label { font-size: 0.65rem; color: var(--text-muted); }
.timer-bar .timer-total { margin-left: auto; font-size: 0.68rem; color: var(--text-secondary); }
.timer-bar.running { background: rgba(0,230,118,0.1); border-left: 2px solid var(--accent-green); }
.timer-bar.running .timer-clock { color: var(--accent-green); }
.timer-bar.paused { background: rgba(255,171,0,0.08); }
.timer-bar.finished { background: rgba(0,230,118,0.08); }
.timer-bar.finished .timer-clock { color: var(--accent-green); }
.timer-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.25rem;
}
.timer-control {
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.62rem;
  cursor: pointer;
  transition: var(--transition-fast);
}
.timer-control:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.12);
}
.timer-control-finish { color: var(--accent-magenta); }
.timer-finished { color: var(--accent-green); }
.btn-small:disabled { cursor: default; opacity: 0.75; }

/* ── Schedule Tab ────────────────────────────────────────────────── */
.schedule-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.schedule-panel, .schedule-list-panel {
  padding: 1.2rem 1.5rem; border-radius: var(--radius-lg); max-height: 100dvh; overflow: scroll;
}
.schedule-panel h2, .schedule-list-panel h2 {
  font-size: 1rem; margin-bottom: 1rem; color: var(--text-primary);
}
.schedule-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.schedule-list-heading h2 { margin-bottom: 1rem; }
.schedule-filter-summary {
  margin-bottom: 1rem;
  padding: 0.24rem 0.58rem;
  border-radius: 999px;
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}
.schedule-filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.9rem;
  padding: 0.7rem;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: linear-gradient(110deg, rgba(0, 212, 255, 0.07), rgba(179, 136, 255, 0.05));
}
.schedule-filter-bar .filter-group { min-width: 0; }
.schedule-filter-bar .filter-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.66rem;
  color: var(--text-muted);
}
.schedule-filter-bar select { width: 100%; min-width: 0; }
.schedule-form { display: flex; flex-direction: column; gap: 0.8rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.form-row { display: flex; gap: 0.8rem; }
.form-row .form-group { flex: 1; }

.day-selector { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.day-selector button {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border-glass); background: rgba(255,255,255,0.03);
  color: var(--text-secondary); font-size: 0.68rem; font-weight: 600;
  cursor: pointer; font-family: var(--font-sans); transition: var(--transition-fast);
}
.day-selector button:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.day-selector button.selected {
  background: var(--gradient-hero); color: white; border-color: transparent;
  box-shadow: 0 2px 10px rgba(0,212,255,0.2);
}

/* ── Schedule Type Selector ─────────────────────────────────── */
.type-selector { display: flex; gap: 0.3rem; }
.type-btn {
  flex: 1; padding: 0.4rem 0.6rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass); background: var(--bg-input);
  color: var(--text-secondary); font-size: 0.75rem; font-weight: 500;
  cursor: pointer; font-family: var(--font-sans); transition: var(--transition-fast);
}
.type-btn:hover { background: var(--bg-input-hover); }
.type-btn.active {
  background: var(--gradient-hero); color: #fff; border-color: transparent;
  font-weight: 600;
}

.schedule-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  line-height: 1.4;
}
.schedule-checkbox-row input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: checkbox;
  margin-top: 0.12rem;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-cyan);
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.schedule-checkbox-help {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-left: 1.55rem;
}

/* ── Template Chips ─────────────────────────────────────────── */
.template-section { margin-bottom: 1rem; }
.template-grid { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.25rem; }
.template-chip {
  padding: 0.3rem 0.7rem; border-radius: 20px;
  border: 1px solid var(--border-glass); background: var(--bg-input);
  color: var(--text-secondary); font-size: 0.72rem; font-weight: 500;
  cursor: pointer; font-family: var(--font-sans); transition: var(--transition-fast);
  white-space: nowrap;
}
.template-chip:hover {
  background: var(--accent-cyan); color: #000; border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* ── Date input ─────────────────────────────────────────────── */
input[type="date"], input[type="time"] {
  background: var(--bg-input); border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm); color: var(--text-primary);
  padding: 0.4rem 0.7rem; font-size: 0.8rem; font-family: var(--font-sans);
  transition: var(--transition-fast); width: 100%;
  color-scheme: dark;
}
input[type="date"]:focus, input[type="time"]:focus {
  outline: none; border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="time"] { color-scheme: light; }

.schedule-list { display: flex; flex-direction: column; gap: 0.7rem; }
.schedule-cache-banner {
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 184, 108, 0.1);
  color: var(--accent-amber);
  font-size: 0.72rem;
  text-align: center;
}
.schedule-category-listing { display: flex; flex-direction: column; gap: 0.9rem; }
.schedule-category {
  overflow: scroll;
  max-height: 100vh;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: linear-gradient(105deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018));
}
.schedule-category-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(255,255,255,0.025);
}
.schedule-category--active .schedule-category-head { box-shadow: inset 3px 0 0 var(--accent-green); }
.schedule-category--inactive .schedule-category-head { box-shadow: inset 3px 0 0 var(--accent-magenta); }
.schedule-category-kicker {
  display: block;
  margin-bottom: 0.18rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}
.schedule-category-head h3 { margin: 0; font-size: 0.86rem; color: var(--text-primary); }
.schedule-category-head p { margin: 0.22rem 0 0; font-size: 0.68rem; color: var(--text-muted); }
.schedule-category-count {
  min-width: 28px;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 750;
  text-align: center;
}
.schedule-category-list, .schedule-ungrouped-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem;
}
.schedule-item {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: var(--radius-md); padding: 0.7rem 1rem;
  display: flex; align-items: flex-start; gap: 0.8rem;
  transition: var(--transition-smooth); animation: cardEnter 0.4s var(--transition-bounce) both;
}
.schedule-item:hover { border-color: var(--border-hover); }
.schedule-item.disabled { opacity: 0.5; }
.schedule-item.is-active { border-color: rgba(0, 230, 118, 0.16); }
.schedule-indicator {
  width: 4px; min-height: 100%; border-radius: 2px;
  background: var(--gradient-hero); align-self: stretch;
}
.schedule-info { flex: 1; }
.schedule-msg { font-size: 0.82rem; color: var(--text-primary); margin-bottom: 0.25rem; white-space: pre-wrap; word-break: break-word; }
.schedule-badges { display: inline-flex; gap: 0.28rem; flex-wrap: wrap; vertical-align: middle; margin-left: 0.2rem; }
.schedule-status-badge, .schedule-type-badge, .schedule-random-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.schedule-status-badge.active { background: rgba(0, 230, 118, 0.14); color: var(--accent-green); }
.schedule-status-badge.inactive { background: rgba(255, 64, 129, 0.13); color: #ff8eb8; }
.schedule-type-badge.recurring { background: rgba(179, 136, 255, 0.15); color: var(--accent-purple); }
.schedule-type-badge.one-time { background: rgba(0, 212, 255, 0.14); color: var(--accent-cyan); }
.schedule-random-badge { background: rgba(255, 184, 108, 0.16); color: var(--accent-amber); }
.schedule-meta { font-size: 0.7rem; color: var(--text-muted); display: flex; gap: 0.8rem; }
.schedule-actions { display: flex; flex-direction: column; gap: 0.25rem; }

/* ── Empty State ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 2rem; color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.85rem; }

/* ── Toast Notifications ─────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: 0.5rem; z-index: 1000;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: var(--radius-md); padding: 0.7rem 1rem;
  min-width: 280px; max-width: 400px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: slideInRight 0.4s var(--transition-bounce);
  display: flex; align-items: flex-start; gap: 0.5rem;
  position: relative; overflow: hidden;
}
.toast::before {
  content: ''; position: absolute; bottom: 0; left: 0; height: 2px;
  background: var(--gradient-hero); animation: toastTimer 4s linear forwards;
}
@keyframes toastTimer { from { width: 100%; } to { width: 0%; } }
.toast.fade-out { animation: slideOutRight 0.3s ease-in forwards; }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { to { transform: translateX(120%); opacity: 0; } }

.toast-icon { font-size: 1.2rem; }
.toast-body { flex: 1; }
.toast-title { font-size: 0.8rem; font-weight: 600; }
.toast-text { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease-out;
}
.modal-overlay.hidden { display: none !important; }
.modal-overlay:not(.hidden) { display: flex !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 90%; max-width: 550px; padding: 1.5rem;
  animation: modalPop 0.3s var(--transition-bounce);
  max-height: 85vh; overflow-y: auto;
}
@keyframes modalPop {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-header h3 { font-size: 1.05rem; }
.modal-close {
  background: none; border: none; color: var(--text-secondary);
  font-size: 1.2rem; cursor: pointer; width: 32px; height: 32px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  transition: var(--transition-fast);
}
.modal-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.modal-body { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 1rem; }
.mention-context {
  padding: 0.5rem 0.7rem; background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm); font-size: 0.8rem; color: var(--text-secondary);
  border-left: 2px solid var(--accent-cyan);
}
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ── Follow-up Messages (expanded) ───────────────────────────────── */
.follow-up-section {
  margin-top: 0.5rem; padding-top: 0.5rem;
  border-top: 1px solid var(--border-glass);
}
.follow-up-section-title {
  font-size: 0.7rem; font-weight: 700;
  color: var(--accent-cyan);
  margin: 0.5rem 0 0.3rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border-glass);
  letter-spacing: 0.03em;
}
.follow-up-msg {
  padding: 0.3rem 0.5rem; margin-bottom: 0.2rem;
  font-size: 0.78rem; color: var(--text-secondary);
  border-left: 2px solid var(--accent-purple);
}
.follow-up-msg.trigger-msg {
  background: rgba(255,61,142,0.06);
  border-left: 3px solid var(--accent-magenta);
  font-weight: 500;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Utility ────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile-first enhancements
   ═══════════════════════════════════════════════════════════════════ */

/* ── Extra small phones (320px–480px) ───────────────────────── */
@media (max-width: 480px) {
  .app-container {
    max-width: 100%;
    padding: 0.4rem 0.4rem 2rem;
  }

  /* ── Header ─────────────────────────────────── */
  .header {
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
  }
  .header-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.4rem;
  }
  .logo h1 {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .logo-icon { font-size: 1.1rem; }
  .version { display: none; }
  .header-right {
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
    justify-content: flex-end;
  }
  .user-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem 0.15rem 0.2rem;
  }
  .user-name {
    max-width: 70px;
    font-size: 0.7rem;
  }
  .status-text { display: none; }
  .live-badge { font-size: 0.55rem; padding: 0.1rem 0.4rem; }
  .theme-toggle { width: 30px; height: 30px; font-size: 0.9rem; }
  .logout-btn { width: 28px; height: 28px; font-size: 0.8rem; }
  .notification-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    font-size: 0.6rem;
  }

  /* ── Tab Nav ────────────────────────────────── */
  .tab-nav {
    gap: 0.15rem;
    padding: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn {
    flex: 1 0 auto;
    font-size: 0.65rem;
    padding: 0.35rem 0.5rem;
    gap: 0.2rem;
    min-width: 0;
  }
  .tab-btn .tab-icon { font-size: 0.8rem; }
  .tab-btn .tab-count { display: none; }

  /* ── Filter Bar ─────────────────────────────── */
  .filter-bar {
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-md);
  }
  .filter-group {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 0;
  }
  .filter-group label { font-size: 0.65rem; }
  select {
    font-size: 0.7rem;
    padding: 0.3rem 1.6rem 0.3rem 0.5rem;
    min-width: 0;
    width: 100%;
    background-position: right 0.4rem center;
    background-size: 10px 10px;
  }
  .btn-refresh {
    width: 32px; height: 32px;
    flex-shrink: 0;
  }

  /* ── Mentions Grid & Cards ──────────────────── */
  .mentions-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .mention-group-row {
    grid-template-columns: 1fr;
  }
  .mention-group-rail {
    gap: 0.45rem;
    padding: 0.8rem;
    border-right: 0;
    border-bottom: 1px solid var(--border-glass);
  }
  .mention-group-latest {
    margin-top: 0;
  }
  .mention-group-cards {
    grid-template-columns: 1fr;
    padding: 0.7rem;
  }
  .mention-card {
    padding: 0.7rem;
  }
  .mention-card .card-header {
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .mention-card .group-name {
    font-size: 0.78rem;
    width: 100%;
    order: -1;
  }
  .mention-card .status-badge {
    font-size: 0.55rem;
    padding: 0.1rem 0.35rem;
  }
  .mention-card .card-meta {
    font-size: 0.62rem;
  }
  .mention-card .card-message {
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
    min-height: 3.8rem;
    max-height: 140px;
    -webkit-line-clamp: 6;
  }
  .mention-card .card-message.is-expanded {
    max-height: max-content;
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
  }
  .mention-card .card-actions {
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .mention-card .card-actions .btn-small {
    font-size: 0.65rem;
    padding: 0.25rem 0.45rem;
    flex: 1 0 calc(50% - 0.15rem);
    text-align: center;
  }
  .mention-card .card-ai {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
  }
  .mention-card .card-ai-pending {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
  }

  /* ── Timer Bar ──────────────────────────────── */
  .timer-bar {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
    flex-wrap: wrap;
    gap: 0.2rem;
  }
  .timer-bar .timer-clock { min-width: 48px; font-size: 0.68rem; }
  .timer-bar .timer-total { font-size: 0.6rem; }
  .timer-controls { width: 100%; margin-left: 0; }
  .timer-control { flex: 1; text-align: center; }

  /* ── HR Tab (Chat) ──────────────────────────── */
  .hr-header {
    padding: 0.6rem 0.8rem;
  }
  .hr-header h2 {
    font-size: 0.9rem;
  }
  .hr-header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
  .hr-header-actions { width: 100%; justify-content: flex-start; }
  .hr-subtitle { font-size: 0.65rem; }
  .hr-chat {
    max-height: 55vh;
    padding: 0 0.25rem 1.5rem;
    gap: 0.2rem;
  }
  .hr-message {
    max-width: 88%;
    padding: 0.45rem 0.6rem;
    border-radius: 14px;
  }
  .hr-msg-sender { font-size: 0.7rem; }
  .hr-msg-time { font-size: 0.55rem; }
  .hr-msg-text { font-size: 0.78rem; }
  .hr-send-bar {
    padding: 0.5rem 0.6rem;
    margin: 0.5rem 0.25rem 0;
    border-radius: var(--radius-lg);
    flex-direction: column;
    gap: 0.35rem;
  }
  .composer-row {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) clamp(42px, 12vw, 50px);
    align-items: end;
    gap: 0.45rem;
  }
  .hr-send-input {
    font-size: 0.78rem;
    padding: 0.45rem 0.6rem;
    min-height: 42px;
  }
  .composer-attach-btn,
  .hr-send-bar .btn-primary {
    width: 100%;
    min-width: 42px;
    max-width: 50px;
    height: 42px;
    padding: 0;
    font-size: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .composer-attach-btn {
    font-size: 1rem;
  }
  .hr-send-bar .btn-primary::before {
    content: '📤';
    font-size: 1rem;
    line-height: 1;
  }

  /* ── Schedule Tab ───────────────────────────── */
  .schedule-layout {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .schedule-panel, .schedule-list-panel {
    padding: 0.8rem 0.8rem;
    border-radius: var(--radius-md);
  }
  .schedule-panel h2, .schedule-list-panel h2 {
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
  }
  .schedule-form { gap: 0.5rem; }
  #scheduleMessage {
    font-size: 0.78rem;
    padding: 0.4rem 0.6rem;
    min-height: 50px;
  }
  .form-group label { font-size: 0.68rem; }
  .form-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  .form-row .form-group {
    flex: 1 1 100%;
  }
  .day-selector {
    gap: 0.2rem;
  }
  .day-selector button {
    width: 30px;
    height: 30px;
    font-size: 0.6rem;
  }
  .type-selector { flex-wrap: wrap; }
  .type-btn {
    font-size: 0.68rem;
    padding: 0.3rem 0.4rem;
  }
  .template-grid { gap: 0.25rem; }
  .template-chip {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }
  input[type="date"], input[type="time"] {
    font-size: 0.72rem;
    padding: 0.3rem 0.5rem;
  }

  .schedule-list { gap: 0.35rem; }
  .schedule-item {
    padding: 0.5rem 0.6rem;
    gap: 0.4rem;
    flex-wrap: wrap;
  }
  .schedule-info { width: 100%; }
  .schedule-msg {
    font-size: 0.75rem;
  }
  .schedule-meta {
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.62rem;
  }
  .schedule-actions {
    flex-direction: row;
    width: 100%;
    gap: 0.3rem;
  }
  .schedule-actions .btn-small {
    flex: 1;
    font-size: 0.62rem;
    padding: 0.25rem 0.4rem;
    text-align: center;
  }

  /* ── Modal ──────────────────────────────────── */
  .modal {
    width: 95%;
    max-width: 100%;
    padding: 1rem;
    max-height: 90vh;
    margin: 0 auto;
  }
  .modal-header h3 { font-size: 0.85rem; }
  .modal-body { gap: 0.5rem; }
  #replyText {
    font-size: 0.78rem;
    padding: 0.45rem 0.6rem;
  }
  .modal-footer { flex-wrap: wrap; gap: 0.35rem; }
  .modal-footer button {
    flex: 1;
    font-size: 0.72rem;
    padding: 0.35rem 0.6rem;
    text-align: center;
  }

  /* ── Toast ──────────────────────────────────── */
  .toast-container {
    bottom: 0.75rem;
    right: 0.5rem;
    left: 0.5rem;
  }
  .toast {
    min-width: 0;
    max-width: 100%;
    padding: 0.5rem 0.7rem;
  }
  .toast-title { font-size: 0.72rem; }
  .toast-text { font-size: 0.65rem; }

  /* ── Follow-up section ──────────────────────── */
  .follow-up-section-title { font-size: 0.62rem; }
  .follow-up-msg { font-size: 0.7rem; padding: 0.2rem 0.4rem; }

  /* ── Login Overlay ──────────────────────────── */
  .login-container {
    padding: 1.2rem 0.8rem !important;
  }
  .login-logo h1 {
    font-size: 1.15rem !important;
  }
  .login-logo-icon {
    font-size: 1.6rem !important;
  }
  .login-input {
    font-size: 0.9rem !important;
    padding: 0.55rem 0.7rem !important;
  }
  .login-code-input {
    font-size: 1.2rem !important;
  }
  .login-btn {
    font-size: 0.82rem;
    padding: 0.6rem 0.8rem;
  }
  .login-form-group label {
    font-size: 0.75rem;
  }
  .login-subtitle {
    font-size: 0.78rem;
  }
  .session-card {
    font-size: 0.78rem;
    padding: 0.6rem 0.7rem;
  }
  .session-card-phone { font-size: 0.8rem; }
  .session-card-time { font-size: 0.6rem; }
  .login-footer {
    position: static;
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 1rem;
    gap: 0.25rem;
  }
  .login-footer span { font-size: 0.6rem; }
  .login-dot { display: none; }

  /* ── Buttons (global) ───────────────────────── */
  .btn-primary {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }
  .btn-secondary {
    padding: 0.3rem 0.6rem;
    font-size: 0.68rem;
  }
  .btn-small {
    font-size: 0.65rem;
    padding: 0.25rem 0.45rem;
  }

  /* ── Empty state ────────────────────────────── */
  .empty-state { padding: 1.25rem; }
  .empty-state .empty-icon { font-size: 1.8rem; }
  .empty-state p { font-size: 0.75rem; }

  /* ── hr unread badge ────────────────────────── */
  .hr-unread-badge {
    font-size: 0.62rem;
    padding: 0.15rem 0.4rem;
  }
}

/* ── Small phones (321px–480px) — landscape fixes ───────────── */
@media (min-width: 481px) and (max-width: 640px) {
  .app-container {
    max-width: 100%;
    padding: 0.5rem 0.6rem 2rem;
  }
  .header { padding: 0.5rem 1rem; }
  .header-left h1 { font-size: 1rem; }
  .version { display: none; }
  .status-text { display: none; }
  .user-name { max-width: 80px; }

  .tab-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn {
    flex: 1 0 auto;
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
  }
  .tab-btn .tab-count { display: none; }

  .mentions-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .mention-group-row {
    grid-template-columns: 1fr;
  }
  .mention-group-rail {
    border-right: 0;
    border-bottom: 1px solid var(--border-glass);
  }
  .mention-group-cards {
    grid-template-columns: 1fr;
  }
  .schedule-layout {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .filter-bar { flex-wrap: wrap; gap: 0.4rem; }
  .filter-group { flex: 1; min-width: 0; }
  select { width: 100%; min-width: 0; }

  .hr-send-bar {
    flex-direction: column;
    gap: 0.35rem;
  }
  .composer-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) clamp(42px, 10vw, 50px);
    align-items: end;
    gap: 0.5rem;
  }
  .composer-attach-btn,
  .hr-send-bar .btn-primary {
    width: 100%;
    min-width: 42px;
    max-width: 50px;
    height: 42px;
    padding: 0;
  }
  .hr-send-bar .btn-primary {
    font-size: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .hr-send-bar .btn-primary::before {
    content: '📤';
    font-size: 1rem;
    line-height: 1;
  }

  .form-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .modal { width: 92%; }
  .toast-container { left: 0.75rem; right: 0.75rem; }
  .toast { max-width: 100%; }

  .schedule-item {
    flex-wrap: wrap;
  }
  .schedule-actions {
    flex-direction: row;
    width: 100%;
  }
  .schedule-actions .btn-small {
    flex: 1;
    text-align: center;
  }

  .mention-card .card-actions .btn-small {
    flex: 1 0 calc(50% - 0.15rem);
    text-align: center;
  }
}

/* ── Tablets / small desktops (641px–900px) ─────────────────── */
@media (min-width: 641px) and (max-width: 900px) {
  .app-container {
    max-width: 100%;
    padding: 0.75rem 1rem 3rem;
  }
  .mentions-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.8rem;
  }
  .mention-group-row {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .mention-group-cards {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
  .schedule-layout {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
  .tab-btn {
    font-size: 0.75rem;
    padding: 0.45rem 0.7rem;
  }
  .tab-btn .tab-count { display: none; }
  .filter-bar { flex-wrap: wrap; }
  .header-right { gap: 0.5rem; }
  .status-text { font-size: 0.68rem; }

  .form-row {
    flex-direction: row;
  }

  .hr-send-bar {
    flex-direction: column;
  }
  .composer-row {
    flex-direction: row;
  }
  .hr-send-bar .btn-primary {
    width: auto;
  }

  .schedule-item {
    flex-wrap: nowrap;
  }
  .schedule-actions {
    flex-direction: column;
    width: auto;
  }
}

/* ── Desktop 901px+ — keeps existing grid (even the largest screens) ─── */
@media (min-width: 901px) and (max-width: 1200px) {
  .mentions-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }
}

/* ── Wide screens (1200px+) ──────────────────────────────────── */
@media (min-width: 1201px) {
  .mentions-grid {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  }
}

/* ── Prevent zoom on double-tap for mobile buttons ─────────── */
button, select, input, textarea, .template-chip, .session-card {
  touch-action: manipulation;
}

/* ── Touch improvements (all screens) ────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  .tab-btn,
  .btn-small,
  .btn-primary,
  .btn-secondary,
  .btn-refresh,
  select,
  input[type="date"],
  input[type="time"],
  .template-chip,
  .day-selector button,
  .type-btn {
    min-height: 38px;
  }
  select { min-height: 40px; }
  .btn-small { min-height: 36px; }
  .mention-card .card-actions .btn-small { min-height: 36px; }
  .schedule-actions .btn-small { min-height: 36px; }
  .day-selector button { min-height: 38px; width: 38px; }
  .template-chip { min-height: 34px; }
  .btn-refresh { min-height: 38px; }
  .modal-close { min-height: 38px; }
  .theme-toggle { min-height: 38px; }
  .logout-btn { min-height: 36px; }
}

/* ═══════════════════════════════════════════════════════════════════
   LOGIN OVERLAY (Telegram auth)
   ═══════════════════════════════════════════════════════════════════ */

.login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--bg-deep);
  animation: fadeIn 0.5s ease-out;
}

.login-container {
  width: 100%; max-width: 440px;
  padding: 2.5rem 2rem 2rem;
  border-radius: var(--radius-xl);
  animation: modalPop 0.5s var(--transition-bounce);
  margin: 0 1rem;
}

.login-header {
  text-align: center; margin-bottom: 2rem;
}

.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.login-logo-icon {
  font-size: 2.2rem;
  animation: bounceIn 0.8s var(--transition-bounce);
}

.login-logo h1 {
  font-size: 1.6rem; font-weight: 800;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem; font-weight: 500;
}

.login-step {
  animation: fadeSlideIn 0.35s var(--transition-smooth);
}

.login-form-group {
  display: flex; flex-direction: column; gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.login-form-group label {
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-primary);
}

.login-input {
  font-size: 1.1rem !important;
  padding: 0.75rem 1rem !important;
  border-radius: var(--radius-md) !important;
  text-align: left;
  letter-spacing: 0.02em;
}

.login-code-input {
  text-align: center !important;
  font-size: 1.8rem !important;
  font-weight: 700;
  letter-spacing: 0.25em !important;
  font-family: var(--font-mono);
}

.login-hint {
  font-size: 0.7rem; color: var(--text-muted);
  line-height: 1.4;
}

.login-btn {
  width: 100%; padding: 0.8rem 1rem;
  font-size: 0.95rem; border-radius: var(--radius-md);
  margin-top: 0.3rem;
}

.login-btn:disabled {
  opacity: 0.5; cursor: not-allowed;
}

.login-back-row {
  margin-bottom: 1rem;
}

.login-back-btn {
  background: none; border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.8rem;
  padding: 0.35rem 0.8rem; cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition-fast);
}

.login-back-btn:hover {
  background: var(--bg-input-hover);
  color: var(--text-primary);
}

.login-error {
  margin-top: 1rem; padding: 0.6rem 0.8rem;
  background: rgba(255,61,142,0.08);
  border: 1px solid rgba(255,61,142,0.2);
  border-radius: var(--radius-sm);
  color: var(--accent-magenta);
  font-size: 0.8rem; font-weight: 500;
  animation: fadeSlideIn 0.25s var(--transition-smooth);
}

.login-loading {
  display: flex; flex-direction: column;
  align-items: center; gap: 1rem;
  padding: 2rem 0;
}

.login-loading p {
  color: var(--text-muted); font-size: 0.85rem;
}

.login-footer {
  position: absolute; bottom: 1.5rem;
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--text-muted); font-size: 0.7rem;
}

.login-dot {
  opacity: 0.4;
}

/* ── User Badge in Header ────────────────────────────────────── */
.user-badge {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.6rem 0.2rem 0.3rem;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-primary);
  transition: var(--transition-fast);
  cursor: default;
}

.user-badge:hover {
  border-color: var(--border-hover);
  background: var(--bg-input-hover);
}

.user-avatar {
  font-size: 1rem;
}

.user-name {
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Logout Button ─────────────────────────────────────────── */
.logout-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-input);
  color: var(--text-secondary); font-size: 0.95rem;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: var(--transition-fast);
}

.logout-btn:hover {
  background: rgba(255,61,142,0.1);
  border-color: var(--accent-magenta);
  color: var(--accent-magenta);
}

/* ── Session Picker Cards ──────────────────────────────────── */
.session-list {
  display: flex; flex-direction: column; gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.session-card {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: var(--transition-fast);
  animation: cardEnter 0.4s var(--transition-bounce) both;
  width: 100%;
}

.session-card:hover {
  background: var(--bg-input-hover);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,212,255,0.1);
}

.session-card-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.session-card-info {
  display: flex; flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

.session-card-phone {
  font-weight: 600;
  font-size: 0.9rem;
}

.session-card-time {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.session-card-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.session-card:hover .session-card-arrow {
  transform: translateX(4px);
  color: var(--accent-cyan);
}

.login-divider {
  display: flex; align-items: center; gap: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-glass);
}

@media (max-width: 500px) {
  .schedule-filter-bar {
    grid-template-columns: 1fr;
    gap: 0.4rem;
    padding: 0.55rem;
  }

  .schedule-category-head {
    padding: 0.65rem 0.7rem;
  }

  .schedule-category-list,
  .schedule-ungrouped-list {
    padding: 0.45rem;
  }

  .schedule-badges {
    margin: 0.35rem 0 0;
  }

  .login-container {
    padding: 1.5rem 1.2rem;
  }

  .login-logo h1 {
    font-size: 1.3rem;
  }

  .login-input {
    font-size: 1rem !important;
  }

  .login-code-input {
    font-size: 1.4rem !important;
  }
}

.md-link {
  color: var(--accent-cyan, #00d4ff);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.md-link:hover {
  color: #66e5ff;
  text-decoration: none;
}

/* ── Theme Selector Group ────────────────────────────────────────── */
.theme-selector-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  padding: 2px;
  height: 3.5vh;
  gap: 2px;
}

.theme-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  line-height: 1;
}

.theme-mode-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.theme-mode-btn.active {
  background: var(--gradient-hero);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 212, 255, 0.25);
}

/* ── Flatpickr Calendar Customization (Glass Dark Theme) ───────── */
.flatpickr-calendar {
  background: var(--bg-card, #121829) !important;
  border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.12)) !important;
  border-radius: var(--radius-md, 12px) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6) !important;
  font-family: var(--font-sans) !important;
  width: 308px !important;
}
.flatpickr-calendar .flatpickr-months {
  background: transparent !important;
  padding: 0.4rem 0.2rem !important;
}
.flatpickr-calendar .flatpickr-month {
  color: var(--text-primary, #ffffff) !important;
  fill: var(--text-primary, #ffffff) !important;
}
.flatpickr-calendar .flatpickr-current-month {
  font-size: 0.95rem !important;
  font-weight: 700 !important;
}
.flatpickr-calendar .flatpickr-current-month .flatpickr-monthDropdown-months {
  font-weight: 700 !important;
}
.flatpickr-calendar .flatpickr-weekdays {
  background: transparent !important;
  border-bottom: 1px solid var(--border-glass, rgba(255, 255, 255, 0.08)) !important;
  padding-bottom: 0.3rem !important;
  width: 100% !important;
}
.flatpickr-calendar .flatpickr-weekdaycontainer {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  width: 100% !important;
  text-align: center !important;
}
.flatpickr-calendar .flatpickr-weekday {
  color: var(--accent-cyan, #00d4ff) !important;
  font-weight: 700 !important;
  font-size: 0.75rem !important;
  text-align: center !important;
}
.flatpickr-calendar .flatpickr-days {
  width: 100% !important;
}
.flatpickr-calendar .dayContainer {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  justify-items: center !important;
  align-items: center !important;
  box-sizing: border-box !important;
  padding: 0 !important;
}
.flatpickr-calendar .flatpickr-day {
  color: var(--text-primary, #e2e8f0) !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
  transition: all 0.15s ease !important;
  width: 38px !important;
  max-width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  margin: 1px 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}
.flatpickr-calendar .flatpickr-day:hover {
  background: rgba(0, 212, 255, 0.18) !important;
  border-color: transparent !important;
  color: #ffffff !important;
}
.flatpickr-calendar .flatpickr-day.selected {
  background: var(--gradient-hero, linear-gradient(135deg, #00d4ff, #ff007a)) !important;
  border-color: transparent !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(0, 212, 255, 0.35) !important;
}
.flatpickr-calendar .flatpickr-day.today {
  border-color: var(--accent-cyan, #00d4ff) !important;
}
.flatpickr-calendar .flatpickr-day.prevMonthDay,
.flatpickr-calendar .flatpickr-day.nextMonthDay {
  color: var(--text-muted, #64748b) !important;
  opacity: 0.5 !important;
}
input.flatpickr-input {
  cursor: pointer;
}


/* ═══════════════════════════════════════════════════════════════════
   HUB DE CHATURI, ALERTE TEHNICE & SERVICE WORKER WEB PUSH
   ═══════════════════════════════════════════════════════════════════ */

/* ── Header Push Toggle Button ──────────────────────────────────── */
.push-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.push-toggle-btn:hover {
  background: var(--bg-input-hover);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}
.push-toggle-btn.active {
  border-color: rgba(0, 230, 118, 0.4);
  background: rgba(0, 230, 118, 0.08);
}
.push-toggle-btn.disabled {
  opacity: 0.6;
  border-color: rgba(255, 61, 142, 0.3);
}
.push-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.push-toggle-btn.active .push-indicator-dot {
  background: var(--accent-green, #00e676);
  box-shadow: 0 0 8px #00e676;
}
.push-toggle-btn.disabled .push-indicator-dot {
  background: #ef4444;
}

/* ── Filter Bar Button: Manage Chats ────────────────────────────── */
.btn-manage-chats {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-manage-chats:hover {
  background: var(--bg-input-hover);
  border-color: var(--accent-purple);
  box-shadow: 0 0 12px rgba(179, 136, 255, 0.2);
}
.badge-mini {
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  font-size: 0.68rem;
  background: rgba(255, 61, 142, 0.2);
  color: var(--accent-magenta);
  font-weight: 700;
}

/* ── Chat Cards Hub Section ─────────────────────────────────────── */
.chat-hub-section {
  margin-bottom: 1.25rem;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-smooth);
}
.chat-hub-section.is-collapsed .chat-hub-cards-grid {
  display: none;
}
.chat-hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-glass);
}
.chat-hub-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.chat-hub-icon {
  font-size: 1.15rem;
}
.chat-hub-title-group h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.chat-hub-count-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent-cyan);
  font-weight: 600;
}
.chat-hub-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.chat-hub-chips {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.hub-chip {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.hub-chip:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}
.hub-chip.active {
  background: var(--gradient-card);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.25);
}
.btn-icon-subtle {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.btn-icon-subtle:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-card);
}

/* ── Chat Hub Cards Grid ────────────────────────────────────────── */
.chat-hub-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}
.chat-hub-loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.chat-hub-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── Compact Chat Card (GPU-optimized: opaque surface, content-visibility) ── */
.chat-card-compact {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  content-visibility: auto;
  contain-intrinsic-size: auto 84px;
}
.chat-card-compact:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* Red Alert static high-contrast accent (GPU optimized: no infinite box-shadow animation) */
.chat-card-compact.has-critical-alert {
  border-left: 3px solid #ef4444;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.chat-card-compact.has-critical-alert:hover {
  border-color: #ef4444;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}

/* Priority / Recommended style */
.chat-card-compact.is-priority {
  border-color: rgba(255, 171, 0, 0.4);
}
.chat-card-compact.is-excluded {
  opacity: 0.55;
  filter: grayscale(0.5);
}

/* Card Header */
.chat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.chat-card-name-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
}
.chat-card-platform-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}
.chat-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-card-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* Badge: Red Alert Pulsing (GPU-optimized: static glow + lightweight compositor ring) */
.badge-red-pulse {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #ef4444;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.25);
  position: relative;
}
.badge-red-pulse::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  border: 1.5px solid rgba(239, 68, 68, 0.5);
  pointer-events: none;
  animation: badge-pulse-ring 2.2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}
.badge-red-pulse .pulse-icon {
  display: inline-block;
}

/* Badge: Yellow Warning Standard Mention */
.badge-yellow-warning {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 171, 0, 0.16);
  border: 1px solid rgba(255, 171, 0, 0.4);
  color: #ffab00;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-tag-priority {
  font-size: 0.7rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 171, 0, 0.15);
  color: #ffab00;
  font-weight: 700;
}
.badge-tag-excluded {
  font-size: 0.7rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: rgba(148, 148, 184, 0.15);
  color: var(--text-muted);
  font-weight: 700;
}

/* Card Body / Preview */
.chat-card-preview {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}
.chat-card-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.btn-card-quick {
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: 4px;
  color: var(--text-muted);
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-card-quick:hover {
  background: var(--bg-input-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.btn-card-quick.is-active-pri {
  color: #ffab00;
  border-color: rgba(255, 171, 0, 0.4);
  background: rgba(255, 171, 0, 0.1);
}
.btn-card-quick.is-active-exc {
  color: #ff3d8e;
  border-color: rgba(255, 61, 142, 0.4);
  background: rgba(255, 61, 142, 0.1);
}

/* ── Chat Management Modal ──────────────────────────────────────── */
.modal-lg {
  max-width: 680px;
  width: 92vw;
}
.modal-xl {
  max-width: 860px;
  width: 95vw;
}
.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.modal-header-icon {
  font-size: 1.4rem;
}
.modal-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0 0;
}
.chat-manage-add-box {
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1rem;
}
.chat-manage-input-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.chat-manage-input-row input {
  flex: 1;
  min-width: 200px;
}
.btn-action-exclude {
  padding: 0.45rem 0.85rem;
  background: rgba(255, 61, 142, 0.12);
  border: 1px solid rgba(255, 61, 142, 0.4);
  color: #ff3d8e;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-action-exclude:hover {
  background: rgba(255, 61, 142, 0.25);
  box-shadow: 0 0 10px rgba(255, 61, 142, 0.3);
}
.btn-action-priority {
  padding: 0.45rem 0.85rem;
  background: rgba(255, 171, 0, 0.12);
  border: 1px solid rgba(255, 171, 0, 0.4);
  color: #ffab00;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-action-priority:hover {
  background: rgba(255, 171, 0, 0.25);
  box-shadow: 0 0 10px rgba(255, 171, 0, 0.3);
}
.chat-manage-hint {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.chat-manage-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.5rem;
}
.manage-tab-btn {
  background: transparent;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.manage-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}
.manage-tab-btn.active {
  background: var(--bg-card);
  color: var(--accent-cyan);
  border: 1px solid var(--border-glass);
}
.chat-manage-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-right: 0.3rem;
}
.chat-manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast);
}
.chat-manage-item:hover {
  border-color: var(--border-hover);
}
.chat-manage-item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}
.chat-manage-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-manage-item-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.modal-footer-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ── Chat History Viewer Modal & Highlighting ────────────────────── */
.chat-history-body {
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem 1rem;
}
.chat-history-footer {
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-glass);
}
.chat-history-reply-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}
.chat-history-input {
  flex: 1;
  resize: none;
  min-height: 38px;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
}

/* Message bubbles in History Viewer (GPU-optimized: content-visibility) */
.chat-hist-bubble {
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  max-width: 85%;
  position: relative;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  content-visibility: auto;
  contain-intrinsic-size: auto 60px;
}
.chat-hist-bubble.outgoing {
  align-self: flex-end;
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
}
.chat-hist-bubble.incoming {
  align-self: flex-start;
}

.chat-hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
}
.chat-hist-sender {
  font-weight: 700;
  color: var(--accent-cyan);
}
.chat-hist-time {
  color: var(--text-muted);
}
.chat-hist-text {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* TRIGGER MESSAGE HIGHLIGHT: RED ALERT (GPU-optimized: static glow, zero continuous repaint) */
.chat-hist-bubble.is-alert-trigger.alert-critical {
  border: 2px solid #ef4444 !important;
  background: rgba(239, 68, 68, 0.09) !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.25) !important;
}
.chat-hist-bubble.is-alert-trigger.alert-warning {
  border: 2px solid #ffab00 !important;
  background: rgba(255, 171, 0, 0.08) !important;
  box-shadow: 0 0 14px rgba(255, 171, 0, 0.2) !important;
}

.trigger-highlight-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}
.trigger-highlight-banner.critical {
  background: rgba(255, 61, 142, 0.2);
  color: #ff3d8e;
  border: 1px solid rgba(255, 61, 142, 0.4);
}
.trigger-highlight-banner.warning {
  background: rgba(255, 171, 0, 0.2);
  color: #ffab00;
  border: 1px solid rgba(255, 171, 0, 0.4);
}

.trigger-bubble-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Hardware-Accelerated Compositor Keyframes (Zero Layout / Zero Paint) ─ */
@keyframes badge-pulse-ring {
  0% {
    transform: scale(0.96);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.22);
    opacity: 0;
  }
}

/* ── Accessibility & Performance: Prefers Reduced Motion ────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
