/* ========================================
   PALETA ALSEA — CANDY
   ======================================== */
:root {
  --alsea-blue: #005782;
  --sky: #85CAF0;
  --mint: #9FD7CB;
  --aqua: #00A7C7;
  --jeans: #347DC1;
  --ice: #DEE5E9;
  --snow: #FFFFFF;
  --moon: #98A1A7;
  --grape: #7B6BA1;

  --fg: #1a2a3a;
  --muted: #6b7d8e;
  --surface: #f7fafb;
  --border: rgba(0,87,130,0.08);

  /* Gradientes principales */
  --gradient-bg: linear-gradient(180deg, #e8f4f8 0%, #d4ede8 30%, #c8e6f0 60%, #dff0f7 100%);
  --gradient-user: linear-gradient(135deg, #9FD7CB 0%, #00A7C7 100%);
  --gradient-header: linear-gradient(135deg, #005782 0%, #347DC1 50%, #85CAF0 100%);
  --gradient-btn: linear-gradient(135deg, #00A7C7 0%, #347DC1 100%);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 4px rgba(0,87,130,0.06);
  --shadow-md: 0 4px 12px rgba(0,87,130,0.08);
  --shadow-lg: 0 6px 20px rgba(0,87,130,0.1);
}

/* ========================================
   RESET
   ======================================== */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; height: 100%; }
body {
  margin: 0; padding: 0; height: 100%;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--gradient-bg);
  color: var(--fg);
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ========================================
   HEADER
   ======================================== */
.app-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,87,130,0.06);
  min-height: 48px; height: 48px;
}

.header-back {
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: transparent; color: var(--alsea-blue);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; flex-shrink: 0;
}
.header-back:active { background: rgba(0,87,130,0.06); }

.header-title {
  font-weight: 700; font-size: 0.95rem;
  color: var(--alsea-blue); letter-spacing: -0.01em;
  font-family: "Bricolage Grotesque", sans-serif;
  position: absolute; left: 50%; transform: translateX(-50%);
}

.header-logo {
  display: grid; place-items: center;
  height: 30px; width: 30px; border-radius: 8px;
  background: rgba(0,87,130,0.05);
  flex-shrink: 0;
}
.logo { height: 18px; width: auto; }

/* ========================================
   LAYOUT
   ======================================== */
.container {
  width: 100%; margin: 0; padding: 0;
  flex: 1; display: flex; flex-direction: column;
  height: calc(100vh - 48px); overflow: hidden;
}

.chat-area {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; height: 100%;
}

.chat-window {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 16px 14px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.chat-window::after { content: ""; display: block; height: 80px; }
.chat-window::-webkit-scrollbar { width: 0; display: none; }

/* ========================================
   WELCOME
   ======================================== */
.welcome-container {
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 24px 20px 100px; text-align: center;
  height: 100%; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Centrado vertical seguro: margin auto centra cuando sobra espacio,
   pero NO recorta el contenido cuando desborda (a diferencia de
   justify-content:center, que dejaba la parte superior inalcanzable). */
.welcome-container > :first-child { margin-top: auto; }
.welcome-container > :last-child { margin-bottom: auto; }
.welcome-container::-webkit-scrollbar { width: 0; display: none; }

.welcome-title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800; font-size: 1.6rem; line-height: 1.25;
  margin: 0 0 28px; letter-spacing: -0.03em;
  color: var(--alsea-blue);
}

.welcome-robot {
  width: 140px; height: 140px;
  object-fit: contain;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 16px rgba(0,87,130,0.15));
  animation: floatBot 3s ease-in-out infinite;
}
@keyframes floatBot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.welcome-title strong {
  font-weight: 900;
  background: var(--gradient-user);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========================================
   ACTION CARDS
   ======================================== */
.welcome-actions {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 100%; padding: 0 4px;
}

.action-card {
  width: 100%; display: flex; align-items: center;
  gap: 12px; padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  cursor: pointer; text-align: left;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.action-card:active {
  transform: scale(0.98);
  background: rgba(255,255,255,0.9);
}

.icon { display: inline-flex; align-items: center; justify-content: center; height: 44px; width: 44px; flex-shrink: 0; }
.action-icon-guide, .action-icon-examples {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
}
.action-icon-guide { background: linear-gradient(135deg, rgba(0,87,130,0.08), rgba(52,125,193,0.06)); }
.action-icon-examples { background: linear-gradient(135deg, rgba(0,167,199,0.08), rgba(159,215,203,0.06)); }

.main-text {
  font-weight: 700; font-size: 0.95rem;
  color: var(--alsea-blue); margin-bottom: 2px;
}
.sub-text {
  font-size: 0.8rem; color: var(--muted);
  font-weight: 500; line-height: 1.3;
}

/* ========================================
   CHAT BUBBLES
   ======================================== */
.bubble-container {
  display: flex; align-items: flex-end; gap: 8px;
  margin: 10px 0; width: 100%;
  animation: bubbleIn 0.3s ease both;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.left-container { justify-content: flex-start; padding-right: 40px; }
.right-container { justify-content: flex-end; padding-left: 40px; }

.bot-avatar {
  flex-shrink: 0; width: 36px; height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid rgba(159,215,203,0.5);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  align-self: flex-end;
  overflow: hidden;
}
.bot-avatar img { width: 100%; height: 100%; object-fit: cover; }

.bubble {
  position: relative; max-width: fit-content;
  padding: 12px 16px; line-height: 1.5;
  font-size: 0.9rem; font-weight: 500;
  word-wrap: break-word; word-break: break-word;
  overflow-wrap: break-word;
}

/* Bot bubble — blanco, como en el ejemplo */
.left {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 18px 18px 18px 4px;
  box-shadow: var(--shadow-md);
}

/* User bubble — gradiente mint→aqua, como en el ejemplo */
.right {
  background: var(--gradient-user);
  color: #fff;
  border: none;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 3px 12px rgba(0,167,199,0.2);
}

/* Text in bubbles */
.left strong, .left b { font-weight: 700; color: var(--alsea-blue); }
.right strong, .right b { font-weight: 700; color: #fff; }

.left ul, .left ol { margin: 8px 0; padding: 0; list-style: none; }
.left li { margin: 6px 0; padding-left: 18px; line-height: 1.5; position: relative; }
.left ul li::before { content: "•"; position: absolute; left: 6px; top: 0; color: var(--aqua); font-weight: bold; }
.left ol { counter-reset: item; list-style: none; padding: 0; }
.left ol li { counter-increment: item; padding-left: 28px; }
.left ol li::before { content: counter(item) ". "; position: absolute; left: 0; top: 0; color: var(--aqua); font-weight: 700; min-width: 24px; text-align: right; font-variant-numeric: tabular-nums; }

.left ol ol { counter-reset: subitem; margin: 6px 0 6px 4px; list-style: none; padding: 0; }
.left ol ol li { counter-increment: subitem; padding-left: 34px; }
.left ol ol li::before { content: counter(item) "." counter(subitem) ". "; min-width: 30px; }

.left p { margin: 6px 0; line-height: 1.5; }
.left p:first-child { margin-top: 0; }
.left p:last-child { margin-bottom: 0; }
.right p { margin: 5px 0; line-height: 1.45; }
.right p:first-child { margin-top: 0; }
.right p:last-child { margin-bottom: 0; }

.right ul, .right ol { margin: 8px 0; padding: 0; list-style: none; }
.right li { margin: 6px 0; padding-left: 18px; line-height: 1.5; position: relative; }
.right ul li::before { content: "•"; position: absolute; left: 6px; top: 0; color: rgba(255,255,255,0.8); font-weight: bold; }

/* Links */
.left a {
  color: var(--jeans); text-decoration: underline;
  text-decoration-color: rgba(52,125,193,0.3);
  text-underline-offset: 2px; font-weight: 600;
  cursor: pointer;
}
.left a:hover { text-decoration-color: var(--jeans); }

.right a {
  color: #fff; text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.5);
  text-underline-offset: 2px; font-weight: 600;
  cursor: pointer;
}

/* ========================================
   SKELETON LOADER — Typing dots
   ======================================== */
.skeleton-loader {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 4px;
}
.skeleton-loader .skeleton-line {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--aqua);
  opacity: 0.5;
  animation: typingDot 1.4s ease-in-out infinite;
}
.skeleton-loader .skeleton-line:nth-child(2) { animation-delay: 0.2s; }
.skeleton-loader .skeleton-line:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-4px); opacity: 0.8; }
}

/* ========================================
   MODALS — Bottom sheet
   ======================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,40,60,0.35);
  backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-backdrop[aria-hidden="false"] { opacity: 1; pointer-events: auto; }

.modal-card {
  width: 100%; max-width: 480px; max-height: 80vh;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 30px rgba(0,87,130,0.12);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-backdrop[aria-hidden="false"] .modal-card { transform: translateY(0); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  flex-shrink: 0;
}
.modal-id { display: flex; align-items: center; gap: 10px; }

.modal-logo {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(159,215,203,0.2), rgba(0,167,199,0.1));
  flex-shrink: 0;
}
.modal-logo img { width: 18px; height: 18px; object-fit: contain; }

.modal-title {
  font-size: 1.05rem; font-weight: 800;
  color: var(--alsea-blue); letter-spacing: -0.02em;
  font-family: "Bricolage Grotesque", sans-serif;
}

.modal-close {
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: rgba(0,87,130,0.06); color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.modal-close:active { background: rgba(0,87,130,0.12); }

.modal-body {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch; padding: 4px 20px 20px;
}
.modal-body::-webkit-scrollbar { width: 0; display: none; }

.guide-section {
  margin-bottom: 16px; padding: 14px 16px;
  background: rgba(159,215,203,0.08);
  border-radius: var(--radius-md);
  border: 1px solid rgba(159,215,203,0.15);
}
.guide-section:last-child { margin-bottom: 0; }
.guide-heading {
  font-size: 0.88rem; font-weight: 800; color: var(--alsea-blue);
  margin: 0 0 6px;
  font-family: "Bricolage Grotesque", sans-serif;
}
.guide-text { font-size: 0.82rem; color: var(--muted); line-height: 1.5; margin: 0 0 6px; }
.guide-list { margin: 0; padding-left: 14px; list-style: none; }
.guide-list li {
  font-size: 0.82rem; color: var(--muted); line-height: 1.5;
  margin-bottom: 3px; padding-left: 6px; position: relative;
}
.guide-list li::before { content: "•"; position: absolute; left: -10px; color: var(--aqua); font-weight: bold; }
.guide-list li strong { color: var(--alsea-blue); font-weight: 700; }

.modal-footer {
  padding: 12px 20px 16px;
  flex-shrink: 0;
}

.btn-primary {
  width: 100%; padding: 13px 20px; border: none; border-radius: var(--radius-full);
  background: var(--gradient-btn);
  color: #fff; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 3px 12px rgba(0,167,199,0.2);
  font-family: "DM Sans", sans-serif;
}
.btn-primary:active { transform: scale(0.98); }

.small-muted { font-size: 0.76rem; color: var(--moon); font-weight: 500; text-align: center; display: block; }

.example-options { display: flex; flex-direction: column; gap: 8px; }
.example-chip {
  width: 100%; padding: 13px 16px;
  border: 1px solid rgba(159,215,203,0.25); border-radius: var(--radius-md);
  background: rgba(255,255,255,0.8);
  color: var(--fg);
  font-size: 0.85rem; font-weight: 600;
  text-align: left; cursor: pointer;
  transition: all 0.2s; line-height: 1.4;
  font-family: "DM Sans", sans-serif;
}
.example-chip:active {
  background: rgba(159,215,203,0.15);
  border-color: var(--mint);
  transform: scale(0.98);
}

/* ========================================
   COMPOSER
   ======================================== */
.composer-wrap {
  position: relative; padding: 8px 12px 10px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0,0,0,0.05);
  z-index: 10; flex-shrink: 0;
}
.composer {
  display: flex; align-items: center; gap: 8px; width: 100%;
}

