/* ============================================================
   SIEVERS E-Rechnungs-Validator – Stylesheet nach SIEVERS Corporate Design
   (Styleguide Version 1, September 2023)

   - Primärfarben: Rot #E10023, Schwarz, Weiß – viel Weißraum
   - Unit-Farbe „Enterprise Resource Planning“: Hellgrün #7dc3a5 (nur mit Rot)
   - Square System: klare Quadrate/Rechtecke, keine Rundungen, keine Schatten
   - Schrift: Markenschrift ABC Oracle (lizenzpflichtig), sonst Arial
   - Kontraste nach WCAG 2.1 AA (≥ 4,5:1 für Text), per Test abgesichert
   ============================================================ */

:root {
  /* Markenfarben (fest) */
  --red:        #e10023;   /* SIEVERS-Rot (Primärfarbe)          */
  --red-dark:   #b8001c;   /* Hover auf roten Flächen            */
  --black:      #000000;
  --white:      #ffffff;
  --unit-erp:   #7dc3a5;   /* Unit Enterprise Resource Planning  */
  --ok:         #00965f;   /* Dunkelgrün (Sekundärfarbe)         */
  --warn:       #f08c23;   /* Dunkelorange (Sekundärfarbe)       */
  --info:       #bedcff;   /* Hellblau (Sekundärfarbe)           */
  --font: "Oracle ABC", Arial, Helvetica, sans-serif;
  --wrap: 1180px;

  /* Farbschema hell (Standard) – semantische Farben */
  color-scheme: light;
  --bg:           #ffffff;
  --fg:           #000000;
  --surface:      #f4f4f4;   /* Flächen wie im Styleguide          */
  --surface-2:    #ffffff;   /* Elemente auf Flächen               */
  --line:         #d9d9d9;
  --text-muted:   #545454;   /* 7,4:1 auf Weiß, 6,7:1 auf Fläche   */
  --accent:       #e10023;   /* Rot für Text, Links, Symbole       */
  --accent-hover: #b8001c;
  --focus:        #b8001c;
  --inverse-bg:   #000000;   /* aktive Sprache, Tabellenkopf       */
  --inverse-fg:   #ffffff;
  --dashed:       #8a8a8a;
  --btn-disabled: #f0a3af;
}

/* Farbschema dunkel: Systemeinstellung, außer hell ist ausdrücklich gewählt,
   oder dunkel ausdrücklich gewählt (Umschalter bzw. ?theme=dark) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121212; --fg: #f2f2f2; --surface: #1f1f1f; --surface-2: #2a2a2a;
    --line: #3d3d3d; --text-muted: #b3b3b3; --accent: #ff5a6e; --accent-hover: #ff8a99;
    --focus: #ff8a99; --inverse-bg: #f2f2f2; --inverse-fg: #000000; --dashed: #7a7a7a;
    --btn-disabled: #6b2a34;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212; --fg: #f2f2f2; --surface: #1f1f1f; --surface-2: #2a2a2a;
  --line: #3d3d3d; --text-muted: #b3b3b3; --accent: #ff5a6e; --accent-hover: #ff8a99;
  --focus: #ff8a99; --inverse-bg: #f2f2f2; --inverse-fg: #000000; --dashed: #7a7a7a;
  --btn-disabled: #6b2a34;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
.dot { color: var(--accent); }

/* ── Kopfzeile ─────────────────────────────────────────────────────────── */
.site-header { background: var(--bg); border-bottom: 1px solid var(--line); }
.site-header__inner {
  max-width: var(--wrap); margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; gap: 24px;
}
.app-name { text-decoration: none; color: var(--fg); display: flex; flex-direction: column; line-height: 1.25; }
.app-name:hover { color: var(--fg); }
.app-name__title { font-size: 1.15rem; font-weight: 700; }
.app-name__sub   { font-size: .85rem; color: var(--text-muted); }
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.docs-link { font-size: .9rem; font-weight: 700; color: var(--fg); text-decoration: none;
             display: inline-flex; align-items: center; gap: 6px; }
