/* ── Design Tokens ── */
:root {
  font-size: clamp(0.77rem, 0.44rem + 0.88vw, 1.1rem);

  /* ── Brand ── */
  --color-primary:          #0F172A; /* Slate 900 */
  --color-primary-hover:    #1E293B;
  --color-accent:           #3B82F6; /* Modern Blue */
  --color-accent-hover:     #2563EB;
  --color-accent-light:     rgba(59, 130, 246, 0.15);

  /* ── Surfaces ── */
  --color-bg:               #ffffff;
  --color-bg-page:          #0F172A;
  --color-bg-muted:         #F8FAFC;
  --color-bg-input:         rgba(255, 255, 255, 0.6);
  --color-bg-agent-bubble:  #F8FAFC;
  
  /* Glassmorphism */
  --glass-bg:               rgba(255, 255, 255, 0.85);
  --glass-border:           rgba(255, 255, 255, 0.5);

  /* ── Text ── */
  --color-text:             #0F172A;
  --color-text-secondary:   #475569;
  --color-text-muted:       #64748B;
  --color-text-placeholder: #94A3B8;
  --color-text-inverse:     #ffffff;

  /* ── Borders ── */
  --color-border:           #E2E8F0;
  --color-border-focus:     #3B82F6;

  /* ── Feedback ── */
  --color-danger:           #EF4444;
  --color-danger-light:     #FEE2E2;
  --color-success:          #10B981;

  /* ── Typography ── */
  --font-family:            'Inter', system-ui, -apple-system, sans-serif;

  /* ── Spacing / Radius ── */
  --radius-sm:              0.75rem;
  --radius-md:              1rem;
  --radius-card:            1.5rem;
  --radius-pill:            624.9375rem;

  /* ── Effects ── */
  --bg-blur:                1.5rem;
  --shadow-sm:              0 0.25rem 0.375rem -1px rgba(0, 0, 0, 0.05), 0 0.125rem 0.25rem -1px rgba(0, 0, 0, 0.03);
  --shadow-card:            0 1.5625rem 3.125rem -0.75rem rgba(0, 0, 0, 0.15);
  --shadow-glow:            0 0 1.25rem rgba(59, 130, 246, 0.3);
}

/* ── Reset ── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  color: var(--color-text);
  overflow: hidden;
}

body {
  background: var(--color-bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
  width: 0.625rem;
  height: 0.625rem;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.9);
}

/* ── Ambient Background ── */
.ambient-background {
  display: none;
}

/* Apply background image only to chat screen */
#c0 {
  background: transparent;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.screen { display: flex; width: 100%; height: 100%; position: relative; z-index: 1; align-items: center; justify-content: center; }
.hidden { display: none !important; }

/* ── Glass Modal (Registration) ── */
.glass-modal {
  display: flex;
  width: 90vw;
  max-width: 48rem;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--bg-blur));
  -webkit-backdrop-filter: blur(var(--bg-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-left {
  flex: 0.85;
  background: var(--color-primary);
  color: white;
  padding: 2rem 2.5rem;
  box-sizing: border-box !important;
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
}
/* Safe flex centering without clipping */
.modal-left::before, .modal-left::after {
  content: "";
  margin: auto;
}

.brand-hero h1 { font-size: 1.75rem; font-weight: 700; margin: 1.25rem 0 0.75rem; line-height: 1.2; }
.brand-hero p { font-size: 0.9375rem; color: rgba(255,255,255,0.7); line-height: 1.5; }
.hero-logo .logo-img { height: 2.5rem; width: auto; filter: brightness(0) invert(1); }
.logo-fallback { font-size: 1.75rem; font-weight: 800; letter-spacing: -1px; }

.modal-right {
  flex: 1;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.5);
  overflow-y: auto;
}
/* Safe flex centering without clipping */
.modal-right::before, .modal-right::after {
  content: "";
  margin: auto;
}

.reg-header { margin-bottom: 2rem; }
.reg-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--color-primary); margin-bottom: 0.5rem; }
.reg-header p { font-size: 0.9375rem; color: var(--color-text-secondary); }