#user-input {
  flex: 1; height: 44px; padding: 10px 16px;
  border: 1px solid rgba(0,0,0,0.08); border-radius: var(--radius-full);
  font-size: 0.92rem; color: var(--fg);
  background: rgba(255,255,255,0.9); outline: none;
  font-family: "DM Sans", sans-serif; font-weight: 400;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#user-input::placeholder { color: var(--moon); font-weight: 500; }
#user-input:focus {
  border-color: var(--aqua);
  box-shadow: 0 0 0 3px rgba(0,167,199,0.1);
  background: #fff;
}
#user-input:disabled { opacity: 0.5; cursor: not-allowed; }

#send-btn {
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: var(--gradient-btn);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 3px 10px rgba(0,167,199,0.2);
  flex-shrink: 0;
}
#send-btn:active { transform: scale(0.93); }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.send-icon { display: flex; align-items: center; justify-content: center; }

.spinner {
  display: none; width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#send-btn[data-loading="true"] .send-icon { display: none; }
#send-btn[data-loading="true"] .spinner { display: inline-block; }

/* ========================================
   SCROLL TO BOTTOM
   ======================================== */
#scrollToBottom {
  position: fixed; right: 14px; bottom: 72px;
  height: 36px; width: 36px; border-radius: 50%;
  background: var(--snow); color: var(--alsea-blue); border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s; font-size: 1.1rem; z-index: 10;
}
#scrollToBottom[aria-hidden="false"] { opacity: 1; pointer-events: auto; }
#scrollToBottom:active { transform: scale(0.93); }

