:root {
  color-scheme: light;
  --ink: #273a35;
  --ink-light: #50645c;
  --muted: #748078;
  --border: #e6e9e3;
  --surface: #ffffff;
  --background: #f8f9f5;
  --sidebar: #e9eee8;
  --accent: #e7a841;
  --accent-dark: #a97025;
  --sage: #e4ede5;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { margin: 0; min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--background); }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, textarea:focus-visible { outline: 3px solid #c08d43; outline-offset: 3px; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.app-shell { display: grid; grid-template-columns: minmax(285px, 340px) minmax(0, 1fr); height: 100vh; height: 100dvh; min-height: 0; max-width: 1760px; margin-inline: auto; overflow: hidden; background: var(--surface); }
.sidebar { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: clamp(18px, 3vh, 36px); overflow-y: auto; padding: 32px 26px 24px; background: var(--sidebar); border-right: 1px solid #dce4da; scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-icon { display: grid; place-items: center; width: 45px; height: 45px; color: var(--ink); background: var(--accent); border-radius: 13px; flex: none; }
.brand-icon svg { width: 30px; height: 30px; }
.brand-copy strong { display: block; font-size: 25px; font-weight: 850; line-height: 1.1; letter-spacing: -1.3px; white-space: nowrap; }
.brand-copy > span { display: block; font-size: 9px; font-weight: 760; letter-spacing: 1.45px; color: #738174; margin-top: 5px; white-space: nowrap; }
.dot { color: #c88b2a; }
.sidebar-intro { margin-top: clamp(12px, 5vh, 58px); }
.section-kicker, .side-heading, .suggestion-heading { font-size: 10px; font-weight: 850; letter-spacing: 1.7px; }
.section-kicker { color: #648273; display: flex; align-items: center; gap: 9px; }
.kicker-line { width: 23px; height: 2px; background: #6b8b7b; }
.sidebar h1 { margin: 16px 0 18px; font-size: clamp(37px, 3vw, 51px); line-height: 1.03; letter-spacing: -2.7px; font-weight: 840; }
.sidebar h1 em { font-style: normal; color: #be8431; }
.sidebar-intro p { max-width: 270px; color: #667970; font-size: 13.5px; line-height: 1.8; margin: 0; }
.side-topics { border-top: 1px solid #d7e0d6; padding-top: 23px; }
.side-heading { margin: 0 0 11px; color: #75887b; }
.side-topic { border: 0; border-bottom: 1px solid #dce4da; background: transparent; width: 100%; padding: 12px 1px; text-align: left; color: #40594d; display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 700; border-radius: 4px; }
.side-topic:hover { background: rgba(255,255,255,.46); }
.side-topic > span:last-child { margin-left: auto; color: #879b8c; }
.topic-glyph { font-size: 11px; font-weight: 850; color: #8c7954; }
.side-safety { display: flex; gap: 12px; padding: 15px 13px; border: 1px solid #d9e1d9; border-radius: 13px; background: #f3f5ef; margin-top: auto; }
.safety-icon { display: grid; place-items: center; width: 23px; height: 23px; border: 1.5px solid #577565; border-radius: 50%; color: #577565; font-size: 13px; font-weight: 900; flex: none; }
.side-safety strong { font-size: 12px; display: block; }
.side-safety p { color: #718177; font-size: 11.5px; line-height: 1.6; margin: 5px 0 0; }
.sidebar-bottom { padding: 3px 2px 0; color: #8b9b8d; font-size: 10px; font-weight: 750; letter-spacing: 1px; display: flex; justify-content: space-between; }

.chat-panel { min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; background: #fcfdfa; overflow: hidden; }
.chat-header { position: relative; z-index: 1; min-height: 85px; flex: 0 0 auto; padding: 15px clamp(22px, 5vw, 54px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 13px; background: rgba(255,255,255,.85); }
.helper-avatar { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 16px; background: #f5ead1; flex: none; }
.helper-avatar svg { width: 38px; height: 38px; }
.chat-header-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.chat-header-text strong { font-size: 16px; font-weight: 810; letter-spacing: -.3px; }
.chat-header-text span { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); line-height: 1.25; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; background: #68967f; }
.new-chat { display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #e3e9e1; border-radius: 11px; background: #fff; color: #485d51; font-size: 12px; font-weight: 700; padding: 10px 13px; white-space: nowrap; }
.new-chat:hover { background: #f4f7f2; border-color: #ccd8cc; }
.new-chat svg { width: 17px; height: 17px; }
.mobile-logo, .mobile-categories { display: none; }

.messages { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 19px; padding: 28px max(24px, calc((100% - 800px)/2)) 33px; scrollbar-width: thin; }
.welcome { width: 100%; max-width: 750px; margin: auto; padding: 26px 0 14px; text-align: center; }
.welcome-badge { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid #e7e8dd; background: #f4f5ed; border-radius: 30px; color: #74816a; font-size: 10px; font-weight: 850; letter-spacing: 1px; }
.welcome-spark { font-size: 18px; color: #ca902f; line-height: 0.6; }
.welcome h2 { max-width: 650px; margin: 19px auto 11px; font-size: clamp(32px, 4vw, 46px); letter-spacing: -2.1px; line-height: 1.11; font-weight: 840; }
.welcome h2 span { color: #c08b3e; }
.welcome > p { color: #728077; font-size: 14px; line-height: 1.75; margin: 0 auto; max-width: 440px; }
.suggestion-heading { margin: 35px 0 14px; color: #829087; text-align: left; }
.suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.suggestion-card { display: flex; align-items: center; gap: 12px; min-width: 0; text-align: left; padding: 16px; background: #fff; border: 1px solid #e8ebe4; border-radius: 15px; box-shadow: 0 5px 22px rgba(36, 59, 46, .035); color: var(--ink); transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.suggestion-card:hover { border-color: #d5bf92; box-shadow: 0 8px 26px rgba(36,59,46,.07); transform: translateY(-1px); }
.suggestion-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.suggestion-icon svg { width: 25px; height: 25px; }
.icon-amber { background: #fcf0d7; color: #ac772e; }
.icon-sage { background: #eaf2e9; color: #598267; }
.icon-blue { background: #e8f0f0; color: #55817c; }
.icon-clay { background: #f4ebe3; color: #a27b54; }
.suggestion-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.suggestion-copy strong { font-size: 13px; font-weight: 775; }
.suggestion-copy small { font-size: 11px; color: #869188; line-height: 1.4; }
.suggestion-arrow { margin-left: auto; align-self: flex-start; font-size: 17px; color: #a0afa4; }

.chat-message { display: flex; gap: 11px; align-items: flex-start; max-width: min(94%, 660px); animation: rise .2s ease-out; }
.chat-message.is-user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.is-bot { align-self: flex-start; }
.message-avatar { display: grid; place-items: center; border-radius: 10px; width: 30px; height: 30px; flex: none; font-size: 10px; font-weight: 900; background: #f2e2bb; }
.is-user .message-avatar { background: #e7efe4; }
.message-content { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.is-user .message-content { align-items: flex-end; }
.message-meta { width: 100%; display: flex; align-items: center; gap: 12px; color: #87948b; font-size: 10px; padding: 0 3px; }
.is-user .message-meta { justify-content: flex-end; }
.message-meta span { color: #556b5c; font-weight: 740; }
.message-bubble { min-width: 0; max-width: 100%; border: 1px solid #e8ebe4; background: #fff; border-radius: 3px 15px 15px 15px; padding: 14px 17px; line-height: 1.68; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; box-shadow: 0 5px 19px rgba(25,45,35,.028); }
.is-user .message-bubble { border-radius: 15px 3px 15px 15px; background: #e9f1e6; border-color: #dce9d8; }
.out-of-scope .message-bubble { background: #f8f4e9; border-color: #e9dfc9; }
.loading-bubble { color: #809185; }
.copy-button { border: 0; background: transparent; color: #8a998e; padding: 2px 4px 4px; font-size: 11px; }
.copy-button:hover { color: #395d46; text-decoration: underline; }

.composer-area { flex: 0 0 auto; padding: 16px max(24px,calc((100% - 800px)/2)) max(15px,env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: #fff; }
.composer { display: flex; align-items: flex-end; gap: 9px; padding: 7px; border: 1px solid #dbe3d9; background: #fff; border-radius: 15px; box-shadow: 0 7px 24px rgba(30,58,44,.045); }
.composer:focus-within { border-color: #ceae77; box-shadow: 0 0 0 3px rgba(202,155,78,.13); }
.composer textarea { min-width: 0; min-height: 44px; max-height: 136px; width: 100%; resize: none; padding: 12px 12px; border: 0; background: transparent; color: var(--ink); outline: 0; font-size: 14px; line-height: 1.45; }
.composer textarea:focus-visible { outline: none; }
.composer textarea::placeholder { color: #9da9a1; }
.send-button { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 11px; background: #dfab53; color: #233a2f; transition: background .15s ease; }
.send-button:hover:enabled { background: #efbb65; }
.send-button:disabled { opacity: .42; }
.send-button svg { width: 20px; height: 20px; }
.composer-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 3px 0; color: #8b998e; font-size: 10px; line-height: 1.5; }
.composer-meta span:last-child { white-space: nowrap; color: #88978d; font-variant-numeric: tabular-nums; }
.error-banner { background: #fff0e7; border: 1px solid #f0d2c0; color: #864535; border-radius: 10px; padding: 9px 12px; font-size: 12px; margin-bottom: 10px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 275px minmax(0,1fr); }
  .sidebar { padding: 26px 20px 20px; }
  .brand-copy strong { font-size: 22px; }
  .brand-copy > span { letter-spacing: 1px; }
  .messages { padding-inline: 25px; }
  .composer-area { padding-inline: 25px; }
}
@media (max-width: 880px) {
  .app-shell { display: block; width: 100%; height: 100vh; height: 100dvh; }
  .sidebar { display: none; }
  .chat-panel { width: 100%; }
  .chat-header { min-height: 71px; padding: 12px 21px; gap: 10px; }
  .helper-avatar { width: 40px; height: 40px; border-radius: 13px; }
  .helper-avatar svg { width: 35px; height: 35px; }
  .chat-header-text span { font-size: 10px; }
  .messages { padding: 25px clamp(18px, 5vw, 40px); }
  .composer-area { padding: 12px clamp(15px, 4vw, 30px) max(13px, env(safe-area-inset-bottom)); }
  .mobile-categories { display: flex; flex: 0 0 auto; padding: 11px 18px; gap: 8px; overflow-x: auto; border-bottom: 1px solid #edf0ec; background: #fcfdfa; scrollbar-width: none; }
  .mobile-categories::-webkit-scrollbar { display: none; }
  .mobile-categories button { border: 1px solid #e3e9e1; background: #f8faf6; border-radius: 30px; color: #506b58; white-space: nowrap; padding: 8px 13px; font-size: 11px; font-weight: 725; flex: none; }
  .mobile-categories button:hover { background: #edf4ed; }
}
@media (max-width: 560px) {
  .chat-header { min-height: 64px; padding-inline: 14px; }
  .chat-header-text strong { font-size: 14px; }
  .chat-header-text span { max-width: 185px; font-size: 10px; }
  .new-chat { width: 38px; height: 38px; padding: 0; border-radius: 10px; }
  .new-chat span { display: none; }
  .new-chat svg { width: 19px; height: 19px; }
  .mobile-categories { padding: 10px 12px; }
  .messages { padding: 18px 14px 20px; gap: 15px; }
  .welcome { padding: 7px 0 4px; }
  .welcome-badge { font-size: 9px; padding: 7px 10px; }
  .welcome h2 { margin: 16px auto 11px; font-size: clamp(28px, 8vw, 37px); letter-spacing: -1.4px; }
  .welcome > p { font-size: 12.5px; line-height: 1.65; max-width: 330px; }
  .suggestion-heading { margin: 24px 0 12px; }
  .suggestion-grid { gap: 9px; }
  .suggestion-card { padding: 12px; gap: 9px; border-radius: 12px; }
  .suggestion-icon { width: 33px; height: 33px; border-radius: 9px; }
  .suggestion-icon svg { width: 21px; height: 21px; }
  .suggestion-copy strong { font-size: 11px; line-height: 1.25; }
  .suggestion-copy small { font-size: 10px; }
  .suggestion-arrow { display: none; }
  .chat-message { max-width: 100%; gap: 8px; }
  .message-avatar { width: 27px; height: 27px; font-size: 9px; }
  .message-bubble { font-size: 13px; padding: 12px 13px; }
  .composer-area { padding: 10px 12px max(10px, env(safe-area-inset-bottom)); }
  .composer textarea { font-size: 16px; /* Evita zoom automático en Safari iOS. */ }
  .composer-meta { font-size: 9px; }
}
@media (max-width: 370px) {
  .suggestion-grid { grid-template-columns: 1fr; }
  .chat-header-text span { max-width: 140px; }
  .helper-avatar { width: 36px; height: 36px; }
  .helper-avatar svg { width: 30px; height: 30px; }
}
@media (max-height: 650px) and (min-width: 881px) {
  .sidebar { gap: 14px; }
  .sidebar-intro { margin-top: 10px; }
  .sidebar h1 { font-size: 38px; margin: 9px 0; }
  .sidebar-intro p { font-size: 12px; }
  .side-topic { padding: 7px 1px; }
  .side-safety { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
