:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --ink: #1a1c22;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #1c1d27;   /* per CI via JS überschrieben */
  --accent: #df5c26;    /* CI Akzent */
  --accent2: #98232a;   /* CI Sekundär */
  --ok: #1f9d55;
  --warn: #c47f17;
  --danger: #d23b3b;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20,25,40,.08), 0 6px 20px rgba(20,25,40,.05);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

#app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--primary); color: #fff; padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top,0px)); display: flex; align-items: center; gap: 10px; }
.topbar .logo { font-weight: 800; font-size: 18px; line-height: 1.1; }
.topbar .logo small { display: block; font-weight: 500; opacity: .75; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 12px; opacity: .85; text-align: right; }

.view { flex: 1; padding: 16px; max-width: 820px; width: 100%; margin: 0 auto; padding-bottom: 100px; }
h1 { font-size: 22px; margin: 4px 0 16px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 20px 4px 8px; font-weight: 700; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding-bottom: var(--safe-bottom); }
.tabbar a { flex: 1; text-align: center; padding: 9px 2px 7px; color: var(--muted); font-size: 10.5px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tabbar a .ic { font-size: 20px; line-height: 1; }
.tabbar a.active { color: var(--accent); font-weight: 700; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2, .card h3 { margin: 0 0 10px; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.kpi .val { font-size: 25px; font-weight: 800; line-height: 1.1; }
.kpi .lbl { color: var(--muted); font-size: 13px; margin-top: 3px; }
.kpi.alert .val { color: var(--accent); }

.row { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amt { font-weight: 700; white-space: nowrap; }
.row.clickable:active { background: #f0f1f4; }
.avatars { display: flex; gap: -6px; }
.chip { display: inline-block; background: #eef1f6; color: var(--muted); border-radius: 999px; padding: 2px 9px; font-size: 12px; margin: 2px 4px 0 0; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.neu { background: #fdeede; color: var(--accent); }
.badge.zugeordnet { background: #e3f0ff; color: #1f5fb0; }
.badge.geprueft, .badge.bezahlt, .badge.abgeschlossen, .badge.aktiv { background: #e2f5ea; color: var(--ok); }
.badge.offen { background: #eef1f6; color: var(--muted); }
.badge.auto { background: #ece6ff; color: #6b3fd1; }
.badge.manuell { background: #eef1f6; color: var(--muted); }
.badge.warn { background: #fdeede; color: var(--warn); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); color: #fff; border: 0; border-radius: 11px; padding: 13px 18px; font-weight: 700; font-size: 15px; width: 100%; cursor: pointer; }
.btn:active { filter: brightness(.93); }
.btn.sec { background: #eef1f6; color: var(--ink); }
.btn.dark { background: var(--primary); }
.btn.ok { background: var(--ok); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 14px; border-radius: 9px; }
.btn:disabled { opacity: .55; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); background: #fff; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 24px 16px; text-align: center; color: var(--muted); background: var(--surface); }
.drop.drag { border-color: var(--accent); background: #fdf3ec; }
.drop .big { font-size: 32px; }

.bar { height: 8px; background: #eef1f6; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--ok); }
.bar.over > span { background: var(--danger); }

.seg { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.seg button { background: #eef1f6; border: 0; border-radius: 9px; padding: 8px 13px; font-size: 14px; font-weight: 600; color: var(--ink); }
.seg button.on { background: var(--accent); color: #fff; }

.empty, .loading, .error { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 42px; margin-bottom: 8px; }
.error { color: var(--danger); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg,#eef1f6 25%,#f6f8fb 50%,#eef1f6 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 54px; margin-bottom: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, var(--primary), #000); }
.login-card { background: #fff; border-radius: 18px; padding: 28px 24px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card .brand { text-align: center; margin-bottom: 18px; }
.login-card .brand .nm { font-size: 22px; font-weight: 800; color: var(--primary); }
.login-card .brand .sub { color: var(--muted); font-size: 13px; }

#toast { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); background: #1a1c22; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 100; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; max-width: 90%; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }
#toast.ok { background: #1f7a47; } #toast.err { background: #b32d2d; }

.modal-bg { position: fixed; inset: 0; background: rgba(15,18,28,.5); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; border-radius: 18px 18px 0 0; width: 100%; max-width: 820px; max-height: 92dvh; overflow: auto; padding: 20px 18px calc(20px + var(--safe-bottom)); }
.modal h2 { margin-top: 4px; }
.modal .close { float: right; background: #eef1f6; border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 18px; }
@media(min-width:760px){ .modal-bg{ align-items: center; } .modal{ border-radius: 18px; } }

.hint { font-size: 13px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.kv:last-child { border-bottom: 0; } .kv .k { color: var(--muted); } .kv .v { font-weight: 600; text-align: right; }
.suggest { background: #fdf3ec; border: 1px solid #f3d4bf; border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.fab { position: fixed; right: 16px; bottom: calc(80px + var(--safe-bottom)); z-index: 25; background: var(--accent); color: #fff; border: 0; width: 56px; height: 56px; border-radius: 50%; font-size: 28px; box-shadow: 0 6px 18px rgba(223,92,38,.5); }
.menu-list a { display: flex; align-items: center; gap: 12px; padding: 16px 4px; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.menu-list a .ic { font-size: 20px; }
.menu-list a:last-child { border-bottom: 0; }
