/* =====================================================================
   EPLAN Aufwandsschätzer – Sci-Fi Dark Theme
   ===================================================================== */

/* --- 1. Variables --------------------------------------------------- */
:root {
  --bg:        #07090f;
  --surface:   #0d1117;
  --surface-2: #111827;
  --surface-3: #1a2236;
  --surface-4: #1e2a42;

  --border:        rgba(0, 212, 255, 0.10);
  --border-med:    rgba(0, 212, 255, 0.22);
  --border-bright: rgba(0, 212, 255, 0.40);

  --accent:      #00d4ff;
  --accent-dim:  rgba(0, 212, 255, 0.12);
  --accent-glow: 0 0 18px rgba(0, 212, 255, 0.32);

  --accent2:     #7c3aff;
  --accent2-dim: rgba(124, 58, 255, 0.14);

  --success:     #00e5a0;
  --success-dim: rgba(0, 229, 160, 0.14);
  --warning:     #ffaa00;
  --warning-dim: rgba(255, 170, 0, 0.14);
  --danger:      #ff4444;
  --danger-dim:  rgba(255, 68, 68, 0.14);

  --text:        #c8ddf5;
  --text-dim:    #546e8a;
  --text-bright: #eef6ff;
  --text-muted:  #3d5570;

  --font:      'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --radius:    6px;
  --radius-lg: 10px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,.5);
  --shadow:    0 4px 20px rgba(0,0,0,.6);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.7);

  --t:     150ms ease;
  --t-med: 250ms ease;
}

/* --- 2. Reset ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--text-bright); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

/* --- 3. Layout ------------------------------------------------------ */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border-med);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; gap: 32px;
}
.app-main {
  flex: 1; padding: 32px 24px;
  max-width: 1200px; width: 100%; margin: 0 auto;
}
.app-footer {
  padding: 16px 24px; text-align: center;
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* --- 4. Logo & Nav -------------------------------------------------- */
.logo {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-bright); font-weight: 600; letter-spacing: .02em;
}
.logo-icon {
  width: 28px; height: 28px; color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(0,212,255,.5));
}
.logo-text strong { color: var(--accent); }
.header-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link {
  padding: 6px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; color: var(--text-dim);
  border: 1px solid transparent;
  transition: color var(--t), background var(--t), border-color var(--t);
}
.nav-link:hover {
  color: var(--text-bright); background: var(--accent-dim); border-color: var(--border);
}
.nav-link.active {
  color: var(--accent); background: var(--accent-dim); border-color: var(--border-med);
}

/* --- 5. Typography -------------------------------------------------- */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--text-bright); line-height: 1.2; }
h2 { font-size: 1.15rem; font-weight: 600; color: var(--text-bright); margin-bottom: 16px; }
h3 { font-size: 1rem; font-weight: 600; color: var(--text); }
.subtitle { color: var(--text-dim); font-size: .9rem; margin-top: 4px; }
.section { margin-bottom: 36px; }
.section-hint { font-size: .85rem; color: var(--text-dim); margin-bottom: 16px; }

/* --- Notes ---------------------------------------------------------- */
.notes-wrap { display: flex; flex-direction: column; gap: 8px; }
.notes-textarea {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: .9rem; font-family: inherit; color: var(--text-main);
  background: var(--bg-card); resize: vertical; min-height: 90px;
  line-height: 1.5;
}
.notes-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.notes-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.notes-chars { font-size: .78rem; color: var(--text-dim); }

