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

/* ─── Variables ──────────────────────────────────────────────── */

:root, [data-theme="dark"] {
  --bg:           #111111;
  --surface:      #191919;
  --surface2:     #1f1f1f;
  --surface3:     #262626;
  --border:       #2a2a2a;
  --border-focus: #444444;
  --text:         #e8e8e8;
  --text-2:       #a0a0a0;
  --text-3:       #777777;
  --accent:       #e8e8e8;
  --danger:       #cc4444;
  --danger-bg:    rgba(204, 68, 68, 0.08);
  --danger-border:rgba(204, 68, 68, 0.2);
  --success:      #55aa55;
  --success-bg:   rgba(85, 170, 85, 0.08);
  --warn:         #aa8855;
  --warn-bg:      rgba(170, 136, 85, 0.08);

  /* Badge role colors */
  --badge-admin-bg:      #1a1a1f;  --badge-admin-fg:      #99f;
  --badge-journalist-bg: #1a1f1a;  --badge-journalist-fg: #7a7;
  --badge-researcher-bg: #1f1f1a;  --badge-researcher-fg: #aa7;
  --badge-extern-bg:     #1f1a1a;  --badge-extern-fg:     #a77;
  --badge-active-bg:     #1a1f1a;  --badge-active-fg:     #7a7;
  --badge-inactive-bg:   #1f1a1a;  --badge-inactive-fg:   #a77;
  --badge-pending-bg:    #1f1f1a;  --badge-pending-fg:    #aa7;

  /* Signal category colors */
  --sig-wirtschaft-bg:    rgba(170,136,85,.18);   --sig-wirtschaft-fg:    #c8a060;
  --sig-politik-bg:       rgba(80,130,200,.18);   --sig-politik-fg:       #6090d0;
  --sig-justiz-bg:        rgba(140,90,200,.18);   --sig-justiz-fg:        #a070d0;
  --sig-finanz-bg:        rgba(85,170,85,.18);    --sig-finanz-fg:        #60b060;
  --sig-international-bg: rgba(60,160,160,.18);   --sig-international-fg: #50b0b0;
  --sig-recht-bg:         rgba(100,110,200,.18);  --sig-recht-fg:         #8090d0;
  --sig-umwelt-bg:        rgba(100,170,60,.18);   --sig-umwelt-fg:        #80c040;
  --sig-sicherheit-bg:    rgba(200,80,80,.18);    --sig-sicherheit-fg:    #d06060;
  --sig-media-bg:         rgba(200,80,180,.18);   --sig-media-fg:         #d060c0;
  --sig-investigativ-bg:  rgba(220,140,40,.18);   --sig-investigativ-fg:  #d09040;

  /* Z-index scale */
  --z-sidebar:    100;
  --z-overlay:    200;
  --z-modal:      300;
  --z-writing:    250;
  --z-upload:     300;
  --z-toast:      400;

  --radius:       8px;
  --radius-sm:    6px;
  --radius-xs:    4px;
  --font:         'Inter', -apple-system, system-ui, sans-serif;
  --sidebar-w:    200px;
  --transition:   0.15s ease;
}

