/* ============================================================
   Interne KI – Design-Tokens

   Ruhiges Unternehmens-Blau auf Tinte + Nebel-Weiß.
   Systemschriften statt Web-Fonts.
   ============================================================ */

:root {
  --ink: #14151a;
  --ink-raised: #1d1f28;
  --ink-hover: #262936;
  --ink-border: #2c2f3d;

  --mist: #f5f6f9;
  --paper: #ffffff;
  --line: #e3e5ec;

  --text: #1b1d27;
  --text-muted: #6b6f83;
  --text-on-ink: #dcdee8;
  --text-on-ink-muted: #83879c;

  --accent: #3654d6;
  --accent-hover: #2c46bd;
  --accent-soft: #eaeefc;
  --accent-soft-border: #c9d3f7;

  --error: #c8402f;
  --error-soft: #fbeceb;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-ui:
    -apple-system,
    "Segoe UI",
    "Inter",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;

  --font-mono:
    ui-monospace,
    "Cascadia Code",
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;
}


/* ============================================================
   Basis
   ============================================================ */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* ============================================================
   Login
   ============================================================ */

.login-view {
  height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    radial-gradient(
      1200px 600px at 20% -10%,
      #1b2244 0%,
      transparent 60%
    ),
    var(--ink);
}

.login-card {
  width: 360px;

  background: var(--ink-raised);

  border: 1px solid var(--ink-border);
  border-radius: var(--radius-lg);

  padding: 32px 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;

  margin-bottom: 28px;
}

.login-brand-mark {
  color: var(--accent);
  font-size: 20px;
}

.login-brand-text {
  color: var(--text-on-ink);

  font-weight: 600;
  font-size: 16px;

  letter-spacing: 0.01em;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12.5px;
  color: var(--text-on-ink-muted);
  font-weight: 500;
}

.field input {
  background: var(--ink);

  border: 1px solid var(--ink-border);
  border-radius: var(--radius-sm);

  padding: 10px 12px;

  color: var(--text-on-ink);

  outline: none;
}

.field input:focus {
  border-color: var(--accent);
}

.login-error {
  min-height: 18px;

  margin: 0;

  color: #ff8a80;

  font-size: 13px;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);

  padding: 10px 16px;

  font-weight: 600;
  font-size: 14px;

  cursor: pointer;

  transition:
    background-color 120ms ease,
    opacity 120ms ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-block {
  width: 100%;
}

.server-settings-toggle {
  background: none;
  border: none;

  color: var(--text-on-ink-muted);

  font-size: 12.5px;

  text-align: left;

  cursor: pointer;

  padding: 2px 0;
}

.server-settings-toggle:hover {
  color: var(--text-on-ink);
}


/* ============================================================
   App-Shell
   ============================================================ */

.app-view {
  width: 100%;
  height: 100vh;
  min-height: 0;

  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  min-width: 0;
  min-height: 0;

  background: var(--ink);
  color: var(--text-on-ink);

  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 18px 16px 8px;
}

.sidebar-brand {
  font-weight: 600;
  font-size: 14px;

  letter-spacing: 0.02em;

  color: var(--text-on-ink);
}

