/* =========================================================================
   app.css — Eventuality Caflou Asistent — Premium Design System
   Palette: teal-ocean calm, warm, organic, guide-like
   Fonts: Plus Jakarta Sans (body/UI) + Fraunces (display headings)
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. CUSTOM PROPERTIES (design tokens)
   ------------------------------------------------------------------------- */
:root {
  /* Brand colors */
  --primary:   #4e888e;
  --accent:    #6fb0b7;
  --logo:      #55a7b3;
  --dark:      #2d5155;
  --light:     #e6f2f3;

  /* Surface palette */
  --surface:        #ffffff;
  --surface-tint:   #f0f8f9;
  --surface-mid:    #ddeef0;
  --border:         rgba(78, 136, 142, 0.18);
  --border-strong:  rgba(78, 136, 142, 0.35);

  /* Text */
  --text-primary:   #1a3335;
  --text-secondary: #4a6d71;
  --text-muted:     #7a9fa3;
  --text-inverse:   #ffffff;

  /* Gradients */
  --gradient-brand:   linear-gradient(135deg, #4e888e 0%, #6fb0b7 100%);
  --gradient-surface: linear-gradient(160deg, #f0f8f9 0%, #e6f2f3 100%);
  --gradient-dark:    linear-gradient(135deg, #2d5155 0%, #3d7075 100%);

  /* Shadows — layered organic depth */
  --shadow-xs:  0 1px 3px rgba(45, 81, 85, 0.06), 0 1px 2px rgba(45, 81, 85, 0.04);
  --shadow-sm:  0 2px 8px rgba(45, 81, 85, 0.08), 0 1px 3px rgba(45, 81, 85, 0.06);
  --shadow-md:  0 4px 16px rgba(45, 81, 85, 0.12), 0 2px 6px rgba(45, 81, 85, 0.08);
  --shadow-lg:  0 8px 32px rgba(45, 81, 85, 0.16), 0 4px 12px rgba(45, 81, 85, 0.10);
  --shadow-xl:  0 16px 48px rgba(45, 81, 85, 0.22), 0 8px 20px rgba(45, 81, 85, 0.14);

  /* Radius */
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-pill: 999px;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Type scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-md:   1.0625rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.5rem;

  /* Transitions */
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth:  cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:     cubic-bezier(0, 0, 0.2, 1);
  --dur-fast:     150ms;
  --dur-mid:      250ms;
  --dur-slow:     400ms;

  /* Navbar height */
  --navbar-h: 60px;
}

/* -------------------------------------------------------------------------
   2. RESET & BASE
   ------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--gradient-surface);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Atmospheric background wash */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 20% 10%, rgba(111, 176, 183, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 80% 90%, rgba(78, 136, 142, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

main, header, section, div {
  position: relative;
}

img { max-width: 100%; display: block; }

a { color: var(--primary); }

/* -------------------------------------------------------------------------
   3. ACCESSIBILITY
   ------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* -------------------------------------------------------------------------
   4. NAVBAR
   ------------------------------------------------------------------------- */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-h);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

#site-nav {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
  max-width: 1280px;
  margin: 0 auto;
}

.eve-nav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  flex-shrink: 0;
}

.eve-nav-logo img {
  height: 32px;
  width: auto;
  object-fit: contain;
  transition: opacity var(--dur-mid) var(--ease-smooth);
}

.eve-nav-logo img:hover { opacity: 0.82; }

.eve-nav-logo-fallback {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.eve-nav-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.eve-nav-title span {
  display: block;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}

.eve-nav-spacer { flex: 1; }

/* Nav button */
.eve-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-4);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  transition:
    background var(--dur-fast) var(--ease-smooth),
    color var(--dur-fast) var(--ease-smooth),
    border-color var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-fast) var(--ease-smooth),
    transform var(--dur-fast) var(--ease-spring);
  min-height: 36px;
  white-space: nowrap;
}

.eve-nav-btn:hover {
  background: var(--light);
  color: var(--dark);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.eve-nav-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  background: var(--gradient-brand);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* -------------------------------------------------------------------------
   5. LOGIN / AUTH PAGES
   ------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  padding-top: max(var(--sp-6), env(safe-area-inset-top));
  padding-bottom: max(var(--sp-6), env(safe-area-inset-bottom));
  position: relative;
  overflow: hidden;
}

/* Jungle backdrop */
.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url('https://eventuality.app/static/brand/bg/jungle.png');
  background-size: cover;
  background-position: center;
  z-index: -2;
}

/* Dark teal overlay for readability */
.login-page::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(
    155deg,
    rgba(20, 48, 52, 0.82) 0%,
    rgba(45, 81, 85, 0.76) 50%,
    rgba(30, 62, 66, 0.88) 100%
  );
  z-index: -1;
}