.docs-link::before { content: ""; width: 8px; height: 8px; background: var(--red); }
.docs-link:hover { color: var(--accent); }
.lang-switch { display: flex; gap: 0; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  background: none; border: 1px solid var(--line); color: var(--fg); cursor: pointer; border-radius: 0;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
.lang-switch a {
  font-size: .8rem; font-weight: 700; color: var(--fg); text-decoration: none;
  padding: 6px 10px; border: 1px solid var(--line);
}
.lang-switch a + a { border-left: none; }
.lang-switch a:hover  { color: var(--accent); }
.lang-switch a.active { background: var(--inverse-bg); color: var(--inverse-fg); border-color: var(--inverse-bg); }
.logo-link { display: block; flex-shrink: 0; line-height: 0; }
.logo { width: 54px; height: 54px; display: block; }   /* Logo immer als Quadrat */

/* ── Hauptbereich ──────────────────────────────────────────────────────── */
main { flex: 1; width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 48px 24px 64px; }
main.report { max-width: 960px; padding-top: 32px; }

h1, h2, h3 { font-weight: 700; line-height: 1.2; }

/* Unit-Kennzeichnung wie auf sievers-group.com */
.unit-tag {
  display: inline-block; background: var(--unit-erp); color: var(--black);
  font-size: .85rem; padding: 6px 14px; margin-bottom: 20px;
}

/* ── Startseite: Hero + Upload ─────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 48px; align-items: start; }
.hero__title { font-size: clamp(2.2rem, 4.2vw, 3.4rem); font-weight: 700; margin-bottom: 16px; }
.hero__sub   { color: var(--accent); font-weight: 700; font-size: 1.25rem; line-height: 1.4; margin-bottom: 16px; }
.hero__lead  { color: var(--fg); max-width: 34em; }

.card { background: var(--surface); padding: 32px; }
.card h2   { font-size: 1.4rem; margin-bottom: 8px; }
.card .sub { font-size: .95rem; color: var(--text-muted); margin-bottom: 24px; }

.drop-zone {
  background: var(--surface-2); border: 2px dashed var(--dashed);
  padding: 40px 20px; text-align: center; cursor: pointer;
  color: var(--fg); transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--red); border-style: solid; color: var(--fg); }
.drop-zone svg { display: block; margin: 0 auto 12px; color: var(--accent); }
.drop-text { font-size: 1rem; font-weight: 700; }
.drop-hint { font-size: .85rem; margin-top: 6px; color: var(--text-muted); }
#fileInput { display: none; }

.file-badge {
  display: none; align-items: center; gap: 10px; margin-top: 12px;
  background: var(--surface-2); border-left: 6px solid var(--red); padding: 10px 14px;
}
.file-badge.visible { display: flex; }
.file-badge-icon    { color: var(--accent); flex-shrink: 0; }
.file-badge-name    { font-weight: 700; font-size: .95rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-badge-type    { font-size: .75rem; background: var(--inverse-bg); color: var(--inverse-fg); padding: 3px 8px; white-space: nowrap; }
.file-badge-remove  { color: var(--fg); background: none; border: none; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 2px 6px; }
.file-badge-remove:hover { color: var(--accent); }

/* Buttons wie auf sievers-group.com: rot, eckig, fett */
.btn-validate, .btn-print, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--red); color: var(--white); border: 2px solid var(--red);
  font-family: var(--font); font-size: 1.05rem; font-weight: 700; line-height: 1.2;
  padding: 16px 22px; cursor: pointer; text-decoration: none; border-radius: 0;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-validate:hover:not(:disabled), .btn-print:hover, .btn:hover { background: var(--red-dark); border-color: var(--red-dark); color: var(--white); }
.btn-validate { width: 100%; margin-top: 20px; }
.btn-validate:disabled { background: var(--btn-disabled); border-color: var(--btn-disabled); color: var(--white); cursor: not-allowed; }

.spinner {
  display: none; width: 18px; height: 18px;
  animation: spin .8s linear infinite;
}
.spinner circle { stroke-dasharray: 40 30; }
.btn-validate.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.info-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.info-box { background: var(--surface-2); padding: 14px 16px; font-size: .85rem; color: var(--text-muted); line-height: 1.5; }
.info-box strong { display: block; color: var(--fg); font-size: .9rem; margin-bottom: 4px; }