.new-chat-btn {
  margin: 8px 12px 4px;

  display: flex;
  align-items: center;
  gap: 8px;

  background: var(--ink-raised);

  border: 1px solid var(--ink-border);
  color: var(--text-on-ink);

  border-radius: var(--radius-sm);

  padding: 9px 12px;

  font-size: 13.5px;
  font-weight: 500;

  cursor: pointer;

  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.new-chat-btn:hover {
  background: var(--ink-hover);
  border-color: var(--accent);
}

.prompt-library-sidebar-btn {
  margin: 4px 12px 4px;

  display: flex;
  align-items: center;
  gap: 8px;

  width: calc(100% - 24px);

  background: transparent;

  border: 1px solid transparent;
  color: var(--text-on-ink-muted);

  border-radius: var(--radius-sm);

  padding: 8px 12px;

  font-size: 13px;
  font-weight: 500;

  text-align: left;

  cursor: pointer;

  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.prompt-library-sidebar-btn:hover {
  background: var(--ink-raised);
  border-color: var(--ink-border);
  color: var(--text-on-ink);
}

.prompt-library-sidebar-icon {
  width: 18px;
  flex: 0 0 18px;
  text-align: center;
  color: var(--accent);
}

.new-chat-icon {
  color: var(--accent);
  font-weight: 700;
}

.chat-list {
  flex: 1 1 auto;

  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;

  padding: 10px 8px 8px;

  display: flex;
  flex-direction: column;

  gap: 2px;
}

.chat-group-heading {
  font-size: 11px;

  text-transform: uppercase;
  letter-spacing: 0.06em;

  color: var(--text-on-ink-muted);

  padding: 12px 8px 4px;
}

.chat-group-heading:first-child {
  padding-top: 4px;
}

.chat-list-item {
  position: relative;

  display: flex;
  align-items: center;

  text-align: left;

  background: none;
  border: none;

  color: var(--text-on-ink);

  padding: 8px 28px 8px 10px;

  min-height: 34px;

  border-radius: var(--radius-sm);

  font-size: 13.5px;
  line-height: 1.2;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  cursor: pointer;
}

.chat-list-item:hover {
  background: var(--ink-hover);
}

.chat-list-item.active {
  background: var(--ink-raised);

  color: #fff;

  box-shadow:
    inset 2px 0 0 var(--accent);
}

.chat-delete {
  position: absolute;

  right: 8px;
  top: 50%;

  transform: translateY(-50%);

  font-size: 11px;

  color: var(--text-on-ink-muted);

  opacity: 0;

  transition: opacity 120ms ease;

  padding: 2px 4px;
}

.chat-list-item:hover .chat-delete,
.chat-list-item.active .chat-delete {
  opacity: 1;
}

.chat-delete:hover {
  color: #ff8a80;
}

.sidebar-footer {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 8px;

  padding: 12px 14px;

  border-top: 1px solid var(--ink-border);
}

.current-user-label {
  font-size: 12.5px;

  color: var(--text-on-ink-muted);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  background: none;

  border: 1px solid var(--ink-border);

  color: var(--text-on-ink-muted);

  border-radius: var(--radius-sm);

  padding: 5px 10px;

  font-size: 12px;

  cursor: pointer;
}

.logout-btn:hover {
  color: var(--text-on-ink);
  border-color: var(--accent);
}


/* ============================================================
   Chat-Hauptbereich
   ============================================================ */

.chat-main {
  position: relative;

  min-width: 0;
  min-height: 0;

  display: flex;
  flex-direction: column;

  background: var(--mist);

  overflow: hidden;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(234, 238, 252, 0.94);
  border: 2px dashed var(--accent);

  pointer-events: none;
}

.drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;

  padding: 28px 36px;
  border-radius: var(--radius-lg);
  background: var(--paper);
  border: 1px solid var(--accent-soft-border);
  box-shadow: 0 8px 28px rgba(20, 21, 26, 0.08);

  color: var(--text);
  text-align: center;
}

.drop-overlay-icon {
  font-size: 28px;
  color: var(--accent);
}

.drop-overlay-content span:last-child {
  font-size: 12.5px;
  color: var(--text-muted);
}

.chat-header {
  flex: 0 0 auto;

  padding: 16px 28px;

  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.chat-title {
  margin: 0;

  font-size: 14.5px;

  font-weight: 600;

  color: var(--text);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-close-btn {
  flex-shrink: 0;
}

.messages {
  flex: 1 1 auto;

  min-width: 0;
  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;

  padding: 24px 0 24px;

  overscroll-behavior: contain;

  scrollbar-gutter: stable;
}


/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
  height: 100%;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  text-align: center;

  color: var(--text-muted);

  gap: 6px;
}

.empty-state-mark {
  color: var(--accent);

  font-size: 28px;

  margin-bottom: 6px;
}

.empty-state h2 {
  margin: 0;

  font-size: 18px;

  color: var(--text);
}

.empty-state p {
  margin: 0;

  font-size: 13.5px;
}


/* ============================================================
   Gesprächs-Turns
   ============================================================ */

.turn {
  max-width: 760px;

  margin: 0 auto 22px;

  padding: 0 28px;
}

.turn-role {
  font-size: 11px;

  font-weight: 600;

  letter-spacing: 0.05em;

  text-transform: uppercase;

  color: var(--text-muted);

  margin-bottom: 6px;
}

.turn-user .turn-role {
  text-align: right;
}

.turn-user .turn-body {
  background: var(--accent-soft);

  border:
    1px solid
    var(--accent-soft-border);

  border-radius: var(--radius-lg);

  padding: 10px 16px;

  margin-left: 15%;
}

.turn-assistant .turn-body {
  border-left:
    3px solid
    var(--accent);

  padding:
    2px 0
    2px 16px;
}

.turn-error .turn-body {
  border-left-color: var(--error);

  background: var(--error-soft);

  border-radius: var(--radius-md);

  padding: 10px 14px;
}

.error-text {
  color: var(--error);
}

.turn-body {
  font-size: 14.5px;

  line-height: 1.65;

  min-width: 0;
}

.turn-body p {
  margin: 0 0 10px;
}

.turn-body p:last-child {
  margin-bottom: 0;
}


/* ============================================================
   Markdown – Überschriften
   ============================================================ */

.turn-body h1,
.turn-body h2,
.turn-body h3,
.turn-body h4,
.turn-body h5,
.turn-body h6 {
  margin:
    16px 0 8px;

  line-height: 1.3;

  color: var(--text);
}

.turn-body h1:first-child,
.turn-body h2:first-child,
.turn-body h3:first-child,
.turn-body h4:first-child,
.turn-body h5:first-child,
.turn-body h6:first-child {
  margin-top: 0;
}

.turn-body h1 {
  font-size: 25px;
}

.turn-body h2 {
  font-size: 21px;
}

.turn-body h3 {
  font-size: 18px;
}

.turn-body h4 {
  font-size: 16px;
}

.turn-body h5 {
  font-size: 14.5px;
}

.turn-body h6 {
  font-size: 13px;

  color: var(--text-muted);
}


/* ============================================================
   Markdown – Text
   ============================================================ */

.turn-body strong {
  font-weight: 700;
}

.turn-body em {
  font-style: italic;
}

.turn-body del {
  opacity: 0.65;
}

.turn-body a {
  color: var(--accent);

  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.turn-body a:hover {
  color: var(--accent-hover);
}

.turn-body ul,
.turn-body ol {
  margin:
    0 0 10px;

  padding-left: 22px;
}

.turn-body li {
  margin-bottom: 4px;
}

.turn-body blockquote {
  margin:
    12px 0;

  padding:
    8px 14px;

  border-left:
    3px solid
    var(--text-muted);

  background:
    rgba(54, 84, 214, 0.035);

  color: var(--text-muted);

  border-radius:
    0
    var(--radius-sm)
    var(--radius-sm)
    0;
}

.turn-body hr {
  margin:
    18px 0;

  border: none;

  border-top:
    1px solid
    var(--line);
}


/* ============================================================
   Markdown – Inline Code
   ============================================================ */

.turn-body code {
  font-family: var(--font-mono);

  font-size: 13px;

  background:
    rgba(54, 84, 214, 0.08);

  padding:
    1px 5px;

  border-radius: 4px;
}


/* ============================================================
   Markdown – Bilder
   ============================================================ */

.turn-body .markdown-image {
  display: block;

  max-width: 100%;
  max-height: 600px;

  margin:
    12px 0;

  border:
    1px solid
    var(--line);

  border-radius: var(--radius-md);

  object-fit: contain;

  background: var(--paper);
}


/* ============================================================
   Markdown – Tabellen
   ============================================================ */

.turn-body .markdown-table-wrapper {
  width: 100%;

  overflow-x: auto;

  margin:
    14px 0;

  border:
    1px solid
    var(--line);

  border-radius: var(--radius-md);

  background: var(--paper);
}

.turn-body .markdown-table {
  width: max-content;

  min-width: 100%;

  border-collapse: collapse;

  font-size: 13px;
}

.turn-body .markdown-table th,
.turn-body .markdown-table td {
  padding:
    8px 11px;

  border:
    1px solid
    var(--line);

  vertical-align: top;
}

.turn-body .markdown-table th {
  background: var(--mist);

  font-weight: 650;

  color: var(--text);
}

.turn-body .markdown-table td {
  background: var(--paper);
}

.turn-body .markdown-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}


/* ============================================================
   Markdown – Task Lists
   ============================================================ */

.task-list-item {
  list-style: none;
}

.task-list-item label {
  display: inline-flex;

  align-items: flex-start;

  gap: 7px;
}

.markdown-task-checkbox {
  margin:
    4px 0 0;
}


/* ============================================================
   KI-Antwort – Aktionen
   ============================================================ */

.assistant-actions {
  display: flex;
  align-items: center;
  gap: 6px;

  margin-top: 7px;
  padding-left: 19px;
}

.assistant-action-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  border-radius: var(--radius-sm);

  padding: 4px 8px;

  font-size: 11.5px;
  cursor: pointer;

  transition:
    background-color 120ms ease,
    color 120ms ease,
    border-color 120ms ease;
}

.assistant-action-btn:hover:not(:disabled) {
  background: var(--paper);
  color: var(--text);
  border-color: var(--accent-soft-border);
}

.assistant-action-btn-disabled,
.assistant-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}


