/* erewa – e-Rechnung · Gestaltung angelehnt an das artTECc:om-Logo (Grau/Schwarz) */
:root {
  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #6b6b73;
  --line: #e4e4e7;
  --line-2: #d4d4d8;
  --bg: #f5f5f6;
  --card: #ffffff;
  --brand: #bfbfbf;
  --brand-dark: #000000;
  --ok: #1f7a4d;
  --ok-bg: #ecf7f1;
  --warn: #9a5b00;
  --warn-bg: #fff6e5;
  --err: #b42318;
  --err-bg: #fdecea;
  --info-bg: #f0f0f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55;
  color: var(--ink); background: var(--bg);
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .9em; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.small, .muted { color: var(--muted); font-size: .9em; }

/* Kopfzeile ------------------------------------------------------------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand img { height: 30px; width: auto; display: block; }
.brand .product { display: flex; flex-direction: column; line-height: 1.1; padding-left: 14px; border-left: 1px solid var(--line-2); }
.brand .product b { font-size: 1.05rem; letter-spacing: .02em; }
.brand .product span { font-size: .75rem; color: var(--muted); }
.mainnav { display: flex; align-items: center; gap: 4px; flex: 1; }
.mainnav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .95rem; }
.mainnav a:hover { background: var(--bg); color: var(--ink); }
.mainnav a.active { background: var(--ink); color: #fff; }
.usermenu { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.usermenu .who { text-align: right; line-height: 1.25; font-size: .8rem; color: var(--muted); max-width: 210px; }
.usermenu .who b, .usermenu .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu .who a { color: var(--muted); }
.usermenu .who b { color: var(--ink); font-size: .85rem; font-weight: 600; }
.usermenu form { margin: 0; }
.menu-toggle { display: none; }

/* Inhalt ----------------------------------------------------------------- */
main { flex: 1; padding: 32px 0 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.narrow { max-width: 460px; }
.stack > * + * { margin-top: 16px; }

/* Brand-Balken wie im Logo */
.bars { position: relative; height: 18px; width: 220px; margin: 10px 0 0; }
.bars::before { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 7px; background: var(--brand); }
.bars::after { content: ""; position: absolute; left: 30%; bottom: 7px; width: 70%; height: 7px; background: var(--brand-dark); }

/* Formulare -------------------------------------------------------------- */
label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
input, textarea, select {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit; font-weight: 400; color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: 8px; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(24,24,27,.12); }
input[type=checkbox] { display: inline-block; width: auto; margin: 0 8px 0 0; vertical-align: middle; accent-color: var(--ink); }
label.check { font-weight: 500; display: flex; align-items: flex-start; }
label.check input { margin-top: 4px; flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; margin: 0 0 20px; background: var(--card); }
legend { font-weight: 700; padding: 0 6px; font-size: .95rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; font: inherit; font-weight: 600;
  color: #fff; background: var(--ink); border: 1px solid var(--ink); border-radius: 8px; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .05s;
}
button:hover, .btn:hover { background: #000; }
button:active, .btn:active { transform: translateY(1px); }
.btn-secondary, button.secondary { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn-secondary:hover, button.secondary:hover { background: var(--bg); }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
button.link { background: none; border: none; color: var(--ink-2); padding: 0; font-weight: 500; text-decoration: underline;
  text-decoration-color: var(--brand); text-underline-offset: 3px; }
button.link:hover { color: var(--ink); background: none; }
button.link.danger { color: var(--err); }

/* Meldungen -------------------------------------------------------------- */
.ok, .err, .warn, .notice { border-radius: 10px; padding: 12px 16px; margin: 0 0 16px; border: 1px solid; }
.ok { background: var(--ok-bg); border-color: #b7e0c8; color: #14532d; }
.err { background: var(--err-bg); border-color: #f5c2bd; color: #7a1a12; }
.warn { background: var(--warn-bg); border-color: #f3d9a6; color: #6b3f00; }
.notice { background: var(--info-bg); border-color: var(--line-2); }
.err ul { margin: 6px 0 0; padding-left: 20px; }

/* Tabellen --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
td, th { padding: 8px 10px; text-align: left; vertical-align: middle; }
.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.list td { border-bottom: 1px solid var(--line); }
.list tr:last-child td { border-bottom: none; }
.list tbody tr:hover td { background: #fafafa; }
.list tfoot th { border-top: 2px solid var(--ink); border-bottom: none; color: var(--ink); font-size: .9rem; text-transform: none; letter-spacing: 0; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.actions { white-space: nowrap; text-align: right; }
.actions a, .actions form { display: inline; margin-left: 10px; }
.empty { color: var(--muted); text-align: center; padding: 28px 10px; }
table.lines input { padding: 6px 8px; margin: 0; font-size: .9rem; }
table.lines th { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px; }
table.lines td { padding: 3px; }
table.lines .c-pos { width: 70px; } table.lines .c-art { width: 140px; } table.lines .c-num { width: 90px; } table.lines .c-unit { width: 70px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--info-bg); color: var(--ink-2); white-space: nowrap; }
.badge.neu { background: var(--warn-bg); color: var(--warn); }
.badge.erzeugt, .badge.erstellt { background: #eef2ff; color: #3730a3; }
.badge.gesendet, .badge.versendet { background: var(--ok-bg); color: var(--ok); }

.totals { display: flex; gap: 24px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; font-variant-numeric: tabular-nums; }
.totals div { text-align: right; } .totals span { display: block; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.totals b { font-size: 1.15rem; }

/* Upload ----------------------------------------------------------------- */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 30px 20px; background: #fafafa; cursor: pointer; font-weight: 500; }
.dropzone:hover { border-color: var(--ink); background: #fff; }
.dropzone input[type=file] { margin: 8px auto 0; max-width: 360px; background: transparent; border: none; padding: 0; }
.dropzone .icon { font-size: 28px; line-height: 1; }

/* Startseite ------------------------------------------------------------- */
.hero { background: var(--card); border-bottom: 1px solid var(--line); padding: 64px 0 56px; margin: -32px 0 40px; }
.hero .wrap { display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4vw, 2.9rem); letter-spacing: -.025em; margin-bottom: 16px; }
.hero .lead { font-size: 1.12rem; color: var(--ink-2); max-width: 36em; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.doc-visual { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.doc-visual .file { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.doc-visual .file .tag { font-family: var(--mono); font-size: .72rem; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: var(--ink); color: #fff; }
.doc-visual .file .tag.pdf { background: var(--brand); color: var(--ink); }
.doc-visual .arrow { text-align: center; color: var(--muted); font-size: 1.3rem; margin: 6px 0; }
.doc-visual .file small { display: block; color: var(--muted); font-size: .78rem; }
.section { margin-bottom: 48px; }
.section > h2 { font-size: 1.5rem; margin-bottom: 6px; }
.section > p.sub { color: var(--muted); margin-bottom: 22px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature .ico { width: 38px; height: 38px; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-family: var(--mono); font-size: .9rem; margin-bottom: 12px; }
.feature h3 { margin-bottom: 6px; }
.feature p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; counter-reset: step; }
.step { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 22px 70px; }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 20px; top: 20px; width: 34px; height: 34px;
  border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 700; }
.step h3 { margin-bottom: 4px; } .step p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.timeline div { padding: 20px 22px; border-right: 1px solid var(--line); }
.timeline div:last-child { border-right: none; }
.timeline b { display: block; font-size: 1.2rem; margin-bottom: 4px; }
.cta-band { background: var(--ink); color: #fff; border-radius: 16px; padding: 34px; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.cta-band h2 { margin: 0 0 4px; } .cta-band p { margin: 0; color: #d4d4d8; }
.cta-band .btn { background: #fff; color: var(--ink); border-color: #fff; }
.cta-band .btn:hover { background: var(--brand); }

/* Rechtstexte ------------------------------------------------------------ */
.legal { max-width: 860px; margin-left: auto; margin-right: auto; }
.legal h2 { margin-top: 1.6em; font-size: 1.15rem; }
.legal h2:first-of-type { margin-top: .4em; }
.legal address { font-style: normal; }
.legal dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0 0 1em; }
.legal dt { color: var(--muted); } .legal dd { margin: 0; }

/* Anmeldung -------------------------------------------------------------- */
.auth { display: grid; place-items: center; padding: 20px 0; }
.auth .card { width: 100%; max-width: 420px; padding: 32px; }
.auth .logo { display: block; height: 40px; width: auto; margin: 0 auto 18px; }
.auth h1 { text-align: center; font-size: 1.35rem; }
.auth p.sub { text-align: center; color: var(--muted); margin-bottom: 22px; }
.auth form > * + * { margin-top: 14px; }
.auth button { width: 100%; padding: 11px; }

/* Fußzeile --------------------------------------------------------------- */
.site-footer { background: var(--card); border-top: 1px solid var(--line); padding: 28px 0; font-size: .88rem; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; }
.site-footer .by { display: flex; align-items: center; gap: 10px; }
.site-footer .by img { height: 20px; width: auto; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* Mobil ------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .site-header .wrap { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .menu-toggle { display: inline-flex; margin-left: auto; background: #fff; color: var(--ink); border-color: var(--line-2); padding: 7px 12px; }
  .menu-toggle:hover, .site-header.open .menu-toggle { background: var(--bg); color: var(--ink); }
  .mainnav, .usermenu { display: none; width: 100%; }
  .site-header.open .mainnav { display: flex; flex-direction: column; align-items: stretch; }
  .site-header.open .usermenu { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
  .usermenu .who { text-align: left; }
  .brand .product { display: none; }
  .timeline div { border-right: none; border-bottom: 1px solid var(--line); }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .card { padding: 18px; }
  .wrap { padding: 0 16px; }
  .hero { padding: 40px 0; }
  .actions a, .actions form { margin-left: 6px; }
}
@media print {
  .site-header, .site-footer, .form-actions, button { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; border: none; padding: 0; }
}

/* Vertrag zur Auftragsverarbeitung */
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.contract { max-width: 820px; margin: 0 auto; font-size: .95rem; line-height: 1.55; }
.contract-head { text-align: center; padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.contract-head img { height: 40px; width: auto; margin-bottom: 14px; }
.contract-head h1 { margin: 0 0 4px; font-size: 1.6rem; }
.contract-head p { margin: 0; color: var(--muted); }
.contract h2 { font-size: 1.05rem; margin: 26px 0 8px; break-after: avoid; }
.contract h3 { font-size: .95rem; margin: 16px 0 6px; break-after: avoid; }
.contract ol, .contract ul { padding-left: 1.4em; margin: 0 0 8px; }
.contract li { margin-bottom: 5px; }
.contract .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 8px; }
.contract .parties p { margin: 0; }
.contract .eyebrow { margin-bottom: 6px; }
.contract .blank { display: inline-block; border-bottom: 1px solid var(--ink); height: 1.2em; vertical-align: bottom; max-width: 100%; }
.contract .signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 44px; break-inside: avoid; }
.contract .signatures span.line { display: block; border-top: 1px solid var(--ink); padding-top: 4px; margin-top: 48px; font-size: .85rem; color: var(--muted); }
.contract .annex { margin-top: 36px; }
@media (max-width: 700px) { .contract .parties, .contract .signatures { grid-template-columns: 1fr; } }
@media print {
  @page { size: A4; margin: 18mm 16mm; }
  .no-print, .notice { display: none !important; }
  main, .wrap { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .contract { max-width: none; font-size: 10pt; }
  .contract .parties, .contract .signatures { grid-template-columns: 1fr 1fr; }
  .contract .annex { break-before: page; margin-top: 0; }
  .contract tr, .contract li { break-inside: avoid; }
  .contract a { color: inherit; text-decoration: none; }
}

/* Prüfdienste */
.howto { padding-left: 1.3em; } .howto li { margin-bottom: 6px; }
.validators { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.validators .card { margin: 0; display: flex; flex-direction: column; }
.validator h3 { margin: 0 0 2px; } .validator p { margin: 0 0 8px; }
.validator .btn { margin-top: auto; align-self: flex-start; }


/* Vorlagen-Analyse in der Verwaltung */
.sample { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.sample-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.sample-head form { margin-left: auto; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0 0 8px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.pdftext { max-height: 320px; overflow: auto; background: #f6f6f6; padding: 10px; border-radius: 8px; font-size: .8rem; white-space: pre-wrap; }

/* Auswahl der Rechnungsvorlage */
.layout-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.layout-choice .radio { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 500; }
.layout-choice .radio input { width: auto; margin: 0; flex: none; accent-color: var(--ink); }
.layout-choice .radio:has(input:checked) { border-color: var(--ink); background: #fafafa; }
label.inline { display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.card.reread { padding: 14px 18px; }
.layout-choice .radio small { margin-left: 6px; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