/* --- 6. Buttons ----------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t); white-space: nowrap; letter-spacing: .02em;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); color: #000; border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: #22e4ff; box-shadow: var(--accent-glow);
}
.btn-secondary {
  background: var(--surface-3); color: var(--text); border-color: var(--border-med);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-4); border-color: var(--accent); color: var(--text-bright);
}
.btn-outline {
  background: transparent; color: var(--accent); border-color: var(--accent);
}
.btn-outline:hover:not(:disabled) {
  background: var(--accent-dim); box-shadow: var(--accent-glow);
}
.btn-danger {
  background: transparent; color: var(--danger); border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger-dim); }
.btn-large { padding: 11px 28px; font-size: 14px; }
.btn-sm    { padding: 5px 12px; font-size: 12px; }

/* --- 7. Badges ------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 99px;
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
}
.badge-warning { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(255,170,0,.25); }
.badge-success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(0,229,160,.25); }
.badge-info    { background: var(--accent-dim);  color: var(--accent);  border: 1px solid var(--border-med); }
.badge-muted   { background: var(--surface-3);   color: var(--text-dim);border: 1px solid var(--border); }
.badge-small {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
  background: var(--accent-dim); color: var(--accent);
  margin-left: 6px; border: 1px solid var(--border);
}

/* --- 8. Upload Page ------------------------------------------------- */
.page-upload { max-width: 720px; margin: 0 auto; }
.upload-hero { text-align: center; padding: 32px 0 28px; }
.upload-hero h1 { margin-bottom: 10px; letter-spacing: -.02em; }
.upload-hero .subtitle { max-width: 500px; margin: 0 auto 20px; line-height: 1.7; }
.upload-card {
  background: var(--surface-2); border: 1px solid var(--border-med);
  border-radius: var(--radius-xl); padding: 28px; margin-bottom: 28px;
}
.drop-zone {
  border: 2px dashed var(--border-med); border-radius: var(--radius-lg);
  padding: 44px 24px; text-align: center; cursor: pointer;
  background: var(--surface); position: relative;
  transition: all var(--t-med);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent); background: var(--accent-dim);
  box-shadow: inset 0 0 40px rgba(0,212,255,.04), var(--accent-glow);
}
.drop-zone-icon { color: var(--text-dim); margin-bottom: 14px; transition: color var(--t); }
.drop-zone:hover .drop-zone-icon,
.drop-zone.drag-over .drop-zone-icon { color: var(--accent); }
.drop-zone-text { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.file-link { color: var(--accent); cursor: pointer; font-weight: 600; }
.file-link:hover { text-decoration: underline; }
.drop-zone-hint { font-size: 12px; color: var(--text-dim); }
.file-input-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.file-info {
  display: flex; align-items: center; gap: 12px;
  background: var(--accent-dim); border: 1px solid var(--border-med);
  border-radius: var(--radius); padding: 10px 14px; margin-top: 14px; font-size: 13px;
}
.file-name { font-weight: 600; color: var(--text-bright); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text-dim); white-space: nowrap; }

.progress-section { margin-top: 20px; padding: 16px; background: var(--surface-2); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.progress-bar-track { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-bottom: 12px; }
.progress-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 500ms ease;
  box-shadow: 0 0 12px rgba(0,212,255,.5);
}
.progress-text { font-size: 13px; color: var(--text); text-align: center; font-family: var(--font-mono); margin-bottom: 10px; font-weight: 500; }
.progress-steps { display: flex; justify-content: space-between; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.progress-step { font-size: 10px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; }
.progress-step--active { color: var(--accent); }
.progress-step--done { color: var(--success); }
.progress-step__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

#submit-btn { width: 100%; margin-top: 18px; justify-content: center; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 28px; }
.info-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.info-card-icon { font-size: 24px; margin-bottom: 10px; }
.info-card h3 { font-size: 13px; margin-bottom: 6px; }
.info-card p { font-size: 12px; color: var(--text-dim); line-height: 1.6; }

/* --- 9. Result Page ------------------------------------------------- */
.page-result { max-width: 1100px; }
.result-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 32px; flex-wrap: wrap;
}
.result-header h1 { font-size: 1.4rem; word-break: break-all; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.calc-table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.calc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.calc-table thead tr { background: var(--surface-3); }
.calc-table thead th {
  padding: 11px 16px; text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--accent);
}
.calc-table thead th.text-right { text-align: right; }
.calc-table tbody tr { border-top: 1px solid var(--border); transition: background var(--t); }
.calc-table tbody tr:hover { background: var(--surface-3); }
.calc-table tbody td { padding: 11px 16px; color: var(--text); }
.calc-table tfoot tr { border-top: 2px solid var(--border-med); background: var(--surface-3); }
.calc-table tfoot td { padding: 13px 16px; font-weight: 600; color: var(--text-bright); }
.text-right { text-align: right; }
.stundensatz-hint { font-size: 11px; color: var(--text-dim); font-weight: 400; margin-left: 6px; }
.netto-highlight {
  font-family: var(--font-mono); font-size: 1.1rem;
  color: var(--accent) !important;
  text-shadow: 0 0 12px rgba(0,212,255,.35);
}

.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.page-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t);
}
.page-card:hover { border-color: var(--border-med); box-shadow: 0 0 12px rgba(0,212,255,.08); }
.page-card--override { border-color: var(--warning); box-shadow: 0 0 12px rgba(255,170,0,.12); }
.page-card--selected { border-color: var(--accent) !important; box-shadow: 0 0 0 2px rgba(37,99,235,.35) !important; }

