/* ============================================================
   KImatiX Portal – Design System
   Basis: design.md
   ============================================================ */

/* ---- CSS-Variablen ---------------------------------------- */
:root {
  --teal:        #0CD5AD;
  --teal-dark:   #09b896;
  --teal-light:  #e6faf6;
  --bg:          #F7F7F7;
  --surface:     #ffffff;
  --border:      #e4e4e4;
  --text:        #1a1a1a;
  --text-muted:  #6b7280;
  --error:       #ef4444;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 2px 12px rgba(12, 213, 173, 0.08);
  --shadow-md:   0 4px 24px rgba(0, 0, 0, 0.08);
  --sidebar-w:   256px;
  --header-h:    56px;
}

/* ---- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.4rem; font-weight: 600; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.5rem; }
h3 { font-size: 1rem;   font-weight: 600; margin: 0 0 0.4rem; }

p  { margin: 0 0 0.75rem; }

/* hidden-Attribut sicher überschreiben */
[hidden] { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ---- Animationen ------------------------------------------ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1;   }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- Karten ----------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

/* ---- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--teal-dark);
  transform: scale(1.02);
  text-decoration: none;
}

.btn-secondary {
  background: var(--teal-light);
  color: var(--teal-dark);
  border: 1px solid var(--teal);
}
.btn-secondary:hover:not(:disabled) {
  background: #d0f4ee;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-full { width: 100%; }

/* Spinner inside button */
.btn .spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ---- Formulare -------------------------------------------- */
.form-field {
  display: grid;
  gap: 5px;
  margin-bottom: 1rem;
}

.form-field label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.form-field .hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(12, 213, 173, 0.12);
}
.input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.10);
}

textarea.input {
  resize: vertical;
  min-height: 80px;
}