/* ============================================================
   Code Blocks
   ============================================================ */

.code-block {
  margin:
    10px 0;

  border:
    1px solid
    var(--line);

  border-radius:
    var(--radius-md);

  overflow: hidden;

  background: var(--ink);
}

.code-block-header {
  display: flex;

  align-items: center;
  justify-content: space-between;

  padding:
    6px 10px;

  background:
    var(--ink-raised);

  border-bottom:
    1px solid
    var(--ink-border);
}

.code-lang {
  font-family: var(--font-mono);

  font-size: 11.5px;

  color:
    var(--text-on-ink-muted);

  text-transform: lowercase;
}

.copy-code-btn {
  background: none;

  border:
    1px solid
    var(--ink-border);

  color:
    var(--text-on-ink-muted);

  border-radius: 4px;

  font-size: 11px;

  padding: 3px 8px;

  cursor: pointer;
}

.copy-code-btn:hover {
  color: #fff;

  border-color:
    var(--accent);
}

.code-block pre {
  margin: 0;

  padding:
    12px 14px;

  overflow-x: auto;
}

.code-block code {
  font-family:
    var(--font-mono);

  font-size: 13px;

  color: #dfe2ee;

  background: none;

  padding: 0;

  white-space: pre;
}


/* ============================================================
   Typing Cursor
   ============================================================ */