/* ── Modern Form ── */
.field { position: relative; margin-bottom: 1.25rem; }
.field-floating input {
  width: 100%;
  padding: 1.5rem 1rem 0.5rem 1rem;
  border: 0.125rem solid transparent;
  border-bottom-color: var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg-input);
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.field-floating input:focus { border-bottom-color: var(--color-border-focus); background: #fff; box-shadow: 0 0.25rem 0.75rem rgba(59,130,246,0.1); }
.field-floating input.input-error { border-bottom-color: var(--color-danger); }
.field-error { font-size: 0.75rem; color: var(--color-danger); margin-top: 0.375rem; font-weight: 500; }

.field-floating label {
  position: absolute;
  left: 1rem;
  top: 1.125rem;
  font-size: 0.9375rem;
  color: var(--color-text-placeholder);
  pointer-events: none;
  transition: all 0.2s ease-out;
  transform-origin: left top;
}
.field-floating input:focus + label,
.field-floating input:not(:placeholder-shown) + label {
  top: 0.5rem; font-size: 0.75rem; font-weight: 600; color: var(--color-border-focus);
}
.field-floating input:not(:focus):not(:placeholder-shown) + label { color: var(--color-text-secondary); }

.btn-primary {
  width: 100%;
  padding: 1rem;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.75rem;
}
.btn-primary:hover { background: var(--color-primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-glow); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}
.auth-divider:not(:empty)::before { margin-right: 1rem; }
.auth-divider:not(:empty)::after { margin-left: 1rem; }

.btn-google {
  width: 100%;
  padding: 1em 5%;
  background: white;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  white-space: nowrap;
}
.btn-google:hover { background: var(--color-bg-muted); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn-google img { width: 1.5rem; height: 1.5rem; }
/* ── Adaptive Chat Dashboard ── */
.chat-dashboard {
  width: 100%;
  background: transparent;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.dark-header {
  background: var(--color-primary);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.sidebar-toggle { color: rgba(255,255,255,0.8); margin-right: -0.25rem; transition: color 0.2s; }
.sidebar-toggle:hover { color: white; background: rgba(255,255,255,0.1); }
.header-avatar {
  background: rgba(255,255,255,0.1);
  padding: 0.625rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-avatar .logo-img { height: 1.5rem; width: auto; filter: brightness(0) invert(1); }
.header-title { font-size: 1.125rem; font-weight: 600; }
.header-subtitle { font-size: 0.8125rem; color: rgba(255,255,255,0.7); margin-top: 0.25rem; display: flex; align-items: center; gap: 0.375rem; }
.status-dot { width: 0.5rem; height: 0.5rem; background: var(--color-success); border-radius: 50%; display: inline-block; box-shadow: 0 0 0.5rem rgba(16,185,129,0.5); }

.btn-icon { background: transparent; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 50%; width: 2.25rem; height: 2.25rem; transition: all 0.2s; }
.btn-icon.btn-sm { width: 1.75rem; height: 1.75rem; }
.btn-light { color: white; }
.btn-light:hover { background: rgba(255,255,255,0.1); }
.btn-danger { color: #EF4444; background: rgba(239, 68, 68, 0.15); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); color: #DC2626; }

.btn-signout {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  font-family: var(--font-family);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.btn-signout svg {
  opacity: 0.8;
  transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
}
.btn-signout:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.btn-signout:hover svg {
  opacity: 1;
  color: var(--color-danger);
  transform: translateX(2px);
}
.btn-signout:active {
  transform: scale(0.97);
}

/* Messages Area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: transparent;
}
.messages-inner { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; }

.msg-group { display: flex; flex-direction: column; margin-bottom: 1.5rem; }
.msg-group.user { align-items: flex-end; }
.msg-group.agent { align-items: flex-start; }

.agent-msg {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  padding: 1rem 1.25rem;
  border-radius: 0.25rem 1.25rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  font-size: 0.9375rem;
  line-height: 1.6;
  max-width: 85%;
  color: var(--color-text);
  word-break: break-word;
  white-space: pre-wrap;
}
.agent-msg p { margin-bottom: 0.625rem; }
.agent-msg p:last-child { margin-bottom: 0; }
.agent-msg ul, .agent-msg ol { padding-left: 1.25rem; margin: 0.5rem 0; }
.agent-msg li { margin-bottom: 0.375rem; }

.bubble {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.6), rgba(96, 165, 250, 0.6));
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  color: white;
  padding: 1rem 1.25rem;
  border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  max-width: 85%;
  box-shadow: var(--shadow-sm);
  word-break: break-word;
  white-space: pre-wrap;
}
.bubble p { margin-bottom: 0.25rem; }
.bubble p:last-child { margin-bottom: 0; }

.msg-time { font-size: 0.75rem; color: rgba(255,255,255,0.9); margin-top: 0.5rem; text-shadow: 0 1px 0.1875rem rgba(0,0,0,0.6); font-weight: 500; }

/* Command Palette Input */
.input-area {
  padding: 1.25rem 1.5rem;
  background: transparent;
  border-top: 1px solid var(--color-border);
}
.command-palette {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.75rem;
  box-shadow: var(--shadow-sm);
  gap: 0.5rem;
  transition: all 0.2s;
}
.command-palette:focus-within { border-color: var(--color-border-focus); box-shadow: 0 0 0 0.1875rem var(--color-accent-light); }

#b2 {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.9375rem;
  font-family: var(--font-family);
  padding: 0.5rem;
  background: transparent;
}
#b2::placeholder { color: #475569; opacity: 1; }

.btn-action {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-bg-muted); color: var(--color-primary); }
.btn-send { background: var(--color-primary); color: white; }
.btn-send:hover:not(:disabled) { background: var(--color-primary-hover); transform: scale(1.05); }
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; background: var(--color-text-muted); }
.btn-action.is-recording { background: var(--color-danger); color: white; animation: pulse 1.5s infinite; }

/* Floating Action Bars */
.action-bars-container {
  padding: 0 1.5rem;
  background: transparent;
}
.floating-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow-sm);
}
.attachment-bar { background: white; border: 1px solid var(--color-border); }
.recording-bar { background: var(--color-danger-light); color: var(--color-danger); font-weight: 600; border: 1px solid #FECACA; }
.bar-left { display: flex; align-items: center; gap: 0.5rem; }
.rec-dot { width: 0.625rem; height: 0.625rem; background: var(--color-danger); border-radius: 50%; animation: pulse 1.5s infinite; }

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

/* Typing indicator */
.agent-msg.loading { display: inline-flex; align-items: center; padding: 1rem 1.25rem; }
.typing-bubble { display: flex; gap: 0.375rem; }
.typing-dot { width: 0.375rem; height: 0.375rem; background: var(--color-text-muted); border-radius: 50%; animation: typing 1.4s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.25rem); } }

/* Responsive */
@media (max-width: 48rem) {
  .glass-modal { flex-direction: column; }
  .modal-left, .modal-right { padding: 2rem; }
  .chat-dashboard { height: 100dvh; border-radius: 0; }
  #app { padding: 0; }
}

/* ── Sidebar and Layout ── */
.chat-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}
.chat-sidebar {
  width: 0;
  opacity: 0;
  overflow: hidden;
  background: var(--color-primary);
  border-right: none;
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  white-space: nowrap;
  position: relative;
}
.chat-sidebar.resizing {
  transition: none !important;
}
.sidebar-resizer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  background: transparent;
  z-index: 100;
  transition: background 0.2s;
}
.sidebar-resizer:hover, .sidebar-resizer.active {
  background: rgba(255, 255, 255, 0.3);
}
body.sidebar-open .chat-sidebar {
  width: 16.25rem;
  opacity: 1;
}
.sidebar-header { padding: 1rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.new-chat-btn-chatgpt {
  width: 100%; display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 0.75rem;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 500; font-size: 0.875rem; font-family: var(--font-family); transition: all 0.2s; color: white;
}
.new-chat-btn-chatgpt:hover { background: rgba(255,255,255,0.15); }
.sidebar-heading { padding: 1rem 1rem 0.5rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: rgba(255,255,255,0.5); }
.sidebar-list { flex: 0 1 auto; overflow-y: auto; padding: 0.5rem; min-height: 0; }
.sidebar-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); }
.sidebar-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }
.sidebar-item {
  display: block !important;
  position: relative !important;
  width: 100%; text-align: left; padding: 0.625rem 0.75rem; background: transparent; border: none;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 0.875rem; font-family: var(--font-family); color: rgba(255,255,255,0.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.25rem; transition: all 0.2s;
}
.sidebar-item:hover { background: rgba(255,255,255,0.08); }
.sidebar-item.active { background: rgba(255,255,255,0.15); font-weight: 500; color: white; }

.chat-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  background: var(--bg-image) no-repeat center center;
  background-size: cover;
}
.chat-main::before {
  content: "";
  position: absolute;
  inset: 0;
  backdrop-filter: blur(0.3125rem);
  -webkit-backdrop-filter: blur(0.3125rem);
  background: rgba(0, 0, 0, 0.2);
  z-index: 0;
}
.messages-area, .action-bars-container, .input-area {
  position: relative;
  z-index: 1;
}

