:root{--ink:#0b1f3a;--paper:#f4f0e8;--gold:#d4a64a;--line:rgba(11,31,58,.14);--muted:#607087}*{box-sizing:border-box}[hidden]{display:none!important}body{margin:0;background:radial-gradient(circle at top right,rgba(212,166,74,.18),transparent 28%),var(--paper);color:var(--ink);font-family:Estedad,Tahoma,sans-serif;min-height:100vh}.chat-shell{width:min(900px,calc(100% - 28px));margin:auto;padding:22px 0 56px}.chat-header{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:20px}.brand{font-weight:800;color:var(--ink);text-decoration:none}.header-actions,.start-actions{display:flex;gap:10px;flex-wrap:wrap}.language,.exit,.secondary,.primary{min-height:42px;padding:0 15px;border-radius:13px;border:1px solid var(--line);font:inherit;font-weight:800;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}.language,.secondary{background:#fff;color:var(--ink)}.exit{background:transparent;color:var(--ink)}.primary{border-color:var(--gold);background:var(--gold);color:#111d2f}.chat-card{background:#fff;border:1px solid var(--line);border-radius:24px;box-shadow:0 24px 64px rgba(11,31,58,.12);padding:clamp(22px,5vw,46px)}.chat-intro{max-width:680px}.eyebrow{margin:0 0 10px;color:#9a7419;font-size:13px;font-weight:800}.chat-intro h1{font-size:clamp(28px,5vw,48px);line-height:1.22;margin:0 0 16px}.chat-intro p{line-height:1.9;color:var(--muted)}.availability{padding:14px 16px;border-radius:15px;background:#f7f1df;border:1px solid rgba(212,166,74,.32);font-weight:700;margin:22px 0}.small{font-size:13px}.chat-room{display:grid;gap:16px}.room-head{display:flex;justify-content:space-between;align-items:center;gap:10px;border-bottom:1px solid var(--line);padding-bottom:16px}.room-head div{display:grid;gap:4px}.room-head span{color:var(--muted);font-size:13px}.messages{height:min(54vh,520px);overflow:auto;display:grid;align-content:start;gap:10px;padding:8px 2px}.message{max-width:80%;padding:12px 14px;border-radius:16px;background:#edf2f7;line-height:1.75;white-space:pre-wrap;overflow-wrap:anywhere}.message.agent{background:#f7ecd0}.message small{display:block;margin-top:5px;color:var(--muted);font-size:11px}.composer{display:grid;grid-template-columns:1fr auto;gap:10px}.composer textarea{min-height:68px;max-height:180px;resize:vertical;border:1px solid var(--line);border-radius:14px;padding:12px;font:inherit;color:var(--ink)}.error{min-height:1.3em;color:#a31320;font-weight:700}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}html[lang=en]{font-family:Metropolis,Segoe UI,sans-serif;direction:ltr}@media(max-width:600px){.chat-shell{width:min(100% - 18px,900px);padding-top:12px}.chat-card{padding:20px 16px}.chat-header,.room-head,.composer{align-items:stretch;grid-template-columns:1fr;flex-direction:column}.composer .primary{width:100%}.message{max-width:94%}}
:root{--chat-space:18px}.agent-layout{display:grid;grid-template-columns:220px minmax(0,1fr);gap:var(--chat-space);margin-top:20px}.conversation-list{display:grid;align-content:start;gap:8px}.conversation-item{padding:12px;text-align:start;border:1px solid var(--line);border-radius:12px;background:#fff;cursor:pointer;font:inherit}#note-form{display:grid;gap:8px;border-top:1px solid var(--line);padding-top:14px}#note-form textarea{min-height:70px;border:1px solid var(--line);border-radius:12px;padding:10px;font:inherit}@media(max-width:700px){.agent-layout{grid-template-columns:1fr}}
.recovery{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px;border:1px dashed rgba(212,166,74,.55);background:#fff9e9;border-radius:12px}.recovery code{direction:ltr;overflow-wrap:anywhere;word-break:break-word;min-width:0;flex:1 1 16rem;font-size:12px}
.restore{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:8px;align-items:center;margin-top:18px}.restore input{min-width:0;padding:10px;border:1px solid var(--line);border-radius:12px;font:inherit}@media(max-width:600px){.restore{grid-template-columns:1fr}}
.composer .chat-send{width:auto;min-width:88px;padding-inline:18px}@media(max-width:600px){.composer .chat-send{width:auto;justify-self:start}}

/* Refined chat controls: compact, calm, and clear in both RTL and LTR. */
:root {
  --chat-surface: #fbfcfd;
  --chat-composer-border: #dce4eb;
  --chat-outgoing: #244e70;
  --chat-outgoing-border: #214664;
  --chat-incoming: #fff4dc;
  --chat-incoming-border: #eddbad;
  --chat-accent: #c99132;
  --chat-focus: rgba(201,145,50,.28);
}

.language,
.exit,
.secondary,
.primary,
.conversation-item {
  min-height: 40px;
  border-radius: 12px;
}

.primary {
  border-color: var(--chat-accent);
  background: linear-gradient(145deg, #e0b55c, #cb9130);
  color: #18243a;
  box-shadow: 0 4px 10px rgba(178,119,31,.16);
}

.language.is-selected {
  border-color: rgba(201,145,50,.72);
  background: #fff7e7;
  color: #7d5415;
  box-shadow: inset 0 0 0 1px rgba(201,145,50,.14);
}

@media (prefers-reduced-motion: no-preference) {
  .language,
  .exit,
  .secondary,
  .primary,
  .conversation-item {
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
  }
}

@media (hover: hover) {
  .primary:hover:not(:disabled) {
    background: #c18729;
    box-shadow: 0 7px 15px rgba(178,119,31,.22);
    transform: translateY(-1px);
  }

  .secondary:hover,
  .language:hover {
    background: #fffaf0;
    border-color: rgba(201,145,50,.4);
  }

  .conversation-item:hover {
    background: #fffaf0;
    border-color: rgba(201,145,50,.38);
  }
}

.primary:active:not(:disabled) {
  background: #ae731c;
  box-shadow: 0 2px 6px rgba(178,119,31,.18);
  transform: translateY(0);
}

.primary:disabled,
.secondary:disabled,
.language:disabled {
  cursor: not-allowed;
  opacity: .56;
  box-shadow: none;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid var(--chat-focus);
  outline-offset: 3px;
}

.composer {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--chat-composer-border);
  border-radius: 19px;
  background: var(--chat-surface);
  box-shadow: 0 10px 28px rgba(11,31,58,.06);
}

.composer textarea {
  min-height: 52px;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 10px 12px;
}

.composer:focus-within {
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 4px var(--chat-focus), 0 10px 28px rgba(11,31,58,.06);
}

.composer .chat-send {
  width: auto;
  min-width: 88px;
  min-height: 40px;
  height: 40px;
  align-self: end;
  justify-self: auto;
  padding-inline: 12px;
  gap: 6px;
  border-radius: 13px;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.chat-send-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  pointer-events: none;
}

html[dir=rtl] .chat-send-icon {
  transform: scaleX(-1);
}

.composer .chat-send.is-sending {
  background: #c28a33;
  opacity: .78;
}

.messages {
  align-content: end;
  gap: 12px;
  padding: 10px 4px;
}

.message {
  width: fit-content;
  max-width: min(80%, 580px);
  border: 1px solid transparent;
  border-radius: 18px;
  box-shadow: 0 3px 10px rgba(11,31,58,.05);
}

#messages .message:not(.agent),
#agent-messages .message.agent {
  justify-self: start;
  background: var(--chat-outgoing);
  color: #fff;
  border-color: var(--chat-outgoing-border);
  border-radius: 18px 18px 4px 18px;
}

#messages .message.agent,
#agent-messages .message:not(.agent) {
  justify-self: end;
  background: var(--chat-incoming);
  color: var(--ink);
  border-color: var(--chat-incoming-border);
  border-radius: 18px 18px 18px 4px;
}

#messages .message:not(.agent) small,
#agent-messages .message.agent small {
  color: rgba(255,255,255,.74);
}

html[dir=ltr] #messages .message:not(.agent),
html[dir=ltr] #agent-messages .message.agent {
  border-radius: 18px 18px 18px 4px;
}

html[dir=ltr] #messages .message.agent,
html[dir=ltr] #agent-messages .message:not(.agent) {
  border-radius: 18px 18px 4px 18px;
}

.conversation-item[aria-current=true] {
  border-color: rgba(201,145,50,.62);
  background: #fff7e5;
  box-shadow: 0 5px 14px rgba(201,145,50,.12);
}

.error:not(:empty) {
  padding: 10px 12px;
  border: 1px solid #f3c9ce;
  border-radius: 12px;
  background: #fff0f1;
}

@media (max-width: 600px) {
  .composer {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .composer .chat-send {
    width: auto;
    min-width: 88px;
    height: 40px;
    min-height: 40px;
    justify-self: auto;
  }

  .message {
    max-width: 92%;
  }
}

html[lang="en"] body {
  font-family: Metropolis, "Segoe UI", sans-serif;
}