.typing-cursor {
  display: inline-block;

  width: 7px;
  height: 15px;

  background:
    var(--accent);

  margin-left: 2px;

  vertical-align: text-bottom;

  animation:
    blink 1s step-start infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}


/* ============================================================
   Dateien in Nachrichten
   ============================================================ */

.turn-files {
  display: flex;

  flex-wrap: wrap;

  gap: 6px;

  margin-bottom: 6px;

  justify-content: flex-end;
}

.turn-assistant .turn-files {
  justify-content: flex-start;
}

.file-chip {
  display: inline-flex;

  align-items: center;

  gap: 6px;

  max-width: 100%;

  background:
    var(--paper);

  border:
    1px solid
    var(--line);

  border-radius:
    999px;

  padding:
    4px 10px;

  font-size: 12.5px;

  color:
    var(--text);

  text-decoration: none;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

button.file-chip {
  font: inherit;

  cursor: pointer;
}

.file-chip-preview {
  transition:
    border-color 120ms ease,
    background-color 120ms ease;
}

.file-chip-preview:hover {
  border-color:
    var(--accent);

  background:
    var(--accent-soft);
}

.file-chip.removable {
  background: var(--mist);

  padding-right: 6px;
}

.file-chip-remove {
  border: none;

  background: transparent;

  color:
    var(--text-muted);

  font-size: 11px;

  padding: 1px 3px;
}

.file-chip-remove:hover {
  color:
    var(--error);
}

/* ============================================================
   TTS / Spracheingabe
   ============================================================ */
.speech-btn.is-recording {
  outline: 2px solid currentColor;
  outline-offset: 1px;
  animation: speech-pulse 1.2s ease-in-out infinite;
}

.speech-btn.is-processing {
  opacity: 0.6;
  cursor: wait;
}

@keyframes speech-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}


/* ============================================================
   Composer
   ============================================================ */

