.assistant-workspace { height: 100%; }
.assistant-workspace [hidden] { display: none !important; }
.assistant-workspace .chat-layout { grid-template-columns: minmax(240px, 290px) minmax(0, 1fr); }
.assistant-workspace .chat-list { gap: 14px; padding: 20px 14px 14px; overflow: hidden; }
.chat-history-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; font-size: 15px; font-weight: 650; color: var(--text-primary); }
.chat-history-close { display: none; }
.chat-search { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 12px; border: 1px solid var(--border-glass); border-radius: 13px; background: var(--control-bg); color: var(--text-tertiary); }
.chat-search:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--focus-ring); }
.chat-search input { min-width: 0; width: 100%; border: 0; outline: none; background: transparent; color: var(--text-primary); font: inherit; font-size: 12px; }
.chat-search input::placeholder { color: var(--text-tertiary); }
.chat-history-tabs { display: flex; padding: 4px; gap: 4px; border: 1px solid var(--border-glass); border-radius: 13px; background: var(--control-bg); }
.chat-history-tabs button { flex: 1; display: flex; justify-content: center; align-items: center; gap: 6px; min-height: 34px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text-secondary); font: inherit; font-size: 12px; cursor: pointer; transition: background .24s ease, color .24s ease, border-color .24s ease; }
.chat-history-tabs button svg { width: 15px; height: 15px; }
.chat-history-tabs button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-border); color: var(--color-gold); }
.chat-history-items { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 5px; }
.assistant-workspace .chat-list-item { width: 100%; flex: none; display: block; padding: 13px 12px; text-align: left; font: inherit; color: var(--text-primary); background: transparent; border-radius: 14px; transition: background .24s ease, border-color .24s ease, transform .24s cubic-bezier(.2,.7,.3,1); }
.assistant-workspace .chat-list-item:hover { background: var(--surface-hover); transform: translateX(2px); }
.assistant-workspace .chat-list-item.active { background: var(--accent-soft); border-color: var(--accent-border); }
.chat-item-heading { display: flex; align-items: baseline; gap: 12px; }
.chat-item-heading .chat-title { flex: 1; min-width: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.5; }
.chat-item-heading time { flex: none; color: var(--text-tertiary); font-size: 10px; }
.assistant-workspace .chat-preview { display: block; font-size: 11px; }
.chat-history-empty { padding: 16px 10px; color: var(--text-tertiary); line-height: 1.65; font-size: 12px; }
.chat-history-refresh { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; border: 0; border-top: 1px solid var(--divider); background: transparent; color: var(--text-tertiary); font: inherit; font-size: 11px; cursor: pointer; }
.chat-history-refresh svg { width: 15px; height: 15px; }
.chat-history-refresh:hover { color: var(--color-gold); }
.chat-conversation-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: none; padding: 18px 22px; border-bottom: 1px solid var(--divider); }
.chat-conversation-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-conversation-title > span { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--accent-soft); color: var(--color-gold); border: 1px solid var(--accent-border); }
.chat-conversation-title > div { min-width: 0; }
.chat-conversation-title h2 { font-size: 15px; line-height: 1.4; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-conversation-title p { margin: 4px 0 0; color: var(--text-tertiary); font-size: 11px; line-height: 1.45; }
.chat-conversation-actions { flex: none; display: flex; gap: 6px; }
.chat-action-button, .chat-voice-btn, .chat-history-close { width: 38px; height: 38px; display: grid; place-items: center; flex: none; padding: 0; border: 1px solid var(--border-glass); background: var(--control-bg); color: var(--text-secondary); border-radius: 12px; cursor: pointer; transition: background .25s ease, color .25s ease, transform .25s cubic-bezier(.2,.7,.3,1); }
.chat-history-close { display: none; }
.chat-action-button:hover, .chat-voice-btn:hover { background: var(--accent-soft); color: var(--color-gold); transform: translateY(-2px); }
.chat-action-delete:hover { color: var(--color-danger, #d69b84); }
.chat-voice-btn { width: 46px; height: 46px; border-radius: 50%; }
.chat-voice-btn[aria-pressed="true"] { color: var(--color-gold); border-color: var(--accent-border); background: var(--accent-soft); animation: assistant-voice-pulse 1.6s ease-in-out infinite; }
.chat-voice-status { padding: 0 20px 12px; color: var(--text-secondary); font-size: 11px; line-height: 1.5; }
.chat-voice-status:empty { display: none; }
.assistant-workspace button:disabled { opacity: .46; cursor: default; transform: none; }
.assistant-workspace textarea:disabled { opacity: .7; }
.assistant-workspace button:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 3px; }
.assistant-workspace .empty-state { max-width: 420px; align-self: center; margin: auto; padding: 36px 20px; line-height: 1.65; }
.assistant-empty-icon { display: grid; place-items: center; width: 70px; height: 70px; margin: 0 auto 20px; border: 1px solid var(--accent-border); border-radius: 23px; color: var(--color-gold); background: var(--accent-soft); box-shadow: 0 12px 40px rgba(0,0,0,.07); }
.assistant-workspace .empty-state strong { display: block; color: var(--text-primary); font-size: 23px; font-weight: 550; letter-spacing: -.02em; }
.assistant-workspace .empty-state p { color: var(--text-tertiary); font-size: 13px; margin: 10px 0 0; }
.chat-history-notice, .chat-history-error, .chat-archived-notice, .chat-unsaved-notice { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: var(--text-secondary); font-size: 12px; line-height: 1.6; border-bottom: 1px solid var(--divider); background: var(--accent-soft); }
.chat-history-notice span, .chat-archived-notice span, .chat-unsaved-notice span { flex: 1; }
.chat-history-error { color: var(--text-primary); background: color-mix(in srgb, #b96d4c 12%, var(--surface-1)); }
.chat-history-error button, .chat-history-notice button, .chat-archived-notice button { flex: none; }
.chat-archived-notice { border-top: 1px solid var(--divider); border-bottom: 0; }
.chat-archived-notice > svg { flex: none; color: var(--color-gold); }
.chat-unsaved-notice { align-self: flex-start; max-width: 90%; border: 1px solid var(--accent-border); border-radius: 14px; }
.chat-confirmation { margin: 14px 18px; padding: 18px; flex: none; border: 1px solid var(--accent-border); border-radius: 18px; background: var(--surface-2); color: var(--text-primary); animation: assistant-panel-enter .25s cubic-bezier(.2,.7,.3,1) both; }
.chat-confirmation strong { font-size: 14px; }
.chat-confirmation p { margin: 8px 0 14px; font-size: 12px; line-height: 1.6; color: var(--text-secondary); }
.chat-confirmation > div { display: flex; justify-content: flex-end; gap: 8px; }
.assistant-sources { margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--divider); font-size: 11px; line-height: 1.5; }
.assistant-sources-heading { display: flex; align-items: center; gap: 5px; margin-bottom: 7px; color: var(--text-tertiary); font-size: 10px; letter-spacing: .015em; }
.assistant-sources-heading svg { opacity: .65; flex: none; }
.assistant-source-previews { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.assistant-source-preview { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: min(100%, 340px); padding: 5px 8px; border: 1px solid var(--border-glass); border-radius: 9px; color: var(--text-secondary); background: var(--control-bg); text-decoration: none; transition: color .2s ease, border-color .2s ease, background .2s ease; }
a.assistant-source-preview:hover { color: var(--color-gold); border-color: var(--accent-border); background: var(--accent-soft); }
.assistant-source-symbol { display: flex; align-items: center; flex: none; color: var(--color-gold); opacity: .8; }
.assistant-source-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assistant-source-count { flex: none; padding-left: 5px; border-left: 1px solid var(--divider); color: var(--text-tertiary); font-size: 9px; }
.assistant-source-static { background: transparent; }
.assistant-sources-details { margin-top: 7px; }
.assistant-sources-details > summary { width: fit-content; display: flex; align-items: center; gap: 4px; padding: 3px 0; color: var(--text-tertiary); cursor: pointer; list-style: none; font-size: 10px; transition: color .2s ease; }
.assistant-sources-details > summary::-webkit-details-marker { display: none; }
.assistant-sources-details > summary:hover { color: var(--color-gold); }
.assistant-sources-details > summary > svg { transform: rotate(90deg); transition: transform .24s ease; }
.assistant-sources-collapse { display: none; }
.assistant-sources-details[open] > summary > svg { transform: rotate(-90deg); }
.assistant-sources-details[open] .assistant-sources-expand { display: none; }
.assistant-sources-details[open] .assistant-sources-collapse { display: inline; }
.assistant-source-list { display: flex; flex-direction: column; gap: 10px; margin: 9px 0 0; padding: 0 0 0 10px; list-style: none; border-left: 1px solid var(--accent-border); }
.assistant-sources-details[open] .assistant-source-list { animation: assistant-panel-enter .22s ease both; }
.assistant-source-row { margin: 0; padding: 0; min-width: 0; }
.assistant-source-full-title { color: var(--text-secondary); font-size: 11px; font-weight: 550; text-decoration: none; }
a.assistant-source-full-title:hover, .assistant-source-external:hover { color: var(--color-gold); text-decoration: underline; text-underline-offset: 3px; }
.assistant-source-record { margin-top: 3px; display: flex; flex-direction: column; gap: 2px; }
.assistant-source-record + .assistant-source-record { margin-top: 8px; }
.assistant-source-record-title { color: var(--text-secondary); font-size: 11px; }
.assistant-source-kind { color: var(--text-tertiary); font-size: 9px; }
.assistant-source-detail, .assistant-source-alias { display: block; color: var(--text-tertiary); font-size: 10px; line-height: 1.55; white-space: pre-line; }
.assistant-source-links { display: flex; flex-wrap: wrap; gap: 10px; }
.assistant-source-external { color: var(--color-gold); text-decoration: none; font-size: 10px; }
.assistant-sources a:focus-visible, .assistant-sources summary:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 3px; border-radius: 4px; }
@keyframes assistant-panel-enter { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
@keyframes assistant-voice-pulse { 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }
@media (max-width: 1100px) { .assistant-workspace .chat-layout { grid-template-columns: 240px minmax(0, 1fr); } .chat-conversation-header { padding: 16px; } }
@media (max-width: 720px) {
  .assistant-workspace .chat-layout { grid-template-columns: minmax(0, 1fr); position: relative; }
  .assistant-workspace .chat-list { display: none; }
  .assistant-workspace .is-history-open .chat-list { position: absolute; display: flex; inset: 0; z-index: 5; background: var(--surface-1); border-radius: var(--radius-lg); animation: assistant-panel-enter .25s ease both; }
  .assistant-workspace .is-history-open .chat-window { visibility: hidden; }
  .chat-history-close { display: grid; }
  .chat-conversation-header { padding: 12px; gap: 8px; }
  .chat-conversation-title { gap: 8px; }
  .chat-conversation-title > span { width: 34px; height: 34px; border-radius: 11px; }
  .chat-conversation-title h2 { font-size: 13px; }
  .chat-conversation-title p { font-size: 10px; }
  .chat-conversation-actions { gap: 4px; }
  .chat-action-button { width: 34px; height: 34px; }
  .assistant-workspace .chat-input-row { gap: 7px; padding: 12px; flex-wrap: wrap; }
  .assistant-workspace .chat-input-row textarea { order: 0; flex-basis: calc(100% - 100px); padding: 12px; }
  .assistant-workspace .chat-attach-btn { order: 1; }
  .assistant-workspace .chat-voice-btn { order: 2; }
  .assistant-workspace #chat-send-btn { order: 3; flex: 1; }
  .chat-history-notice, .chat-history-error, .chat-archived-notice, .chat-unsaved-notice { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .chat-confirmation { margin: 10px; padding: 14px; }
  .assistant-workspace .empty-state { padding: 22px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .assistant-workspace *, .assistant-workspace *::before, .assistant-workspace *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .assistant-workspace .chat-list-item:hover, .chat-action-button:hover, .chat-voice-btn:hover { transform: none; }
}
