[hidden] { display: none !important; }
:root {
  --navy: #1F3A5F; --navy-2: #2C5282; --ink: #18212d; --muted: #5d6877; --line: #dde2e9;
  --bg: #f4f6f9; --card: #ffffff; --soft: #eef2f7; --best: #d5f0dc; --best-ink: #1d6b3a;
  --warn: #fff4d6; --warn-ink: #7a5600; --bad: #fde3e3; --bad-ink: #9b2222; --focus: #3b82f6;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --navy: #8fb4e6; --navy-2: #a9c6ee; --ink: #e6ebf2; --muted: #9aa6b6; --line: #2c3644;
    --bg: #11161d; --card: #18202a; --soft: #1f2935; --best: #183d27; --best-ink: #8fe0ad;
    --warn: #3a3014; --warn-ink: #f2d27a; --bad: #3d1d1d; --bad-ink: #f5a3a3;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-2); }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; }
.ver { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 1px 8px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.seg button.on { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button.on { color: #10161e; } }

main { max-width: 1400px; margin: 0 auto; padding: 22px 20px 60px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.btn, button.primary, button.ghost, button.danger { border-radius: 8px; padding: 7px 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); display: inline-flex; gap: 6px; align-items: center; }
button.primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { button.primary { color: #0f151c; } }
button.ghost:hover, .btn:hover { background: var(--soft); }
button.danger { color: var(--bad-ink); }
button.danger:hover { background: var(--bad); }
button.small { padding: 4px 9px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

input, select, textarea { border: 1px solid var(--line); border-radius: 7px; background: var(--card); padding: 6px 9px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
label.f > span { font-weight: 600; }
.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
@media (max-width: 900px) { .g4, .g6 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px) { .g2, .g4, .g6 { grid-template-columns: 1fr; } }

/* Liste */
.list { display: grid; gap: 10px; }
.rfq { display: grid; grid-template-columns: 1fr auto; gap: 8px; cursor: pointer; transition: border-color .15s; }
.rfq:hover { border-color: var(--navy-2); }
.rfq .t { font-weight: 600; font-size: 15px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 11px; background: var(--soft); border-radius: 20px; padding: 2px 9px; color: var(--muted); }
.chip.ok { background: var(--best); color: var(--best-ink); }
.chip.warn { background: var(--warn); color: var(--warn-ink); }
.chip.bad { background: var(--bad); color: var(--bad-ink); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 16px 0 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--navy); font-weight: 600; }
.tabs .n { font-size: 11px; background: var(--soft); border-radius: 10px; padding: 0 6px; margin-left: 4px; }

/* Ranking */
.rank-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 16px; }
.rk { position: relative; }
.rk .pos { position: absolute; top: 12px; right: 14px; font-size: 22px; font-weight: 700; color: var(--line); }
.rk.first { border-color: var(--best-ink); background: linear-gradient(180deg, var(--best), var(--card) 70%); }
.rk.first .pos { color: var(--best-ink); }
.rk .name { font-weight: 600; padding-right: 30px; }
.rk .tco { font-size: 20px; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.rk .dev { font-size: 12px; color: var(--muted); }
.bar { height: 5px; border-radius: 3px; background: var(--soft); margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--navy-2); }
.rk.first .bar > i { background: var(--best-ink); }

/* Tabellen */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.t { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.t th, table.t td { padding: 6px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t thead th { background: var(--soft); font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; }
table.t th.bh { text-align: center; color: var(--ink); border-left: 1px solid var(--line); }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; }
table.t td.bl, table.t th.bl { border-left: 1px solid var(--line); }
table.t td.best { background: var(--best); color: var(--best-ink); font-weight: 600; }
table.t td.na { color: var(--muted); text-align: center; font-style: italic; }
table.t tr.sum td { background: var(--soft); }
table.t tr.sum.strong td { font-weight: 700; }
table.t tr.sum.first td { border-top: 2px solid var(--navy); }
table.t td.desc { min-width: 220px; }
table.t input, table.t select { padding: 4px 6px; font-size: 13px; }
table.t td.inp { padding: 3px 4px; }
.dev-pct { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; }
td.best .dev-pct { color: var(--best-ink); }
tr.low td { background: var(--warn); }
tr.skip td { opacity: .45; }
.conf { font-size: 10.5px; border-radius: 10px; padding: 1px 7px; white-space: nowrap; }
.conf.hi { background: var(--best); color: var(--best-ink); }
.conf.mid { background: var(--warn); color: var(--warn-ink); }
.conf.lo { background: var(--bad); color: var(--bad-ink); }

.notice { border-radius: 8px; padding: 9px 12px; margin: 0 0 12px; font-size: 13px; }
.notice.warn { background: var(--warn); color: var(--warn-ink); }
.notice.info { background: var(--soft); }
.notice.bad { background: var(--bad); color: var(--bad-ink); }

/* Upload */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; cursor: pointer;
  background: var(--card); transition: .15s; }
.drop:hover, .drop.over { border-color: var(--navy-2); background: var(--soft); }
.drop b { display: block; font-size: 15px; margin-bottom: 4px; }
.spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--navy); border-radius: 50%;
  display: inline-block; animation: sp 0.8s linear infinite; vertical-align: middle; }
@keyframes sp { to { transform: rotate(360deg); } }

/* Bieterliste */
.bidders { display: grid; gap: 10px; }
.bidder { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.bidder.excl { opacity: .55; }
.bidder .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(10,16,26,.5); z-index: 50; display: flex; align-items: flex-start;
  justify-content: center; padding: 30px 14px; overflow-y: auto; }
.modal-box { background: var(--card); border-radius: 12px; width: min(1180px, 100%); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-box.narrow { width: min(560px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
details.raw summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 10px; }
details.raw pre { max-height: 260px; overflow: auto; background: var(--soft); padding: 10px; border-radius: 8px; font-size: 11px; white-space: pre-wrap; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 9px 16px; border-radius: 8px; z-index: 60; font-size: 13px; }
.login { max-width: 360px; margin: 10vh auto; }
.section-gap { margin-top: 20px; }
@media print { .top, .tabs, .no-print { display: none !important; } main { padding: 0; } }

/* LV-Struktur (v1.1) */
table.t tr.grp td { background: var(--soft); font-weight: 600; }
table.t tr.grp.l1 td { background: color-mix(in srgb, var(--navy) 14%, var(--card)); font-size: 13.5px; }
table.t tr.grp.l2 td { background: color-mix(in srgb, var(--navy) 7%, var(--card)); }
table.t tr.grp td.best { background: var(--best); color: var(--best-ink); }
table.t tr.nototal td { color: var(--muted); font-style: italic; }
.kind { display: inline-block; font-size: 10px; font-style: normal; border-radius: 10px; padding: 0 6px; margin-left: 4px;
  background: var(--soft); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.kind.k-bedarf, .kind.k-alternativ { background: var(--warn); color: var(--warn-ink); border-color: transparent; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { padding: 10px 12px; }
.stat .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11.5px; color: var(--muted); }

/* Mehrere Dokumente je Angebot (v1.2) */
.notice.ok { background: var(--best); color: var(--best-ink); }
.docs { padding: 12px 14px; margin-bottom: 12px; }
.docrow { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(170px, 230px) auto auto; gap: 10px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--line); }
.docrow .dn b { word-break: break-all; font-weight: 600; }
.docrow select.role { width: 100%; }
.dt { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; border-radius: 5px; padding: 2px 7px;
  background: var(--soft); color: var(--muted); white-space: nowrap; }
.dt.t-pdf { background: #fde3e3; color: #9b2222; }
.dt.t-gaeb { background: #e3ecfb; color: #234f9b; }
.dt.t-excel { background: #dff3e5; color: #1d6b3a; }
@media (prefers-color-scheme: dark) {
  .dt.t-pdf { background: #3d1d1d; color: #f5a3a3; } .dt.t-gaeb { background: #1c2a44; color: #a9c6ee; } .dt.t-excel { background: #183d27; color: #8fe0ad; }
}
.mapping { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; align-items: end;
  background: var(--soft); border-radius: 8px; padding: 10px; }
.mapping select, .mapping input { padding: 4px 6px; font-size: 12px; }
.doclinks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.doclinks a { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doclinks a:hover { background: var(--soft); }
.choice { grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .choice { grid-template-columns: 1fr; } .docrow { grid-template-columns: auto 1fr; } .docrow select.role { grid-column: 1 / -1; } }
.pick { display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer; padding: 16px; }
.pick:hover { border-color: var(--navy-2); background: var(--soft); }
td.assign { min-width: 170px; white-space: nowrap; }
td.assign select { width: auto; }
td.assign input { width: 110px; margin-left: 4px; }

/* Revisionen (v1.3) */
.chip.rev { background: #e3ecfb; color: #234f9b; font-weight: 600; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .chip.rev { background: #1c2a44; color: #a9c6ee; } }
.revbox { margin-bottom: 12px; padding: 12px 14px; border-left: 4px solid var(--line); }
.revbox.strong { border-left-color: var(--navy-2); }
.revbox.muted-box { padding: 8px 12px; }
.rvopt { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.rvopt input[type=radio] { width: auto; margin-top: 4px; }
.revhist { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.down { color: var(--best-ink); font-weight: 600; }
.up { color: var(--bad-ink); font-weight: 600; }
table.t td.chg, table.t tr.chg td { background: var(--warn); color: var(--warn-ink); }
.modal-foot .spacer { flex: 1; }

/* Kostenblock-Modus (v1.4) */
.chips-b { white-space: normal; min-width: 260px; }
.bchip { font-size: 10.5px; border: 1px solid var(--line); background: var(--card); border-radius: 5px; padding: 1px 5px; margin: 1px; cursor: pointer; color: var(--muted); }
.bchip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .bchip.on { color: #10161e; } }
table.cl tr.lt-scope td { background: color-mix(in srgb, var(--best) 35%, var(--card)); }
table.cl tr.lt-excluded td { background: color-mix(in srgb, var(--bad) 45%, var(--card)); }
table.cl tr.lt-option td, table.cl tr.lt-effort td, table.cl tr.lt-budget td { background: color-mix(in srgb, var(--warn) 55%, var(--card)); }
table.bmatrix td.bcell { cursor: pointer; min-width: 150px; }
table.bmatrix td.bcell:hover { outline: 2px solid var(--focus); outline-offset: -2px; }
td.bcell .stl { display: block; font-size: 11.5px; font-weight: 600; }
td.bcell .amt { display: block; font-variant-numeric: tabular-nums; }
td.bcell .adjv { display: block; font-size: 11px; color: var(--bad-ink); }
td.bcell.st-priced .stl, td.bcell.st-included .stl { color: var(--best-ink); }
td.bcell.st-bundle .stl { color: var(--muted); }
td.bcell.st-budget, td.bcell.st-option, td.bcell.st-effort, td.bcell.st-unclear { background: var(--warn); }
td.bcell.st-excluded { background: var(--bad); }
td.bcell.st-excluded .stl { color: var(--bad-ink); }
td.pre { white-space: pre-line; }
.qlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.qlist li { font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.qlist li.off { opacity: .45; text-decoration: line-through; }
.qlist label { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
.qadd { margin-top: 8px; }
.gqrow { margin-bottom: 4px; }
.clist { margin: 4px 0; padding-left: 18px; }
.stat .f input { margin-top: 2px; font-size: 16px; font-weight: 700; }

/* v1.5 Aufmaß / Regie */
details.epblk { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 8px 0; }
details.epblk summary, details.card > summary { cursor: pointer; }
details.epblk[open] summary { margin-bottom: 6px; }
table.ep td.inp input, table.rg td.inp input, table.ep td.inp select, table.rg td.inp select { min-width: 0; }
label.chk { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 14px; }
.eptag { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 2px; }
.eptag.win { color: var(--best-ink); font-weight: 600; }
.eptag.none { font-style: italic; }
.ital { font-style: italic; }
tr.grp td { background: var(--soft); }
label.chk input { width: auto; margin: 0; flex: none; }
label.chk { justify-content: flex-start; text-align: left; }
tr.warnrow td { background: var(--warn); }
tr.dim td { opacity: .6; }
table.rp td { vertical-align: top; }
.qr { display: flex; justify-content: center; margin: 10px 0; } .qr svg { width: 220px; height: 220px; background: #fff; border-radius: 8px; }
.docl { display: inline-flex; align-items: center; gap: 2px; }
.docdel { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 5px; border-radius: 6px; font-size: 12px; line-height: 1; }
.docdel:hover { color: var(--bad, #b42318); background: var(--soft); }