/* Override body::before on login pages */
.login-page ~ * body::before { display: none; }

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    var(--shadow-xl),
    0 0 0 1px rgba(111, 176, 183, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  padding: var(--sp-10) var(--sp-8);
  animation: card-rise 0.6s var(--ease-spring) both;
}

@keyframes card-rise {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.login-brand-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  animation: logo-pop 0.5s var(--ease-spring) 0.15s both;
}

@keyframes logo-pop {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.login-brand-fallback {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.login-brand-fallback span {
  font-family: 'Fraunces', serif;
  font-size: var(--text-2xl);
  font-weight: 600;
  color: white;
}

.login-heading {
  font-family: 'Fraunces', serif;
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  text-align: center;
  letter-spacing: -0.02em;
  line-height: 1.2;
  animation: fade-in 0.4s var(--ease-out) 0.25s both;
}

.login-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: center;
  margin: var(--sp-2) 0 0;
  line-height: 1.5;
  animation: fade-in 0.4s var(--ease-out) 0.32s both;
}

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

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  animation: fade-in 0.4s var(--ease-out) 0.4s both;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form-input {
  width: 100%;
  padding: 12px var(--sp-4);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.7);
  transition:
    border-color var(--dur-mid) var(--ease-smooth),
    box-shadow var(--dur-mid) var(--ease-smooth),
    background var(--dur-mid) var(--ease-smooth);
  min-height: 48px;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(78, 136, 142, 0.18), var(--shadow-sm);
}

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

.form-error {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-4);
  background: rgba(200, 60, 60, 0.08);
  border: 1px solid rgba(200, 60, 60, 0.22);
  border-radius: var(--radius-sm);
  color: #b83232;
  font-size: var(--text-sm);
  font-weight: 500;
  margin: 0;
  animation: shake 0.4s var(--ease-spring);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-5px); }
  75%       { transform: translateX(5px); }
}

.form-error::before {
  content: '✕';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: rgba(200, 60, 60, 0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.btn-submit {
  width: 100%;
  padding: 13px var(--sp-6);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 700;
  color: white;
  background: var(--gradient-brand);
  cursor: pointer;
  min-height: 48px;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 16px rgba(78, 136, 142, 0.4), 0 2px 4px rgba(78, 136, 142, 0.25);
  transition:
    box-shadow var(--dur-mid) var(--ease-smooth),
    transform var(--dur-fast) var(--ease-spring),
    filter var(--dur-mid) var(--ease-smooth);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(78, 136, 142, 0.5), 0 4px 8px rgba(78, 136, 142, 0.3);
  filter: brightness(1.06);
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(78, 136, 142, 0.3);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.login-hint {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: var(--sp-4) 0 0;
  animation: fade-in 0.4s var(--ease-out) 0.5s both;
}

/* -------------------------------------------------------------------------
   6. CHAT PAGE
   ------------------------------------------------------------------------- */
#main-content.chat-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--navbar-h));
  height: calc(100dvh - var(--navbar-h));
  overflow: hidden;
}

.chat-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

/* ---- Messages scroll area ---- */
#messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-6) var(--sp-2);
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

/* Scrollbar */
#messages::-webkit-scrollbar { width: 5px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb {
  background: var(--surface-mid);
  border-radius: var(--radius-pill);
}
#messages::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ---- Message rows ---- */
.msg-row {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-end;
  animation: msg-appear 0.35s var(--ease-spring) both;
}

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

.msg-row--user {
  flex-direction: row-reverse;
}

/* Avatar */
.msg-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  align-self: flex-end;
}

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

.msg-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: var(--text-sm);
}

/* Bubble group */
.msg-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 72%;
}

.msg-row--user .msg-group { align-items: flex-end; }

/* Individual bubble */
.msg {
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  font-size: var(--text-md);
  line-height: 1.55;
  word-break: break-word;
  position: relative;
}

.msg-user {
  background: var(--gradient-brand);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 12px rgba(78, 136, 142, 0.3);
}

