:root {
  --bg: #f5f7f9;
  --surface: #fff;
  --surface-soft: #f9fafb;
  --border: #d9e0e7;
  --text: #111827;
  --secondary: #344054;
  --muted: #667085;
  --blue: #1f5fbf;
  --blue-soft: #eaf1fb;
  --green: #13715b;
  --gold: #a16207;
  --sidebar: #172033;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--secondary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 200px;
  background: var(--sidebar);
  color: #b7c0ce;
  padding: 18px 12px;
}
.brand {
  color: #fff;
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(183, 192, 206, .22);
}
.brand strong { display: block; font-size: 17px; line-height: 1.1; }
.brand span { display: block; margin-top: 4px; color: #b7c0ce; font-size: 11px; }
.sidebar nav { margin-top: 14px; display: grid; gap: 2px; }
.sidebar a, .logout button {
  display: block;
  width: 100%;
  color: #b7c0ce;
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 8px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.sidebar a.active, .sidebar a:hover, .logout button:hover {
  color: #fff;
  background: rgba(148, 163, 184, .12);
  text-decoration: none;
}
.logout { position: absolute; left: 12px; right: 12px; bottom: 16px; margin: 0; }

.main { margin-left: 200px; min-height: 100vh; }
.topbar {
  height: 58px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.topbar h1 { margin: 0; color: var(--text); font-size: 18px; font-weight: 650; }
.topbar span { color: var(--muted); font-size: 12px; }
.workspace-status { display: flex; align-items: center; gap: 9px; }
.demo-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #f4d7a6;
  border-radius: 4px;
  padding: 3px 7px;
  background: #fffbeb;
  color: #92400e !important;
  font-weight: 700;
  text-transform: uppercase;
}
.validation-note {
  margin: 14px 20px 0;
  border: 1px solid #d7e1ea;
  border-left: 3px solid var(--gold);
  border-radius: 5px;
  background: #fff;
  padding: 10px 12px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.45;
}
.validation-note strong { color: var(--text); }
.inline-note { margin-top: 16px; }


.workspace-hero, .page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 24px;
  padding: 24px 28px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fafc 62%, #edf7f3 100%);
  border-bottom: 1px solid var(--border);
}
.page-intro { grid-template-columns: minmax(0, 760px); }
.workspace-hero h2, .page-intro h2 {
  margin: 5px 0 8px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.18;
  letter-spacing: 0;
}
.workspace-hero p, .page-intro p, .hero-panel p, .signal-strip p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.eyebrow, .signal-label {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}
.hero-panel {
  align-self: stretch;
  border: 1px solid #cfe1d8;
  background: #ffffff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 12px 26px rgba(17, 24, 39, .06);
}
.hero-panel span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.hero-panel strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 8px; }
.signal-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px 20px 0;
}
.signal-strip div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.signal-strip strong { display: block; color: var(--text); margin: 4px 0 5px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.kpis div { padding: 16px 20px; border-right: 1px solid var(--border); }
.kpis strong { display: block; color: var(--text); font-size: 24px; line-height: 1.1; }
.kpis span { color: var(--muted); font-size: 12px; }

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, .8fr);
  gap: 20px;
  padding: 20px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
}
.section-head h2 { color: var(--text); font-size: 15px; margin: 0; }

