/* ═══════════════════════════════════════════════════════════════════════════
   INKPi – app.css  (Professional Redesign)
   ══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── 1. CSS Variables ───────────────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:       #6366f1;
  --primary-h:     #4f46e5;
  --primary-d:     #3730a3;
  --primary-light: #eef2ff;
  --primary-ring:  rgba(99,102,241,.15);

  /* Neutrals */
  --bg:            #f8fafc;
  --bg-subtle:     #f1f5f9;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;
  --border-soft:   #f1f5f9;

  /* Text */
  --text:          #0f172a;
  --text-muted:    #475569;
  --text-subtle:   #94a3b8;

  /* Status */
  --success:        #10b981;
  --success-light:  #ecfdf5;
  --success-border: #a7f3d0;
  --warning:        #f59e0b;
  --warning-light:  #fffbeb;
  --warning-border: #fde68a;
  --danger:         #ef4444;
  --danger-h:       #dc2626;
  --danger-light:   #fef2f2;
  --danger-border:  #fecaca;

  /* Sidebar */
  --sb-bg:          #0f172a;
  --sb-surface:     #1e293b;
  --sb-border:      #1e293b;
  --sb-text:        #f1f5f9;
  --sb-text-muted:  #94a3b8;
  --sb-hover:       rgba(255,255,255,.05);
  --sb-active:      rgba(99,102,241,.18);
  --sb-active-text: #a5b4fc;

  /* Radii */
  --r-xs:   4px;
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-full: 9999px;

  /* Legacy compat */
  --radius:    var(--r-lg);
  --radius-sm: var(--r-md);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.05);
  --shadow-xl: 0 25px 60px rgba(0,0,0,.15);

  --navbar-h:  58px;
  --transition: 150ms ease;
}

/* ── 2. Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── 3. Base ────────────────────────────────────────────────────────────── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: -webkit-fill-available; /* iOS Safari: excludes browser chrome */
  height: 100dvh;                 /* modern: dynamic viewport height */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── 4. Navbar ──────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--navbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.admin-nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.navbar-logo-ukd {
  height: 30px;
  width: auto;
  display: block;
  border-radius: 4px;
}

.navbar-logo-inkpi {
  height: 34px;
  width: auto;
  display: block;
  border-radius: 4px;
}

.navbar-divider {
  width: 1.5px;
  height: 28px;
  background: var(--border);
  border-radius: 1px;
  flex-shrink: 0;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-email {
  font-size: 13px;
  color: var(--text-muted);
}

/* Admin nav pill tabs */
.admin-nav {
  display: flex;
  gap: 2px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
}

.admin-nav-link {
  padding: 5px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.admin-nav-link:hover {
  background: var(--surface);
  color: var(--text);
}

.admin-nav-link.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.btn-logout {
  font-size: 13px;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background var(--transition), border-color var(--transition);
}

.btn-logout:hover {
  background: var(--bg);
  border-color: var(--border-strong);
}

/* ── 5. Main Content ────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  overflow-y: auto;
}

.main-content.admin-page {
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.main-content.chat-page {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  overflow: hidden;
  flex-direction: row;
}

.main-content.auth-page {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
}

.main-content.support-main {
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  background: var(--sb-bg);
  padding: 40px 20px 60px;
}

/* ── 6. Buttons ─────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 3px rgba(99,102,241,.3);
  font-family: inherit;
}

.btn-primary:hover {
  background: var(--primary-h);
  box-shadow: 0 2px 6px rgba(99,102,241,.4);
}

.btn-primary:disabled {
  background: #a5b4fc;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), border-color var(--transition);
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--border-strong);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}

.btn-danger:hover {
  background: var(--danger-h);
}

/* ── 7. Form Elements ───────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 400;
}

.form-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.form-input::placeholder {
  color: var(--text-subtle);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap .form-input {
  padding-right: 40px;
}

.input-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-subtle);
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: var(--r-sm);
  transition: color var(--transition);
}

.input-toggle:hover {
  color: var(--text-muted);
}

/* ── 8. Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: #92400e;
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-red    { background: rgba(239,68,68,.12);  color: #ef4444; }
.badge-blue   { background: rgba(59,130,246,.12); color: #3b82f6; }
.badge-green  { background: rgba(34,197,94,.12);  color: #22c55e; }
.badge-gray   { background: rgba(148,163,184,.12); color: #94a3b8; }
.badge-purple { background: rgba(168,85,247,.12); color: #a855f7; }

.feedback-row-closed { opacity: .55; }

/* ── Feedback-Modal ──────────────────────────────────────────────────────── */
.feedback-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 540px) {
  .feedback-modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

.feedback-modal-overlay.open { display: flex; }

.feedback-modal-overlay.open .feedback-modal {
  animation: fbSlideUp .28s cubic-bezier(.32,.72,0,1) forwards;
}

@keyframes fbSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

.feedback-modal {
  background: #131c2e;
  border: 1px solid rgba(255,255,255,.08);
  border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 0;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 40px rgba(0,0,0,.4);
}

@media (min-width: 540px) {
  .feedback-modal {
    border-radius: var(--r-xl);
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 24px 64px rgba(0,0,0,.5);
  }
}

/* drag handle (mobile) */
.feedback-modal::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

@media (min-width: 540px) {
  .feedback-modal::before { display: none; }
}

.feedback-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.feedback-modal-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feedback-modal-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: rgba(99,102,241,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
  flex-shrink: 0;
}

.feedback-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0;
  line-height: 1.3;
}

.feedback-modal-subtitle {
  font-size: 11.5px;
  color: #64748b;
  margin: 1px 0 0;
}

.feedback-modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: none;
  background: none;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.feedback-modal-close:hover {
  background: rgba(255,255,255,.07);
  color: #f1f5f9;
}

/* Category tabs */
.feedback-tabs {
  display: flex;
  gap: 6px;
  padding: 16px 24px 0;
}

.feedback-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: #64748b;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .15s ease;
  font-family: inherit;
}

.feedback-tab:hover {
  background: rgba(255,255,255,.06);
  color: #94a3b8;
}

.feedback-tab.active[data-cat="bug"] {
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.3);
  color: #fca5a5;
}

.feedback-tab.active[data-cat="improvement"] {
  background: rgba(99,102,241,.12);
  border-color: rgba(99,102,241,.3);
  color: #a5b4fc;
}