/* Checkbox auf der Vorschaukarte */
.page-select-wrap {
  position: absolute; top: 6px; right: 6px; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: rgba(7,9,15,.65); border-radius: 5px; cursor: pointer;
}
.page-checkbox { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); }

/* Massenbearbeitungs-Leiste */
.bulk-bar {
  position: sticky; bottom: 0; z-index: 200;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--accent);
  border-radius: 10px; padding: 10px 16px;
  box-shadow: 0 -4px 24px rgba(37,99,235,.18);
  margin-bottom: 12px;
}
.bulk-bar-left  { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.bulk-bar-center { display: flex; align-items: center; gap: 8px; }
.bulk-bar-right { display: flex; align-items: center; }
.bulk-count { font-weight: 600; font-size: .9rem; color: var(--accent); white-space: nowrap; }
.bulk-link {
  background: none; border: none; padding: 2px 6px; font-size: .8rem;
  color: var(--text-dim); cursor: pointer; border-radius: 4px;
  text-decoration: underline; text-underline-offset: 2px;
}
.bulk-link:hover { color: var(--text-main); }
.bulk-type-select { min-width: 180px; }
.bulk-subtype-select { min-width: 160px; }
.page-preview { position: relative; background: var(--surface); height: 175px; overflow: hidden; cursor: zoom-in; }
.page-img { width: 100%; height: 100%; object-fit: contain; transition: transform var(--t-med); }
.page-preview:hover .page-img { transform: scale(1.04); }
.page-number-badge {
  position: absolute; top: 6px; left: 6px;
  background: rgba(7,9,15,.75); color: var(--text-bright);
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 99px; font-family: var(--font-mono);
  border: 1px solid var(--border); backdrop-filter: blur(4px);
}
.page-meta { padding: 10px 12px; }
.type-select {
  width: 100%; background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 5px 8px; font-size: 11px; margin-bottom: 8px;
  appearance: none; cursor: pointer; transition: border-color var(--t);
}
.type-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.page-hours { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.hours-value { font-family: var(--font-mono); font-weight: 600; color: var(--accent); font-size: 11px; }
.override-indicator { color: var(--warning); font-size: 13px; }
.confidence-bar { height: 3px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.confidence-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--warning), var(--success));
  transition: width 600ms ease;
}
.ocr-badge {
  display: inline-block; margin-top: 6px;
  padding: 1px 7px; border-radius: 99px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid var(--border-med);
}

/* --- 10. Analysis Page ---------------------------------------------- */
.page-analysis { max-width: 1100px; }
.analysis-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 12px; margin-bottom: 32px;
}
.analysis-header h1 { font-size: 1.3rem; word-break: break-all; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 28px; }
.kpi-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  position: relative; overflow: hidden; transition: border-color var(--t);
}
.kpi-card::before, .kpi-card::after {
  content: ''; position: absolute;
  width: 8px; height: 8px; border-color: var(--accent); border-style: solid; opacity: .4;
}
.kpi-card::before { top: 0; left: 0; border-width: 1.5px 0 0 1.5px; }
.kpi-card::after  { bottom: 0; right: 0; border-width: 0 1.5px 1.5px 0; }
.kpi-card:hover { border-color: var(--border-med); }
.kpi-label { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.kpi-value { font-family: var(--font-mono); font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: var(--accent); text-shadow: 0 0 16px rgba(0,212,255,.3); }
.kpi-value.kpi-eur  { color: var(--success); text-shadow: 0 0 16px rgba(0,229,160,.3); }
.kpi-value.kpi-warn { color: var(--warning); text-shadow: 0 0 16px rgba(255,170,0,.3); }
.kpi-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.chart-panel {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; position: relative;
}
.chart-panel::before, .chart-panel::after {
  content: ''; position: absolute;
  width: 8px; height: 8px; border-color: var(--accent); border-style: solid; opacity: .3;
}
.chart-panel::before { top: 0; left: 0; border-width: 1.5px 0 0 1.5px; }
.chart-panel::after  { bottom: 0; right: 0; border-width: 0 1.5px 1.5px 0; }
.chart-panel h3 { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 16px; }
.chart-wrap { position: relative; height: 240px; }

.type-stats-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.type-stats-table thead th {
  padding: 9px 14px; text-align: left;
  font-size: 10px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--accent);
  background: var(--surface-3); border-bottom: 1px solid var(--border);
}
.type-stats-table thead th.text-right { text-align: right; }
.type-stats-table tbody tr { border-bottom: 1px solid var(--border); transition: background var(--t); }
.type-stats-table tbody tr:hover { background: var(--surface-3); }
.type-stats-table td { padding: 9px 14px; color: var(--text); }
.type-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; flex-shrink: 0; }
.mini-bar-track { height: 5px; background: var(--surface-3); border-radius: 99px; overflow: hidden; min-width: 60px; }
.mini-bar-fill { height: 100%; border-radius: 99px; transition: width 600ms ease; }