/* Password-Wrapper (für Eye-Toggle) */
.pw-wrapper {
  position: relative;
}
.pw-wrapper .input {
  padding-right: 2.5rem;
}
.pw-toggle {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.pw-toggle:hover { color: var(--teal-dark); }

/* ---- Feedback-Boxen --------------------------------------- */
.alert {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  animation: fadeIn 0.2s ease;
}
.alert-error {
  background: #fde8e8;
  border: 1px solid #f5c2c7;
  color: #842029;
}
.alert-ok {
  background: #e8f5e9;
  border: 1px solid #b7e1cd;
  color: #1b5e20;
}
.alert-info {
  background: var(--teal-light);
  border: 1px solid var(--teal);
  color: var(--teal-dark);
}

/* ---- Chips / Badges --------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--teal-light);
  border: 1px solid var(--teal);
  color: var(--teal-dark);
  border-radius: 20px;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ---- Tabellen --------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}
.data-table th,
.data-table td {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}
.data-table th {
  background: var(--teal-light);
  font-weight: 600;
  color: var(--teal-dark);
}
.data-table tr:nth-child(even) td { background: #fafafa; }
.data-table tr:hover td { background: var(--teal-light); }

/* file-table (Downloads) */
.file-table {
  width: 100%;
  border-collapse: collapse;
  font-family: system-ui, sans-serif;
  font-size: 0.93rem;
}
.file-table th,
.file-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.file-table th { background: var(--teal-light); font-weight: 600; }
.file-table tr:hover td { background: #f9f9f9; }
.file-table a { color: var(--teal-dark); }
.file-table a:hover { text-decoration: underline; }

/* ---- Toast ------------------------------------------------ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 0.55rem 1.2rem;
  border-radius: 20px;
  font-size: 0.85rem;
  z-index: 400;
  animation: toastIn 0.2s ease;
  white-space: nowrap;
}
.toast.error   { background: var(--error); }
.toast.success { background: var(--teal-dark); }

/* ============================================================
   PORTAL LAYOUT (index.php)
   ============================================================ */

/* ---- Sidebar ---------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo img {
  height: 32px;
  width: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  background: transparent;
}
.sidebar-nav a:hover {
  background: var(--teal-light);
  color: var(--teal-dark);
  text-decoration: none;
}
.sidebar-nav a.active {
  background: var(--teal);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav a.active img { filter: brightness(0) invert(1); }

.sidebar-nav a img {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-nav a:hover img { opacity: 1; }
.sidebar-nav a.active img { opacity: 1; }

.sidebar-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---- Main Content ----------------------------------------- */
.portal-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.portal-content {
  padding: 2rem 2.5rem;
  max-width: 1200px;
}

/* ---- Mobile Header ---------------------------------------- */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  height: var(--header-h);
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.mobile-header img {
  height: 28px;
  width: auto;
}

.burger-btn {
  width: 36px; height: 36px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s, color 0.15s;
}
.burger-btn:hover { border-color: var(--teal); color: var(--teal-dark); }

/* Mobile Drawer */
.mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.75rem 0.75rem;
  gap: 3px;
}
.mobile-nav.open { display: flex; }

.mobile-nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.mobile-nav a:hover { background: var(--teal-light); color: var(--teal-dark); }
.mobile-nav a.active { background: var(--teal); color: #fff; font-weight: 600; }

/* ---- Dropzone (Datei-Upload) ------------------------------ */
.dropzone {
  border: 2px dashed #94a3b8;
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone.dragover {
  border-color: var(--teal);
  background: var(--teal-light);
}
.dropzone p { margin: 0; color: var(--text-muted); font-size: 0.93rem; line-height: 1.4; }
.dropzone .hint { margin-top: 6px; font-size: 0.8rem; color: var(--text-muted); }
.file-name { margin-top: 10px; font-size: 0.88rem; font-weight: 600; color: var(--text); word-break: break-word; }
.preview { margin-top: 12px; }
.preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
}
.preview img {
  width: 100%; max-height: 300px; object-fit: contain;
  display: block; border-radius: var(--radius-sm); background: #f1f5f9;
}
.file-chip {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  border-radius: var(--radius-sm); background: #f8fafc; border: 1px solid var(--border);
}
.file-icon { font-size: 22px; line-height: 1; }
.file-meta { flex: 1; min-width: 0; }
.file-meta strong { display: block; font-size: 0.9rem; word-break: break-word; }
.file-meta span { display: block; margin-top: 3px; font-size: 0.8rem; color: var(--text-muted); }
.remove-file-btn {
  display: block; width: 100%; margin-top: 10px; padding: 8px;
  background: var(--surface); color: #b91c1c; border: 1px solid #fecaca;
  border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-size: 0.88rem;
  transition: background 0.15s;
}
.remove-file-btn:hover { background: #fde8e8; }

/* ---- n8n-Formulare ---------------------------------------- */
.n8n-form {
  max-width: 520px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}

.n8n-form form {
  display: grid;
  gap: 0;
}

.n8n-form .row {
  display: grid;
  gap: 5px;
  margin-bottom: 1rem;
}

.n8n-form label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.n8n-form input,
.n8n-form textarea,
.n8n-form select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;
}

.n8n-form input:focus,
.n8n-form textarea:focus,
.n8n-form select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(12, 213, 173, 0.12);
}

.n8n-form input[type="file"] {
  font-size: 0.88rem;
  padding: 0.4rem 0.6rem;
}

.n8n-form button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: 0.5rem;
}
.n8n-form button[type="submit"]:hover:not(:disabled) {
  background: var(--teal-dark);
  transform: scale(1.02);
}
.n8n-form button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.n8n-form .status {
  margin-top: 1rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--teal-light);
  border: 1px solid var(--teal);
  color: var(--teal-dark);
  font-size: 0.9rem;
  white-space: pre-wrap;
  animation: fadeIn 0.2s ease;
}
.n8n-form .status.error {
  background: #fde8e8;
  border-color: #f5c2c7;
  color: #842029;
}

/* ============================================================
   AUTH-LAYOUT (login, register, reset)
   ============================================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.5rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 400px;
  animation: fadeIn 0.25s ease;
}

.auth-logo {
  display: block;
  height: 36px;
  width: auto;
  margin: 0 auto 1.5rem;
}

.auth-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1.5rem;
  text-align: center;
}

.auth-field {
  margin-bottom: 1rem;
}
.auth-field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}

.auth-field .pw-wrapper { position: relative; }
.auth-field .pw-wrapper .input { padding-right: 2.5rem; }

.auth-submit {
  margin-top: 1.25rem;
}

.auth-links {
  margin-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.auth-links a { color: var(--teal-dark); }
.auth-links a:hover { text-decoration: underline; }

/* ============================================================
   CHAT-MODUL (modules/chat.php)
   ============================================================ */