/* ── Hinweisblock SIEVERS E-Rechnung (PBI 154323) ─────────────────────── */
.cta {
  background: var(--red); color: var(--white); margin-top: 56px; padding: 40px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px 48px; align-items: end;
  position: relative;
}
.cta::before {   /* Quadrat-Akzent in der ERP-Unit-Farbe (Square System) */
  content: ""; position: absolute; top: 0; right: 0; width: 56px; height: 56px; background: var(--unit-erp);
}
.cta .dot { color: var(--white); }
.cta__kicker { font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.cta__title  { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin-bottom: 14px; max-width: 22em; }
.cta__lead   { max-width: 46em; margin-bottom: 14px; }
.cta__points { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; max-width: 52em; }
.cta__points li { padding-left: 18px; position: relative; font-size: .95rem; }
.cta__points li::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; background: var(--white); }
.cta__actions { display: flex; flex-direction: column; gap: 12px; min-width: 260px; }
.btn--light { background: var(--white); color: var(--black); border-color: var(--white); }
.btn--light:hover { background: var(--black); border-color: var(--black); color: var(--white); }
.btn--outline-light { background: transparent; color: var(--white); border-color: var(--white); }
.btn--outline-light:hover { background: var(--white); color: var(--black); border-color: var(--white); }
.cta a:focus-visible { outline-color: var(--white); }
main.report .cta { margin-top: 40px; }

/* ── Erklärbereich ─────────────────────────────────────────────────────── */
.explain { margin-top: 56px; }
.explain h2 { font-size: 1.8rem; margin-bottom: 20px; }
.explain-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.explain-item { background: var(--surface); padding: 28px; font-size: .97rem; }
.explain-item h3 { font-size: 1.15rem; margin-bottom: 10px; }
.explain-item p + p, .explain-item p + ul, .explain-item ul + p { margin-top: 10px; }
.explain-item ul { list-style: none; }
.explain-item li { padding-left: 18px; position: relative; }
.explain-item li + li { margin-top: 6px; }
.explain-item li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; background: var(--red); }
.explain-note { font-size: .85rem; color: var(--text-muted); margin-top: 16px; }

/* ── Berichtsseiten ────────────────────────────────────────────────────── */
.btn-back { display: inline-block; margin-bottom: 16px; font-weight: 700; text-decoration: none; font-size: .95rem; }
.btn-back:hover { text-decoration: underline; }
.page-title { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin-bottom: 20px; }