.confidence-section { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.uncertain-list { list-style: none; }
.uncertain-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.uncertain-item:last-child { border-bottom: none; }
.uncertain-thumb { width: 40px; height: 40px; object-fit: contain; border-radius: var(--radius); background: var(--surface-3); flex-shrink: 0; cursor: zoom-in; }
.uncertain-meta { flex: 1; min-width: 0; }
.uncertain-page { font-size: 11px; font-family: var(--font-mono); color: var(--text-dim); }
.uncertain-type { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uncertain-conf { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--warning); padding: 2px 7px; background: var(--warning-dim); border-radius: 99px; flex-shrink: 0; }
.no-data-hint { font-size: 13px; color: var(--text-dim); padding: 16px 0; display: flex; align-items: center; gap: 8px; }

.source-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.source-chip { display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-3); border: 1px solid var(--border); color: var(--text); }
.source-chip-count { font-family: var(--font-mono); color: var(--accent); }

.keyword-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.keyword-tag { display: flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 11px; background: var(--accent-dim); border: 1px solid var(--border-med); color: var(--text); font-family: var(--font-mono); }
.keyword-tag-count { color: var(--accent); font-weight: 700; }

/* --- 11. Article Stats ---------------------------------------------- */
.article-quality-badge {
  display: inline-block; margin-left: 10px;
  padding: 2px 10px; border-radius: 99px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em;
  text-transform: none; vertical-align: middle;
}
.article-quality-gut       { background: rgba(0,229,160,.15); color: var(--success); border: 1px solid rgba(0,229,160,.3); }
.article-quality-mittel    { background: rgba(255,170,0,.12); color: var(--warning); border: 1px solid rgba(255,170,0,.3); }
.article-quality-gering    { background: rgba(255,68,68,.12); color: var(--danger);  border: 1px solid rgba(255,68,68,.3); }
.article-quality-keine_daten { background: var(--surface-3); color: var(--text-dim); border: 1px solid var(--border); }

.complexity-badge {
  display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 10px; font-weight: 600;
}
.complexity-einfach { background: rgba(0,229,160,.15); color: var(--success); }
.complexity-mittel  { background: rgba(255,170,0,.12);  color: var(--warning); }
.complexity-komplex { background: rgba(255,68,68,.12);  color: var(--danger); }

