/* SAPify-Solutions Design (analog SAP Patch Advisor): gleiche Variablen, Hell/Dunkel */
:root {
  --sap-blue: #0a6ed1;
  --sap-blue-dark: #0854a0;
  --sap-dark: #32363a;
  --sap-navy: #1c2b3a;
  --bg: #f5f6f7;
  --border: #d9d9d9;
  --hot: #bb0000;
  --high: #e9730c;
  --ok: #107e3e;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 6px rgba(0,0,0,0.04);
  --surface: #ffffff;
  --surface-alt: #fafcff;
  --surface-hover: #f0f2f4;
  --table-header-bg: #f7f8f9;
  --text: #1a1a1a;
  --text-muted: #6a6d70;
  --ok-bg: #e5f5e8; --ok-fg: #0d6b32;
  --nok-bg: #fde8e8; --nok-fg: #a30000;
  --na-bg: #ececec; --na-fg: #595959;
}
[data-theme="dark"] {
  --sap-dark: #e4e7ea;
  --bg: #14171a;
  --border: #3a4048;
  --surface: #20242a;
  --surface-alt: #262b32;
  --surface-hover: #2b313a;
  --table-header-bg: #262b32;
  --text: #e4e7ea;
  --text-muted: #9aa3ad;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 1px 6px rgba(0,0,0,0.25);
  --ok-bg: #16331f; --ok-fg: #6fd48f;
  --nok-bg: #3b1b1d; --nok-fg: #ff8e8e;
  --na-bg: #2f343b; --na-fg: #aab2bb;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "72", "Segoe UI", Arial, sans-serif;
  margin: 0; background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1 0 auto; padding: 32px 0 48px; }
.page-container { --seitenrand: clamp(16px, 2.2vw, 40px); width: 100%; max-width: 1760px; margin: 0 auto; padding: 0 var(--seitenrand); }
[hidden] { display: none !important; }

/* Header */
header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 20px; padding-top: 14px; padding-bottom: 14px; }
header .logo { height: 40px; width: auto; display: block; }
.wordmark { font-weight: 800; font-size: 24px; color: var(--sap-blue); letter-spacing: -0.01em; }
header .header-text { border-left: 1px solid var(--border); padding-left: 20px; }
header h1 { margin: 0; font-size: 19px; font-weight: 700; color: var(--sap-dark); }
.subtitle { margin: 2px 0 0; opacity: 0.65; font-size: 12.5px; }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--text-muted); white-space: nowrap; }

