/* Readable type and a quieter task layout, preserving the existing themes. */
:root {
  --ui-body: 1rem;
  --ui-control: .9375rem;
  --ui-secondary: .875rem;
  --ui-meta: .8125rem;
}
body { font-size: var(--ui-body); line-height: 1.55; }
button, input, textarea, select { font-family: inherit; }
.workspace { width: min(100% - 48px, 1600px); padding-top: 20px; }
.topbar { min-height: 64px; padding-bottom: 14px; }
.topbar-right { flex-wrap: wrap; gap: 10px; }
.workspace .brand b { font-size: 1rem; }
.brand, .skip-link { min-height: 44px; }
.brand small { font-size: var(--ui-meta); letter-spacing: .025em; }
.prime-brand-logo { display: block; width: 126px; height: 64px; padding: 4px; object-fit: contain; border-radius: 6px; background: #fff; }
html[data-theme] .login-emblem { width: 168px; height: auto; padding: 8px; border-radius: 8px; background: #fff; box-shadow: none; }
.login-emblem img { display: block; width: 100%; height: auto; }
.workspace-context, .icon-button, .language-option { font-size: var(--ui-secondary); }
.icon-button, .theme-toggle, .language-option { min-width: 44px; min-height: 44px; height: auto; }
.icon-button { padding: 8px 10px; }
.workspace-intro { display: none; }
.workspace-grid { grid-template-columns: 248px minmax(0, 1fr) 48px; gap: 16px; margin-top: 16px; height: calc(100dvh - 128px); min-height: 40rem; }
.results-expanded .workspace-grid { grid-template-columns: 248px minmax(380px, 1.4fr) minmax(300px, 1fr); }
.guide-panel, .conversation-panel, .results-panel { min-height: 0; }
.guide-panel { padding: 22px 18px; }
.guide-panel > .panel-kicker, .conversation-header .panel-kicker { display: none; }
.avatar-stage { min-height: 116px; margin: 0 0 12px; }
.avatar-stage::before { width: 104px; height: 104px; }
.avatar-stage::after { width: 116px; height: 116px; }
.guide-avatar-svg { width: 112px; }
.guide-panel h2 { font-size: 1.125rem; line-height: 1.4; letter-spacing: -.02em; }
.guide-copy { font-size: var(--ui-secondary); line-height: 1.6; margin-top: 6px; }
.guide-state { min-height: 44px; flex-wrap: wrap; padding: 8px; font-size: var(--ui-meta); }
.state-detail { max-width: 100%; white-space: normal; font-size: var(--ui-meta); }
.guide-libraries { display: grid; gap: 8px; min-height: 0; max-height: none; overflow: auto; }
#platformWorkspaceButton, #desktopWorkspaceButton {
  width: 100%; min-height: 48px; margin: 0; padding: 11px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  color: var(--ink); background: var(--panel-soft); font: inherit;
  font-size: var(--ui-secondary); line-height: 1.4; text-align: left; cursor: pointer;
}
.guide-library-disclosure, .guide-libraries > .native-crm-catalog-shell {
  min-width: 0; border: 1px solid var(--line); border-radius: 10px; margin: 0;
}
.guide-library-disclosure > summary, .guide-libraries > .native-crm-catalog-shell > summary {
  display: flex; min-height: 48px; align-items: center; gap: 9px;
  padding: 10px 12px; font-size: var(--ui-secondary); font-weight: 650; list-style: none; cursor: pointer;
}
.guide-library-disclosure > summary::-webkit-details-marker,
.guide-libraries > .native-crm-catalog-shell > summary::-webkit-details-marker { display: none; }
.guide-library-disclosure > summary::after,
.guide-libraries > .native-crm-catalog-shell > summary::after {
  width: 7px; height: 7px; flex: 0 0 auto; margin-left: auto;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  content: ""; transform: rotate(45deg);
}
.guide-library-disclosure[open] > summary::after,
.guide-libraries > .native-crm-catalog-shell[open] > summary::after { transform: rotate(225deg); }
.guide-library-disclosure > summary svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: var(--cyan); stroke-width: 1.6; stroke-linejoin: round; }
.guide-library-disclosure > :not(summary), .guide-libraries > .native-crm-catalog-shell > section { padding: 0 12px 12px; }
.guide-library-disclosure .action-library-title { display: none; }
.library-label-en { display: none; }
html[lang="en"] .library-label-tr { display: none; }
html[lang="en"] .library-label-en { display: inline; }
.question-library-hint, .library-question, .question-category summary,
.native-crm-catalog button, .native-crm-catalog summary, .native-crm-catalog__hint,
.native-crm-catalog__status { font-size: var(--ui-secondary); }
.question-category summary, .library-question, .native-crm-catalog button { min-height: 44px; }
.question-category-items { padding-left: 0; max-height: 360px; }
.question-category-count, .action-library .action-library-mode { font-size: var(--ui-meta); }
.provider-note, .knowledge-note { font-size: var(--ui-meta); line-height: 1.6; }
.conversation-panel { padding: 26px 28px 22px; }
.conversation-header { flex-wrap: wrap; row-gap: 10px; padding-bottom: 20px; }
.conversation-header h2 { margin: 0; font-size: 1.5rem; line-height: 1.35; letter-spacing: -.025em; }
.quiet-toggle { min-height: 44px; padding: 8px; font-size: var(--ui-secondary); }
.message-list { min-height: 160px; max-height: none; padding: 24px 0; gap: 24px; }
.welcome-message, .chat-message { max-width: 100%; gap: 12px; }
.message-content { max-width: 72ch; }
.message-content p, .analysis-text p, .analysis-text ul, .analysis-text ol,
.answer-details-content, .knowledge-document-text { font-size: var(--ui-body); line-height: 1.65; }
.message-avatar-mark { width: 32px; height: 32px; font-size: var(--ui-secondary); }
.chat-message.assistant .message-content { padding: 2px 0; border: 0; background: transparent; border-radius: 0; }
.message-time { font-size: var(--ui-meta); }
.analysis-text h3, .analysis-text h4 { font-size: 1.125rem; }
.suggestion-heading, .role-picker label { font-size: var(--ui-secondary); }
.suggestion-list { gap: 8px; }
.suggestion-chip { min-height: 44px; max-width: 100%; padding: 10px 13px; font-size: var(--ui-secondary); line-height: 1.45; }
.role-picker { margin: 2px 0 14px; gap: 12px; }
.role-picker select, .mic-device-control select { min-height: 44px; font-size: var(--ui-secondary); }
.composer { min-height: 88px; padding: 12px 12px 12px 18px; gap: 12px; }
.composer textarea { min-width: 0; min-height: 4rem; max-height: 8rem; padding: 8px 0; font-size: var(--ui-body); line-height: 1.55; }
.send-button { width: 48px; height: 48px; }
.send-button svg { width: 22px; }
.conversation-controls { flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.voice-controls { gap: 8px; }
.control-button, .interrupt-button { min-height: 44px; padding: 10px 12px; font-size: var(--ui-secondary); }
html[data-theme] .conversation-controls .control-connect { color: var(--night-deep); background: var(--cyan); border-color: var(--cyan); }
html[data-theme] .conversation-controls .control-connect:disabled { color: var(--muted); background: var(--panel-soft); border-color: var(--line); opacity: 1; }
#micButton:disabled, #muteButton:disabled, #interruptButton:disabled { display: none; }
.privacy-note, .mic-device-control label, .chat-error, .action-notice { font-size: var(--ui-secondary); line-height: 1.55; }
.results-heading, .results-panel h2, .results-panel h3 { font-size: 1.125rem; }
.results-message, .result-name, .result-meta, .source-document-button, .sources-section ul,
.warnings-section ul, .action-button, .export-button, .summary-table, .result-count,
.answer-details-content table, .lead-field dt, .lead-field dd { font-size: var(--ui-secondary); }
.result-row { padding: 14px; }
.results-summary, .action-button, .export-button, .source-document-button { min-height: 44px; }
.overview-label, .facet-chip, .facets-hint, .workspace-footer, .workspace-footer span:last-child { font-size: var(--ui-meta); }
.workspace-footer { display: none; }
.settings-field input, .settings-field select { min-height: 44px; font-size: var(--ui-body); }
.settings-field label, .settings-check, .settings-dialog legend, .settings-note, .settings-account,
.settings-preview, .settings-status { font-size: var(--ui-secondary); }
.settings-check { min-height: 44px; }
.settings-check input { width: 24px; height: 24px; }
.settings-save, .settings-cancel, .settings-close { min-width: 44px; min-height: 44px; }
.settings-range-field input { min-height: 44px; }
.native-crm-table, .native-crm-note, .native-crm-status, .native-crm-link,
.native-crm-card dt, .native-crm-card dd, .crm-operation__post-meta { font-size: var(--ui-secondary); }
.native-crm-title, .crm-operation__title { font-size: 1.125rem; }
.native-crm-button, .native-crm-catalog__search, .desktop-control-button, .desktop-launch-button,
.workspace-mode-tab, .platform-workspace__select, .platform-workspace__close, .platform-workspace__open { min-height: 44px; font-size: var(--ui-secondary); }
.desktop-session-meta, .desktop-account, .desktop-session-message { font-size: var(--ui-secondary); }
html[data-theme] :is(.message-time, .state-detail, .knowledge-note) { color: var(--muted); }
html[data-theme] .composer textarea::placeholder { color: var(--muted); }
/* Task-first composition: optional choices stay close to the message box. */
.conversation-bottom { position: relative; flex: 0 0 auto; padding-top: 12px; border-top: 1px solid var(--line); }
.conversation-examples { position: relative; margin-bottom: 8px; }
.conversation-examples > summary, .voice-settings > summary {
  display: inline-flex; min-height: 44px; min-width: 44px; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid transparent; border-radius: 8px;
  color: var(--muted); font-size: var(--ui-secondary); font-weight: 600; list-style: none; cursor: pointer;
}
.conversation-examples > summary::-webkit-details-marker, .voice-settings > summary::-webkit-details-marker { display: none; }
.conversation-examples > summary:hover, .voice-settings > summary:hover { color: var(--ink); background: var(--panel-soft); }
.conversation-examples > summary svg, .voice-settings > summary svg, .tools-toggle svg, .tools-close svg {
  width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.conversation-examples[open] .menu-chevron { transform: rotate(180deg); }
.conversation-menu-content {
  position: absolute; z-index: 25; bottom: calc(100% + 8px); left: 0; width: 100%; max-height: 300px;
  overflow: auto; padding: 16px; border: 1px solid var(--line-strong); border-radius: 12px;
  color: var(--ink); background: var(--night); box-shadow: 0 12px 32px rgba(0, 0, 0, .12);
}
html[data-theme="light"] .conversation-menu-content { background: #fff; }
.conversation-examples .suggestions { display: block; padding-bottom: 16px; }
.conversation-examples .role-picker { display: flex; margin: 0; justify-content: space-between; }
.conversation-controls { justify-content: flex-start; align-items: center; }
.voice-controls { min-width: 0; flex: 1 1 auto; align-items: center; }
.voice-settings { position: relative; flex: 0 0 auto; }
.voice-settings-content { right: 0; left: auto; width: min(320px, calc(100vw - 56px)); }
.voice-settings-content .quiet-toggle { width: 100%; justify-content: flex-start; max-width: none; }
.voice-settings-content .control-button { display: flex; width: 100%; justify-content: flex-start; margin-top: 4px; }
.voice-settings-content :is(#micButton, #muteButton):disabled { display: none; }
.voice-settings-content .mic-device-control:not([hidden]) { display: grid; grid-template-columns: 1fr; }
.privacy-note { margin-top: 10px; font-size: var(--ui-meta); }
.tools-toggle, .tools-close {
  display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); background: var(--panel-soft); font: inherit; font-size: var(--ui-secondary); cursor: pointer;
}
.tools-toggle[hidden], .tools-close { display: none; }
.tools-toggle:hover, .tools-close:hover { border-color: var(--line-strong); }
.conversation-examples > summary:focus-visible, .voice-settings > summary:focus-visible,
.tools-toggle:focus-visible, .tools-close:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.guide-panel { min-width: 0; overflow: hidden; }
.guide-panel .provider-note { flex-shrink: 0; }
.guide-rail-mark { display: none !important; }
.desktop-active.workspace { width: min(100% - 32px, 1920px); padding-top: 12px; }
.desktop-active.workspace .workspace-grid {
  display: grid; grid-template-columns: minmax(400px, .85fr) minmax(0, 1.6fr);
  height: calc(100dvh - 112px); min-height: 40rem; gap: 16px;
}
.desktop-active.workspace .guide-panel { display: none; }
.desktop-active.workspace .conversation-panel { padding: 22px; min-height: 0; max-height: none; }
.desktop-active.workspace .conversation-header { padding-bottom: 16px; }
.desktop-active.workspace .conversation-header h2 { font-size: 1.25rem; }
.desktop-active.workspace .message-list { min-height: 160px; max-height: none; padding: 20px 0; }
.desktop-active.workspace .results-panel { padding: 16px; min-height: 0; }
.desktop-active.workspace .desktop-workspace-header { flex-wrap: wrap; gap: 12px; }
.desktop-active.workspace .desktop-workspace-controls { justify-content: flex-start; }
.desktop-workspace-heading > .panel-kicker { display: none; }
.desktop-active.workspace .desktop-screen { min-height: 280px; }
.desktop-active.workspace .desktop-quick-stop:not([hidden]) { display: inline-flex; }
.desktop-active.workspace .privacy-note { display: flex; }
.desktop-active.workspace .conversation-examples .suggestions { display: block; }
.desktop-active.workspace .conversation-examples .role-picker { display: flex; }
.workspace.tools-open .guide-panel {
  position: fixed; z-index: 45; left: 16px; top: 88px; bottom: 16px; width: min(296px, calc(100vw - 32px));
  display: flex; flex-direction: column; align-items: stretch; padding: 22px 18px; height: auto;
  max-height: calc(100dvh - 104px); overflow: auto; box-shadow: 0 16px 48px rgba(0, 0, 0, .18);
}
#workspace.desktop-active.tools-open #guidePanel > :not(.guide-rail-mark):not(.panel-kicker):not([hidden]) { display: block !important; }
#workspace.tools-open #guidePanel .tools-close { display: inline-flex !important; align-self: flex-end; margin: -6px -4px 4px 0; }
#workspace.desktop-active.tools-open #guidePanel .guide-libraries { display: grid !important; overflow: visible; }
#workspace.desktop-active.tools-open #guidePanel .avatar-stage { display: grid !important; }
#workspace.desktop-active.tools-open #guidePanel .guide-state, #workspace.desktop-active.tools-open #guidePanel .provider-note { display: flex !important; }
@media (max-width: 1100px) and (min-width: 721px) {
  .workspace { width: calc(100% - 32px); }
  .workspace-grid, .results-expanded .workspace-grid { grid-template-columns: minmax(0, 1fr) 48px; gap: 14px; }
  .workspace:not(.tools-open) .guide-panel { display: none; }
  .conversation-panel { padding: 22px 20px; }
  .results-expanded .results-panel { width: min(440px, 75%); }
}
@media (max-width: 1000px) {
  .desktop-active.workspace .workspace-grid { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .desktop-active.workspace .conversation-panel { order: 0; min-height: 36rem; height: 36rem; }
  .desktop-active.workspace .results-panel { order: 1; min-height: 600px; height: 75dvh; overflow: visible; }
  .desktop-active.workspace .results-panel .desktop-screen { min-height: 320px; }
}
@media (max-width: 720px) {
  .login-top { flex-wrap: wrap; align-items: center; gap: 12px; }
  .login-top-tools { margin-left: auto; }
  .workspace { width: calc(100% - 24px); padding-top: 12px; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar-right { margin-left: auto; gap: 4px; }
  .topbar .language-option { min-width: 44px; min-height: 44px; }
  .topbar .brand b { font-size: 1rem; }
  .topbar .brand small { font-size: var(--ui-meta); }
  .prime-brand-logo { width: 104px; height: 54px; }
  .workspace-grid { gap: 16px; margin-top: 16px; height: auto; min-height: 0; }
  .workspace:not(.tools-open) .guide-panel { display: none; }
  .conversation-panel { order: 0; height: max(36rem, calc(100dvh - 200px)); min-height: 36rem; padding: 20px 18px 18px; }
  .desktop-active.workspace .conversation-panel { min-height: 40rem; height: 40rem; }
  .guide-panel { order: 1; min-height: 0; grid-template-columns: 84px minmax(0, 1fr); padding: 18px; }
  .results-panel { order: 2; min-height: 0; }
  .avatar-stage { grid-column: 1; grid-row: 1 / span 2; min-height: 100px; margin: 0; }
  .avatar-stage::before { width: 80px; height: 80px; }
  .avatar-stage::after { width: 88px; height: 88px; }
  .guide-avatar-svg { width: 88px; }
  .guide-panel h2 { grid-column: 2; align-self: end; margin: 0 0 4px; font-size: 1.125rem; }
  .guide-copy { grid-column: 2; margin: 0; max-width: none; }
  .guide-libraries, .guide-state, .knowledge-note { grid-column: 1 / -1; }
  .guide-state { margin: 16px 0 12px; }
  .conversation-header h2 { font-size: 1.375rem; }
  .conversation-header { align-items: flex-start; flex-wrap: nowrap; }
  .tools-toggle { flex: 0 0 auto; padding: 10px; }
  .tools-toggle > .library-label-tr { display: inline; }
  html[lang="en"] .tools-toggle > .library-label-tr { display: none; }
  .tools-toggle::after { content: none; }
  .quiet-toggle { max-width: none; font-size: var(--ui-secondary); }
  .message-list { min-height: 160px; max-height: none; padding: 20px 0; }
  .message-content { max-width: 100%; }
  .chat-message.assistant .message-content { padding: 2px 0; }
  .suggestion-chip { width: 100%; }
  .role-picker { flex-wrap: wrap; justify-content: space-between; }
  .composer { padding-left: 12px; }
  .composer textarea { min-height: 4.5rem; padding-top: 8px; padding-bottom: 8px; }
  .voice-controls { flex-wrap: wrap; gap: 6px; }
  .control-button, .interrupt-button { padding: 10px; font-size: var(--ui-secondary); }
  .voice-controls { gap: 4px; }
  .voice-settings > summary { padding: 8px; }
  .conversation-controls { flex-wrap: wrap; gap: 4px; }
  .conversation-panel:has(#conversationExamples[open]) { height: auto; }
  .conversation-panel:has(#conversationExamples[open]) .message-list { flex: 0 0 160px; min-height: 160px; max-height: 160px; }
  .conversation-examples .conversation-menu-content { position: static; margin: 8px 0 12px; max-height: 240px; box-shadow: none; }
  .workspace.tools-open .guide-panel { top: 16px; max-height: calc(100dvh - 32px); }
  .workspace-footer { flex-wrap: wrap; gap: 6px; }
  .workspace-mode-tabs { flex-wrap: wrap; overflow: visible; }
  .settings-dialog { padding: 18px; }
  .settings-field select { width: 100%; }
  .settings-check { position: relative; padding-left: 44px; }
  .settings-check input { position: absolute; left: 0; width: 44px; height: 44px; margin: 0; }
  .answer-markdown a, .native-crm-link, .platform-workspace__new-tab { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; }
}
