/* Farben und Schrift gemäss AdaLo-Erscheinungsbild: Navy #16233F, Türkis #2AA9A0, Grau #5A6478, Schrift Poppins/Inter. */
:root {
  --navy: #16233f; --teal: #2aa9a0;
  --bg: #f3f5f8; --card: #ffffff; --soft: #f6f8fb; --text: #1e2940; --heading: #16233f; --muted: #5a6478; --line: #dde2ea;
  --field: #ffffff; --field-line: #c3cad6;
  --primary: #16233f; --primary-hover: #24365c; --on-primary: #ffffff;
  --link: #17807a; --focus: #2aa9a0;
  --second: #e6eaf0; --second-hover: #d7dde6; --on-second: #1e2940;
  --ok: #17764a; --warn: #9a5200; --bad: #b42318; --bad-line: #e3b4ae; --bad-soft: #fdecea;
  --flash-ok-bg: #e2f5f1; --flash-ok-text: #0e4f49; --flash-ok-line: #a9dcd5;
  --flash-err-bg: #fdecea; --flash-err-text: #7a1b12; --flash-err-line: #f1b9b2;
  --badge-bg: #e6eaf0; --badge-text: #33415c;
  --badge-warn-bg: #fff1d6; --badge-warn-text: #7a4a00;
  --badge-info-bg: #d9f1ee; --badge-info-text: #0f5650;
  --badge-ok-bg: #dcf3e4; --badge-ok-text: #14532d;
  --badge-bad-bg: #fde3e0; --badge-bad-text: #7a1b12;
  --header: #16233f; --header-text: #c9d2e3; --header-active: #24365c; --header-line: transparent;
  --hover-row: #eaf6f5; --shadow: 0 8px 24px rgba(16, 24, 40, .16);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1526; --card: #16233f; --soft: #1b2a4a; --text: #e3e8f2; --heading: #ffffff; --muted: #9aa6bd; --line: #2b3b5e;
  --field: #0f1a30; --field-line: #3a4c73;
  --primary: #2aa9a0; --primary-hover: #3bbdb4; --on-primary: #0b1a2a;
  --link: #5fd0c7; --focus: #5fd0c7;
  --second: #263657; --second-hover: #314369; --on-second: #e3e8f2;
  --ok: #5fd39a; --warn: #f0b45a; --bad: #ff8f85; --bad-line: #7a3a35; --bad-soft: #3a1f22;
  --flash-ok-bg: #123a3a; --flash-ok-text: #bfeee8; --flash-ok-line: #1f6b65;
  --flash-err-bg: #3a1f22; --flash-err-text: #ffd0cb; --flash-err-line: #7a3a35;
  --badge-bg: #2b3b5e; --badge-text: #d5dcea;
  --badge-warn-bg: #4a3a16; --badge-warn-text: #f6d594;
  --badge-info-bg: #154744; --badge-info-text: #a9ece5;
  --badge-ok-bg: #17442c; --badge-ok-text: #a8ecc4;
  --badge-bad-bg: #4a2224; --badge-bad-text: #ffc4be;
  --header: #0a1120; --header-text: #b9c4d9; --header-active: #1b2a4a; --header-line: #2b3b5e;
  --hover-row: #1f3152; --shadow: 0 8px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 Poppins, Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { background: var(--header); color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; padding: 8px 20px; border-bottom: 1px solid var(--header-line); }
header.top .brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; margin-right: 10px; color: #fff; letter-spacing: .01em; }
header.top .brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; flex: none; }
header.top nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
header.top nav a { color: var(--header-text); padding: 6px 10px; border-radius: 6px; border-bottom: 2px solid transparent; }
header.top nav a:hover { background: var(--header-active); color: #fff; text-decoration: none; }
header.top nav a.active { background: var(--header-active); color: #fff; border-bottom-color: var(--teal); border-radius: 6px 6px 2px 2px; }
header.top #menu-toggle { display: none; background: none; border: 1px solid #4b5b7c; color: var(--header-text); padding: 5px 12px; margin-left: auto; }
@media (max-width: 760px) {
  header.top { padding: 8px 14px; }
  header.top #menu-toggle { display: inline-block; }
  header.top nav, header.top .me { flex-basis: 100%; }
  header.top:not(.open) nav, header.top:not(.open) .me { display: none; }
  header.top.open nav { display: flex; flex-direction: column; gap: 0; margin-top: 6px; }
  header.top.open nav a { padding: 11px 10px; font-size: 16px; }
  header.top.open .me { display: flex; flex-wrap: wrap; padding: 10px 0 4px; border-top: 1px solid var(--header-line); margin-top: 6px; }
  header.top.open .me button { padding: 6px 12px; }
  main { padding-left: 12px; padding-right: 12px; }
}
code { overflow-wrap: anywhere; }
header.top .me { display: flex; align-items: center; gap: 10px; font-size: 14px; }
header.top .me a { color: var(--header-text); }
header.top .me button { background: none; border: 1px solid #4b5b7c; color: var(--header-text); padding: 3px 10px; }
header.top .me button:hover { background: var(--header-active); color: #fff; }
#theme-toggle { min-width: 34px; font-size: 15px; line-height: 1.4; }
#theme-toggle .dark-only, :root[data-theme="dark"] #theme-toggle .light-only { display: none; }
:root[data-theme="dark"] #theme-toggle .dark-only { display: inline; }
main { max-width: 1200px; margin: 0 auto; padding: 20px; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 14px; color: var(--heading); }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 10px; color: var(--heading); }
h3 { font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.head h1, .head h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.right, th.right { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); }
form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=month], input[type=search], input[type=url], input[type=file], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--field-line); border-radius: 6px; background: var(--field); color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:disabled, select:disabled, textarea:disabled { background: var(--soft); color: var(--muted); }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type=checkbox] { accent-color: var(--teal); width: 16px; height: 16px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; align-items: end; }
.grid .wide { grid-column: span 2; }
.grid .full { grid-column: 1 / -1; }
.tf-main { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; margin-bottom: 12px; }
.tf-times { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: stretch; margin-bottom: 12px; }
.tf-group { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 10px 14px; flex: 1 1 330px; margin: 0; padding: 8px 12px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); min-width: 0; }
.tf-group legend { padding: 0 6px; font-size: 12.5px; font-weight: 600; color: var(--heading); }
.tf-submit { display: flex; align-items: flex-end; padding-bottom: 12px; }
@media (max-width: 720px) { .tf-main { grid-template-columns: 1fr; } .tf-group { grid-template-columns: 1fr 1fr; flex-basis: 100%; } .tf-group > div { min-width: 0; } }
table.ml td { vertical-align: top; }
table.ml input.num { width: 86px; text-align: right; }
table.ml input:invalid { border-color: var(--bad); }
.hm { display: flex; align-items: center; gap: 6px; }
.hm select { flex: 1; min-width: 0; }
.hm span { color: var(--muted); font-weight: 600; }
dialog.popup { background: var(--card); color: var(--text); border: 1px solid var(--bad-line); border-top: 4px solid var(--bad); border-radius: 10px; padding: 20px 22px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
dialog.popup::backdrop { background: rgba(13, 21, 38, .55); }
dialog.popup h2 { color: var(--bad); }
dialog.popup.warn { border-color: var(--line); border-top-color: var(--warn); }
dialog.popup.warn h2 { color: var(--warn); }
dialog.popup p { margin: 0 0 16px; line-height: 1.5; }
dialog.popup form { text-align: right; }
@media (max-width: 520px) { .grid .wide { grid-column: 1 / -1; } }
/* Formularzeile, die umbricht statt überzulaufen: Felder teilen sich den Platz, die Schaltfläche behält ihre Breite. */
.row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.row > div { flex: 1 1 130px; min-width: 0; }
.row > .fix { flex: 0 0 auto; }
details.group > .gbody { padding: 10px 14px 14px; background: var(--card); border-radius: 0 0 8px 8px; }
/* Benutzerliste: eine Zeile pro Benutzer, ein Klick klappt die Einstellungen auf */
details.urow { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 8px; background: var(--card); }
details.urow > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0; padding: 10px 12px; list-style: none; color: var(--heading); background: var(--soft); border-radius: 8px; cursor: pointer; }
details.urow > summary::-webkit-details-marker { display: none; }
details.urow > summary::before { content: '▸'; color: var(--muted); width: 1em; }
details.urow[open] > summary::before { content: '▾'; }
details.urow[open] > summary { border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
details.urow > summary:hover { background: var(--hover-row); }
.urow-name { font-weight: 600; }
.urow-meta { margin-left: auto; color: var(--muted); font-size: 13px; }
.urow-body { padding: 4px 14px 14px; }
details.urow[hidden] { display: none; }
/* Benutzerformular: Abschnitte, auszufüllende Felder (fett, roter Stern) und automatisch gerechnete Felder (grau, gestrichelt) */
fieldset.ufs { border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px 14px; margin: 14px 0 0; min-width: 0; }
fieldset.ufs > legend { padding: 0 6px; font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.req > label, .req-mark { color: var(--heading); font-weight: 600; }
.req > label::after, .req-mark::after { content: ' *'; color: var(--bad); }
.auto > label { font-style: italic; }
.auto input, .auto-mark { background: var(--soft); border: 1px dashed var(--field-line, var(--line)); color: var(--muted); }
.auto input { font-weight: 600; cursor: default; }
.auto input:focus { outline: none; border-color: var(--field-line, var(--line)); }
.auto-mark { padding: 0 6px; border-radius: 4px; }
.legend { margin: 0 0 12px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text); margin: 0; }
.check input { width: 16px; }
button, .btn { display: inline-block; background: var(--primary); color: var(--on-primary); border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; white-space: nowrap; font-weight: 500; }
button:hover, .btn:hover { background: var(--primary-hover); text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary, .btn.secondary { background: var(--second); color: var(--on-second); }
button.secondary:hover, .btn.secondary:hover { background: var(--second-hover); }
button.danger, .btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad-line); }
button.danger:hover, .btn.danger:hover { background: var(--bad-soft); }
button.destroy { background: var(--bad); color: #fff; }
:root[data-theme="dark"] button.destroy { color: #2a0d0b; }
button.destroy:hover { filter: brightness(.92); background: var(--bad); }
button.link { background: none; color: var(--bad); padding: 0; font-weight: 400; }
button.link:hover { background: none; text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: var(--flash-ok-bg); color: var(--flash-ok-text); border: 1px solid var(--flash-ok-line); }
.flash.err { background: var(--flash-err-bg); color: var(--flash-err-text); border: 1px solid var(--flash-err-line); }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; background: var(--badge-bg); color: var(--badge-text); white-space: nowrap; }
.badge.entwurf, .badge.offen { background: var(--badge-warn-bg); color: var(--badge-warn-text); }
.badge.freigegeben, .badge.in-Arbeit { background: var(--badge-info-bg); color: var(--badge-info-text); }
.badge.angenommen, .badge.bezahlt, .badge.abgeschlossen { background: var(--badge-ok-bg); color: var(--badge-ok-text); }
.badge.abgelehnt, .badge.entfernt, .badge.ueberfaellig { background: var(--badge-bad-bg); color: var(--badge-bad-text); }
.over { color: var(--bad); font-weight: 600; }
.under { color: var(--ok); }
.bar { height: 8px; background: var(--second); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--teal); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--soft); border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: 8px; padding: 10px 12px; }
.kpi b { display: block; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--heading); }
.kpi b.over { color: var(--bad); }
.kpi b.under { color: var(--ok); }
.kpi span { font-size: 12.5px; color: var(--muted); }
details { margin-top: 10px; }
details > summary { cursor: pointer; color: var(--link); margin-bottom: 10px; }
details.group { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; }
details.group > summary { margin: 0; padding: 10px 12px; color: var(--heading); font-weight: 600; background: var(--soft); border-radius: 8px; }
details.group[open] > summary { border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
details.group > summary span { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 8px; }
details.group > .tablewrap { padding: 0 4px; }
.picker { position: relative; }
.picker-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 2px; background: var(--card); border: 1px solid var(--field-line); border-radius: 6px; box-shadow: var(--shadow); max-height: 320px; overflow-y: auto; }
.picker-list button { display: block; width: 100%; text-align: left; background: var(--card); color: var(--text); border-radius: 0; padding: 7px 10px; white-space: normal; border-bottom: 1px solid var(--line); font-weight: 400; }
.picker-list button:last-child { border-bottom: 0; }
.picker-list button:hover, .picker-list button:focus { background: var(--hover-row); outline: none; }
.picker-list small { display: block; color: var(--muted); font-size: 12.5px; }
.picker-none { padding: 9px 10px; color: var(--muted); font-size: 14px; }
.sub { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: -6px 0 16px; font-size: 14px; }
.login { max-width: 380px; margin: 9vh auto; }
.login .card > * + * { margin-top: 12px; }
.login .qr { text-align: center; }
.login .qr svg { border-radius: 8px; border: 1px solid var(--line); max-width: 100%; height: auto; }
.login .steps { margin: 0 0 0 18px; padding: 0; }
.login .steps li + li { margin-top: 4px; }
.login code.secret { font-size: 14px; letter-spacing: .08em; user-select: all; }
.login .brandmark { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login .brandmark .logo { width: 44px; height: 44px; }
.login .brandmark h1 { margin: 0; }
.login .brandmark small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }
.logo .bus { stroke: var(--heading); }
header.top .logo .bus { stroke: #fff; }
table.items input, table.items select { padding: 5px 6px; }
table.items td { padding: 4px 4px; border-bottom: 0; }
table.items .num { width: 100px; }
table.items .unit { width: 80px; }
table.items .type { width: 115px; }
.sums { margin-left: auto; width: min(100%, 380px); }
.sums td { padding: 4px 8px; border: 0; }
.sums td.right { white-space: nowrap; } /* Betrag und Einheit («114 h») bleiben in einer Zeile, auch wenn die Beschriftung links lang ist */
.sums tr.total td { font-weight: 600; border-top: 2px solid var(--line); color: var(--heading); }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; white-space: pre-line; }

/* Optionspositionen in Offerten: hellblau, zählen nicht zum Total */
:root { --option: #e3f1fa; --option-text: #1e2940; }
:root[data-theme="dark"] { --option: #1d3b5c; --option-text: #e3e8f2; }
tr.option td { background: var(--option); color: var(--option-text); }
tr.option td input, tr.option td select { background: var(--card); }
table.items .opt { width: 60px; text-align: center; }
table.items .optbox { width: 18px; height: 18px; }
.sums tr.optrow td { background: var(--option); color: var(--option-text); }