/* Tabs */
nav.tabs { background: var(--surface); border-bottom: 1px solid var(--border); }
.tabs-inner { display: flex; flex-wrap: wrap; }
.tab-btn { border: none; background: none; padding: 14px 22px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 500; color: var(--sap-dark); border-bottom: 3px solid transparent; transition: color .15s ease, border-color .15s ease; }
.tab-btn:hover { color: var(--sap-blue); }
.tab-btn.active { border-bottom-color: var(--sap-blue); color: var(--sap-blue); font-weight: 700; }
.tab-btn:focus-visible { outline: 2px solid var(--sap-blue); outline-offset: -3px; border-radius: 2px; }
h2 { color: var(--sap-dark); font-size: 20px; font-weight: 700; margin: 0 0 16px; }
h3 { color: var(--sap-dark); font-size: 15px; margin: 0 0 10px; }
h4 { color: var(--sap-dark); font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .03em; }
.view { animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Buttons / Inputs */
button, .btn { font: inherit; }
.btn { background: var(--sap-blue); color: #fff; border: 1px solid var(--sap-blue); border-radius: 6px; padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--sap-blue-dark); border-color: var(--sap-blue-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border); }
.btn-danger { background: var(--surface); color: var(--hot); border: 1px solid var(--border); }
.btn-danger:hover { background: var(--nok-bg); border-color: var(--hot); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-icon { background: transparent; color: var(--sap-dark); border: none; font-size: 18px; line-height: 1; padding: 6px; cursor: pointer; border-radius: 6px; }
.btn-icon:hover { background: var(--surface-hover); }
.link { background: none; border: none; color: var(--sap-blue); cursor: pointer; padding: 0; font-size: 12.5px; }
.link:hover { text-decoration: underline; }
input, select, textarea { font: inherit; font-size: 13.5px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 9px 11px; width: 100%; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: var(--surface-alt); }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sap-blue); outline-offset: -1px; border-color: var(--sap-blue); }
label { display: block; font-size: 12.5px; font-weight: 700; color: var(--sap-dark); margin-bottom: 5px; }
.req::after { content: " *"; color: var(--hot); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.hint { color: var(--text-muted); font-size: 12.5px; }
.err { color: var(--hot); font-size: 13px; margin-top: 8px; }
details.phase { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
details.phase > summary { cursor: pointer; padding: 14px 18px; font-weight: 600; color: var(--sap-dark); list-style: none; display: flex; align-items: center; gap: 10px; user-select: none; }
details.phase > summary::-webkit-details-marker { display: none; }
details.phase > summary::before { content: "▶"; font-size: 10px; color: var(--sap-blue); transition: transform .15s ease; display: inline-block; }
details.phase[open] > summary::before { transform: rotate(90deg); }
details.phase > summary:hover { background: var(--surface-hover); }
.phase-count { margin-left: auto; font-weight: 500; font-size: 12.5px; color: var(--text-muted); }

/* Tabellen */
table { width: 100%; border-collapse: collapse; background: var(--surface); }
.tbl-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }
details.phase table { border-top: 1px solid var(--border); }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
th { background: var(--surface-hover); color: var(--sap-dark); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; user-select: none; }
tbody tr:last-child td { border-bottom: none; }
tr.chk { cursor: pointer; }
tr.chk:hover td { background: var(--surface-hover); }
tr.chk.open td { background: var(--surface-alt); }
td.nr { width: 46px; color: var(--text-muted); text-align: center; }
td.num, th.num { text-align: center; white-space: nowrap; }
.sub { display: block; color: var(--text-muted); font-size: 12px; margin-top: 3px; font-family: Consolas, "Courier New", monospace; }
.muted { color: var(--text-muted); }
tr.detail > td { padding: 0; background: var(--surface-alt); cursor: default; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 18px 20px 20px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; font-size: 13px; margin-bottom: 14px; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* Status */
select.st { width: 86px; padding: 5px 8px; font-weight: 700; font-size: 12.5px; text-align: center; }
select.st.s-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: transparent; }
select.st.s-nok { background: var(--nok-bg); color: var(--nok-fg); border-color: transparent; }
select.st.s-na { background: var(--na-bg); color: var(--na-fg); border-color: transparent; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border); }
.badge.eigen { background: rgba(10,110,209,.12); color: var(--sap-blue); border-color: transparent; }
.ico { white-space: nowrap; color: var(--text-muted); font-size: 12.5px; }

/* Summary */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.tile .v { font-size: 26px; font-weight: 700; color: var(--sap-dark); }
.tile .l { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); font-weight: 700; }
.tile.t-ok .v { color: var(--ok-fg); } .tile.t-nok .v { color: var(--nok-fg); }
.bar { height: 8px; background: var(--surface-hover); border-radius: 4px; overflow: hidden; margin-top: 8px; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; background: var(--sap-blue); width: 0; transition: width .25s; }
.bar.sm { width: 120px; margin-top: 0; }

/* Bilder / Kommentare */
.dropzone { border: 1px dashed var(--border); border-radius: 6px; padding: 12px; text-align: center; color: var(--text-muted); font-size: 12.5px; cursor: pointer; background: var(--surface); }
.dropzone:hover, .dropzone:focus, .dropzone.over { border-color: var(--sap-blue); color: var(--sap-blue); outline: none; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.thumb { position: relative; width: 112px; height: 82px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; line-height: 18px; text-align: center; border-radius: 10px; background: rgba(0,0,0,.65); color: #fff; font-size: 13px; border: none; cursor: pointer; padding: 0; }
.thumb .x:hover { background: var(--hot); }
.comment { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); padding: 10px 12px; margin-bottom: 10px; }
.comment .meta { display: flex; gap: 8px; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; align-items: center; }
.comment .meta b { color: var(--sap-dark); }
.comment .txt { white-space: pre-wrap; word-break: break-word; font-size: 13px; }

/* Modal / Toast / Lightbox */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.4); width: 100%; max-width: 640px; padding: 22px; }
.modal h3 { font-size: 17px; margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--sap-navy); color: #fff; padding: 11px 16px; border-radius: 6px; box-shadow: var(--shadow); z-index: 100; font-size: 13.5px; max-width: 420px; }
.toast.bad { background: var(--hot); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 120; display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 4px; }

