:root {
  --bg: #f4f6fa; --card: #fff; --line: #e5e8ef; --text: #0f172a; --muted: #64748b;
  --primary: #2563eb; --primary-d: #1d4ed8; --side: #0f172a; --side-t: #cbd5e1;
  --ok: #16a34a; --warn: #d97706; --err: #dc2626; --info: #64748b;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; word-break: break-all; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 10px; }
h2.sec { margin: 26px 0 12px; font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.up { color: var(--ok); } .down { color: var(--err); }

/* Layout */
.side { position: fixed; inset: 0 auto 0 0; width: 236px; background: var(--side); color: var(--side-t); display: flex; flex-direction: column; padding: 16px 12px; overflow-y: auto; }
.side a { color: var(--side-t); display: block; padding: 7px 10px; border-radius: 7px; }
.side a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.side a.on, .side a.cur { background: rgba(255,255,255,.1); color: #fff; }
.side .brand { font-weight: 700; font-size: 17px; color: #fff; margin-bottom: 14px; }
.side .side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin: 16px 10px 6px; }
.side .sub { margin: 2px 0 8px 10px; border-left: 1px solid #334155; padding-left: 6px; }
.side .sub a { font-size: 13px; padding: 5px 10px; }
.side .soon { font-size: 10px; background: #334155; color: #cbd5e1; padding: 1px 6px; border-radius: 9px; margin-left: 4px; }
.side-foot { margin-top: auto; border-top: 1px solid #1e293b; padding-top: 10px; }
.side-foot small { display: block; color: #64748b; padding: 6px 10px; word-break: break-all; }
.logo { color: #60a5fa; }
.brand.big { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 20px; }
main.with-side { margin-left: 236px; padding: 26px 30px 60px; max-width: 1500px; }
main.centered { padding: 60px 20px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.page-head p { margin: 0; }
.actions { display: flex; gap: 8px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.toolbar h2.sec { margin: 18px 0 8px; }
.period { margin: 4px 0 14px; }

/* Cards & Grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; }
.card.narrow { max-width: 560px; margin: 0 auto 16px; }
.card.hint { background: #eff6ff; border-color: #bfdbfe; }
.card.warnbox { border-color: #fcd34d; background: #fffbeb; }
.card.danger { border-color: #fecaca; }
.card.center { text-align: center; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.grid { display: grid; gap: 16px; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .grid { margin-top: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.two-one { grid-template-columns: 2fr 1fr; }
.grid.one-two { grid-template-columns: 1fr 2fr; }
@media (max-width: 1000px) { .grid.two, .grid.two-one, .grid.one-two { grid-template-columns: 1fr; } }
.proj-card { color: inherit; display: block; transition: box-shadow .15s, border-color .15s; }
.proj-card:hover { text-decoration: none; border-color: #93c5fd; box-shadow: 0 4px 16px rgba(37,99,235,.08); }
.proj-card h3 { margin-bottom: 2px; }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.mini-kpis .lbl, .kpi .lbl, .card .lbl { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mini-kpis b { font-size: 18px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi b { display: block; font-size: 24px; line-height: 1.25; margin: 2px 0; }
.kpi .codes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.delta { font-size: 12px; font-weight: 600; color: var(--muted); }
.delta.up { color: var(--ok); } .delta.down { color: var(--err); }

.score { font-weight: 800; }
.score.big { font-size: 30px; }
.score.huge { font-size: 64px; line-height: 1.1; margin: 6px 0; }
.score.sg { color: var(--ok); } .score.sm { color: var(--warn); } .score.sb { color: var(--err); }

/* Tabellen */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl.compact td, .tbl.compact th { padding: 6px 8px; }
.tbl .r { text-align: right; white-space: nowrap; }
.tbl td.url { word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.tbl.kv th { width: 220px; text-transform: none; font-size: 13px; }
.tbl th.sort a { color: var(--muted); }
.tbl th.sort a.on { color: var(--text); text-decoration: underline; }
.ext { margin-left: 4px; color: var(--muted); }

.pos { display: inline-block; min-width: 40px; text-align: center; padding: 1px 7px; border-radius: 6px; font-weight: 600; font-size: 12.5px; }
.pos.p1 { background: #dcfce7; color: #166534; } .pos.p2 { background: #dbeafe; color: #1e40af; }
.pos.p3 { background: #fef3c7; color: #92400e; } .pos.p4 { background: #f1f5f9; color: #475569; }
.sev, .tag, .code { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.sev.error { background: #fee2e2; color: #991b1b; } .sev.warning { background: #fef3c7; color: #92400e; } .sev.notice { background: #e0f2fe; color: #075985; }
.tag.warn { background: #fef3c7; color: #92400e; font-weight: 500; }
.code.c2, .codes .c2 { background: #dcfce7; color: #166534; } .code.c3, .codes .c3 { background: #e0f2fe; color: #075985; }
.code.c4, .codes .c4 { background: #fee2e2; color: #991b1b; } .code.c5, .code.c0, .codes .c5 { background: #fecaca; color: #7f1d1d; }
.codes span { padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }

/* Tabs & Segmente */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .tabs { margin-bottom: 0; border-bottom: 0; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a.on { color: var(--text); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.seg { display: inline-flex; background: #e9edf3; border-radius: 8px; padding: 3px; }
.seg a { padding: 4px 11px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.seg a.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg a:hover { text-decoration: none; }

/* Formulare */
.form label { display: block; margin-bottom: 12px; font-weight: 500; }
.form label input, .form label select, .form label textarea { display: block; width: 100%; margin-top: 4px; }
.form label.check { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
.form label.check input { width: auto; margin-top: 3px; }
.form h3 { margin-top: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
textarea.code { width: 100%; font-family: ui-monospace, monospace; font-size: 12px; }
.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { min-width: 260px; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 7px; border: 1px solid #cbd5e1; background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { background: #fff; border-color: #fca5a5; color: var(--err); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.flash.err { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
.flash.warn { background: #fef3c7; color: #78350f; border-color: #fde68a; }

.progress { height: 10px; background: #e2e8f0; border-radius: 6px; overflow: hidden; margin: 8px 0 10px; }
.progress .bar { height: 100%; background: linear-gradient(90deg, #3b82f6, #6366f1); transition: width .4s; }

.checks { list-style: none; padding: 0; margin: 0 0 12px; }
.checks li { padding: 4px 0 4px 26px; position: relative; }
.checks li::before { position: absolute; left: 0; }
.checks li.ok::before { content: "✅"; } .checks li.no::before { content: "⬜"; }
.issue-list { list-style: none; padding: 0; margin: 0; }
.issue-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }

.pager { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager span { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.pager a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager span { border-color: transparent; }

@media (max-width: 800px) {
  .side { position: static; width: auto; }
  main.with-side { margin-left: 0; padding: 18px; }
  .row2, .row3 { grid-template-columns: 1fr; }
}
