/* admin.css — shared styles for the admin multi-page area (admin-*.html).
 *
 * Build-step 71 split the former single-page admin.html (JS tab switching) into
 * one standalone HTML page per area. This file holds the styling every one of
 * those pages shares (extracted verbatim from admin.html's old inline <style>),
 * so the look stays identical across pages without duplicating ~630 lines of CSS
 * ten times. The grouped sidebar's item styling (.sidebar-nav-*) lives in
 * shared.css and is shared with the in-app help page; only the .admin-nav-sidebar
 * positioning/collapse below is admin-specific.
 *
 * All colours come from the shared theme variables in shared.css, so light and
 * dark both work. Loaded after shared.css on every admin page.
 */

/* ── Auth ── */
#authSection { max-width: 440px; margin: 48px auto 0; padding: 0 20px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo-sub { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.card-body { padding: 24px; }
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 6px;
}
.field input:not([type="checkbox"]):not([type="radio"]), .field select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 4px; font-family: inherit; font-size: 15px;
  color: var(--text); background: var(--surface);
  transition: border-color 0.15s; outline: none;
}
.field input:not([type="checkbox"]):not([type="radio"]):focus, .field select:focus { border-color: var(--red); }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
#authSection .btn-primary { width: 100%; padding: 12px 28px; font-size: 15px; }
.settings-section-title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 14px;
}
.settings-section + .settings-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }

/* ── Admin layout ── */
#mainSection {
  max-width: min(95vw, 1800px);
  margin: 0 auto;
  padding: 32px 32px 80px;
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
/* Sidebar container — help-page-style (borderless, sticky). The nav item classes
   (.sidebar-nav-*) are shared with the help sidebar and live in shared.css. */
.admin-nav-sidebar {
  position: sticky;
  top: 60px;
  flex: 0 0 220px;
  width: 220px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 28px 0 40px;
}
.admin-content { flex: 1; min-width: 0; }

/* ── Responsive: collapse the sidebar into a toggle (mirrors the help page) ── */
@media (max-width: 900px) {
  #mainSection { display: block; padding: 20px 16px 60px; }
  .sidebar-nav-toggle { display: inline-flex; margin: 0 0 16px; }
  .admin-nav-sidebar {
    position: static;
    width: auto; flex-basis: auto;
    max-height: none; overflow: visible;
    display: none;
    padding: 8px 0 4px;
  }
  .admin-nav-sidebar.open { display: block; }
}