[data-theme="light"] {
  --bg:           #f5f5f5;
  --surface:      #ffffff;
  --surface2:     #f0f0f0;
  --surface3:     #e8e8e8;
  --border:       #cccccc;
  --border-focus: #999999;
  --text:         #1a1a1a;
  --text-2:       #555555;
  --text-3:       #505050;
  --accent:       #1a1a1a;
  --danger:       #b03030;
  --danger-bg:    rgba(176, 48, 48, 0.08);
  --danger-border:rgba(176, 48, 48, 0.2);
  --success:      #33aa77;
  --success-bg:   rgba(51, 170, 119, 0.08);
  --warn:         #8a6020;
  --warn-bg:      rgba(138, 96, 32, 0.08);

  --badge-admin-bg:      #ebebff;  --badge-admin-fg:      #5555cc;
  --badge-journalist-bg: #ebffeb;  --badge-journalist-fg: #336633;
  --badge-researcher-bg: #fffaeb;  --badge-researcher-fg: #7a5500;
  --badge-extern-bg:     #ffebeb;  --badge-extern-fg:     #883333;
  --badge-active-bg:     #ebffeb;  --badge-active-fg:     #336633;
  --badge-inactive-bg:   #ffebeb;  --badge-inactive-fg:   #883333;
  --badge-pending-bg:    #fffaeb;  --badge-pending-fg:    #7a5500;

  --sig-wirtschaft-bg:    rgba(138,96,32,.12);    --sig-wirtschaft-fg:    #8a6020;
  --sig-politik-bg:       rgba(50,90,170,.12);    --sig-politik-fg:       #3a5aa0;
  --sig-justiz-bg:        rgba(100,60,160,.12);   --sig-justiz-fg:        #6a40a0;
  --sig-finanz-bg:        rgba(40,130,40,.12);    --sig-finanz-fg:        #2a7a2a;
  --sig-international-bg: rgba(30,120,120,.12);   --sig-international-fg: #207878;
  --sig-recht-bg:         rgba(60,70,160,.12);    --sig-recht-fg:         #4050a0;
  --sig-umwelt-bg:        rgba(60,130,30,.12);    --sig-umwelt-fg:        #3c8020;
  --sig-sicherheit-bg:    rgba(180,50,50,.12);    --sig-sicherheit-fg:    #a03030;
  --sig-media-bg:         rgba(160,50,140,.12);   --sig-media-fg:         #a03090;
  --sig-investigativ-bg:  rgba(180,100,20,.12);   --sig-investigativ-fg:  #b06a14;
}

/* ─── Reset & Base ───────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Typography ─────────────────────────────────────────────── */

h1 { font-size: 17px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
h4 { font-size: 13px; font-weight: 600; }

.text-sm   { font-size: 13px; }
.text-xs   { font-size: 12px; }
.text-xxs  { font-size: 11px; }
.text-muted { color: var(--text-2); }
.text-faint { color: var(--text-3); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warn    { color: var(--warn); }
.font-mono { font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace; }
.font-medium  { font-weight: 500; }
.font-semibold { font-weight: 600; }
.label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

/* ─── Layout ─────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: var(--z-sidebar);
  overflow-y: auto;
}

.sidebar-brand {
  display: block;
  padding: 20px 16px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sidebar-sub {
  display: block;
  padding: 0 16px 16px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.sidebar-nav { flex: 1; padding: 4px 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--surface3); color: var(--text); font-weight: 500; }

.sidebar-section {
  padding: 12px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

.main {
  grid-column: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.view-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.view-header h1 { font-size: 15px; font-weight: 600; }

.view-body { padding: 24px; flex: 1; }

/* Two-column detail layout */
.detail-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
}

.detail-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px;
}

.detail-panel {
  overflow-y: auto;
  padding: 24px;
}

/* ─── Buttons ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: opacity var(--transition), background var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:hover:not(:disabled) { opacity: 0.85; text-decoration: none; }

.btn-primary {
  background: var(--text);
  color: var(--bg);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-focus); opacity: 1; }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.btn-danger:hover:not(:disabled) { opacity: 0.8; }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }

/* ─── Form Elements ──────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--border-focus);
}

input::placeholder, textarea::placeholder {
  color: var(--text-3);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-group input { flex: 1; }

/* ─── Cards ──────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-sm {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  transition: border-color var(--transition);
}
.card-sm:hover { border-color: var(--border-focus); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
}

/* ─── Badges ─────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface3);
  color: var(--text-2);
}

.badge-admin      { background: var(--badge-admin-bg);      color: var(--badge-admin-fg); }
.badge-journalist { background: var(--badge-journalist-bg); color: var(--badge-journalist-fg); }
.badge-researcher { background: var(--badge-researcher-bg); color: var(--badge-researcher-fg); }
.badge-extern     { background: var(--badge-extern-bg);     color: var(--badge-extern-fg); }
.badge-active     { background: var(--badge-active-bg);     color: var(--badge-active-fg); }
.badge-inactive   { background: var(--badge-inactive-bg);   color: var(--badge-inactive-fg); }
.badge-pending    { background: var(--badge-pending-bg);    color: var(--badge-pending-fg); }

.btn-reset-override {
  background: none; border: none; padding: 0 2px;
  cursor: pointer; color: inherit; opacity: 0.6; font-size: 11px; line-height: 1;
}
.btn-reset-override:hover { opacity: 1; }

.btn-badge-remove {
  background: none; border: none; padding: 0 0 0 4px;
  cursor: pointer; color: inherit; opacity: 0.5; font-size: 12px; line-height: 1;
}
.btn-badge-remove:hover { opacity: 1; }

/* ─── Tables ─────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: var(--surface2);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  padding: 10px 14px;
  text-align: left;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface2); }
tbody tr.clickable { cursor: pointer; }

/* Permission matrix table */
.matrix th, .matrix td {
  text-align: center;
  padding: 8px 12px;
}
.matrix th:first-child, .matrix td:first-child {
  text-align: left;
  min-width: 180px;
}

