/* Gieseke Lead Radar – Look & Feel nach dem Corporate Design der Gieseke Gruppe.
   Marke: Rot #DB2A1B, Anthrazit #303030/#212529, Grautöne, viel Weiß, flache Flächen.
   Schrift: Helvetica-Neue-Stack (die lizenzierten Webfonts der Website werden bewusst nicht verwendet). */

:root {
  color-scheme: light dark;
  --brand: #E0584B;          /* Gieseke-Rot, aufgehellt (Flächen: Buttons, Marker) */
  --brand-hover: #CC4337;
  --brand-ink: #ffffff;
  --link: #cf4034;           /* Rot für Text/Links auf hellem Grund (AA) */
  --link-hover: #ab2f25;
  --anthracite: #303030;

  --bg: #f4f5f6; --surface: #ffffff; --surface-2: #f8f9fa;
  --ink: #212529; --muted: #5a626a; --line: #dee2e6; --line-strong: #adb5bd;
  --chip: #eceff1; --ring: #212529;

  --ok: #1b6b3a;   --ok-bg: #e2f2e7;
  --warn: #6b5200; --warn-bg: #fff3c2;
  --bad: #a3200f;  --bad-bg: #fde8e6;
  --info: #1f4f93; --info-bg: #e4edfa;

  --radius: 3px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --shadow: 0 1px 2px rgba(33, 37, 41, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #E0584B; --brand-hover: #ee7064; --brand-ink: #ffffff;
    --link: #ff6e60; --link-hover: #ff9a8f;
    --bg: #15171a; --surface: #202327; --surface-2: #1a1d20;
    --ink: #eceff1; --muted: #a4acb3; --line: #3a4046; --line-strong: #5b646c;
    --chip: #2c3136; --ring: #f1f3f5;
    --ok: #7fd49a;   --ok-bg: #16301f;
    --warn: #ffdf42; --warn-bg: #3a3210;
    --bad: #ff8d80;  --bad-bg: #3f1d19;
    --info: #9ec0f2; --info-bg: #1b2b45;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
strong, b { font-weight: 700; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px;
  background: var(--ink); color: var(--surface); border-radius: var(--radius); text-decoration: none; }
.skip-link:focus { top: 8px; color: var(--surface); }

/* ---------- Layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 28px 24px 72px; }
main.wide { max-width: 1600px; }
main.narrow { max-width: 440px; padding-top: 9vh; }

/* ---------- Kopfzeile ---------- */
.topbar { display: flex; align-items: center; gap: 8px 28px; padding: 0 28px;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 16px; padding: 10px 0; color: var(--ink);
  text-decoration: none; flex: none; }
.brand:hover { color: var(--ink); }
.brand img { display: block; height: 40px; width: auto; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1;
  padding-left: 16px; border-left: 1px solid var(--line-strong); white-space: nowrap; }
.topbar nav { display: flex; align-items: stretch; align-self: stretch; gap: 2px; flex: 1;
  overflow-x: auto; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a { display: flex; align-items: center; padding: 0 14px; color: var(--muted);
  text-decoration: none; font-weight: 700; white-space: nowrap;
  border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.topbar nav a:hover { color: var(--ink); }
.topbar nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }
.topbar nav a.nav-export { margin-left: auto; font-weight: 400; }
.logout { display: flex; gap: 12px; align-items: center; margin: 0; flex: none; }
.logout .muted { font-size: 14px; }
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding: 0 16px; gap: 0 12px; }
  .brand { order: 1; padding: 8px 0; }
  .brand img { height: 34px; }
  .brand-name { font-size: 17px; padding-left: 12px; }
  .logout { order: 2; margin-left: auto; }
  .logout .muted { display: none; }
  .topbar nav { order: 3; flex: 0 0 100%; margin: 0 -16px; padding: 0 12px;
    border-top: 1px solid var(--line); }
  .topbar nav a { padding: 10px 12px; }
  main { padding: 20px 16px 56px; }
}

/* ---------- Typografie ---------- */
h1 { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 18px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; margin: 32px 0 12px; }
h3 { font-weight: 700; }
h1 + p.muted { margin-top: 0; }
p { margin: 0 0 12px; }
code { font: 13px/1.4 var(--mono); background: var(--chip); border-radius: 2px; padding: 1px 5px; }
blockquote { margin: 6px 0 0; padding: 4px 14px; border-left: 3px solid var(--brand);
  color: var(--muted); font-size: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- Buttons ---------- */
.btn, .btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; line-height: 1.25; padding: 9px 18px; border-radius: var(--radius);
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, color .12s; }
.btn:hover, .btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover);
  color: var(--brand-ink); }
