:root {
  --bg: #f3f5f8; --card: #fff; --ink: #1d2433; --muted: #7a8396; --line: #e3e7ee;
  --accent: #2f5bea; --accent-ink: #fff; --ok: #1f9d55; --err: #d1495b; --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; color: var(--ink); background: var(--bg);
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
a { color: var(--accent); text-decoration: none; }
h2, h3 { font-weight: 600; }
.muted { color: var(--muted); }
.center { text-align: center; }
kbd { font: 12px ui-monospace, monospace; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

/* Kopfzeile */
.top { display: flex; align-items: center; gap: 28px; padding: 0 22px; height: 56px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; letter-spacing: .2px; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--accent); display: inline-block; }
nav { display: flex; gap: 4px; flex: 1; }
nav a { color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
nav a.on, nav a:hover { color: var(--ink); background: var(--bg); }
.who { display: flex; gap: 10px; align-items: center; color: var(--muted); }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

/* Bausteine */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(20, 30, 60, .04); margin-bottom: 14px; }
input, select, button, textarea { font: inherit; color: inherit; }
input, select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; min-width: 0; }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; cursor: pointer; color: var(--ink); white-space: nowrap; font-weight: 500; }
.btn:hover { border-color: #c9cfda; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--err); }
.btn.icon { padding: 8px 12px; }
.btn.wide { width: 100%; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.err { background: #fdecef; color: #8c1d2c; }
.flash.ok { background: #e7f6ee; color: #145c34; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.stack label input, .stack label select { color: var(--ink); font-size: 15px; }
label.check { flex-direction: row !important; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.pill { color: var(--c); font-weight: 500; white-space: nowrap; }
.pill::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 1px; }
.pill em { font-style: normal; color: var(--muted); font-weight: 400; }

/* Login */
.login { max-width: 360px; margin: 12vh auto 0; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.login h1 { display: flex; align-items: center; gap: 10px; font-size: 22px; margin: 0 0 6px; }
.login summary { color: var(--muted); cursor: pointer; margin-bottom: 10px; }

/* Erfassen */
.entry { display: flex; align-items: center; gap: 10px; padding: 12px; flex-wrap: wrap; }
.entry .desc { flex: 1 1 200px; font-size: 16px; padding: 10px 12px; }
.entry .swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; }
.entry select.role { max-width: 300px; flex: 0 1 300px; }
.bill { display: flex; align-items: center; cursor: pointer; }
.bill input { display: none; }
.bill span { font-size: 12px; font-weight: 700; padding: 8px 8px; border-radius: 8px; color: #b7bdc8; border: 1px solid var(--line); }
.bill input:checked + span { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.times { display: flex; align-items: center; gap: 4px; color: var(--muted); }
input.t { width: 64px; text-align: center; }
.entry input[type=date] { width: 140px; }
.entry .dur { width: 74px; text-align: right; font-weight: 600; font-size: 16px; border-color: transparent; }
.entry .dur:hover { border-color: var(--line); }
.hint { color: var(--muted); font-size: 13px; margin: -4px 4px 22px; }
.empty { padding: 26px; text-align: center; }

.week { margin-top: 22px; }
.week-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 8px; color: var(--muted); }
.week-head h2 { font-size: 16px; color: var(--ink); margin: 0; }
.week-head b { color: var(--ink); font-size: 18px; margin-left: 6px; }
.day { overflow: hidden; }
.day-head { display: flex; justify-content: space-between; background: #eef1f6; padding: 9px 16px; color: var(--muted); font-size: 14px; }
.day-head b { color: var(--ink); margin-left: 6px; }
.row { display: grid; grid-template-columns: 1fr 44px 120px 86px 70px; align-items: center; gap: 8px; padding: 11px 16px; border-top: 1px solid var(--line); }
.row:hover { background: #fafbfd; }
.what { display: flex; gap: 6px 14px; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.what .text { overflow-wrap: anywhere; }
.money { font-size: 11px; font-weight: 700; color: #c4c9d3; text-align: center; }
.money.on { color: var(--accent); }
.span { color: var(--muted); text-align: center; }
.sum { font-weight: 600; text-align: right; font-size: 16px; }
.acts { display: flex; justify-content: flex-end; gap: 2px; opacity: .35; }
.row:hover .acts { opacity: 1; }
button.icon { border: 0; background: none; cursor: pointer; font-size: 16px; padding: 4px 6px; border-radius: 6px; color: var(--muted); }
button.icon:hover { background: var(--bg); color: var(--ink); }
.row.flash-new { animation: pop 1.6s ease-out; }
@keyframes pop { from { background: #e8eeff; } to { background: transparent; } }

dialog { border: 0; border-radius: 14px; padding: 22px; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(20, 30, 60, .25); }
dialog::backdrop { background: rgba(20, 30, 50, .35); }
dialog h3 { margin: 0 0 4px; }
.grid3 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.grid3 input { width: 100%; }
.dialog-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; margin-top: 8px; }

/* Berichte */
.filters { padding: 12px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.range { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.selects { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.selects select { max-width: 220px; }
.totals { display: flex; gap: 34px; align-items: center; padding: 16px 20px; flex-wrap: wrap; }
.totals small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.totals b { font-size: 22px; }
.export { margin-left: auto; display: flex; gap: 8px; }
.chart { padding: 20px 18px 12px; }
.bars { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 6px; height: 220px; align-items: end; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bar.we .l { opacity: .55; }
.bar i { display: block; width: 78%; max-width: 64px; background: linear-gradient(180deg, #6f8ff5, var(--accent)); border-radius: 5px 5px 2px 2px; }
.bar.zero i { height: 2px !important; background: var(--line); }
.bar .v { font-size: 11px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.bar .l { font-size: 11px; color: var(--muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.split { display: grid; grid-template-columns: 1fr 300px; gap: 14px; }
.split .card { margin-bottom: 14px; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); }
td { padding: 10px 16px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
.r { text-align: right; white-space: nowrap; }
tr.g td { background: #f7f8fb; font-weight: 600; }
.donut-card { display: grid; place-items: center; padding: 24px; }
.donut { width: 220px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; }
.donut span { width: 62%; aspect-ratio: 1; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.report-title { margin: 0; padding: 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.scroll { overflow-x: auto; }
.detail td, .detail th { padding: 7px 12px; font-size: 13.5px; }
.detail td:nth-child(2) { min-width: 280px; }

/* Einstellungen */
h2.section { font-size: 17px; margin: 28px 4px 10px; }
.list { padding: 6px 0; }
.list.archived, .line.archived { opacity: .55; }
.line { display: flex; gap: 10px; align-items: center; padding: 8px 14px; flex-wrap: wrap; }
.line + .line { border-top: 1px solid var(--line); }
.line.head { background: #f7f8fb; border-radius: var(--radius) var(--radius) 0 0; margin-top: -6px; }
.line .grow { flex: 1 1 280px; }
.line.add { background: #fbfcfe; }
.role-line { padding-left: 34px; }
.role-line .code { width: 220px; }
.role-line .sp { width: 40px; }
input[type=color] { width: 40px; height: 36px; padding: 2px; }
.rate { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.rate input { width: 90px; text-align: right; }

@media (max-width: 860px) {
  .top { gap: 12px; padding: 0 12px; }
  .who span { display: none; }
  .entry select.role { flex: 1 1 100%; max-width: none; }
  .row { grid-template-columns: 1fr auto 70px; }
  .row .money, .row .span { display: none; }
  .split { grid-template-columns: 1fr; }
  .export { margin-left: 0; }
  .selects { margin-left: 0; }
}