/* --- 12. Learning Badges (Result-Seite) ----------------------------- */
.learn-badge {
  display: inline-block; margin-top: 5px;
  padding: 1px 8px; border-radius: 99px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
.learn-badge--applied {
  background: rgba(0,229,160,.15); color: var(--success);
  border: 1px solid rgba(0,229,160,.35);
}
.learn-badge--hint {
  background: rgba(0,212,255,.12); color: var(--accent);
  border: 1px solid rgba(0,212,255,.25);
}

/* Vision-Badges */
.vision-badge {
  display: inline-block; margin-top: 5px;
  padding: 1px 8px; border-radius: 99px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
.vision-badge--override {
  background: rgba(255,170,0,.15); color: var(--warning);
  border: 1px solid rgba(255,170,0,.35);
}
.vision-badge--confirmed {
  background: rgba(0,229,160,.10); color: var(--success);
  border: 1px solid rgba(0,229,160,.25);
}
.vision-badge--conflict {
  background: rgba(255,68,68,.14); color: var(--danger);
  border: 1px solid rgba(255,68,68,.35);
}

/* Komplexitäts-Badges */
.complexity-badge {
  display: inline-block; margin-top: 5px;
  padding: 1px 8px; border-radius: 99px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
.complexity-badge--einfach {
  background: rgba(0,229,160,.10); color: var(--success);
  border: 1px solid rgba(0,229,160,.25);
}
.complexity-badge--komplex {
  background: rgba(255,170,0,.14); color: var(--warning);
  border: 1px solid rgba(255,170,0,.30);
}

/* Ähnlichkeits-Badge (Kopierseite) */
.similar-badge {
  display: inline-block; margin-top: 5px;
  padding: 1px 8px; border-radius: 99px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: rgba(139,92,246,.13); color: #a78bfa;
  border: 1px solid rgba(139,92,246,.30);
}

/* --- 13. Toast-Benachrichtigungen ------------------------------------ */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999; pointer-events: none;
}
.toast {
  padding: 10px 18px; border-radius: var(--radius-lg);
  font-size: 13px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border-med);
  color: var(--text); box-shadow: 0 4px 20px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(8px);
  transition: opacity 300ms, transform 300ms;
  pointer-events: auto;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--success { border-color: rgba(0,229,160,.4); color: var(--success); }
.toast--info    { border-color: rgba(0,212,255,.3); }
.toast--error   { border-color: rgba(255,68,68,.4); color: var(--danger); }

/* --- 14. Toggle-Switch (Settings) ------------------------------------ */
.toggle-switch { display: inline-flex; align-items: center; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-slider {
  width: 38px; height: 20px; border-radius: 99px;
  background: var(--surface-3); border: 1px solid var(--border-med);
  position: relative; transition: background var(--t), border-color var(--t);
}
.toggle-slider::after {
  content: ''; position: absolute;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-dim); top: 2px; left: 2px;
  transition: transform var(--t), background var(--t);
}
.toggle-switch input:checked + .toggle-slider {
  background: rgba(0,229,160,.25); border-color: var(--success);
}
.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(18px); background: var(--success);
}

/* --- 15. Settings Page ---------------------------------------------- */
.page-settings { max-width: 760px; }
.settings-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 28px;
}
.settings-header h1 { font-size: 1.5rem; }
.settings-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.settings-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; padding: 4px 12px; border-radius: 99px;
}
.settings-status.default { color: var(--text-dim); background: var(--surface-3); border: 1px solid var(--border); }
.settings-status.modified { color: var(--warning); background: var(--warning-dim); border: 1px solid rgba(255,170,0,.25); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.settings-section { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 20px; overflow: hidden; }
.settings-section-header { padding: 14px 20px; background: var(--surface-3); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.settings-section-title { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }

.settings-row { display: flex; align-items: center; gap: 16px; padding: 13px 20px; border-bottom: 1px solid var(--border); transition: background var(--t); }
.settings-row:last-child { border-bottom: none; }
.settings-row:hover { background: var(--surface-3); }
.settings-row-label { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); }
.settings-row-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.settings-row-input-wrap { display: flex; align-items: center; gap: 8px; }
.settings-input {
  background: var(--surface); color: var(--text-bright);
  border: 1px solid var(--border-med); border-radius: var(--radius);
  padding: 7px 10px; font-size: 13px; font-family: var(--font-mono); font-weight: 600;
  width: 90px; text-align: right;
  transition: border-color var(--t), box-shadow var(--t);
}
.settings-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.settings-input.modified { border-color: var(--warning); color: var(--warning); }
.settings-unit { font-size: 12px; color: var(--text-dim); min-width: 22px; }
.settings-default { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }
.settings-delta { font-size: 10px; font-weight: 700; font-family: var(--font-mono); padding: 1px 6px; border-radius: 99px; min-width: 42px; text-align: center; }
.settings-delta.up   { background: rgba(0,229,160,.15); color: var(--success); }
.settings-delta.down { background: rgba(255,68,68,.15);  color: var(--danger); }
.settings-delta.same { background: var(--surface-3);     color: var(--text-muted); }

.settings-save-bar {
  position: sticky; bottom: 24px;
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; background: var(--surface);
  border: 1px solid var(--border-med); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); margin-top: 12px;
}
.import-hint { font-size: 12px; color: var(--text-dim); margin-top: 8px; padding: 0 20px 12px; }