.data-table {
  width: calc(100% - 40px);
  margin: 20px;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 10px 22px rgba(17, 24, 39, .04);
}
.grid-two .data-table, .pipeline-intro + .kpis + .data-table { width: 100%; margin: 0; }
.data-table th {
  background: var(--surface-soft);
  color: #4b5563;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tbody tr:nth-child(even) { background: #fbfcfd; }
.data-table tbody tr:hover { background: var(--blue-soft); }
.data-table strong { color: var(--text); font-weight: 600; }
.right { text-align: right; }
.click-row { cursor: pointer; }

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: end;
  margin: 16px 20px 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.filter-bar label { display: grid; gap: 4px; color: #64748b; font-size: 12px; }
select, input {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 7px 9px;
  min-width: 130px;
}
button {
  border: 1px solid #1d4ed8;
  background: var(--blue);
  color: #fff;
  border-radius: 4px;
  padding: 7px 10px;
  font: inherit;
  cursor: pointer;
}

.badge, .tag {
  display: inline-block;
  font-size: 11px;
  line-height: 1.3;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag { color: #475569; background: #f1f5f9; border-color: #e2e8f0; margin: 2px 3px 0 0; }
.severity-high, .priority-urgent { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.severity-medium, .priority-standard { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.severity-low, .priority-monitor { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.source-BMF { color: #1e40af; background: #dbeafe; }
.source-BFH { color: #5b21b6; background: #ede9fe; }
.source-EU_OJ { color: #3730a3; background: #e0e7ff; }
.source-OECD { color: #115e59; background: #ccfbf1; }
.source-Bundesgesetzblatt { color: #334155; background: #f1f5f9; }
.compact { margin-top: 4px; }

.bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; min-width: 140px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); }
.activity-list { background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 22px rgba(17, 24, 39, .04); }
.activity-item { display: grid; grid-template-columns: 84px 1fr; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.activity-item time { color: var(--muted); font-size: 12px; }

.detail-head, .company-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.detail-head h2, .company-head h2 { margin: 0 0 8px; color: var(--text); font-size: 20px; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12px; }
.detail-stat { border-left: 1px solid var(--border); padding-left: 18px; min-width: 120px; }
.detail-stat strong { display: block; color: var(--text); font-size: 22px; }
.detail-stat span { color: var(--muted); font-size: 12px; }
.summary { margin: 20px; padding: 14px 16px; background: #fff; border: 1px solid var(--border); line-height: 1.5; }
.tag-row { padding: 0 20px 14px; }

.company-head { grid-template-columns: minmax(0, 1fr) minmax(420px, .9fr); }
.company-head p { margin: 0; color: var(--muted); }
dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px; margin: 0; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 0; color: var(--text); }
.risk { font-weight: 650; }
.risk-high { color: #991b1b; }
.risk-med { color: #92400e; }
.risk-low { color: #166534; }

.login-panel { display: grid; place-items: center; min-height: calc(100vh - 58px); }
.login-form { width: 340px; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 18px; }
.login-form h2 { margin: 0 0 6px; color: var(--text); }
.login-form p { margin: 0 0 16px; color: var(--muted); }
.login-form label { display: block; margin-bottom: 6px; color: #475569; }
.login-form input { width: 100%; margin-bottom: 12px; }
.form-error { color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; padding: 8px; margin-bottom: 12px; border-radius: 4px; }

.briefing-doc {
  max-width: 800px;
  margin: 24px auto;
  padding: 40px;
  background: #fff;
  border: 1px solid var(--border);
  color: #111827;
}
.briefing-doc h2 { font-family: Georgia, serif; color: #111827; font-size: 28px; margin: 16px 0; }
.briefing-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #64748b;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  align-items: center;
}
.briefing-context {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  margin: 16px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.briefing-context span { display: block; color: #64748b; font-size: 11px; text-transform: uppercase; margin-bottom: 4px; }
.briefing-context strong { display: block; color: #111827; font-size: 14px; }
.briefing-impact-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.briefing-impact-summary span { display: block; color: #64748b; font-size: 11px; text-transform: uppercase; margin-bottom: 4px; }
.briefing-impact-summary p { margin: 0; color: #334155; font-size: 13px; line-height: 1.5; }
.briefing-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.briefing-footer p { margin: 0; color: #94a3b8; font-size: 12px; }
.briefing-content { font-family: Georgia, serif; line-height: 1.55; }
.briefing-content h1 { font-size: 20px; }
.briefing-content h2 { font-size: 18px; }
.briefing-content h3 { font-size: 16px; margin-top: 22px; }
.briefing-content table { width: 100%; border-collapse: collapse; margin: 14px 0; font-family: Georgia, serif; }
.briefing-content th, .briefing-content td { border: 1px solid #cbd5e1; padding: 8px; text-align: left; }

@media print {
  body { background: #fff; font-size: 12pt; }
  .sidebar, .topbar, .briefing-meta button, .briefing-footer button, .validation-note.briefing-note { display: none; }
  .main { margin-left: 0; }
  .briefing-doc { border: 0; margin: 0; max-width: none; padding: 20px 0; box-shadow: none; }
  .briefing-doc h2 { font-size: 22pt; }
  .briefing-context { border-color: #999; }
  .briefing-content h1 { font-size: 16pt; }
  .briefing-content h2 { font-size: 14pt; }
  .briefing-content h3 { font-size: 12pt; }
  .briefing-content table { page-break-inside: avoid; }
  .briefing-footer { border-color: #999; }
  .briefing-footer p { color: #666; }
  a { color: #111; text-decoration: none; }
}

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; }
  .logout { position: static; }
  .main { margin-left: 0; }
  .workspace-hero, .page-intro, .grid-two, .company-head, .detail-head { grid-template-columns: 1fr; }
  .signal-strip { grid-template-columns: 1fr; padding: 14px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-wrap: wrap; margin: 14px; }
  .data-table { display: block; width: calc(100% - 28px); margin: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .workspace-hero, .page-intro { padding: 20px 16px; }
  .workspace-status > span:last-child { display: none; }
  .validation-note { margin: 14px; }
  .matrix-wrap { margin: 14px; }
  .briefing-context { grid-template-columns: repeat(2, 1fr); }
  .briefing-impact-summary { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .deadline-strip { flex-wrap: wrap; gap: 14px 24px; }
  .mandant-form { margin: 14px; }
  .import-panel { margin: 14px; }
}

.action-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}
.action-card {
  display: block;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s;
}
.action-card:hover { box-shadow: 0 4px 12px rgba(17,24,39,.1); text-decoration: none; }
.action-card strong { display: block; font-size: 28px; color: var(--text); line-height: 1.1; }
.action-card span { display: block; font-size: 13px; font-weight: 600; margin-top: 2px; }
.action-card p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.action-urgent { border-left: 3px solid #ef4444; }
.action-urgent span { color: #991b1b; }
.action-new { border-left: 3px solid #3b82f6; }
.action-new span { color: #1e40af; }
.action-review { border-left: 3px solid #f59e0b; }
.action-review span { color: #92400e; }
.action-briefing { border-left: 3px solid #22c55e; }
.action-briefing span { color: #166534; }
.next-deadline {
  margin: 0 20px 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
}
.next-deadline span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.next-deadline strong { display: inline; color: var(--text); font-size: 15px; margin-left: 8px; }
.next-deadline p { margin: 4px 0 0; color: var(--secondary); font-size: 13px; }
@media (max-width: 900px) { .action-cards { grid-template-columns: repeat(2, 1fr); } }

.briefing-pending { color: var(--muted); font-size: 12px; font-style: italic; }

.empty-state {
  text-align: center;
  padding: 32px 20px !important;
  color: var(--muted);
  font-style: italic;
}

.deadline-urgent { color: #991b1b; font-weight: 600; }
.deadline-soon { color: #92400e; font-weight: 600; }
.deadline-ok { color: #166534; }
.verification-badge { color: #92400e; background: #fffbeb; border: 1px solid #f4d7a6; border-radius: 4px; padding: 2px 6px; }
.verification-verified { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.verification-pending { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.status-new { color: #1e40af; background: #dbeafe; border-color: #93c5fd; }
.status-in-review { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.status-active { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.status-archived { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.deadline-strip { display: flex; gap: 28px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: #fff; }
.deadline-strip div { display: grid; gap: 3px; }
.deadline-strip span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.deadline-strip strong { color: var(--text); font-size: 13px; }
.briefing-note { margin: 18px 0; }

.matrix-wrap {
  margin: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 10px 22px rgba(17, 24, 39, .04);
}
.matrix-table {
  border-collapse: collapse;
  min-width: 100%;
}
.matrix-corner {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface-soft);
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  color: #4b5563;
  text-align: left;
  border-bottom: 1px solid var(--border);
  border-right: 2px solid var(--border);
  min-width: 260px;
}
.matrix-col-head {
  padding: 10px 6px;
  font-size: 11px;
  text-align: center;
  color: #4b5563;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  min-width: 80px;
  white-space: nowrap;
}
.matrix-col-head a { color: var(--blue); }
.matrix-row-head {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  border-right: 2px solid var(--border);
  min-width: 260px;
}
.matrix-row-head a { color: var(--text); font-weight: 600; font-size: 13px; }
.matrix-row-head .badge { margin-left: 6px; vertical-align: middle; }
.matrix-cell {
  padding: 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid #f0f2f5;
}
.matrix-dot {
  font-size: 18px;
  cursor: default;
  line-height: 1;
}
.matrix-dot.priority-urgent { color: #dc2626; }
.matrix-dot.priority-standard { color: #f59e0b; }
.matrix-dot.priority-monitor { color: #16a34a; }
.matrix-empty { color: #d1d5db; font-size: 14px; }
.matrix-hit { cursor: pointer; }
.matrix-hit:hover { background: var(--blue-soft); }
.matrix-table tbody tr:hover td { background: #f8fafc; }
.matrix-table tbody tr:hover .matrix-row-head { background: var(--blue-soft); }
.matrix-legend {
  display: flex;
  gap: 18px;
  padding: 10px 20px 18px;
  color: var(--muted);
  font-size: 12px;
  align-items: center;
}
.matrix-legend .matrix-dot { font-size: 14px; margin-right: 3px; }
.matrix-legend .matrix-dot.priority-urgent { color: #dc2626; }
.matrix-legend .matrix-dot.priority-standard { color: #f59e0b; }
.matrix-legend .matrix-dot.priority-monitor { color: #16a34a; }

.completeness { display: flex; align-items: center; gap: 6px; min-width: 80px; }
.completeness-bar { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; min-width: 40px; }
.completeness-bar span { display: block; height: 100%; border-radius: 3px; }
.completeness-good { background: #22c55e; }
.completeness-ok { background: #f59e0b; }
.completeness-low { background: #ef4444; }
.completeness-label { font-size: 11px; color: var(--muted); white-space: nowrap; }

.mandant-form {
  margin: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-section h3 { color: var(--text); font-size: 14px; margin: 0 0 12px; }
.form-section label {
  display: block;
  margin-bottom: 10px;
  color: #64748b;
  font-size: 12px;
}
.form-section input[type="text"],
.form-section input[type="number"],
.form-section select {
  width: 100%;
  margin-top: 4px;
}
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  flex-direction: row !important;
}
.checkbox-label input[type="checkbox"] { min-width: auto; width: auto; margin: 0; }
.form-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
}
.form-actions a { color: var(--muted); }
.import-panel {
  margin: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.import-panel form {
  display: flex;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
}
.import-panel label { display: grid; gap: 4px; color: #64748b; font-size: 12px; }
.import-help { margin-top: 20px; }
.import-help h3 { color: var(--text); font-size: 14px; margin: 0 0 8px; }
.import-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
}
.import-actions form { display: flex; gap: 12px; align-items: center; }
.import-actions a { color: var(--muted); }