.composer-wrap {
  flex: 0 0 auto;

  min-width: 0;

  padding: 10px 28px 18px;

  background: var(--mist);
}

.composer {
  max-width: 760px;

  margin: 0 auto;

  background:
    var(--paper);

  border:
    1px solid
    var(--line);

  border-radius:
    var(--radius-lg);

  padding:
    10px 12px 8px;

  box-shadow:
    0 1px 2px
    rgba(20, 21, 26, 0.04);
}

.file-chips {
  display: flex;

  flex-wrap: wrap;

  gap: 6px;

  padding:
    0 4px 6px;
}

.file-chips:empty {
  display: none;
}

.composer-row {
  padding:
    0 4px;
}

.composer-input {
  width: 100%;

  resize: none;

  border: none;

  outline: none;

  background: none;

  font-size: 14.5px;

  line-height: 1.5;

  max-height: 320px;

  min-height: 24px;

  padding: 4px 0;
}

.composer-input::placeholder {
  color:
    var(--text-muted);
}

.composer-toolbar {
  display: flex;

  align-items: center;

  justify-content: space-between;

  padding-top: 6px;

  gap: 8px;
}

.composer-toolbar-left {
  display: flex;

  align-items: center;

  gap: 8px;

  min-width: 0;

  flex-wrap: wrap;
}

.icon-btn {
  display: inline-flex;

  align-items: center;
  justify-content: center;

  width: 30px;
  height: 30px;

  background: none;

  border: none;

  font-size: 16px;

  cursor: pointer;

  padding: 4px 6px;

  border-radius:
    var(--radius-sm);

  color:
    var(--text-muted);
}

.icon-btn:hover {
  background:
    var(--mist);

  color:
    var(--text);
}


/* ============================================================
   Modell / Thinking / Effort
   ============================================================ */

.model-select,
.thinking-budget {

  height: 30px;

  background:
    var(--mist);

  border:
    1px solid
    var(--line);

  border-radius:
    999px;

  padding:
    4px 10px;

  font-size:
    12px;

  color:
    var(--text);

  cursor:
    pointer;

  outline:
    none;

  transition:
    border-color 120ms ease,
    background-color 120ms ease;
}


/* ------------------------------------------------------------
   Hover / Focus
   ------------------------------------------------------------ */

.model-select:hover,
.thinking-budget:hover {

  border-color:
    var(--accent-soft-border);
}


.model-select:focus,
.thinking-budget:focus {

  border-color:
    var(--accent);
}


/* ------------------------------------------------------------
   Disabled
   ------------------------------------------------------------ */

.model-select:disabled,
.thinking-budget:disabled {

  opacity:
    0.55;

  cursor:
    default;
}


/* ============================================================
   Thinking Budget
   ============================================================ */

/**
 * Der Thinking-Budget-Wert ist jetzt ein Slider.
 *
 * Die eigentliche Tokenzahl wird intern von JavaScript
 * verwaltet. Der Benutzer sieht nur verständliche Stufen.
 */

.thinking-budget {

  width:
    120px;

  height:
    18px;

  padding:
    0;

  border:
    none;

  border-radius:
    999px;

  background:
    transparent;

  cursor:
    pointer;

  appearance:
    none;

  -webkit-appearance:
    none;
}


/* ------------------------------------------------------------
   WebKit / Chrome / Electron
   ------------------------------------------------------------ */

.thinking-budget::-webkit-slider-runnable-track {

  height:
    5px;

  background:
    var(--line);

  border-radius:
    999px;
}


.thinking-budget::-webkit-slider-thumb {

  width:
    14px;

  height:
    14px;

  margin-top:
    -4.5px;

  background:
    var(--accent);

  border:
    2px solid
    var(--mist);

  border-radius:
    50%;

  cursor:
    pointer;

  appearance:
    none;

  -webkit-appearance:
    none;
}


/* ------------------------------------------------------------
   Firefox
   ------------------------------------------------------------ */

.thinking-budget::-moz-range-track {

  height:
    5px;

  background:
    var(--line);

  border-radius:
    999px;
}


.thinking-budget::-moz-range-thumb {

  width:
    14px;

  height:
    14px;

  background:
    var(--accent);

  border:
    2px solid
    var(--mist);

  border-radius:
    50%;

  cursor:
    pointer;
}