/* Form body */
.feedback-modal-body {
  padding: 14px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.feedback-label {
  font-size: 11.5px;
  font-weight: 500;
  color: #64748b;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.feedback-input,
.feedback-textarea {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-md);
  color: #f1f5f9;
  font-size: 13.5px;
  padding: 9px 12px;
  box-sizing: border-box;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
  font-family: inherit;
  line-height: 1.5;
}

.feedback-input::placeholder,
.feedback-textarea::placeholder {
  color: #334155;
}

.feedback-textarea {
  resize: none;
  height: 100px;
}

.feedback-input:focus,
.feedback-textarea:focus {
  border-color: rgba(99,102,241,.5);
  background: rgba(99,102,241,.04);
  box-shadow: 0 0 0 3px rgba(99,102,241,.08);
}

.feedback-char-count {
  font-size: 11px;
  color: #334155;
  text-align: right;
  margin-top: -6px;
  transition: color .15s;
}
.feedback-char-count.warn { color: #f59e0b; }

/* Screenshot upload zone */
.feedback-upload-zone {
  border: 1.5px dashed rgba(255,255,255,.1);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all .15s;
  background: rgba(255,255,255,.02);
  position: relative;
  overflow: hidden;
}
.feedback-upload-zone:hover,
.feedback-upload-zone.dragover {
  border-color: rgba(99,102,241,.4);
  background: rgba(99,102,241,.06);
}
.feedback-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.feedback-upload-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  flex-shrink: 0;
  transition: all .15s;
}
.feedback-upload-zone:hover .feedback-upload-icon,
.feedback-upload-zone.dragover .feedback-upload-icon {
  background: rgba(99,102,241,.15);
  color: #a5b4fc;
}
.feedback-upload-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.feedback-upload-title {
  font-size: 12.5px;
  font-weight: 500;
  color: #64748b;
}
.feedback-upload-hint {
  font-size: 11px;
  color: #334155;
}

/* Preview */
.feedback-preview {
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-md);
  padding: 8px 12px;
}
.feedback-preview.show { display: flex; }
.feedback-preview-img {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.feedback-preview-name {
  font-size: 12px;
  color: #94a3b8;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.feedback-preview-remove {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  border: none;
  background: rgba(239,68,68,.12);
  color: #fca5a5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.feedback-preview-remove:hover { background: rgba(239,68,68,.22); }

/* Multi-image preview grid */
.fb-multi-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.fb-thumb-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 8px;
  padding: 6px 8px 8px;
  width: 90px;
}
.fb-thumb-img {
  width: 74px;
  height: 56px;
  object-fit: cover;
  border-radius: 5px;
}
.fb-thumb-name {
  font-size: 10px;
  color: #64748b;
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fb-thumb-wrap .feedback-preview-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 18px;
  height: 18px;
}

.feedback-error {
  display: none;
  align-items: center;
  gap: 6px;
  color: #fca5a5;
  font-size: 12px;
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--r-md);
  padding: 8px 12px;
}
.feedback-error.show { display: flex; }

/* Footer actions */
.feedback-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 24px 20px;
  padding-bottom: max(20px, calc(20px + env(safe-area-inset-bottom)));
}

.feedback-btn-cancel {
  padding: 8px 16px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,.08);
  background: none;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.feedback-btn-cancel:hover {
  background: rgba(255,255,255,.05);
  color: #94a3b8;
}

.feedback-btn-submit {
  padding: 8px 20px;
  border-radius: var(--r-md);
  border: none;
  background: #6366f1;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all .15s;
  position: relative;
  overflow: hidden;
}
.feedback-btn-submit:hover:not(:disabled) {
  background: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
}
.feedback-btn-submit:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Toast */
.feedback-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1e293b;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-full);
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  z-index: 1100;
  opacity: 0;
  transition: opacity .22s, transform .22s cubic-bezier(.32,.72,0,1);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  white-space: nowrap;
}
.feedback-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.feedback-toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
}

.role-superadmin {
  background: #fae8ff;
  color: #7e22ce;
}

.role-admin {
  background: #fef3c7;
  color: #92400e;
}

.role-user {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── 9. Alerts ──────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.alert-success {
  background: var(--success-light);
  border: 1px solid var(--success-border);
  color: #065f46;
}

.alert-error {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: var(--danger-h);
}

.alert-warning {
  background: var(--warning-light);
  border: 1px solid var(--warning-border);
  color: #92400e;
}

/* ── 10. AUTH LAYOUT ────────────────────────────────────────────────────── */

.auth-split {
  display: flex;
  width: 100%;
  height: 100%;
}

/* Left dark panel */
.auth-panel-left {
  width: 42%;
  min-width: 380px;
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  padding: 40px 48px;
  gap: 40px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.auth-panel-left::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -80px;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,.18) 0%, transparent 70%);
  pointer-events: none;
}

.auth-panel-left::after {
  content: "";
  position: absolute;
  bottom: -100px;
  left: -60px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,.10) 0%, transparent 70%);
  pointer-events: none;
}

/* Logos — native look, no pill wrapper */
.logo-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-pill .logo-ukd {
  height: 24px;
  width: auto;
  border-radius: 4px;
}

.logo-pill .logo-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,.2);
  border-radius: 1px;
  flex-shrink: 0;
}

.logo-pill .logo-inkpi {
  height: 32px;
  width: auto;
  border-radius: 4px;
}

.auth-left-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  position: relative;
  z-index: 1;
}

.auth-left-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--sb-text);
  line-height: 1.25;
  letter-spacing: -0.5px;
}

.auth-left-subtitle {
  font-size: 14px;
  color: var(--sb-text-muted);
  line-height: 1.65;
  margin-top: 10px;
  max-width: 360px;
}

.auth-left-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-left-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.auth-feature-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: rgba(99,102,241,.18);
  border: 1px solid rgba(99,102,241,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
}

.auth-feature-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-feature-text strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--sb-text);
}

.auth-feature-text span {
  font-size: 12.5px;
  color: var(--sb-text-muted);
  line-height: 1.5;
}

.auth-left-footer {
  font-size: 11.5px;
  color: rgba(148,163,184,.6);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

/* Right form panel */
.auth-panel-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow-y: auto;
  padding: 40px 24px;
}

.auth-form-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-form-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-form-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.auth-form-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Legacy compat for auth-form in old structure */
.auth-form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.auth-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.auth-form-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.auth-form-footer a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.auth-form-footer a:hover {
  color: var(--primary);
}

.auth-form-footer a span {
  color: var(--primary);
  font-weight: 600;
}