/* ── Page header ── */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px;
}
.page-eyebrow { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.page-header h1 { font-size: 28px; font-weight: 700; color: var(--text-strong); margin-bottom: 6px; }
.page-header p  { font-size: 14px; color: var(--text-muted); }

/* ── Cards ── */
.card { margin-bottom: 20px; }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-title { font-weight: 700; font-size: 14px; color: var(--text-strong); }

/* ── Users table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-soft); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-admin    { background: var(--info-light);    color: var(--info-text); }
.badge-stamm    { background: var(--warning-light); color: var(--warning-text); }
.badge-user     { background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--border); }
.badge-demo     { background: var(--purple-light); color: var(--purple-text); }
.badge-active   { background: var(--success-light); color: var(--success-text); }
.badge-inactive { background: var(--danger-light);  color: var(--danger-text); }
.badge-pw       { background: var(--warning-light); color: var(--warning-text); font-size: 10px; }

.loading-state { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ── Icon buttons ── */
.icon-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 4px; padding: 5px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: border-color 0.15s, color 0.15s, background 0.15s;
  line-height: 0;
}
.icon-btn:hover { border-color: var(--text-muted); color: var(--text-strong); background: var(--bg-soft); }
.icon-btn.icon-btn-active { border-color: var(--red); color: var(--red-text); background: var(--red-light); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn:disabled:hover { border-color: var(--border); color: var(--text-muted); background: none; }

/* ── Feedback tab ── */
.feedback-list { display: flex; flex-direction: column; }
.feedback-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
}
.feedback-row:last-child { border-bottom: none; }
.feedback-row-text { flex: 1; font-size: 13px; line-height: 1.6; color: var(--text); }
.feedback-row-meta { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.feedback-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.feedback-edit-row { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.feedback-edit-row textarea {
  width: 100%; min-height: 60px; font-family: inherit; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 8px 10px; resize: vertical;
}
.feedback-edit-actions { display: flex; gap: 8px; }
.feedback-edit-actions button {
  border: none; border-radius: 4px; padding: 6px 14px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.feedback-edit-actions .btn-save { background: var(--red); color: white; }
.feedback-edit-actions .btn-cancel { background: var(--bg-soft); color: var(--text-muted); }

.feedback-chat { display: flex; flex-direction: column; height: 320px; border-top: 1px solid var(--border); }
.feedback-chat-messages { flex: 1; overflow-y: auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 10px; }
.feedback-chat-empty { color: var(--text-light); font-size: 13px; text-align: center; margin: auto; }
.feedback-chat-msg { font-size: 13px; line-height: 1.5; padding: 8px 12px; border-radius: 8px; max-width: 88%; }
.feedback-chat-msg.role-user { background: var(--red-light); color: var(--text-strong); align-self: flex-end; }
.feedback-chat-msg.role-assistant { background: var(--bg-soft); color: var(--text); align-self: flex-start; }
.feedback-chat-input-row { display: flex; gap: 8px; padding: 12px 24px; border-top: 1px solid var(--border); }
.feedback-chat-input-row textarea {
  flex: 1; min-height: 40px; max-height: 100px; font-family: inherit; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 8px 10px; resize: vertical;
}
.feedback-chat-input-row button {
  border: none; background: var(--red); color: white; border-radius: 4px;
  padding: 0 16px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.feedback-chat-input-row button:disabled { background: var(--border-strong); cursor: not-allowed; }

/* ── Info popover ── */
.info-popover {
  position: fixed; z-index: 350;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.14);
  width: 330px;
}
.info-popover-header {
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
}
.info-popover-body { padding: 0 14px 10px; }
.info-popover-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.info-popover-table td { padding: 7px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.info-popover-table tr:last-child td { border-bottom: none; }
.info-popover-key { color: var(--text-muted); width: 46%; font-weight: 600; font-size: 12px; }
.info-popover-empty {
  padding: 16px 0; color: var(--text-muted); font-size: 13px;
  text-align: center; display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ── Gear dropdown ── */
.gear-dropdown {
  position: fixed; z-index: 350;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 200px; padding: 4px 0;
}
.gear-item-wrap { display: block; position: relative; }
.gear-item-wrap[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; right: calc(100% + 6px); top: 50%; transform: translateY(-50%);
  background: var(--tooltip-bg); color: var(--tooltip-text);
  font-size: 11px; font-weight: 500; border-radius: 4px;
  padding: 4px 8px; white-space: nowrap; pointer-events: none; z-index: 400;
}
.gear-item {
  display: block; width: 100%; padding: 9px 16px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  text-align: left; background: none; border: none;
  color: var(--text); cursor: pointer; transition: background 0.12s;
}
.gear-item:hover:not(:disabled) { background: var(--bg-soft); }
.gear-item:disabled { opacity: 0.4; cursor: not-allowed; }
.gear-item-danger { color: var(--danger-text); }
.gear-item-danger:hover:not(:disabled) { background: var(--danger-light); }
.gear-separator { border-top: 1px solid var(--border); margin: 4px 0; }

/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--red); color: white; border: none;
  padding: 10px 22px; border-radius: 4px; font-family: inherit;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: background 0.2s;
}
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-primary:disabled { background: var(--border-strong); cursor: not-allowed; }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  padding: 10px 22px; border-radius: 4px; font-family: inherit;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: border-color 0.15s;
}
.btn-secondary:hover { border-color: var(--text-muted); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary:disabled:hover { border-color: var(--border-strong); }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--danger); color: white; border: none;
  padding: 10px 22px; border-radius: 4px; font-family: inherit;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: background 0.2s;
}
.btn-danger:hover:not(:disabled) { background: #a52f2f; }
.btn-danger:disabled { background: var(--border-strong); cursor: not-allowed; }
.btn-danger-outline {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--danger);
  border: 1px solid var(--danger);
  padding: 9px 18px; border-radius: 4px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all 0.2s; width: 100%;
}
.btn-danger-outline:hover { background: var(--danger); color: white; }

/* ── Modals ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 8px;
  width: 100%; max-width: 480px; margin: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  /* On a short screen (phone / landscape) a tall edit form must scroll INSIDE the
     modal so the footer's Speichern/Abbrechen stay reachable — the overlay itself
     is a fixed, non-scrolling flex-center. Invisible on desktop, where these forms
     fit well under the cap so no scrollbar appears. Mirrors components.html's own
     modal (max-height:90vh; overflow-y:auto); 40px matches the 20px margin. */
  max-height: calc(100vh - 40px); overflow-y: auto;
}
.modal-wide { max-width: 600px; }
.field-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.field-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; border-radius: 4px;
  font-size: 20px; line-height: 1;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text-strong); }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 12px;
  padding: 16px 24px; border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.pw-box {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 20px; letter-spacing: 0.1em;
  background: var(--bg-soft); border: 1px solid var(--border-strong);
  border-radius: 4px; padding: 12px 16px;
  text-align: center; color: var(--text-strong);
  user-select: all; word-break: break-all;
}

