/* ═══════════════════════════════════════════════════════
   KI-Auto-Doku-Ablagesystem – Style Sheet
   ═══════════════════════════════════════════════════════ */

/* ── CSS Variables (Theme) ──────────────────────────── */
:root {
  --bg-primary: #f0f2f5;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f5f7fa;
  --bg-code: #f8f9fa;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --border: #e5e7eb;
  --shadow: rgba(0, 0, 0, 0.06);
  --shadow-md: rgba(0, 0, 0, 0.1);
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --bg-hover: #334155;
  --bg-code: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #60a5fa;
  --accent-hover: #93bbfd;
  --success: #34d399;
  --success-bg: #064e3b;
  --warning: #fbbf24;
  --warning-bg: #78350f;
  --danger: #f87171;
  --danger-bg: #7f1d1d;
  --border: #334155;
  --shadow: rgba(0, 0, 0, 0.2);
  --shadow-md: rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Fixed Top Container ───────────────────────────── */
.fixed-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 6px var(--shadow);
}

/* ── Header ─────────────────────────────────────────── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-icon { font-size: 24px; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.badge-online { background: var(--success-bg); color: var(--success); }
.badge-online::before { background: var(--success); box-shadow: 0 0 6px var(--success); }
.badge-offline { background: var(--danger-bg); color: var(--danger); }
.badge-offline::before { background: var(--danger); }

.badge-conf {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-conf.high { background: var(--success-bg); color: var(--success); }
.badge-conf.medium { background: var(--warning-bg); color: var(--warning); }
.badge-conf.low { background: var(--danger-bg); color: var(--danger); }

.badge-status {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-status.verschoben { background: var(--success-bg); color: var(--success); }
.badge-status.dry_run { background: var(--warning-bg); color: var(--warning); }
.badge-status.fehler { background: var(--danger-bg); color: var(--danger); }
.badge-status.klassifiziert { background: #e0e7ff; color: #4f46e5; }

/* ── Tab Navigation ─────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  padding: 12px 20px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: var(--font);
}

.tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── Content Area ───────────────────────────────────── */
.content {
  padding: 24px;
  padding-top: 120px;
  max-width: 1400px;
  margin: 0 auto;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px var(--shadow);
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

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

.card-header h2 { margin-bottom: 0; }

.card-full { min-height: 500px; display: flex; flex-direction: column; }

/* ── Grid ───────────────────────────────────────────── */
.grid { display: grid; gap: 20px; margin-bottom: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Stat Cards ─────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px var(--shadow);
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

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

/* ── Service Details ────────────────────────────────── */
.service-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.detail-row {
  padding: 8px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.detail-label {
  color: var(--text-secondary);
  font-weight: 500;
  margin-right: 6px;
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  color: white;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #1a1a2e; }
.btn-warning:hover { background: #d97706; }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-icon {
  background: var(--bg-hover);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: 50%;
}
.btn-icon:hover { background: var(--border); color: var(--text-primary); }

.btn-group { display: flex; gap: 8px; }

/* ── Inputs ─────────────────────────────────────────── */
.input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

select.input { cursor: pointer; }

/* ── Filter Bar ─────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .input { min-width: 120px; }
.filter-bar input[type="text"] { flex: 1; min-width: 200px; }

/* ── Tables ─────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}

.table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr.expandable { cursor: pointer; }
.table tbody tr.expanded { background: var(--bg-hover); }
.table tbody tr.detail-row-content td {
  padding: 12px 20px;
  background: var(--bg-hover);
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}

.table .text-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table .level-error { color: var(--danger); font-weight: 600; }
.table .level-warning { color: var(--warning); font-weight: 600; }

/* ── Pagination ─────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination .page-buttons {
  display: flex;
  gap: 4px;
}

.pagination .page-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
}

.pagination .page-btn:hover { background: var(--bg-hover); }
.pagination .page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.pagination .page-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Folder Tree ────────────────────────────────────── */
.folder-tree ul {
  list-style: none;
  padding-left: 20px;
}

.folder-tree > ul { padding-left: 0; }

.folder-tree li { margin: 2px 0; }

.folder-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.1s;
}

.folder-node:hover { background: var(--bg-hover); }
.folder-node .icon { font-size: 16px; transition: transform 0.15s; }
.folder-node.collapsed .icon { transform: rotate(-90deg); }
.folder-node .name { font-weight: 500; }
.folder-node .count { color: var(--text-muted); font-size: 12px; }
.folder-node .recent-count { color: var(--success); font-weight: 600; }
.folder-node.leaf .icon { transform: none; }

.folder-open-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.folder-node:hover .folder-open-btn { opacity: 1; }
.folder-open-btn:hover { background: var(--bg-primary); }

.folder-tree .children { overflow: hidden; transition: max-height 0.2s; }
.folder-tree .children.collapsed { display: none; }

/* ── File Nodes in Folder Tree ─────────────────────── */
.file-list { list-style: none; padding-left: 8px; }
.file-node {
  padding: 2px 8px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-node .file-icon { font-size: 12px; margin-right: 4px; }
.file-node.recent {
  color: var(--success);
  font-weight: 500;
}

/* ── Log Viewer ─────────────────────────────────────── */
.log-viewer {
  flex: 1;
  background: #1e1e2e;
  color: #cdd6f4;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-y: auto;
  max-height: 600px;
  min-height: 400px;
}

.log-line { white-space: pre-wrap; word-break: break-all; padding: 1px 0; }
.log-line.info { color: #cdd6f4; }
.log-line.warning { color: #f9e2af; }
.log-line.error { color: #f38ba8; }
.log-line.debug { color: #6c7086; }
.log-line.system { color: #89b4fa; font-style: italic; }

/* ── Settings Form ──────────────────────────────────── */
.settings-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.settings-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.form-group {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.form-group label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-group .input { width: 100%; }

.form-group .hint {
  grid-column: 2;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -4px;
}

.form-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-list-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.form-list-item .input { flex: 1; }
.form-list-item .btn-remove {
  background: var(--danger-bg);
  color: var(--danger);
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Toggle Label ───────────────────────────────────── */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ── Watch Folder Items ─────────────────────────────── */
.watch-folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 13px;
}

.watch-folder-item .wf-icon { font-size: 20px; }
.watch-folder-item .wf-path { flex: 1; word-break: break-all; font-family: var(--font-mono); font-size: 12px; }
.watch-folder-item .wf-count {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.watch-folder-item .wf-status { font-size: 16px; }

/* ── Feature Indicators ─────────────────────────────── */
.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
}

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

.feature-dot.on { background: var(--success); box-shadow: 0 0 6px var(--success); }
.feature-dot.off { background: var(--text-muted); }

/* ── Toast Notifications ────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: white;
  box-shadow: 0 4px 12px var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Empty States ───────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

/* ── Loading ────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 10px;
}

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

/* ── Workflow Process View (n8n-style) ─────────────── */
.wf-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.wf-canvas {
  position: relative;
  padding: 40px 10px;
  min-height: 220px;
  overflow-x: auto;
}

.wf-connections {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.wf-conn-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
}

.wf-conn-line {
  fill: none;
  stroke: transparent;
  stroke-width: 2.5;
  stroke-dasharray: 8 4;
  transition: stroke 0.3s;
}

.wf-conn-line.active {
  stroke: var(--accent);
  animation: wf-dash 0.6s linear infinite;
}

.wf-conn-line.completed {
  stroke: var(--success);
  stroke-dasharray: none;
  animation: none;
}

@keyframes wf-dash {
  to { stroke-dashoffset: -24; }
}

.wf-nodes {
  display: flex;
  justify-content: center;
  gap: 52px;
  position: relative;
  z-index: 2;
}

/* ── Node Card ──── */
.wf-node {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  width: 168px;
  transition: all 0.35s ease;
  box-shadow: 0 2px 8px var(--shadow);
  overflow: visible;
}

.wf-node:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px var(--shadow-md);
}

.wf-node-accent {
  height: 4px;
  width: 100%;
  border-radius: 10px 10px 0 0;
}

.wf-node-body {
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.wf-node-icon {
  font-size: 30px;
  line-height: 1;
}

.wf-node-info {
  min-height: 42px;
}

.wf-node-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.wf-node-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.3;
  max-width: 144px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Node Status Dot ──── */
.wf-node-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.3s;
  margin-top: 2px;
}

.wf-node-status.active {
  background: var(--warning);
  box-shadow: 0 0 12px var(--warning);
  animation: wf-pulse 1s ease-in-out infinite;
}

.wf-node-status.completed {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.wf-node-status.error {
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
}

@keyframes wf-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.6; }
}

/* ── Node State Borders ──── */
.wf-node.active {
  border-color: var(--warning);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.25);
  transform: translateY(-3px) scale(1.03);
}

.wf-node.completed {
  border-color: var(--success);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
}

.wf-node.error {
  border-color: var(--danger);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.25);
  animation: wf-shake 0.4s ease;
}

@keyframes wf-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* ── Connection Ports ──── */
.wf-node-port {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid;
  background: var(--bg-card);
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  transition: background 0.3s;
}

.wf-port-in { left: -7px; }
.wf-port-out { right: -7px; }

.wf-node.active .wf-port-in,
.wf-node.active .wf-port-out {
  background: var(--warning);
}

.wf-node.completed .wf-port-in,
.wf-node.completed .wf-port-out {
  background: var(--success);
}

.wf-node.error .wf-port-in {
  background: var(--danger);
}

/* ── Controls Bar ──── */
.wf-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  flex-wrap: wrap;
}

.wf-status-text {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Recent Filings List ──── */
.wf-recent {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.wf-recent h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.wf-recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.wf-recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
}

.wf-recent-item:hover {
  background: var(--bg-primary);
  border-color: var(--border);
}

.wf-recent-item.active {
  border-color: var(--accent);
  background: var(--bg-primary);
}

.wf-recent-status {
  font-size: 14px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.wf-recent-info {
  flex: 1;
  min-width: 0;
}

.wf-recent-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-recent-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Notification Badge & Pending Panel ─────────────── */
.notification-wrapper {
  position: relative;
}

.count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.5);
  animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.pending-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 420px;
  max-height: 70vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px var(--shadow-md);
  z-index: 200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: panel-slide 0.2s ease;
}

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

.pending-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.pending-panel-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.pending-actions-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* ── Pending Action Card ──────────────────────────── */
.pending-action-card {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.pending-action-card:hover {
  border-color: var(--accent);
}

.pending-action-card:last-child {
  margin-bottom: 0;
}

.pac-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pac-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.pac-filename {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.pac-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pac-suggestion {
  background: var(--bg-primary);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

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

.pac-suggestion .value {
  color: var(--text-primary);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 12px;
}

.pac-reasoning {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
}

.pac-confidence {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.pac-confidence.medium { background: var(--warning-bg); color: var(--warning); }
.pac-confidence.low { background: var(--danger-bg); color: var(--danger); }

.pac-actions {
  display: flex;
  gap: 6px;
}

.pac-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: 12px;
  padding: 6px 10px;
}

/* ── Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modal-fade 0.2s ease;
}

@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 500px;
  max-width: 90vw;
  max-height: 80vh;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modal-pop 0.25s ease;
}

@keyframes modal-pop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-body {
  padding: 20px;
}

.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.modal-value-small {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.4;
}

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

/* ── New status badges ─────────────────────────────── */
.badge-status.neuer_ordner { background: #dbeafe; color: #2563eb; }
.badge-status.ausstehend { background: var(--warning-bg); color: var(--warning); }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .wf-nodes { gap: 32px; }
  .wf-node { width: 140px; }
  .wf-node-icon { font-size: 24px; }
  .wf-node-desc { max-width: 120px; }
}

@media (max-width: 768px) {
  .header { padding: 12px 16px; }
  .content { padding: 16px; padding-top: 114px; }
  .tab-bar { padding: 0 16px; }
  .form-group { grid-template-columns: 1fr; }
  .service-details { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar .input { width: 100%; min-width: auto; }
  .wf-nodes {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }
  .wf-node { width: 220px; }
  .wf-node-port { display: none; }
  .wf-connections { display: none; }
  .wf-controls { flex-direction: column; align-items: flex-start; }
  .wf-status-text { margin-left: 0; }
  .pending-panel { width: calc(100vw - 32px); right: -8px; }
  .modal { width: calc(100vw - 32px); }
}

/* ── Read-Only Mode ──────────────────────────────────── */

.read-only-banner {
  background: linear-gradient(135deg, #1a3a5c, #2563eb);
  color: #fff;
  text-align: center;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

body.read-only .btn-group { display: none !important; }
body.read-only .folder-open-btn { display: none !important; }
body.read-only [data-tab="settings"] { display: none !important; }
body.read-only #tab-settings { display: none !important; }
body.read-only #pending-bell { display: none !important; }
body.read-only #modify-modal { display: none !important; }
body.read-only .pending-panel { display: none !important; }