.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - 4rem);
  min-height: 400px;
  max-width: 860px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.chat-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  flex-shrink: 0;
  transition: background 0.3s;
}
.status-dot.online    { background: var(--teal); }
.status-dot.error     { background: var(--error); }
.status-dot.connecting { background: #f59e0b; }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  animation: fadeIn 0.2s ease;
}
.message-row.user { flex-direction: row-reverse; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.avatar.agent {
  background: var(--teal-light);
  color: var(--teal-dark);
  border: 1.5px solid var(--teal);
}
.avatar.user {
  background: var(--text);
  color: #fff;
}

.bubble {
  max-width: min(72%, 600px);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.93rem;
  line-height: 1.55;
  word-break: break-word;
}
.message-row.agent .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}
.message-row.user .bubble {
  background: var(--text);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Markdown inside bubbles */
.bubble p          { margin-bottom: 0.5em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { padding-left: 1.4em; margin-bottom: 0.5em; }
.bubble h1, .bubble h2, .bubble h3 { margin: 0.6em 0 0.25em; }
.bubble a          { color: var(--teal-dark); text-decoration: underline; text-underline-offset: 2px; }
.bubble code {
  font-family: 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 0.85em;
  background: #f0faf8;
  border: 1px solid #c5ede6;
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
.bubble pre {
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  overflow-x: auto;
  margin: 0.4em 0;
}
.bubble pre code { background: none; border: none; padding: 0; font-size: 0.85em; }
.bubble blockquote {
  border-left: 3px solid var(--teal);
  background: var(--teal-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.2em 0.8em;
  color: var(--text-muted);
  margin: 0.4em 0;
}
.bubble table { border-collapse: collapse; font-size: 0.9em; margin: 0.4em 0; }
.bubble th, .bubble td { border: 1px solid var(--border); padding: 0.3em 0.6em; }
.bubble th { background: var(--teal-light); font-weight: 600; }

/* Bild-Attachment im Bubble */
.bubble .msg-image {
  max-width: 280px;
  max-height: 200px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: block;
  margin-top: 0.35rem;
  border: 1px solid var(--border);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  animation: fadeIn 0.2s ease;
  flex-shrink: 0;
}
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
  padding: 0.55rem 0.75rem;
  box-shadow: var(--shadow);
}
.typing-bubble span {
  display: block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal);
  animation: bounce 1.2s infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }
.typing-text { font-size: 0.8rem; color: var(--text-muted); }

/* Upload Preview */
.upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.4rem 0 0;
  flex-shrink: 0;
}

.preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--teal-light);
  border: 1px solid var(--teal);
  border-radius: 20px;
  padding: 0.2rem 0.5rem 0.2rem 0.4rem;
  font-size: 0.8rem;
  color: var(--teal-dark);
  max-width: 180px;
  animation: fadeIn 0.15s ease;
}
.preview-chip svg { flex-shrink: 0; }
.preview-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-chip .remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 1px;
  color: var(--teal-dark);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.preview-chip .remove-btn:hover { opacity: 1; }

/* Chat Input Row */
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.65rem 0 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input-row .icon-btn {
  width: 36px; height: 36px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}
.chat-input-row .icon-btn:hover { border-color: var(--teal); color: var(--teal-dark); }

.textarea-wrapper { flex: 1; }

.chat-textarea {
  display: block;
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.93rem;
  color: var(--text);
  resize: none;
  outline: none;
  min-height: 38px;
  max-height: 180px;
  overflow-y: auto;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(12, 213, 173, 0.12);
}

.send-btn {
  width: 36px; height: 36px;
  background: var(--teal);
  border: none;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.send-btn:hover:not(:disabled) { background: var(--teal-dark); transform: scale(1.05); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Drag-over overlay */
body.drag-over::after {
  content: 'Datei(en) hier ablegen';
  position: fixed;
  inset: 0;
  background: rgba(12, 213, 173, 0.08);
  border: 3px dashed var(--teal);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--teal-dark);
  z-index: 9999;
  pointer-events: none;
}

/* Clear-button */
.chat-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.chat-clear-btn:hover { color: var(--error); background: #fde8e8; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 975px) {
  .sidebar       { display: none; }
  .mobile-header { display: flex; }
  .portal-main   { margin-left: 0; }
  .portal-content { padding: 1.25rem 1.25rem; }
}

@media (max-width: 576px) {
  .auth-card { padding: 1.75rem 1.25rem; }
  .bubble { max-width: 88%; }
  .bubble .msg-image { max-width: 200px; }
  .portal-content { padding: 1rem; }
  .chat-wrapper { height: calc(100vh - var(--header-h) - 2rem); }
}
