/* KUKANILEA Webtools — Break-Even-Rechner. Eigenständige Subdomain, eigenes Mini-Design-
   System (Tokens 1:1 aus kukanilea-fahrtenbuch/styles.css übernommen — Kanon, nicht neu
   erfunden — volle Unabhängigkeit der Subdomain, identische Tokens wie andere Themen). */

:root {
  --cream: #ffffff;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --ink-3: #475569;
  --ink-4: #5a6678;
  --line: #e6ebf1;
  --line-2: #cbd5e1;
  --white: #ffffff;
  --paper: #f4f6f9;
  --blue: #1B4965;
  --blue-2: #123449;
  --blue-soft: #d7e3ea;
  --blue-tint: #eef3f6;
  --green: #18553a;
  --green-soft: #e4f1e9;
  --warn-ink: #97491a;
  --warn-soft: #fde9d4;
  --red-ink: #8a1f2b;
  --red-soft: #fbe0e2;

  --radius: 14px;
  --radius-lg: 20px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 0 rgba(15,23,42,.04), 0 1px 2px rgba(15,23,42,.05);
  --shadow: 0 1px 0 rgba(15,23,42,.04), 0 12px 28px -16px rgba(15,23,42,.16);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", "SF Mono", "IBM Plex Mono", monospace;
  --maxw: 880px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html body [hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.wide { max-width: 1080px; }

a { color: var(--blue); }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--blue); color: var(--white); padding: 10px 16px; z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ── Header ── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.brand-sub { font-size: 11px; color: var(--ink-4); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.brand-sub.tool-suite { color: var(--blue); }

.header-actions a.text-link { font-size: 14px; font-weight: 600; text-decoration: none; }

@media (max-width: 720px) {
  .header-row { flex-wrap: wrap; }
}

/* ── Hero / intro ── */
.tool-hero { padding: 44px 0 8px; }
.tool-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--blue); margin-bottom: 10px;
}
.tool-hero h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.01em; }
.tool-hero p.lede { font-size: 17px; color: var(--ink-3); max-width: 60ch; margin: 0 0 0; }

.privacy-note {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 22px 0 0;
  padding: 14px 16px;
  background: var(--blue-tint);
  border: 1px solid var(--blue-soft);
  border-radius: var(--radius);
  font-size: 14px; color: var(--blue-2);
}
.privacy-note svg { flex: none; margin-top: 2px; }

/* ── Tool card / workspace ── */
.tool-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  margin: 28px 0 40px;
}
.tool-card-title { margin: 0 0 4px; font-size: 17px; }
.tool-card-hint { margin: 0 0 14px; font-size: 14px; color: var(--ink-3); }

.tool-actions { display: flex; align-items: center; gap: 14px; margin-top: 20px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px; font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--blue-2); }
.btn-primary:disabled { background: var(--line-2); color: var(--ink-4); cursor: not-allowed; }
.btn-ghost { background: var(--white); color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line-2); color: var(--ink-2); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.tool-status { font-size: 14px; color: var(--ink-3); min-height: 1.4em; }
.tool-status[data-state="error"] { color: var(--warn-ink); }
.tool-status[data-state="done"] { color: var(--green); font-weight: 600; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 40px;
  margin-top: 40px;
}
.ft-row {
  display: flex; flex-wrap: wrap; gap: 10px 24px;
  align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--ink-4);
}
.ft-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.ft-links a { color: var(--ink-4); text-decoration: none; }
.ft-links a:hover { color: var(--blue); }
.brand-note {
  max-width: var(--maxw);
  margin: 18px auto 0;
  padding: 0 20px;
  font-size: 12px; color: var(--ink-4);
}
.brand-note a { color: var(--ink-4); text-decoration: underline; }

/* ── Formular ── */
.form-field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 20px; }
.form-field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form-field input[type="text"], .form-field input[type="number"], .form-field input[type="date"], .form-field select {
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 16px;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--white);
  max-width: 280px;
}
.form-field select { appearance: auto; cursor: pointer; }
.form-field input:focus, .form-field select:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint);
}
.form-field input:disabled { background: var(--paper); color: var(--ink-4); cursor: not-allowed; }
.field-hint { font-size: 13px; color: var(--ink-4); margin: 0; }

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px 20px;
  margin: 0 0 4px;
}

/* ── Warnhinweis (Deckungsbeitrag <= 0) ── */
.warn-banner {
  margin: 18px 0 0;
  padding: 14px 16px;
  background: var(--red-soft);
  border: 1px solid #f0b9bf;
  border-radius: var(--radius);
  font-size: 14px; color: var(--red-ink);
}
.warn-banner strong { display: inline; }

/* ── Ergebnis-Kacheln (allgemein) ── */
.result-block { margin-top: 22px; }
.result-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.stat {
  background: var(--blue-tint);
  border: 1px solid var(--blue-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.stat.is-primary { background: var(--blue); border-color: var(--blue-2); }
.stat.is-primary .stat-label { color: rgba(255,255,255,.75); }
.stat.is-primary .stat-value { color: var(--white); }
.stat-label { font-size: 12px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--blue-2); margin-top: 4px; }
.stat-sub { font-size: 12.5px; color: var(--ink-4); margin-top: 2px; }

/* ── Sicherheitsabstand ── */
.safety-block { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.safety-block .stat.is-positive { background: var(--green-soft); border-color: #bfe0cd; }
.safety-block .stat.is-positive .stat-value { color: var(--green); }
.safety-block .stat.is-negative { background: var(--red-soft); border-color: #f0b9bf; }
.safety-block .stat.is-negative .stat-value { color: var(--red-ink); }
.safety-note { margin: 12px 0 0; font-size: 13.5px; color: var(--ink-3); }

/* ── Diagramm (Vanilla-SVG, keine Chart-Bibliothek) ── */
.chart-wrap { margin-top: 22px; }
.chart-caption { margin: 0 0 8px; font-size: 12.5px; color: var(--ink-4); }
#beChart {
  display: block; width: 100%; height: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 16px; height: 3px; display: inline-block; border-radius: 2px; }
.legend-swatch.is-kosten { background: var(--red-ink); }
.legend-swatch.is-erloes { background: var(--blue); }
.legend-swatch.is-be { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }

/* ── FAQ (native <details>, kein JS nötig) ── */
.faq-list { display: flex; flex-direction: column; gap: 2px; }
.faq-item {
  border-top: 1px solid var(--line);
  padding: 4px 0;
}
.faq-item:first-child { border-top: none; }
.faq-item summary {
  cursor: pointer; font-weight: 700; font-size: 15px; padding: 12px 4px;
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 20px; color: var(--blue); flex: none; }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { margin: 0 4px 16px; font-size: 14.5px; color: var(--ink-3); }

.source-note { font-size: 12.5px; color: var(--ink-4); margin-top: 16px; }
.source-note a { color: var(--ink-4); text-decoration: underline; }

@media (max-width: 520px) {
  .tool-card { padding: 20px; }
}

/* ── Druckansicht (A4, Pflicht) ── */
.print-footer-note { display: none; }

@media print {
  @page { size: A4; margin: 16mm; }
  .site-header, .site-footer, .tool-actions, .privacy-note, .tool-kicker { display: none; }
  body { background: var(--white); }
  .tool-card { box-shadow: none; border: none; padding: 0; margin: 0 0 20px; }
  .faq-list { display: none; }
  .source-note { display: none; }
  a[href]::after { content: ""; }
  .print-footer-note {
    display: block;
    margin-top: 18px;
    padding-top: 10px;
    border-top: 1px solid var(--line-2);
    font-size: 11px; color: var(--ink-4);
  }
}
