/* IGRO E-Rechnung: component styles. Tokens live in tokens.css. No inline styles anywhere (the CSP forbids them). */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: clamp(15.5px, .3vw + 14.4px, 17px);
  line-height: 1.5;
  color: var(--tx);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: -80px; z-index: 300; background: var(--gold); color: #000; padding: .7em 1.1em; border-radius: 10px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

/* ------------------------------------------------------------------ mock banner */
.mockbar { background: var(--gold); color: var(--ink); font-size: .82rem; font-weight: 650; padding: .35rem var(--pad); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem 1.2rem; text-align: center; }

/* ------------------------------------------------------------------ header */
.hd { position: sticky; top: 0; z-index: 100; height: var(--hd); background: var(--ink); color: #fff; display: flex; align-items: center; gap: clamp(.8rem, 2vw, 2rem); padding: 0 var(--pad); }
.hd-logo { display: flex; align-items: center; gap: .8rem; text-decoration: none; flex: none; min-height: var(--tap); }
.hd-logo img { height: 40px; width: auto; }
.hd-app { font-size: .72rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--mut-on-ink); border-left: 1px solid var(--ink3); padding-left: .8rem; line-height: 1.2; }
.hd-nav { margin-left: auto; height: 100%; }
.hd-nav ul { list-style: none; display: flex; height: 100%; padding: 0; gap: clamp(.6rem, 1.3vw, 1.5rem); }
.hd-nav a { position: relative; display: flex; align-items: center; height: 100%; text-decoration: none; font-weight: 650; font-size: .8rem; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; color: #E9EAEC; }
.hd-nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--red); transform: scaleX(0); transition: transform .35s var(--e); }
.hd-nav a:hover::after, .hd-nav a[aria-current]::after { transform: none; }
.hd-nav a[aria-current] { color: #fff; }
.hd-r { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.hd-nav + .hd-r { margin-left: 0; }

.roleswitch { display: flex; align-items: center; gap: .5rem; }
.roleswitch label { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; }
.roleswitch select { background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: .35rem .8rem; min-height: 40px; font-size: .85rem; font-weight: 650; }

.pop { position: relative; }
.pop > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; min-height: var(--tap); padding: 0 .9rem; border-radius: 999px; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); font-weight: 650; font-size: .88rem; white-space: nowrap; user-select: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop > summary:hover, .pop[open] > summary { background: var(--red); box-shadow: none; }
.pop > summary svg { width: 1.1em; height: 1.1em; flex: none; }
.pop-panel { position: absolute; right: 0; top: calc(100% + 10px); min-width: 15rem; background: var(--ink); color: #fff; border-radius: 16px; padding: .5rem; box-shadow: 0 24px 60px rgba(0,0,0,.45); z-index: 120; }
.pop-panel a, .pop-panel button { display: flex; width: 100%; align-items: center; gap: .6rem; min-height: var(--tap); padding: .6rem .9rem; border-radius: 11px; text-decoration: none; background: none; border: 0; cursor: pointer; font-weight: 600; text-align: left; }
.pop-panel a:hover, .pop-panel button:hover, .pop-panel a[aria-current] { background: var(--ink3); }
.pop-panel .who { padding: .6rem .9rem .8rem; border-bottom: 1px solid var(--ink3); margin-bottom: .4rem; }
.pop-panel .who b { display: block; }
.pop-panel .who span { font-size: .82rem; color: var(--mut-on-ink); }
.menu { display: none; }
.menu .pop-panel { position: fixed; left: 0; right: 0; top: var(--hd); border-radius: 0 0 20px 20px; padding: .6rem var(--pad) 1rem; max-height: calc(100vh - var(--hd)); overflow: auto; }
.menu .pop-panel ul { list-style: none; padding: 0; }
.menu .pop-panel a { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; }
.menu .pop-panel a[aria-current] { color: var(--gold); }

.user-name { display: none; }
.user > summary { padding: 0; width: var(--tap); justify-content: center; }
@media (max-width: 1240px) {
  .hd-nav { display: none; }
  .menu { display: block; }
}
@media (max-width: 720px) {
  .hd-app { display: none; }
  .mockbar { font-size: .76rem; }
}
@media (max-width: 420px) {
  .hd-logo img { height: 32px; }
}

/* ------------------------------------------------------------------ page frame */
.wrap { width: 100%; max-width: calc(var(--max) + 2 * var(--pad)); margin: 0 auto; padding: clamp(1.4rem, 3vw, 2.6rem) var(--pad) clamp(3rem, 6vw, 5rem); flex: 1; }
.wrap:focus { outline: none; }
.page-hd { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: clamp(1.2rem, 2.5vw, 2rem); }
.page-hd > div:first-child { min-width: 0; }
.kicker { font-size: .76rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; color: var(--acc); display: flex; align-items: center; gap: .7em; margin-bottom: .6rem; }
.kicker::before { content: ""; width: 1.6em; height: 2px; background: currentColor; }
.kicker a { text-decoration: none; }
.kicker a:hover { text-decoration: underline; }
.disp, h1 { font-stretch: 68%; font-weight: 800; text-transform: uppercase; line-height: .95; letter-spacing: -.005em; font-size: clamp(2rem, 4.2vw, 3.4rem); overflow-wrap: anywhere; hyphens: auto; }
h2 { font-stretch: 72%; font-weight: 800; text-transform: uppercase; font-size: clamp(1.25rem, 1.6vw, 1.55rem); line-height: 1.05; margin-bottom: .9rem; }
h3 { font-size: 1.02rem; font-weight: 750; margin-bottom: .5rem; }
.lead { color: var(--mut); max-width: 68ch; margin-top: .7rem; }
.muted { color: var(--mut); }
.small { font-size: .86rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: clamp(1.2rem, 2.4vw, 2rem); }
.cols { display: grid; gap: clamp(1rem, 2vw, 1.6rem); grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.cols-2-1 { display: grid; gap: clamp(1rem, 2vw, 1.6rem); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 980px) { .cols-2-1 { grid-template-columns: minmax(0, 1fr); } }

.ft { padding: 1.4rem var(--pad); font-size: .82rem; color: var(--mut); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; justify-content: space-between; }

/* ------------------------------------------------------------------ cards and stats */
.card { background: var(--card); border-radius: var(--radius); padding: clamp(1.1rem, 2.2vw, 1.7rem); box-shadow: 0 1px 0 var(--line); min-width: 0; }
.card-ink { background: var(--ink); color: #fff; --mut: var(--mut-on-ink); --line: rgba(255,255,255,.14); }
.card > h2:first-child, .card > header:first-child { margin-top: -.1rem; }
.card-hd { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem 1rem; margin-bottom: .9rem; }
.card-hd h2 { margin-bottom: 0; }
.stats { display: grid; gap: clamp(.8rem, 1.6vw, 1.2rem); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.stat { background: var(--card); border-radius: var(--radius); padding: 1.1rem 1.3rem 1.2rem; box-shadow: 0 1px 0 var(--line); display: flex; flex-direction: column; gap: .3rem; text-decoration: none; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line-strong); }
.stat.tone-bad::before { background: var(--red); }
.stat.tone-warn::before { background: var(--gold); }
.stat.tone-info::before { background: var(--blue); }
.stat .lbl { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--mut); }
.stat .val { font-stretch: 72%; font-weight: 800; font-size: clamp(1.7rem, 2.4vw, 2.2rem); line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .86rem; color: var(--mut); }
a.stat:hover { box-shadow: 0 18px 40px -18px rgba(20,22,26,.4); }

dl.facts { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: .55rem 1.2rem; }
dl.facts dt { font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--mut); padding-top: .2rem; }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { dl.facts { grid-template-columns: 1fr; gap: .1rem; } dl.facts dd { margin-bottom: .6rem; } }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .6em; min-height: var(--tap); padding: .75em 1.45em; border-radius: 999px; border: 0; font-weight: 700; font-stretch: 92%; letter-spacing: .02em; line-height: 1.15; text-decoration: none; cursor: pointer; position: relative; overflow: hidden; isolation: isolate; transition: transform .3s var(--e), color .3s, box-shadow .3s; text-align: center; }
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--gold); transform: translateY(102%); transition: transform .4s var(--e2); }
.btn:hover::before { transform: none; }
.btn:hover { color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn svg { width: 1.1em; height: 1.1em; flex: none; }
.btn-red { background: var(--red); color: #fff; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-line { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn-line:hover { box-shadow: inset 0 0 0 1.5px var(--gold); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold::before { background: #fff; }
.btn-sm { min-height: 40px; padding: .5em 1em; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-xl { min-height: 60px; font-size: 1.1rem; padding: .9em 1.8em; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn[disabled]::before { display: none; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--acc); font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 32px; }
@media (max-width: 720px) { .btn-sm { min-height: var(--tap); } }

/* ------------------------------------------------------------------ chips */
.chip { display: inline-flex; align-items: center; gap: .35em; font-size: .78rem; font-weight: 700; letter-spacing: .03em; padding: .28em .75em; border-radius: 999px; background: var(--muted-bg); color: var(--muted-tx); white-space: nowrap; line-height: 1.3; }
.chip.ok { background: var(--ok-bg); color: var(--ok-tx); }
.chip.warn { background: var(--warn-bg); color: var(--warn-tx); }
.chip.bad { background: var(--bad-bg); color: var(--bad-tx); }
.chip.info { background: var(--info-bg); color: var(--info-tx); }
.chip.ink { background: var(--ink); color: #fff; }
.chip.ph { background: var(--warn-bg); color: var(--warn-tx); border: 1px dashed var(--warn-tx); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.ph-val { background: var(--warn-bg); color: var(--warn-tx); border-bottom: 1.5px dashed var(--warn-tx); padding: 0 .2em; }

/* ------------------------------------------------------------------ alerts */
.alert { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1.1rem; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info-tx); }
.alert svg { width: 1.3em; height: 1.3em; flex: none; margin-top: .1em; }
.alert.ok { background: var(--ok-bg); color: var(--ok-tx); }
.alert.warn { background: var(--warn-bg); color: var(--warn-tx); }
.alert.bad { background: var(--bad-bg); color: var(--bad-tx); }
.alert a { font-weight: 700; }
.alert p + p { margin-top: .3rem; }
.flash { margin-bottom: 1.2rem; }
.warnings { list-style: none; padding: 0; display: grid; gap: .6rem; }

/* ------------------------------------------------------------------ tables (cards below 720 px) */
/* position: relative keeps screen-reader-only labels inside the scroll box, so they cannot widen the page. */
.tbl-wrap { overflow-x: auto; position: relative; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--mut); text-align: left; padding: .5rem .6rem .6rem; border-bottom: 1.5px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: .75rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl td.main a { font-weight: 700; text-decoration: none; }
.tbl td.main a:hover { text-decoration: underline; }
.tbl tbody tr:hover { background: rgba(20,22,26,.025); }
.tbl tfoot td { font-weight: 750; border-top: 1.5px solid var(--line-strong); border-bottom: 0; }
.tbl .empty { color: var(--mut); text-align: center; padding: 2rem 1rem; }
.tbl .sub { display: block; font-size: .84rem; color: var(--mut); }

@media (max-width: 719.98px) {
  .tbl-wrap { overflow: visible; }
  .tbl, .tbl tbody, .tbl tr, .tbl td, .tbl tfoot { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { padding: .9rem 0; border-bottom: 1px solid var(--line); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .2rem 0; border: 0; text-align: right; }
  .tbl td::before { content: attr(data-label); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--mut); text-align: left; flex: none; }
  .tbl td.main { display: block; text-align: left; font-size: 1.05rem; padding-bottom: .35rem; }
  .tbl td.main::before { display: none; }
  .tbl td.opt { display: none; }
  .tbl td.act { justify-content: flex-start; padding-top: .5rem; }
  .tbl td.act::before { display: none; }
  .tbl td.empty { display: block; text-align: center; }
  .tbl td.empty::before { display: none; }
  .tbl tfoot tr { border-top: 1.5px solid var(--line-strong); }
  .tbl tfoot td:first-child:not(:only-child) { display: none; }
  .tbl td { min-width: 0; overflow-wrap: anywhere; }
}

/* ------------------------------------------------------------------ forms */
.form { display: grid; gap: 1.1rem 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.form .full { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; min-width: 0; }
fieldset.group { border-top: 1.5px solid var(--line); padding-top: 1.2rem; }
legend { font-stretch: 72%; font-weight: 800; text-transform: uppercase; font-size: 1.15rem; padding: 0; margin-bottom: .8rem; float: left; width: 100%; }
legend + * { clear: both; }
.fld { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.fld > label, .lbl { font-size: .74rem; letter-spacing: .13em; text-transform: uppercase; font-weight: 700; color: var(--mut); }
.fld .req { color: var(--acc); }
.inp, .fld input:not([type=checkbox]):not([type=radio]):not([type=file]), .fld select, .fld textarea {
  width: 100%; min-height: var(--tap); padding: .6rem .85rem; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; font-size: 1rem; transition: border-color .2s; }
.fld textarea { min-height: 6rem; resize: vertical; line-height: 1.45; }
.fld input:hover, .fld select:hover, .fld textarea:hover { border-color: var(--ink3); }
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--red); }
.fld input[readonly] { background: var(--paper); color: var(--mut); }
.fld input[type=file] { min-height: var(--tap); padding: .5rem; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm); background: #fff; width: 100%; }
.fld .hint { font-size: .84rem; color: var(--mut); }
.fld.bad input, .fld.bad select, .fld.bad textarea { border-color: var(--red); background: #FFF7F7; }
.err { font-size: .86rem; color: var(--bad-tx); font-weight: 650; display: flex; gap: .4rem; align-items: baseline; }
.err::before { content: "!"; display: inline-grid; place-items: center; width: 1.2em; height: 1.2em; border-radius: 50%; background: var(--red); color: #fff; font-size: .75em; font-weight: 800; flex: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; grid-column: 1 / -1; padding-top: .4rem; }

.check { display: flex; gap: .75rem; align-items: flex-start; cursor: pointer; min-height: var(--tap); padding: .4rem 0; }
.check input { width: 1.35rem; height: 1.35rem; accent-color: var(--red); flex: none; margin-top: .1rem; }
.check span b { display: block; }
.check span small { display: block; color: var(--mut); font-size: .86rem; }

.pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pills label { position: relative; cursor: pointer; }
.pills input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pills span { display: inline-flex; align-items: center; min-height: var(--tap); padding: .5rem 1.1rem; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--line-strong); font-weight: 650; background: #fff; }
.pills input:checked + span { background: var(--red); color: #fff; box-shadow: none; }
.pills input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.pills label:hover span { box-shadow: inset 0 0 0 1.5px var(--ink); }
.pills-xl span { min-height: 58px; min-width: 4.2rem; justify-content: center; font-size: 1.1rem; }

.filters { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; margin-bottom: 1.2rem; }
.filters .fld { flex: 1 1 13rem; }
.filters .fld.grow { flex: 2 1 18rem; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 1.5px solid var(--line); margin-bottom: 1.4rem; scrollbar-width: thin; }
.tabs a { display: flex; align-items: center; min-height: var(--tap); padding: 0 1rem; text-decoration: none; font-weight: 700; font-size: .86rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1.5px; color: var(--mut); }
.tabs a:hover { color: var(--tx); }
.tabs a[aria-current] { color: var(--tx); border-color: var(--red); }

.subnav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.4rem; }
.subnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border-radius: 999px; text-decoration: none; font-weight: 650; font-size: .9rem; box-shadow: inset 0 0 0 1.5px var(--line-strong); background: #fff; }
.subnav a[aria-current] { background: var(--ink); color: #fff; box-shadow: none; }

/* ------------------------------------------------------------------ totals */
.totals { display: grid; grid-template-columns: 1fr auto; gap: .45rem 0; font-variant-numeric: tabular-nums; }
.totals dt { color: var(--mut); padding-right: 1.2rem; }
.totals dd { margin: 0; text-align: right; white-space: nowrap; }
.totals .sum { font-weight: 800; font-size: 1.15rem; padding-top: .6rem; border-top: 1.5px solid var(--line-strong); color: var(--tx); }
.totals .minus { color: var(--bad-tx); }
.totals .info { font-size: .88rem; }
.taxbox { border-radius: var(--radius-sm); padding: 1rem 1.1rem; background: var(--paper); border-left: 5px solid var(--blue); }
.taxbox.rc { border-left-color: var(--gold); }
.taxbox h3 { margin-bottom: .3rem; }
.taxbox p { font-size: .92rem; }

/* ------------------------------------------------------------------ draft lines */
.lines { display: grid; gap: .8rem; }
/* One draft line: the description on its own row, the numbers below it. */
.line { display: grid; gap: .6rem .8rem; grid-template-columns: 2rem minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1fr) minmax(0, .8fr) minmax(6.5rem, auto) auto; align-items: end; padding: .9rem; border-radius: var(--radius-sm); background: var(--paper); }
.line .pos { grid-row: 1 / span 2; font-weight: 800; font-stretch: 72%; font-size: 1.3rem; align-self: start; padding-top: 1.6rem; text-align: center; }
.line .desc { grid-column: 2 / -1; }
.line .fld > label { font-size: .66rem; }
.line .net { text-align: right; font-weight: 750; padding-bottom: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .line .pos { grid-row: auto; grid-column: 1 / -1; text-align: left; padding-top: 0; }
  .line .desc { grid-column: 1 / -1; }
  .line .net { text-align: left; padding: 0; align-self: center; }
  .line .rm { justify-self: end; }
}
.addline { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.addline .fld { flex: 1 1 18rem; }

/* ------------------------------------------------------------------ "Neue Rechnung": the table of the paper invoice */
.qi-new { border: 0; padding: 1rem; margin: 0; border-radius: var(--radius-sm); background: var(--paper); }
.qi-new legend { float: left; width: 100%; margin-bottom: .8rem; }
.qi { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.qi th { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--mut); text-align: left; padding: .4rem .35rem .6rem; border-bottom: 1.5px solid var(--line-strong); white-space: nowrap; }
.qi td { padding: .35rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.qi .num { text-align: right; }
.qi .pos { width: 2.6rem; font-weight: 800; padding-top: .9rem; color: var(--mut); }
.qi input { width: 100%; min-height: var(--tap); padding: .55rem .7rem; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; font-size: 1rem; }
.qi input:focus { border-color: var(--red); }
.qi td.num input { text-align: right; max-width: 9rem; }
.qi th:nth-child(2), .qi td.desc { width: 60%; }
.qi th:nth-child(3), .qi th:nth-child(4) { width: 9.5rem; }
.qi td.bad input { border-color: var(--red); background: #FFF7F7; }
.qi .err { font-size: .84rem; color: var(--bad-tx); margin-top: .25rem; text-align: left; }
.qi .unit { display: block; font-size: .8rem; color: var(--mut); margin-top: .2rem; }
.qi .amt { font-weight: 750; white-space: nowrap; padding-top: .9rem; min-width: 7.5rem; }
.qi .rm { width: 3.4rem; text-align: right; }
.qi-add { margin-top: .9rem; }
.qi-skonto { margin-top: .9rem; padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--paper); }
.qi-actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: flex-end; }
.qi-actions .qi-delete { margin-right: auto; }
@media (max-width: 720px) {
  /* Phone: every line becomes a small card, description on top, numbers below. */
  .qi thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .qi, .qi tbody { display: block; }
  .qi tr { display: grid; grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 1fr) auto; gap: .5rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
  .qi tr[hidden] { display: none; }
  .qi td { display: block; padding: 0; border: 0; }
  .qi .pos { grid-row: 1; grid-column: 1; padding-top: .8rem; width: auto; }
  .qi .desc { grid-row: 1; grid-column: 2 / -1; width: auto; }
  .qi td.num input { max-width: none; }
  .qi td:nth-child(3) { grid-row: 2; grid-column: 2; }
  .qi td:nth-child(4) { grid-row: 2; grid-column: 3 / -1; }
  .qi .amt { grid-row: 3; grid-column: 2 / 4; text-align: left; padding-top: .7rem; min-width: 0; }
  .qi .rm { grid-row: 3; grid-column: 4; width: auto; }
  .qi-actions .btn { flex: 1 1 100%; }
}

/* ------------------------------------------------------------------ Aufmaß (phone first) */
.quick { display: grid; gap: 1rem; }
.quick .row2 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.quick input[inputmode] { font-size: 1.25rem; font-weight: 700; }
.sumlist { list-style: none; padding: 0; display: grid; gap: .5rem; }
.sumlist li { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--paper); align-items: baseline; }
.sumlist b { font-stretch: 72%; font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mlist { list-style: none; padding: 0; display: grid; gap: .6rem; }
.mitem { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem 1rem; padding: .9rem 1rem; border-radius: var(--radius-sm); background: #fff; box-shadow: inset 0 0 0 1.5px var(--line); }
.mitem .q { font-stretch: 72%; font-weight: 800; font-size: 1.35rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mitem .meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .86rem; color: var(--mut); align-items: center; }
.mitem form { margin-left: auto; }

/* ------------------------------------------------------------------ validation result */
.checks { list-style: none; padding: 0; display: grid; gap: .6rem; }
.checks li { padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--ok-bg); color: var(--ok-tx); }
.checks li.fail { background: var(--bad-bg); color: var(--bad-tx); }
.checks li.info { background: var(--info-bg); color: var(--info-tx); }
.checks li li { padding: 0; background: none; color: inherit; border-radius: 0; }
.checks li b { display: flex; gap: .5rem; align-items: center; }
.checks li ul { margin: .4rem 0 0 1.6rem; font-size: .9rem; }
.checks svg { width: 1.2em; height: 1.2em; flex: none; }
details.report { border-top: 1px solid var(--line); padding: .6rem 0; }
details.report summary { cursor: pointer; font-weight: 650; min-height: 40px; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------ dialog */
dialog { border: 0; padding: 0; border-radius: var(--radius); width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: #fff; color: var(--tx); box-shadow: 0 40px 80px rgba(0,0,0,.45); }
dialog::backdrop { background: rgba(20, 22, 26, .62); }
.dlg { padding: clamp(1.2rem, 3vw, 1.8rem); display: grid; gap: 1rem; }
.dlg-hd { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.dlg-hd h2 { margin: 0; }
.xbtn { background: var(--paper); border: 0; border-radius: 50%; width: var(--tap); height: var(--tap); display: grid; place-items: center; cursor: pointer; flex: none; text-decoration: none; }
.xbtn svg { width: 1.1rem; height: 1.1rem; }
.xbtn:hover { background: var(--gold); }
.pagedialog { max-width: 680px; margin: 0 auto; background: #fff; border-radius: var(--radius); box-shadow: 0 30px 70px -30px rgba(0,0,0,.45); }

/* ------------------------------------------------------------------ sign-in */
.auth { flex: 1; display: grid; place-items: center; padding: 2rem var(--pad); background: var(--ink); color: #fff; }
.auth-card { width: min(440px, 100%); background: #fff; color: var(--tx); border-radius: 24px; padding: clamp(1.5rem, 5vw, 2.4rem); display: grid; gap: 1.2rem; }
.auth-logo { width: 180px; height: auto; }
.auth .kicker { margin-bottom: 0; }
.auth h1 { font-size: clamp(2rem, 7vw, 2.6rem); }
.code-input { font-size: 1.8rem !important; letter-spacing: .4em; text-align: center; font-weight: 800; }
.qr { width: 180px; height: 180px; border-radius: 12px; background: var(--paper); border: 1.5px dashed var(--line-strong); display: grid; place-items: center; text-align: center; padding: 1rem; font-size: .82rem; color: var(--mut); }
.qr svg { width: 72px; height: 72px; margin: 0 auto .4rem; color: var(--ink); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ misc */
.divider { border: 0; border-top: 1.5px solid var(--line); margin: 1.2rem 0; }
.empty-state { text-align: center; padding: 2.4rem 1rem; color: var(--mut); }
.iconlink { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--acc); text-decoration: none; min-height: 40px; }
.iconlink:hover { text-decoration: underline; }
.iconlink svg { width: 1em; height: 1em; }
.badge-count { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .4em; border-radius: 999px; background: var(--red); color: #fff; font-size: .75rem; font-weight: 800; }
.htmx-request .spin { opacity: 1; }
.spin { opacity: 0; transition: opacity .2s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* 2FA setup: real QR code (inline SVG), and the one-time password shown once to the owner. */
.qr-code { width: 220px; max-width: 100%; margin: 0 auto; background: #fff; border-radius: 12px; border: 1.5px solid var(--line-strong); padding: 6px; }
.qr-code svg { display: block; width: 100%; height: auto; }
.onetime { border-left: 4px solid var(--warn, #b7791f); margin-bottom: 1rem; }
.onetime-pw { font-size: 1.5rem; letter-spacing: .08em; user-select: all; }
.narrow { max-width: 34rem; }
