@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --navy: #143557;
  --navy-deep: #092641;
  --wine: #a7191c;
  --ink: #10283f;
  --muted: #6b7987;
  --canvas: #f7f8f6;
  --line: rgba(20, 53, 87, .13);
  --success: #2c9a6a;
  --shadow: 0 28px 90px rgba(18, 45, 70, .14);
  font-family: "Poppins", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transform: translateZ(0);
  backdrop-filter: blur(16px) saturate(135%);
  box-shadow:
    0 6px 18px rgba(9,38,65,.10),
    inset 1px 1px 0 rgba(255,255,255,.38),
    inset -1px -1px 0 rgba(9,38,65,.12),
    inset 0 0 0 1px rgba(255,255,255,.12);
  transition: transform .26s cubic-bezier(.2,.8,.2,1), filter .2s ease, box-shadow .26s ease, opacity .2s ease !important;
}
button::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(145deg,rgba(255,255,255,.34),transparent 38%),
    radial-gradient(circle at 78% 120%,rgba(255,255,255,.18),transparent 48%);
  opacity: .72;
}
button:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.08);
  box-shadow:
    0 11px 26px rgba(9,38,65,.15),
    inset 1px 1px 0 rgba(255,255,255,.5),
    inset -1px -1px 0 rgba(9,38,65,.14),
    inset 0 0 0 1px rgba(255,255,255,.16);
}
button:active:not(:disabled) { transform: translateY(1px) scale(.985); filter: brightness(.96); }
button:focus-visible { outline: 3px solid rgba(167,25,28,.23); outline-offset: 3px; }
button:disabled { cursor: not-allowed !important; opacity: .48; filter: saturate(.65); }
button > * { position: relative; z-index: 1; }
.background-art { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.background-art::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 43%, rgba(255,255,255,.16), rgba(247,248,246,.68) 44%, rgba(247,248,246,.95) 82%); }
#pathCanvas { position: absolute; inset: -8%; width: 116%; height: 116%; opacity: .82; }
.motion-path { fill: none; stroke-linecap: round; stroke-dasharray: var(--dash) var(--gap); animation: pathFlow var(--duration) linear infinite; animation-delay: var(--delay); }
.background-glow { position: absolute; left: 50%; top: 50%; width: min(76vw, 900px); aspect-ratio: 1; transform: translate(-50%,-50%); border-radius: 50%; background: radial-gradient(circle,rgba(255,255,255,.98) 0%,rgba(255,255,255,.7) 38%,transparent 72%); filter: blur(14px); }

