/*
 * maiketingOS – Cockpit-Stylesheet
 * Autor: Maik Haring / maikharing.com
 *
 * Keine Framework-Abhaengigkeit, keine externen Requests.
 * Farbwerte aus colors.pdf, mit einer Korrektur:
 *   Weiss auf #4A90E2 liegt bei 3,29:1 und faellt damit unter WCAG AA.
 *   Auf dem Akzentblau steht deshalb dunkler Text (#1E1E1E, 5,06:1).
 */

@font-face {
  font-family: "Ubuntu";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/ubuntu-400.woff2") format("woff2");
}
@font-face {
  font-family: "Ubuntu";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/ubuntu-500.woff2") format("woff2");
}
@font-face {
  font-family: "Ubuntu";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/ubuntu-700.woff2") format("woff2");
}

:root {
  --navy: #193153;
  --navy-deep: #112743;
  --blue: #4a90e2;
  --blue-hover: #5c9ded;
  --orange: #f5a623;
  --text: #1e1e1e;
  --muted: #58677e;          /* aufgehellt auf 5,35:1 statt 4,07:1 */
  --muted-soft: #6b7a90;     /* nur fuer Linien und Icons, nicht fuer Text */
  --surface: #ffffff;
  --surface-muted: #f5f7fa;
  --line: #e4e8ef;
  --green: #17815d;
  --red: #b3322f;
  --shadow: 0 8px 28px rgba(25, 49, 83, 0.06);
  --radius: 12px;
  --sidebar-width: 252px;
  --font-heading: "Ubuntu", "Trebuchet MS", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--surface-muted); }