.file-info {
  background: var(--surface); padding: 14px 18px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.file-icon { color: var(--accent); flex-shrink: 0; }
.file-name { font-weight: 700; overflow-wrap: anywhere; }
.file-type { font-size: .78rem; background: var(--inverse-bg); color: var(--inverse-fg); padding: 3px 8px; }

/* Ergebnisboxen: Farbe als Quadrat und Randbalken, Text immer schwarz */
.result-hero {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border-left: 8px solid var(--text-muted);
  padding: 18px 22px; margin-bottom: 14px;
}
.result-icon { width: 18px; height: 18px; flex-shrink: 0; background: var(--text-muted); }
.result-label { font-size: 1.2rem; font-weight: 700; color: var(--fg); }
.result-hero.pass { border-left-color: var(--ok); }
.result-hero.pass .result-icon { background: var(--ok); }
.result-hero.fail { border-left-color: var(--red); }
.result-hero.fail .result-icon { background: var(--red); }
.result-hero.warn { border-left-color: var(--warn); }
.result-hero.warn .result-icon { background: var(--warn); }
.result-hero--sm { font-size: .95rem; padding: 14px 18px; }
.result-hero--sm .result-icon { width: 12px; height: 12px; }
.result-hero--mb { margin-bottom: 1rem; }
.result-hero--overall { padding: 24px; }
.result-hero--overall .result-label { font-size: 1.35rem; }
.scenario { font-size: .82rem; color: var(--text-muted); background: var(--surface-2); padding: 3px 10px; margin-left: auto; }

.badge-row   { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.badge       { font-size: .8rem; font-weight: 700; padding: 4px 10px; }
.badge-error { background: var(--red); color: var(--white); }
.badge-warn  { background: var(--warn); color: var(--black); }
.badge-info  { background: var(--info); color: var(--black); }

details { background: var(--bg); border: 1px solid var(--line); margin-bottom: 14px; }
details summary {
  padding: 14px 18px; cursor: pointer; font-weight: 700; list-style: none;
  display: flex; align-items: center; gap: 10px; background: var(--surface);
}
details summary::-webkit-details-marker { display: none; }
details summary::before { content: ""; width: 10px; height: 10px; background: var(--red); transition: transform .15s; }
details[open] summary::before { transform: rotate(45deg); }

.msg-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.msg-table th { text-align: left; padding: 10px 12px; background: var(--inverse-bg); color: var(--inverse-fg); font-weight: 700; }
.msg-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.error-row td:first-child   { box-shadow: inset 4px 0 0 var(--red); }
.warning-row td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
.msg-id  { white-space: nowrap; color: var(--text-muted); font-family: Consolas, "Courier New", monospace; }
.msg-loc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
           color: var(--text-muted); font-family: Consolas, "Courier New", monospace; font-size: .78rem; }

.detail-table { border-collapse: collapse; width: 100%; }
.detail-label { padding: 7px 12px; color: var(--text-muted); font-size: .88rem; white-space: nowrap; vertical-align: top; }
.detail-value { padding: 7px 12px; font-size: .88rem; }
.profile-table { margin: 4px 0 12px; background: var(--surface); }
.report-meta { margin: 24px 0 16px; border-top: 2px solid var(--fg); }

.report-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.btn-print { font-size: .95rem; padding: 12px 18px; }

.hint-text { font-size: .9rem; color: var(--text-muted); margin-top: 12px; }
.kosit-iframe { width: 100%; border: none; min-height: 600px; display: block; }

.hidden     { display: none; }
.error-msg  { color: var(--accent); font-weight: 700; }
.error-hint { margin-top: 8px; font-size: .9rem; color: var(--text-muted); }
.error-link { color: var(--accent); }

/* ── Fußzeile: Logo + Claim „all digital.“ ─────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); background: var(--bg); }
.site-footer__inner {
  max-width: var(--wrap); margin: 0 auto; padding: 28px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap;
}
.claim-lockup { display: flex; align-items: center; gap: 12px; }
.claim-logo { width: 40px; height: 40px; display: block; }
.claim { font-size: 1.35rem; font-weight: 700; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: .85rem; color: var(--text-muted); }
.footer-links a { color: var(--fg); text-decoration: none; font-weight: 700; }
.footer-links a:hover { color: var(--accent); }

/* ── Barrierefreiheit ──────────────────────────────────────────────────── */
a:focus-visible, button:focus-visible, summary:focus-visible,
.drop-zone:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--bg); color: var(--focus); padding: 10px 16px; border: 2px solid var(--focus);
}
.skip-link:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Druck ─────────────────────────────────────────────────────────────── */
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    color-scheme: light; --bg: #fff; --fg: #000; --surface: #f4f4f4; --surface-2: #fff; --line: #d9d9d9;
    --text-muted: #545454; --accent: #e10023; --inverse-bg: #000; --inverse-fg: #fff;
  }
  .theme-toggle, .docs-link { display: none !important; }
  .btn-back, .btn-print, .report-actions, .lang-switch, .cta, .site-footer { display: none !important; }
  details { border: none; }
  details[open] summary { display: none; }
  .result-hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Tablet / Mobil ────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .cta  { grid-template-columns: 1fr; align-items: start; }
  .cta__actions { min-width: 0; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .site-header__inner { padding: 12px 16px; gap: 12px; }
  .app-name__sub { display: none; }
  /* Zwei Zeilen: Name + Logo oben, Doku/Farbschema/Sprache darunter */
  .site-header__inner { flex-wrap: wrap; }
  .app-name { flex: 1; }
  .logo-link { order: 2; }
  .header-nav { order: 3; width: 100%; margin-left: 0; gap: 12px; }
  .lang-switch { margin-left: auto; }
  .logo { width: 44px; height: 44px; }
  main { padding: 28px 16px 48px; }
  .card { padding: 20px 16px; }
  .info-row, .explain-grid, .cta__points { grid-template-columns: 1fr; }
  .cta { padding: 28px 20px; margin-top: 40px; }
  .cta::before { width: 36px; height: 36px; }
  .explain-item { padding: 20px; }
  .msg-table { display: block; overflow-x: auto; }
  .site-footer__inner { padding: 24px 16px; }
}