/* ─── Toggle / Checkbox ──────────────────────────────────────── */

.toggle {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 18px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-3);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--success-bg);
  border-color: var(--success);
}

.toggle input:checked + .toggle-slider::before {
  transform: translate(14px, -50%);
  background: var(--success);
}

.toggle input:disabled + .toggle-slider { opacity: 0.4; cursor: not-allowed; }

/* ─── Alerts ─────────────────────────────────────────────────── */

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-2);
}

.alert-error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.alert-success {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.alert-warn {
  background: var(--warn-bg);
  border-color: var(--warn);
  color: var(--warn);
}

/* ─── Modals ─────────────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: var(--z-overlay);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title { font-size: 15px; font-weight: 600; }

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ─── List Items ─────────────────────────────────────────────── */

.list-item {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}

.list-item:hover { background: var(--surface2); }
.list-item.active { background: var(--surface3); border-color: var(--border); }

/* ─── Divider ────────────────────────────────────────────────── */

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ─── Toast ──────────────────────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  pointer-events: all;
  animation: toast-in 0.2s ease;
  min-width: 200px;
  max-width: 360px;
}

.toast-success { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.toast-error   { border-color: var(--danger-border); color: var(--danger); background: var(--danger-bg); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Loading ────────────────────────────────────────────────── */

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--text-2);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

.skeleton {
  background: var(--surface2);
  border-radius: var(--radius-xs);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* ─── Utilities ──────────────────────────────────────────────── */

.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1      { flex: 1; }
.flex-wrap   { flex-wrap: wrap; }

.gap-2  { gap: 2px; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mb-4   { margin-bottom: 4px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }

.w-full  { width: 100%; }
.grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4  { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden   { display: none; }

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    left: calc(-1 * var(--sidebar-w) - 2px);
    z-index: var(--z-modal);
    transition: left 0.2s ease;
  }

  .sidebar.open { left: 0; }

  .main { grid-column: 1; }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .view-header { padding-left: 52px; }
}

/* ── Datenpools ─────────────────────────────────────────────────────────── */
.datapools-list { flex: 1; overflow-y: auto; padding: 0 8px; display: none; }
.datapools-list.active { display: flex; flex-direction: column; gap: 6px; }
.pool-item {
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pool-item:hover { background: var(--surface3); }
.pool-item-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-item-meta { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.pool-active-toggle { font-size: 14px; cursor: pointer; opacity: 0.5; flex-shrink: 0; }
.pool-active-toggle.on { opacity: 1; color: var(--success); }
/* ── Datapool Detail Page ────────────────────────────────────────────────── */
.dp-page { max-width: 760px; margin: 0 auto; padding: 28px 20px 60px; }
.dp-header { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.dp-back { font-size: 13px; color: var(--text-2); flex-shrink: 0; }
.dp-back:hover { color: var(--text); text-decoration: none; }
.dp-pool-name { flex: 1; }
.dp-desc { margin-bottom: 20px; }
.dp-section { margin-bottom: 32px; }
.dp-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dp-subsection-title { margin: 20px 0 8px; }
.dp-doc-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; }
.dp-doc-row:hover { background: var(--surface2); }
.dp-doc-name { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-doc-meta { font-size: 11px; color: var(--text-3); flex-shrink: 0; white-space: nowrap; }
.dp-doc-status { font-size: 11px; flex-shrink: 0; }
.dp-status-indexed { color: var(--success); }
.dp-status-pending { color: var(--warn); }
.dp-status-failed { color: var(--danger); }
.dp-invite-form { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.dp-invite-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; }
.dp-invite-row:hover { background: var(--surface2); }
.dp-invite-meta { flex: 1; font-size: 12px; color: var(--text-2); }
.dp-member-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; }
.dp-member-row:hover { background: var(--surface2); }
.dp-member-id { flex: 1; font-size: 13px; color: var(--text-2); }
.dp-empty { padding: 12px 8px; font-size: 13px; color: var(--text-3); }
.dp-loading { padding: 20px 8px; font-size: 13px; color: var(--text-3); text-align: center; }

/* ─── Signals ────────────────────────────────────────────────── */

/* Nav badge */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  background: var(--surface3);
  color: var(--text-2);
  vertical-align: middle;
}

/* Sidebar signals list */
.signals-sidebar { padding: 8px 4px; }
.sig-sidebar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 13px;
}
.sig-sidebar-row:hover { background: var(--surface2); }
.sig-sidebar-row.active { background: var(--surface2); color: var(--text); }
.sig-sidebar-count { font-size: 11px; color: var(--text-3); }

/* Filter bar */
.sig-header {
  padding: 14px 20px;
  padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sig-header-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}
.sig-header-count {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 400;
}
.sig-sort-inline {
  margin-left: auto;
  flex-shrink: 0;
}
.sig-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: var(--bg);
  flex-shrink: 0;
}
.sig-select {
  width: auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-2);
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  font-family: var(--font);
  appearance: none;
  -webkit-appearance: none;
  padding-right: 20px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a0a0a0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}