body {
  margin: 0;
  background: var(--surface-muted);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .wordmark { font-family: var(--font-heading); }

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

/* ---------------------------------------------------------------- Sidebar */

.sidebar {
  background: var(--navy);
  border-right: 1px solid var(--navy-deep);
  bottom: 0;
  color: #fff;
  display: flex;
  flex-direction: column;
  left: 0;
  padding: 26px 16px 16px;
  position: fixed;
  top: 0;
  width: var(--sidebar-width);
  z-index: 20;
}

.brand-block {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0 10px 22px;
}

.wordmark {
  align-items: baseline;
  display: inline-flex;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}
.wordmark strong { color: var(--blue-hover); font-weight: 500; margin-left: 3px; }
.brand-block small {
  color: rgba(255, 255, 255, 0.62);
  display: block;
  font-size: 12px;
  margin-top: 9px;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; margin-top: 20px; }

.nav-item {
  align-items: center;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  font-size: 14px;
  gap: 11px;
  padding: 10px 11px;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active { background: rgba(92, 157, 237, 0.2); color: #fff; font-weight: 500; }
.nav-item.pending { color: rgba(255, 255, 255, 0.45); }
.nav-item .nav-label { flex: 1; }

.nav-glyph {
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  display: inline-flex;
  flex: 0 0 26px;
  font-size: 11px;
  font-weight: 500;
  height: 26px;
  justify-content: center;
}
.nav-item.active .nav-glyph { background: var(--blue); color: var(--text); }

.nav-item em {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.4px;
  padding: 2px 6px;
  text-transform: uppercase;
}

.sidebar-footer { margin-top: auto; }

.source-mini {
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 14px 10px 12px;
}
.source-mini small {
  color: rgba(255, 255, 255, 0.6);
  flex: 1 0 100%;
  font-size: 11px;
  margin-top: 3px;
}

.user-card {
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  display: flex;
  gap: 10px;
  padding: 10px;
}
.user-card strong { display: block; font-size: 13px; }
.user-card small { color: rgba(255, 255, 255, 0.6); font-size: 11px; }

.avatar {
  align-items: center;
  background: var(--blue);
  border-radius: 50%;
  color: var(--text);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  height: 32px;
  justify-content: center;
  width: 32px;
}

/* -------------------------------------------------------------- Workspace */

.workspace { margin-left: var(--sidebar-width); min-height: 100vh; }

.topbar {
  align-items: center;
  background: rgba(245, 247, 250, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 32px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}

.data-status {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  gap: 8px;
}
.data-status .sep { color: var(--line); }

.live-dot {
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  width: 8px;
}
.live-dot.warn { background: var(--orange); }

.range-note { color: var(--muted); font-size: 12px; }

main { padding: 26px 32px 40px; }

.page-heading {
  align-items: flex-end;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 22px;
}
.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.3px;
  margin: 0 0 6px;
  text-transform: uppercase;
}
.page-heading h1 { font-size: 27px; font-weight: 500; margin: 0; }
.lede { color: var(--muted); margin: 6px 0 0; max-width: 62ch; }

.segmented {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  display: inline-flex;
  overflow: hidden;
}
.segmented a {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 14px;
}
.segmented a:hover { background: var(--surface-muted); }
.segmented a.active { background: var(--navy); color: #fff; }

/* ----------------------------------------------------------------- Panels */

.metric-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.metric-card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card { padding: 16px 18px 18px; }
.metric-top { align-items: center; display: flex; justify-content: space-between; }

.metric-icon {
  align-items: center;
  background: var(--surface-muted);
  border-radius: 9px;
  color: var(--navy);
  display: inline-flex;
  font-size: 15px;
  height: 32px;
  justify-content: center;
  width: 32px;
}
.metric-card p { color: var(--muted); font-size: 13px; margin: 14px 0 2px; }
.metric-card > strong { display: block; font-family: var(--font-heading); font-size: 27px; font-weight: 500; }
.metric-card > small { color: var(--muted-soft); font-size: 11px; }

.delta {
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 9px;
}
.delta.positive { background: rgba(23, 129, 93, 0.1); color: var(--green); }
.delta.negative { background: rgba(179, 50, 47, 0.09); color: var(--red); }
.delta.flat     { background: var(--surface-muted); color: var(--muted); }

.noise-note {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 20px;
  max-width: 78ch;
}

.dashboard-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.dashboard-grid-primary { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.78fr); }
.dashboard-grid-secondary { grid-template-columns: 1fr 1fr; }

.panel { padding: 18px 20px 20px; }

.panel-heading {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin: -2px 0 16px;
  padding-bottom: 13px;
}
.overline {
  color: var(--muted-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.1px;
  margin: 0 0 3px;
  text-transform: uppercase;
}
.panel h2 { font-size: 17px; font-weight: 500; margin: 0; }

.legend { color: var(--muted); display: flex; font-size: 12px; gap: 12px; }
.legend i { border-radius: 3px; display: inline-block; height: 9px; margin-right: 5px; width: 9px; }
.legend-blue { background: var(--blue); }
.legend-navy { background: var(--navy); opacity: 0.45; }

.chart-wrap { margin: 4px -4px 0; }

.text-button { color: var(--blue); font-size: 13px; font-weight: 500; }
.text-button:hover { color: var(--navy); text-decoration: underline; }

.health-score {
  background: var(--surface-muted);
  border-radius: 8px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px;
}

.compact-list { list-style: none; margin: 0; padding: 0; }
.compact-list li {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 9px;
  padding: 9px 0;
}
.compact-list li:last-child { border-bottom: 0; }
.compact-list b { flex: 1; font-size: 13px; font-weight: 500; }
.compact-list small { color: var(--muted); font-size: 12px; }

.dot { border-radius: 50%; display: inline-block; flex: 0 0 8px; height: 8px; width: 8px; }
.dot.good { background: var(--green); }
.dot.warn { background: var(--orange); }
.dot.bad { background: var(--red); }
.dot.missing { background: #c8cfda; }

.issue-box {
  background: rgba(245, 166, 35, 0.09);
  border-left: 3px solid var(--orange);
  margin-top: 14px;
  padding: 10px 12px;
}
.issue-box strong { display: block; font-size: 12px; margin-bottom: 4px; }
.issue-box p { color: var(--muted); font-size: 12px; margin: 2px 0; }

.row-list { display: flex; flex-direction: column; }
.row-item {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 0;
}
.row-item:last-child { border-bottom: 0; }
.row-item strong { display: block; font-size: 14px; font-weight: 500; }
.row-item small { color: var(--muted); font-size: 12px; }
.row-item b { font-family: var(--font-heading); font-size: 17px; font-weight: 500; }

.facts { margin: 0; }
.facts dt { color: var(--muted-soft); font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; }
.facts dd {
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin: 4px 0 12px;
  padding-bottom: 10px;
}
.facts dd span { color: var(--muted); font-size: 12px; }

.empty-hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

/* ----------------------------------------------------------------- Tables */

.data-table { border-collapse: collapse; font-size: 14px; table-layout: fixed; width: 100%; }
.data-table th {
  border-bottom: 1px solid var(--line);
  color: var(--muted-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.7px;
  padding: 0 10px 9px;
  text-align: left;
  text-transform: uppercase;
}
.data-table td { border-bottom: 1px solid var(--line); padding: 10px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-muted); }
.data-table .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; width: 108px; }
.data-table th.num { width: 108px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------------- Platzhalter */

.pending-panel { padding: 40px 32px; text-align: center; }
.pending-mark { color: var(--muted-soft); display: block; font-size: 30px; margin-bottom: 10px; }
.pending-panel h2 { font-size: 19px; margin: 0 0 8px; }
.pending-panel p { color: var(--muted); margin: 0 auto 18px; max-width: 60ch; }

.check-list { display: inline-block; list-style: none; margin: 0; padding: 0; text-align: left; }
.check-list li { color: var(--muted); font-size: 13px; padding: 4px 0 4px 20px; position: relative; }
.check-list li::before { color: var(--blue); content: "✓"; left: 0; position: absolute; }

.app-footer {
  color: var(--muted-soft);
  display: flex;
  font-size: 11px;
  gap: 16px;
  justify-content: space-between;
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------- Responsive */

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid-primary, .dashboard-grid-secondary { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar {
    bottom: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 12px 16px;
    position: sticky;
    width: 100%;
  }
  .sidebar nav { flex-direction: row; margin: 0 0 0 18px; }
  .nav-item em, .nav-item .nav-label, .brand-block small, .sidebar-footer { display: none; }
  .brand-block { border: 0; padding: 0; }
  .workspace { margin-left: 0; }
  main { padding: 18px 16px 32px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
}

@media print {
  .sidebar, .segmented, .topbar { display: none; }
  .workspace { margin: 0; }
  .panel, .metric-card { box-shadow: none; }
}

/* -------------------------------------------------------------- Prüfqueue */

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.chip {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  gap: 7px;
  padding: 6px 13px;
}
.chip:hover { border-color: var(--blue); color: var(--text); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip b {
  background: var(--surface-muted);
  border-radius: 10px;
  color: var(--navy);
  font-size: 11px;
  min-width: 20px;
  padding: 1px 6px;
  text-align: center;
}
.chip.active b { background: rgba(255, 255, 255, 0.22); color: #fff; }

.nav-item em.count {
  background: var(--blue);
  color: var(--text);
  font-weight: 500;
}

.finding {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  padding: 15px 18px 16px;
}
.finding.sev-critical, .finding.sev-high { border-left-color: var(--red); }
.finding.sev-medium { border-left-color: var(--orange); }
.finding.sev-low { border-left-color: var(--blue); }
.finding.sev-info { border-left-color: var(--muted-soft); }

.finding-head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.sev-badge {
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  padding: 3px 7px;
  text-transform: uppercase;
}
.sev-badge.critical, .sev-badge.high { background: rgba(179, 50, 47, 0.1); color: var(--red); }
.sev-badge.medium { background: rgba(245, 166, 35, 0.16); color: #8a5a06; }
.sev-badge.low { background: rgba(74, 144, 226, 0.12); color: #1f5fa8; }
.sev-badge.info { background: var(--surface-muted); color: var(--muted); }

.rule-label { font-size: 13px; font-weight: 500; margin-left: 8px; }
.entity { color: var(--muted); font-size: 12px; margin-left: 8px; }

.status-badge {
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-size: 11px;
  padding: 3px 10px;
}
.status-badge.s-implemented, .status-badge.s-measured {
  background: rgba(23, 129, 93, 0.09); border-color: transparent; color: var(--green);
}
.status-badge.s-dismissed { color: var(--muted-soft); }

.finding-headline {
  font-family: var(--font-heading);
  font-size: 15px;
  margin: 10px 0 12px;
}

.evidence { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 12px; }
.evidence > div {
  background: var(--surface-muted);
  border-radius: 6px;
  display: flex;
  gap: 6px;
  padding: 4px 9px;
}
.evidence dt { color: var(--muted); font-size: 11px; }
.evidence dd { font-size: 11px; font-variant-numeric: tabular-nums; margin: 0; }

.finding-note { color: var(--muted); font-size: 12px; margin: 0 0 10px; }

.finding-actions {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
}
.finding-actions input[type="text"] {
  border: 1px solid var(--line);
  border-radius: 8px;
  flex: 1 1 200px;
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
}
.finding-actions input[type="text"]:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(74, 144, 226, 0.25);
}

.btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 7px 13px;
}
.btn:hover { border-color: var(--navy); }
/* Weiss auf #4A90E2 liegt bei 3,29:1 und faellt unter WCAG AA.
   Dunkler Text auf dem Akzentblau erreicht 5,06:1. */
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--text); font-weight: 500; }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-quiet { color: var(--muted); }

code {
  background: var(--surface-muted);
  border-radius: 4px;
  font-size: 12px;
  padding: 1px 5px;
}

/* ------------------------------------------------------------- Anmeldung */

.auth-body {
  align-items: center;
  background: var(--surface-muted);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 460px;
  padding: 36px 34px;
  text-align: center;
  width: 100%;
}
.auth-mark { color: var(--navy); font-size: 30px; justify-content: center; margin-bottom: 22px; }
.auth-mark strong { color: var(--blue); }
.auth-card h1 { font-size: 20px; font-weight: 500; margin: 0 0 10px; }
.auth-card p { color: var(--muted); margin: 0 0 20px; }
.auth-card a { color: var(--blue); }
.auth-btn { display: inline-block; padding: 11px 22px; text-decoration: none; }
.auth-btn:hover { color: var(--text); }

.user-card { position: relative; }
.logout {
  color: rgba(255, 255, 255, 0.55);
  font-size: 15px;
  padding: 4px 6px;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}
.logout:hover { color: #fff; }