/* ========================================
   RECENT CONVERSATIONS
   ======================================== */
.recent-conversations {
  width: 100%; margin-top: auto; padding: 0 4px;
  flex-shrink: 0; max-height: 220px;
  display: flex; flex-direction: column;
}
.recent-header {
  font-size: 0.68rem; font-weight: 700;
  font-family: "Bricolage Grotesque", sans-serif;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--alsea-blue);
  margin-bottom: 8px; margin-top: 20px; padding: 0 4px;
  display: flex; align-items: center; gap: 6px;
}
.recent-header::before {
  content: "●"; font-size: 0.4rem; color: var(--aqua);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}

.recent-list {
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.recent-list::-webkit-scrollbar { width: 0; display: none; }

.recent-card {
  position: relative;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: left; cursor: pointer;
  transition: all 0.2s; width: 100%;
  box-shadow: var(--shadow-sm);
  animation: bubbleIn 0.3s ease both;
}
.recent-card:active { background: rgba(255,255,255,0.95); }

.recent-question {
  font-size: 0.82rem; font-weight: 700;
  font-family: "DM Sans", sans-serif;
  color: var(--alsea-blue); margin-bottom: 3px;
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.recent-answer {
  font-size: 0.72rem; color: var(--muted);
  line-height: 1.35; font-weight: 400;
  font-family: "DM Sans", sans-serif;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ========================================
   DOCUMENT VIEWER
   ======================================== */
.doc-viewer-container {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.doc-pdf-viewer {
  margin-top: 8px; border-radius: var(--radius-md);
  overflow: hidden; background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.doc-pdf-title {
  padding: 8px 12px; font-size: 0.75rem;
  font-weight: 700; color: var(--alsea-blue);
  background: var(--surface);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.doc-pdf-canvas-wrap {
  padding: 6px; background: #fafbfc;
  cursor: pointer; min-height: 180px;
  display: flex; align-items: center; justify-content: center;
}
.doc-pdf-canvas { width: 100%; display: block; border-radius: 4px; }

.doc-pdf-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid rgba(0,0,0,0.05);
  background: var(--surface);
}
.doc-pdf-nav-btn {
  padding: 5px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff; color: var(--alsea-blue);
  font-size: 0.75rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.doc-pdf-nav-btn:active { background: var(--surface); }
.doc-pdf-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.doc-pdf-counter { font-size: 0.75rem; font-weight: 600; color: var(--muted); }

/* Images inline */
.doc-image-wrap {
  margin-top: 8px; border-radius: var(--radius-md);
  overflow: hidden; background: #fff;
  border: 1px solid var(--border);
}
.doc-image-inline {
  width: 100%; max-height: 350px;
  object-fit: contain; display: block;
  cursor: pointer; transition: opacity 0.2s;
}
.doc-image-inline:hover { opacity: 0.9; }

/* Image zoom overlay */
.image-zoom-overlay {
  display: none; position: fixed; inset: 0;
  z-index: 2000; background: rgba(0,15,30,0.88);
  backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
}
.image-zoom-overlay.active { display: flex; }
.image-zoom-close {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: none;
  color: #fff; font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.image-zoom-img {
  max-width: 95%; max-height: 90vh;
  object-fit: contain; border-radius: 6px;
  transition: transform 0.15s ease;
  touch-action: none;
  cursor: grab;
}

/* ========================================
   QUICK REPLIES
   ======================================== */
.quick-replies {
  display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.quick-reply-btn {
  padding: 8px 16px; border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(159,215,203,0.15);
  color: var(--alsea-blue);
  font-size: 0.8rem; font-weight: 600;
  font-family: "DM Sans", sans-serif;
  cursor: pointer; transition: all 0.2s;
  -webkit-user-select: none; user-select: none;
}
.quick-reply-btn:active {
  transform: scale(0.95);
  background: rgba(159,215,203,0.3);
}

/* ========================================
   EVALUATION CARD
   ======================================== */
.eval-card {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 18px; margin: 12px 0;
  box-shadow: var(--shadow-lg);
  animation: bubbleIn 0.4s ease;
}

.eval-title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 0.92rem; font-weight: 800;
  color: var(--alsea-blue); margin-bottom: 4px;
  text-align: center;
}
.eval-subtitle {
  font-size: 0.76rem; color: var(--muted);
  text-align: center; margin-bottom: 16px; font-weight: 500;
}

.eval-stars {
  display: flex; justify-content: center; gap: 6px; margin-bottom: 14px;
}
.eval-star {
  font-size: 1.7rem; background: none; border: none;
  cursor: pointer; padding: 3px;
  transition: all 0.2s;
  filter: grayscale(1) opacity(0.3);
}
.eval-star.active { filter: none; transform: scale(1.12); }
.eval-star:active { transform: scale(0.85); }

.eval-resolved-label {
  font-size: 0.78rem; color: var(--muted); font-weight: 600;
  display: flex; align-items: center; width: 100%;
  justify-content: center; margin-bottom: 6px;
}
.eval-resolved {
  display: flex; justify-content: center; gap: 8px; margin-bottom: 14px;
}
.eval-res-btn {
  padding: 8px 20px; border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: #fff; font-size: 0.8rem;
  font-weight: 700; color: var(--muted);
  cursor: pointer; transition: all 0.2s;
}
.eval-res-btn.active {
  background: var(--gradient-user);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(0,167,199,0.2);
}

.eval-comment-wrap { position: relative; margin-bottom: 12px; }
.eval-comment {
  width: 100%; padding: 10px 14px;
  border: 1px solid rgba(0,0,0,0.08); border-radius: var(--radius-md);
  font-size: 0.82rem; font-family: "DM Sans", sans-serif;
  resize: none; height: 56px;
  outline: none; color: var(--fg);
  background: var(--surface);
  transition: border-color 0.2s;
}
.eval-comment:focus { border-color: var(--aqua); background: #fff; }
.eval-comment::placeholder { color: var(--moon); }

.eval-char-count {
  position: absolute; bottom: 6px; right: 10px;
  font-size: 0.65rem; color: var(--moon);
  font-weight: 600; pointer-events: none;
}
.eval-char-count.near-limit { color: #e67e22; }
.eval-char-count.at-limit { color: #e74c3c; }

.eval-submit {
  width: 100%; padding: 11px; border: none; border-radius: var(--radius-md);
  background: var(--gradient-btn);
  color: #fff; font-weight: 700; font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,167,199,0.2);
  transition: all 0.2s;
  font-family: "DM Sans", sans-serif;
}
.eval-submit:active { transform: scale(0.98); }
.eval-submit:disabled { opacity: 0.4; cursor: not-allowed; }

.eval-thanks {
  text-align: center; padding: 16px;
  font-size: 0.88rem; color: var(--alsea-blue); font-weight: 700;
}

/* ========================================
   MOBILE
   ======================================== */
@supports (-webkit-touch-callout: none) {
  input[type="text"] { font-size: 16px !important; }
}

.action-card, .bubble-container, .modal-card, .recent-card {
  will-change: transform; transform: translateZ(0);
}

@supports (padding: max(0px)) {
  body { padding-top: env(safe-area-inset-top); }
}

.action-card, .example-chip, .btn-primary, #send-btn,
.modal-close, .recent-card, .eval-star, .eval-res-btn,
.eval-submit, .quick-reply-btn {
  -webkit-user-select: none; user-select: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-height: 667px) {
  .welcome-container { padding: 16px 20px 90px; }
  .welcome-title { font-size: 1.4rem; margin-bottom: 20px; }
  .welcome-robot { width: 100px; height: 100px; margin-bottom: 12px; }
  .action-card { padding: 12px 14px; }
  .bubble { font-size: 0.86rem; padding: 10px 14px; }
  .bot-avatar { width: 32px; height: 32px; }
  .bot-avatar img { width: 100%; height: 100%; }
  .recent-conversations { max-height: 160px; }
}

@media (max-width: 360px) {
  .welcome-title { font-size: 1.35rem; }
  .main-text { font-size: 0.9rem; }
  .sub-text { font-size: 0.76rem; }
  #user-input { height: 42px; padding: 10px 14px; font-size: 0.9rem; }
  #send-btn { height: 42px; width: 42px; }
  .bubble { font-size: 0.84rem; padding: 10px 13px; }
  .left-container { padding-right: 30px; }
  .right-container { padding-left: 30px; }
}

@media (min-height: 800px) {
  .recent-conversations { max-height: 280px; }
  .welcome-title { font-size: 1.7rem; margin-bottom: 32px; }
}

@media (max-width: 768px) {
  .doc-pdf-viewer { border-radius: var(--radius-sm); }
  .doc-image-inline { max-height: 280px; }
  .image-zoom-img { max-width: 100%; max-height: 85vh; }
}

@media (min-width: 768px) {
  .chat-window { padding: 20px 18px; }
  .welcome-actions { max-width: 400px; }
  .left-container { padding-right: 60px; }
  .right-container { padding-left: 60px; }
  .bubble { max-width: 75%; }
}

@media (min-width: 1024px) {
  .container { max-width: 680px; margin: 0 auto; }
}
