:root {
  /* Unternehmensfarben */
  --brand: #003B2B;        /* Primär / Marke (Tannengrün) */
  --brand-ink: #ffffff;    /* Text auf Marke */
  --accent: #F2C94C;       /* Sekundär / Akzent (Gold) */
  --accent-ink: #003B2B;   /* Text auf Akzent */
  --bg: #E6ECE9;           /* Seitenhintergrund (helle Fläche) */
  --card: #F9FAF8;         /* Karten / Flächen */

  --ink: #17241E;          /* Text (dunkles Grün-Grau) */
  --muted: #5f6b64;        /* Sekundärtext */
  --line: #d3ddd7;         /* Rahmen / Trennlinien */

  /* Signalfarben für Finanzzahlen – bewusst vom Marken-Grün abgesetzt */
  --ok: #1e7e34;           /* positiv / Guthaben */
  --err: #c0392b;          /* negativ / überzogen */
  --warn: #9a7d1e;         /* Hinweis (dunkles Gold, texttauglich) */
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
header {
  background: var(--brand);
  color: var(--brand-ink);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--accent);
}
header h1 { font-size: 18px; margin: 0; line-height: 1.1; }
header .sub { font-weight: 400; opacity: .8; font-size: 12px; display: block; }
.brand-logo {
  background: #fff; border-radius: 8px; padding: 6px 10px;
  display: inline-flex; align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.brand-logo img { height: 34px; display: block; }
.app-title { display: flex; flex-direction: column; }
nav { display: flex; gap: 6px; }
nav button {
  background: rgba(255,255,255,.12);
  color: #fff; border: 0; padding: 8px 14px;
  border-radius: 6px; cursor: pointer; font-size: 14px;
}
nav button.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* Admin-Auth */
.auth { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.auth-badge { color: var(--accent); font-weight: 600; font-size: 13px; }
.auth-btn {
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
/* nur-Icon-Buttons (Passwort ändern, Logout) – kompakt, quadratisch */
.auth-btn.icon-btn {
  padding: 6px; width: 34px; line-height: 1; font-size: 16px; text-align: center;
}
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,25,20,.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: var(--card); border-radius: 12px; padding: 22px 24px;
  width: 320px; max-width: 92vw; box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.modal h3 { margin: 0 0 4px; color: var(--brand); }
.modal label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-top: 12px; }
.modal input { padding: 8px 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.login-err { color: var(--err); font-size: 13px; margin-top: 10px; min-height: 16px; }
main { padding: 20px; max-width: 1200px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
h2 { font-size: 16px; margin: 18px 0 10px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 16px; margin-bottom: 14px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
label { font-size: 13px; }
label.checkbox { display: inline-flex; align-items: center; gap: 6px; }
select, input[type=text], input[type=number], input[type=date] {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; background: #fff;
}
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
button, .btn {
  background: var(--brand); color: #fff; border: 0; padding: 8px 14px;
  border-radius: 6px; cursor: pointer; font-size: 13px; text-decoration: none;
  display: inline-block;
}
button.secondary { background: #dbe4de; color: var(--ink); }
button.ghost { background: transparent; color: var(--brand); padding: 4px 8px; }
button.warnbtn { background: #f3e0e0; color: var(--err); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.small, .btn.small { padding: 4px 10px; font-size: 12px; }
/* Status-Badges (z. B. Urlaubsanträge) */
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: #e6ece9; color: var(--muted); white-space: nowrap;
}
.badge.ok { background: #d4edda; color: var(--ok); }
.badge.warn { background: #fbeecb; color: var(--warn); }
.badge.err { background: #f3dede; color: var(--err); }
.muted { color: var(--muted); }
.result { width: 100%; margin-top: 8px; }
.result .ok { color: var(--ok); }
.result .err { color: var(--err); }

.review-summary { margin-bottom: 12px; }
.rsum {
  background: #edf2ef; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font-size: 13px;
}
.rsum b { font-variant-numeric: tabular-nums; }

.tx {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; margin-bottom: 12px; overflow: hidden;
}
table.splits tr.match td { background: #fdf3d3; }
.tx.bestaetigt { opacity: .75; }
.tx-head {
  display: flex; gap: 14px; align-items: baseline;
  padding: 10px 14px; background: #f1f5f2; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tx-head .amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.tx-head .amount.ein { color: var(--ok); }
.tx-head .amount.aus { color: var(--err); }
.tx-head .datum { color: var(--muted); }
.tx-head .zweck { flex: 1; color: var(--ink); }
.tx-head .badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #e6ece9;
  color: var(--muted);
}
.tx-head .badge.offen { background: #fbeecb; color: var(--warn); }
.tx-head .badge.bestaetigt { background: #d4edda; color: var(--ok); }
.tx-head { cursor: pointer; }
.tx-head .caret { color: var(--muted); transition: transform .15s; font-size: 11px; }
.tx.open .tx-head .caret { transform: rotate(90deg); display: inline-block; }
.tx-body { padding: 12px 14px; display: none; }
.tx.open .tx-body { display: block; }

/* Übersicht: Kacheln */
.tiles { display: grid; gap: 12px; margin-bottom: 12px; }
.tiles.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.cols4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles.cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles.colsauto { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 720px) {
  .tiles.cols3, .tiles.cols4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
  .tiles.cols2, .tiles.cols3, .tiles.cols4 { grid-template-columns: 1fr; }
}
.tile {
  min-width: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
}
.tile.brandtile { border-left: 4px solid var(--brand); }
.tile.small-tile { flex: 1 1 130px; min-width: 120px; }
.tile-val { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile.small-tile .tile-val { font-size: 16px; }
.tile-val.neg { color: var(--err); }
.tile-lbl { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Prüfhinweise */
.check-ok { color: var(--ok); font-weight: 600; padding: 8px 0; }
.check {
  display: flex; gap: 10px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--card);
  font-size: 13px;
}
.check-badge {
  font-size: 10px; text-transform: uppercase; font-weight: 700; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 20px;
}
.check-badge.hoch { background: #f3e0e0; color: var(--err); }
.check-badge.mittel { background: #fbeecb; color: var(--warn); }
.check-badge.info { background: #e6ece9; color: var(--muted); }
.check-text { flex: 1; }

/* Scroll-Container: max. ~5 Zeilen sichtbar, dann scrollen (Kopfzeile bleibt) */
.scroll5 {
  max-height: 210px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px;
}
.scroll5 table.grid { border: 0; border-radius: 0; }
.scroll5 table.grid th { position: sticky; top: 0; z-index: 1; }

/* Timesheet-Kalender */
.scroll-cal { max-height: 62vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.scroll-cal table.grid { border: 0; border-radius: 0; }
table.ts-cal { table-layout: fixed; }
table.ts-cal th { text-align: left; }                          /* Header linksbündig */
table.ts-cal td { text-align: left; vertical-align: top; font-size: 12.5px; padding: 4px 6px; }
table.ts-cal td.ts-tag { white-space: nowrap; font-weight: 600; }
table.ts-cal .ts-desc { width: 100%; }
table.ts-cal .ts-time { width: 100%; }
table.ts-cal .ts-hrs { width: 100%; text-align: right; }
table.ts-cal .ts-hrs[readonly] { background: #f2f2f2; color: #555; border-color: #e0e0e0; cursor: default; }
table.ts-cal .ts-pause { width: 100%; text-align: right; }
tr.we td { background: #eef1ef; color: var(--muted); }        /* Wochenende ausgegraut */
tr.vac-halb td { background: #fdf6e3; }                        /* halber Urlaubstag */
tr.vac-ganz td { background: #fbe6c8; }                        /* ganzer Urlaubstag */
.vac-note { font-size: 11px; font-weight: 600; color: #b5820a; margin: 2px 0; }  /* Urlaubshinweis in Tag-Zelle */
/* Bonus / Vergütung */
.bonus-model, .bonus-emp { margin-bottom: 14px; }
.bonus-emp h4 { margin: 0 0 8px; }
.bonus-tiers { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.bonus-tier-row { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
/* Stammdaten: klebende Speichern-Leiste */
.stamm-bar {
  position: sticky; top: 0; z-index: 20; background: var(--card);
  border-bottom: 1px solid var(--line); padding: 8px 4px; margin: -4px 0 10px;
  align-items: center;
}
.stamm-bar #stamm-status.warn { font-weight: 600; }
/* Tages-Auswahl im Urlaubsantrag */
table.urlaub-days { max-width: 460px; }
table.urlaub-days td, table.urlaub-days th { text-align: left; }
table.urlaub-days tr.vac-weekend td { background: #eef1ef; color: var(--muted); }
table.urlaub-days tr.vac-holiday td { background: #f3e8d0; color: #8a6d1f; }
.rate-box { display: flex; flex-wrap: wrap; gap: 10px; }
.rate-lbl { font-size: 12px; white-space: nowrap; }
.rate-inp { width: 72px; text-align: right; }

/* Diagramm */
.chart { width: 100%; height: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }

/* Personen-Export-Links in der Rücklagen-Tabelle */
.person-exports { display: inline-flex; gap: 6px; }
.person-exports a { font-size: 11px; padding: 2px 8px; }
.reserve-grid td.dl-cell, .reserve-grid th:first-child { text-align: left; white-space: nowrap; }
.reserve-grid td:nth-child(2), .reserve-grid th:nth-child(2) { text-align: left; }

/* Regel-Vorschau */
.rule-preview { font-size: 12px; margin-top: 8px; color: var(--muted); }
.rule-preview .hit { color: var(--brand); font-weight: 600; }
table.splits { width: 100%; border-collapse: collapse; }
table.splits th, table.splits td { padding: 5px 6px; text-align: left; font-size: 12.5px; }
table.splits th { color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
table.splits td select, table.splits td input { width: 100%; font-size: 12.5px; }
table.splits td.num input { text-align: right; }
.participants { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.participants label { display: inline-flex; gap: 3px; align-items: center; }
.split-actions { margin-top: 10px; display: flex; gap: 8px; align-items: center; }
.sum-info { font-variant-numeric: tabular-nums; }
.sum-info.bad { color: var(--err); font-weight: 700; }
.sum-info.good { color: var(--ok); }

table.grid { width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; }
table.grid th, table.grid td { padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--line); }
/* Kopfzeile bleibt beim Scrollen fest (Seite oder Scroll-Container) */
table.grid th { background: var(--brand); color: #fff; text-align: left;
  position: sticky; top: 0; z-index: 2; }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid td { text-align: left; font-variant-numeric: tabular-nums; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.total td { font-weight: 700; background: #e6ece9; }
.neg { color: var(--err); }
.pos { color: var(--ok); }
.warn { color: var(--warn); }
td.warn { color: var(--warn); }
td.strong, th.strong { font-weight: 700; }
.card.wrap { flex-wrap: wrap; align-items: flex-end; }
.card.wrap label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; }
table.grid.rules td { text-align: left; }
table.grid.rules input, table.grid.rules select { width: 100%; }
table.grid th.sep, table.grid td.sep { border-left: 2px solid #b9c6bf; }
td.saldo { font-weight: 700; font-size: 13.5px; }

/* Erklär-Box */
details.explain {
  background: #edf2ef; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 14px;
}
details.explain summary { cursor: pointer; font-weight: 600; color: var(--brand); }
details.explain ul { margin: 10px 0 6px; padding-left: 18px; }
details.explain li { margin-bottom: 5px; }
details.explain .small { font-size: 12px; margin: 6px 0 0; }

/* Interpretations-Karten */
.interpret { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0 4px; }
.icard {
  flex: 1 1 200px; min-width: 190px; background: var(--card);
  border: 1px solid var(--line); border-left: 4px solid var(--ok);
  border-radius: 8px; padding: 12px 14px;
}
.icard.neg { border-left-color: var(--err); }
.icard .iname { font-weight: 600; margin-bottom: 2px; }
.icard .ival { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.icard .ival.neg { color: var(--err); }
.icard .ival.pos { color: var(--ok); }
.icard .idesc { font-size: 12px; color: var(--muted); margin-top: 3px; }

#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: var(--brand-ink); padding: 10px 18px; border-radius: 8px;
  opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 50;
}
#toast.show { opacity: 1; }
#toast.err { background: var(--err); }
