/* FISCHMANN.IT E-Rechnungs-Viewer – CI von www.fischmann.it (Farben, Schriften und Grundbausteine wie im Kundenportal) */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/montserrat-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/montserrat-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* CI-Farben (nicht ändern, identisch mit dem Kundenportal) */
  --navy: #1e2d47;
  --navy-2: #15223a;
  --navy-3: #2b3d5f;
  --blue: #2d67cf;
  --blue-dark: #2457b4;
  --blue-bright: #4290fb;
  --blue-light: #a8cbfb;
  --blue-mist: #e6effc;
  --ink: #1e2d47;
  --text: #33415a;
  --muted: #5f6c82;
  --line: #dde4ee;
  --light: #f1f4f8;
  --light-2: #e7ecf3;
  --white: #fff;
  --success: #1f8a5b;
  --success-bg: #e3f4ec;
  --error: #c0392b;
  --warning-bg: #fff6e5;
  --warning: #8a5a00;
  /* CI-Schriften (nicht ändern) */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "Montserrat", "Inter", system-ui, sans-serif;
  /* Aufbau */
  --topbar-h: 60px;
  --content-max: 1240px;
  --radius: 8px;
  --radius-lg: 14px;
  --field-border: #c9d3e1;
  --shadow: 0 1px 2px rgba(21, 34, 58, .05), 0 6px 20px rgba(21, 34, 58, .05);
  --shadow-pop: 0 14px 36px rgba(21, 34, 58, .18), 0 2px 6px rgba(21, 34, 58, .08);
  --ring: 0 0 0 3px rgba(45, 103, 207, .2);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 20px); }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55;
  color: var(--text); background: var(--light); -webkit-font-smoothing: antialiased;
}
body.is-auth { background: var(--white); }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--blue-dark); }
h1, h2, h3 { font-family: var(--font-head); color: var(--ink); line-height: 1.25; }
:focus-visible { outline: 3px solid var(--blue-bright); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.muted { color: var(--muted); }
.pre { white-space: pre-line; overflow-wrap: anywhere; }

.icon {
  width: 20px; height: 20px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px;
  background: var(--white); color: var(--ink); font-weight: 600; border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.skip-link:focus { top: 12px; }

.eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--blue);
}

/* ------------------------------------------------------------------
   Kopfzeile
   ------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 16px 0 24px; color: var(--white);
  background: radial-gradient(900px 200px at 85% -80%, rgba(66, 144, 251, .35), transparent 70%),
              linear-gradient(120deg, var(--navy-2) 0%, var(--navy) 60%, var(--navy-3) 100%);
}
.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand img { display: block; height: 34px; width: auto; }
.topbar-divider { width: 1px; height: 24px; background: rgba(168, 203, 251, .35); }
.topbar-title { font-family: var(--font-head); font-weight: 600; font-size: 15px; color: var(--blue-light); letter-spacing: .02em; white-space: nowrap; }
.topbar-logout { margin: 0 0 0 auto; }
.topbar-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--white); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
.topbar-link:hover { background: rgba(255, 255, 255, .1); }
.topbar-link .icon { width: 18px; height: 18px; opacity: .85; }

/* ------------------------------------------------------------------
   Inhalt
   ------------------------------------------------------------------ */