/* ------------------------------------------------------------
   Hover / Focus für Slider
   ------------------------------------------------------------ */

.thinking-budget:hover::-webkit-slider-runnable-track {

  background:
    var(--accent-soft-border);
}


.thinking-budget:focus-visible::-webkit-slider-thumb {

  box-shadow:
    0 0 0 3px
    var(--accent-soft-border);
}


.thinking-budget:focus-visible::-moz-range-thumb {

  box-shadow:
    0 0 0 3px
    var(--accent-soft-border);
}

/* ============================================================
   Thinking Budget Container
   ============================================================ */

.thinking-budget-wrap {

  display:
    flex;

  align-items:
    center;

  gap:
    8px;

  height:
    30px;
}


/* ============================================================
   Thinking Budget Label
   ============================================================ */

.thinking-budget-label {

  min-width:
    72px;

  font-size:
    11.5px;

  line-height:
    1;

  color:
    var(--text-muted);

  white-space:
    nowrap;

  user-select:
    none;
}


/* ============================================================
   Send Button
   ============================================================ */

.send-btn {

  padding:
    8px 18px;
}


/* ============================================================
   Composer Hint
   ============================================================ */

.composer-hint {

  max-width:
    760px;

  margin:
    8px auto 0;

  text-align:
    center;

  font-size:
    11.5px;

  color:
    var(--text-muted);
}


/* ============================================================
   Chat Header
   ============================================================ */

.chat-header {

  display:
    flex;

  align-items:
    center;

  justify-content:
    space-between;

  gap:
    12px;
}


/* ============================================================
   Chat schließen
   ============================================================ */

.chat-close-btn {

  flex-shrink:
    0;

  width:
    32px;

  height:
    32px;

  display:
    flex;

  align-items:
    center;

  justify-content:
    center;

  padding:
    0;

  border:
    1px solid
    var(--line);

  border-radius:
    50%;

  background:
    var(--mist);

  color:
    var(--text-muted);

  cursor:
    pointer;

  transition:
    background-color 120ms ease,
    color 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}


.chat-close-btn:hover {

  border-color:
    var(--accent-soft-border);

  background:
    var(--accent-soft);

  color:
    var(--text);

  transform:
    scale(1.04);
}


.chat-close-btn:focus {

  outline:
    none;

  border-color:
    var(--accent);
}


.chat-close-btn:active {

  transform:
    scale(0.96);
}


/* ============================================================
   Utility
   ============================================================ */

.hidden {

  display:
    none !important;
}


/* ============================================================
   Fehlerbanner
   ============================================================ */

.error-banner {
  max-width: 760px;

  margin:
    0 auto 8px;

  background:
    var(--error-soft);

  color:
    var(--error);

  border:
    1px solid
    #f2c6c1;

  border-radius:
    var(--radius-sm);

  padding:
    8px 12px;

  font-size: 13px;
}


/* ============================================================
   Prompt-Bibliothek
   ============================================================ */

.prompt-library-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.prompt-library-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 21, 26, 0.45);
}

.prompt-library-dialog {
  position: relative;
  z-index: 1;

  width: min(720px, 92vw);
  max-height: 82vh;

  margin: 9vh auto 0;

  display: flex;
  flex-direction: column;

  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 48px rgba(20, 21, 26, 0.18);

  overflow: hidden;
}

.prompt-library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;

  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.prompt-library-title {
  display: block;
  font-size: 17px;
  font-weight: 650;
  color: var(--text);
}

.prompt-library-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.prompt-library-search-wrap {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--mist);
}

.prompt-library-search {
  width: 100%;

  padding: 10px 12px;

  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);

  outline: none;
}

.prompt-library-search:focus {
  border-color: var(--accent);
}

.prompt-list {
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
}

.prompt-library-item {
  position: relative;

  width: 100%;

  display: grid;
  grid-template-columns: 1fr auto 24px;
  align-items: center;
  gap: 10px;

  padding: 10px 12px;
  margin-bottom: 4px;

  text-align: left;

  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;

  color: var(--text);

  cursor: pointer;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.prompt-library-item:hover {
  background: var(--mist);
  border-color: var(--line);
}

.prompt-library-item.copied {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
}

.prompt-library-item.copy-failed {
  background: var(--error-soft);
  border-color: #efc4be;
}

.prompt-library-item-title {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
}

.prompt-library-item-category {
  font-size: 11.5px;
  color: var(--text-muted);
}

.prompt-library-copy-icon {
  color: var(--accent);
  text-align: center;
  font-size: 15px;
}

.prompt-library-empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}


