/* Rechnung schreiben – Logik in web/src/rechnung/ */
.re-main { max-width: 1240px; }
#re { margin-bottom: var(--sp-7); display: flex; flex-direction: column; gap: var(--sp-4); }
#re h2 { margin: 0 0 12px; font-size: 1.1rem; }
#re h3 { margin: 0 0 6px; font-size: .95rem; }
.tg-noscroll { overflow: hidden; }
.tg-modal { position: fixed; inset: 0; background: rgba(10, 12, 25, .55); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .tg-modal { align-items: center; } }
.tg-sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 16px 18px 22px; animation: reUp .28s cubic-bezier(.2, .9, .3, 1); }
@media (min-width: 700px) { .tg-sheet { border-radius: var(--r-l); } }
.tg-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.tg-x { border: 0; background: none; font-size: 1.2rem; padding: 4px 8px; color: var(--text); cursor: pointer; }
.tg-toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); background: #111827; color: #fff; padding: 10px 16px; border-radius: var(--r-m); opacity: 0; pointer-events: none; transition: .2s; z-index: 1100; max-width: calc(100% - 32px); text-align: center; }
.tg-toast.on { opacity: 1; transform: translate(-50%, 0); }
@keyframes reUp { from { transform: translateY(24px); opacity: 0; } }

/* Reiter */
.re-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.re-tabs button { flex: 0 0 auto; min-height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: 600 .92rem/1 var(--font); cursor: pointer; white-space: nowrap; }
.re-tabs button.an { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.re-grenze { margin: 0; padding: 10px 14px; border-radius: var(--r-m); background: var(--surface-2); color: var(--muted); font-size: .88rem; line-height: 1.45; }
.re-grenze b { color: var(--text); }

/* Zwei Spalten: Formular und Blatt */
.re-zwei { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.re-links, .re-form, .re-liste { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.re-rechts { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; padding: 4px; border-radius: var(--r-m); }
.re-vor { display: flex; flex-direction: column; gap: 14px; }
.re-blatt { display: block; width: 100%; height: auto; background: #fff; border-radius: 4px; box-shadow: 0 2px 14px rgba(15, 23, 42, .18), 0 0 0 1px rgba(15, 23, 42, .06); }
.re-mobil { display: none; }
.re-akt { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.re-akt b { font-size: 1.05rem; }
.re-akt .h-btn { margin-left: auto; }
@media (max-width: 899px) {
  .re-zwei { grid-template-columns: minmax(0, 1fr); }
  .re-rechts { display: none; position: static; max-height: none; overflow: visible; padding: 0; }
  .re-zeigvor .re-links { display: none; }
  .re-zeigvor .re-rechts { display: block; }
  .re-mobil { display: block; position: sticky; bottom: 10px; z-index: 20; padding: 6px; border-radius: 999px; background: var(--surface); box-shadow: 0 6px 24px rgba(15, 23, 42, .22); order: 3; }
  .re-mobil .h-seg { width: 100%; }
}

/* Formular */
.re-karte { padding: 16px; }
.re-karte.re-blink { animation: reBlink 1.6s ease; }
@keyframes reBlink { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: none; } }
.re-f { margin-bottom: 10px; min-width: 0; }
.re-f .h-textarea { padding-top: 10px; padding-bottom: 10px; min-height: 64px; resize: vertical; }
.re-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.re-grid3 { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 10px; }
.re-grid4 { display: grid; grid-template-columns: 1fr 1.2fr 1.3fr .9fr; gap: 8px; }
.re-grid4 .h-input, .re-grid4 .h-select { padding-left: 10px; }
.re-grid4 .h-select { padding-right: 28px; background-position: right 8px center; }
@media (max-width: 520px) { .re-grid3 { grid-template-columns: 90px 1fr; } .re-grid3 > :last-child { grid-column: 1 / -1; } .re-grid4 { grid-template-columns: 1fr 1fr; } }
.re-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.re-pos { padding: 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--r-m); background: var(--surface-2); }
.re-poskopf { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .86rem; color: var(--muted); }
.re-possum { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.re-mini { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer; font-size: .95rem; }
.re-mini:hover { border-color: var(--accent); }
.re-rabatt { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.re-rabatt .re-f { margin: 0; flex: 1 1 160px; }
.re-farben { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.re-farbe { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.re-farbe.an { box-shadow: 0 0 0 2px var(--text); }
.re-farbwahl { width: 44px; height: 36px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
.re-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.re-logo img { max-width: 180px; max-height: 80px; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 6px; }

/* Speichern */
.re-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; font-variant-numeric: tabular-nums; color: var(--muted); }
.re-sum b { color: var(--text); font-size: 1.15rem; }
.re-ausknopf { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.re-pruef { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.re-pruef button { width: 100%; text-align: left; padding: 9px 12px; border: 0; border-left: 4px solid var(--warn, #d97706); border-radius: 8px; background: var(--warn-soft, #fef3c7); color: var(--text); font: inherit; font-size: .9rem; line-height: 1.4; cursor: pointer; }
.re-pruef .re-muss button { border-left-color: var(--danger, #dc2626); background: var(--danger-soft, #fee2e2); }
.re-ok { margin: 0 0 8px; color: var(--success, #15803d); font-weight: 600; }
.re-dlg { display: flex; flex-direction: column; gap: 10px; }
.re-dlg .h-field { margin-bottom: 4px; }

/* Listen */
.re-tab { display: flex; flex-direction: column; gap: 8px; }
.re-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-m); background: var(--surface); }
.re-zeile.an { border-color: var(--accent); }
.re-zl { flex: 1 1 320px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; padding: 4px 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.re-zl.re-fest { cursor: default; }
.re-zk { color: var(--muted); flex: 1 1 140px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.re-zb { font-variant-numeric: tabular-nums; font-weight: 600; }
.re-zakt { display: flex; flex-wrap: wrap; gap: 2px; }
.re-jahr { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; font-weight: 600; }

/* E-Rechnung lesen */
.re-drop { text-align: center; border: 2px dashed color-mix(in srgb, var(--accent) 40%, var(--border)); }
.re-lgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
@media (max-width: 600px) { .re-lgrid { grid-template-columns: 1fr; } }
.re-lp { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r-m); background: var(--surface-2); overflow-wrap: anywhere; }
.re-lz { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.re-lz span { color: var(--muted); }
.re-lz b { text-align: right; overflow-wrap: anywhere; }
.re-ltab { overflow-x: auto; }
.re-ltab table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.re-ltab th, .re-ltab td { padding: 8px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.re-ltab th { color: var(--muted); font-size: .8rem; }
.re-ltab td:nth-child(n+3), .re-ltab th:nth-child(n+3) { text-align: right; white-space: nowrap; }
.re-lsum { max-width: 420px; margin: 12px 0 12px auto; }