.auth-resend-block {
  background: var(--warning-light);
  border: 1px solid var(--warning-border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13.5px;
  color: #92400e;
}

/* ── Auth Minimal (centered single-card pages) ────────────────────────── */
.main-content.auth-minimal {
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
  flex-direction: column;
  background: var(--bg);
}

.auth-minimal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.auth-minimal-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.auth-minimal-logo .logo-ukd  { height: 26px; width: auto; display: block; }
.auth-minimal-logo .logo-inkpi { height: 30px; width: auto; display: block; }
.auth-minimal-logo .logo-divider {
  width: 1.5px;
  height: 24px;
  background: var(--border);
  border-radius: 1px;
  flex-shrink: 0;
}

.auth-status-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.auth-status-icon--success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.auth-status-icon--info {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(99,102,241,.2);
}

.auth-minimal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  margin-bottom: 6px;
  text-align: center;
}

.auth-minimal-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 24px;
  text-align: center;
  line-height: 1.5;
}

.auth-minimal-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 20px 0;
}

.auth-minimal-back {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: 16px;
  transition: color var(--transition);
}

.auth-minimal-back:hover { color: var(--primary); }
.auth-minimal-back span  { color: var(--primary); font-weight: 500; }

/* Keep .auth-card for backward compat */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  font-size: 20px;
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.auth-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.auth-link {
  margin-top: 14px;
  font-size: 13px;
  text-align: center;
  color: var(--text-muted);
}

.auth-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-link a:hover {
  text-decoration: underline;
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

/* ── Confirm Modal (shared, used in interactions + sops) ─────────────────── */
.confirm-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
}

.confirm-modal-backdrop.open { display: flex; }

.confirm-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px 28px 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  animation: modal-in 180ms ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.confirm-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--danger);
}

.confirm-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.2px;
}

.confirm-modal-body {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 22px;
}

.confirm-modal-body strong { color: var(--text); }

.confirm-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Settings Card Header (users toolbar etc.) ───────────────────────────── */
.settings-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-card-header .settings-card-title { margin: 0; padding: 0; border: none; }

.badge-pill {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 3px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  font-weight: 500;
  flex-shrink: 0;
}

/* ── 11. CHAT LAYOUT ────────────────────────────────────────────────────── */

.chat-shell {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Sidebar */
.chat-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--sb-border);
  position: relative;
  z-index: 20;
}

.sb-brand {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.sb-brand .logo-pill .logo-ukd    { height: 22px; border-radius: 0; }
.sb-brand .logo-pill .logo-inkpi  { height: 32px; border-radius: 0; }
.sb-brand .logo-pill .logo-divider { height: 18px; }

/* Sidebar & Auth dark panel: logos als weiße Silhouetten */
.sb-brand .logo-pill .logo-ukd,
.sb-brand .logo-pill .logo-inkpi,
.auth-panel-left .logo-pill .logo-ukd,
.auth-panel-left .logo-pill .logo-inkpi {
  filter: brightness(0) invert(1);
}

.sb-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 9px 14px;
  background: var(--primary);
  border: none;
  border-radius: var(--r-md);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition);
  font-family: inherit;
}

.sb-new-btn:hover {
  background: var(--primary-h);
}

.sb-section-label {
  padding: 10px 16px 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--sb-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  flex-shrink: 0;
}

/* Chat list = #chat-list */
.sb-chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.sb-chat-list::-webkit-scrollbar {
  width: 4px;
}

.sb-chat-list::-webkit-scrollbar-track {
  background: transparent;
}

.sb-chat-list::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

/* .chat-item – KEEP class */
.chat-item {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--r-sm);
  transition: background var(--transition);
  padding: 1px 2px 1px 0;
}

.chat-item:hover {
  background: var(--sb-hover);
}

.chat-item.active {
  background: var(--sb-active);
}

/* .chat-item-link – KEEP class */
.chat-item-link {
  flex: 1;
  padding: 7px 10px;
  color: var(--sb-text-muted);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  border-radius: var(--r-sm);
  transition: color var(--transition);
}

.chat-item.active .chat-item-link {
  color: var(--sb-active-text);
  font-weight: 500;
}

.chat-item:hover .chat-item-link {
  color: var(--sb-text);
}

/* .chat-delete-btn – KEEP class */
.chat-delete-btn {
  flex-shrink: 0;
  padding: 5px 6px;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: transparent;
  cursor: pointer;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-item:hover .chat-delete-btn {
  color: var(--sb-text-muted);
}

.chat-delete-btn:hover {
  background: rgba(220,38,38,.2);
  color: #f87171 !important;
}

.sb-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.sb-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.sb-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sb-user-email {
  font-size: 12px;
  color: var(--sb-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.sb-footer-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.sb-icon-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: var(--sb-text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.sb-icon-btn:hover {
  background: var(--sb-hover);
  color: var(--sb-text);
}

.sb-empty {
  padding: 16px 10px;
  font-size: 12.5px;
  color: var(--sb-text-muted);
  text-align: center;
}

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 40;
}

.sidebar-overlay.open {
  display: block;
}

/* Hamburger button */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  transition: background var(--transition);
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.hamburger-btn:hover {
  background: var(--bg);
}

/* ── Chat Main Area ── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

/* Top bar */
.chat-topbar {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 10px;
}

.chat-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-admin-link {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition);
}

.topbar-admin-link:hover {
  background: #dde4fd;
}

.topbar-email {
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.topbar-btn:hover {
  background: var(--bg);
}

/* Chat history */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.chat-history::-webkit-scrollbar {
  width: 5px;
}

.chat-history::-webkit-scrollbar-track {
  background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

/* Welcome message */
.welcome-msg {
  display: flex;
  justify-content: flex-start;
  padding: 4px 20px;
  width: 100%;
  margin: 0 auto;
  align-self: stretch;
}

.welcome-bubble {
  background: linear-gradient(135deg, var(--primary-light) 0%, #f0f9ff 100%);
  border: 1px solid #c7d2fe;
  border-left: 3px solid var(--primary);
  border-radius: var(--r-lg);
  border-bottom-left-radius: 4px;
  padding: 20px 24px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.welcome-icon {
  margin-bottom: 2px;
}

.welcome-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-h);
  letter-spacing: -0.2px;
}

.welcome-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.welcome-disclaimer {
  margin-top: 4px;
  padding: 8px 12px;
  background: var(--warning-light);
  border: 1px solid var(--warning-border);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}

/* Messages */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin: 0 auto;
  padding: 4px 20px;
  align-self: stretch;
}

.msg-user {
  justify-content: flex-end;
}

.msg-assistant {
  justify-content: flex-start;
}

.msg-highlight {
  animation: msg-pulse 1.8s ease;
}

@keyframes msg-pulse {
  0%   { background: transparent; }
  20%  { background: rgba(99,102,241,.1); }
  80%  { background: rgba(99,102,241,.07); }
  100% { background: transparent; }
}

.hint-shake {
  animation: hint-shake .4s ease;
}

@keyframes hint-shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.msg-avatar {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

.avatar-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  object-fit: contain;
  display: block;
}

.msg-bubble {
  max-width: 100%;
  border-radius: var(--r-lg);
  font-size: 14px;
  line-height: 1.6;
  min-width: 0;
}

.msg-user .msg-bubble {
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 18px 18px 4px 18px;
  max-width: 75%;
  box-shadow: 0 1px 3px rgba(99,102,241,.25);
}

.msg-assistant .msg-bubble {
  flex: 1;
  background: var(--surface);
  color: var(--text);
  padding: 12px 16px;
  font-size: 14.5px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.msg-error {
  background: var(--danger-light) !important;
  color: var(--danger) !important;
  border: 1px solid var(--danger-border) !important;
}

/* ── Markdown / Answer text ── */
/* KEEP .answer-text class */
.answer-text {
  line-height: 1.7;
  color: var(--text);
  font-size: 14.5px;
}

.answer-text > *:first-child { margin-top: 0 !important; }
.answer-text > *:last-child  { margin-bottom: 0 !important; }

.answer-text p  { margin: 0 0 10px; }

.answer-text h1,
.answer-text h2,
.answer-text h3 {
  margin: 16px 0 6px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
}

.answer-text h1 {
  font-size: 1.1em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.answer-text h2 { font-size: 1.0em; }

.answer-text h3 {
  font-size: 0.95em;
  color: var(--text-muted);
}

.answer-text ul {
  padding-left: 0;
  margin: 8px 0;
  list-style: none;
}

.answer-text ul li {
  padding-left: 16px;
  position: relative;
  margin: 5px 0;
}

.answer-text ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}

.answer-text ol {
  padding-left: 20px;
  margin: 8px 0;
}

.answer-text ol li { margin: 5px 0; }

.answer-text strong { font-weight: 700; color: var(--text); }

.answer-text em {
  font-style: italic;
  color: var(--text-muted);
}

.answer-text a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.answer-text a:hover {
  color: var(--primary-h);
}

.answer-text code {
  background: var(--bg-subtle);
  border-radius: var(--r-xs);
  padding: 1px 6px;
  font-size: 0.87em;
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace;
  color: var(--text);
  border: 1px solid var(--border);
}

.answer-text pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 12px 0;
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace;
  font-size: 0.88em;
}

.answer-text pre code {
  background: none;
  border: none;
  padding: 0;
}

.answer-text blockquote {
  border-left: 3px solid var(--primary);
  padding: 6px 14px;
  margin: 10px 0;
  background: var(--primary-light);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-muted);
  font-style: italic;
}

/* Table wrap – KEEP .table-wrap */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 1px var(--border);
}

.answer-text table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  border-radius: var(--r-sm);
  overflow: hidden;
}

