/* ═══════════════════════════════════════════════════════
   Auditron – Web UI  |  Sky-blue / Gray / White theme
   ═══════════════════════════════════════════════════════ */

:root {
  /* Sky blue palette */
  --sky-50:  #F0F9FF;
  --sky-100: #E0F2FE;
  --sky-200: #BAE6FD;
  --sky-300: #7DD3FC;
  --sky-400: #38BDF8;
  --sky-500: #0EA5E9;
  --sky-600: #0284C7;
  --sky-700: #0369A1;

  /* Gray palette */
  --gray-50:  #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  /* Semantic */
  --primary:        var(--sky-500);
  --primary-hover:  var(--sky-600);
  --primary-light:  var(--sky-100);
  --bg:             var(--gray-50);
  --surface:        #FFFFFF;
  --border:         var(--gray-200);
  --text:           var(--gray-800);
  --text-muted:     var(--gray-500);
  --sidebar-bg:     var(--sky-700);
  --sidebar-text:   #FFFFFF;
  --sidebar-muted:  var(--sky-200);
  --sidebar-active: rgba(255,255,255,0.15);
  --sidebar-hover:  rgba(255,255,255,0.08);

  /* Status */
  --green:  #22C55E;
  --red:    #EF4444;
  --amber:  #F59E0B;

  /* Layout */
  --sidebar-w: 240px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.10);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
button { cursor: pointer; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--primary); text-decoration: none; }

/* ── Layout ────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: white;
}
.sidebar-logo-text h1 {
  font-size: 15px; font-weight: 700; color: white; line-height: 1.2;
}
.sidebar-logo-text p {
  font-size: 11px; color: var(--sidebar-muted); line-height: 1.2;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}
.sidebar-section {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--sky-300);
  padding: 12px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.active { background: var(--sidebar-active); color: white; }
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.2);
  color: white; font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 99px;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-db-info {
  font-size: 11px; color: var(--sidebar-muted);
  display: flex; align-items: center; gap: 6px;
}
.db-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* ── Main Content ───────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ── Topbar ─────────────────────────────────────────────── */
#topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
}
.topbar-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  flex: 1;
}
.topbar-subtitle {
  font-size: 12px; color: var(--text-muted); margin-left: 6px;
}

/* ── View container ─────────────────────────────────────── */
.view { display: none; flex: 1; overflow-y: auto; }
.view.active { display: flex; flex-direction: column; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 16px;
  border-radius: var(--radius); border: none;
  font-size: 13px; font-weight: 600;
  transition: all 0.15s; white-space: nowrap;
  text-decoration: none; /* for <a> used as button */
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: none; padding: 6px 10px;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Form Elements ──────────────────────────────────────── */
.input, .select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--sky-100);
}
.input::placeholder { color: var(--gray-400); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ── Progress Bar ───────────────────────────────────────── */
.progress-wrap { background: var(--gray-200); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--sky-400), var(--sky-600));
  transition: width 0.3s;
}
.progress-label { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Status Badge ───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.badge-green  { background: #DCFCE7; color: #166534; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-blue   { background: var(--sky-100); color: var(--sky-700); }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }
.badge-amber  { background: #FEF3C7; color: #92400E; }

/* ═══════════════════════════════════════════════════════
   SEARCH VIEW
   ═══════════════════════════════════════════════════════ */
#view-search { padding: 20px 24px; gap: 16px; }

.search-bar-card { padding: 16px 20px; }
.search-bar-row { display: flex; gap: 10px; align-items: flex-end; }
.search-bar-row .input { font-size: 14px; }
.search-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; align-items: flex-end; }
.search-filters .form-group { min-width: 140px; max-width: 180px; }
.search-filters .amount-mode-group { min-width: unset; max-width: unset; flex: 0 0 auto; }

.results-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-muted);
  padding: 0 4px;
}
.results-count { font-weight: 600; color: var(--text); }

/* ── Results Table ──────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.4px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--sky-50); }
tbody td {
  padding: 10px 14px;
  font-size: 13px;
  vertical-align: middle;
}
.td-name { font-weight: 500; max-width: 280px; }
.td-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-muted { color: var(--text-muted); font-size: 12px; }
.td-actions { display: flex; gap: 4px; }

/* ── PDF Preview Drawer ─────────────────────────────────── */
/* Wrapper that holds preview + chat side by side */
#preview-wrap {
  position: fixed; right: 0; top: 0; bottom: 0;
  display: flex; flex-direction: row;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 100;
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
}
#preview-wrap.open  { transform: translateX(0); }
#preview-wrap.resizing { transition: none; user-select: none; }

