/* ============================================================
   BWH Cockpit — modernes Design
   ============================================================ */
:root {
  --bg: #eef1f7;
  --bg-soft: #f6f8fc;
  --card: #ffffff;
  --ink: #0f1b30;          /* Überschriften / Navy (Logo) */
  --text: #344054;         /* Fließtext */
  --muted: #7a869a;
  --line: #e6eaf1;
  --line-soft: #eef1f6;
  --brand: #1f4fd1;        /* Primär-Blau */
  --brand-2: #3b6ef0;      /* Verlauf-Ende */
  --brand-ink: #112248;    /* Navy für Marke */
  --brand-soft: rgba(31,79,209,.10);
  --green: #167a52;
  --green-soft: #e3f5ec;
  --red: #c0341d;
  --red-soft: #fbe8e4;
  --amber: #a76a12;
  --amber-soft: #fcf1de;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16,30,54,.06);
  --shadow-md: 0 2px 6px rgba(16,30,54,.06), 0 8px 24px rgba(16,30,54,.06);
  --shadow-lg: 0 8px 20px rgba(16,30,54,.10), 0 24px 60px rgba(16,30,54,.12);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2, h3 { color: var(--ink); }
strong { color: var(--ink); }

/* Buttons */
button { font: inherit; cursor: pointer; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px; font-weight: 600;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease, filter .12s ease, background .12s ease; }
button:hover { filter: brightness(1.05); box-shadow: 0 4px 14px rgba(31,79,209,.30); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button.ghost { background: transparent; color: var(--muted); box-shadow: none; }
button.ghost:hover { background: rgba(15,27,48,.05); color: var(--ink); filter: none; transform: none; }
button.secondary { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
button.secondary:hover { background: var(--bg-soft); border-color: #d7deea; filter: none; }
button.danger { background: linear-gradient(135deg, #d23a22, #b5301b); }
button.danger:hover { box-shadow: 0 4px 14px rgba(192,52,29,.30); }
button.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Inputs */
input, select, textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink); transition: border-color .12s ease, box-shadow .12s ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input::placeholder { color: #aab3c2; }
textarea { resize: vertical; min-height: 64px; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
label input, label select, label textarea { margin-top: 6px; font-weight: 400; }
.error { color: var(--red); font-size: 13.5px; margin-top: 10px; min-height: 18px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, var(--bg-soft) 45%, var(--bg) 100%); }
.login-card { background: var(--card); padding: 38px 36px; border-radius: 20px; box-shadow: var(--shadow-lg); width: 380px; border: 1px solid var(--line-soft); }
.login-card h1 { font-size: 23px; margin: 0; text-align: center; letter-spacing: -.2px; }
.login-card .sub { color: var(--muted); margin: 6px 0 26px; text-align: center; }
.login-card button[type=submit] { width: 100%; margin-top: 10px; padding: 11px; }

.logo { height: 30px; width: auto; display: block; }
.logo-lg { height: 60px; margin: 0 auto 10px; display: block; }

/* App-Shell: Sidebar + Inhalt */
#app-view { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar { width: 250px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 16px 14px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 8px 8px 16px; cursor: pointer; }
.side-brand .bt { font-weight: 800; color: var(--brand-ink); letter-spacing: -.2px; font-size: 16px; white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.side-nav button, .side-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; justify-content: flex-start; background: transparent; color: var(--muted); border-radius: 9px; padding: 10px 12px; font-weight: 600; box-shadow: none; font-size: 14px; }
.side-nav button:hover, .side-item:hover { background: rgba(15,27,48,.05); color: var(--ink); filter: none; transform: none; }
.side-nav button.active { background: var(--brand-soft); color: var(--brand); }
.side-nav button.side-back { color: var(--brand); padding: 8px 12px; }
.side-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 14px 12px 5px; font-weight: 700; }
.side-foot { border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.side-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.side-user { padding: 8px 12px 6px; }
#user-label { font-size: 13px; color: var(--muted); }
.notif-badge { margin-left: auto; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; }

/* Main */
main { flex: 1; min-width: 0; padding: 30px 34px 64px; }
.main-inner, .page-head, .stat-row, .cockpit-grid, .toolbar-inline, .card, #main > h3 { max-width: 1120px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.page-head h3 { margin: 0; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }

/* Cards & tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
th { background: var(--bg-soft); color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; }
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: #fafbfe; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 44px; text-align: center; color: var(--muted); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; letter-spacing: .2px; }
.badge.pending { background: var(--amber-soft); color: var(--amber); }
.badge.approved, .badge.active { background: var(--green-soft); color: var(--green); }
.badge.rejected { background: var(--red-soft); color: var(--red); }
.badge.closed { background: #eef1f6; color: var(--muted); }

/* Layout helpers */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; flex: 1; min-width: 190px; box-shadow: var(--shadow-md); }
.stat .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 6px; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.stat .v.green { color: var(--green); }
.toolbar-inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar-inline label { margin-bottom: 0; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,27,48,.42); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg); width: 560px; max-width: 100%; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--card); }
.modal-head h2 { margin: 0; font-size: 18px; }
#modal-body { padding: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 11px; box-shadow: var(--shadow-lg); z-index: 100; font-size: 14px; font-weight: 500; }
.toast.err { background: linear-gradient(135deg, #d23a22, #b5301b); }

/* Options / notices */
.notice { background: var(--amber-soft); color: #7a5212; border: 1px solid #f1dcae; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; margin: 16px 0; line-height: 1.55; }
.opt-list { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; margin: 8px 0 4px; }
.opt-row { display: flex; gap: 11px; align-items: flex-start; padding: 13px 15px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .1s ease; }
.opt-row:last-child { border-bottom: none; }
.opt-row:hover { background: var(--bg-soft); }
.opt-row input { width: auto; margin-top: 3px; accent-color: var(--brand); }
.opt-row.sel { background: var(--brand-soft); }
.opt-row .ot { font-weight: 700; color: var(--ink); }
.opt-row .od { font-size: 12.5px; color: var(--muted); }
.fixed-field { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 6px; font-weight: 700; color: var(--ink); }
.check-row { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 14px; }
.check-row input { width: auto; margin-top: 2px; accent-color: var(--brand); }
.check-row label { margin: 0; font-size: 14px; font-weight: 500; color: var(--text); }

/* Notifications */
.notif-item { padding: 13px 15px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--brand-soft); }
.notif-item .nt { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sum-row td { font-weight: 800; background: var(--bg-soft); color: var(--ink); }

/* Cockpit */
.cockpit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.module { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-md); padding: 24px; display: flex; flex-direction: column; gap: 9px; position: relative; overflow: hidden; }
.module.clickable { cursor: pointer; transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease; }
.module.clickable::before { content: ""; position: absolute; left: 0; top: 0; height: 4px; width: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); opacity: 0; transition: opacity .18s ease; }
.module.clickable:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: #d7deea; }
.module.clickable:hover::before { opacity: 1; }
.module.soon { opacity: .72; background: linear-gradient(180deg, #fff, #fbfcfe); }
.module .icon { width: 48px; height: 48px; border-radius: 13px; background: linear-gradient(135deg, var(--brand-soft), rgba(59,110,240,.18)); display: grid; place-items: center; font-size: 23px; margin-bottom: 6px; }
.module.soon .icon { background: #f0f3f8; filter: grayscale(.3); }
.module h3 { margin: 0; font-size: 18px; letter-spacing: -.2px; }
.module .desc { color: var(--muted); font-size: 13.5px; line-height: 1.5; flex: 1; }
.module .kpis { display: flex; gap: 20px; margin: 10px 0 6px; flex-wrap: wrap; }
.module .kpi .v { font-size: 20px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
.module .kpi .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; margin-top: 2px; }
.module .open-btn { align-self: flex-start; margin-top: 6px; }
.module .icon { color: var(--brand); }
.module .icon svg { width: 24px; height: 24px; }
.sec-title { font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; margin: 28px 0 14px; }
.greeting h2 { font-size: 25px; letter-spacing: -.4px; }
.greeting .muted { margin-top: 3px; }

@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 16px; }
  main { padding: 22px 16px 48px; }
}