.app-shell { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-rows: auto minmax(0,1fr) auto; padding-left: 248px; transition: padding-left .3s ease; }
.chat-sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; width: 248px; display: flex; flex-direction: column; padding: 20px 14px 14px; color: #fff; background: linear-gradient(180deg,#0b2a46 0%,#071d31 100%); border-right: 1px solid rgba(255,255,255,.08); box-shadow: 18px 0 50px rgba(12,40,65,.08); transition: transform .3s ease; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.sidebar-brand > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(145deg,#a7191c,#163a5d); box-shadow: 0 8px 20px rgba(0,0,0,.18); font-weight: 700; }
.sidebar-brand strong { font-size: 17px; letter-spacing: -.04em; }
.new-chat-button { width: 100%; height: 44px; display: flex; align-items: center; gap: 11px; padding: 0 13px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; color: #fff; background: rgba(255,255,255,.055); cursor: pointer; text-align: left; font-size: 11px; transition: background .2s; }
.new-chat-button:hover { background: rgba(255,255,255,.1); }
.new-chat-button span { font-size: 18px; font-weight: 300; }
.training-button {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 11px; margin-top: 9px; padding: 9px 12px;
  border: 1px solid rgba(130,199,242,.16); border-radius: 12px; color: #fff;
  background: linear-gradient(135deg,rgba(36,92,130,.36),rgba(255,255,255,.035)); cursor: pointer; text-align: left;
}
.training-button > span:first-child { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: #ff8a93; background: rgba(193,34,47,.16); font-size: 14px; }
.training-button > span:last-child { display: grid; gap: 2px; }
.training-button strong { font-size: 10px; font-weight: 600; }
.training-button small { color: rgba(255,255,255,.42); font-size: 7px; }
.sidebar-section-title { padding: 25px 10px 10px; color: rgba(255,255,255,.38); font-size: 8px; letter-spacing: .13em; text-transform: uppercase; }
.history-list { flex: 1; min-height: 0; overflow-y: auto; }
.history-empty { margin: 8px 10px; color: rgba(255,255,255,.35); font-size: 9px; line-height: 1.6; }
.history-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 11px 10px; border: 0; border-radius: 10px; color: rgba(255,255,255,.78); background: transparent; cursor: pointer; text-align: left; font-size: 9px; }
.history-item:hover, .history-item.active { color: #fff; background: rgba(255,255,255,.08); }
.history-item i { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #c64a51; }
.history-item .history-copy { min-width: 0; display: grid; gap: 3px; overflow: hidden; }
.history-item .history-copy strong { overflow: hidden; font-size: 9px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.history-item .history-copy small { color: rgba(255,255,255,.4); font-size: 7px; }
.sidebar-profile { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 12px 9px; border-top: 1px solid rgba(255,255,255,.09); }
.sidebar-profile img { width: 34px; height: 34px; object-fit: cover; object-position: 50% 14%; border-radius: 50%; background: #e7edf1; }
.sidebar-profile strong, .sidebar-profile span { display: block; }
.sidebar-profile strong { font-size: 10px; }.sidebar-profile span { margin-top: 2px; overflow: hidden; color: rgba(255,255,255,.43); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile button { border: 0; color: rgba(255,255,255,.5); background: transparent; cursor: pointer; letter-spacing: .1em; }
.site-header { height: 98px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px,5vw,78px); }
.brand { display: flex; align-items: center; gap: 14px; color: var(--navy); text-decoration: none; }
.brand-logo-wrap { display: grid; place-items: center; width: 126px; height: 48px; padding: 8px 11px; background: rgba(255,255,255,.76); border: 1px solid rgba(255,255,255,.86); border-radius: 14px; box-shadow: 0 10px 32px rgba(20,53,87,.08); backdrop-filter: blur(18px); }
.brand-logo-wrap img { display: block; width: 100%; height: auto; }
.brand-divider { width: 1px; height: 32px; background: var(--line); }
.dalia-wordmark { display: block; font-size: 22px; line-height: 1; letter-spacing: -.05em; font-weight: 500; }
.dalia-wordmark strong { color: var(--wine); }
.dalia-wordmark small { display: block; margin-top: 6px; color: var(--muted); font-size: 8px; line-height: 1; letter-spacing: .12em; text-transform: uppercase; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.api-status { display: inline-flex; align-items: center; gap: 8px; margin-right: 9px; color: var(--muted); font-size: 10px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #dca63d; box-shadow: 0 0 0 5px rgba(220,166,61,.1); }
.status-dot.online { background: var(--success); box-shadow: 0 0 0 5px rgba(44,154,106,.1); }
.status-dot.offline { background: var(--wine); box-shadow: 0 0 0 5px rgba(167,25,28,.1); }
.header-button { height: 42px; padding: 0 16px; border: 1px solid var(--navy); border-radius: 999px; color: #fff; background: var(--navy); cursor: pointer; font-size: 10px; font-weight: 600; transition: transform .2s, box-shadow .2s, background .2s; }
.header-button:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(20,53,87,.17); }
.header-button.quiet { color: var(--navy); background: rgba(255,255,255,.56); border-color: var(--line); backdrop-filter: blur(14px); }
.sidebar-toggle { display: none; min-width: 42px; padding: 0; }

.experience { min-height: 0; display: grid; place-items: center; padding: 4px 26px 14px; }
.welcome { width: min(940px, 100%); text-align: center; animation: reveal .8s cubic-bezier(.2,.8,.2,1) both; }
.hero-avatar { width: 72px; height: 72px; margin: 0 auto 12px; overflow: hidden; border: 3px solid rgba(255,255,255,.9); border-radius: 50%; background: linear-gradient(145deg,#dce7ed,#fff); box-shadow: 0 16px 42px rgba(20,53,87,.15); }
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; transform: scale(1.18); transform-origin: 50% 16%; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: var(--wine); font-size: 10px; font-weight: 600; letter-spacing: .17em; text-transform: uppercase; }
.eyebrow i { width: 24px; height: 1px; background: var(--wine); }
.animated-title { max-width: 880px; margin: 18px auto 16px; color: var(--navy-deep); font-size: clamp(46px,5.8vw,78px); line-height: .96; letter-spacing: -.067em; font-weight: 600; text-wrap: balance; }
.animated-letter { display: inline-block; opacity: 0; transform: translateY(36px) rotateX(-50deg); filter: blur(6px); animation: letterIn .75s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: calc(120ms + var(--i) * 23ms); }
.animated-word { display: inline-block; white-space: nowrap; }
.animated-word:not(:last-child) { margin-right: .27em; }
.welcome > p { max-width: 670px; margin: 0 auto; color: var(--muted); font-size: 13px; line-height: 1.75; }
.hero-composer { width: min(720px, 100%); min-height: 74px; display: flex; align-items: center; gap: 10px; margin: 24px auto 0; padding: 9px 9px 9px 22px; background: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.9); border-radius: 23px; box-shadow: 0 24px 70px rgba(20,53,87,.12), inset 0 0 0 1px rgba(20,53,87,.055); backdrop-filter: blur(22px); }
.hero-composer textarea { flex: 1; resize: none; min-height: 36px; max-height: 100px; padding: 8px 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; line-height: 1.5; }
.hero-composer textarea::placeholder { color: #7e8b97; }
.hero-composer button { height: 54px; display: inline-flex; align-items: center; gap: 14px; flex: 0 0 auto; padding: 0 11px 0 20px; border: 0; border-radius: 16px; color: #fff; background: linear-gradient(115deg,var(--navy),#234a70); cursor: pointer; font-size: 11px; font-weight: 600; box-shadow: 0 12px 28px rgba(20,53,87,.22); transition: transform .2s, box-shadow .2s; }
.hero-composer button:hover { transform: translateY(-2px); box-shadow: 0 17px 34px rgba(20,53,87,.27); }
.hero-composer button i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: var(--navy); background: #fff; font-style: normal; font-size: 17px; }
.quick-actions { display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap; margin-top: 16px; }
.quick-actions button { padding: 7px 11px 7px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--navy); background: rgba(255,255,255,.5); cursor: pointer; font-size: 9px; backdrop-filter: blur(12px); transition: .2s; }
.quick-actions button:hover { transform: translateY(-2px); background: #fff; border-color: rgba(167,25,28,.25); }
.quick-actions span { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 4px; border-radius: 50%; color: var(--wine); background: rgba(167,25,28,.08); font-size: 7px; font-weight: 700; }
.trust-row { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin-top: 24px; color: #7b8791; font-size: 8px; }
.trust-row span { display: inline-flex; align-items: center; gap: 6px; }
.trust-row i { color: var(--success); font-style: normal; }

.chat-workspace { width: min(1480px, 100%); height: calc(100vh - 158px); min-height: 560px; display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; overflow: hidden; border: 1px solid rgba(255,255,255,.93); border-radius: 26px; background: rgba(255,255,255,.82); box-shadow: var(--shadow), inset 0 0 0 1px rgba(20,53,87,.05); backdrop-filter: blur(26px); animation: workspaceIn .55s cubic-bezier(.2,.8,.2,1) both; }
.chat-heading { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px,4vw,64px); border-bottom: 1px solid var(--line); }
.assistant-identity { display: flex; align-items: center; gap: 12px; }
.assistant-mark { width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; border-radius: 14px; color: #fff; background: linear-gradient(145deg,#e8eff3,#fff); box-shadow: 0 9px 24px rgba(20,53,87,.18); font-weight: 700; }
.assistant-mark img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 13%; transform: scale(1.18); }
.assistant-identity strong, .assistant-identity span { display: block; }
.assistant-identity strong { color: var(--navy); font-size: 14px; }
.assistant-identity span { margin-top: 2px; color: var(--muted); font-size: 8px; }
.chat-heading button { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.58); cursor: pointer; font-size: 9px; }
.messages { overflow-y: auto; padding: 36px clamp(20px,5vw,88px); scroll-behavior: smooth; }
.message-row { display: flex; align-items: flex-start; gap: 14px; width: min(960px,100%); margin: 18px auto; }
.message-row.user { justify-content: flex-end; }
.message-avatar { width: 38px; height: 38px; flex: 0 0 auto; overflow: hidden; border: 2px solid rgba(255,255,255,.9); border-radius: 50%; background: #e9eef1; box-shadow: 0 8px 22px rgba(20,53,87,.13); }
.message-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 13%; transform: scale(1.16); }
.bubble { max-width: min(78%, 780px); padding: 14px 18px; border-radius: 18px; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; animation: bubbleIn .3s ease both; }
.assistant .bubble { padding-top: 8px; color: var(--ink); background: transparent; border: 0; box-shadow: none; }
.user .bubble { color: #fff; background: linear-gradient(125deg,var(--navy),#2b506f); border-bottom-right-radius: 5px; box-shadow: 0 10px 26px rgba(20,53,87,.16); }
.bubble-meta { display: block; margin-top: 7px; color: rgba(107,121,135,.65); font-size: 7px; }
.user .bubble-meta { color: rgba(255,255,255,.58); }
.date-separator { width: fit-content; margin: 22px auto 8px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(8, 30, 48, .68); font-size: 8px; text-transform: capitalize; }
.appointment-picker { width: min(520px, 100%); display: grid; gap: 8px; margin-top: 18px; }
.appointment-picker > strong { margin-bottom: 2px; color: #91aabd; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.appointment-picker button {
  width: 100%; min-height: 52px; display: grid; grid-template-columns: 34px minmax(0,1fr) 24px;
  align-items: center; gap: 10px; padding: 7px 11px 7px 8px; border: 1px solid rgba(140,199,236,.18);
  border-radius: 15px; color: #eef7fc; background: linear-gradient(135deg,rgba(27,77,111,.72),rgba(10,35,54,.88));
  cursor: pointer; text-align: left; box-shadow: 0 10px 28px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.08);
}
.appointment-picker button > span:first-child { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(145deg,#d32a39,#941923); font-size: 11px; font-weight: 700; }
.appointment-picker button > span:nth-child(2) { font-size: 10px; line-height: 1.4; }
.appointment-picker button i { color: #8dbbd8; font-style: normal; font-size: 16px; text-align: center; }
.appointment-picker button:hover:not(:disabled) { border-color: rgba(131,204,247,.42); background: linear-gradient(135deg,rgba(39,104,148,.85),rgba(14,48,73,.94)); }
.appointment-picker button.selected { border-color: rgba(74,190,135,.45); box-shadow: inset 0 0 0 1px rgba(74,190,135,.16); }
.appointment-picker button:disabled { opacity: .55; }
.typing { width: min(960px,calc(100% - 40px)); display: flex; align-items: center; gap: 5px; margin: auto; padding: 0 0 8px 52px; color: var(--muted); font-size: 9px; }
.typing span { width: 5px; height: 5px; border-radius: 50%; background: var(--wine); animation: typing 1s infinite alternate; }
.typing span:nth-child(2) { animation-delay: .18s; }.typing span:nth-child(3) { animation-delay: .36s; }
.typing em { margin-left: 5px; font-style: normal; }
.composer { padding: 8px clamp(20px,5vw,88px) 18px; }
.composer-box { max-width: 960px; display: flex; align-items: flex-end; gap: 10px; margin: auto; padding: 9px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.94); box-shadow: 0 16px 46px rgba(20,53,87,.11); }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 11px 13px; border: 0; outline: 0; background: transparent; font-size: 13px; line-height: 1.5; }
.composer textarea:disabled { color: #82909c; background: rgba(20,53,87,.035); border-radius: 14px; }
.composer button { width: 44px; height: 44px; border: 1px solid rgba(103,5,12,.18); border-radius: 14px; color: #fff; background: linear-gradient(180deg,#c72b35,#96151c); cursor: pointer; font-size: 19px; box-shadow: 0 8px 20px rgba(167,25,28,.23), inset 1px 1px 0 rgba(255,255,255,.36); }
.composer button:disabled { opacity: .4; cursor: wait; }
.composer > p { margin: 7px auto 0; text-align: center; color: #8b97a1; font-size: 8px; }

.site-footer { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px,5vw,78px); color: #8a959e; font-size: 8px; letter-spacing: .03em; }
.drawer-backdrop { position: fixed; z-index: 20; inset: 0; background: rgba(7,24,40,.2); backdrop-filter: blur(5px); animation: fadeIn .2s ease; }
.settings-drawer { position: fixed; z-index: 21; top: 12px; right: 12px; bottom: 12px; width: min(390px, calc(100vw - 24px)); padding: 27px; overflow-y: auto; color: #fff; background: linear-gradient(160deg,#123655,#09243c); border: 1px solid rgba(255,255,255,.12); border-radius: 24px; box-shadow: -20px 20px 70px rgba(9,36,60,.28); transform: translateX(calc(100% + 26px)); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.settings-drawer.open { transform: translateX(0); }
.settings-drawer > header { display: flex; align-items: flex-start; justify-content: space-between; }
.settings-drawer h2 { margin: 6px 0 0; font-size: 24px; letter-spacing: -.04em; }
.settings-drawer > header button { width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; color: #fff; background: rgba(255,255,255,.06); cursor: pointer; font-size: 22px; }
.drawer-kicker { color: rgba(255,255,255,.48); font-size: 8px; letter-spacing: .16em; text-transform: uppercase; }
.drawer-section { margin-top: 28px; }
.connection-card { display: flex; align-items: center; justify-content: space-between; padding: 12px 13px; border: 1px solid rgba(255,255,255,.11); border-radius: 14px; background: rgba(255,255,255,.05); }
.connection-card div { display: flex; align-items: center; gap: 10px; }
.connection-card strong { font-size: 10px; font-weight: 500; }
.connection-card button { border: 0; color: rgba(255,255,255,.6); background: transparent; cursor: pointer; font-size: 8px; }
.settings-drawer label { display: block; margin: 14px 0 6px; color: rgba(255,255,255,.6); font-size: 9px; }
.settings-drawer input { width: 100%; height: 43px; padding: 0 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 11px; outline: 0; color: #fff; background: rgba(255,255,255,.065); font-size: 11px; }
.settings-drawer input:focus { border-color: rgba(255,255,255,.35); box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
.field-help { margin: 9px 2px 0; color: rgba(255,255,255,.42); font-size: 8px; line-height: 1.6; }
.password-field { position: relative; }
.password-field input { padding-right: 58px; }
.password-field button { position: absolute; right: 6px; top: 6px; height: 31px; padding: 0 10px; border: 0; border-radius: 8px; color: var(--navy); background: #fff; cursor: pointer; font-size: 8px; }
.primary-button, .secondary-button { width: 100%; height: 44px; margin-top: 14px; border-radius: 11px; cursor: pointer; font-size: 10px; }
.primary-button { display: flex; align-items: center; justify-content: space-between; padding: 0 15px; border: 0; color: #fff; background: linear-gradient(115deg,#b22531,#8c1d2a); box-shadow: 0 12px 26px rgba(0,0,0,.18); font-weight: 600; }
.secondary-button { margin-top: 8px; border: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.7); background: rgba(255,255,255,.04); }
.turn-section { padding-top: 22px; border-top: 1px solid rgba(255,255,255,.09); }
.turn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 0; }
.turn-grid div { min-width: 0; padding: 10px; border: 1px solid rgba(255,255,255,.07); border-radius: 10px; background: rgba(255,255,255,.045); }
.turn-grid dt { color: rgba(255,255,255,.4); font-size: 7px; letter-spacing: .08em; text-transform: uppercase; }
.turn-grid dd { margin: 5px 0 0; overflow: hidden; color: #fff; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.privacy-note { margin: 20px 0 0; color: rgba(255,255,255,.35); font-size: 8px; line-height: 1.6; }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: 380px; padding: 12px 15px; border-radius: 12px; color: #fff; background: var(--navy); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s; font-size: 10px; }
.toast.visible { opacity: 1; transform: translateY(0); }.toast.error { background: #7b2331; }

@keyframes pathFlow { to { stroke-dashoffset: -1000; } }
@keyframes reveal { from { opacity: 0; transform: translateY(18px); } }
@keyframes letterIn { to { opacity: 1; transform: translateY(0) rotateX(0); filter: blur(0); } }
@keyframes workspaceIn { from { opacity: 0; transform: translateY(26px) scale(.98); } }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes typing { to { opacity: .25; transform: translateY(-3px); } }
@keyframes fadeIn { from { opacity: 0; } }

/* Avanzar nocturne — luminous, focused and conversational. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --navy: #174a73;
  --navy-deep: #061522;
  --wine: #d22635;
  --ink: #f4f8fb;
  --muted: #9fb1c0;
  --canvas: #061522;
  --line: rgba(173, 211, 238, .14);
  --shadow: 0 30px 100px rgba(0, 0, 0, .46);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 72% 12%, rgba(41, 106, 153, .24), transparent 31%),
    radial-gradient(circle at 56% 88%, rgba(210, 38, 53, .13), transparent 34%),
    #061522;
}
.background-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(122, 177, 213, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 177, 213, .035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 62% 46%, #000, transparent 76%);
}
.background-art::after {
  background:
    radial-gradient(circle at 60% 43%, rgba(27, 83, 123, .16), transparent 36%),
    linear-gradient(110deg, rgba(6, 21, 34, .96), rgba(6, 21, 34, .62) 52%, rgba(8, 25, 39, .94));
}
#pathCanvas { opacity: .22; filter: saturate(1.5); }
.background-glow {
  width: min(72vw, 980px);
  background: radial-gradient(circle, rgba(41, 111, 160, .16), rgba(15, 51, 78, .07) 45%, transparent 72%);
  filter: blur(28px);
}

.app-shell { padding-left: 238px; }
.chat-sidebar {
  width: 238px;
  padding: 22px 14px 14px;
  background: linear-gradient(180deg, rgba(5, 25, 41, .96), rgba(4, 18, 30, .98));
  border-right-color: rgba(153, 205, 239, .12);
  box-shadow: 24px 0 80px rgba(0, 0, 0, .22), inset -1px 0 rgba(255,255,255,.025);
  backdrop-filter: blur(26px);
}
.sidebar-brand {
  min-height: 60px;
  display: grid;
  place-items: center;
  margin: 0 3px 18px;
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 14px 34px rgba(0,0,0,.2), inset 0 0 0 1px rgba(255,255,255,.7);
}
.sidebar-brand img { display: block; width: 148px; max-width: 100%; height: 38px; object-fit: contain; }
.new-chat-button {
  height: 48px;
  border-color: rgba(132, 190, 228, .22);
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(38, 92, 132, .34), rgba(255,255,255,.045));
  box-shadow: inset 0 1px rgba(255,255,255,.11), 0 12px 28px rgba(0,0,0,.15);
}
.new-chat-button:hover { background: linear-gradient(135deg, rgba(50, 117, 164, .44), rgba(210, 38, 53, .12)); }
.history-item:hover, .history-item.active {
  background: linear-gradient(110deg, rgba(41, 103, 147, .3), rgba(210, 38, 53, .08));
  box-shadow: inset 0 0 0 1px rgba(148, 202, 237, .12);
}

.site-header { height: 88px; padding: 0 clamp(22px, 4vw, 62px); }
.brand { color: #fff; }
.dalia-wordmark { font-size: 24px; text-shadow: 0 0 30px rgba(101, 178, 229, .2); }
.dalia-wordmark small { color: #849bab; }
.api-status { color: #9eb1bf; }
.header-button.quiet, .chat-heading button {
  color: #dce9f2;
  background: rgba(11, 37, 57, .58);
  border-color: rgba(154, 205, 238, .16);
}
.header-button {
  border-color: rgba(119, 188, 231, .2);
  background: linear-gradient(125deg, rgba(31, 87, 127, .94), rgba(13, 49, 76, .96));
  box-shadow: 0 12px 34px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.15);
}

.experience { padding: 0 28px 18px; }
.welcome { width: min(980px, 100%); }
.hero-orbit {
  position: relative;
  width: 138px;
  height: 138px;
  display: grid;
  place-items: center;
  margin: 0 auto 7px;
}
.hero-orbit::before, .hero-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.hero-orbit::before {
  inset: -34px;
  background: radial-gradient(circle, rgba(120, 197, 245, .26), rgba(45, 116, 165, .08) 43%, transparent 72%);
  filter: blur(12px);
  animation: orbitPulse 4s ease-in-out infinite;
}
.hero-orbit::after {
  inset: 3px;
  border: 1px solid rgba(123, 199, 245, .2);
  box-shadow: 0 0 44px rgba(75, 159, 215, .15), inset 0 0 30px rgba(210,38,53,.06);
}
.orbit-ring {
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  border-top-color: rgba(119, 198, 246, .64);
  border-right-color: rgba(210, 38, 53, .38);
  border-radius: 50%;
  animation: orbitSpin 10s linear infinite;
}
.hero-avatar {
  position: relative;
  z-index: 1;
  width: 88px;
  height: 88px;
  margin: 0;
  border: 1px solid rgba(255,255,255,.3);
  background: #dfe8ed;
  box-shadow: 0 0 42px rgba(83, 173, 229, .23), 0 18px 50px rgba(0,0,0,.34);
}
.hero-avatar img { object-position: 50% 10%; transform: scale(1.08); }
.eyebrow { color: #b7ccda; }
.eyebrow i { background: linear-gradient(90deg, var(--wine), #62a9d8); }
.animated-title {
  max-width: 900px;
  margin: 14px auto 15px;
  color: #f4f9fc;
  font-size: clamp(42px, 5.4vw, 72px);
  text-shadow: 0 0 45px rgba(107, 187, 238, .11);
}
.welcome > p { color: #9fb2c0; }
.hero-composer {
  width: min(800px, 100%);
  min-height: 96px;
  align-items: flex-end;
  margin-top: 27px;
  padding: 14px 14px 14px 23px;
  border-color: rgba(157, 210, 244, .2);
  border-radius: 25px;
  background: linear-gradient(145deg, rgba(22, 55, 78, .72), rgba(8, 28, 45, .82));
  box-shadow: 0 28px 80px rgba(0,0,0,.34), inset 0 1px rgba(255,255,255,.09), 0 0 0 1px rgba(35, 100, 145, .08);
  backdrop-filter: blur(30px) saturate(135%);
}
.hero-composer textarea { min-height: 52px; color: #f5f9fb; font-size: 13px; }
.hero-composer textarea::placeholder { color: #8ea4b3; }
.hero-composer button {
  background: linear-gradient(135deg, #c82635, #86131d);
  box-shadow: 0 12px 30px rgba(180, 24, 38, .28), inset 0 1px rgba(255,255,255,.2);
}
.hero-composer button i { color: #a01924; }
.quick-actions button {
  color: #dbe8f0;
  border-color: rgba(141, 198, 234, .15);
  background: rgba(14, 42, 63, .58);
  box-shadow: 0 10px 30px rgba(0,0,0,.15), inset 0 1px rgba(255,255,255,.07);
}
.quick-actions button:hover { background: rgba(26, 70, 101, .72); border-color: rgba(109, 186, 233, .35); }
.quick-actions span { color: #ff7d88; background: rgba(210,38,53,.13); }
.trust-row { color: #758d9d; }

.chat-workspace {
  height: calc(100vh - 144px);
  border-color: rgba(147, 201, 236, .16);
  background: linear-gradient(145deg, rgba(11, 34, 52, .88), rgba(5, 22, 36, .94));
  box-shadow: 0 32px 100px rgba(0,0,0,.42), inset 0 1px rgba(255,255,255,.07), inset 0 0 80px rgba(23,75,109,.07);
  backdrop-filter: blur(30px) saturate(125%);
}
.chat-heading { border-bottom-color: rgba(159, 210, 242, .12); }
.assistant-mark { border-radius: 50%; background: #dfe8ed; }
.assistant-mark img {
  object-fit: cover;
  object-position: 50% 8%;
  transform: scale(1.03);
}
.assistant-identity strong { color: #f4f9fc; }
.assistant-identity span { color: #8fa5b4; }
.messages { scrollbar-color: rgba(114,168,201,.38) transparent; }
.message-avatar img { object-position: 50% 8%; transform: scale(1.04); }
.assistant .bubble { color: #eaf2f7; }
.user .bubble {
  background: linear-gradient(135deg, #1d5a84, #123b5b 72%, #7f1b28 145%);
  border: 1px solid rgba(149, 211, 249, .14);
  box-shadow: 0 16px 38px rgba(0,0,0,.26), inset 0 1px rgba(255,255,255,.09);
}
.bubble-meta { color: rgba(178, 201, 216, .55); }
.typing { color: #91a7b6; }
.composer-box {
  border-color: rgba(148, 204, 239, .18);
  background: linear-gradient(145deg, rgba(21, 53, 76, .88), rgba(8, 29, 46, .94));
  box-shadow: 0 18px 54px rgba(0,0,0,.35), inset 0 1px rgba(255,255,255,.08);
}
.composer textarea { color: #f5f9fc; }
.composer textarea::placeholder { color: #8196a5; }
.composer textarea:disabled { color: #758c9b; background: rgba(255,255,255,.025); }
.composer > p { color: #6f8797; }
.site-footer { color: #627989; }
.drawer-backdrop { background: rgba(2, 10, 17, .62); }
.toast { background: #123b5a; }

.training-backdrop { position: fixed; z-index: 24; inset: 0; background: rgba(1,10,18,.66); backdrop-filter: blur(7px); animation: fadeIn .2s ease; }
.training-panel {
  position: fixed; z-index: 25; top: 18px; right: 18px; bottom: 18px; width: min(620px,calc(100vw - 36px));
  padding: 30px; overflow-y: auto; color: #edf6fb; border: 1px solid rgba(142,205,243,.18); border-radius: 26px;
  background: linear-gradient(150deg,rgba(15,48,72,.98),rgba(4,22,36,.99));
  box-shadow: -30px 30px 100px rgba(0,0,0,.5), inset 0 1px rgba(255,255,255,.08);
  transform: translateX(calc(100% + 40px)); transition: transform .38s cubic-bezier(.2,.8,.2,1);
}
.training-panel.open { transform: translateX(0); }
.training-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 23px; border-bottom: 1px solid rgba(151,207,242,.12); }
.training-panel h2 { margin: 7px 0 5px; font-size: 26px; letter-spacing: -.045em; }
.training-panel header p { margin: 0; color: #86a0b2; font-size: 9px; }
.training-panel > header button { width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; color: #fff; background: rgba(255,255,255,.06); cursor: pointer; font-size: 22px; }
.training-content { display: grid; gap: 28px; padding-top: 24px; }
.training-loading, .training-error { padding: 18px; border: 1px solid rgba(255,255,255,.1); border-radius: 15px; color: #9fb4c2; background: rgba(255,255,255,.035); font-size: 10px; }
.training-loading span { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #56c391; box-shadow: 0 0 0 5px rgba(86,195,145,.09); }
.training-error small { display: block; margin-top: 7px; color: #e58a91; }
.training-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.training-stats div { padding: 17px; border: 1px solid rgba(142,205,243,.13); border-radius: 16px; background: rgba(255,255,255,.035); }
.training-stats strong, .training-stats span { display: block; }
.training-stats strong { color: #fff; font-size: 25px; letter-spacing: -.04em; }
.training-stats span { margin-top: 3px; color: #7f9aab; font-size: 8px; text-transform: uppercase; letter-spacing: .1em; }
.training-section h3 { margin: 0 0 12px; color: #b3c8d5; font-size: 9px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.capability-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.capability-grid article { display: flex; gap: 12px; min-height: 104px; padding: 15px; border: 1px solid rgba(142,205,243,.12); border-radius: 16px; background: linear-gradient(145deg,rgba(32,81,113,.25),rgba(255,255,255,.025)); }
.capability-grid i { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: #ff8b95; background: rgba(195,35,49,.14); font-size: 8px; font-style: normal; }
.capability-grid strong { font-size: 10px; }
.capability-grid p { margin: 6px 0 0; color: #86a0b1; font-size: 8px; line-height: 1.55; }
.training-sources { display: grid; gap: 7px; }
.training-sources article { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 13px; border: 1px solid rgba(142,205,243,.1); border-radius: 13px; background: rgba(255,255,255,.026); }
.training-sources strong, .training-sources small { display: block; }
.training-sources strong { font-size: 9px; font-weight: 500; }
.training-sources small { margin-top: 4px; color: #708a9b; font-size: 7px; }
.training-status { flex: 0 0 auto; padding: 5px 7px; border-radius: 999px; color: #d2a85f; background: rgba(210,168,95,.1); font-size: 7px; }
.training-status.approved { color: #73d1a5; background: rgba(74,190,135,.1); }

.theme-toggle { min-width: 82px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.theme-toggle > span:first-child { font-size: 14px; line-height: 1; }

/* Modo claro: conserva el azul y vino de Avanzar sobre una superficie luminosa. */
:root[data-theme="light"] {
  color-scheme: light;
  --navy: #143557;
  --navy-deep: #092641;
  --wine: #a7191c;
  --ink: #10283f;
  --muted: #6b7987;
  --canvas: #f7f8f6;
  --line: rgba(20,53,87,.13);
  --shadow: 0 28px 90px rgba(18,45,70,.14);
}
[data-theme="light"] body {
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 10%,rgba(67,137,181,.11),transparent 30%),
    radial-gradient(circle at 58% 90%,rgba(167,25,28,.065),transparent 34%),
    #f7f8f6;
}
[data-theme="light"] .background-art::before {
  background-image:
    linear-gradient(rgba(20,53,87,.025) 1px,transparent 1px),
    linear-gradient(90deg,rgba(20,53,87,.025) 1px,transparent 1px);
  mask-image: radial-gradient(circle at 62% 46%,#000,transparent 77%);
}
[data-theme="light"] .background-art::after {
  background:
    radial-gradient(circle at 60% 43%,rgba(78,145,188,.08),transparent 38%),
    linear-gradient(110deg,rgba(247,248,246,.96),rgba(255,255,255,.68) 52%,rgba(242,246,247,.94));
}
[data-theme="light"] #pathCanvas { opacity: .55; filter: saturate(.9); }
[data-theme="light"] .background-glow { background: radial-gradient(circle,rgba(255,255,255,.98),rgba(255,255,255,.68) 44%,transparent 72%); }
[data-theme="light"] .site-header .brand { color: var(--navy); }
[data-theme="light"] .dalia-wordmark { color: var(--navy); text-shadow: none; }
[data-theme="light"] .dalia-wordmark small, [data-theme="light"] .api-status { color: var(--muted); }
[data-theme="light"] .header-button.quiet,
[data-theme="light"] .chat-heading button {
  color: var(--navy); background: rgba(255,255,255,.72); border-color: var(--line);
  box-shadow: 0 8px 24px rgba(20,53,87,.08),inset 0 1px rgba(255,255,255,.8);
}
[data-theme="light"] .header-button:not(.quiet) { border-color: var(--navy); background: linear-gradient(125deg,#1d4a71,#143557); }
[data-theme="light"] .hero-orbit::before { background: radial-gradient(circle,rgba(65,145,197,.19),rgba(45,116,165,.05) 44%,transparent 72%); }
[data-theme="light"] .animated-title { color: var(--navy-deep); text-shadow: none; }
[data-theme="light"] .welcome > p { color: var(--muted); }
[data-theme="light"] .eyebrow { color: var(--wine); }
[data-theme="light"] .hero-composer {
  border-color: rgba(20,53,87,.1); background: rgba(255,255,255,.82);
  box-shadow: 0 24px 70px rgba(20,53,87,.12),inset 0 1px rgba(255,255,255,.9);
}
[data-theme="light"] .hero-composer textarea { color: var(--ink); }
[data-theme="light"] .hero-composer textarea::placeholder { color: #7e8b97; }
[data-theme="light"] .quick-actions button { color: var(--navy); border-color: var(--line); background: rgba(255,255,255,.72); }
[data-theme="light"] .quick-actions button:hover { background: #fff; border-color: rgba(167,25,28,.25); }
[data-theme="light"] .trust-row { color: #71808d; }
[data-theme="light"] .chat-workspace {
  border-color: rgba(20,53,87,.11); background: rgba(255,255,255,.86);
  box-shadow: 0 28px 90px rgba(18,45,70,.14),inset 0 1px rgba(255,255,255,.9);
}
[data-theme="light"] .chat-heading { border-bottom-color: var(--line); }
[data-theme="light"] .assistant-identity strong { color: var(--navy); }
[data-theme="light"] .assistant-identity span { color: var(--muted); }
[data-theme="light"] .assistant .bubble { color: var(--ink); }
[data-theme="light"] .user .bubble { background: linear-gradient(135deg,#1d527b,#143557 74%,#7f1b28 145%); }
[data-theme="light"] .date-separator { color: #607485; background: rgba(255,255,255,.78); }
[data-theme="light"] .composer-box { border-color: var(--line); background: rgba(255,255,255,.96); box-shadow: 0 16px 46px rgba(20,53,87,.11); }
[data-theme="light"] .composer textarea { color: var(--ink); }
[data-theme="light"] .composer textarea::placeholder { color: #84929d; }
[data-theme="light"] .composer textarea:disabled { color: #82909c; background: rgba(20,53,87,.035); }
[data-theme="light"] .composer > p, [data-theme="light"] .site-footer { color: #7e8c97; }
[data-theme="light"] .training-backdrop { background: rgba(20,42,61,.3); }
[data-theme="light"] .training-panel {
  color: var(--ink); border-color: rgba(20,53,87,.12);
  background: linear-gradient(150deg,rgba(255,255,255,.99),rgba(239,245,247,.99));
  box-shadow: -30px 30px 100px rgba(20,53,87,.2),inset 0 1px rgba(255,255,255,.9);
}
[data-theme="light"] .training-panel > header { border-bottom-color: var(--line); }
[data-theme="light"] .training-panel header p,
[data-theme="light"] .capability-grid p,
[data-theme="light"] .training-sources small { color: var(--muted); }
[data-theme="light"] .training-panel > header button { color: var(--navy); border-color: var(--line); background: rgba(255,255,255,.8); }
[data-theme="light"] .training-stats div,
[data-theme="light"] .capability-grid article,
[data-theme="light"] .training-sources article { border-color: var(--line); background: rgba(255,255,255,.68); }
[data-theme="light"] .training-stats strong { color: var(--navy); }
[data-theme="light"] .training-stats span,
[data-theme="light"] .training-section h3 { color: #647989; }
[data-theme="light"] .training-loading,
[data-theme="light"] .training-error { color: var(--muted); border-color: var(--line); background: rgba(255,255,255,.7); }

@keyframes orbitSpin { to { transform: rotate(360deg); } }
@keyframes orbitPulse { 50% { opacity: .62; transform: scale(1.1); } }

@media (max-width: 720px) {
  body { overflow: auto; }
  .app-shell { padding-left: 0; }
  .chat-sidebar { transform: translateX(-100%); width: min(280px, 86vw); }
  .chat-sidebar.open { transform: translateX(0); }
  .site-header { height: 82px; padding: 0 17px; }
  .brand-logo-wrap { width: 98px; height: 42px; }
  .brand-divider, .dalia-wordmark small, .api-status, .header-button.quiet:not(.sidebar-toggle) { display: none; }
  .sidebar-toggle { display: inline-block; }
  .dalia-wordmark { font-size: 18px; }
  .header-button { height: 38px; padding: 0 13px; }
  .experience { min-height: calc(100vh - 130px); padding: 18px 15px; }
  .animated-title { margin-top: 18px; font-size: clamp(42px,13vw,64px); }
  .welcome > p { font-size: 11px; }
  .hero-composer { min-height: 64px; padding-left: 15px; border-radius: 19px; }
  .hero-composer button { width: 48px; height: 48px; padding: 7px; border-radius: 14px; }
  .hero-composer button span { display: none; }
  .hero-composer button i { width: 34px; height: 34px; }
  .trust-row { gap: 9px 16px; }
  .site-footer { justify-content: center; text-align: center; padding: 10px 18px 18px; }
  .site-footer span:last-child { display: none; }
  .chat-workspace { height: calc(100vh - 112px); min-height: 560px; border-radius: 22px; }
  .bubble { max-width: 88%; }
  .training-panel { top: 8px; right: 8px; bottom: 8px; width: calc(100vw - 16px); padding: 22px; border-radius: 22px; }
  .training-stats { gap: 6px; }
  .training-stats div { padding: 12px 10px; }
  .capability-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