.main { min-width: 0; display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h)); padding: 28px 32px 0; }
.main:focus { outline: none; }
.main-inner { width: 100%; max-width: var(--content-max); margin: 0 auto; flex: 1; }
.main-foot {
  width: 100%; max-width: var(--content-max); margin: 48px auto 0; padding: 18px 0 24px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.main-foot strong { color: var(--ink); font-weight: 600; }
.main-foot a { color: var(--muted); }
.main-foot a:hover { color: var(--blue); }
.main-foot-links { display: flex; gap: 16px; }

.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 4px 0 6px; font-size: clamp(24px, 2.6vw, 30px); font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.page-head h1:focus { outline: none; }
.page-lead { margin: 0; max-width: 720px; font-size: 16px; color: var(--muted); }

.panel {
  padding: 24px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.panel-title { margin: 0 0 14px; font-size: 17px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head .panel-title { margin: 0; display: flex; align-items: center; gap: 8px; }
.panel-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 12px; background: rgba(168, 203, 251, .16); color: var(--blue-light); }
.count {
  min-width: 26px; padding: 2px 8px; border-radius: 999px; text-align: center;
  background: var(--light-2); color: var(--ink); font-family: var(--font); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  background: var(--blue-mist); color: var(--blue-dark); font-size: 12px; font-weight: 600; white-space: nowrap;
}

.callout {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; padding: 14px 16px;
  background: var(--blue-mist); border: 1px solid #cfdef8; border-radius: var(--radius); color: var(--navy);
}
.callout .icon { color: var(--blue); margin-top: 1px; }
.callout p { margin: 0; }
.callout-warn { background: var(--warning-bg); border-color: #f1d9a6; color: var(--warning); }
.callout-warn .icon { color: var(--warning); }
.callout-list { margin: 4px 0 0; padding-left: 18px; }

.alert {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; padding: 12px 14px;
  border-radius: var(--radius); font-weight: 500;
}
.alert .icon { margin-top: 1px; }
.alert-error { background: #fdecea; border: 1px solid #f3c2bc; color: #8e2a1f; }
.alert-info { background: var(--blue-mist); border: 1px solid #cfdef8; color: var(--navy); }
.alert-info .icon { color: var(--blue); }
.error-list { margin: 6px 0 0; padding-left: 18px; font-weight: 400; }
.error-list li + li { margin-top: 4px; }
.error-file { font-weight: 600; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------
   Knöpfe
   ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--white); box-shadow: 0 1px 2px rgba(21, 34, 58, .14); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: var(--white); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: var(--white); border-color: var(--field-border); color: var(--ink); }
.btn-ghost:hover { background: #f8fbff; border-color: var(--blue-light); color: var(--ink); }
.btn-lg { min-height: 48px; font-size: 16px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-link {
  padding: 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--blue); background: none; border: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px;
}
.btn-link:hover { color: var(--blue-dark); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; padding: 0;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--light-2); color: var(--ink); }

/* ------------------------------------------------------------------
   Startansicht: Datei öffnen
   ------------------------------------------------------------------ */
.start-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.start-main, .start-side { display: grid; gap: 20px; min-width: 0; }

.drop { position: relative; }
.drop-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 44px 24px 36px; text-align: center; cursor: pointer;
  background: var(--white); border: 2px dashed var(--field-border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  transition: border-color .15s ease, background-color .15s ease;
}
.drop-zone:hover, .is-dragging .drop-zone { border-color: var(--blue); background: #f8fbff; }
.drop-input:focus-visible + .drop-zone { outline: 3px solid var(--blue-bright); outline-offset: 2px; }
.drop-icon {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--blue-mist); color: var(--blue);
}
.drop-icon .icon { width: 30px; height: 30px; }
.drop-title { font-family: var(--font-head); font-size: 20px; font-weight: 700; color: var(--ink); }
.drop-or { font-size: 14px; color: var(--muted); }
.drop-btn { pointer-events: none; }
.drop-hint { margin-top: 4px; font-size: 13.5px; color: var(--muted); }
.drop-busy {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 12px;
  border-radius: var(--radius-lg); background: rgba(255, 255, 255, .94); color: var(--ink); font-weight: 600;
}
.spinner {
  width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--blue-mist); border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Datei über der ganzen Seite ablegen */
.is-dragging::after {
  content: "Datei zum Öffnen hier ablegen"; position: fixed; inset: 12px; z-index: 100; pointer-events: none;
  display: grid; place-items: center; border: 3px dashed var(--blue); border-radius: 18px; background: rgba(230, 239, 252, .9);
  font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--blue-dark);
}

.messages:empty { display: none; }
.messages .alert:last-child { margin-bottom: 0; }

.panel.open-panel { padding: 0; overflow: hidden; }
.open-panel .panel-head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-row { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 12px 14px 20px; border-top: 1px solid var(--line); }
.doc-row:first-child { border-top: 0; }
.doc-row:hover { background: #f8fbff; }
.doc-icon { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center; background: var(--blue-mist); color: var(--blue); }
.doc-main { flex: 1; min-width: 0; }
.doc-title { color: var(--ink); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.doc-title::after { content: ""; position: absolute; inset: 0; }
.doc-title:hover { color: var(--blue-dark); }
.doc-title:focus-visible { outline: none; }
.doc-row:has(.doc-title:focus-visible) { box-shadow: inset 0 0 0 3px var(--blue-bright); }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; margin-top: 3px; font-size: 13.5px; color: var(--muted); }
.doc-amount { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.doc-row .icon-btn { position: relative; z-index: 1; }

.privacy-panel {
  color: #d3dcea; border-color: var(--navy);
  background: radial-gradient(420px 220px at 100% 0%, rgba(66, 144, 251, .3), transparent 70%), var(--navy);
}
.privacy-panel .panel-title { color: var(--white); }
.privacy-panel p { margin: 0; }
.format-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.format-list li { display: flex; gap: 10px; align-items: flex-start; }
.format-list .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--success); stroke-width: 2.2; }
.format-list strong { display: block; color: var(--ink); }

.faq { margin-top: 32px; display: grid; gap: 10px; }
.faq-title { margin: 0 0 6px; font-size: 18px; }
.faq details { background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px;
  color: var(--ink); font-weight: 600; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { width: 18px; height: 18px; color: var(--muted); transition: transform .15s ease; }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details p { margin: 0; padding: 0 18px 16px; color: var(--muted); }

/* ------------------------------------------------------------------
   Rechnungsansicht
   ------------------------------------------------------------------ */
.inv-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 20px; }
.inv-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inv-head { margin-bottom: 20px; }
/* Desktop: Rechnung links, rechts Zahlbetrag und darunter die Seitenleiste */
.inv-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 330px; grid-template-rows: auto 1fr;
  grid-template-areas: "sheet total" "sheet side"; gap: 20px; align-items: start;
}
.inv-total { grid-area: total; }
.sheet { grid-area: sheet; }
.inv-side { grid-area: side; }

/* Rechnungsblatt */
.sheet {
  min-width: 0; padding: 32px 36px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); font-size: 14.5px;
}
.sheet-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 350px); gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.sheet-label { margin: 0 0 6px; font-family: var(--font); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.party p { margin: 0; }
.party-name { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.party-big .party-name { font-family: var(--font-head); font-size: 20px; font-weight: 700; line-height: 1.3; }
.party-trading { color: var(--muted); }
.party-address { margin-top: 4px !important; overflow-wrap: anywhere; }
.party-contact { display: flex; flex-direction: column; margin-top: 8px !important; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.sheet-doc { align-self: start; padding: 16px 18px; background: var(--light); border-radius: 12px; }
.sheet-doc-title { margin-bottom: 10px; font-family: var(--font-head); font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.sheet-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px 28px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.sheet-section { padding-top: 24px; }
.sheet-heading { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 15.5px; font-weight: 700; }
.sheet-subheading { margin: 0 0 8px; font-size: 14px; font-weight: 700; }

.facts { display: grid; gap: 10px; margin: 0; }
.fact { min-width: 0; }
.facts dt { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 1px 0 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.facts-doc { grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; }
.facts-doc .fact { display: contents; }
.facts-doc dt { padding-top: 1px; font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.facts-doc dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.facts-small { margin-top: 10px; gap: 6px; }
.facts-small .fact { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13.5px; }
.facts-small dt { font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.facts-small dd { margin: 0; }
.facts-refs, .facts-legal { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 24px; }
.facts-legal { font-size: 13.5px; }
.facts-pay { gap: 8px; }
.facts-tech { gap: 8px; font-size: 13.5px; }

.sheet-notes .note { margin-bottom: 8px; padding: 10px 14px; background: var(--light); border-left: 3px solid var(--blue-light); border-radius: 0 var(--radius) var(--radius) 0; }
.note-subject { display: block; margin-bottom: 2px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* Positionen */
.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.lines th {
  padding: 8px 10px; text-align: left; vertical-align: bottom; border-bottom: 2px solid var(--line);
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.lines td { padding: 12px 10px; vertical-align: top; border-bottom: 1px solid var(--line); }
.lines th:first-child, .lines td:first-child { padding-left: 0; }
.lines th:last-child, .lines td:last-child { padding-right: 0; }
.lines .col-pos { width: 52px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lines .col-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lines th.col-num { text-align: right; }
.lines .col-amount { color: var(--ink); font-weight: 600; }
.lines .col-item { min-width: 200px; overflow-wrap: anywhere; }
.li-name { color: var(--ink); font-weight: 600; }
.li-desc { margin-top: 2px; }
.li-meta { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.li-note { margin-top: 4px; font-size: 13px; color: var(--text); }
.li-ac { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.li-ac-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.li-base { display: block; font-size: 12px; color: var(--muted); }
.line.has-children > td { background: #f8fbff; }
.line.is-sub .col-item { padding-left: 26px; box-shadow: inset 3px 0 0 var(--blue-light); }
.line.depth-2 .col-item { padding-left: 44px; }
.line.depth-3 .col-item { padding-left: 62px; }

/* Summen */
.sheet-totals { display: flex; flex-direction: column; align-items: flex-end; }
.totals { min-width: min(100%, 400px); border-collapse: collapse; font-variant-numeric: tabular-nums; }
.totals th { padding: 5px 0; text-align: left; font-weight: 400; }
.totals td { padding: 5px 0 5px 28px; text-align: right; white-space: nowrap; color: var(--ink); }
.totals .is-sub th, .totals .is-sub td { font-size: 13.5px; color: var(--muted); }
.totals .is-strong th, .totals .is-strong td { padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.totals .is-total th, .totals .is-total td {
  padding-top: 10px; border-top: 2px solid var(--ink); color: var(--ink);
  font-family: var(--font-head); font-size: 18px; font-weight: 700;
}
.exemptions { list-style: none; max-width: 560px; margin: 12px 0 0; padding: 0; font-size: 13px; color: var(--muted); }

/* Zahlung, Anlagen, Rechtliches */
.pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px 28px; }
.terms { margin-top: 18px; }
.terms-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.terms-list li { white-space: pre-line; }
.terms-list .is-discount { padding: 8px 12px; border-radius: var(--radius); background: var(--success-bg); color: #17694a; font-weight: 500; }
.attach-list { list-style: none; margin: 0; padding: 0; }
.attach { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.attach:first-child { border-top: 0; }
.attach-icon { width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto; display: grid; place-items: center; background: var(--light); color: var(--muted); }
.attach-icon .icon { width: 18px; height: 18px; }
.attach-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.attach-name { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.attach-info { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.sheet-legal { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.sheet-disclaimer {
  display: flex; gap: 10px; align-items: flex-start; margin: 24px 0 0; padding: 12px 14px;
  background: var(--light); border-radius: var(--radius); font-size: 13px; color: var(--muted);
}
.sheet-disclaimer .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--blue); }
.sheet-disclaimer strong { color: var(--ink); }
.print-note { display: none; }

/* Seitenleiste */
.inv-side { display: grid; gap: 16px; min-width: 0; }
.side-card { padding: 18px 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); min-width: 0; }
.side-title { margin: 0 0 12px; font-size: 15px; }
.side-text { margin: 0 0 12px; font-size: 14px; }
.side-total {
  display: grid; gap: 6px; color: #d3dcea; border-color: var(--navy);
  background: radial-gradient(420px 220px at 100% 0%, rgba(66, 144, 251, .32), transparent 70%), var(--navy);
}
.side-label { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-light); }
.side-amount-row { display: flex; align-items: center; gap: 10px; }
.side-amount { font-family: var(--font-head); font-size: 30px; font-weight: 700; line-height: 1.15; color: var(--white); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.side-due { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.side-due .icon { width: 16px; height: 16px; color: var(--blue-light); }
.side-total .copy-btn { background: rgba(255, 255, 255, .08); border-color: rgba(168, 203, 251, .35); color: var(--blue-light); }
.side-total .copy-btn:hover { background: rgba(255, 255, 255, .16); color: var(--white); }
.copy-list { display: grid; gap: 10px; margin: 0; }
.copy-row dt { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.copy-row dd { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 1px 0 0; }
.copy-value { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.copy-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; padding: 0; cursor: pointer;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted);
  transition: color .15s ease, border-color .15s ease;
}
.copy-btn .icon { width: 16px; height: 16px; }
.copy-btn:hover { border-color: var(--blue-light); color: var(--blue); }
.copy-btn.is-done, .side-total .copy-btn.is-done { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 13.5px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check .icon { width: 18px; height: 18px; margin-top: 1px; }
.check.is-ok .icon { color: var(--success); }
.check.is-warn .icon { color: var(--warning); }
.check.is-warn { color: var(--warning); font-weight: 500; }
.check.is-info .icon { color: var(--blue); }
.side-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.side-tech dd { font-size: 13px; }

/* Hinweis vor der Anzeige (Haftung), mit OK zu bestätigen */
.notice-dialog {
  width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 28px;
  border: 0; border-radius: var(--radius-lg); background: var(--white); color: var(--text); box-shadow: var(--shadow-pop);
}
.notice-dialog::backdrop { background: rgba(21, 34, 58, .6); }
.notice-icon {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px;
  background: var(--warning-bg); color: var(--warning);
}
.notice-icon .icon { width: 24px; height: 24px; }
.notice-title { margin: 0 0 10px; font-size: 20px; }
.notice-text { margin: 0 0 10px; }
.notice-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.notice-actions .btn-primary { min-width: 120px; }

/* Fehlerseite */
.error-page .main { padding-top: 48px; }
.error-panel { max-width: 560px; margin: 0 auto; display: grid; justify-items: start; gap: 4px; }
.error-panel p { margin: 0 0 16px; color: var(--muted); }
.empty-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-mist); color: var(--blue); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-title { margin: 10px 0 4px; font-size: 22px; }

/* ------------------------------------------------------------------
   Anmeldung (wie im Kundenportal)
   ------------------------------------------------------------------ */
.auth { display: grid; grid-template-columns: minmax(380px, 42%) minmax(0, 1fr); min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 40px; padding: 40px 48px;
  color: #c5d3e8;
  background: radial-gradient(760px 480px at 100% 0%, rgba(66, 144, 251, .28), transparent 62%),
              linear-gradient(160deg, var(--navy-2) 0%, var(--navy) 55%, var(--navy-3) 100%);
}
.auth-brand::after {
  content: ""; position: absolute; right: -150px; bottom: -170px; width: 560px; height: 560px; pointer-events: none;
  background: url("../img/favicon.svg") no-repeat center / contain; opacity: .08;
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .brand img { height: 44px; }
.auth-intro { max-width: 460px; margin-top: auto; }
.eyebrow-light { color: var(--blue-light); }
.auth-title { margin: 10px 0 12px; font-family: var(--font-head); font-size: clamp(26px, 2.6vw, 34px); font-weight: 700; line-height: 1.2; color: var(--white); }
.auth-lead { margin: 0; font-size: 16px; }
.auth-steps { list-style: none; max-width: 460px; margin: 0 0 auto; padding: 0; display: grid; gap: 4px; }
.auth-steps li { display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: start; padding: 12px; border-radius: 12px; }
.auth-steps li.is-current { background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(168, 203, 251, .25); }
.auth-step-no {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid rgba(168, 203, 251, .4); color: var(--blue-light); font: 700 14px/1 var(--font-head);
}
.is-current .auth-step-no { background: var(--blue-bright); border-color: var(--blue-bright); color: var(--white); }
.auth-step-text strong { display: block; font-weight: 600; color: var(--white); }
.auth-step-text small { display: block; margin-top: 2px; font-size: 13.5px; color: #9fb0c9; }
.auth-support { margin: 0; font-size: 14px; }
.auth-support a { color: var(--white); }

.auth-main { display: flex; flex-direction: column; min-width: 0; background: var(--white); }
.auth-main:focus { outline: none; }
.auth-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-heading { margin: 4px 0 10px; font-size: 28px; font-weight: 700; }
.auth-text { margin: 0 0 22px; color: var(--muted); }
.auth-form { display: grid; gap: 14px; margin-bottom: 22px; }
.auth-form .field-label { margin-bottom: -8px; }
.auth-help { font-size: 14px; color: var(--muted); }
.auth-privacy { display: flex; gap: 10px; align-items: flex-start; margin: 22px 0 0; padding: 12px 14px; border-radius: var(--radius); background: var(--light); font-size: 13.5px; color: var(--muted); }
.auth-privacy .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--success); }
.auth-step-mobile { display: none; }
.auth-foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; padding: 18px 24px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.auth-foot a { color: var(--muted); }

.field-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 40px; }
input[type=password], input[type=text] {
  width: 100%; min-height: 48px; padding: 10px 12px;
  font: inherit; font-size: 16px; color: var(--ink); background: var(--white);
  border: 1px solid var(--field-border); border-radius: var(--radius);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover { border-color: #a9b7cb; }
input:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
input:disabled { background: var(--light); cursor: not-allowed; }

/* ------------------------------------------------------------------
   Breakpoints (nur Bildschirm; der Druck hat eigene Regeln)
   ------------------------------------------------------------------ */
@media screen and (max-width: 1099.98px) {
  /* Zahlbetrag über der Rechnung, Bankverbindung, Prüfung und Technik darunter */
  .inv-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "total" "sheet" "side"; }
  .inv-side { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
}

@media screen and (max-width: 1023.98px) {
  .topbar { padding-left: 16px; gap: 12px; }
  .main { padding: 24px 24px 0; }
  .start-grid { grid-template-columns: minmax(0, 1fr); }
  .sheet { padding: 26px 24px; }
}

@media screen and (max-width: 899.98px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-brand { gap: 14px; padding: 18px 20px 22px; }
  .auth-brand::after { width: 260px; height: 260px; right: -70px; bottom: -120px; }
  .auth-brand .brand img { height: 32px; }
  .auth-intro { margin-top: 0; }
  .auth-title { margin: 6px 0 0; font-size: 21px; }
  .auth-lead, .auth-steps, .auth-support { display: none; }
  .auth-panel { align-items: flex-start; padding: 28px 20px 36px; }
  .auth-step-mobile { display: inline-block; }
  .auth-heading { font-size: 24px; }
}

@media screen and (max-width: 759.98px) {
  .topbar { padding-right: 8px; }
  .brand img { height: 28px; }
  .topbar-divider, .topbar-title { display: none; }
  .topbar-link span { display: none; }
  .topbar-link { padding: 8px 10px; }
  .main { padding: 20px 16px 0; }
  .main-foot { flex-direction: column; margin-top: 32px; }
  .drop-zone { padding: 32px 18px 28px; }
  .panel { padding: 20px 16px; }
  .doc-row { padding-left: 14px; }
  .inv-toolbar > .btn { width: 100%; }
  .inv-actions { width: 100%; }
  .inv-actions .btn { flex: 1 1 auto; padding: 10px 12px; }
  .inv-side { grid-template-columns: minmax(0, 1fr); }
  .sheet { padding: 20px 16px; font-size: 14px; }
  .sheet-top { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .sheet-doc-title { font-size: 21px; }

  /* Positionen als Karten */
  .lines, .lines tbody, .lines tr, .lines td { display: block; }
  .lines thead { display: none; }
  .lines tr.line { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .lines td { padding: 2px 0; border: 0; }
  .lines td.col-pos, .lines td.col-item { grid-column: 1 / -1; width: auto; }
  .lines td.col-pos { font-size: 12px; }
  .lines td.col-pos:not(:empty)::before { content: "Pos. "; }
  .lines td.col-item { min-width: 0; padding-bottom: 8px; }
  .lines td.col-num { text-align: left; white-space: normal; }
  .lines td.col-num::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .lines td.col-num:empty { display: none; }
  .line.is-sub { padding-left: 14px !important; box-shadow: inset 3px 0 0 var(--blue-light); }
  .line.is-sub .col-item { padding-left: 0; box-shadow: none; }
  .line.has-children > td { background: none; }
  .totals { width: 100%; min-width: 0; }
  .totals td { padding-left: 12px; }
  .totals th { overflow-wrap: anywhere; }
  .side-amount { font-size: 26px; }
  .notice-dialog { padding: 22px 18px; }
  .notice-actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------
   Druck bzw. „Als PDF speichern“: nur das Rechnungsblatt
   ------------------------------------------------------------------ */
@media print {
  @page { size: A4; margin: 14mm 12mm 16mm; }
  html, body { background: #fff !important; }
  body { font-size: 9.5pt; color: #111; }
  .topbar, .main-foot, .skip-link, .start, .inv-toolbar, .inv-side, .inv-total, .callout, .no-print, .sprite, noscript { display: none !important; }
  .main { display: block; min-height: 0; padding: 0; }
  .main-inner { max-width: none; }
  .inv-head { margin-bottom: 6mm; }
  .inv-head .page-lead { font-size: 10pt; }
  .inv-layout { display: block; }
  .sheet { padding: 0; border: 0; border-radius: 0; box-shadow: none; font-size: 9.5pt; }
  .sheet-doc { background: none; border: 1px solid #ccd3de; }
  .lines { font-size: 9pt; }
  .lines thead { display: table-header-group; }
  .lines tr, .party, .sheet-doc, .totals, .attach, .note { break-inside: avoid; }
  .sheet-heading { break-after: avoid; }
  .line.has-children > td { background: none; }
  .sheet-disclaimer { display: none !important; }
  .print-note { display: block; margin: 8mm 0 0; font-size: 8pt; color: #555; }
  a { color: inherit; text-decoration: none; }
}