.col-id { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── Role radio group ── */
.role-radio-group { display: flex; flex-direction: column; gap: 8px; }
.role-radio-option {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--border-strong);
  border-radius: 6px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.role-radio-option.is-selected { border-color: var(--red); background: var(--red-light); }
.role-radio-option input[type="radio"] { margin-top: 2px; accent-color: var(--red); cursor: pointer; flex-shrink: 0; }
.role-radio-label { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.role-radio-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── System tab — compact status panel ── */
.sys-compact-grid {
  display: grid; grid-template-columns: 1fr 1fr;
}
.sys-compact-cell { padding: 9px 16px; }
.sys-compact-cell:nth-child(odd)  { border-right: 1px solid var(--border); }
.sys-compact-cell:nth-child(n+3)  { border-top: 1px solid var(--border); }
.sys-compact-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 2px;
  display: flex; align-items: center; gap: 5px;
}
.sys-compact-value { font-size: 14px; color: var(--text-strong); }
.sys-compact-value code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 13px; background: var(--bg-soft);
  padding: 2px 6px; border-radius: 3px; color: var(--text-strong);
}
.sys-compact-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.sys-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 28px 20px; color: var(--text-muted); font-size: 14px;
}
.sys-status-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
.sys-timestamp { font-size: 12px; color: var(--text-muted); }

/* ── System tab — Danger Zone ── */
.danger-zone-header { margin: 28px 0 16px; }
.danger-zone-title { font-size: 16px; font-weight: 700; color: var(--text-strong); margin-bottom: 4px; }
.danger-zone-sub { font-size: 13px; color: var(--text-muted); }
.danger-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .danger-grid { grid-template-columns: 1fr; } }
.danger-card {
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); color: var(--text);
}
.danger-card-critical { border-color: var(--danger); border-width: 2px; }
.danger-card-icon { display: flex; align-items: center; color: var(--text-light); }
.danger-card-critical .danger-card-icon { color: var(--danger); }
.danger-card-title { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.danger-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.55; flex: 1; }

/* Reset modal confirm input */
.reset-confirm-input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 4px; font-family: inherit; font-size: 15px;
  color: var(--text); background: var(--surface);
  transition: border-color 0.15s; outline: none; margin: 12px 0 0;
  box-sizing: border-box;
}
.reset-confirm-input:focus { border-color: var(--red); }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 500;
  padding: 12px 20px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.toast-success { background: var(--success); color: white; }
#toast.toast-error   { background: var(--danger);  color: white; }