#preview-drawer {
  width: 680px;
  min-width: 320px;
  max-width: 75vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}

/* Drag handle – left edge of drawer */
#preview-resize-handle {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 6px; cursor: ew-resize;
  background: transparent;
  z-index: 10;
}
#preview-resize-handle:hover,
#preview-resize-handle:active {
  background: var(--sky-400);
  opacity: 0.5;
}

.preview-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.preview-title {
  flex: 1; font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Meta tags bar under header */
.preview-meta-bar {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* PDF / image viewer — takes all available space */
#preview-viewer {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: #525659;
}
#preview-viewer-inner {
  flex: 1; min-height: 0;
  overflow: auto;        /* scrollable when PDF.js renders pages */
  display: flex; flex-direction: column;
  align-items: center;
  background: #525659;
}

/* PDF.js loading spinner */
.pdf-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: rgba(255,255,255,.8);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.preview-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1;
  color: rgba(255,255,255,0.65); font-size: 13px;
  padding: 40px; text-align: center;
  min-height: 200px;
}
.preview-page-canvas {
  background: white;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  display: block;
  max-width: 100%;
}

/* Snippet section (search hits) – fixed height under viewer */
#preview-snippets-wrap {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  max-height: 220px; overflow-y: auto;
}
.preview-snippets-title {
  padding: 6px 16px;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
}
.preview-text {
  padding: 10px 16px;
  font-size: 12px; line-height: 1.8; color: var(--gray-700);
}
.preview-snippet {
  padding: 6px 10px; margin-bottom: 8px;
  border-left: 3px solid var(--sky-400);
  background: var(--sky-50);
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: pre-wrap; word-break: break-word;
}
.preview-snippet:last-child { margin-bottom: 0; }
mark.search-hit {
  background: #FEF08A; color: #713F12;
  border-radius: 2px; padding: 0 2px;
  font-weight: 700;
}
.preview-empty { color: var(--text-muted); font-style: italic; }
.preview-more  { color: var(--text-muted); }
.preview-actions {
  display: flex; gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   INDEXING VIEW
   ═══════════════════════════════════════════════════════ */
#view-index { padding: 20px 24px; gap: 16px; }

.index-folder-row { display: flex; gap: 10px; align-items: flex-end; }
.folder-path-display {
  flex: 1; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--gray-50); color: var(--gray-700);
  font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder-path-display.has-path { background: var(--sky-50); border-color: var(--sky-300); color: var(--sky-700); }

.index-status-bar {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--gray-50);
  border: 1px solid var(--border);
  display: none;
}
.index-status-bar.visible { display: block; }
.index-status-bar.running { background: var(--sky-50); border-color: var(--sky-200); }
.index-status-bar.done    { background: #F0FDF4; border-color: #BBF7D0; }
.index-status-bar.error   { background: #FEF2F2; border-color: #FECACA; }

.mandate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.mandate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mandate-card:hover { border-color: var(--sky-300); box-shadow: 0 0 0 3px var(--sky-100); }
.mandate-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mandate-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.mandate-name { font-size: 14px; font-weight: 600; }
.mandate-meta { font-size: 12px; color: var(--text-muted); }
.mandate-stats { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════
   AUDIT VIEW
   ═══════════════════════════════════════════════════════ */
#view-audit { padding: 20px 24px; gap: 16px; }

.audit-steps { display: flex; gap: 4px; align-items: center; margin-bottom: 8px; }
.step { display: flex; align-items: center; gap: 6px; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gray-200); color: var(--gray-500);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step.active .step-num  { background: var(--primary); color: white; }
.step.done .step-num    { background: var(--green); color: white; }
.step-label { font-size: 12px; color: var(--text-muted); }
.step.active .step-label { color: var(--text); font-weight: 600; }
.step-arrow { color: var(--gray-300); font-size: 12px; }

.audit-results-row { display: flex; gap: 10px; flex-wrap: wrap; }
.audit-stat-box {
  flex: 1; min-width: 110px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  text-align: center;
}
.audit-stat-box .num { font-size: 22px; font-weight: 700; color: var(--primary); }
.audit-stat-box .lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════
   SETTINGS VIEW
   ═══════════════════════════════════════════════════════ */
#view-settings { padding: 20px 24px; gap: 16px; max-width: 720px; }
.settings-section-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info label { font-size: 13px; font-weight: 500; display: block; }
.settings-row-info p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.settings-row-control { flex-shrink: 0; margin-left: 16px; }

/* ── Toggle Switch ──────────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--gray-300); border-radius: 99px;
  transition: background 0.2s;
  cursor: pointer;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: white; left: 3px; top: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ═══════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 24px; gap: 12px;
  color: var(--text-muted); text-align: center;
}
.empty-icon { font-size: 40px; opacity: 0.4; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--gray-600); }
.empty-body  { font-size: 13px; max-width: 320px; }

/* ═══════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.35); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open,
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); max-width: 520px; width: 90%;
  overflow: hidden;
}
.modal-header {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ═══════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999;
}
.toast {
  padding: 12px 16px; border-radius: var(--radius);
  color: white; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease;
  display: flex; align-items: center; gap: 8px;
  min-width: 260px; max-width: 380px;
}
.toast-success { background: #166534; }
.toast-error   { background: #991B1B; }
.toast-info    { background: var(--sky-700); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Misc ───────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.w-full { width: 100%; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Index status bar always visible ────────────────────── */
.index-status-bar { display: block; }

/* ═══════════════════════════════════════════════════════
   ADDITIONAL COMPONENT STYLES
   ═══════════════════════════════════════════════════════ */

/* ── DB dot states ──────────────────────────────────────── */
.db-dot { background: var(--amber); }              /* default = connecting */
.db-dot.connected { background: var(--green); }

/* ── Toast additions ────────────────────────────────────── */
.toast { opacity: 0; transform: translateX(110%); transition: opacity 0.25s, transform 0.25s; }
.toast.toast-visible { opacity: 1; transform: translateX(0); }
.toast-warning { background: #92400E; }
.toast-close {
  background: none; border: none; color: rgba(255,255,255,0.7);
  font-size: 14px; line-height: 1; cursor: pointer;
  margin-left: auto; padding: 0 2px; flex-shrink: 0;
}
.toast-close:hover { color: white; }
.toast-icon { font-size: 14px; flex-shrink: 0; }
.toast-msg  { flex: 1; }

/* ── File type badges in result table ───────────────────── */
.file-type-badge {
  display: inline-block;
  padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700;
  margin-right: 6px; vertical-align: middle;
}
.badge-pdf  { background: #FEE2E2; color: #991B1B; }
.badge-docx { background: #DBEAFE; color: #1E40AF; }
.badge-img  { background: #D1FAE5; color: #065F46; }
.file-name  { vertical-align: middle; }

/* ── Mandate pill in results ────────────────────────────── */
.mandate-pill {
  display: inline-block;
  padding: 2px 8px; border-radius: 99px;
  background: var(--sky-100); color: var(--sky-700);
  font-size: 11px; font-weight: 600;
}

/* ── Preview meta tags ──────────────────────────────────── */
.meta-tag {
  display: inline-block;
  padding: 3px 8px;
  background: var(--gray-100);
  border-radius: 4px;
  font-size: 11px;
  color: var(--gray-700);
  margin: 2px;
}
#preview-meta { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── Mandate card layout (grid variant) ─────────────────── */
.mandate-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.mandate-card-icon {
  width: 38px; height: 38px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.mandate-card-body { flex: 1; min-width: 0; }
.mandate-card-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mandate-card-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.mandate-card-actions { flex-shrink: 0; }

/* ── Audit results table ────────────────────────────────── */
.row-unmatched td { background: #FEF2F2; }
.row-unmatched:hover td { background: #FEE2E2; }

.badge-unmatched {
  display: inline-block;
  padding: 2px 8px; border-radius: 4px;
  background: #fee2e2; color: #991b1b;
  font-size: 11px; font-weight: 500;
}
.badge-partial {
  display: inline-block;
  padding: 2px 8px; border-radius: 4px;
  background: #fef3c7; color: #92400e;
  font-size: 11px; font-weight: 500;
}
.match-count-chip {
  display: inline-block;
  padding: 1px 6px; border-radius: 10px;
  background: #dcfce7; color: #166534;
  font-size: 11px; font-weight: 600; vertical-align: middle;
}
.audit-file-link {
  cursor: pointer; color: var(--primary);
  text-decoration: underline; text-underline-offset: 2px;
  font-size: 12px;
}
.audit-file-link:hover { color: var(--primary-dark, #1d4ed8); }
.score-pill {
  display: inline-block;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
}
.score-good { background: #DCFCE7; color: #166534; }
.score-bad  { background: #FEE2E2; color: #991B1B; }

/* ── Audit summary stats ────────────────────────────────── */
.audit-results-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.audit-stat {
  flex: 1; min-width: 100px;
  background: var(--gray-50); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; text-align: center;
}
.audit-stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.audit-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.text-success { color: #166534; }
.text-danger  { color: #991B1B; }
.text-center  { text-align: center; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Complete step style ─────────────────────────────────── */
.step.complete .step-num { background: var(--green); color: white; }
.step.complete .step-label { color: var(--text-muted); }

/* ── Audit Rules Panel ──────────────────────────── */
.rules-panel {
  position: fixed; top: 56px; right: 0; bottom: 0;
  width: 520px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.10);
  display: none; flex-direction: column;
  z-index: 90;
  overflow: hidden;
}
.rules-panel.open { display: flex; }
.rules-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.rules-panel-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
}

/* ── Rule cards in rules list ───────────────────── */
.rule-card {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px 14px; margin-bottom: 8px;
  background: #f9fafb;
  display: flex; align-items: flex-start; gap: 12px;
  transition: box-shadow .15s;
}
.rule-card:hover { box-shadow: 0 1px 6px rgba(0,0,0,.10); }
.rule-card.rule-disabled { opacity: 0.45; }
.rule-card-body { flex: 1; min-width: 0; }
.rule-card-name { font-size: 13px; font-weight: 700; margin-bottom: 3px; color: #111827; }
.rule-card-meta { font-size: 11px; color: #6b7280; line-height: 1.6; }
.rule-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.rule-enabled-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #22c55e; margin-top: 5px; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(34,197,94,.25);
}
.rule-enabled-dot.off { background: #d1d5db; box-shadow: none; }

/* ── Rule checkbox row ──────────────────────────── */
.rule-checkbox-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--gray-50);
}
.rule-checkbox-row input[type="checkbox"] { width: 14px; height: 14px; }

/* ── Audit PDF upload list ──────────────────────── */
.audit-file-list {
  margin-top: 8px; display: flex; flex-direction: column; gap: 4px;
}
.audit-file-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; padding: 4px 8px;
  background: var(--sky-50); border-radius: 4px;
  border: 1px solid var(--sky-200);
}
.audit-file-item .remove-file {
  margin-left: auto; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 12px;
  padding: 0 2px;
}
.audit-file-item .remove-file:hover { color: var(--red); }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ══════════════════════════════════════════════════════════
   LOGIN OVERLAY
══════════════════════════════════════════════════════════ */
#login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background-image: url('background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex; align-items: center; justify-content: center;
}
#login-overlay::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(5, 15, 35, 0.45);
  backdrop-filter: blur(1px);
}
.login-box {
  position: relative; z-index: 1;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 44px 40px; width: 380px; max-width: 95vw;
  box-shadow: 0 32px 64px rgba(0,0,0,0.5);
}
.login-logo {
  text-align: center; margin-bottom: 32px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.login-logo h2 { margin: 0; font-size: 24px; color: white; font-weight: 700; letter-spacing: -0.3px; }
.login-logo p  { margin: 0; font-size: 13px; color: rgba(255,255,255,0.55); }
.login-box .form-label { color: rgba(255,255,255,0.75); font-size: 12px; font-weight: 600; letter-spacing: 0.3px; }
.login-box .input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  border-radius: 10px;
}
.login-box .input::placeholder { color: rgba(255,255,255,0.35); }
.login-box .input:focus {
  background: rgba(255,255,255,0.15);
  border-color: rgba(100,180,255,0.6);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
}
.login-box .btn-primary {
  width: 100%; padding: 12px;
  font-size: 15px; font-weight: 600;
  border-radius: 10px; margin-top: 4px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 4px 15px rgba(59,130,246,0.4);
  transition: opacity 0.15s, transform 0.1s;
}
.login-box .btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.login-error {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: #fca5a5; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; margin-bottom: 12px;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR USER INFO + LOGOUT
══════════════════════════════════════════════════════════ */
.sidebar-user-info {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-top: 8px;
  background: rgba(255,255,255,0.05); border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
.user-name  { display: block; font-size: 12px; font-weight: 600; color: white; truncate; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role  { display: block; font-size: 10px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.5px; }
.btn-logout {
  background: none; border: none; color: rgba(255,255,255,0.4);
  cursor: pointer; padding: 4px; border-radius: 4px;
  display: flex; align-items: center; flex-shrink: 0;
  transition: color 0.15s;
}
.btn-logout:hover { color: rgba(255,255,255,0.8); }

/* ══════════════════════════════════════════════════════════
   BENUTZERVERWALTUNG
══════════════════════════════════════════════════════════ */

/* Header bar */
.users-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 24px 16px; flex-shrink: 0;
}

/* Card grid */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; padding: 0 24px 24px;
  align-content: start; overflow-y: auto;
}
.users-loading {
  grid-column: 1/-1; text-align: center;
  padding: 48px; color: var(--text-secondary); font-size: 14px;
}

/* Individual user card */
.user-card {
  background: white; border-radius: 12px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: hidden; transition: box-shadow 0.15s, border-color 0.15s;
}
.user-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-color: var(--primary-light,#93c5fd); }

.user-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 12px;
}
.user-card-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: white; flex-shrink: 0;
}
.avatar-admin { background: linear-gradient(135deg, #f59e0b, #d97706); }
.avatar-user  { background: linear-gradient(135deg, #6366f1, #4f46e5); }

.user-card-info { flex: 1; min-width: 0; }
.user-card-name {
  font-weight: 600; font-size: 15px; color: var(--gray-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card-username {
  font-size: 12px; color: var(--text-secondary); margin-top: 1px;
}
.user-card-badges {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}

/* Role + status badges */
.role-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 20px; line-height: 1;
}
.role-badge.admin { background: #fef3c7; color: #92400e; }
.role-badge.user  { background: #ede9fe; color: #4c1d95; }
.status-badge {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.status-badge.active   { background: #16a34a; box-shadow: 0 0 0 2px #dcfce7; }
.status-badge.inactive { background: #dc2626; box-shadow: 0 0 0 2px #fee2e2; }

/* Permissions section inside card */
.user-card-perms {
  padding: 4px 16px 12px;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.perm-chip {
  font-size: 11px; padding: 2px 7px; border-radius: 10px; font-weight: 500;
  background: #dbeafe; color: #1d4ed8;
}
.perm-chip.off { background: var(--gray-100); color: var(--text-secondary); text-decoration: line-through; }

/* Card actions */
.user-card-actions {
  display: flex; border-top: 1px solid var(--gray-100);
}
.user-card-actions button {
  flex: 1; padding: 10px; background: none; border: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-secondary); transition: background 0.1s, color 0.1s;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.user-card-actions button:hover { background: var(--gray-50); color: var(--gray-900); }
.user-card-actions .btn-delete:hover { background: #fef2f2; color: #dc2626; }
.user-card-actions button + button { border-left: 1px solid var(--gray-100); }

/* Modal form layout */
.modal-form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px;
}
.perm-section-header {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--gray-700);
  margin-bottom: 10px;
}
.permissions-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; padding: 12px;
  background: var(--gray-50); border-radius: 8px;
  border: 1px solid var(--gray-200);
}
.permission-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer; padding: 4px 6px;
  border-radius: 6px; transition: background 0.1s;
}
.permission-item:hover { background: var(--gray-100); }
.permission-item input[type="checkbox"] {
  width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   KI-CHAT PANEL
══════════════════════════════════════════════════════════ */

/* Button in der Preview-Aktionsleiste */
.btn-ai {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white; border: none;
  display: flex; align-items: center; gap: 5px;
}
.btn-ai:hover { opacity: 0.88; }

/* Chat panel sits to the right of the preview inside #preview-wrap */
.ai-chat-panel {
  width: 0;
  overflow: hidden;
  background: white;
  border-left: 1px solid var(--gray-200);
  display: flex; flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4,0,0.2,1);
  flex-shrink: 0;
}
.ai-chat-panel.open {
  width: 360px;
  min-width: 320px;
}

.ai-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.ai-chat-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px; color: var(--gray-900);
}
.ai-model-badge {
  font-size: 10px; font-weight: 600;
  background: #ede9fe; color: #4f46e5;
  padding: 2px 8px; border-radius: 20px;
}

.ai-chat-doc-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  font-size: 12px; color: var(--text-secondary);
  flex-shrink: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ai-chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}

.ai-chat-welcome {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; height: 100%;
  text-align: center; color: var(--text-secondary); font-size: 14px;
}

.ai-msg {
  display: flex; flex-direction: column; gap: 2px;
  max-width: 90%;
}
.ai-msg.user { align-self: flex-end; align-items: flex-end; }
.ai-msg.assistant { align-self: flex-start; align-items: flex-start; }

.ai-msg-bubble {
  padding: 9px 13px; border-radius: 12px;
  font-size: 13px; line-height: 1.5;
}
.ai-msg.user .ai-msg-bubble {
  background: var(--primary); color: white;
  border-bottom-right-radius: 3px;
}
.ai-msg.assistant .ai-msg-bubble {
  background: var(--gray-100); color: var(--gray-900);
  border-bottom-left-radius: 3px;
}
.ai-msg-bubble.loading {
  color: var(--text-secondary);
  font-style: italic;
}

.ai-chat-input-row {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.ai-chat-input { flex: 1; font-size: 13px; }

/* ── Exact match toggle ─────────────────────────────────── */
/* ── Amount-mode toggle group (Normal / Exakt / Vorkomma) ───────────────── */
.amount-mode-group {
  flex: 0 0 auto !important;   /* don't shrink / don't clip */
  min-width: unset !important;
  max-width: unset !important;
}
.amount-mode-toggle {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--gray-300); border-radius: 20px;
  overflow: hidden; background: white; white-space: nowrap;
}
.amount-mode-option {
  display: flex; align-items: center;
  cursor: pointer; user-select: none;
}
.amount-mode-option input[type="radio"] { display: none; }
.amount-mode-label {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; font-size: 11.5px; font-weight: 500;
  color: var(--text-secondary); white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  border-right: 1.5px solid var(--gray-300);
}
.amount-mode-option:last-child .amount-mode-label { border-right: none; }
.amount-mode-option input:checked + .amount-mode-label {
  background: #ede9fe; color: #4f46e5;
}
.amount-mode-option:hover .amount-mode-label { color: #4f46e5; }

/* ── KI-Kriteriensuche Button ───────────────────────────────────────────── */
.btn-criteria {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white; border: none; cursor: pointer;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
  transition: opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn-criteria:hover { opacity: 0.9; box-shadow: 0 4px 14px rgba(99,102,241,0.4); }

/* ── Kriteriensuche Modal ────────────────────────────────────────────────── */
.criteria-modal-backdrop {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.criteria-modal-backdrop.open {
  opacity: 1; pointer-events: all;
}
.criteria-modal-box {
  background: white; border-radius: 16px;
  width: 100%; max-width: 500px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.2);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1);
  overflow: hidden;
}
.criteria-modal-backdrop.open .criteria-modal-box {
  transform: translateY(0) scale(1);
}
.criteria-modal-header {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 20px 20px 0;
}
.criteria-modal-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center; color: white;
}
.criteria-modal-title {
  font-size: 16px; font-weight: 700; color: var(--text-primary); margin: 0 0 2px;
}
.criteria-modal-subtitle {
  font-size: 12px; color: var(--text-secondary); margin: 0;
}
.criteria-modal-close {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 4px; border-radius: 6px;
  display: flex; align-items: center;
}
.criteria-modal-close:hover { background: var(--gray-100); color: var(--text-primary); }
.criteria-modal-body {
  padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px;
}
.criteria-textarea {
  resize: vertical; min-height: 90px; font-family: inherit; line-height: 1.5;
}
.criteria-modal-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px;
}
.btn-criteria-start {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; border: none; cursor: pointer;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
  transition: opacity 0.15s;
}
.btn-criteria-start:hover { opacity: 0.9; }

/* ── Fortschritt ─────────────────────────────────────────────────────────── */
.criteria-progress-body {
  padding: 24px 20px; display: flex; flex-direction: column; gap: 10px;
}
.criteria-progress-info {
  display: flex; justify-content: space-between; align-items: center;
}
.criteria-progress-label {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
}
.criteria-progress-count {
  font-size: 12px; color: var(--text-secondary);
}
.criteria-progress-bar-wrap {
  width: 100%; height: 8px; background: var(--gray-100);
  border-radius: 99px; overflow: hidden;
}
.criteria-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.criteria-progress-matches {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: #4f46e5; font-weight: 500;
}

/* ── Criteria Keywords display ───────────────────────────────────────────── */
.criteria-keywords-wrap {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; background: #f5f3ff; border-radius: 8px;
  border: 1px solid #ddd6fe;
}
.criteria-keywords-title {
  font-size: 11px; font-weight: 600; color: #6d28d9; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.criteria-keywords-list {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.criteria-kw-chip {
  display: inline-block; padding: 2px 9px;
  background: #ede9fe; color: #4f46e5;
  border-radius: 99px; font-size: 12px; font-weight: 500;
}

/* ── Agent API Settings ─────────────────────────────────────────────────── */
.agent-api-badge {
  margin-left: auto; padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  background: var(--gray-100); color: var(--text-secondary);
  border: 1.5px solid var(--gray-300);
}
.agent-api-badge.active {
  background: #dcfce7; color: #16a34a; border-color: #86efac;
}
.agent-endpoint-code {
  display: block; font-size: 11px; font-family: monospace;
  background: var(--gray-100); padding: 4px 10px; border-radius: 6px;
  color: var(--gray-700); white-space: nowrap;
}
.agent-keys-toolbar { display:flex; justify-content:flex-end; margin-bottom:10px; }
.agent-keys-list { display:flex; flex-direction:column; gap:8px; }
.agent-keys-empty { color:var(--text-secondary); font-size:13px; padding:12px 0; }

.agent-key-row {
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--gray-50); transition: border-color 0.15s;
}
.agent-key-row:hover { border-color: var(--gray-300); }
.key-row-revoked { opacity: 0.5; }
.agent-key-info { display:flex; flex-direction:column; gap:4px; min-width:0; }
.agent-key-name { font-weight:600; font-size:13px; color:var(--text-primary); }
.agent-key-meta { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.agent-key-prefix { font-size:12px; background:#f1f5f9; padding:1px 6px; border-radius:4px; color:#4f46e5; }
.agent-key-stat { font-size:11px; color:var(--text-secondary); }
.agent-key-scopes { display:flex; flex-wrap:wrap; gap:4px; margin-top:2px; }
.agent-key-actions { flex-shrink:0; padding-top:2px; }

.key-scope-chip {
  font-size:10px; font-weight:500; padding:2px 7px;
  border-radius:99px; background:#ede9fe; color:#4f46e5;
}

/* ── Key Scopes Grid (in modal) ─────────────────────────────────────────── */
.key-scopes-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.key-scope-option {
  display:flex; align-items:flex-start; gap:8px;
  padding:8px 10px; border:1.5px solid var(--border); border-radius:8px;
  cursor:pointer; transition:border-color 0.15s, background 0.15s;
}
.key-scope-option:has(input:checked) { border-color:#6366f1; background:#f5f3ff; }
.key-scope-option input { margin-top:2px; accent-color:#6366f1; }
.key-scope-option span { font-size:12px; font-weight:600; color:var(--text-primary); display:block; }
.key-scope-option small { font-size:10px; color:var(--text-secondary); display:block; }

/* ── Key Reveal ─────────────────────────────────────────────────────────── */
.key-reveal-box {
  display:flex; gap:10px; align-items:flex-start;
  padding:12px 14px; background:#f0fdf4; border:1.5px solid #86efac;
  border-radius:10px; margin-bottom:12px;
}
.key-reveal-box p { font-size:13px; color:var(--text-primary); line-height:1.5; }
.key-reveal-value {
  font-family:monospace; font-size:12px; word-break:break-all;
  background:var(--gray-100); padding:10px 12px; border-radius:8px;
  color:#4f46e5; border:1px solid var(--border); margin-bottom:12px;
  user-select:all;
}