.sig-select:focus { outline: none; border-color: var(--border-focus); color: var(--text); }
.sig-select.active { border-color: var(--border-focus); color: var(--text); }
.sig-reset { font-size: 12px; color: var(--text-3); cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.sig-reset:hover { color: var(--text-2); }

/* Body layout: grid + detail panel side by side */
.sig-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.sig-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.sig-stats {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 12px;
}
.sig-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 900px) { .sig-grid { grid-template-columns: 1fr; } }
.sig-load-more { text-align: center; padding: 16px 0; }
.sig-empty { padding: 40px 0; text-align: center; font-size: 13px; color: var(--text-3); }
.sig-loading { padding: 40px 0; text-align: center; font-size: 13px; color: var(--text-3); }

/* Signal tile */
.sig-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sig-tile:hover { border-color: var(--border-focus); }
.sig-tile.active { border-color: var(--text-3); }
.sig-tile-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.sig-tile-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sig-tile-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sig-tile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  margin-top: auto;
}
.sig-tile-meta-left { display: flex; align-items: center; gap: 8px; }
.sig-tile-action {
  font-size: 11px;
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}
.sig-tile-action:hover { background: var(--surface3); color: var(--text-2); }

/* Detail panel */
.sig-detail-panel {
  width: 360px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.sig-detail-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.sig-detail-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.sig-detail-close:hover { color: var(--text-2); }
.sig-detail-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.sig-detail-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 6px;
}
.sig-detail-text { font-size: 13px; color: var(--text-2); line-height: 1.55; }
.sig-evidence-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 12px;
}
.sig-evidence-key { color: var(--text-3); white-space: nowrap; }
.sig-evidence-val { color: var(--text-2); word-break: break-word; }
.sig-entities { display: flex; flex-wrap: wrap; gap: 6px; }
.sig-entity {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface3);
  color: var(--text-2);
}
.sig-detail-actions {
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
}