/* ── Training tab: Drop zone ── */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: 8px; padding: 48px 32px;
  text-align: center; cursor: pointer;
  transition: all 0.2s; position: relative; background: var(--surface);
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--red); background: var(--red-light); }
.drop-zone:hover .dz-icon, .drop-zone.dragover .dz-icon { color: var(--red-text); }
.drop-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.dz-icon { color: var(--border-strong); margin-bottom: 14px; transition: color 0.2s; }
.dz-title { font-size: 16px; font-weight: 700; color: var(--text-strong); margin-bottom: 6px; }
.dz-sub { font-size: 13px; color: var(--text-muted); }
.dz-formats { display: inline-flex; gap: 8px; margin-top: 16px; }
.format-tag {
  padding: 3px 10px; border-radius: 3px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.tag-pdf  { background: var(--red-light);  color: var(--red-text); }
.tag-docx { background: var(--info-light); color: var(--info-text); }
.tag-xlsx { background: var(--success-light); color: var(--success-text); }
.tag-eml  { background: var(--purple-light); color: var(--purple-text); }

/* ── Training tab: File queue ── */
.file-queue { margin-top: 16px; }
.file-queue.empty { display: none; }
.queue-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.queue-count { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.btn-clear {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 12px; color: var(--text-light); padding: 0;
}
.btn-clear:hover { color: var(--danger); }
.queue-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.queue-item:last-child { border-bottom: none; }
.file-icon {
  width: 36px; height: 36px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white; flex-shrink: 0;
}
.icon-pdf  { background: var(--red); }
.icon-docx { background: var(--info); }
.icon-xlsx { background: #10733e; }
.icon-doc  { background: #1e5bb0; }
.icon-xls  { background: #0d5c31; }
.icon-file { background: var(--text-muted); }
.queue-info { flex: 1; min-width: 0; }
.queue-name {
  font-size: 14px; font-weight: 600; color: var(--text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.queue-meta { font-size: 12px; color: var(--text-muted); }
.queue-status { flex-shrink: 0; }
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-pending   { background: var(--bg-soft);       color: var(--text-light); border: 1px solid var(--border); }
.badge-uploading { background: var(--info-light);    color: var(--info-text);       border: 1px solid var(--info-border); }
.badge-done      { background: var(--success-light); color: var(--success-text);    border: 1px solid var(--success-border); }
.badge-error     { background: var(--danger-light);  color: var(--danger-text);     border: 1px solid var(--danger-border); }
.badge-skipped   { background: var(--warning-light); color: var(--warning-text);    border: 1px solid var(--warning-border); }
.dup-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  background: var(--warning-light); color: var(--warning-text); border: 1px solid var(--warning-border);
  white-space: nowrap;
}
.btn-secondary.active { border-color: var(--red); color: var(--red-text); background: var(--red-light); }
.btn-remove-file {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); padding: 4px; flex-shrink: 0; line-height: 0; border-radius: 3px;
}
.btn-remove-file:hover { color: var(--danger-text); background: var(--danger-light); }

/* ── Training tab: Upload actions ── */
.upload-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 20px; gap: 12px;
}
.upload-summary { font-size: 13px; color: var(--text-muted); }
.btn-upload {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--red); color: white; border: none;
  padding: 12px 28px; border-radius: 4px; font-family: inherit;
  font-size: 15px; font-weight: 700; cursor: pointer; transition: background 0.2s;
  white-space: nowrap;
}
.btn-upload:hover:not(:disabled) { background: var(--red-dark); }
.btn-upload:disabled { background: var(--border-strong); cursor: not-allowed; }

/* ── Training tab: File list ── */
.files-content { padding: 20px 24px; background: var(--bg-soft); }
.file-row {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 14px 40px 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px;
  margin-bottom: 8px; transition: box-shadow 0.15s;
}
.file-row:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.08); }
.file-row:last-child { margin-bottom: 0; }
.file-row-body { display: flex; align-items: flex-start; gap: 12px; }
.file-row-info { flex: 1; min-width: 0; }
.file-row-name {
  font-size: 14px; font-weight: 600; color: var(--text-strong);
  word-break: break-word; line-height: 1.4;
}
.file-row-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.file-row-tags { display: flex; flex-wrap: nowrap; gap: 4px; margin-top: 6px; overflow: hidden; }
.file-row-actions { display: flex; align-items: center; gap: 8px; align-self: flex-start; margin-top: auto; }
.btn-download {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border: 1px solid var(--border-strong);
  border-radius: 4px; background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; text-decoration: none;
  white-space: nowrap;
}
.btn-download:hover { border-color: var(--red); color: var(--red-text); background: var(--red-light); }
.btn-file-delete {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 4px; border: none;
  background: transparent; color: var(--danger-text);
  cursor: pointer; padding: 0; line-height: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.file-row:hover .btn-file-delete { opacity: 1; }
.btn-file-delete:hover { background: var(--danger-light); color: var(--danger-text); }
.btn-file-reprocess {
  width: 28px; height: 28px; border-radius: 4px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; padding: 0; line-height: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-file-reprocess:hover { border-color: var(--text-muted); color: var(--text-strong); background: var(--bg-soft); }
.btn-file-reprocess:disabled { cursor: not-allowed; opacity: 0.5; }
.btn-file-reprocess .spinner { width: 12px; height: 12px; }

/* ── Training tab: Paired document grid ── */
.docs-grid-header {
  display: grid; grid-template-columns: 1.3fr 1.3fr 1fr 1fr; gap: 12px; padding: 10px 0;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.docs-grid-row {
  display: grid; grid-template-columns: 1.3fr 1.3fr 1fr 1fr;
  gap: 12px; margin-bottom: 8px; align-items: stretch;
}
.docs-grid-cell { display: flex; flex-direction: column; }
.docs-grid-cell .file-row,
.docs-grid-cell .doc-cell-empty { flex: 1; margin-bottom: 0; }
.doc-cell-empty {
  border: 2px dashed var(--border); border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--text-light); font-size: 12px; text-align: center;
  padding: 24px 16px; min-height: 80px;
}
.doc-cell-empty svg { opacity: 0.35; }
.docs-grid-cell--stack { gap: 8px; }
.docs-grid-cell--stack .file-row { margin-bottom: 0; }
.docs-others-label {
  margin-top: 16px; margin-bottom: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}
@media (max-width: 1024px) {
  .docs-grid-header, .docs-grid-row { grid-template-columns: 1fr 1fr; }
  .docs-grid-cell--entity { display: none; }
  .docs-grid-header > div:nth-child(3), .docs-grid-header > div:nth-child(4) { display: none; }
}
@media (max-width: 768px) {
  .docs-grid-header, .docs-grid-row { grid-template-columns: 1fr; }
}

/* ── Training tab: Detected customer/site columns ── */
.docs-grid-cell--entity {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; font-size: 12px; justify-content: center;
}
.entity-cell-name { font-weight: 600; color: var(--text-strong); word-break: break-word; }
.entity-cell-address { color: var(--text-muted); margin-top: 2px; word-break: break-word; }
.entity-cell-contact { color: var(--text-muted); margin-top: 4px; word-break: break-word; font-style: italic; }
.entity-cell-empty { color: var(--text-light); font-style: italic; }
.entity-cell-block { position: relative; padding-right: 18px; }
.entity-cell-block .btn-edit-entity { position: absolute; top: 0; right: 0; }
.entity-cell-block + .entity-cell-block { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* ── Training tab: Role & pair badges ── */
.role-badge, .pair-badge, .entity-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 1px 7px;
  border-radius: 10px; vertical-align: middle; white-space: nowrap; flex-shrink: 0;
}
.role-anfrage { background: var(--info-light);    color: var(--info-text);    border: 1px solid var(--info-border); }
.role-angebot { background: var(--success-light); color: var(--success-text); border: 1px solid var(--success-border); }
.pair-badge   { background: var(--warning-light); color: var(--warning-text); border: 1px solid var(--warning-border); }
.entity-badge { background: var(--info-light); color: var(--info-text); border: 1px solid var(--info-border); }

/* ── Training tab: Match banner ── */
.match-banner {
  display: none; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--success-light); color: var(--success-text);
  border: 1px solid var(--success-border); border-radius: 8px; font-size: 14px; margin-top: 16px;
}
.match-banner.show { display: flex; }
.match-banner svg  { flex-shrink: 0; }

/* ── Training tab: Empty state ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 14px; }
.empty-state svg { opacity: 0.25; margin-bottom: 12px; display: block; margin: 0 auto 12px; }

/* ── API-Nutzung tab ── */
.usage-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.usage-range-btn { padding: 6px 14px; font-size: 13px; }
.usage-custom-range { display: inline-flex; gap: 6px; align-items: center; }
.usage-custom-range input[type="date"] {
  padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 6px;
  font-size: 13px; background: var(--surface); color: var(--text-strong);
}
.usage-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.usage-stat { border: 1px solid var(--border); border-radius: 10px; padding: 16px; background: var(--bg-soft); }
.usage-stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px; }
.usage-stat-value { font-size: 22px; font-weight: 700; color: var(--text-strong); }
.usage-stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.usage-stat.usage-stat-savings { background: var(--success-light); border-color: var(--success-text); }
.usage-stat.usage-stat-savings .usage-stat-value { color: var(--success-text); }
.usage-section-title { font-size: 13px; font-weight: 700; color: var(--text-strong); margin: 22px 0 10px; }
.usage-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-cost { font-weight: 700; }
/* A model with usage but no price row: not a cost, a config gap — flagged distinctly
   from a genuine $0.00 (see the .usage-price-warning banner above the tables). */
.usage-cost-missing { font-weight: 700; color: var(--danger-text); white-space: nowrap; }
.usage-price-warning { margin: 0 0 16px; }
.usage-price-warning code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px; }
/* Step 87 — per-proposal cost table: muted feature-split line under each offer row,
   and the "nicht zuordenbar" breakdown below the table. */
