/* /rechner/ page (ET-12). Builds on site.css tokens. Green text and buttons use #15803D for 4.5:1 contrast. */
:root { --green-text: #15803D; --green-dark: #166534; --loss: #B91C1C; --best-bg: #F0FDF4; --line: #F0EFEA; --field: #D1D0CA; }

[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-link.is-current { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 6px; }

.rechner-page { padding-top: 60px; }
.rechner-wrap { max-width: 1160px; margin: 0 auto; padding: 3.5rem 2rem 0; }
.rechner-head { max-width: 760px; margin-bottom: 2.5rem; }
.rechner-kicker { font-size: 13px; font-weight: 600; color: var(--green-text); margin-bottom: 0.75rem; }
.rechner-head h1 { font-size: clamp(2.1rem, 4vw, 3rem); margin-bottom: 1rem; }
.rechner-intro { font-size: 18px; line-height: 1.6; color: var(--ink-2); }
.scope-note { margin-top: 1rem; font-size: 14px; line-height: 1.55; color: var(--ink-2); background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; display: inline-block; }
.scope-note strong { color: var(--ink); }

.rechner-grid { display: flex; flex-wrap: wrap; gap: 2rem; align-items: flex-start; }
.rechner-form { flex: 1 1 340px; max-width: 400px; background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 1.75rem; display: flex; flex-direction: column; gap: 1.25rem; }
.rechner-result { flex: 999 1 560px; min-width: 0; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field legend { font-size: 14px; font-weight: 600; color: var(--ink); }
.help { font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.input-unit { display: flex; align-items: center; border: 1px solid var(--field); border-radius: 8px; background: var(--white); }
.input-unit:focus-within, .field select:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.input-unit input { flex: 1; min-width: 0; border: 0; padding: 12px 14px; font: 16px 'Inter', sans-serif; color: var(--ink); background: transparent; outline: none; }
.input-unit span { padding: 0 14px; color: var(--ink-3); font-size: 15px; }
.field select { border: 1px solid var(--field); border-radius: 8px; padding: 12px 14px; font: 16px 'Inter', sans-serif; color: var(--ink); background: var(--white); outline: none; }
fieldset.field { border: 0; }
.vat-choice { display: flex; gap: 8px; margin-top: 8px; }
.vat-choice label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid var(--field); border-radius: 8px; font-size: 15px; font-weight: 500; cursor: pointer; }
.vat-choice label:has(input:checked) { border: 2px solid var(--ink); font-weight: 600; }
.vat-choice input, .check input { accent-color: var(--ink); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--ink-2); cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }
.check strong { color: var(--ink); }
.vat-disabled { opacity: 0.5; }

details.more { border-top: 1px solid var(--border); padding-top: 1rem; }
details.more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); margin: 0 4px 4px; transition: transform 0.2s; }
details.more[open] summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
.more-fields { display: flex; flex-direction: column; gap: 1.25rem; padding-top: 0.75rem; }