/* ── Display Modes ── */
body.mode-widget #app { padding: 1.5rem; }
body.mode-widget .glass-modal { width: 95vw; max-width: 35rem; max-height: 90vh; flex-direction: column; overflow-y: auto; }
body.mode-widget .modal-left { padding: 0.75rem 2rem 1.5rem; flex: unset; overflow-y: hidden; }
body.mode-widget .brand-hero h1 { font-size: 1.25rem; margin: 0.75rem 0 0.375rem; }
body.mode-widget .brand-hero p { font-size: 0.8125rem; }
body.mode-widget .hero-logo .logo-img { height: 2rem; }
body.mode-widget .chat-dashboard { width: 95vw; max-width: 35rem; height: 85vh; max-height: 45rem; }
body.mode-widget .chat-sidebar { display: none; }
body.mode-widget .sidebar-toggle { display: none; }

body.mode-fullscreen #app { padding: 0; }

body.mode-fullscreen .glass-modal {
  width: 95vw;
  max-width: 60rem;
  max-height: 95vh;
}

body.mode-fullscreen .chat-dashboard {
  max-width: 100%; height: 100dvh; border-radius: 0;
}
body.mode-fullscreen .chat-sidebar { display: flex; }

/* ── Fullscreen Centered Empty State ── */
body.mode-fullscreen .chat-main { align-items: center; }
body.mode-fullscreen .messages-area {
  width: 100%; max-width: none;
}
body.mode-fullscreen .messages-inner {
  width: 100%; max-width: 47rem; margin: 0 auto;
}
body.mode-fullscreen .input-area,
body.mode-fullscreen .action-bars-container {
  width: 100%; max-width: 50rem; margin: 0 auto;
}
body.mode-fullscreen .input-area { background: transparent; border-top: none; padding-bottom: 2.5rem; }
body.mode-fullscreen .chat-empty .chat-main { justify-content: center; }
body.mode-fullscreen .chat-empty .messages-area { flex: 0 1 auto; }
body.mode-fullscreen .messages-area { flex: 1; }

