:root {
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #475569;
  --accent-blue: #38bdf8;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

body.light-mode {
  background-color: #f1f5f9;
  color: #1e293b;
}

body.dark-mode {
  background-color: var(--bg-primary);
  color: var(--text-main);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
}

body.dark-mode .app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}

.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-title { font-size: 1.25rem; }
.badge-airgap {
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}
body.dark-mode .badge-airgap {
  background: #0284c7;
  color: #ffffff;
}

.stage-container {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px;
}

.stage-header { margin-bottom: 24px; }
.step-num { font-size: 0.8rem; font-weight: 700; color: #64748b; letter-spacing: 1px; }
.step-vault { color: var(--accent-blue); }
.crypto-hash { font-family: monospace; font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.template-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.template-card {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-card:hover { border-color: #0284c7; }
.template-card.active { border-color: #0284c7; background: #f0f9ff; }
.template-card .card-icon { font-size: 1.5rem; margin-bottom: 12px; color: #0284c7; }
.template-card h3 { font-size: 1rem; margin-bottom: 6px; }
.template-card p { font-size: 0.825rem; color: #64748b; margin-bottom: 12px; line-height: 1.4; }
.template-card .tag { font-size: 0.7rem; font-weight: 700; background: #e2e8f0; padding: 2px 6px; border-radius: 4px; }

.staging-box {
  background: #ffffff;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.staging-file { display: flex; align-items: center; gap: 12px; }
.file-icon-pdf { font-size: 2rem; color: #ef4444; }
.file-icon-csv { font-size: 2rem; color: #22c55e; }
.file-sub { display: block; font-size: 0.75rem; color: #64748b; }

.btn-primary {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: #0369a1; }

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-sign {
  background: var(--accent-green);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.workbench-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.workbench-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  height: 580px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  font-weight: 600;
}

.document-content-box {
  padding: 20px;
  overflow-y: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.doc-section { margin-bottom: 16px; }
.doc-section-title { font-weight: 700; color: var(--accent-blue); margin-bottom: 4px; }
.highlight-error { background: rgba(239, 68, 68, 0.25); border-left: 3px solid var(--accent-red); padding: 4px 8px; }
.highlight-pass { background: rgba(34, 197, 94, 0.15); border-left: 3px solid var(--accent-green); padding: 4px 8px; }

.findings-list { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.finding-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
}
.finding-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.badge-status { font-size: 0.75rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.badge-deviation { background: var(--accent-red); color: white; }
.badge-compliant { background: var(--accent-green); color: white; }

.finding-evidence { font-size: 0.8rem; background: rgba(0,0,0,0.25); padding: 8px; border-radius: 4px; margin-bottom: 8px; }
.finding-trace { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

.scan-progress-box { margin-bottom: 16px; }
.scan-status-text { font-size: 0.85rem; margin-bottom: 6px; color: var(--accent-blue); }
.progress-bar-bg { background: var(--bg-card); height: 6px; border-radius: 3px; overflow: hidden; }
.progress-bar-fill { background: var(--accent-blue); height: 100%; width: 0%; transition: width 0.3s ease; }

.export-tray {
  margin-top: 20px;
  display: flex;
  gap: 16px;
}
.btn-download {
  background: var(--accent-blue);
  color: var(--bg-primary);
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex; justify-content: center; align-items: center; z-index: 1000;
}
.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px; width: 480px; padding: 24px; color: var(--text-main);
}
.modal-wide { width: 900px; max-height: 80vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; margin-bottom: 16px; }
.close-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }
.form-group { margin: 16px 0; }
.form-group label { display: block; font-size: 0.85rem; margin-bottom: 6px; }
.form-group input { width: 100%; padding: 10px; background: var(--bg-card); border: 1px solid var(--border-color); color: white; border-radius: 4px; }
.modal-error { color: var(--accent-red); font-size: 0.8rem; margin-top: 6px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

.ledger-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.ledger-table th, .ledger-table td { padding: 8px 12px; border: 1px solid var(--border-color); text-align: left; }
.ledger-table th { background: var(--bg-card); color: var(--accent-blue); }

.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 24px;
  margin-top: 40px;
}