/* ============================================================
   Datei-Vorschau / Modal
   ============================================================ */

.file-preview-modal {
  position: fixed;

  inset: 0;

  z-index: 10000;
}

.file-preview-modal.hidden {
  display: none !important;
}

.file-preview-backdrop {
  position: absolute;

  inset: 0;

  background:
    rgba(20, 21, 26, 0.72);
}

.file-preview-dialog {
  position: relative;

  z-index: 1;

  width:
    min(1100px, 92vw);

  height:
    min(820px, 90vh);

  margin:
    5vh auto;

  display: flex;

  flex-direction: column;

  background:
    var(--paper);

  border:
    1px solid
    var(--line);

  border-radius:
    var(--radius-lg);

  overflow: hidden;

  box-shadow:
    0 25px 80px
    rgba(20, 21, 26, 0.3);
}

.file-preview-header {
  min-height: 52px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 12px;

  padding:
    0 12px 0 17px;

  background:
    var(--paper);

  border-bottom:
    1px solid
    var(--line);
}

.file-preview-title {
  min-width: 0;

  font-size: 14px;

  font-weight: 600;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.file-preview-content {
  flex: 1;

  min-height: 0;

  overflow: auto;

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 18px;

  background:
    var(--mist);
}

.file-preview-loading {
  color:
    var(--text-muted);

  font-size: 13px;
}

.file-preview-image {
  display: block;

  max-width: 100%;

  max-height: 100%;

  object-fit: contain;

  border:
    1px solid
    var(--line);

  border-radius:
    var(--radius-md);

  background:
    var(--paper);
}

.file-preview-frame {
  width: 100%;

  height: 100%;

  border: none;

  background:
    #fff;

  border-radius:
    var(--radius-sm);
}

.file-preview-text {
  width: 100%;

  height: 100%;

  margin: 0;

  padding: 14px;

  overflow: auto;

  background:
    var(--ink);

  border:
    1px solid
    var(--ink-border);

  border-radius:
    var(--radius-md);

  color:
    var(--text-on-ink);

  font-family:
    var(--font-mono);

  font-size: 13px;

  line-height: 1.55;

  white-space: pre-wrap;

  word-break: break-word;
}

.file-preview-unsupported {
  max-width: 520px;

  text-align: center;

  color:
    var(--text-muted);
}

.file-preview-icon {
  margin-bottom: 14px;

  font-size: 42px;
}

.file-preview-unsupported h3 {
  margin:
    0 0 8px;

  color:
    var(--text);

  font-size: 16px;
}

.file-preview-unsupported p {
  margin: 0;

  font-size: 13px;
}


/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 860px) {

  .app-view {
    grid-template-columns:
      220px 1fr;
  }

  .turn,
  .composer-wrap,
  .chat-header {
    padding-left: 16px;
    padding-right: 16px;
  }

  .turn-user .turn-body {
    margin-left: 5%;
  }
}

@media (max-width: 700px) {

  .app-view {
    grid-template-columns:
      1fr;
  }

  .sidebar {
    display: none;
  }

  .turn {
    max-width: 100%;
  }

  .composer-wrap {
    padding-left: 10px;
    padding-right: 10px;
  }

  .composer-toolbar {
    align-items: flex-end;
  }

  .composer-toolbar-left {
    max-width: 100%;
  }

  .model-select,
  .thinking-budget {
    max-width: 130px;
  }

  .file-preview-dialog {
    width: 96vw;

    height: 94vh;

    margin:
      3vh auto;
  }

  .prompt-library-dialog {
    width: 96vw;
    max-height: 88vh;
    margin-top: 6vh;
  }

  .prompt-library-item {
    grid-template-columns: 1fr 24px;
  }

  .prompt-library-item-category {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {

  .typing-cursor {
    animation: none;

    opacity: 1;
  }

  * {
    transition: none !important;
  }
}