/* Fallbacks & Misc */
.file-bubble, .audio-bubble {
  background: white;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}
.msg-group.user .file-bubble, .msg-group.user .audio-bubble { background: white; color: var(--color-primary); }
.options-group { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; margin-top: 0.75rem; }
.option-btn { background: white; border: 1px solid var(--color-border); padding: 0.75rem 1rem; border-radius: var(--radius-sm); color: var(--color-primary); font-weight: 500; cursor: pointer; transition: all 0.2s; }
.option-btn:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); }
.empty-state {
  text-align: center;
  color: var(--color-text-secondary);
  margin: auto;
  padding: 2rem 3rem;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.5);
  max-width: 90%;
}
.empty-state h3 { font-size: 1.375rem; font-weight: 700; color: var(--color-text); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.9375rem; font-weight: 500; }
/* ── Sidebar Ad Container (Image Only) ── */
.sidebar-ad-container {
  margin: auto 0.5rem;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}
.sidebar-ad-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}
.sidebar-ad-image-wrapper {
  display: grid;
  width: 100%;
  margin-top: 0.25rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: transparent;
}
.sidebar-ad-image {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  max-height: 35vh;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}
.sidebar-ad-image.active {
  opacity: 1;
}

.chat-link { color: var(--color-accent); text-decoration: none; font-weight: 500; }
.chat-link:hover { text-decoration: underline; }

