:root {
  --assistant-panel: #081e2d;
  --assistant-panel-2: #0d2a3c;
  --assistant-paper: #f5f1e7;
  --assistant-line: rgba(255, 255, 255, 0.13);
  --assistant-muted: #91a8b3;
  --assistant-orange: #df7545;
}

html { background: var(--ink); }
.assistant-page { overflow: hidden; background: var(--ink); }
.assistant-workbench { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: calc(100dvh - 74px); min-height: 620px; color: #eef4f5; background: var(--ink); }
.history-panel, .guide-panel { min-width: 0; background: var(--assistant-panel); }
.history-panel { display: flex; flex-direction: column; padding: 30px 21px 22px; border-right: 1px solid var(--assistant-line); }
.assistant-identity { display: flex; align-items: center; gap: 14px; }
.history-close, .mobile-history-button { display: none; }
.assistant-seal { display: grid; place-items: center; width: 50px; height: 50px; flex: 0 0 50px; padding: 8px; border: 1px solid rgba(255,255,255,.22); border-radius: 13px; background: #f5f1e8; box-shadow: 0 12px 28px rgba(0,0,0,.22); }
.assistant-seal img { display: block; width: 100%; height: 100%; object-fit: contain; }
.assistant-identity p, .assistant-identity h1 { margin: 0; }
.assistant-identity p { color: var(--gold-pale); font: 600 8px var(--mono); letter-spacing: .12em; }
.assistant-identity h1 { margin-top: 1px; color: #fff; font: 700 27px/1.1 var(--serif); letter-spacing: .06em; }
.identity-note { margin: 19px 0 24px; color: #a9bdc6; font-size: 12px; line-height: 1.8; }
.new-chat-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 16px; color: #fff; border: 1px solid rgba(219, 180, 93, .65); background: rgba(219, 180, 93, .07); cursor: pointer; font-weight: 700; transition: background .2s, color .2s; }
.new-chat-button:hover { color: var(--ink); background: var(--gold); }
.new-chat-button svg, .icon-button svg, .send-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.history-section { min-height: 0; margin-top: 27px; }
.panel-label, .source-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-label h2, .panel-label span { margin: 0; color: var(--assistant-muted); font: 600 9px var(--mono); letter-spacing: .13em; text-transform: uppercase; }
.panel-label span { padding: 1px 7px; border: 1px solid rgba(255, 255, 255, .12); }
.session-list { max-height: calc(100dvh - 390px); overflow-y: auto; margin: 12px -8px 0; padding: 0 8px; list-style: none; scrollbar-color: #416171 transparent; }
.session-list li + li { margin-top: 5px; }
.session-button { width: 100%; min-height: 58px; padding: 9px 12px; color: #bbcad1; border: 1px solid transparent; background: transparent; text-align: left; cursor: pointer; }
.session-button:hover { background: rgba(255, 255, 255, .05); }
.session-button.is-active { color: #fff; border-color: rgba(219, 180, 93, .36); background: rgba(219, 180, 93, .07); }
.session-button b, .session-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-button b { font-size: 12px; font-weight: 600; }
.session-button small { margin-top: 3px; color: #718e9b; font: 500 9px var(--mono); }
.history-empty { margin: 13px 2px; color: #6e8996; font-size: 11px; }
.history-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--assistant-line); }
.history-footer a { color: var(--gold-pale); font-size: 12px; text-decoration: none; }
.history-footer p { margin: 14px 0 0; color: #708c98; font-size: 9px; line-height: 1.7; }

.conversation-panel { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr) auto; min-width: 0; background: var(--assistant-paper); color: var(--text); }
.conversation-header { display: flex; align-items: center; justify-content: space-between; min-height: 84px; padding: 14px clamp(24px, 4vw, 64px); border-bottom: 1px solid var(--line); background: rgba(245, 241, 231, .97); }
.conversation-header { grid-row: 1; }
.workspace-kicker { margin: 0 0 5px; color: var(--teal-dark); font: 600 9px var(--mono); letter-spacing: .14em; }
.conversation-header h2 { margin: 0; font: 700 27px/1.2 var(--serif); letter-spacing: -.02em; }
.conversation-tools { display: flex; align-items: center; gap: 12px; }
.connection-status { display: inline-flex; align-items: center; gap: 8px; color: #64747b; font-size: 10px; }
.connection-status i { width: 7px; height: 7px; border-radius: 50%; background: #91a0a5; box-shadow: 0 0 0 4px rgba(100, 116, 123, .1); }
.connection-status.is-ready i { background: var(--teal); box-shadow: 0 0 0 4px rgba(73, 169, 161, .13); }
.connection-status.is-error i { background: var(--red); box-shadow: 0 0 0 4px rgba(178, 74, 55, .12); }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; color: #607077; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.icon-button:hover { color: var(--red); border-color: rgba(178, 74, 55, .45); }
.mode-switcher { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); background: #eee9dd; }
.mode-switcher { grid-row: 2; }
.mode-button { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 0 12px; min-height: 72px; padding: 12px clamp(18px, 3vw, 42px); color: #5e6b70; border: 0; border-right: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; transition: color .2s ease, background .2s ease; }
.mode-button:last-child { border-right: 0; }
.mode-button::after { position: absolute; content: ""; right: 0; bottom: -1px; left: 0; height: 3px; background: transparent; }
.mode-button:hover { background: rgba(255, 255, 255, .45); }
.mode-button.is-active { color: var(--text); background: var(--assistant-paper); }
.mode-button.is-active::after { background: var(--assistant-orange); }
.mode-button > span { grid-row: 1 / 3; align-self: center; color: var(--teal-dark); font: 700 11px var(--mono); }
.mode-button b { font: 700 14px var(--serif); }
.mode-button small { color: #7b878b; font-size: 9px; }
.role-strip { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 62px; padding: 10px clamp(22px, 3vw, 48px); color: #d9e4e8; background: var(--assistant-panel-2); border-bottom: 1px solid rgba(255, 255, 255, .12); }
.role-strip { grid-row: 3; }
.role-strip[hidden] { display: none; }
.role-strip label span, .role-strip label small { display: block; }
.role-strip label span { color: var(--gold-pale); font: 700 13px var(--serif); }
.role-strip label small { color: #829ca8; font-size: 9px; }
.role-strip select { min-width: 205px; min-height: 42px; padding: 0 32px 0 12px; color: #fff; border: 1px solid rgba(219, 180, 93, .45); border-radius: 0; background: #17384b; cursor: pointer; font-size: 11px; }
.role-strip select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.message-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #b8b1a3 transparent; }
.message-scroll { grid-row: 4; }
.message-list { width: min(900px, calc(100% - 56px)); min-height: 100%; margin: 0 auto; padding: 34px 0 28px; }
.welcome-state { max-width: 760px; margin: min(5vh, 46px) auto 0; text-align: center; }
.welcome-mark { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 19px; padding: 11px; border: 1px solid #b9b1a2; border-radius: 16px; background: #fffdf7; box-shadow: 0 15px 34px rgba(7,24,39,.1); }
.welcome-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.welcome-overline { margin: 0 0 17px; color: var(--assistant-orange); font: 600 9px var(--mono); letter-spacing: .16em; }
.welcome-state h3 { margin: 0; font: 700 clamp(38px, 4.4vw, 58px)/1.15 var(--serif); letter-spacing: -.035em; }
.welcome-state > p:not(.welcome-overline) { max-width: 620px; margin: 17px auto 0; color: var(--muted); font-size: 14px; line-height: 1.9; }
.knowledge-line { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 650px; margin: 27px auto 0; border: 1px solid var(--line); background: rgba(255,255,255,.48); text-align: left; }
.knowledge-line span { min-height: 62px; padding: 13px 16px; color: #617076; border-right: 1px solid var(--line); font-size: 10px; line-height: 1.55; }
.knowledge-line span:last-child { border-right: 0; }
.knowledge-line b { display: block; color: var(--teal-dark); font: 700 14px var(--serif); }
.scope-note { display: grid; grid-template-columns: 94px 1fr; max-width: 650px; margin: 10px auto 0; border: 1px solid var(--line); border-top: 0; background: rgba(255, 255, 255, .28); text-align: left; }
.scope-note span { display: grid; place-items: center; color: var(--teal-dark); border-right: 1px solid var(--line); font: 700 9px var(--mono); letter-spacing: .09em; }
.scope-note p { margin: 0; padding: 14px 16px; color: #57666c; font-size: 11px; }
.message { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 13px; margin-bottom: 28px; }
.message-avatar { display: grid; place-items: center; width: 38px; height: 38px; padding: 7px; color: #fff; border: 1px solid #c6beaf; border-radius: 10px; background: #fffdf7; font: 700 16px var(--serif); }
.message-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }
.user-message { grid-template-columns: minmax(0, 1fr) 38px; margin-left: clamp(20px, 9vw, 100px); }
.user-message .message-avatar { grid-column: 2; grid-row: 1; padding: 0; color: var(--ink); border: 0; border-radius: 0; background: var(--gold); }
.user-message .message-content { grid-column: 1; grid-row: 1; padding: 14px 17px; background: #e4ded0; }
.message-author { display: flex; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.message-author b { font: 700 14px var(--serif); }
.message-author span { color: #849095; font: 500 8px var(--mono); letter-spacing: .07em; }
.message-text { color: #273a44; font-size: 14px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-text p { margin: 0; }
.answer-boundary { display: inline-block; margin-top: 12px; padding: 3px 8px; color: #71402b; border-left: 2px solid var(--assistant-orange); background: #eee4d7; font-size: 9px; }
.assistant-message .message-content { min-width: 0; padding: 3px 0 0; }
.source-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; margin-top: 13px; padding: 0 12px; color: var(--teal-dark); border: 1px solid rgba(31, 111, 106, .28); background: transparent; cursor: pointer; font-size: 11px; font-weight: 700; }
.source-toggle:hover { background: rgba(73, 169, 161, .08); }
.message-sources { display: grid; gap: 7px; margin-top: 9px; }
.message-sources[hidden] { display: none; }
.inline-source { padding: 10px 12px; border-left: 3px solid var(--gold); background: #ece6da; }
.inline-source b { display: block; font-size: 11px; }
.inline-source span { display: block; margin-top: 2px; color: #68767b; font-size: 10px; }
.thinking { display: flex; align-items: center; gap: 5px; min-height: 32px; color: #75858b; font-size: 11px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--teal-dark); animation: thinking 1s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: .13s; }.thinking i:nth-child(3) { animation-delay: .26s; }
.thinking span { margin-left: 6px; }
@keyframes thinking { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

.composer-wrap { padding: 0 clamp(24px, 4vw, 64px) 22px; border-top: 1px solid var(--line); background: var(--assistant-paper); box-shadow: 0 -14px 30px rgba(20, 36, 46, .035); }
.composer-wrap { grid-row: 5; }
.composer-wrap > * { width: min(900px, 100%); margin-left: auto; margin-right: auto; }
.privacy-notice { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; margin-bottom: 0; color: #7c6b61; font-size: 9px; line-height: 1.5; }
.privacy-notice svg { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: var(--assistant-orange); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.prompt-row { display: flex; gap: 7px; overflow-x: auto; margin-top: -1px; margin-bottom: 11px; padding: 12px 1px 1px; scrollbar-width: none; }
.prompt-row::-webkit-scrollbar { display: none; }
.prompt-chip { flex: 0 0 auto; min-height: 38px; max-width: 265px; padding: 7px 12px; overflow: hidden; color: #506269; border: 1px solid var(--line); background: #eee9dd; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-size: 10px; }
.prompt-chip:hover { color: var(--teal-dark); border-color: rgba(31, 111, 106, .4); background: #fffdf7; }
.composer { position: relative; display: grid; grid-template-columns: 1fr auto; min-height: 86px; border: 1px solid #bfb7a7; background: #fffdf8; box-shadow: 0 12px 30px rgba(20, 36, 46, .07); }
.composer:focus-within { border-color: var(--teal-dark); box-shadow: 0 0 0 3px rgba(73, 169, 161, .12); }
.composer textarea { width: 100%; max-height: 150px; min-height: 52px; resize: none; padding: 15px 17px 2px; color: var(--text); border: 0; outline: 0; background: transparent; font: 14px/1.65 var(--sans); }
.composer textarea::placeholder { color: #899397; }
.composer-meta { display: flex; gap: 13px; padding: 0 17px 10px; color: #8a9497; font-size: 8px; }
.send-button { align-self: stretch; display: flex; align-items: center; justify-content: center; gap: 9px; width: 91px; margin: -1px -1px -1px 0; color: #fff; border: 0; background: var(--teal-dark); cursor: pointer; font-weight: 700; }
.send-button:hover { background: #185d59; }
.send-button:disabled { cursor: wait; opacity: .55; }
.error-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 11px 0; padding: 10px 12px 10px 15px; color: #713429; border-left: 3px solid var(--red); background: #f1ded7; }
.error-banner[hidden] { display: none; }
.error-banner strong, .error-banner span { display: block; }
.error-banner strong { font-size: 11px; }.error-banner span { font-size: 10px; }
.error-banner button { min-height: 38px; padding: 0 13px; color: #fff; border: 0; background: var(--red); cursor: pointer; font-size: 10px; font-weight: 700; white-space: nowrap; }

.guide-panel { display: none; }
.guide-intro { padding-bottom: 25px; border-bottom: 1px solid var(--assistant-line); }
.guide-intro .workspace-kicker { color: var(--gold); }
.guide-intro h2 { margin: 0; color: #fff; font: 700 23px/1.35 var(--serif); }
.guide-intro > p:last-child { margin: 12px 0 0; color: #8fa8b3; font-size: 11px; }
.guide-block { padding: 23px 0; border-bottom: 1px solid var(--assistant-line); }
.guide-block h3, .source-heading h3 { margin: 0 0 12px; color: #8fa9b5; font: 600 9px var(--mono); letter-spacing: .13em; }
.mode-explanation strong { display: block; color: var(--gold-pale); font: 700 17px var(--serif); }
.mode-explanation p { margin: 6px 0 0; color: #afc0c8; font-size: 11px; }
.mode-explanation ul { margin: 13px 0 0; padding-left: 17px; color: #819aa6; font-size: 10px; }
.source-heading h3 { margin: 0; }
.source-heading span { color: #6f8a96; font-size: 9px; }
.source-placeholder { margin: 12px 0 0; color: #6f8995; font-size: 10px; }
.shelf-source { margin-top: 9px; padding: 12px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .035); }
.shelf-source b { display: block; color: #d7e2e6; font-size: 11px; line-height: 1.5; }
.shelf-source span { display: block; margin-top: 4px; color: #7893a0; font-size: 9px; }
.boundary-card { margin-top: 24px; padding: 17px; border-top: 3px solid var(--assistant-orange); background: #132f40; }
.boundary-card > span { color: var(--assistant-orange); font: 600 9px var(--mono); letter-spacing: .13em; }
.boundary-card p { margin: 11px 0; color: #a6bac3; font-size: 10px; }
.boundary-card a { color: var(--gold-pale); font-size: 10px; text-underline-offset: 4px; }

@media (max-width: 1180px) {
  .assistant-workbench { grid-template-columns: 240px minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .assistant-page { overflow: auto; }
  .assistant-workbench { display: block; width: 100%; max-width: 100vw; height: auto; min-height: calc(100dvh - 123px); overflow: hidden; }
  .history-panel { position: fixed; inset: 0 auto 0 0; z-index: 90; display: flex; width: min(320px, calc(100vw - 46px)); transform: translateX(-101%); visibility: hidden; transition: transform .24s ease, visibility .24s; box-shadow: 20px 0 55px rgba(0, 0, 0, .3); }
  .history-panel.is-open { transform: translateX(0); visibility: visible; }
  .history-close { display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; color: #c4d2d8; border: 1px solid var(--assistant-line); background: transparent; cursor: pointer; font-size: 24px; }
  .history-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(2, 14, 23, .66); }
  .history-scrim[hidden] { display: none; }
  .mobile-history-button { display: grid; }
  .conversation-panel { width: 100%; max-width: 100vw; height: calc(100dvh - 123px); min-height: 580px; overflow: hidden; }
  .conversation-header { min-height: 72px; padding: 10px 17px; }
  .conversation-header h2 { font-size: 21px; }
  .connection-status > span { display: none; }
  .mode-button, .mode-button b, .mode-button small { min-width: 0; }
  .message-list { width: min(calc(100% - 28px), 760px); padding-top: 24px; }
  .composer-wrap { padding: 0 14px 12px; }
  .role-strip { padding: 9px 14px; }
}
@media (max-width: 560px) {
  .mode-button { min-height: 63px; grid-template-columns: 1fr; gap: 0; padding: 10px 7px; text-align: center; }
  .mode-button > span { display: none; }
  .mode-button b { font-size: 12px; }
  .mode-button small { font-size: 8px; }
  .role-strip { align-items: stretch; gap: 8px; flex-direction: column; }
  .role-strip label small { display: none; }
  .role-strip select { width: 100%; min-width: 0; }
  .welcome-state { margin-top: 4vh; }
  .welcome-mark { width: 56px; height: 56px; margin-bottom: 15px; padding: 9px; }
  .welcome-state h3 { font-size: 37px; }
  .welcome-state > p:not(.welcome-overline) { font-size: 13px; }
  .knowledge-line { grid-template-columns: repeat(3, 1fr); margin-top: 22px; }
  .knowledge-line span { min-height: 64px; padding: 9px 10px; border-right: 1px solid var(--line); border-bottom: 0; }
  .knowledge-line span:last-child { border-right: 0; }
  .knowledge-line b { display: block; margin: 0; }
  .scope-note { display: none; }
  .user-message { margin-left: 12px; }
  .composer { grid-template-columns: minmax(0, 1fr) 65px; }
  .send-button { width: 66px; }
  .send-button span { display: none; }
  .composer-meta span:last-child { display: none; }
  .prompt-chip { max-width: 230px; }
}
@media (prefers-reduced-motion: reduce) {
  .thinking i { animation: none; opacity: .7; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