.btn:disabled, .btn[aria-disabled="true"], .btn.htmx-request { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--chip); border-color: var(--ink); color: var(--ink); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn-sm { padding: 4px 10px; font-size: 13px; white-space: nowrap; }
.btn .spinner { color: currentColor; }

/* ---------- Tabs (Unterstreichung wie auf der Gieseke-Website) ---------- */
.tabs { display: flex; gap: 4px; margin: 20px 0 22px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 14px 10px; margin-bottom: -1px; color: var(--muted); text-decoration: none;
  font-weight: 700; font-size: 14px; border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }
.tabs .count { display: inline-block; min-width: 1.9em; margin-left: 6px; padding: 0 6px;
  border-radius: var(--radius); background: var(--chip); color: var(--muted);
  font-size: 12px; font-weight: 700; text-align: center; }
.tabs a[aria-current="page"] .count { background: var(--brand); color: var(--brand-ink); }

/* ---------- Karten, Panels ---------- */
.cards { display: grid; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: var(--radius); padding: 16px 20px; display: grid;
  grid-template-columns: 1fr auto; gap: 6px 20px; box-shadow: var(--shadow); }
.card:hover { border-left-color: var(--brand); }
.card h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--link); text-decoration: underline; }
.card .meta { color: var(--muted); font-size: 14px; display: flex; gap: 4px 16px; flex-wrap: wrap; }
.card .summary { grid-column: 1 / -1; margin: 4px 0 0; }
.card .actors { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.score { font-size: 30px; font-weight: 700; letter-spacing: -.02em; text-align: right; line-height: 1; }
.score small { display: block; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px 16px; margin: 0 0 14px; }
.panel-head > :is(h1, h2, h3, h4) { margin: 0; }
.panel-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.scorebox { margin-bottom: 12px; }
.empty { padding: 44px 24px; text-align: center; color: var(--muted); background: var(--surface);
  border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ---------- Chips, Badges, Score, Gates ---------- */
.chip { display: inline-block; background: var(--chip); border-radius: var(--radius);
  padding: 2px 9px; font-size: 13px; }
.chip b { font-weight: 700; }
.badge { display: inline-block; border-radius: var(--radius); padding: 2px 9px; font-size: 12px;
  font-weight: 700; line-height: 1.5; background: var(--chip); color: var(--muted); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--chip); color: var(--muted); }

.score-pill { display: inline-block; min-width: 2.8em; padding: 2px 10px; border-radius: var(--radius);
  font-weight: 700; font-size: 14px; line-height: 1.5; text-align: center;
  font-variant-numeric: tabular-nums; background: var(--chip); color: var(--ink); }
.score-pill.score-high { background: var(--ok-bg); color: var(--ok); box-shadow: inset 0 0 0 1px currentColor; }
.score-pill.score-mid  { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1px currentColor; }
.score-pill.score-low  { background: var(--chip); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }

.gate-ok, .gate-fail, .gate-unclear { display: inline-flex; align-items: center; justify-content: center;
  width: 1.45em; height: 1.45em; border-radius: 50%; font-size: 13px; font-weight: 700;
  line-height: 1; vertical-align: middle; flex: none; }
.gate-ok { background: var(--ok-bg); color: var(--ok); }
.gate-fail { background: var(--bad-bg); color: var(--bad); }
.gate-unclear { background: var(--warn-bg); color: var(--warn); }
.gate-ok::before { content: "\2713"; }
.gate-fail::before { content: "\2717"; }
.gate-unclear::before { content: "?"; }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em; border-bottom: 2px solid var(--line-strong); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td a { overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); }
.table-wrap table { min-width: 960px; }
.table-wrap tr:last-child td { border-bottom: 0; }
.col-name { min-width: 260px; }
a.url, span.url { font-size: 13px; overflow-wrap: anywhere; }
.rowactions { display: flex; gap: 6px; flex-wrap: wrap; }
.rowactions form { margin: 0; }
td .error { margin: 6px 0 0; font-size: 13px; }

/* Dichte Datentabelle: in .table-scroll (horizontal + vertikal scrollbar, Kopfzeile bleibt oben) */
.table-scroll { overflow: auto; max-height: min(78vh, 960px); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); }
.table-scroll > table { min-width: 100%; }
table.data { font-size: 13px; }
table.data th, table.data td { padding: 6px 10px; }
table.data th { position: sticky; top: 0; z-index: 2; background: var(--surface-2);
  white-space: nowrap; box-shadow: inset 0 -2px 0 var(--line-strong); border-bottom: 0; }
