/* Abrechnung page overrides */
html, body{overflow-x:hidden}
.card{min-width:0}
.table-wrap{min-width:0; width:100%; max-width:100%; overflow-x:auto; overflow-y:visible; max-height:none}
.calc-table{width:max-content; min-width:1900px; border-collapse:collapse; font-size:12px}
.calc-table th,.calc-table td{border-bottom:1px solid rgba(255,255,255,.08); padding:5px 6px; text-align:left; vertical-align:middle}
.calc-table th{font-size:11px; color:var(--muted)}
.calc-table thead th{position:sticky; top:0; z-index:2; background:var(--card); box-shadow:0 2px 0 rgba(0,0,0,.35)}
.calc-table input{min-width:7ch; width:auto; max-width:100%}
.calc-table select{min-width:7ch; width:auto; max-width:100%}
.calc-table .num{text-align:right; white-space:nowrap}
.calc-table .name{min-width:150px}
.summary{display:grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap:10px; margin-top:10px}
.summary .stat{background:rgba(0,0,0,.16); border:1px solid rgba(255,255,255,.08); border-radius:12px; padding:8px}
.summary .stat .k{font-size:11px; color:var(--muted)}
.summary .stat .v{font-size:14px; font-weight:700}
.row-inline{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.small-input{max-width:140px}
#data-warning{margin-top:8px}

/* Projekt-Kontrollzeile: Felder sauber einpassen */
.project-controls{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:14px;
}

.project-controls > label{
  display:inline-flex;
  align-items:center;
  gap:8px;
  white-space:nowrap;
  font-weight:600;
}

.project-controls > label > select,
.project-controls > label > input{
  width:auto !important;
}

.project-controls .small-input{
  max-width:none !important;
}

.project-controls #f-group{
  min-width:250px;
}

.project-controls #f-print-speaker{
  min-width:250px;
}

.project-controls #f-kv-rate{
  min-width:250px;
}

.project-controls #f-type{
  min-width:130px;
  max-width:130px;
}

.project-controls #f-ust{
  min-width:110px;
  max-width:110px;
}