/* Footer */
footer.site-footer { flex-shrink: 0; background: var(--surface); border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-muted); }
footer .footer-inner { display: flex; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
footer .wordmark { font-size: 16px; }
footer img { height: 22px; }

@media (max-width: 980px) {
  .detail-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .tbl-wrap, details.phase { overflow-x: auto; }
  .header-inner { flex-wrap: wrap; }
}

/* Cockpit */
.cockpit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; margin-bottom: 32px; max-width: 1200px; }
.cockpit-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; transition: border-color .15s, transform .15s; }
.cockpit-card:hover { border-color: var(--sap-blue); transform: translateY(-2px); }
.cc-icon { font-size: 34px; line-height: 1; margin-bottom: 12px; }
.cockpit-card h3 { font-size: 21px; margin-bottom: 8px; }
.cc-text { color: var(--text-muted); font-size: 13.5px; line-height: 1.5; margin: 0 0 18px; min-height: 60px; }
.cc-stats { display: flex; gap: 28px; margin-bottom: 20px; }
.cc-stats b { display: block; font-size: 24px; color: var(--sap-dark); }
.cc-stats b.bad { color: var(--nok-fg); }
.cc-stats span { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); font-weight: 700; }
.cc-lead { margin: -8px 0 20px; font-size: 14px; }

/* Hilfsklassen */
.flush { margin: 0 !important; }
.w150 { width: 150px; } .w200 { width: 200px; } .w300 { width: 300px; max-width: 100%; }
.filter-row { margin-bottom: 16px; }
.chk-lbl { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; cursor: pointer; }
.chk-lbl input { width: auto; }
.pad { padding: 16px 20px; }
.mt { margin-top: 18px; }
.narrow { max-width: 440px; }
.create-row { margin-top: 16px; }
.detail-actions { margin-bottom: 14px; }
.meta-panel { padding-top: 14px; }
.badge.nokb { background: var(--nok-bg); color: var(--nok-fg); border-color: transparent; }
.badge.eigen { margin-left: 8px; }
.composer { margin-top: 12px; }
.composer textarea { margin-bottom: 6px; }

/* Portale / Bestätigung / Word-Vorlage */
.badge.done { background: var(--ok-bg); color: var(--ok-fg); border-color: transparent; margin-left: 8px; }
.badge.big { font-size: 12px; padding: 3px 10px; vertical-align: middle; }
.confirm-banner { background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-fg); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.note-box { background: var(--surface-hover); border-left: 4px solid var(--sap-blue); border-radius: 4px; padding: 10px 14px; margin: 10px 0; font-size: 13.5px; }
.secret { display: block; font-size: 18px; letter-spacing: .04em; padding: 14px 16px; margin: 12px 0 16px; background: var(--surface-hover); border: 1px dashed var(--border); border-radius: 6px; user-select: all; word-break: break-all; }
.chip { display: inline-block; font-size: 12px; background: var(--surface-hover); border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; margin: 2px 4px 2px 0; }
ul.warn { margin: 10px 0 4px 18px; padding: 0; color: var(--nok-fg); font-size: 13px; }
.panel.flat { box-shadow: none; margin-top: 12px; }
.tiles.kpis { margin-bottom: 24px; }
details.hist { margin-top: 16px; }
details.hist table { width: 100%; }
.pad p { margin: 0 0 10px; font-size: 13.5px; }
@media (max-width: 900px) { .tiles.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Zweiter Faktor (Konto) */
.mfa-qr { display: flex; justify-content: center; margin: 10px 0; }
.mfa-qr svg { background: #fff; padding: 6px; border-radius: 6px; }
.codes-liste { font-family: Consolas, monospace; font-size: 14px; columns: 2; margin: 8px 0 14px; padding-left: 22px; }
.sub.plain { font-family: inherit; font-size: 12px; }