.answer-text thead tr {
  background: var(--primary);
  color: #fff;
}

.answer-text th {
  padding: 9px 13px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.answer-text td {
  padding: 8px 13px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

.answer-text tbody tr:last-child td { border-bottom: none; }
.answer-text tbody tr:nth-child(even) td { background: var(--bg-subtle); }
.answer-text tbody tr:hover td { background: var(--primary-light); transition: background 0.1s; }

.answer-img {
  display: block;
  max-width: 100%;
  border-radius: var(--r-md);
  margin: 12px 0;
  box-shadow: var(--shadow-md);
}

/* ── Source badges ── KEEP .src-badge */
.src-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #c7d2fe;
  border-radius: var(--r-xs);
  font-size: 9px;
  font-weight: 700;
  padding: 0 4px;
  min-width: 16px;
  line-height: 16px;
  cursor: pointer;
  vertical-align: super;
  transition: background var(--transition);
  user-select: none;
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace;
}

.src-badge:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Sources – KEEP .sources */
.sources {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.sources summary {
  cursor: pointer;
  background: var(--bg-subtle);
  color: var(--text-muted);
  user-select: none;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  transition: background var(--transition);
}

.sources summary::-webkit-details-marker { display: none; }

.sources summary:hover {
  background: var(--border-soft);
  color: var(--text);
}

.sources[open] summary {
  border-bottom: 1px solid var(--border);
}

/* .source-item – KEEP class */
.source-item {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto auto;
  gap: 6px;
  align-items: baseline;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition);
}

.source-item:last-child {
  border-bottom: none;
}

.source-item:hover {
  background: var(--bg-subtle);
}

/* KEEP .source-highlight */
.source-highlight {
  background: var(--primary-light) !important;
}

/* KEEP all source classes */
.source-num {
  font-weight: 700;
  color: var(--text-subtle);
  font-size: 11px;
  white-space: nowrap;
}

.source-ampel {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 0 0 2px rgba(0,0,0,.08);
}

.source-sop {
  font-weight: 600;
  color: var(--primary);
  font-size: 11px;
}

.source-heading {
  color: var(--text-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.source-score {
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
}

.source-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  min-width: 52px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  background: var(--surface);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.source-download:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 1px 4px rgba(99,102,241,.15);
}

/* KEEP .response-time */
.response-time {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 8px;
}

/* KEEP .rating */
.rating {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  align-items: center;
}

.rating::before {
  content: "Hilfreich?";
  font-size: 11px;
  color: var(--text-subtle);
  margin-right: 2px;
}

/* KEEP .rate-btn */
.rate-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  width: 30px;
  height: 30px;
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rate-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  transform: scale(1.1);
}

.rate-btn-active {
  background: rgba(99, 102, 241, 0.18);
  border: 2px solid var(--primary);
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.rating--locked::before {
  display: none;
}

/* KEEP .rated */
.rated {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Chat input area */
.chat-input-area {
  flex-shrink: 0;
  padding: 12px 20px 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  align-self: stretch;
}

/* KEEP .loading-indicator structure */
.loading-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.loading-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}

.loading-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: bounce .9s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: .15s; }
.loading-dots span:nth-child(3) { animation-delay: .30s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%            { transform: scale(1);   opacity: 1;   }
}

/* KEEP .rating-hint */
.rating-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 7px 12px;
  background: var(--warning-light);
  border: 1px solid var(--warning-border);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
}

/* KEEP .ask-form */
.ask-form {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 6px 6px 6px 10px;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.ask-form:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring), var(--shadow-md);
}

/* KEEP #question-input reference */
.ask-form input {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
  color: var(--text);
  font-family: inherit;
}

.ask-form input::placeholder { color: var(--text-subtle); }
.ask-form input:disabled { opacity: 0.5; }

.btn-lang {
  padding: 7px 11px;
  background: transparent;
  color: var(--text-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  transition: color var(--transition), border-color var(--transition);
}

.btn-lang:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  transition: background var(--transition);
}