.msg-assistant {
  background: white;
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

/* Markdown-like rendering inside bubbles */
.msg-content { display: block; overflow-wrap: anywhere; word-break: break-word; }

.msg-content strong { font-weight: 700; }

.msg-content code {
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  font-size: 0.875em;
  background: rgba(78, 136, 142, 0.1);
  border-radius: 3px;
  padding: 1px 4px;
}

.msg-assistant .msg-content code { background: rgba(78, 136, 142, 0.12); }

.msg-user .msg-content code {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

.msg-content ul {
  margin: var(--sp-2) 0 0;
  padding-left: var(--sp-5);
  list-style-type: disc;
}

.msg-content li { margin-bottom: 2px; }

/* Markdown tables */
.md-table-wrap {
  overflow-x: auto;
  margin: var(--sp-2) 0;
  border-radius: var(--radius-sm);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  line-height: 1.45;
  min-width: 240px;
}

.md-table th,
.md-table td {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  text-align: left;
  white-space: nowrap;
}

.md-table th {
  background: var(--surface-mid);
  font-weight: 700;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.md-table tr:nth-child(even) td { background: var(--surface-tint); }
.md-table tr:hover td { background: var(--light); }

/* Tools badge */
.msg-tools-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--sp-2);
  padding: 4px 10px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--text-muted);
  width: fit-content;
}

.msg-tools-badge svg { flex-shrink: 0; }

/* ---- Typing indicator ---- */
.msg-typing-row {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-end;
  animation: msg-appear 0.3s var(--ease-spring) both;
}

.typing-bubble {
  background: white;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.typing-status {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  transition: opacity 0.4s var(--ease-smooth);
  animation: status-fade 2.5s var(--ease-smooth) infinite;
}

@keyframes status-fade {
  0%, 80%  { opacity: 1; }
  90%      { opacity: 0.3; }
  100%     { opacity: 1; }
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing-bounce 1.1s var(--ease-spring) infinite;
}

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

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.45; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* ---- Empty state ---- */
#empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  gap: var(--sp-5);
  animation: fade-in 0.5s var(--ease-out) both;
}

.empty-mascot {
  width: 88px;
  height: 88px;
  object-fit: contain;
  animation: mascot-float 3.5s ease-in-out infinite;
  filter: drop-shadow(0 8px 20px rgba(78, 136, 142, 0.25));
}

@keyframes mascot-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.empty-heading {
  font-family: 'Fraunces', serif;
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.empty-sub {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
  max-width: 340px;
  line-height: 1.55;
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
  max-width: 480px;
}

.example-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 16px;
  background: white;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition:
    background var(--dur-fast) var(--ease-smooth),
    border-color var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-fast) var(--ease-smooth),
    transform var(--dur-fast) var(--ease-spring);
  box-shadow: var(--shadow-xs);
  min-height: 44px;
}

.example-chip:hover {
  background: var(--light);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm), 0 0 0 3px rgba(78, 136, 142, 0.1);
  transform: translateY(-2px);
}

.example-chip:active { transform: translateY(0); }

/* ---- Composer ---- */
.chat-composer {
  background: linear-gradient(to top, #e6f2f3 0%, #e6f2f3 58%, rgba(230, 242, 243, 0) 100%);
  padding: var(--sp-6) var(--sp-2) var(--sp-3);
  padding-bottom: max(var(--sp-3), env(safe-area-inset-bottom));
}

.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  background: white;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  transition:
    border-color var(--dur-mid) var(--ease-smooth),
    box-shadow var(--dur-mid) var(--ease-smooth);
  box-shadow: var(--shadow-sm);
}

.composer-inner:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(78, 136, 142, 0.16), var(--shadow-md);
}

#chat-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text-primary);
  line-height: 1.5;
  resize: none;
  max-height: 160px;
  min-height: 24px;
  overflow-y: auto;
  background: transparent;
  padding: 6px 0;
}

#chat-input::placeholder { color: var(--text-muted); }

#chat-input::-webkit-scrollbar { width: 3px; }
#chat-input::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

#send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) var(--ease-smooth),
    filter var(--dur-mid) var(--ease-smooth);
  box-shadow: 0 3px 12px rgba(78, 136, 142, 0.4);
  min-width: 40px;
  min-height: 40px;
}

#send-btn:hover:not(:disabled) {
  transform: scale(1.08) translateY(-1px);
  box-shadow: 0 5px 18px rgba(78, 136, 142, 0.5);
  filter: brightness(1.08);
}

#send-btn:active:not(:disabled) {
  transform: scale(0.96);
}

#send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#send-btn svg { width: 18px; height: 18px; }

/* -------------------------------------------------------------------------
   7. ADMIN PAGE
   ------------------------------------------------------------------------- */
#main-content.admin-layout {
  height: calc(100vh - var(--navbar-h));
  height: calc(100dvh - var(--navbar-h));
  overflow: hidden;
}

.admin-section {
  display: flex;
  height: 100%;
  gap: 0;
  background: var(--surface-tint);
}

/* Left panel */
#conversations-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.panel-header {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-heading {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.panel-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  font-family: 'Plus Jakarta Sans', sans-serif;
  display: block;
  margin-top: 2px;
}