.usage-proposal-split td { font-size: 12px; color: var(--text-muted); padding-top: 0; border-top: none; }
.usage-unattributed { font-size: 13px; color: var(--text-muted); }

/* Minimal CSP-safe cost-per-day bar chart (no external chart lib) */
.usage-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding: 8px 4px 0;
               border-bottom: 1px solid var(--border); overflow-x: auto; }
.usage-chart-bar { flex: 1 0 14px; min-width: 14px; display: flex; flex-direction: column;
                   align-items: center; justify-content: flex-end; height: 100%; }
.usage-chart-fill { width: 60%; min-height: 2px; background: var(--red); border-radius: 3px 3px 0 0; transition: opacity .15s; }
.usage-chart-bar:hover .usage-chart-fill { opacity: 0.7; }
/* Numeric value above each bar (used by BOTH custom bar charts: the API-Nutzung
   "Kosten pro Tag" chart in admin-usage.js and the CrowdSec "Gesperrte IPs pro Tag"
   chart in admin-crowdsec.js) — readable in light/dark, placed outside the fill so
   it never gets clipped by a short/tall bar. */
.usage-chart-value { font-size: 10px; font-weight: 700; color: var(--text-strong);
                     font-variant-numeric: tabular-nums; white-space: nowrap; margin-bottom: 3px; line-height: 1; }