/* ── WhatsApp Dock ── */
.sidebar-dock {
  margin-top: 0;
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.02);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  border: none;
  border-radius: 0;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease;
  font-family: inherit;
  color: rgba(255,255,255,0.85);
}
.sidebar-dock:hover {
  background: rgba(255,255,255,0.08);
}
.dock-text {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
}
.dock-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.dock-icon:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.2);
}
.dock-icon svg { width: 1.25rem; height: 1.25rem; }

/* ── WhatsApp Modal ── */
.wa-modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(0.5rem);
  -webkit-backdrop-filter: blur(0.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s;
}
.wa-modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.wa-modal-content {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  border: 1px solid white;
  border-radius: 1.25rem;
  padding: 2.5rem;
  width: 90vw;
  max-width: 24rem;
  text-align: center;
  box-shadow: 0 1.5rem 3rem rgba(0,0,0,0.3);
  position: relative;
  transform: translateY(0) scale(1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.wa-modal-overlay.hidden .wa-modal-content {
  transform: translateY(2rem) scale(0.95);
}
.wa-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color 0.2s;
}
.wa-modal-close:hover { color: var(--color-text); }
.wa-icon-large { margin-bottom: 1rem; }
.wa-icon-large svg { width: 3rem; height: 3rem; }
.wa-modal-content h3 { font-size: 1.25rem; margin-bottom: 0.5rem; color: var(--color-primary); }
.wa-modal-content p { font-size: 0.875rem; color: var(--color-text-secondary); margin-bottom: 1.5rem; }
.wa-qr { background: white; border-radius: 0.5rem; padding: 0.5rem; display: inline-block; box-shadow: 0 0.25rem 1rem rgba(0,0,0,0.1); }
.wa-qr img { width: 100%; max-width: 10rem; height: auto; aspect-ratio: 1/1; image-rendering: pixelated; display: block; }

/* ── Mobile fullscreen: sidebar as overlay, hamburger always visible ── */
@media (max-width: 47.9375rem) {
  body.mode-fullscreen .chat-sidebar {
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    width: 0;
    opacity: 0;
    box-shadow: none;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, box-shadow 0.3s;
  }
  body.mode-fullscreen.sidebar-open .chat-sidebar {
    width: 85vw;
    max-width: 22rem;
    opacity: 1;
    box-shadow: 0.25rem 0 1.5rem rgba(0, 0, 0, 0.5);
  }
  body.mode-fullscreen .sidebar-toggle { display: flex; }
}

/* Phone Input & intl-tel-input overrides */
.phone-input {
  width: 100%;
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
  padding-right: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-input);
  font-size: 0.9375rem;
  font-family: var(--font-family);
  color: var(--color-text);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
  height: 3.125rem;
}
.phone-input:focus {
  border-color: var(--color-border-focus);
  background: #fff;
  box-shadow: 0 0.25rem 0.75rem rgba(59,130,246,0.1);
}
.phone-input.input-error {
  border-color: var(--color-danger);
}
.iti { width: 100%; display: block; }
.iti__country-list { z-index: 99; border-radius: 0.75rem; border: 1px solid var(--color-border); box-shadow: 0 0.25rem 0.75rem rgba(0,0,0,0.1); font-family: var(--font-family); }
.iti__selected-flag { border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding: 0 0.75rem 0 1rem; }
.iti__selected-dial-code { font-size: 0.9375rem; color: var(--color-text); font-family: var(--font-family); }
.error-box {
  color: var(--color-danger);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 0.375rem;
  display: none;
  align-items: center;
  gap: 0.375rem;
  animation: slideDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.error-box.show {
  display: flex;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-0.25rem); }
  to { opacity: 1; transform: translateY(0); }
}