/* ==========================================================================
   getmomo Tools — nur die Tool-Bausteine (Kachelgrid, Rechner-Karten,
   eRechnung-Blatt). Rahmen, Tokens, Typografie und Footer kommen aus
   blog.css, das auf jeder Tools-Seite davor geladen wird — die Seiten
   liegen unter /tools/, die Assets im Magazin-Baum (/magazin/assets/).
   ========================================================================== */
:root {
  /* Tool-eigene Tokens — die geteilten (Navy, Primary, Flaechen) kommen aus
     blog.css, das auf jeder Tools-Seite davor geladen wird. */
  --error:      #d94343;
  --success:    #1f8a4c;
  --field-bg:   #f5f5f5;
  --note-bg:    #eeeff9;
  --note-border:#c4c5e4;
  --primary-hi: #6264b5;
}

/* Nummerierte Liste im Rechner-Fliesstext (CO2-Seite): blog.css stylt nur
   ul.bullets, das ol mit Zaehler kommt aus der alten Tools-Fassung. */
ol.bullets { list-style: none; padding: 0; margin: 0 0 48px; display: flex; flex-direction: column; gap: 8px; counter-reset: step; }
ol.bullets li {
  position: relative; padding-left: 28px;
  font-family: var(--font-text); font-size: 20px; line-height: 1.5; color: var(--body);
}
ol.bullets li::before { content: counter(step) "."; position: absolute; left: 0; top: 0; font-weight: 700; color: var(--navy); }

/* --- Hero-Bild der Startseite ------------------------------------------ */
.tools-hero {
  width: 100%; aspect-ratio: 780 / 530; object-fit: contain; margin: 0 0 24px;
}

/* --- Tool-Kachelgrid (Startseite) --------------------------------------
   Das Vorschaubild füllt die komplette Kachel; der dunkle Titelbalken liegt
   halbtransparent darüber (Figma: 76 % Schwarz, 112 px hoch). */
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-bottom: 48px; }
.tool-card {
  position: relative; display: block; aspect-ratio: 378 / 413; overflow: hidden;
  border-radius: var(--radius); text-decoration: none; background: var(--white);
  transition: transform .18s ease, box-shadow .18s ease;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(22,37,56,.16); }
.tool-card:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.tool-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tool-card__label {
  position: absolute; left: 0; right: 0; bottom: 0; height: 112px;
  display: flex; align-items: center; padding: 0 24px;
  background: rgba(0,0,0,.76); color: var(--white);
  font-family: var(--font-text); font-weight: 700; font-size: 16px; line-height: 24px;
  letter-spacing: .5px;
}

