.hermes-chat-panel { max-width: 960px; margin: 24px auto; padding: 0 20px 24px; }
.hermes-chat-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hermes-chat-header h2 { margin-top: 0; }
.hermes-chat-messages { min-height: 240px; max-height: 48vh; overflow-y: auto; padding: 16px; border: 1px solid #d9dfe5; border-radius: 6px; background: #f8fafb; }
.hermes-chat-message { max-width: 86%; margin-bottom: 14px; padding: 12px; border: 1px solid #dfe4e8; border-radius: 10px; background: #fff; }
.hermes-chat-message-user { margin-left: auto; background: #eaf4ff; }
.hermes-chat-message-label { font-size: 12px; font-weight: 600; color: #52606d; }
.hermes-chat-message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.hermes-chat-message-note { font-size: 12px; color: #52606d; margin-top: 6px; }
.hermes-analytics-chart { margin: 12px 0; overflow: auto; max-height: 420px; white-space: normal; }
.hermes-analytics-chart svg { display: block; width: 100%; min-width: 560px; }
.hermes-analytics-chart text { font-size: 14px; fill: #34495e; }
.hermes-analytics-chart figcaption { font-size: 12px; color: #52606d; margin-bottom: 6px; }
.hermes-chart-bar { fill: #2b96cc; }
.hermes-chart-line { stroke: #2b96cc; stroke-width: 2; }
.hermes-chart-axis { stroke: #a9b7c4; stroke-width: 1; }
.hermes-chat-panel textarea { resize: vertical; }
.hermes-chat-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
#hermesChatProgress, #hermesChatError { min-height: 20px; margin: 6px 0; }
@media (max-width: 640px) {
    .hermes-chat-panel { padding: 0 10px 16px; }
    .hermes-chat-header { align-items: flex-start; flex-direction: column; }
    .hermes-chat-message { max-width: 96%; }
    .hermes-chat-actions button { flex: 1 1 auto; }
}

.hermes-chat-panel{height:calc(100vh - 120px);height:calc(100dvh - 120px);min-height:0;display:flex;flex-direction:column;margin:32px auto 12px;padding-bottom:8px}.hermes-chat-header,.hermes-chat-actions,#hermesChatContext,#hermesChatStatus,#hermesChatSafety,#hermesChatInputHelp,#hermesChatInput,#hermesChatProgress,#hermesChatError{flex-shrink:0}.hermes-chat-messages{flex:1;min-height:100px;max-height:none;overscroll-behavior:contain;scrollbar-gutter:stable}.hermes-chat-panel textarea{height:72px;min-height:72px;max-height:72px;resize:none}.hermes-chat-panel #hermesChatSafety{font-size:12px;padding:6px 10px;margin:4px 0}.hermes-chat-panel #hermesChatContext,.hermes-chat-panel #hermesChatStatus,.hermes-chat-panel #hermesChatInputHelp{font-size:12px;margin:3px 0}.hermes-chat-sources{font-size:11px;color:#66788a;border-top:1px solid #edf0f2;padding-top:4px}.hermes-chat-sources p{margin:2px 0}.hermes-chat-sources a{color:#66788a}.hermes-chat-message p{white-space:pre-wrap;line-height:1.6}.hermes-chat-panel button.btn{min-width:52px}@media(max-height:650px){.hermes-chat-panel{min-height:0}.hermes-chat-panel #hermesChatContext{display:none}.hermes-chat-panel textarea{height:54px;min-height:54px;max-height:54px}}

/* Fit the existing multi-row Painsight navigation, including narrow windows. */
.hermes-chat-header{flex-direction:row;align-items:center;gap:6px}.hermes-chat-header h2{font-size:22px;line-height:1.2;margin:0}.hermes-chat-messages{min-height:40px;padding:10px}.hermes-chat-panel #hermesChatProgress,.hermes-chat-panel #hermesChatError{min-height:16px;font-size:12px;line-height:16px;margin:2px 0}.hermes-chat-panel #hermesChatError:empty{display:none}
@media(max-width:640px),(max-height:750px){.hermes-chat-panel textarea{height:54px;min-height:54px;max-height:54px}.hermes-chat-panel #hermesChatSafety{font-size:10px;line-height:1.25;padding:4px 6px}.hermes-chat-header button{font-size:12px;padding:6px}.hermes-chat-panel #hermesChatContext,.hermes-chat-panel #hermesChatStatus,.hermes-chat-panel #hermesChatInputHelp{margin:1px 0}}

body.hermes-chat-active{overflow:hidden}

.hermes-chat-notice{flex-shrink:0;font-size:11px;color:#607080;margin:4px 0}.hermes-chat-notice summary{cursor:pointer}.hermes-chat-notice #hermesChatSafety{background:none;border:0}

/* Assistant workspace; deliberately scoped away from the legacy patient UI. */
.hermes-chat-panel{max-width:1100px;background:#fff;border:1px solid #e0e7ed;border-radius:18px;box-shadow:0 8px 32px #1b405b06;padding:20px 26px 14px;margin:20px auto 12px;color:#243c51}
.hermes-chat-header{padding-bottom:12px;border-bottom:1px solid #e9eef3;gap:12px;flex-shrink:0}.hermes-chat-eyebrow{display:block;font-size:10px;font-weight:700;letter-spacing:1.6px;color:#1383b3;margin-bottom:4px}.hermes-chat-header h2{font-size:24px;font-weight:600}.hermes-chat-header-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.hermes-chat-panel button.btn{border-radius:9px;font-size:12px;padding:9px 12px}.hermes-chat-header #hermesChatRetry{color:#63798c;background:#f8fafc}
.hermes-chat-panel #hermesChatStatus{font-size:11px;color:#568072;margin-top:9px}.hermes-chat-panel #hermesChatContext{font-size:12px;color:#728598;margin:3px 0 10px}
.hermes-chat-history{flex:1;min-height:0;display:flex;flex-direction:column;background:linear-gradient(180deg,#fcfdff,#fff);overflow:hidden}.hermes-chat-messages{flex:1;min-height:0;border:0;border-radius:0;background:transparent;padding:12px 8px 8px 0}.hermes-chat-message{max-width:92%;padding:16px 20px;border-color:#e2eaf0;border-radius:15px;margin-bottom:15px;line-height:1.65;box-shadow:0 2px 5px #183b5603;font-size:14px}.hermes-chat-message-user{max-width:82%;background:#eaf4fb;border-color:#dcecf6;border-bottom-right-radius:5px}.hermes-chat-message-assistant{border-bottom-left-radius:5px}.hermes-chat-message-label{font-size:10px;letter-spacing:.5px;color:#678298;margin-bottom:6px}.hermes-chat-message p{margin-bottom:10px}.hermes-chat-message-note:empty{display:none}.hermes-chat-message-note{color:#69849a;font-size:12px}.hermes-chat-messages[aria-busy=true] .hermes-chat-message-assistant:last-child .hermes-chat-message-note:not(:empty):before{content:'';display:inline-block;width:10px;height:10px;border:2px solid #d8e9f3;border-top-color:#1388ba;border-radius:50%;margin-right:7px;animation:hermes-chat-spin 1s linear infinite}
.hermes-chat-welcome{text-align:center;flex-shrink:0;padding:clamp(12px,4vh,44px) 12px 18px}.hermes-chat-symbol{display:grid;place-items:center;width:44px;height:44px;margin:auto;background:#e6f3fa;color:#0877ab;border-radius:14px;font-size:24px;font-weight:700}.hermes-chat-welcome h3{font-size:23px;font-weight:600;margin:16px 0 8px}.hermes-chat-welcome p{color:#74899a;font-size:13px;margin-bottom:18px}.hermes-chat-welcome small{display:block;color:#8194a3;font-size:10px;margin-top:10px}.hermes-chat-suggestions{display:flex;justify-content:center;gap:9px;flex-wrap:wrap}.hermes-chat-suggestion{border:1px solid #dce7ee;border-radius:11px;background:#fff;color:#355770;font-size:12px;padding:12px 16px;cursor:pointer}.hermes-chat-suggestion:hover:not(:disabled){border-color:#72b5d0;background:#f2f9fd}.hermes-chat-suggestion:disabled{opacity:.5;cursor:default}.hermes-chat-panel [hidden]{display:none!important}
.hermes-chat-composer{flex-shrink:0;border-top:1px solid #e9eff4;padding-top:10px}.hermes-chat-composer label{font-size:11px;color:#607b90;margin-bottom:5px}.hermes-chat-notice{float:right;margin:0;font-size:10px}.hermes-chat-notice[open]{float:none}.hermes-chat-compose-row{display:flex;gap:10px;align-items:flex-end;border:1px solid #cbdce8;border-radius:14px;padding:8px;background:#fff;box-shadow:0 4px 18px #183b5608}.hermes-chat-compose-row:focus-within{border-color:#258cbc;box-shadow:0 0 0 3px #1687ba12}.hermes-chat-panel .hermes-chat-compose-row textarea{flex:1;min-width:0;width:auto;box-shadow:none;border:0;outline:none;background:transparent;height:62px;min-height:62px;max-height:62px;font-size:14px;padding:6px;line-height:1.5}.hermes-chat-actions{flex-shrink:0;gap:7px}.hermes-chat-panel #hermesChatInputHelp{font-size:10px;color:#8194a3;margin:7px 0 0}.hermes-chat-panel #hermesChatError:not(:empty){background:#fff4ee;border:1px solid #f3ddcd;color:#8a492a;padding:10px 12px;line-height:1.5;border-radius:10px;max-height:100px;overflow:auto}.hermes-chat-panel :focus-visible{outline:3px solid #269cd0;outline-offset:2px}.hermes-chat-panel textarea:focus-visible{outline:none}
@keyframes hermes-chat-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.hermes-chat-messages[aria-busy=true] .hermes-chat-message-note:before{animation:none}}
@media(max-width:640px){.hermes-chat-panel{margin:8px auto;padding:12px;border-radius:12px}.hermes-chat-header h2{font-size:20px}.hermes-chat-header-actions{gap:5px}.hermes-chat-header #hermesChatRetry{font-size:10px;padding:6px}.hermes-chat-panel button.btn{padding:8px;font-size:11px}.hermes-chat-welcome{padding:15px 4px}.hermes-chat-welcome h3{font-size:21px}.hermes-chat-message{max-width:100%;padding:12px;font-size:14px}.hermes-chat-message-user{max-width:90%}.hermes-chat-suggestion{padding:10px}.hermes-chat-compose-row{gap:5px;padding:5px}.hermes-chat-panel .hermes-chat-compose-row textarea{height:52px;min-height:52px;max-height:52px;font-size:16px}.hermes-chat-actions{flex-direction:column;gap:4px}.hermes-chat-panel #hermesChatContext{font-size:11px;line-height:1.4}}
@media(max-height:700px){.hermes-chat-panel{padding-top:10px;margin-top:10px}.hermes-chat-welcome{padding:6px}.hermes-chat-symbol,.hermes-chat-welcome small{display:none}.hermes-chat-welcome h3{font-size:19px;margin:6px 0}.hermes-chat-welcome p{margin-bottom:8px}.hermes-chat-panel .hermes-chat-compose-row textarea{height:48px;min-height:48px;max-height:48px}}

.hermes-chat-welcome{flex:1;min-height:0;overflow-y:auto;padding:16px 12px}.hermes-chat-welcome:not([hidden])+.hermes-chat-messages{display:none}.hermes-chat-symbol{width:36px;height:36px;font-size:21px}.hermes-chat-welcome h3{margin:10px 0 6px}.hermes-chat-welcome p{margin-bottom:12px}
/* Use available panel height, not just the layout viewport, when a keyboard opens. */
.hermes-chat-panel.hermes-chat-compact{padding:8px 12px}.hermes-chat-compact .hermes-chat-header{padding-bottom:6px;gap:6px}.hermes-chat-compact .hermes-chat-eyebrow,.hermes-chat-compact .hermes-chat-symbol,.hermes-chat-compact .hermes-chat-welcome small{display:none}.hermes-chat-compact .hermes-chat-header h2{font-size:18px}.hermes-chat-compact .hermes-chat-header button.btn{padding:5px 7px;font-size:10px}.hermes-chat-compact .hermes-chat-welcome{padding:6px}.hermes-chat-compact .hermes-chat-welcome h3{font-size:18px;margin:4px 0}.hermes-chat-compact .hermes-chat-welcome p{margin-bottom:6px}.hermes-chat-compact .hermes-chat-composer{padding-top:6px}.hermes-chat-panel.hermes-chat-compact .hermes-chat-compose-row textarea{height:42px;min-height:42px;max-height:42px}.hermes-chat-panel.hermes-chat-compact #hermesChatInputHelp{margin-top:4px;line-height:1.3}
/* A very short viewport cannot fit the header, errors and input at once. Keep all reachable. */
.hermes-chat-panel.hermes-chat-tight{overflow-y:auto}.hermes-chat-tight .hermes-chat-history{flex:1 0 48px}