.btn-send:hover { background: var(--primary-h); }
.btn-send:disabled { background: #a5b4fc; cursor: not-allowed; }

.chat-disclaimer {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-subtle);
  text-align: center;
  line-height: 1.45;
}

/* Legacy: chat-layout compat wrapper */
.chat-layout {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ── 12. ADMIN LAYOUT ────────────────────────────────────────────────────── */
.admin-layout {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon-indigo {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-card-icon-green {
  background: var(--success-light);
  color: var(--success);
}

.stat-card-icon-amber {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-card-icon-rose {
  background: var(--success-light);
  color: var(--success);
}

.stat-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.admin-section-toolbar .admin-section-title {
  margin: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.admin-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.admin-section-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.admin-add-user-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  font-size: 13.5px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--transition);
}

.admin-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.admin-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--bg-subtle); }
.interaction-row { cursor: pointer; }
.interaction-row:hover td { background: var(--primary-light) !important; }
.interaction-row.row-alt td { background: var(--bg-subtle); }
.interaction-row.row-alt:hover td { background: var(--primary-light) !important; }
.th-center { text-align: center !important; }

.td-muted    { color: var(--text-muted); font-size: 12.5px; }
.td-nowrap   { white-space: nowrap; }
.th-nowrap   { white-space: nowrap; }
.td-center   { text-align: center; }
.td-question { max-width: 200px; }
.td-answer   { max-width: 260px; }
.td-text-clip {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rating-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  font-size: 14px;
}

.role-select {
  font-size: 12px;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.btn-delete-all-interactions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid #fca5a5;
  background: #fff1f2;
  color: #dc2626;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.btn-delete-all-interactions:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.btn-delete-user {
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid var(--danger-border);
  color: var(--danger);
  border-radius: var(--r-sm);
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.btn-delete-user:hover {
  background: var(--danger-light);
}

/* Detail row for interactions */
.detail-row td {
  padding: 0;
}

.detail-cell {
  padding: 16px 20px !important;
  background: var(--bg-subtle) !important;
  border-top: 1px solid var(--border);
}

.detail-content {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.detail-col {
  flex: 1;
  min-width: 220px;
}

.detail-col-full {
  flex: 100%;
}

.detail-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.detail-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}
.detail-text.admin-answer {
  white-space: normal;
  overflow-x: auto;
}

.detail-timing-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-timing-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 5px 12px;
  font-size: 12px;
}

.detail-timing-icon {
  font-size: 13px;
}

.detail-timing-label {
  color: var(--text-muted);
  font-weight: 500;
}

.detail-timing-value {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Status indicators */
.status-active,
.status-inactive {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
}

.status-active  { color: var(--success); }
.status-inactive { color: var(--text-subtle); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-active  .status-dot { background: var(--success); }
.status-inactive .status-dot { background: var(--border-strong); }

/* ── 12b. STUDY STATS PANEL ─────────────────────────────────────────────── */

.study-stats-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.study-stats-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.study-stats-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.study-stats-meta {
  font-size: 12px;
  color: var(--text-subtle);
}

.study-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: start;
}

/* ── Card shell ── */
.sstat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

/* ── Colored top band ── */
.sstat-card-top {
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sstat-card-top--blue    { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); }
.sstat-card-top--violet  { background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%); }
.sstat-card-top--quality { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); }

