/* HKP-VO-Manager – Medden em Levve */
:root {
  --brand: #00a0b8;
  --brand-ink: #007588;
  --brand-btn: #008398;
  --brand-soft: #e4f5f8;
  --ink: #1d2b33;
  --ink-2: #4a5a63;
  --ink-3: #7b8a92;
  --line: #e1e7ea;
  --line-2: #eef2f4;
  --bg: #f4f7f8;
  --card: #ffffff;
  --rot: #c93a3a;      --rot-bg: #fdeeee;   --rot-line: #f3c9c9;
  --gelb: #8a6200;     --gelb-dot: #e0a400; --gelb-bg: #fff6dc; --gelb-line: #f1dfa4;
  --gruen: #237a48;    --gruen-dot: #2e9e5b; --gruen-bg: #e7f5ec; --gruen-line: #bfe3cc;
  --grau-bg: #eef1f3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 40, 50, .05), 0 1px 1px rgba(20, 40, 50, .03);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.boot { padding: 40px; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .logo { padding: 18px 18px 10px; }
.side .logo img { width: 100%; max-width: 196px; display: block; }
.side .appname { padding: 0 20px 14px; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; border-bottom: 1px solid var(--line-2); }
.nav { padding: 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--line-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; font-size: 12px; background: var(--rot); color: #fff; border-radius: 10px; padding: 0 7px; font-weight: 600; }
.side .userbox { padding: 14px 18px; border-top: 1px solid var(--line-2); font-size: 13px; }
.side .userbox strong { display: block; font-size: 14px; }
.side .userbox .links { margin-top: 8px; display: flex; gap: 12px; }
.side .userbox button { background: none; border: 0; padding: 0; color: var(--brand-ink); cursor: pointer; font-size: 13px; }
.main { min-width: 0; padding: 22px 28px 60px; }
.demo-banner { background: var(--gelb-bg); border: 1px solid var(--gelb-line); color: var(--gelb); padding: 8px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead .sub { color: var(--ink-3); font-size: 14px; margin-top: 3px; }
.pagehead .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }

/* ---------- Karten ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-b { padding: 16px 18px; }
.card-b.flush { padding: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 7px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- KPI-Kacheln ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 13px; cursor: pointer; box-shadow: var(--shadow); position: relative; border-top: 4px solid var(--line); transition: transform .08s; }
.kpi:hover { transform: translateY(-1px); }
.kpi.rot { border-top-color: var(--rot); }
.kpi.gelb { border-top-color: var(--gelb-dot); }
.kpi.gruen { border-top-color: var(--gruen-dot); }
.kpi.sel { outline: 2px solid var(--brand); outline-offset: 1px; }
.kpi .n { font-size: 28px; font-weight: 650; line-height: 1.1; }
.kpi .l { font-size: 13px; color: var(--ink-2); margin-top: 4px; font-weight: 500; }
.kpi .s { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.kpi .s .r { color: var(--rot); font-weight: 600; }
.kpi .s .g { color: var(--gelb); font-weight: 600; }
.kpi .s .ok { color: var(--gruen); font-weight: 600; }

/* ---------- Filterleiste ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.filters input, .filters select { min-width: 140px; }
.filters .search { flex: 1; min-width: 200px; }
.filters .search input { width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: none; padding: 8px 13px; cursor: pointer; color: var(--ink-2); font-weight: 500; min-height: 38px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brand-soft); color: var(--brand-ink); }

/* ---------- Formularelemente ---------- */
input[type=text], input[type=password], input[type=date], input[type=month], input[type=number], input[type=search], select, textarea {
  border: 1px solid #cfd8dc; border-radius: 7px; padding: 8px 10px; background: #fff; min-height: 38px; width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #cfd8dc; background: #fff; border-radius: 7px; padding: 8px 14px; cursor: pointer; font-weight: 500; min-height: 38px; white-space: nowrap; color: var(--ink); }
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn.primary { background: var(--brand-btn); border-color: var(--brand-btn); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.danger { color: var(--rot); border-color: var(--rot-line); }
.btn.danger:hover { background: var(--rot-bg); }
.btn.sm { padding: 4px 10px; min-height: 32px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: none; color: var(--brand-ink); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Tabellen ---------- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; user-select: none; }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--ink); }
table.t th .arr { font-size: 10px; margin-left: 3px; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f7fafb; }
table.t tr.done td { color: var(--ink-3); }
table.t td.ampel { width: 26px; padding-right: 0; }
.empty { padding: 28px 18px; text-align: center; color: var(--ink-3); }
.empty.ok { color: var(--gruen); }

/* ---------- Badges & Ampel ---------- */
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--line); vertical-align: middle; margin-top: 4px; }
.dot.rot { background: var(--rot); }
.dot.gelb { background: var(--gelb-dot); }
.dot.gruen { background: var(--gruen-dot); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 20px; background: var(--grau-bg); color: var(--ink-2); white-space: nowrap; border: 1px solid transparent; }
.badge.rot { background: var(--rot-bg); color: var(--rot); border-color: var(--rot-line); }
.badge.gelb { background: var(--gelb-bg); color: var(--gelb); border-color: var(--gelb-line); }
.badge.gruen { background: var(--gruen-bg); color: var(--gruen); border-color: var(--gruen-line); }
.badge.blau { background: var(--brand-soft); color: var(--brand-ink); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cat { font-size: 12px; color: var(--ink-3); }
.wgtag { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* ---------- Hinweise ---------- */
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; border: 1px solid; font-size: 14px; }
.alert.rot { background: var(--rot-bg); border-color: var(--rot-line); }
.alert.gelb { background: var(--gelb-bg); border-color: var(--gelb-line); }
.alert.gruen { background: var(--gruen-bg); border-color: var(--gruen-line); }
.alert .grow { flex: 1; }

/* ---------- Schrittanzeige Antrag ---------- */
.steps { display: flex; gap: 0; margin: 4px 0 16px; }
.steps .st { flex: 1; text-align: center; font-size: 12px; color: var(--ink-3); position: relative; padding-top: 22px; }
.steps .st::before { content: ""; position: absolute; top: 6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #fff; border: 2px solid #c7d1d6; z-index: 1; }
.steps .st::after { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: #c7d1d6; }
.steps .st:first-child::after { display: none; }
.steps .st.done { color: var(--ink-2); }
.steps .st.done::before { background: var(--brand); border-color: var(--brand); }
.steps .st.done::after { background: var(--brand); }
.steps .st.cur { color: var(--brand-ink); font-weight: 600; }
.steps .st.warn::before { background: var(--gelb-dot); border-color: var(--gelb-dot); }

/* ---------- Leistungsnachweis-Monate ---------- */
.lnrow { display: flex; align-items: center; gap: 12px; padding: 8px 18px; border-bottom: 1px solid var(--line-2); }
.lnrow:last-child { border-bottom: 0; }
.lnrow .m { width: 130px; font-weight: 500; }
.lnrow select { max-width: 260px; }
.lnrow .info { font-size: 12px; color: var(--ink-3); }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 35, 45, .38); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 680px; box-shadow: 0 20px 50px rgba(0, 0, 0, .2); }
.modal.wide { max-width: 860px; }
.modal .mh { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal .mh .x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--ink-3); padding: 4px 8px; }
.modal .mb { padding: 18px 20px; }
.modal .mf { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal .mf .left { margin-right: auto; display: flex; gap: 8px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form .f { display: flex; flex-direction: column; gap: 4px; }
.form .f.full { grid-column: 1 / -1; }
.form .f > span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.form .f > span .req { color: var(--rot); }
.form .f .hint { font-size: 12px; color: var(--ink-3); }
.form .sec { grid-column: 1 / -1; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--brand-ink); padding-top: 6px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.form .sec:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.checks { display: flex; gap: 6px 14px; flex-wrap: wrap; padding: 6px 0; }
.checks label, .chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.checks input, .chk input { width: 18px; height: 18px; accent-color: var(--brand-btn); }
.formerr { background: var(--rot-bg); color: var(--rot); border: 1px solid var(--rot-line); border-radius: 7px; padding: 8px 12px; font-size: 14px; margin-bottom: 12px; }
.compare { font-size: 13px; background: var(--line-2); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 20px rgba(0, 0, 0, .2); max-width: 420px; }
.toast.err { background: var(--rot); }

/* ---------- Anmeldung ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .box { width: 100%; max-width: 430px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 30px 30px 26px; box-shadow: 0 10px 30px rgba(20, 40, 50, .06); }
.login img { width: 100%; max-width: 330px; display: block; margin: 0 auto 6px; }
.login .title { text-align: center; color: var(--ink-3); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 22px; }
.login .f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.login .btn { width: 100%; margin-top: 6px; }
.login .demo-users { display: flex; flex-direction: column; gap: 6px; }
.login .demo-users .btn { justify-content: space-between; margin: 0; }
.login .note { font-size: 12px; color: var(--ink-3); margin-top: 16px; text-align: center; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--brand-ink); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* ---------- Responsiv (iPad, schmale Fenster) ---------- */
@media (max-width: 1080px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav { min-width: 0; }
  .side { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; z-index: 20; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .logo { padding: 8px 12px; }
  .side .logo img { width: 150px; }
  .side .appname { display: none; }
  .nav { flex-direction: row; overflow-x: auto; padding: 6px; flex: 1; }
  .nav a { padding: 9px 11px; white-space: nowrap; }
  .side .userbox { border-top: 0; border-left: 1px solid var(--line-2); padding: 6px 12px; white-space: nowrap; }
  .side .userbox .role { display: none; }
  .main { padding: 18px 16px 50px; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav a span.lbl { display: none; }
  .form { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .side .userbox strong { display: none; }
}
@media print {
  .side, .filters, .actions, .btn { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