/* --- 12. Lightbox --------------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; background: rgba(7,9,15,.92);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.lightbox.hidden { display: none; }
.lightbox-inner { position: relative; max-width: 90vw; max-height: 90vh; }
.lightbox-inner img { max-width: 90vw; max-height: 85vh; border-radius: var(--radius-lg); box-shadow: 0 20px 80px rgba(0,0,0,.8), 0 0 0 1px var(--border-med); }
.lightbox-close { position: absolute; top: -36px; right: 0; background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; transition: color var(--t); padding: 4px 8px; }
.lightbox-close:hover { color: var(--text-bright); }
.lightbox-caption { text-align: center; font-size: 12px; color: var(--text-dim); margin-top: 10px; font-family: var(--font-mono); }

/* --- 13. Utilities -------------------------------------------------- */
.hidden { display: none !important; }
.text-accent   { color: var(--accent); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-danger   { color: var(--danger); }
.text-dim      { color: var(--text-dim); }
.text-mono     { font-family: var(--font-mono); }
.flex-between  { display: flex; justify-content: space-between; align-items: center; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 900;
  background: var(--surface-3); border: 1px solid var(--border-med);
  border-radius: var(--radius-lg); padding: 12px 20px;
  font-size: 13px; font-weight: 500; color: var(--text-bright);
  box-shadow: var(--shadow-lg); animation: slide-in 200ms ease;
  max-width: 320px; display: flex; align-items: center; gap: 10px;
}
.toast-success { border-color: var(--success); color: var(--success); }
.toast-error   { border-color: var(--danger);  color: var(--danger); }

/* highlight for calc-table update */
.highlight-update {
  box-shadow: 0 0 0 2px var(--accent), 0 0 20px rgba(0,212,255,.2) !important;
}

/* --- 14. Animations ------------------------------------------------- */
@keyframes slide-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border-med);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}

/* --- 15. Responsive ------------------------------------------------- */
@media (max-width: 768px) {
  .app-main { padding: 20px 16px; }
  .charts-row { grid-template-columns: 1fr; }
  .confidence-section { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .result-header { flex-direction: column; }
  .pages-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .settings-row { flex-wrap: wrap; }
  h1 { font-size: 1.35rem; }
}
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 1.5rem; }
  .drop-zone { padding: 28px 16px; }
  .upload-card { padding: 18px; }
}

/* ============================================================
   16. Neue Seitentyp-Farben (CSS Custom Properties)
   ============================================================ */
:root {
  --type-color-schaltplan_allpolig_einfach:  #ffd966;
  --type-color-schaltplan_allpolig_standard: #ffaa00;
  --type-color-schaltplan_allpolig_komplex:  #ff6b35;
  --type-color-schaltplan_einpolig_einfach:  #80eaff;
  --type-color-schaltplan_einpolig_standard: #00d4ff;
  --type-color-schaltplan_einpolig_komplex:  #0099cc;
  --type-color-grafikseite:                  #7c3aff;
  --type-color-textseite:                    #a78bfa;
  --type-color-deckblatt:                    #00e5a0;
  --type-color-inhaltsverzeichnis_seite:     #2dd4bf;
  --type-color-montageplan:                  #ff4444;
  --type-color-uebersicht_legende:           #f59e0b;
  --type-color-leere_seite:                  #2d3f55;
  --type-color-unbekannt:                    #334155;
  --type-color-auswertung:                   #546e8a;
}

/* ============================================================
   17. Artikel-Modus-Auswahl (Upload-Seite)
   ============================================================ */
.article-mode-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.article-mode-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.article-mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.article-mode-option {
  display: block;
  cursor: pointer;
}
.article-mode-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.article-mode-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
  cursor: pointer;
}
.article-mode-card:hover {
  border-color: var(--border-med);
  background: var(--surface-3);
}
.article-mode-card--selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent);
}

.article-mode-icon {
  font-size: 22px;
  margin-bottom: 6px;
}
.article-mode-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}
.article-mode-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

.article-mode-hint {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--warning-dim);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text);
}

/* ============================================================
   18. Filter-Bar (Result-Seite)
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-med);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
}
.filter-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}
.filter-chip--active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.filter-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-select {
  background: var(--surface-3);
  border: 1px solid var(--border-med);
  color: var(--text);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.filter-summary {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding: 0 2px;
}

/* ============================================================
   19. "Übernehmen"-Button (Result-Seite)
   ============================================================ */
.type-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.btn-uebernehmen {
  display: none;          /* versteckt bis Änderung vorliegt */
  width: 100%;
  padding: 5px 10px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--t);
}
.btn-uebernehmen:hover   { opacity: .85; }
.btn-uebernehmen--active { display: block; }

.page-card--pending {
  outline: 2px solid var(--warning);
  outline-offset: 2px;
}

/* Custom-Felder (Bezeichnung + Stunden) */
.custom-fields {
  display: flex;
  gap: 6px;
}
.custom-label-input {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
}
.custom-label-input:focus { outline: none; border-color: var(--accent); }
.custom-hours-input {
  width: 56px;
  padding: 4px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  text-align: right;
}
.custom-hours-input:focus { outline: none; border-color: var(--accent); }

.page-card--highlight {
  animation: card-highlight 1.8s ease forwards;
}
@keyframes card-highlight {
  0%   { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: none; }
}

.page-badges {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

/* btn-sm for inline buttons */
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