.result-heading { font-family: 'Lora', serif; font-size: 26px; font-weight: 600; margin-bottom: 1rem; }
.result-empty { background: var(--white); border: 1px dashed var(--field); border-radius: 12px; padding: 2.5rem 1.5rem; text-align: center; color: var(--ink-3); font-size: 15px; }
.result-alert { background: #FEF2F2; border: 1px solid #FECACA; color: #7F1D1D; border-radius: 12px; padding: 14px 16px; font-size: 15px; line-height: 1.5; margin-bottom: 1rem; }
.result-table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--border); border-radius: 12px; }
.result-table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.result-table th, .result-table td { padding: 12px 16px; text-align: right; }
.result-table td, .result-card dd, .card-profit { white-space: nowrap; }
.result-table th:first-child { text-align: left; font-weight: 400; color: var(--ink-2); padding-left: 20px; }
.result-table thead th { padding-top: 18px; padding-bottom: 12px; font-weight: 600; color: var(--ink); vertical-align: bottom; }
.result-table tbody tr { border-top: 1px solid var(--line); }
.result-table .is-best { background: var(--best-bg); }
.result-table tbody tr th[title] { cursor: help; text-decoration: underline dotted var(--ink-4); text-underline-offset: 4px; }
.result-table .row-profit { border-top: 2px solid var(--ink); }
.result-table .row-profit th, .result-table .row-profit td { font-weight: 700; font-size: 17px; color: var(--ink); padding-top: 14px; padding-bottom: 14px; }
.result-table .row-profit td.is-best { color: var(--green-text); }
.result-table td.is-loss, .result-table .row-profit td.is-loss { color: var(--loss); }
.result-table .row-margin { border-top: 0; }
.best-badge { display: block; font-size: 12px; font-weight: 600; color: var(--green-text); margin-bottom: 4px; }
.result-notes { list-style: none; margin-top: 1rem; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.result-loss-note { margin-top: 0.75rem; font-size: 14px; color: var(--loss); font-weight: 500; }

.result-cards { display: none; flex-direction: column; gap: 12px; font-variant-numeric: tabular-nums; }
.result-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.result-card.is-best { border: 2px solid var(--green-text); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.card-head h3 { font-size: 17px; font-weight: 600; }
.card-profit { font-size: 20px; font-weight: 700; }
.card-profit.is-loss, .card-loss { color: var(--loss); }
.card-loss { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.result-card dl { display: grid; grid-template-columns: 1fr auto; row-gap: 6px; column-gap: 12px; font-size: 14px; color: var(--ink-2); }
.result-card dd { text-align: right; }
.card-note { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.5; color: var(--ink-2); }

.fine-print { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.6; color: var(--ink-3); }
.fine-print p:first-child { color: var(--ink-2); }
.fine-print a { color: var(--green-text); }

.rechner-about { font-size: 15px; line-height: 1.55; color: var(--ink-2); border-left: 0; padding: 0 0 1rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); max-width: 640px; }

.btn-primary { display: inline-block; background: var(--green-text); color: var(--white); font: 600 16px 'Inter', sans-serif; padding: 14px 22px; border-radius: 8px; text-decoration: none; border: 0; cursor: pointer; }
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:disabled { background: #9CA3AF; cursor: not-allowed; }
.btn-secondary { display: inline-block; background: var(--white); color: var(--ink); font: 600 15px 'Inter', sans-serif; padding: 13px 20px; border-radius: 8px; border: 1px solid var(--field); cursor: pointer; text-decoration: none; }
.btn-link { background: none; border: 0; padding: 12px 4px; font: 500 14px 'Inter', sans-serif; color: var(--ink-2); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; min-height: 44px; }

.save-box { margin-top: 1.25rem; background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.save-box .field { flex: 1 1 240px; }
.save-box .help { flex-basis: 100%; }
.list-status { flex-basis: 100%; font-size: 14px; font-weight: 600; color: var(--green-text); min-height: 0; }
.list-status:empty { display: none; }

.list-section { margin-top: 3.5rem; background: var(--white); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.list-inner { max-width: 1160px; margin: 0 auto; padding: 3rem 2rem; }
.list-section h2 { font-family: 'Lora', serif; font-size: 28px; font-weight: 600; margin-bottom: 0.4rem; }
.list-hint, .list-note { font-size: 14px; color: var(--ink-3); }
.list-summary { margin-top: 1.25rem; font-size: 17px; font-weight: 600; color: var(--ink); }
.list-summary.has-loss { color: var(--loss); }
.list-note { margin: 4px 0 12px; }
.list-table th:first-child { color: var(--ink); font-weight: 600; }
.list-cat { display: block; font-size: 12px; font-weight: 400; color: var(--ink-3); margin-top: 2px; }
.list-actions { width: 48px; padding-left: 0 !important; }
.list-remove { width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink-3); font-size: 16px; border-radius: 8px; cursor: pointer; }
.list-remove:hover { background: var(--cream-2, #F3F2EE); color: var(--ink); }
.list-cards { display: none; flex-direction: column; gap: 12px; }
.list-cards .card-head { align-items: center; }
.list-cards .list-cat { margin: -4px 0 10px; }
.list-full { margin-top: 12px; font-size: 14px; color: var(--loss); }
.list-buttons { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 1.5rem; }
.list-pilot { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; font-size: 15px; color: var(--ink-2); }
.print-head { display: none; }

@media (max-width: 720px) {
  .save-box .btn-primary { width: 100%; }
  .list-inner { padding: 2.25rem 1.25rem; }
  .list-table-wrap { display: none; }
  .list-cards { display: flex; }
  .list-buttons .btn-primary, .list-buttons .btn-secondary { width: 100%; text-align: center; }
}

@media print {
  nav, footer, .rechner-wrap, .list-buttons, .list-pilot, .list-hint, .list-remove, .list-actions, .rechner-disclaimer, .jump-result { display: none !important; }
  .rechner-page { padding-top: 0; }
  body { background: #fff; }
  .list-section { margin: 0; border: 0; }
  .list-inner { padding: 0; }
  .print-head { display: flex; justify-content: space-between; font-size: 12px; color: #374151; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #ccc; }
  .list-table-wrap { display: block !important; border: 0; overflow: visible; }
  .list-cards { display: none !important; }
  .list-table { min-width: 0; font-size: 12px; }
  .list-table th, .list-table td { padding: 6px 8px; }
  .list-section::after { content: attr(data-print-foot); display: block; margin-top: 12px; font-size: 10px; color: #6B7280; }
}
.confirm-note { background: #F0FDF4; border: 1px solid #BBF7D0; color: #14532D; border-radius: 10px; padding: 12px 16px; font-size: 15px; line-height: 1.5; margin-bottom: 1.25rem; }

.popup { position: fixed; right: 24px; bottom: 24px; z-index: 300; width: min(420px, calc(100vw - 32px)); background: var(--white); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 40px rgba(17, 24, 39, 0.18); padding: 22px 22px 18px; opacity: 0; transform: translateY(12px); transition: opacity 0.25s ease, transform 0.25s ease; }
.popup.is-open { opacity: 1; transform: none; }
.popup-close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 8px; font-size: 16px; color: var(--ink-3); cursor: pointer; }
.popup-close:hover { background: #F3F2EE; color: var(--ink); }
.popup-title { font-family: 'Lora', serif; font-size: 21px; line-height: 1.3; font-weight: 600; color: var(--ink); margin: 0 36px 8px 0; }
.popup-text { font-size: 15px; line-height: 1.55; color: var(--ink-2); margin-bottom: 14px; }
.popup-form label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.popup-row { display: flex; gap: 8px; flex-wrap: wrap; }
.popup-row input { flex: 1 1 200px; min-width: 0; border: 1px solid var(--field); border-radius: 8px; padding: 12px 14px; font: 16px 'Inter', sans-serif; color: var(--ink); }
.popup-row input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.popup-row .btn-primary { flex: 0 0 auto; }
.popup-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.popup-msg { font-size: 14px; line-height: 1.5; margin-top: 10px; }
.popup-msg:empty { display: none; }
.popup-msg.is-error { color: var(--loss); }
.popup-msg.is-done { color: #14532D; font-size: 15px; }
.popup-small { font-size: 12px; line-height: 1.5; color: var(--ink-3); margin-top: 10px; }
.popup-small a { color: var(--ink-2); }
@media (max-width: 720px) {
  .popup { right: 0; left: 0; bottom: 0; width: auto; border-radius: 16px 16px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); }
  .popup-row .btn-primary { width: 100%; }
}
@media print { .popup, .confirm-note { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .popup { transition: none; } }
.jump-result { display: none; }
.rechner-disclaimer { max-width: 1160px; margin: 0 auto; padding: 2rem; font-size: 13px; line-height: 1.6; color: var(--ink-3); }

@media (max-width: 720px) {
  .rechner-wrap { padding: 2rem 1.25rem 0; }
  .rechner-intro { font-size: 16px; }
  .rechner-form { max-width: none; padding: 1.25rem; flex: 1 1 100%; min-width: 0; }
  .jump-result { display: flex; align-items: center; justify-content: center; min-height: 48px; background: var(--ink); color: var(--white); border-radius: 8px; font-weight: 600; text-decoration: none; }
  .result-table-wrap.main-table { display: none; }
  .result-cards { display: flex; }
  .result-notes { display: none; }
  .result-loss-note { display: none; }
  .rechner-disclaimer { padding: 1.5rem 1.25rem 2rem; }
}