.usage-chart-xlabel { font-size: 9px; color: var(--text-muted); margin-top: 4px; white-space: nowrap;
                      transform: rotate(-45deg); transform-origin: center; height: 26px; }
.usage-chart-empty { padding: 30px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — ADMIN PAGES (mobile & tablet)
   The sidebar already collapses to a toggle at ≤900px (see the top of this file).
   These rules keep the admin CONTENT — dashboard cards, charts, tables, forms —
   clean and fully-visible at phone/tablet widths. Desktop is untouched (all rules
   are below a breakpoint). Breakpoints match shared.css (tablet ≤1024, mobile ≤480).
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  /* Page header: title and any right-aligned actions stack instead of colliding. */
  .page-header { flex-direction: column; gap: 12px; }
  /* Two-column form grids collapse to a single full-width column. */
  .field-grid, .field-grid-2 { grid-template-columns: 1fr; }
  /* Range-filter buttons stay a comfortable tap size. */
  .usage-range-btn { padding: 8px 14px; }
}
/* Phase 4 — touch devices have no hover: reveal the otherwise hover-only
   affordances permanently so they stay reachable by tap. */
@media (hover: none) and (pointer: coarse) {
  .btn-file-delete { opacity: 1; }
}
@media (max-width: 480px) {
  .card-body { padding: 18px 16px; }
  .card-header { padding: 14px 16px; }
  /* List-card header (Kunden/Standorte/Lieferanten): the title + search+dup-button
     toolbar sit in one no-wrap flex row. Let it wrap so the toolbar drops to its own
     full-width line, and let the search input shrink — !important is required to beat
     the input's inline min-width:220px (same reason the mobile nav uses it). */
  .card-header { flex-wrap: wrap; gap: 10px; }
  #customersSearchInput, #sitesSearchInput, #suppliersSearchInput { min-width: 0 !important; flex: 1; }
  /* Stat cards: allow two-up on small phones, one-up on the very narrowest. */
  .usage-stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .usage-stat-value { font-size: 20px; }
  /* Keep chart bars wide enough that the value label above each stays legible;
     the chart's own overflow-x:auto then lets the row scroll inside its card. */
  .usage-chart-bar { flex: 0 0 26px; min-width: 26px; }
  .page-header h1 { font-size: 23px; }
}