/* --- Rechner-Karte ("Eingabe" / "Ergebnis") ---------------------------- */
.toolbox {
  background: var(--white); border-radius: var(--radius); padding: 48px;
  margin: 0 0 24px;
}
.toolbox__label {
  font-family: var(--font-text); font-weight: 700; font-size: 15px; line-height: 24px;
  color: #000; margin: 0 0 24px;
}
.toolbox__group {
  font-family: var(--font-text); font-weight: 700; font-size: 15px; line-height: 24px;
  color: #000; margin: 28px 0 12px;
}
.tool-field { margin: 0 0 24px; }
.tool-field > label {
  display: block; font-family: var(--font-text); font-size: 13px; line-height: 20px;
  color: var(--dim); margin: 0 0 6px;
}
.tool-input, .tool-select {
  width: 100%; height: 48px; padding: 12px 16px;
  background: var(--field-bg); border: 1px solid transparent; border-radius: var(--radius);
  font-family: var(--font-text); font-size: 16px; color: #000;
}
.tool-input { text-align: right; }
.tool-input--left { text-align: left; }
.tool-select {
  appearance: none; text-align: left; cursor: pointer;
  background-image: url("../img/generic/chevron-down.svg");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 12px;
  padding-right: 40px;
}
.tool-input::placeholder { color: #9a9a9a; }
.tool-input:focus, .tool-select:focus { outline: none; border-color: var(--primary); background-color: var(--white); }
.tool-input[aria-invalid="true"] { border-color: var(--error); background-color: #fdf2f2; }
.tool-hint { display: block; font-family: var(--font-text); font-size: 12px; line-height: 18px; color: var(--dim); margin-top: 6px; }
.tool-error {
  display: none; font-family: var(--font-text); font-size: 13px; line-height: 20px;
  color: var(--error); margin-top: 6px;
}
.tool-error.show { display: block; }

.tool-btn {
  width: 100%; height: 48px; border: none; border-radius: var(--radius);
  background: var(--primary); color: var(--white); cursor: pointer;
  font-family: var(--font-text); font-weight: 700; font-size: 15px;
}
.tool-btn:hover { background: var(--primary-hi); }
.tool-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.tool-btn--ghost {
  width: auto; padding: 0 16px; height: 40px; background: var(--white); color: var(--navy);
  border: 1px solid var(--divider); font-weight: 400; font-size: 14px;
}
.tool-btn--ghost:hover { background: #f2f4fd; }

/* Ergebnisblock */
.tool-result { text-align: center; }
.tool-result__value {
  font-family: var(--font-text); font-weight: 700; font-size: 48px; line-height: 60px; color: #000;
  margin: 24px 0 8px;
}
.tool-result__caption {
  font-family: var(--font-text); font-weight: 700; font-size: 15px; line-height: 24px; color: #000; margin: 0;
}
.tool-result__sub {
  font-family: var(--font-text); font-size: 15px; line-height: 24px; color: var(--body); margin: 4px 0 0;
}
.tool-result__sub b { color: #000; }
.tool-result__heading {
  font-family: var(--font-text); font-weight: 700; font-size: 22px; line-height: 32px; color: #000;
  margin: 24px 0 4px;
}
.tool-result__footnote {
  font-family: var(--font-text); font-size: 12px; line-height: 18px; color: var(--dim); margin: 16px 0 0;
}

/* Kennzahlen-Raster und Aufteilungsbalken (CO2-Kostenrechner) */
.tool-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 24px 0 0; text-align: left; }
.tool-stat { background: #f7f8fd; border: 1px solid #e3e5f3; border-radius: var(--radius); padding: 14px 16px; }
.tool-stat__label { font-family: var(--font-text); font-size: 12px; line-height: 18px; color: var(--dim); margin: 0 0 4px; }
.tool-stat__value { font-family: var(--font-text); font-weight: 700; font-size: 22px; line-height: 30px; color: #000; margin: 0; }

.tool-split { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 16px 0 0; }
.tool-split__card { border: 2px solid; border-radius: var(--radius); padding: 20px 16px; text-align: center; }
.tool-split__card--vermieter { border-color: #2a9d90; }
.tool-split__card--mieter    { border-color: var(--primary); }
.tool-split__label { font-family: var(--font-text); font-size: 12px; line-height: 18px; color: var(--dim); margin: 0 0 6px; }
.tool-split__value { font-family: var(--font-text); font-weight: 700; font-size: 26px; line-height: 34px; margin: 0; }
.tool-split__card--vermieter .tool-split__value { color: #2a9d90; }
.tool-split__card--mieter    .tool-split__value { color: var(--primary); }
.tool-split__percent { font-family: var(--font-text); font-weight: 700; font-size: 15px; line-height: 24px; color: #000; margin: 4px 0 0; }

.tool-bar {
  display: flex; height: 44px; margin: 16px 0 0;
  border: 1px solid #e3e5f3; border-radius: var(--radius); overflow: hidden;
}
.tool-bar > span {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-text); font-weight: 700; font-size: 14px; color: var(--white);
  transition: width .25s ease; min-width: 0;
}
.tool-bar__vermieter { background: #2a9d90; }
.tool-bar__mieter    { background: var(--primary); }

/* Hinweisbox innerhalb einer Rechner-Karte */
.tool-note {
  display: flex; gap: 12px; align-items: flex-start; margin: 24px 0 0;
  background: var(--note-bg); border: 1px solid var(--note-border); border-radius: var(--radius);
  padding: 14px 16px; text-align: left;
  font-family: var(--font-text); font-size: 12px; line-height: 18px; color: var(--body);
}
.tool-note svg { flex-shrink: 0; margin-top: 1px; }

/* Haftungsausschluss unter der Rechner-Karte */
.tool-disclaimer {
  font-family: var(--font-text); font-size: 20px; line-height: 30px; color: var(--body); margin: 0;
}

.invoice-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 24px; }
.invoice-actions button {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: var(--radius); border: 1px solid var(--divider); cursor: pointer;
  background: var(--white); color: var(--navy);
  font-family: var(--font-text); font-size: 14px;
}
.invoice-actions button:hover { background: #f2f4fd; }
.invoice-actions .btn-pdf  { background: #1a63d8; border-color: #1a63d8; color: #fff; }
.invoice-actions .btn-pdf:hover  { background: #1552b5; }
.invoice-actions .btn-xml  { background: #17984a; border-color: #17984a; color: #fff; }
.invoice-actions .btn-xml:hover  { background: #13803e; }

.invoice-sheet {
  background: var(--white); border-radius: var(--radius); padding: 48px;
  font-family: var(--font-text); color: #1f2a3a; margin: 0 0 24px;
}
/* DIN-5008-Layout: links die Anschriftzone (auf Höhe des Sichtfensters),
   rechts Logo und Absenderangaben. */
.invoice-head { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.invoice-head__left  { flex: 1 1 300px; min-width: 0; padding-top: 96px; }
.invoice-head__right { flex: 1 1 260px; min-width: 0; }
.invoice-logo {
  width: 100%; max-width: 220px; min-height: 84px; margin: 0 0 24px auto;
  border: 1px dashed var(--divider); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #9a9a9a; overflow: hidden;
}
.invoice-logo img { max-height: 84px; width: auto; }
.invoice-sender {
  font-size: 11px; line-height: 16px; color: #7a7a7a;
  border-bottom: 1px solid #d8d8d8; padding-bottom: 6px; margin-bottom: 12px;
}
.invoice-recipient { font-size: 16px; line-height: 26px; }
.invoice-block-title { font-weight: 700; font-size: 14px; margin: 0 0 10px; }
.invoice-contact-row { font-size: 13px; line-height: 22px; }
.invoice-kv { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 22px; margin-top: 4px; }
.invoice-kv > span:first-child { flex: 1 1 auto; }
.invoice-kv .del, table.invoice-items .del {
  background: none; border: none; cursor: pointer; color: #e03b3b;
  font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: 3px;
}
.invoice-kv .del:hover, table.invoice-items .del:hover { background: #fdeeee; }
.invoice-h2 { font-family: var(--font-text); font-weight: 400; font-size: 26px; line-height: 34px; color: #1f2a3a; margin: 40px 0 16px; }
.invoice-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; font-size: 13px; line-height: 20px; }
.invoice-meta .label { color: #7a7a7a; }

table.invoice-items { width: 100%; border-collapse: collapse; margin: 32px 0 0; font-size: 13px; }
table.invoice-items th {
  text-align: left; font-weight: 700; border-bottom: 1px solid #1f2a3a; padding: 0 8px 8px;
}
table.invoice-items td { padding: 8px; border-bottom: 1px solid #ececec; vertical-align: top; }
table.invoice-items th.num, table.invoice-items td.num { text-align: right; }
table.invoice-items td.act { width: 32px; text-align: right; }

.invoice-totals { margin: 24px 0 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 13px; }
.invoice-totals__row { display: flex; gap: 24px; min-width: 260px; justify-content: space-between; }
.invoice-totals__row--sum { border-top: 1px solid #1f2a3a; padding-top: 8px; font-weight: 700; font-size: 15px; }
.invoice-vat-select {
  border: 1px solid var(--divider); border-radius: var(--radius); background: var(--white);
  font-family: var(--font-text); font-size: 13px; padding: 2px 6px;
}
.invoice-bank { margin: 40px 0 0; font-size: 13px; line-height: 22px; }
.invoice-bank__grid { display: grid; grid-template-columns: 90px 1fr; gap: 2px 12px; max-width: 420px; }
.invoice-bank__grid .label { color: #7a7a7a; }
.invoice-footnote { margin: 32px 0 0; font-size: 11px; line-height: 18px; color: #7a7a7a; }

/* Inline editierbare Felder: im Normalzustand unsichtbar, beim Hovern/Fokus
   als Eingabefeld erkennbar. */
[contenteditable="true"] {
  outline: none; border-radius: 2px; min-width: 24px; display: inline-block;
}
[contenteditable="true"]:hover { background: #f2f4fd; box-shadow: 0 0 0 2px #f2f4fd; }
[contenteditable="true"]:focus { background: #eaeeff; box-shadow: 0 0 0 2px var(--primary); }
[contenteditable="true"]:empty::before { content: attr(data-placeholder); color: #b0b0b0; }
.invoice-sheet.exporting [contenteditable="true"]:hover { background: none; box-shadow: none; }
.invoice-sheet.exporting .no-print { display: none !important; }

.invoice-status {
  font-family: var(--font-text); font-size: 14px; line-height: 22px; margin: 0 0 24px; min-height: 22px;
}
.invoice-status.success { color: var(--success); }
.invoice-status.error   { color: var(--error); }


/* --- Responsive (nur Tool-Bausteine; Rahmen-Regeln stehen in blog.css) --- */
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .tool-disclaimer, ol.bullets li { font-size: 17px; line-height: 26px; }
  .toolbox, .invoice-sheet { padding: 28px 20px; }
  .tool-result__value { font-size: 36px; line-height: 46px; }
  .tool-stats, .tool-split { grid-template-columns: 1fr; }
  .invoice-meta { grid-template-columns: 1fr; }
  .invoice-head__right { flex-basis: 100%; }
  /* Gestapelt braucht die Anschriftzone keinen Sichtfenster-Abstand mehr. */
  .invoice-head__left { padding-top: 0; }
  .invoice-logo { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .tool-card { transition: none; } }
@media print {
  .no-print, .titlebar, .railbar, .drawer, .scrim, footer, .invoice-actions { display: none !important; }
  body { background: #fff; padding-left: 0; }
  .invoice-sheet { padding: 0; }
}
