/* Statische Attribute aus den Originaldialogen, für die Content Security Policy ausgelagert. */
#newRoleDescription { resize: vertical; }
#newRolePrompt { resize: vertical; }
#newRoleIcon { font-size: 24px; text-align: center; width: 60px; }
.save-role { width: 100%; padding: 10px; margin-top: 10px; }
#systemPrompt { resize: vertical; width: 100%; min-height: 100px; }
.save-prompt { width: 100%; padding: 10px; margin-top: 10px; margin-bottom: 20px; }
.settings-divider { border-color: #e5e7eb; margin: 20px 0; }
#userBubbleColorStart { width: 100%; height: 40px; margin-bottom: 10px; }
#userBubbleColorEnd { width: 100%; height: 40px; margin-bottom: 10px; }
#userTextColor { width: 100%; height: 40px; margin-bottom: 10px; }

/* Native Dialoge verwenden die Maße und Hintergründe der ursprünglichen Fenster. */
dialog { margin: 0; padding: 0; color: inherit; font: inherit; }
dialog.modal[open] { display: flex !important; min-width: min(400px, 90vw); }
dialog.modal::backdrop { background: rgb(0 0 0 / 30%); backdrop-filter: blur(5px); }
dialog:is(.auth-modal, .admin-dashboard, .billing-modal) { border: 0; max-width: none; max-height: none; }
dialog:is(.auth-modal, .admin-dashboard, .billing-modal)[open] { display: flex !important; align-items: safe center; justify-content: center; }
dialog:is(.auth-modal, .admin-dashboard, .billing-modal)::backdrop { background: transparent; }
button.authenticated-only:not([hidden]), .settings-dropdown-menu .admin-only:not([hidden]) { display: flex; }
[hidden], #loginStatusIndicator[hidden] { display: none !important; }
#loginStatusRole { font-size: 10px; opacity: .8; }
#question-form { margin: 0; }
#settingsDropdown, #kiSelectionDropdown { max-height: calc(100dvh - 110px); overflow-y: auto; }
#kiSelectionDropdown { max-height: min(400px, calc(100dvh - 100px)); }
#chat-mode { display: block; width: 100%; margin-top: 5px; padding: 6px 8px; border: 1px solid #ddd; border-radius: 6px; background: white; color: #1f2937; font: inherit; }
#chat-mode-hint { max-width: 250px; padding: 6px 0 10px; }
.ki-group { margin-bottom: 10px; }
.ki-group-title { font-weight: 600; color: #374151; font-size: 13px; margin-bottom: 5px; }
.menu-note { padding: 10px; font-size: 13px; color: #6b7280; }
.ki-role-suggestions.visible, .ki-role-clear.visible { display: block; }
.chat-header.targeted { outline: 3px solid #f59e0b; box-shadow: 0 0 0 3px rgb(245 158 11 / 25%); }
.model-colors .chat-header, .model-colors .message-wrapper.assistant .message-bubble, .message-wrapper.assistant.model-colors .message-bubble {
  background: linear-gradient(135deg, var(--model-start), var(--model-end));
  color: var(--model-color);
}
.model-colors .chat-header :is(.chat-title, .chat-subtitle, .window-close-btn) { color: inherit; text-shadow: none; }
.model-colors .window-close-btn { border-color: currentColor; }
.model-colors .message-wrapper.assistant .message-bubble::after, .assistant.model-colors .message-bubble::after { border-right-color: var(--model-start); }
.model-colors .assistant .token-info, .assistant.model-colors .token-info { opacity: 1; }
.model-colors .assistant .token-info span, .assistant.model-colors .token-info span { color: inherit; }
.model-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.model-list-item .model-alias { width: 140px; padding: 4px 6px; border: 1px solid #ddd; border-radius: 6px; }
#file-excerpt, #systemPrompt { width: 100%; }
#files-dialog h4:not(:first-child) { margin-top: 18px; }
#setup-dialog hr, .modal-content hr { margin: 20px 0; border-color: #e5e7eb; }
.full-button { width: 100%; padding: 10px; }
.link-button { border: 0; background: none; color: #667eea; cursor: pointer; font: inherit; }
.modal-content .form-stack, .billing-body .form-stack, .admin-body .form-stack { display: grid; gap: 10px; }
.form-stack label { display: block; }
.form-stack :is(input, select, textarea):not([type=checkbox]) {
  display: block; width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 6px; font: inherit;
}
.modal-content :is(.primary, .secondary, .text-button), .admin-content :is(.primary, .secondary),
.billing-content :is(.primary, .secondary) { background: #f3f4f6; border: 1px solid #e5e7eb; padding: 8px 12px; border-radius: 6px; color: #374151; cursor: pointer; }
.modal-content h4, .modal-content p, .admin-body p, .billing-body p { margin-bottom: 8px; }
.modal-header, .admin-header, .billing-header { flex-shrink: 0; }
.admin-nav-item { font-family: inherit; }
.admin-body .stat-card :is(strong, small), .admin-body td small, .session-row small { display: block; }
#admin-stats { margin-bottom: 14px; }
.admin-body .operation-row, .session-row, .audit-event { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid #e5e7eb; }
.admin-body .table-scroll { overflow-x: auto; }
.admin-body table { width: 100%; text-align: left; border-collapse: collapse; }
.admin-body th, .admin-body td { padding: 8px; border-bottom: 1px solid #e5e7eb; }
.admin-body .panel, #security-dialog .panel { margin-bottom: 16px; }
#security-dialog .plain-list { padding-left: 20px; }
#security-dialog { width: min(920px, 94vw); }
#security-dialog .setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
#security-dialog .panel { min-width: 0; padding: 16px; margin: 0; border: 1px solid #e5e7eb; border-radius: 12px; align-content: start; }
#security-dialog .button-row { flex-wrap: wrap; justify-content: flex-start; }
#security-dialog .form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.user-actions { display: flex; gap: 6px; }
.user-action { min-width: 36px; min-height: 36px; font-size: 16px; }
@media (max-width: 760px) {
  #security-dialog .setup-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 440px) {
  #security-dialog .form-row { grid-template-columns: minmax(0, 1fr); }
}
#history-list, #suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; }
#history-list button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#run-state, #attachment-preview { font-size: 13px; margin-bottom: 6px; }
#run-state button, #attachment-preview button { margin-left: 8px; }
#notice { position: fixed; inset: auto 20px 18px auto; margin: 0; max-width: min(440px,90vw); padding: 12px 18px; background: #374151; color: white; border: 0; border-radius: 10px; box-shadow: 0 4px 15px #0002; font: inherit; z-index: 12000; pointer-events: none; }
#mfa-qr { width: 180px; display: block; }
#mfa-enrollment input, #dialog-content pre { max-width: 100%; overflow-wrap: anywhere; white-space: pre-wrap; }
.message-content { overflow-wrap: anywhere; font-size: var(--message-font-size, 14px); }
.message-content pre { white-space: pre; overflow-x: auto; }
.message-content ul, .message-content ol { padding-left: 1.4em; }
.message-content table { border-collapse: collapse; }
.message-content th, .message-content td { border: 1px solid #ddd; padding: 4px; }
.message-wrapper.user .message-bubble { color: var(--user-text-color, white); }
.message-content .code-content pre { flex: 1; }
.chat-messages.show-line-numbers { counter-reset: message; }
.chat-messages.show-line-numbers .message-wrapper { counter-increment: message; position: relative; }
.chat-messages.show-line-numbers .message-wrapper::before { content: counter(message); position: absolute; left: -38px; color: #6b7280; font: 12px monospace; }
/* Druck und PDF im Look des Chatfensters */
@page { size: A4; margin: 14mm 12mm 16mm; }
@page {
  @bottom-left { content: "askanyai.com"; font: 8pt system-ui, sans-serif; color: #6b7280; }
  @bottom-right { content: "Seite " counter(page) " von " counter(pages); font: 8pt system-ui, sans-serif; color: #6b7280; }
}
@media print {
  html, body { background: white !important; margin: 0; padding: 0; height: auto; overflow: visible; }
  body > :not(#print-chat) { display: none !important; }
  #print-chat[hidden] { display: block !important; }
  #print-chat { color: #1f2937; font: 10.5pt/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-chat * { animation: none !important; transition: none !important; resize: none !important; }
  .print-head { padding-bottom: 4mm; margin-bottom: 6mm; border-bottom: 2px solid #8b5cf6; }
  .print-brand { font: 600 8.5pt system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #6366f1; margin-bottom: 1.5mm; }
  .print-head h1 { font-size: 17pt; line-height: 1.25; margin: 0 0 2mm; color: #312e81; letter-spacing: -.01em; }
  .print-meta { margin: 0; font-size: 8.5pt; color: #6b7280; }
  .print-messages { display: flex; flex-direction: column; gap: 5mm; }
  .print-message.message-wrapper { display: flex; width: 100%; }
  .print-message .message-bubble { max-width: 90%; min-width: 0; box-shadow: none; resize: none; overflow: visible; padding: 3.5mm 4.5mm;
    border-radius: 12px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
  .print-message.user .message-bubble { max-width: 82%; border-bottom-right-radius: 4px; }
  .print-message .message-bubble::after { display: none; }
  .print-message .message-header { break-after: avoid; font-size: 8pt; opacity: .9; }
  .print-message .message-content { font-size: 10pt; }
  .print-message .token-info { font-size: 7.5pt; margin: 0 0 2mm; break-after: avoid; }
  #print-chat :is(h1, h2, h3, h4, h5) { break-after: avoid; }
  .print-message .message-content :is(h1, h2, h3) { margin: 3mm 0 1.5mm; line-height: 1.3; }
  .print-message .message-content h1 { font-size: 14pt; } .print-message .message-content h2 { font-size: 12.5pt; } .print-message .message-content h3 { font-size: 11pt; }
  #print-chat :is(table, figure, .code-block, blockquote, .truncated-note) { break-inside: avoid; }
  #print-chat .table-wrap { overflow: visible; }
  #print-chat table { width: 100%; border-collapse: collapse; font-size: 9pt; margin: 2mm 0; background: rgb(255 255 255 / 70%); }
  #print-chat :is(th, td) { border: 1px solid #d1d5db; padding: 1.5mm 2mm; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
  #print-chat th { background: #eef2ff; color: #312e81; }
  #print-chat .code-block { border-radius: 8px; overflow: hidden; margin: 2mm 0; }
  #print-chat .code-content, #print-chat pre { overflow: visible; }
  #print-chat pre, #print-chat code { white-space: pre-wrap; word-break: break-word; font-size: 8.5pt; }
  #print-chat img { max-width: 100%; max-height: 120mm; height: auto; border-radius: 6px; }
  #print-chat svg { max-width: 100%; height: auto; }
  #print-chat .truncated-note { display: block; margin-top: 2mm; }
  #print-chat .error-message { margin: 2mm 0 0; font-size: 9pt; }
  .print-prompt, .print-note { font-size: 8pt; color: #6b7280; margin: 1mm 0 0; }
  .print-result { margin-top: 7mm; padding: 4mm 5mm; border: 2px solid #8b5cf6; border-radius: 12px; break-inside: avoid; background: #f5f3ff; }
  .print-result h2 { margin: 0 0 2mm; font-size: 12.5pt; color: #312e81; }
  .print-vote { margin: 1mm 0 0; font-size: 9pt; }
}

/* Die Dateiverwaltung arbeitet heute lokal mit dem verschlüsselten Portal. */
#context-file { margin: 6px 0; }
.file-actions { margin: 8px 0; }
#chunk-size { width: 100px; }
.file-targets { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
#file-session { width: 240px; }
#local-files { max-height: 220px; overflow: auto; border: 1px solid #ddd; padding: 8px; border-radius: 8px; }
#local-files label { display: block; }
#files-result { white-space: pre-wrap; background: #f7f7f7; padding: 10px; border-radius: 8px; max-height: 200px; overflow: auto; }
#upload-status { margin-left: 10px; font-size: 12px; }
.modal-content .code-action-btn { color: #374151; background: #f3f4f6; border-color: #e5e7eb; }
#admin-stats .stat-label { display: block; }
.resize-handle { touch-action: none; }
.chat-container.fullscreen { width: var(--fs-width) !important; height: var(--fs-height) !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }

.password-help { float: right; font-size: 13px; color: #667eea; text-decoration: none; }
.password-help:hover { text-decoration: underline; }
#key-name { font-weight: 600; margin-bottom: 15px; }
#apiKeyInput { width: 100%; padding: 10px; border: 1px solid #e5e7eb; border-radius: 8px; }
#provider-form .full-button, #provider-form details { margin-top: 10px; }

.role-item-actions .standard-role { font-size: 12px; opacity: .5; }

.legal-links { padding: 3px 8px; font: 12px/1.5 system-ui,sans-serif; color: #39415c; text-align: center; }
.legal-links a { color: #453a81; }
/* Fußzeile, Eingabeposition und mobile Darstellung: responsive.css */