table.data tbody tr:nth-child(even) { background: var(--surface-2); }
table.data tbody tr:hover { background: var(--chip); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums;
  white-space: nowrap; }

/* ---------- Kennzahlen ---------- */
.kpi, .stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi > div, .stat { background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--brand); border-radius: var(--radius); padding: 12px 16px;
  color: var(--muted); font-size: 13px; box-shadow: var(--shadow); }
.kpi strong, .stat strong { display: block; font-size: 28px; line-height: 1.15; letter-spacing: -.02em;
  color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { display: block; }
.kpi { margin: 4px 0 18px; }

/* ---------- Formulare ---------- */
form.stack { display: grid; gap: 14px; }
label { font-size: 13px; font-weight: 700; color: var(--muted); display: grid; gap: 5px; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--surface);
  padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--line-strong); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ring);
  outline-offset: 0; border-color: var(--ink); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); padding: 0; }
textarea.mono { font-family: var(--mono); font-size: 13px; line-height: 1.5; width: 100%;
  min-height: 16rem; resize: vertical; tab-size: 2; }
.error { color: var(--bad); background: var(--bad-bg); padding: 9px 14px; border-radius: var(--radius);
  border-left: 3px solid var(--bad); }
.filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin: 0 0 16px; }
.importbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 18px 0 12px; }
.importbar form { margin: 0; }

.reviewbox { display: grid; gap: 10px; }
.reviewbox form { margin: 0; }
.reviewbox .btn { width: 100%; text-align: center; }
.reviewbox summary { list-style: none; }
.reviewbox summary::-webkit-details-marker { display: none; }
.reviewbox textarea, .reviewbox select { width: 100%; }

/* ---------- Aufklapp-Panel ---------- */
details.disclosure { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 14px; }
details.disclosure > summary { display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 11px 16px; font-weight: 700; list-style: none; user-select: none; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: ""; flex: none; width: 7px; height: 7px;
  border-right: 2px solid var(--brand); border-bottom: 2px solid var(--brand);
  transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
details.disclosure[open] > summary::before { transform: rotate(45deg); }
details.disclosure > summary:hover { background: var(--surface-2); }
details.disclosure[open] > summary { border-bottom: 1px solid var(--line); }
details.disclosure > :not(summary) { margin-left: 16px; margin-right: 16px; }
details.disclosure > summary + * { margin-top: 14px; }
details.disclosure > textarea.mono, details.disclosure > table { width: calc(100% - 32px); }
details.disclosure > :last-child { margin-bottom: 16px; }

/* ---------- Definitionslisten, Raster ---------- */
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
dt { color: var(--muted); font-weight: 700; font-size: 14px; }
dd { margin: 0; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) {
  .grid2 { grid-template-columns: 1fr; }
  .card { grid-template-columns: 1fr; }
  .score { text-align: left; }
  .grid2 > * { min-width: 0; }
  table { display: block; overflow-x: auto; max-width: 100%; }
  .table-wrap table, .table-scroll table { display: table; }
  h1 { font-size: 26px; }
  dl { grid-template-columns: 1fr; gap: 2px; }
  dd { margin-bottom: 8px; }
}

/* ---------- Lade-Indikator (CSS-only) ---------- */
.spinner { display: inline-block; width: 1em; height: 1em; vertical-align: -.15em; flex: none;
  border: 2px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%;
  animation: spin .7s linear infinite; }
.btn .spinner { border-color: rgba(255, 255, 255, .45); border-top-color: currentColor; }
.btn-secondary .spinner, .btn-ghost .spinner { border-color: var(--line-strong); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  * { transition: none !important; }
}

/* ---------- Login ---------- */
.login-card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand);
  border-radius: var(--radius); padding: 36px 32px 32px; box-shadow: var(--shadow); }
.login-logo { display: block; width: min(260px, 70%); height: auto; margin: 0 auto 6px; }
.login-title { text-align: center; font-size: 22px; margin: 18px 0 2px; }
.login-lead { text-align: center; margin: 0 0 24px; }
.login-card .btn { width: 100%; padding: 11px 18px; }
@media (max-width: 480px) { .login-card { padding: 28px 20px 24px; } main.narrow { padding-top: 5vh; } }