.conversations-list {
  list-style: none;
  margin: 0;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  overflow-y: auto;
  flex: 1;
}

.conversations-list::-webkit-scrollbar { width: 3px; }
.conversations-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.conversation-item a.conversation-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px var(--sp-3);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  background: transparent;
  transition:
    background var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-fast) var(--ease-smooth);
  border: 1px solid transparent;
}

.conversation-item a.conversation-link:hover {
  background: var(--light);
  border-color: var(--border);
}

.conversation-item--active a.conversation-link {
  background: var(--gradient-brand);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.conversation-item--active .conv-meta,
.conversation-item--active .conv-time { color: rgba(255,255,255,0.75) !important; }

.conv-id {
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  font-size: var(--text-sm);
  font-weight: 600;
}

.conv-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.conv-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.conv-time { font-variant-numeric: tabular-nums; }

/* Right panel */
#messages-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-panel-header {
  padding: var(--sp-5) var(--sp-6) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.messages-panel-header .panel-heading { font-size: var(--text-base); }

.conv-id-full {
  font-family: monospace;
  font-size: var(--text-xs);
  background: var(--surface-mid);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.admin-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.admin-messages-scroll::-webkit-scrollbar { width: 5px; }
.admin-messages-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.admin-messages-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.admin-msg {
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  transition: box-shadow var(--dur-fast);
}

.admin-msg:hover { box-shadow: var(--shadow-sm); }

.admin-msg-user {
  background: rgba(78, 136, 142, 0.06);
  border-color: rgba(78, 136, 142, 0.18);
}

.admin-msg-assistant {
  background: white;
}

.admin-msg-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.admin-msg-role {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.admin-msg-user .admin-msg-role {
  background: rgba(78, 136, 142, 0.15);
  color: var(--dark);
}

.admin-msg-assistant .admin-msg-role {
  background: var(--surface-mid);
  color: var(--text-secondary);
}

.admin-msg-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.admin-msg-content {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-msg-tools {
  margin-top: var(--sp-3);
  font-size: var(--text-xs);
}

.admin-msg-tools summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  padding: 3px 0;
}

.admin-msg-tools summary:hover { color: var(--primary); }

.tools-json {
  background: var(--dark);
  color: #a8d8dd;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: var(--text-xs);
  margin: var(--sp-2) 0 0;
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  line-height: 1.5;
}

.admin-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  color: var(--text-muted);
  padding: var(--sp-8);
}

.admin-empty-icon {
  width: 64px;
  height: 64px;
  opacity: 0.3;
  object-fit: contain;
}

.admin-empty p {
  font-size: var(--text-sm);
  margin: 0;
  text-align: center;
  max-width: 240px;
  line-height: 1.6;
}

/* -------------------------------------------------------------------------
   8. EMPTY STATE (shared)
   ------------------------------------------------------------------------- */
.empty-state-generic {
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* -------------------------------------------------------------------------
   9. ANIMATIONS — stagger helpers
   ------------------------------------------------------------------------- */
[data-stagger] { animation: fade-in 0.35s var(--ease-out) calc(var(--i, 0) * 60ms) both; }

/* -------------------------------------------------------------------------
   10. RESPONSIVE — 640px breakpoint (mobile)
   ------------------------------------------------------------------------- */
@media (max-width: 640px) {
  :root { --navbar-h: 56px; }

  #site-nav { padding: 0 var(--sp-4); }

  .eve-nav-title span { display: none; }

  /* Admin: stack panels */
  #main-content.admin-layout {
    height: auto;
    overflow: auto;
  }

  .admin-section {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--navbar-h));
  }

  #conversations-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 260px;
  }

  #messages-panel { min-height: 50vh; }

  .admin-messages-scroll {
    padding: var(--sp-4);
    overflow-y: visible;
  }

  /* Chat */
  #main-content.chat-layout {
    height: calc(100dvh - var(--navbar-h));
  }

  .msg-group { max-width: 85%; }

  .chat-composer { padding: var(--sp-3) var(--sp-3); }

  .example-chips { gap: var(--sp-2); }
  .example-chip { font-size: var(--text-xs); padding: 7px 13px; }

  /* Login */
  .login-card {
    padding: var(--sp-8) var(--sp-6);
    border-radius: var(--radius-lg);
  }

  .login-heading { font-size: var(--text-xl); }
}

/* -------------------------------------------------------------------------
   11. RESPONSIVE — 960px breakpoint (tablet)
   ------------------------------------------------------------------------- */
@media (min-width: 641px) and (max-width: 960px) {
  #conversations-panel { width: 240px; }

  .msg-group { max-width: 80%; }
}
