/* KUKANILEA Webtools — XRechnung-/ZUGFeRD-Viewer. Eigenstaendige Subdomain, eigenes Mini-Design-
   System (Tokens 1:1 aus kukanilea-fahrtenbuch/styles.css uebernommen — Kanon, nicht neu
   erfunden — volle Unabhaengigkeit 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; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@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; }

/* ── Abgrenzung Viewer-vs-Validator (kritischer Hinweis, keine Konformitaets-Suggestion) ── */
.scope-note {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 14px 0 0;
  padding: 14px 16px;
  background: var(--warn-soft);
  border: 1px solid #f3d3ab;
  border-radius: var(--radius);
  font-size: 14px; color: var(--warn-ink);
}
.scope-note svg { flex: none; margin-top: 2px; }
.scope-note a { color: var(--warn-ink); font-weight: 700; }

/* ── 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); }

/* ── Upload / Dropzone ── */
.dropzone {
  border: 2px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--paper);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--blue); background: var(--blue-tint); }
.dropzone:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.dropzone-icon { color: var(--blue); margin: 0 0 10px; }
.dropzone-text { font-size: 14.5px; color: var(--ink-2); font-weight: 600; margin: 0 0 4px; }
.dropzone-hint { font-size: 12.5px; color: var(--ink-4); margin: 0; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.file-meta-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper);
  font-size: 13.5px; color: var(--ink-2);
}
.file-meta-name { font-weight: 700; word-break: break-all; }
.file-meta-size { color: var(--ink-4); font-size: 12.5px; }

/* ── Ergebnis: Rechnungs-Tabelle ── */
.invoice-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px 24px;
  margin: 0 0 20px;
}
.invoice-summary-block h3 {
  margin: 0 0 6px; font-size: 12px; color: var(--ink-4); text-transform: uppercase;
  letter-spacing: .04em; font-weight: 700;
}
.invoice-summary-block p { margin: 0 0 2px; font-size: 14px; color: var(--ink-2); }
.invoice-summary-block .party-name { font-weight: 700; color: var(--ink); }

.invoice-meta-list { list-style: none; margin: 0; padding: 0; }
.invoice-meta-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.invoice-meta-list li:first-child { border-top: none; }
.invoice-meta-list li b { color: var(--ink); font-weight: 700; }

.invoice-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 20px; }
.invoice-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.invoice-table th, .invoice-table td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.invoice-table th:first-child, .invoice-table td:first-child { text-align: left; white-space: normal; }
.invoice-table thead th { color: var(--ink-4); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; background: var(--paper); }
.invoice-table tbody tr:nth-child(even) { background: var(--paper); }

.invoice-totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin: 0 0 4px; }
.invoice-totals-row { display: flex; justify-content: space-between; gap: 24px; width: 100%; max-width: 320px; font-size: 14px; color: var(--ink-2); }
.invoice-totals-row.is-grand { font-size: 17px; font-weight: 800; color: var(--blue-2); border-top: 1px solid var(--line-2); padding-top: 6px; margin-top: 2px; }

/* ── PDF-Canvas-Vorschau ── */
.pdf-preview-wrap {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white);
  padding: 12px; text-align: center; overflow: auto; max-height: 720px;
}
.pdf-preview-wrap canvas { max-width: 100%; height: auto; box-shadow: var(--shadow-sm); }
.pdf-preview-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; font-size: 13.5px; color: var(--ink-3); }

.attachment-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--green);
  background: var(--green-soft); border-radius: 999px; padding: 4px 12px; margin: 0 0 14px;
}
.attachment-badge.is-missing { color: var(--warn-ink); background: var(--warn-soft); }

/* ── FAQ (native <details>, kein JS noetig) ── */
.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; }
}

@media print {
  .site-header, .site-footer, .tool-actions, .privacy-note, .scope-note, .dropzone, .pdf-preview-nav, .faq-list { display: none; }
  body { background: var(--white); }
  .tool-card { box-shadow: none; border: none; padding: 0; margin: 0 0 20px; }
  .invoice-table-wrap { border: none; overflow: visible; }
  .invoice-table { font-size: 11px; }
  .invoice-table th, .invoice-table td { padding: 4px 6px; }
  .pdf-preview-wrap { border: none; max-height: none; overflow: visible; }
  @page { size: A4; margin: 16mm; }
  a[href]::after { content: ""; }
}
