/* ATTA-BAU – ruhige, gut lesbare Arbeitsoberfläche. Keine externen Schriften (schnell auch im Mobilfunk). */
:root {
  --bg: #F4F5F2;
  --surface: #FFFFFF;
  --surface-2: #EEF1EC;
  --ink: #1C2320;
  --ink-2: #4A5550;
  --muted: #6B7570;
  --line: #DDE2DC;
  --line-strong: #C6CEC7;
  --brand: #1F4A3A;
  --brand-2: #2E6650;
  --brand-tint: #E5EEE8;
  --sand: #A86C12;
  --sand-tint: #FBF1DE;
  --danger: #A3362A;
  --danger-tint: #FBEAE7;
  --ok: #2E6650;
  --info-tint: #E8EEF6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 1px 1px rgba(20, 30, 25, .04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --tap: 44px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131816; --surface: #1B211E; --surface-2: #222A26; --ink: #E6ECE8; --ink-2: #BCC7C1; --muted: #8E9993;
    --line: #2C3531; --line-strong: #3A4540; --brand: #7FBF9F; --brand-2: #9BD3B6; --brand-tint: #213229;
    --sand: #E0A84E; --sand-tint: #33291A; --danger: #F08A7C; --danger-tint: #3A211D; --info-tint: #1E2733;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -.01em; }
h1 small { font-size: .9rem; color: var(--muted); font-weight: 500; }
h2 { font-size: 1.02rem; margin: 0 0 .75rem; letter-spacing: -.005em; }
h3.sub { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.25rem 0 .5rem; }
code, .mono { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .block { display: block; } .nowrap { white-space: nowrap; }
.danger { color: var(--danger); } .strong { font-weight: 700; }
.warn-text { color: var(--sand); display: block; font-size: .85rem; }
.empty { color: var(--muted); font-style: italic; padding: .5rem 0; margin: 0; }

/* Kopfzeile */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .55rem 1.25rem;
  background: var(--brand); color: #fff; }
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; font-weight: 700; letter-spacing: .04em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: #fff;
  color: #1F4A3A; font-weight: 800; font-size: .8rem; letter-spacing: 0; }
.topsearch { flex: 1; max-width: 520px; }
.topsearch input { width: 100%; height: 38px; border-radius: 8px; border: 0; padding: 0 .85rem; font: inherit;
  background: rgba(255,255,255,.14); color: #fff; }
.topsearch input::placeholder { color: rgba(255,255,255,.7); }
.topsearch input:focus { background: #fff; color: #1C2320; outline: none; }
.userbox { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.username { display: flex; flex-direction: column; line-height: 1.15; text-align: right; font-size: .9rem; }
.username small { opacity: .75; font-size: .75rem; }
.userbox .btn-link { color: #fff; opacity: .85; }
.envbar { background: var(--sand-tint); color: var(--sand); text-align: center; font-size: .8rem; padding: .2rem; border-bottom: 1px solid var(--line); }

.shell { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 54px); }
.sidenav { padding: 1rem .6rem; border-right: 1px solid var(--line); background: var(--surface); }
.sidenav a { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border-radius: 8px; color: var(--ink-2);
  font-weight: 550; min-height: var(--tap); }
.sidenav a:hover { background: var(--surface-2); text-decoration: none; }
.sidenav a.on { background: var(--brand-tint); color: var(--brand); }
.sidenav .ico { width: 1.2rem; text-align: center; opacity: .8; }
.main { padding: 1.5rem 1.75rem 4rem; max-width: 1400px; width: 100%; min-width: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.eyebrow { display: block; color: var(--muted); font-size: .82rem; margin-bottom: .15rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Karten und Raster */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow); margin-bottom: 1rem; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-pad { padding: 1.1rem 1.2rem; }
.card.narrow { max-width: 620px; }
.card.attention { border-color: #E8CF9E; background: var(--sand-tint); }
.card.attention h2 { color: var(--sand); }
details.card > summary { cursor: pointer; min-height: 28px; }
details.card[open] > summary { margin-bottom: .8rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.count { display: inline-block; min-width: 1.5rem; padding: 0 .4rem; border-radius: 99px; background: var(--surface-2);
  color: var(--ink-2); font-size: .78rem; text-align: center; margin-left: .3rem; font-weight: 600; }

.list-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 0;
  border-top: 1px solid var(--line); color: var(--ink); min-height: var(--tap); }
.list-row:first-of-type { border-top: 0; }
a.list-row:hover { text-decoration: none; background: linear-gradient(90deg, transparent, var(--surface-2) 30%, var(--surface-2) 70%, transparent); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-main small { color: var(--muted); font-size: .84rem; }
.row-main small.danger { color: var(--danger); }
.row-side { font-size: .85rem; color: var(--ink-2); text-align: right; white-space: nowrap; }
.row-side.danger { color: var(--danger); font-weight: 600; }
.note { background: var(--surface-2); border-radius: 8px; padding: .7rem .85rem; white-space: pre-line; margin: .75rem 0 0; }
ul.plain { margin: 0 0 .75rem; padding-left: 1.1rem; }
ul.plain li { margin: .2rem 0; }

dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: .45rem .75rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .87rem; }
dl.kv dd { margin: 0; }
dl.sums { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; margin: 0; }
dl.sums dt { color: var(--ink-2); }
dl.sums dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
dl.sums dd small { color: var(--muted); }
dl.sums .strong { border-top: 1px solid var(--line-strong); padding-top: .35rem; }
.big { font-size: 1.35rem; font-weight: 700; margin: 0 0 .75rem; }

/* Tabellen */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 650; padding: .65rem .8rem; border-bottom: 1px solid var(--line-strong); background: var(--surface); white-space: nowrap; }
.tbl td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl.compact th, .tbl.compact td { padding: .4rem .5rem; font-size: .9rem; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .c { text-align: center; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl tr.sum td { border-top: 1px solid var(--line-strong); font-weight: 600; }
.tbl tr.sum.strong td { font-weight: 800; }
.tbl tr.inactive td { opacity: .55; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix td.c { color: var(--brand); font-weight: 700; }

/* Angebotseditor */
.offer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1rem; align-items: start; }
.offer-side { position: sticky; top: 70px; }
.offer-side .card { margin-bottom: .85rem; }
.items .oz { font-family: var(--mono); font-size: .82rem; color: var(--ink-2); width: 5.6rem; white-space: nowrap; }
.items .title-row td { background: var(--brand-tint); font-weight: 600; }
.items .row-sub { float: right; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.items .kind-bedarf td, .items .kind-alternativ td, .items .kind-optional td { background: #FAFAF7; }
.items tr.has-warn td:first-child { box-shadow: inset 3px 0 0 var(--sand); }
.items .calc-col { color: var(--ink-2); background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.items .detail-row td, .items .edit-row td { background: var(--surface-2); }
.items .inner { background: var(--surface); border-radius: 6px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-actions { white-space: nowrap; text-align: right; }
.badge.kind { background: var(--sand-tint); color: var(--sand); margin-left: .35rem; }
.add-area { border-top: 1px solid var(--line); }
.add-area details { border-top: 1px solid var(--line); padding: .6rem 0; }
.add-area details:first-of-type { border-top: 0; }
.add-area summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.add-area form { margin-top: .6rem; }
.totals.internal { border-style: dashed; }
.totals.internal h2::after { content: " · nicht für Kunden"; font-weight: 400; color: var(--muted); font-size: .8rem; }
.calc-box { position: sticky; top: 70px; }

/* Ablaufleiste */
.flow { display: flex; gap: .25rem; list-style: none; padding: 0; margin: 0 0 1rem; overflow-x: auto; scrollbar-width: none; }
.flow li { flex: 0 0 auto; font-size: .76rem; padding: .3rem .6rem; border-radius: 99px; background: var(--surface);
  border: 1px solid var(--line); color: var(--muted); }
.flow li.done { background: var(--brand-tint); color: var(--brand); border-color: transparent; }
.flow li.now { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }

/* Badges */
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 650;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.badge.test { background: #EDE7F6; color: #5B3F99; }
.badge.st-beauftragt, .badge.st-ausfuehrung, .badge.ost-angenommen, .badge.ost-freigegeben { background: var(--brand-tint); color: var(--brand); }
.badge.st-angebot, .badge.ost-versendet { background: var(--info-tint); color: #2F5585; }
.badge.ost-zur_freigabe, .badge.st-kalkulation { background: var(--sand-tint); color: var(--sand); }
.badge.st-verloren, .badge.ost-abgelehnt { background: var(--danger-tint); color: var(--danger); }
.badge.ost-ersetzt { text-decoration: line-through; }

/* Formulare */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem 1rem; }
.form-grid > h2 { margin-bottom: 0; }
.span-2 { grid-column: 1 / -1; }
.sub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem 1rem; border: 1px solid var(--line);
  border-radius: 8px; padding: .75rem .9rem 1rem; margin: 0; }
.sub-grid legend { padding: 0 .3rem; font-weight: 600; font-size: .9rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field .lbl { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field .lbl em { color: var(--danger); font-style: normal; }
.field .hint { font-size: .8rem; color: var(--muted); }
.field .err { font-size: .82rem; color: var(--danger); font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); background: var(--danger-tint); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: .5rem .65rem; min-height: var(--tap); width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 1px; border-color: var(--brand); }
input[type=checkbox] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--brand); }
input[type=file] { padding: .45rem; }
.with-suffix { display: flex; align-items: stretch; }
.with-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; text-align: right; }
.with-suffix .suffix { display: grid; place-items: center; padding: 0 .65rem; border: 1px solid var(--line-strong); border-left: 0;
  border-radius: 0 8px 8px 0; background: var(--surface-2); color: var(--muted); font-size: .85rem; white-space: nowrap; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .92rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row-form { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-top: .75rem; }
.row-form .grow { flex: 1; min-width: 180px; }
.stack { display: flex; flex-direction: column; gap: .7rem; }
.btn-row { display: flex; gap: .5rem; } .btn-row .btn { flex: 1; }
form.inline { display: inline-flex; gap: .2rem; align-items: center; }
form.inline select { min-height: 34px; padding: .2rem .4rem; width: auto; }
.filterbar, .searchbar { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filterbar input { flex: 1; min-width: 200px; } .filterbar select { width: auto; }
.searchbar input { flex: 1; }
.upload { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .85rem; align-items: center; }
.upload input[type=file] { flex: 1; min-width: 200px; } .upload select { width: auto; }
.note-form { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; margin-bottom: .75rem; }
.note-form select { width: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: var(--tap); padding: 0 1rem;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit;
  font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-link { background: none; border: 0; padding: .25rem .3rem; color: var(--brand); font: inherit; font-size: .88rem; cursor: pointer; }
.btn-link.danger { color: var(--danger); }
.icon-btn { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  color: var(--ink-2); font-size: .95rem; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.danger { color: var(--danger); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

.flashes { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.flash { padding: .7rem .9rem; border-radius: 8px; background: var(--info-tint); border: 1px solid transparent; margin: 0 0 .75rem; }
.flashes .flash { margin: 0; }
.flash-ok { background: var(--brand-tint); color: var(--brand); }
.flash-error { background: var(--danger-tint); color: var(--danger); font-weight: 600; }
.flash-warn { background: var(--sand-tint); color: var(--sand); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 70px 1fr; gap: .1rem .75rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.t-kind { grid-row: span 2; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: .15rem; }
.t-text { white-space: pre-line; }
.t-meta { font-size: .8rem; color: var(--muted); }
.steps li { margin-bottom: .5rem; }
code.secret { font-size: 1.05rem; letter-spacing: .08em; background: var(--surface-2); padding: .2rem .45rem; border-radius: 6px; word-break: break-all; }
code.wrap { word-break: break-all; white-space: pre-wrap; }

/* Anmeldung */
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 1.75rem; box-shadow: var(--shadow); }
.auth-brand { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.5rem; }
.auth-brand .brand-mark { background: var(--brand); color: #fff; width: 42px; height: 42px; font-size: .95rem; }
.auth-brand strong { display: block; font-size: 1.15rem; letter-spacing: .04em; }
.auth-brand small { color: var(--muted); }

/* Tablet */
@media (max-width: 1180px) {
  .offer-layout { grid-template-columns: 1fr; }
  .offer-side { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
  .offer-side .card { margin: 0; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
/* Telefon */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .topbar { padding: .5rem .75rem; gap: .6rem; }
  .brand-name, .username { display: none; }
  .shell { display: block; }
  .sidenav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: space-around;
    padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .sidenav a { flex-direction: column; gap: .1rem; font-size: .7rem; padding: .35rem .4rem; min-width: 56px; text-align: center; }
  .sidenav .ico { font-size: 1.15rem; }
  .main { padding: 1rem .85rem 6rem; }
  h1 { font-size: 1.3rem; }
  .grid-2, .grid-2.wide-left, .grid-3, .form-grid, .sub-grid, .offer-side { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .calc-box { position: static; }
  .tbl th, .tbl td { padding: .55rem .6rem; }
  .items .oz { width: auto; }
  dl.kv { grid-template-columns: 1fr; gap: .1rem; }
  dl.kv dd { margin-bottom: .45rem; }
  .note-form { grid-template-columns: 1fr; }
  .head-actions { width: 100%; } .head-actions .btn { flex: 1; }
}
@media print {
  .topbar, .sidenav, .envbar, .head-actions, .add-area, .row-actions, .offer-side .card:not(.totals) { display: none !important; }
  .shell { display: block; } .card { box-shadow: none; }
}
.offer-side .tbl.compact th, .offer-side .tbl.compact td { padding: .35rem .3rem; font-size: .84rem; }
.offer-side .tbl.compact th { font-size: .68rem; letter-spacing: .02em; }
.sm-only { display: none; }
@media (max-width: 760px) {
  .sm-only { display: inline; }
  .items, .items tbody { display: block; }
  .items thead, .items .detail-row { display: none; }
  .items tr { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); border-bottom: 1px solid var(--line); padding: .35rem 0; }
  .items td { border: 0; padding: .2rem .55rem; }
  .items td[colspan] { grid-column: 2; }
  .items td[data-label] { grid-column: 2; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .items td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; }
  .items td.row-actions { grid-column: 2; text-align: left; padding-top: .4rem; }
  .items .edit-row td:first-child { display: none; }
  .items .edit-row td { grid-column: 1 / -1; }
  .items .calc-col { background: none; }
  .items .row-sub { float: none; display: block; }
}
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .4rem; }
.sub-details { margin-top: .9rem; } .sub-details summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.inline-details summary { list-style: none; cursor: pointer; } .inline-details[open] { flex-basis: 100%; }
.done-row { opacity: .6; }
.note-form .span-all { grid-column: 1 / -1; }
.row-form select { width: auto; } .row-form .grow { flex: 1; min-width: 180px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; }
.kpi span { display: block; font-size: .8rem; color: var(--muted); } .kpi strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.kpi.warn strong { color: var(--danger); }
.steps-flow { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.steps-flow li { font-size: .78rem; padding: .25rem .6rem; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.steps-flow li.done { background: var(--brand-tint); color: var(--brand); border-color: transparent; }
.steps-flow li.now { background: var(--brand); color: #fff; font-weight: 700; }
.tbl input.cq { width: 7rem; min-height: 36px; text-align: right; padding: .3rem .5rem; }
.mob-only { display: none !important; }
@media (max-width: 760px) { .desk-only { display: none !important; } .mob-only { display: flex !important; } }

/* Touch-Geräte: iOS vergrößert die Ansicht bei Eingabefeldern unter 16 px – auch in kompakten Tabellen verhindern */
@media (max-width: 1180px), (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  input[type=checkbox], input[type=radio] { width: 24px; height: 24px; min-height: 24px; }
  .btn-link { min-height: 40px; }
}

/* Tabellen, die auf dem Telefon zu Karten werden (Beschriftung aus data-label) */
@media (max-width: 760px) {
  .stack-sm, .stack-sm tbody, .stack-sm tr { display: block; width: 100%; }
  .stack-sm thead { display: none; }
  .stack-sm tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
  .stack-sm td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border: 0; padding: .15rem .55rem; text-align: right; }
  .stack-sm td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; font-weight: 400; }
  .stack-sm td.lead { display: block; text-align: left; font-weight: 600; }
  .stack-sm td:empty, .stack-sm td.desk-cell { display: none; }
  .stack-sm td.num { text-align: right; }
}
.review { border-top: 1px solid var(--line); padding: .7rem 0; }
.review:first-of-type { border-top: 0; }
.review .btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.review .btn-row input { flex: 1 1 12rem; width: auto; }

/* Planung P1 */
.plan-card { overflow: hidden; }
.plan-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.plan-toolbar .sep { width: 1px; height: 1.6rem; background: var(--line); }
.plan-toolbar .btn.active { background: var(--brand); color: #fff; }
.plan-wrap { background: var(--surface); }
.plan-svg { display: block; width: 100%; height: min(62vh, 640px); touch-action: none; background: #FAFAF7; }
.plan-svg .grid line { stroke: #E3E6E0; }
.plan-svg .obj { cursor: pointer; }
.plan-svg .handle { fill: #fff; stroke: #C2410C; stroke-width: .04; cursor: move; }
.plan-svg .handle.draft { fill: #C2410C; }
.plan-svg .dim { fill: #1C2320; text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: .06; }
textarea.coords { width: 100%; font-size: 16px; }
textarea.coords.invalid { border-color: #B42318; }

/* Materialshowroom (Auftrag 08) */
.sr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.sr-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.sr-img { display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 4 / 3; background: var(--surface-2); color: var(--muted); text-align: center; padding: .5rem; }
.sr-img span { font-size: 1.4rem; font-weight: 700; letter-spacing: .04em; }
.sr-img small { font-size: .72rem; }
.sr-img img { width: 100%; height: 100%; object-fit: cover; }
.sr-img.noimg { aspect-ratio: auto; min-height: 4.5rem; }
.sr-cats { scrollbar-width: thin; }
@media (max-width: 1024px) { .topsearch input { font-size: 16px; } }
.sr-card-body { padding: .8rem .9rem 1rem; }
.sr-card-body h3 { margin: 0 0 .25rem; font-size: 1.02rem; }
.sr-variants { padding-left: 0; list-style: none; margin-top: .5rem; }
.sr-variants .check { align-items: flex-start; }
.sr-variants input[type=checkbox] { width: 22px; height: 22px; flex: none; }
.sr-compare-bar { position: sticky; top: 56px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .8rem; margin-bottom: .8rem; }
.sr-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem .8rem; margin-top: .6rem; align-items: end; }
.sr-filter-box summary, details.card > summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.sr-detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
.sr-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; }
.sr-media figure { margin: 0; } .sr-media img { width: 100%; border-radius: 8px; display: block; }
.sr-variant { border-top: 1px solid var(--line); padding: .9rem 0; }
.sr-variant:first-of-type { border-top: 0; }
.sr-variant header { display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: baseline; }
.sr-variant h3 { margin: 0; font-size: 1.02rem; }
.sr-inactive { opacity: .75; }
dl.kv-tight { grid-template-columns: 150px 1fr; margin: .5rem 0; }
.sr-actions { margin-top: .4rem; }
.sr-compare th { min-width: 150px; vertical-align: top; }
.sr-compare td { min-width: 170px; vertical-align: top; }
.sr-thumb { width: 150px; height: 110px; object-fit: cover; border-radius: 6px; }
.sr-cats { flex-wrap: nowrap; }
.kunde .kunde-main { max-width: 1200px; margin: 0 auto; }
.kunde .kunde-exit { color: #fff; }
.sr-exit { max-width: 420px; margin: 2rem auto; }
.sr-filters input, .sr-filters select, .sr-actions input, .sr-actions select { font-size: 16px; }
@media (max-width: 900px) { .sr-detail { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .sr-grid { grid-template-columns: 1fr; } dl.kv-tight { grid-template-columns: 120px 1fr; } }

/* Paket E: Plantafel */
.tbl.board th, .tbl.board td { vertical-align: top; min-width: 120px; }
.tbl.board tbody th { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tbl.board td.conflict { background: var(--sand-tint); outline: 2px solid var(--sand); outline-offset: -2px; }
.board-item { border-left: 3px solid var(--brand); padding: .15rem .4rem; margin-bottom: .3rem; font-size: .88rem; }
input[type=time], input[type=date] { font-size: 16px; }

/* Paket F: Nachweise */
.cert { border-top: 1px solid var(--line); padding: .8rem 0; }
.cert:first-of-type { border-top: 0; }
.cert header { display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: baseline; }
.cert-bad header strong { color: var(--danger); }
.cert-version { border-left: 3px solid var(--line); padding: .3rem 0 .3rem .7rem; margin: .5rem 0; font-size: .92rem; }
.cert-type { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .6rem; }
code.secret { word-break: break-all; }

/* Paket G: Unterschrift */
canvas.sig-pad { width: 100%; height: 180px; border: 1px dashed var(--line-strong); border-radius: 8px; background: #fff; touch-action: none; }
.sig-img { display: block; max-width: 240px; max-height: 80px; background: #fff; border-radius: 4px; margin-top: .3rem; }

/* Zwei-Faktor: QR-Code immer auf weißem Grund (auch im dunklen Modus), groß genug zum Scannen */
img.totp-qr { display: block; margin: .6rem 0; background: #fff; padding: 6px; border-radius: 8px; max-width: 100%; height: auto; }