@media print{
  *{-webkit-print-color-adjust: exact; print-color-adjust: exact; color:#000 !important;}
  .table-wrap{max-height:none; overflow:visible}
  body{font-family:Arial, Helvetica, sans-serif; font-size:10pt; color:#000}
  .calc-table{font-size:9pt}
}

/* Invoice / print layout */
.invoice{font:10pt/1.35 Arial, Helvetica, sans-serif; color:#000}
.inv-top{display:flex; justify-content:space-between; align-items:flex-start; gap:10mm}
.inv-left{min-width:60%}
.inv-right{text-align:right; min-width:30%}
.inv-small{font-size:9pt; color:#444}
.inv-company{font-size:10pt; font-weight:700; margin:1mm 0}
.inv-date{font-size:8.5pt; font-weight:600}
.inv-title{font-size:11pt; font-weight:800; margin:5mm 0 2mm}
.inv-sub{font-size:9pt; margin-bottom:4mm}
.inv-columns{display:grid; grid-template-columns: 1fr 1fr; gap:10mm; margin-bottom:4mm}
.inv-section{font-weight:700; margin-bottom:1mm}
.inv-meta{font-size:8.5pt}
.inv-row{display:flex; justify-content:space-between; gap:6mm; border-bottom:1px solid #eee; padding:1mm 0}
.inv-table{width:100%; border-collapse:collapse; margin:4mm 0}
.inv-table th,.inv-table td{border-bottom:1px solid #000; padding:2mm 1.5mm; text-align:left}
.inv-table th{font-size:8.5pt; color:#000; background:transparent}
.inv-table .num{text-align:right}
.inv-totals{margin-top:3mm; border-top:1px solid #ccc; padding-top:2mm}
.inv-line{display:flex; justify-content:space-between; gap:8mm; padding:1mm 0}
.inv-strong{font-weight:800; border-top:1px solid #999; margin-top:2mm; padding-top:2mm}
.inv-footer{margin-top:6mm; font-size:7.5pt; color:#000}


/* Active row highlight */
.calc-table tr.row-paid td{
  background: rgba(88, 191, 123, .14);
}
.calc-table tr.row-paid td input,
.calc-table tr.row-paid td select{
  border-color: rgba(88, 191, 123, .45);
}
.calc-table tr.row-active td{
  background: rgba(95,163,255,.14);
}
.calc-table tr.row-active td input,
.calc-table tr.row-active td select{
  border-color: rgba(95,163,255,.45);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.topbar{left:0; right:0}

/* UI refresh 2026-02 */
.calc-table th,.calc-table td{border-bottom:1px solid rgba(120,160,220,.22)}
.calc-table th{color:var(--muted)}
.calc-table thead th{
  background:linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  box-shadow:0 2px 0 rgba(95,163,255,.25);
}
.summary .stat{
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border:1px solid rgba(120,160,220,.25);
}
.calc-table tr.row-active td{
  background:rgba(95,163,255,.14);
}
.invoice{
  font-family:"IBM Plex Sans","Fira Sans","Segoe UI",sans-serif;
}


#calc-table{min-width:1900px}
#calc-table input[type="number"]{min-width:6ch}
#calc-table input[data-field="ust_id"],
#calc-table input[data-field="steuer_nr"],
#calc-table input[data-field="versicherungsnr"],
#calc-table input[data-field="sozialversnr"]{min-width:9ch}
#calc-table input[data-field="iban"]{min-width:16ch}
#calc-table input[data-field="bic"]{min-width:9ch}
#calc-table input[data-field="gutschrift_nr"]{min-width:11ch}
#calc-table input[data-field="taetigkeit"]{min-width:13ch}
#calc-table input[data-field="taetigkeit_nr"]{min-width:8ch}
#calc-table input[data-field="bezahlt"]{min-width:9ch}
#calc-table input[data-field="betrag_bezahlt"]{min-width:8ch}
#calc-table select.small-input{min-width:7ch}
#calc-table select[data-field="kasse"]{min-width:12ch}


/* Extras (Studio/Tonmeister) */
.extras-table{min-width:900px}
.extras-table .num{text-align:right; white-space:nowrap}
.extras-table .btn.small{padding:4px 8px; font-size:11px}
.extras-wrap{max-height:none}

.extras-table input{min-width:8ch}
.extras-table select{min-width:7ch}
.extras-table input[data-extra-field="invoice_no"],
.extras-table input[data-extra-field="steuer_nr"]{min-width:9ch}
.extras-table input[data-extra-field="paid_date"]{min-width:11ch}
.extras-table input[data-extra-field="iban"]{min-width:15ch}
.extras-table input[data-extra-field="bic"]{min-width:9ch}
.extras-table input[data-extra-field="bank"]{min-width:10ch}
.extras-table input[data-extra-field="note"]{min-width:12ch}


/* Kassenuebersicht */
.kassen-table{min-width:1260px}
.kassen-table .num{text-align:right; white-space:nowrap}
.kassen-wrap{max-height:none}
.kassen-table input{min-width:8ch}
.kassen-table input[data-field="betriebsnummer"]{min-width:9ch}
.kassen-table input[data-field="iban"]{min-width:16ch}
.kassen-table input[data-field="bic"]{min-width:9ch}
.kassen-table input[data-field="bank"]{min-width:10ch}
.kassen-table input[data-field="bezahlt"]{min-width:10ch}
.kassen-table input[data-field="portal_url"],
.kassen-table input[data-field="zahlung_url"]{min-width:18ch}

.kassen-table tr.kassen-total td{font-weight:700; border-top:2px solid rgba(255,255,255,.25)}
.kassen-sheet .kassen-total td{border-top:2px solid #999}

/* Solid header for Abrechnung table */
#calc-table thead th{background:#121b33; box-shadow:0 2px 0 rgba(0,0,0,.35)}
#calc-table tfoot td{
  border-top:2px solid rgba(95,163,255,.45);
  border-bottom:none;
  background:rgba(10,24,52,.92);
  font-weight:700;
}
#calc-table tfoot .num{font-variant-numeric:tabular-nums}
#calc-table tfoot tr.calc-total-row td:first-child{letter-spacing:.2px}


.kassen-note{margin:8px 0 12px; padding:10px 12px; border-radius:10px; background:rgba(20,30,55,.85); border:1px solid rgba(120,160,220,.25); font-size:12px; line-height:1.35}
.kassen-note b{color:var(--text)}
.kassen-note .muted{color:var(--muted)}
.inv-note{margin:3mm 0 4mm; font-size:9.5pt; color:#333}
.kassenmeldung-sheet .inv-table th,
.kassenmeldung-sheet .inv-table td{font-size:7.6pt; padding:1mm .9mm; white-space:nowrap}
.kassenmeldung-sheet .inv-table td:nth-child(2),
.kassenmeldung-sheet .inv-table td:nth-child(9){white-space:normal}


.kasse-link{display:inline-block; padding:4px 8px; border-radius:8px; background:rgba(95,163,255,.18); border:1px solid rgba(95,163,255,.4); color:#eaf2ff; text-decoration:none; font-weight:600; font-size:11px}
.kasse-link:hover{background:rgba(95,163,255,.3)}


@media print{
  .sheet.invoice{
    padding:7mm 8mm !important;
    font:9pt/1.2 Arial, Helvetica, sans-serif !important;
    page-break-inside:avoid;
    break-inside:avoid-page;
  }
  .invoice .inv-top{gap:6mm; margin-bottom:1mm}
  .invoice .inv-small{font-size:8pt}
  .invoice .inv-company{font-size:9pt; margin:.6mm 0}
  .invoice .inv-date{font-size:7.5pt}
  .invoice .inv-title{font-size:10pt; margin:2.5mm 0 1.5mm}
  .invoice .inv-sub{font-size:8.5pt; margin-bottom:2mm}
  .invoice .inv-columns{gap:6mm; margin-bottom:2mm}
  .invoice .inv-meta{font-size:8pt}
  .invoice .inv-row{padding:.35mm 0}
  .invoice .inv-table{margin:2mm 0}
  .invoice .inv-table th,
  .invoice .inv-table td{padding:1mm 1mm}
  .invoice .inv-totals{margin-top:1.5mm; padding-top:1.2mm}
  .invoice .inv-line{padding:.6mm 0}
  .invoice .inv-footer{margin-top:2mm; font-size:7pt}
}


/* No inner scroll in Abrechnung */
.card{overflow:visible}

/* Abrechnung compact pass 2026-02-20 */
body.page-abrechnung .table-wrap{
  overflow-x:auto;
  overflow-y:visible;
}

body.page-abrechnung .calc-table{
  min-width:1580px;
  font-size:11px;
}

body.page-abrechnung #calc-table{
  min-width:1580px;
}

body.page-abrechnung .calc-table th,
body.page-abrechnung .calc-table td{
  padding:4px 5px;
}

body.page-abrechnung .calc-table .name{
  min-width:120px;
}

body.page-abrechnung #calc-table input,
body.page-abrechnung #calc-table select,
body.page-abrechnung .extras-table input,
body.page-abrechnung .extras-table select,
body.page-abrechnung .kassen-table input,
body.page-abrechnung .kassen-table select{
  font-size:11px;
  min-height:28px;
  padding:4px 6px;
}

body.page-abrechnung .small-input{
  max-width:110px;
}

body.page-abrechnung .extras-table{
  min-width:640px;
}

body.page-abrechnung .outgoing-table{
  min-width:640px;
}

body.page-abrechnung .outgoing-table input,
body.page-abrechnung .outgoing-table select{
  font-size:11px;
  min-height:28px;
  padding:4px 6px;
}

body.page-abrechnung .outgoing-table input[data-out-field="customer"]{min-width:10ch;}
body.page-abrechnung .outgoing-table select[data-out-field="customer"]{min-width:12ch;}
body.page-abrechnung .outgoing-table input[data-out-field="invoice_no"]{min-width:9ch;}
body.page-abrechnung .outgoing-table input[data-out-field="sent_date"],
body.page-abrechnung .outgoing-table input[data-out-field="paid_date"]{min-width:9ch;}
body.page-abrechnung .outgoing-table select[data-out-field="vatRate"]{min-width:8ch;}
body.page-abrechnung .outgoing-table [data-out-cell="vat"],
body.page-abrechnung .outgoing-table [data-out-cell="gross"],
body.page-abrechnung .outgoing-table [data-out-cell="open"]{
  font-variant-numeric:tabular-nums;
}

body.page-abrechnung .kassen-table{
  min-width:840px;
}

body.page-abrechnung .extras-table input[data-extra-field="note"]{
  min-width:10ch;
}

body.page-abrechnung .kassen-table input[data-field="portal_url"],
body.page-abrechnung .kassen-table input[data-field="zahlung_url"]{
  min-width:12ch;
}

body.page-abrechnung .outgoing-modal{
  position:fixed;
  inset:0;
  z-index:2200;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

body.page-abrechnung .outgoing-modal.hidden{
  display:none;
}

body.page-abrechnung .outgoing-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(4,10,24,.72);
  backdrop-filter:blur(2px);
}

body.page-abrechnung .outgoing-modal-card{
  position:relative;
  width:min(760px, 96vw);
  max-height:90vh;
  overflow:auto;
  border:1px solid rgba(150,190,255,.38);
  box-shadow:0 18px 56px rgba(0,0,0,.55);
}

body.page-abrechnung .outgoing-modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

body.page-abrechnung .outgoing-modal-header h3{
  margin:0;
  font-size:18px;
  color:#f7fbff;
}

body.page-abrechnung .outgoing-modal-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(180px, 1fr));
  gap:10px 12px;
}

body.page-abrechnung .outgoing-modal-grid label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:#eef6ff;
}

body.page-abrechnung .outgoing-modal-grid input{
  min-height:32px;
}

body.page-abrechnung .outgoing-modal-grid select{
  min-height:32px;
}

body.page-abrechnung .outgoing-modal-grid input[readonly]{
  background:rgba(12,18,34,.9);
  border-color:rgba(150,190,255,.38);
  color:#f7fbff;
}

body.page-abrechnung .outgoing-modal-upload{
  grid-column:1 / -1;
}

body.page-abrechnung .outgoing-modal-actions{
  margin-top:12px;
}

@media (max-width: 700px){
  body.page-abrechnung .outgoing-modal-grid{
    grid-template-columns:1fr;
  }
}

@media print{
  body.page-abrechnung .outgoing-modal{
    display:none !important;
  }
}


/* Scroll calc table after threshold rows */
body.page-abrechnung #calc-table-wrap.rows-scroll{
  overflow-y:auto !important;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-gutter:stable both-edges;
}
body.page-abrechnung #calc-table-wrap.rows-scroll::-webkit-scrollbar{
  width:10px;
  height:10px;
}

.calc-table tr.row-paid.row-active td{
  background: rgba(95,163,255,.18);
}

.billing-actions-inline{margin-bottom:10px;flex-wrap:wrap}
.kassenmeldung-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4mm;margin-top:4mm}
.kassenmeldung-card{border:1px solid #cfd5e3;border-radius:3mm;padding:3mm 3.2mm;break-inside:avoid-page;page-break-inside:avoid;background:#fff}
.kassenmeldung-card-title{font-weight:800;font-size:9pt;margin-bottom:1.6mm}
.kassenmeldung-card .inv-row{font-size:7.8pt;gap:3mm}
.kassenmeldung-card .inv-row span:first-child{font-weight:700;min-width:34%}
.kassenmeldung-card .inv-row span:last-child{text-align:right;flex:1}
@media print{
  .kassenmeldung-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:3mm}
  .kassenmeldung-card{padding:2.4mm 2.6mm}
}
@media (max-width: 900px){
  .kassenmeldung-grid{grid-template-columns:1fr}
}