.sstat-card-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sstat-card-icon--blue    { background: #bfdbfe; color: #1d4ed8; border: 1px solid #93c5fd; }
.sstat-card-icon--violet  { background: #ddd6fe; color: #6d28d9; border: 1px solid #c4b5fd; }
.sstat-card-icon--quality { background: #bbf7d0; color: #15803d; border: 1px solid #86efac; }

.sstat-card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sstat-card-label--blue    { color: #1e40af; }
.sstat-card-label--violet  { color: #5b21b6; }
.sstat-card-label--quality { color: #166534; }

.sstat-card-sublabel {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Card body ── */
.sstat-card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Primary metric ── */
.sstat-primary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}

.sstat-primary-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sstat-primary-value--blue   { color: #1d4ed8; }
.sstat-primary-value--violet { color: #6d28d9; }
.sstat-primary-value--green  { color: #15803d; }

.sstat-primary-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
}

/* ── Secondary rows ── */
.sstat-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sstat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
}

.sstat-row + .sstat-row {
  border-top: 1px solid var(--border-soft);
}

.sstat-row-label {
  font-size: 12px;
  color: var(--text-muted);
}

.sstat-row-value {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sstat-row-value--blue   { color: #2563eb; }
.sstat-row-value--violet { color: #7c3aed; }
.sstat-row-value--green  { color: #15803d; }
.sstat-row-value--muted  { color: var(--text-muted); font-weight: 500; }

/* ── Boxplot strip ── */
.boxplot-wrap {
  padding: 10px 16px 6px;
  border-top: 1px solid var(--border-soft);
  margin-top: 4px;
}
.boxplot-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
  margin-bottom: 6px;
}
.boxplot-strip { user-select: none; }

/* Floating tooltip */
.bp-tooltip {
  position: fixed;
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 6px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  font-size: 11.5px;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}
.bp-tt-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: var(--text-subtle);
}
.bp-tt-value {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

/* ── Card footer ── */
.sstat-card-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-subtle);
  font-size: 11px;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Rating bar (Block 3) ── */
.sstat-rating-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}

.sstat-rating-bar {
  display: flex;
  height: 10px;
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.sstat-rating-seg {
  height: 100%;
  transition: width .3s ease;
  min-width: 0;
}

.sstat-rating-seg--pos { background: #16a34a; }
.sstat-rating-seg--neu { background: #ca8a04; }
.sstat-rating-seg--neg { background: #dc2626; }

/* Round the first/last visible segment */
.sstat-rating-seg:first-child { border-radius: var(--r-full) 0 0 var(--r-full); }
.sstat-rating-seg:last-child  { border-radius: 0 var(--r-full) var(--r-full) 0; }
.sstat-rating-seg:only-child  { border-radius: var(--r-full); }

.sstat-rating-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sstat-rating-legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sstat-rating-legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sstat-rating-legend-dot--pos { background: #16a34a; }
.sstat-rating-legend-dot--neu { background: #ca8a04; }
.sstat-rating-legend-dot--neg { background: #dc2626; }

.sstat-rating-legend-label {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.sstat-rating-legend-count {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 24px;
  text-align: right;
}

.sstat-rating-legend-pct {
  font-size: 11px;
  color: var(--text-subtle);
  min-width: 34px;
  text-align: right;
}

/* ── Empty state ── */
.sstat-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text-subtle);
  font-size: 13px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .study-stats-grid { grid-template-columns: 1fr; }
}

/* ── 13. ADMIN SETTINGS ──────────────────────────────────────────────────── */
.settings-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  width: 100%;
}

.settings-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.settings-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.settings-header p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.settings-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-card-title svg {
  color: var(--primary);
  flex-shrink: 0;
}

.settings-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.settings-input {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13.5px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.settings-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.settings-input-sm {
  max-width: 120px;
}

.settings-hint {
  font-size: 11.5px;
  color: var(--text-subtle);
  font-weight: 400;
  line-height: 1.4;
}

.settings-input:disabled {
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
  border-color: var(--border-soft);
  opacity: 0.75;
}

.settings-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-subtle);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px 8px;
  width: fit-content;
}

/* ── Toggle-Switch (Berechtigungen) ─────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-track::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-track::before {
  transform: translateX(16px);
}

.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
  gap: 12px;
}

.permission-row:last-child {
  border-bottom: none;
}

.permission-row-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.permission-row-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.permission-row-section {
  font-size: 11px;
  color: var(--text-subtle);
}

/* ── Blocklist ───────────────────────────────────────────────────────────── */
.blocklist-add-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.blocklist-add-form .settings-input {
  flex: 1;
  min-width: 0;
}

.blocklist-entries {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.blocklist-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  border-radius: var(--r-full);
  padding: 4px 10px 4px 12px;
  font-size: 12.5px;
  color: var(--text);
}

.blocklist-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--danger);
  padding: 0;
  border-radius: 50%;
  transition: background var(--transition);
  flex-shrink: 0;
}

.blocklist-chip-remove:hover {
  background: var(--danger-border);
}

.blocklist-empty {
  font-size: 13px;
  color: var(--text-subtle);
  font-style: italic;
}

/* ── Interaction Filter + Pagination ────────────────────────────────────── */
.interaction-filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.filter-search {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.filter-select {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--transition);
}

.filter-select:focus {
  border-color: var(--primary);
}

.filter-count {
  font-size: 12px;
  color: var(--text-subtle);
  white-space: nowrap;
  margin-left: auto;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 12.5px;
  color: var(--text-muted);
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-ellipsis {
  font-size: 13px;
  color: var(--text-subtle);
  padding: 0 4px;
}

.settings-actions {
  grid-column: 1 / -1;
  padding-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Settings Menu (Übersicht) ──────────────────────────────────────────── */
.settings-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.settings-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.settings-menu-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  background: var(--primary-light);
}

.settings-menu-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.settings-menu-body { flex: 1; }

.settings-menu-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.settings-menu-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-menu-chevron { color: var(--text-subtle); flex-shrink: 0; }

/* ── Settings Overview Redesign ─────────────────────────────────────────── */
.settings-overview-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.settings-overview-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-d) 100%);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,.35);
}

.settings-overview-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.settings-overview-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.settings-group {
  margin-bottom: 32px;
}

.settings-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-group-label--locked {
  color: var(--warning);
  opacity: 0.85;
}

.settings-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.settings-nav-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 20px 20px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  position: relative;
  overflow: hidden;
}

.settings-nav-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.settings-nav-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(99,102,241,.12), var(--shadow-md);
  transform: translateY(-1px);
}

.settings-nav-card:hover::before {
  opacity: 1;
}

.settings-nav-card-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.settings-nav-card-icon--blue {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.settings-nav-card-icon--violet {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}

.settings-nav-card-icon--amber {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #d97706;
  border: 1px solid #fde68a;
}

.settings-nav-card-icon--teal {
  background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
  color: #0d9488;
  border: 1px solid #99f6e4;
}

.settings-nav-card-body {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.settings-nav-card-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}

.settings-nav-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.45;
}

.settings-nav-card-arrow {
  color: var(--text-subtle);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: color 180ms ease, transform 180ms ease;
}

.settings-nav-card:hover .settings-nav-card-arrow {
  color: var(--primary);
  transform: translateX(2px);
}

/* ── Settings Sub-Page Back-Link ────────────────────────────────────────── */
.settings-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  margin-bottom: 12px;
}

.settings-back:hover { text-decoration: underline; }

/* ── 14. ACCOUNT ────────────────────────────────────────────────────────── */
.account-page-center {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 24px;
  width: 100%;
}

.account-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.account-section {
  padding: 24px 28px;
}

.account-section + .account-section {
  border-top: 1px solid var(--border);
}

.account-section-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.2px;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.account-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.account-section.danger-zone {
  background: var(--danger-light);
}

.account-section.danger-zone .account-section-title {
  color: var(--danger-h);
}

.danger-reveal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.danger-reveal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1.5px solid var(--danger-border);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--danger-h);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), border-color var(--transition);
}

.danger-reveal-toggle:hover {
  background: var(--danger-light);
  border-color: var(--danger);
}

.danger-reveal-form {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.danger-reveal-form.open {
  display: flex;
}

/* Legacy danger-zone compat */
.danger-zone h2 {
  color: var(--danger-h);
  font-size: 15px;
  margin-bottom: 8px;
}

/* ── 15. DOCUMENT MANAGEMENT (dm-*) ─────────────────────────────────────── */

.dm-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Toast */
.dm-toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-md);
  font-size: 13.5px;
}

.dm-toast-success {
  background: var(--success-light);
  border: 1px solid var(--success-border);
  color: #15803d;
}

/* Header */
.dm-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.dm-title {
  font-size: 22px; font-weight: 700; letter-spacing: -.4px;
  color: var(--text); line-height: 1.2;
}

.dm-subtitle { font-size: 13.5px; color: var(--text-muted); margin-top: 4px; }

.dm-stats {
  display: flex; align-items: center; gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.dm-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 22px; gap: 2px;
}