/* Category badge colors */
.sig-cat {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
}
.sig-cat-wirtschaft    { background: var(--sig-wirtschaft-bg);    color: var(--sig-wirtschaft-fg); }
.sig-cat-politik       { background: var(--sig-politik-bg);       color: var(--sig-politik-fg); }
.sig-cat-justiz        { background: var(--sig-justiz-bg);        color: var(--sig-justiz-fg); }
.sig-cat-finanz        { background: var(--sig-finanz-bg);        color: var(--sig-finanz-fg); }
.sig-cat-international { background: var(--sig-international-bg); color: var(--sig-international-fg); }
.sig-cat-recht         { background: var(--sig-recht-bg);         color: var(--sig-recht-fg); }
.sig-cat-umwelt        { background: var(--sig-umwelt-bg);        color: var(--sig-umwelt-fg); }
.sig-cat-sicherheit    { background: var(--sig-sicherheit-bg);    color: var(--sig-sicherheit-fg); }
.sig-cat-media         { background: var(--sig-media-bg);         color: var(--sig-media-fg); }
.sig-cat-investigativ  { background: var(--sig-investigativ-bg);  color: var(--sig-investigativ-fg); }

/* Score indicator */
.sig-score-high { color: var(--success); font-weight: 600; }
.sig-score-mid  { color: var(--warn);    font-weight: 600; }
.sig-score-low  { color: var(--text-3);  font-weight: 600; }

/* ─── Focus Indicators ──────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.nav-item:focus-visible,
.sig-tile:focus-visible,
.sig-select:focus-visible,
.list-item:focus-visible,
.pool-item:focus-visible,
.sig-sidebar-row:focus-visible,
.toggle-slider:focus-visible,
.sig-tile-action:focus-visible,
.sig-detail-close:focus-visible,
.btn-reset-override:focus-visible,
.btn-badge-remove:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(68, 68, 68, 0.3);
}

.toggle input:focus-visible + .toggle-slider {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ─── Tablet Breakpoint ─────────────────────────────────────── */

@media (min-width: 769px) and (max-width: 1024px) {
  .sig-grid { grid-template-columns: 1fr; }
  .sig-detail-panel { width: 300px; }
  .detail-layout { grid-template-columns: 240px 1fr; }
}

/* ─── Mobile Responsive Fixes ───────────────────────────────── */

@media (max-width: 768px) {
  .modal {
    max-width: calc(100vw - 40px);
  }

  .sig-detail-panel {
    width: 100%;
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    border-left: none;
  }
}

/* ─── Landscape Mobile ──────────────────────────────────────── */

@media (max-height: 500px) and (orientation: landscape) {
  .view-header { padding: 8px 24px 8px; }
  .view-body { padding: 12px; }
}

/* ─── Reduced Motion ────────────────────────────────────────── */

/* ─── Audio Player (Datapool) ────────────────────────────── */

.audio-ref { display: inline; }
.audio-ref-btn {
  display: inline;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.audio-ref-btn:hover { background: var(--bg-2); }
.audio-player-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.audio-player-inline audio {
  flex: 1;
  height: 32px;
  min-width: 200px;
}
.audio-dp-link {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  text-decoration: none;
}
.audio-dp-link:hover { color: var(--accent); text-decoration: underline; }
.audio-ref { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.audio-transcript-btn { opacity: 0.7; font-size: 11px; }
.audio-transcript-btn:hover, .audio-transcript-btn.active { opacity: 1; background: var(--bg-2); }
.transcript-panel {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.transcript-title { font-weight: 500; }
.transcript-close {
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--text-3); padding: 0 4px;
}
.transcript-close:hover { color: var(--text-1); }
.transcript-body {
  padding: 10px 12px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-2);
}
.transcript-body mark {
  background: #fef08a;
  color: inherit;
  padding: 1px 2px;
  border-radius: 2px;
}
[data-theme="dark"] .transcript-body mark { background: #854d0e; color: #fef9c3; }
.transcript-loading {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}
.dp-audio-mini {
  width: 100%;
  height: 32px;
  margin-top: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .spinner { animation: none; border-top-color: var(--text-2); }
  .skeleton { animation: none; opacity: 0.7; }
}
