:root { font-family: "Segoe UI", Arial, sans-serif; color: #22352e; background: #f6f7f3; font-synthesis: none; --accent: #176348; }
* { box-sizing: border-box; }
body { margin: 0; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, a:focus-visible, .messages:focus-visible { outline: 3px solid #7ea993; outline-offset: 4px; }
[hidden] { display: none !important; }
.chat-shell { max-width: 1040px; margin: auto; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 0 40px; }
.header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 25px 0; border-bottom: 1px solid #dce3da; }
.brand { display: flex; align-items: baseline; gap: 18px; }
.brand-name { font-size: 31px; font-weight: 750; letter-spacing: -1.7px; }
.brand-dot { color: var(--accent); }
.brand-caption { color: #63736a; font-size: 13px; }
.secondary { border: 1px solid #cdd7ce; background: transparent; color: #385344; border-radius: 9px; min-height: 42px; padding: 9px 15px; transition: background .15s; }
.secondary:hover { background: #e9efe6; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 30px 5px 30px 0; scrollbar-width: thin; }
.welcome { max-width: 580px; margin: 11vh auto 0; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 650; letter-spacing: 1.5px; }
h1 { font-size: clamp(28px, 4.5vw, 42px); line-height: 1.18; letter-spacing: -1px; margin: 20px 0 17px; font-weight: 600; }
.welcome p { font-size: 16px; line-height: 1.8; color: #69796f; max-width: 495px; }
.message { max-width: 80%; margin: 0 0 24px; animation: appear .18s ease-out; }
.message.user { margin-left: auto; }
.message-label { font-size: 11px; font-weight: 650; color: #748077; margin-bottom: 8px; }
.user .message-label { text-align: right; }
.message-body { font-size: 15px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.user .message-body { background: #e6eee3; padding: 13px 18px; border-radius: 15px 15px 3px 15px; }
.assistant .message-body { padding-right: 12px; }
.result-link { display: inline-flex; align-items: center; gap: 9px; color: var(--accent); margin-top: 12px; text-decoration-thickness: 1px; text-underline-offset: 4px; font-weight: 600; }
.pending { color: #748077; font-size: 14px; padding: 6px 0 18px; }
.pending::after { content: ""; display: inline-block; margin-left: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite alternate; }
.error { color: #843c2c; background: #f6e9e3; padding: 12px 16px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; line-height: 1.6; }
.composer-area { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
.composer { display: flex; align-items: flex-end; gap: 12px; padding: 14px; border: 1px solid #cad5c8; border-radius: 15px; background: #fff; transition: border-color .15s; }
.composer:focus-within { border-color: var(--accent); }
textarea { flex: 1; min-width: 0; border: none; outline: none; background: transparent; resize: vertical; min-height: 50px; max-height: 180px; line-height: 1.6; color: #22352e; padding: 3px 4px; }
textarea::placeholder { color: #8a958c; }
.send { display: flex; gap: 16px; align-items: center; justify-content: center; border: none; border-radius: 10px; background: var(--accent); color: white; min-height: 46px; padding: 12px 19px; transition: background .15s, transform .15s; }
.send:hover:not(:disabled) { background: #104d37; transform: translateY(-1px); }
.composer-note { display: flex; justify-content: space-between; gap: 15px; color: #7c877f; font-size: 11px; line-height: 1.5; margin-top: 10px; }
.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; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
@media (max-width: 650px) { .chat-shell { padding: 0 18px; } .header { padding: 18px 0; } .brand { display: block; } .brand-caption { display: block; margin-top: 3px; font-size: 11px; } .brand-name { font-size: 27px; } .message { max-width: 92%; } .welcome { margin-top: 8vh; } .composer { padding: 10px; } .send { padding: 10px 13px; } .send span:first-child { display: none; } .composer-note { flex-direction: column; gap: 3px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.with-history { display: grid; grid-template-columns: 310px minmax(0, 1fr); }
.chat-shell { width: 100%; min-width: 0; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions { flex-wrap: wrap; justify-content: flex-end; }
.nav-link { display: inline-flex; align-items: center; text-decoration: none; }
.text-button, .history-toolbar button, .history-pagination button, .earlier { border: 0; background: transparent; color: var(--accent); padding: 9px; border-radius: 6px; }
.history-panel { height: 100dvh; background: #edf1e9; border-right: 1px solid #dce3da; display: flex; flex-direction: column; padding: 25px 18px 18px; gap: 18px; min-width: 0; }
.history-heading { display: flex; align-items: baseline; gap: 18px; }
.history-search { display: flex; background: #fff; border: 1px solid #cad5c8; border-radius: 8px; }
input { font: inherit; min-width: 0; }
.history-search input { width: 100%; border: 0; background: transparent; padding: 12px 9px; font-size: 13px; }
.history-search button { border: 0; background: transparent; color: var(--accent); padding: 12px; }
.history-toolbar, .history-pagination { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: #69796f; }
.history-list { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.history-item { display: flex; flex-direction: column; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #dce3da; background: transparent; color: inherit; padding: 17px 12px; gap: 7px; transition: background .15s; }
.history-item:hover { background: #e3eadd; }
.history-item[aria-current="true"] { background: #dce7d7; border-radius: 8px; }
.history-item strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.history-item span { font-size: 12px; line-height: 1.6; color: #63736a; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.history-item small { color: #69796f; font-size: 10px; }
.history-empty, .history-error { font-size: 13px; line-height: 1.7; padding: 0 10px; color: #63736a; }
.history-error { color: #843c2c; }
.conversation-detail { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 17px 0; border-bottom: 1px solid #e5e9e1; }
.conversation-detail strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.conversation-detail span { font-size: 10px; color: #7c877f; flex-shrink: 0; }
.earlier { align-self: center; margin-top: 12px; font-size: 13px; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(100%, 390px); }
.login-shell .brand-name { display: block; margin-bottom: 54px; font-size: 38px; }
.login-shell p { color: #69796f; line-height: 1.7; }
.login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.login-form label { font-size: 13px; font-weight: 600; }
.login-form input { border: 1px solid #cad5c8; border-radius: 8px; background: #fff; padding: 13px; margin-bottom: 8px; width: 100%; }
.login-form .send { margin-top: 12px; }
input:focus-visible { outline: 2px solid #7ea993; outline-offset: 2px; }
@media (max-width: 1100px) { .brand-caption { display: none; } .chat-shell { padding: 0 24px; } .conversation-detail { display: block; } .conversation-detail span { display: block; margin-top: 5px; } }
@media (max-width: 850px) { .with-history { display: block; } .history-panel { position: fixed; z-index: 3; left: 0; top: var(--admin-header-height, 87px); height: calc(100dvh - var(--admin-header-height, 87px)); width: min(340px, 90vw); box-shadow: 8px 0 30px #22352e18; } .header-actions { gap: 5px; } .header-actions .secondary { padding: 8px 10px; font-size: 12px; } .text-button { font-size: 12px; } .chat-shell { padding: 0 16px; } }
@media (max-width: 420px) { .brand-name { font-size: 23px; } .header-actions .secondary { padding: 8px 6px; } .text-button { padding: 6px; } }