.dm-stat-divider { width: 1px; background: var(--border); align-self: stretch; }
.dm-stat-value   { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1; }
.dm-stat-green   { color: #16a34a; }
.dm-stat-amber   { color: #d97706; }
.dm-stat-label   { font-size: 11px; font-weight: 500; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .4px; }

/* Drop Zone */
.dm-dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 36px 24px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.dm-dropzone:hover,
.dm-dz-over {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 4px var(--primary-ring);
}

.dm-dropzone-content {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  position: relative; z-index: 1; text-align: center;
}

.dm-dropzone-icon {
  width: 52px; height: 52px; border-radius: var(--r-lg);
  background: var(--primary-light); border: 1px solid #c7d2fe;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}

.dm-dropzone-icon-ready {
  background: var(--success-light);
  border-color: var(--success-border);
  color: var(--success);
}

.dm-dropzone-text {
  display: flex; align-items: center; gap: 7px;
  font-size: 14.5px; color: var(--text-muted);
}

.dm-dropzone-text strong { color: var(--text); font-weight: 600; }
.dm-dropzone-text span   { font-size: 13px; }

.dm-browse-btn {
  display: inline-flex; align-items: center;
  padding: 5px 13px;
  background: var(--primary); color: white;
  border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background var(--transition);
}

.dm-browse-btn:hover { background: var(--primary-h); }

.dm-dropzone-hint { font-size: 12px; color: var(--text-subtle); }

.dm-upload-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px;
  background: var(--primary); color: white;
  border: none; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 6px rgba(99,102,241,.3);
  transition: background var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.dm-upload-btn:hover {
  background: var(--primary-h);
  box-shadow: 0 3px 10px rgba(99,102,241,.4);
}

.dm-change-link {
  font-size: 12.5px; color: var(--text-muted); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}

.dm-change-link:hover { color: var(--primary); }

/* Upload Queue */
.dm-queue {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  margin-bottom: 16px;
}
.dm-queue-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.dm-queue-title { font-size: 13px; font-weight: 600; color: var(--text); }
.dm-queue-clear {
  font-size: 12px; color: var(--text-muted); background: none;
  border: none; cursor: pointer; padding: 0; text-decoration: underline;
  text-underline-offset: 2px;
}
.dm-queue-clear:hover { color: var(--text); }
.dm-queue-list { list-style: none; margin: 0; padding: 0; }
.dm-queue-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.dm-queue-item:last-child { border-bottom: none; }
.dm-qi-icon { flex-shrink: 0; display: flex; align-items: center; }
.dm-qi-info { flex: 1; min-width: 0; }
.dm-qi-name {
  display: block; font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-qi-size { font-size: 11.5px; color: var(--text-subtle); }
.dm-qi-status {
  flex-shrink: 0; font-size: 12px; font-weight: 500;
  padding: 2px 9px; border-radius: 99px;
}
.dm-qi-waiting   { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.dm-qi-uploading { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.dm-qi-processing{ background: #fefce8; color: #b45309; border: 1px solid #fde68a; }
.dm-qi-done      { background: var(--success-light); color: #15803d; border: 1px solid var(--success-border); }
.dm-qi-error     { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.dm-qi-remove {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  color: var(--text-subtle); font-size: 12px; padding: 3px 6px;
  border-radius: var(--r-sm); line-height: 1;
}
.dm-qi-remove:hover { background: var(--bg); color: var(--text); }
.dm-queue-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg); }

/* Shared Buttons */
.dm-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap;
  font-family: inherit;
  transition: background .13s, border-color .13s, color .13s, box-shadow .13s;
}

.dm-btn-ghost {
  background: var(--surface); border-color: var(--border);
  color: var(--text-muted);
}

.dm-btn-ghost:hover {
  background: var(--bg); border-color: #c7d2fe; color: var(--primary);
}

.dm-btn-outline {
  background: var(--surface); border-color: var(--border);
  color: var(--text-muted);
}

.dm-btn-outline:hover {
  background: var(--primary-light); border-color: #c7d2fe; color: var(--primary);
}

.dm-btn-danger {
  background: var(--surface); border-color: var(--danger-border); color: var(--danger);
}

.dm-btn-danger:hover {
  background: var(--danger-light); border-color: var(--danger); color: var(--danger-h);
}

.dm-btn-danger-solid {
  background: var(--danger-h); border-color: var(--danger-h); color: white;
}

.dm-btn-danger-solid:hover { background: #b91c1c; border-color: #b91c1c; }

/* Table card */
.dm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.dm-card-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.dm-card-toolbar-left  { display: flex; align-items: center; gap: 10px; }
.dm-card-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.dm-card-title {
  font-size: 15px; font-weight: 700; color: var(--text); margin: 0;
}

.dm-badge-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 20px; padding: 0 7px;
  background: var(--primary); color: white;
  font-size: 11px; font-weight: 700; border-radius: var(--r-full);
}

.dm-search-wrap {
  position: relative; display: flex; align-items: center;
}

.dm-search-icon {
  position: absolute; left: 10px; color: var(--text-subtle); pointer-events: none;
}

.dm-search {
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg); font-size: 13px; color: var(--text);
  width: 220px; outline: none;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.dm-search:focus {
  border-color: var(--primary); background: white;
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* Table */
.dm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.dm-table th {
  padding: 11px 20px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text-subtle);
  text-transform: uppercase; letter-spacing: .5px;
  background: var(--bg-subtle); border-bottom: 1px solid var(--border);
}

.dm-table td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.dm-table tbody tr:last-child td { border-bottom: none; }
.dm-table tbody tr:hover td { background: var(--primary-light); }

.dm-file-cell { display: flex; align-items: center; gap: 12px; }

.dm-file-icon-wrap {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); border-radius: var(--r-sm);
}

.dm-file-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dm-file-name { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.dm-file-id   { font-size: 11px; color: var(--text-subtle); font-family: "SF Mono", "Fira Code", monospace; }

.dm-cell-muted { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

/* Status */
.dm-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

.dm-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.dm-status-ok   { background: var(--success-light); color: #15803d; }
.dm-status-ok   .dm-status-dot { background: #22c55e; }
.dm-status-proc { background: var(--primary-light); color: var(--primary); }
.dm-status-pend { background: var(--warning-light); color: #b45309; }
.dm-status-pend .dm-status-dot { background: var(--warning); }
.dm-status-err  { background: var(--danger-light); color: var(--danger-h); }
.dm-status-err  .dm-status-dot { background: var(--danger); }

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

.dm-status-spin {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid #c7d2fe; border-top-color: var(--primary);
  animation: dm-spin .75s linear infinite;
}

/* Actions */
.dm-actions { display: flex; align-items: center; gap: 8px; }

/* Empty state */
.dm-empty {
  padding: 60px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.dm-empty p    { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; }
.dm-empty span { font-size: 13px; color: var(--text-muted); }

.dm-no-results { padding: 24px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* Modal */
.dm-modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.dm-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  padding: 28px 28px 24px;
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column; gap: 14px;
  animation: dm-modal-in .18s ease;
}

@keyframes dm-modal-in {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.dm-modal-icon {
  width: 44px; height: 44px; border-radius: var(--r-lg);
  background: var(--danger-light); border: 1px solid var(--danger-border);
  display: flex; align-items: center; justify-content: center;
}

.dm-modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.dm-modal-body  { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; }
.dm-modal-body strong { color: var(--text); font-family: "SF Mono","Fira Code",monospace; font-size: 12px; word-break: break-all; }

.dm-modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 6px; border-top: 1px solid var(--border);
}

/* ── Spinner utility ──────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

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

/* ── 16. RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Navbar */
  .navbar {
    padding: 0 14px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    gap: 8px;
    height: 52px;
  }

  .navbar-email { display: none; }
  .navbar-user  { gap: 6px; }
  .btn-logout   { font-size: 12px; padding: 5px 10px; }

  /* Hamburger visible */
  .hamburger-btn { display: flex; }

  /* Auth: hide left panel, show form full-width */
  .auth-panel-left { display: none; }

  .auth-panel-right {
    padding: 32px 20px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .auth-form-card {
    padding: 28px 22px;
    box-shadow: none;
    border: none;
    max-width: 100%;
  }

  .logo-pill {
    gap: 8px;
  }

  /* Sidebar as fixed drawer — iOS height fix */
  .chat-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    width: 280px !important;
    z-index: 100;
    transition: transform .25s ease;
  }

  .chat-sidebar.open {
    transform: translateX(0);
  }

  /* Hamburger visible */
  .hamburger-btn { display: flex; }

  /* Chat spacing + safe area */
  .chat-history {
    padding: 16px 0 8px;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .chat-input-area {
    padding: 8px 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .msg         { padding: 4px 12px; }
  .welcome-msg { padding: 4px 12px; }

  /* Admin */
  .admin-layout        { padding: 16px 12px 40px; gap: 16px; }
  .admin-stats         { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value          { font-size: 22px; }
  .stat-card           { padding: 14px 16px; }
  .study-stats-grid    { grid-template-columns: 1fr; }
  .sstat-primary-value { font-size: 26px; }

  .admin-nav      { gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-nav-link { padding: 5px 10px; font-size: 12px; white-space: nowrap; }

  /* Admin table: horizontal scroll on mobile */
  .admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .admin-table { min-width: 780px; }

  /* Settings */
  .settings-shell { padding: 16px 12px 40px; }
  .settings-grid  { grid-template-columns: 1fr; }
  .settings-cards-grid { grid-template-columns: 1fr; }
  .settings-overview-header { gap: 14px; margin-bottom: 24px; padding-bottom: 20px; }
  .settings-overview-icon { width: 44px; height: 44px; }
  .settings-overview-title { font-size: 18px; }

  /* Account */
  .account-page-center { padding: 16px 12px; }
  .account-section     { padding: 18px 20px; }

  /* DM — SOP table scrollable */
  .dm-shell  { padding: 16px 12px 40px; }
  .dm-card   { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dm-table  { min-width: 540px; }
  .dm-search { width: 140px; }
  .dm-card-toolbar { flex-wrap: wrap; gap: 8px; }
  .dm-card-toolbar-right { flex-wrap: wrap; gap: 6px; }

  /* Touch-friendly tap targets */
  .btn-primary, .dm-btn, .btn-logout {
    min-height: 44px;
  }
  .rate-btn { width: 40px; height: 40px; }
}

@media (max-width: 480px) {
  .navbar-logo-ukd   { height: 24px; }
  .navbar-logo-inkpi { height: 22px; }
  .btn-logout        { font-size: 11px; padding: 4px 8px; }
  .navbar-account-link { display: none; }

  .auth-form-card {
    padding: 22px 16px;
    border-radius: var(--r-lg);
  }

  .logo-pill .logo-ukd   { height: 20px; }
  .logo-pill .logo-inkpi { height: 22px; }

  .admin-stats { grid-template-columns: repeat(2, 1fr); }

  .source-item {
    grid-template-columns: auto auto auto 1fr auto auto;
    gap: 4px;
    font-size: 10.5px;
  }
  .source-heading {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .rate-btn { width: 36px; height: 36px; font-size: 16px; }
  .msg-user .msg-bubble { max-width: 88%; }

  /* DM upload zone compact */
  .dm-dropzone { padding: 20px 16px; }
  .dm-stat-divider { display: none; }
}

/* ── Tiny phones (iPhone SE, etc.) ─────────────────────────────────────── */
@media (max-width: 375px) {
  .admin-nav-link { padding: 5px 8px; font-size: 11.5px; }
  .dm-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .dm-stats  { gap: 12px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Support Page
   ══════════════════════════════════════════════════════════════════════════ */

.support-page {
  width: 100%;
  display: flex;
  justify-content: center;
}

.support-card {
  width: 100%;
  max-width: 640px;
  background: var(--sb-surface);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

/* Header */
.support-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  padding: 40px 36px 32px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: relative;
  overflow: hidden;
}
.support-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 80% 20%, rgba(99,102,241,.25) 0%, transparent 60%);
  pointer-events: none;
}
.support-logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.support-logo-ukd {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: .9;
}
.support-logo-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,.25);
}
.support-logo-inkpi {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: .9;
}
.support-title {
  font-size: 26px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -.4px;
  margin-bottom: 6px;
}
.support-subtitle {
  font-size: 14px;
  color: var(--sb-text-muted);
  line-height: 1.5;
}

/* Sections */
.support-section {
  padding: 28px 36px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.support-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 12px;
}
.support-text {
  font-size: 14px;
  color: var(--sb-text-muted);
  line-height: 1.65;
  text-align: justify;
  hyphens: auto;
}

/* Badges */
.support-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.support-badge {
  font-size: 12px;
  font-weight: 500;
  color: #a5b4fc;
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: var(--r-full);
  padding: 3px 10px;
}

/* Contact list */
.support-contact-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}
.support-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.support-contact-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
  flex-shrink: 0;
  margin-top: 1px;
}
.support-contact-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--sb-text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 3px;
}
.support-contact-value {
  font-size: 13.5px;
  color: var(--sb-text);
  line-height: 1.5;
  text-decoration: none;
}
a.support-contact-value:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

/* Footer */
.support-footer {
  padding: 24px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.support-copyright {
  font-size: 12px;
  color: var(--sb-text-muted);
}
.support-login-link {
  font-size: 13px;
  font-weight: 500;
  color: #a5b4fc;
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid rgba(99,102,241,.35);
  border-radius: var(--r-full);
  transition: background var(--transition), color var(--transition);
}
.support-login-link:hover {
  background: rgba(99,102,241,.15);
  color: #c7d2fe;
}

/* Copyright footer in base navbar pages */
.site-footer {
  flex-shrink: 0;
  padding: 10px 20px;
  text-align: center;
  font-size: 11px;
  color: var(--text-subtle);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

@media (max-width: 600px) {
  .support-header  { padding: 28px 22px 24px; }
  .support-section { padding: 22px 22px; }
  .support-footer  { padding: 20px 22px; }
  .support-title   { font-size: 22px; }
}
