/* Layout: linke Leiste mit Logo und Navigation, rechts eine Arbeitsfläche.
   Farben folgen dem Logo des angemeldeten Nachunternehmers (--brand-dark / --brand). */
@font-face { font-family: 'Archivo'; font-weight: 800; src: url(fonts/archivo-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Archivo'; font-weight: 800; src: url(fonts/archivo-latin-ext-800-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+A720-A7FF; }
@font-face { font-family: 'Archivo'; font-weight: 700; src: url(fonts/archivo-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC; }
@font-face { font-family: 'Archivo'; font-weight: 700; src: url(fonts/archivo-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF; }
@font-face { font-family: 'Source Sans 3'; font-weight: 400; src: url(fonts/source-sans-3-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC; }
@font-face { font-family: 'Source Sans 3'; font-weight: 400; src: url(fonts/source-sans-3-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF; }
@font-face { font-family: 'Source Sans 3'; font-weight: 600; src: url(fonts/source-sans-3-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC; }
@font-face { font-family: 'Source Sans 3'; font-weight: 600; src: url(fonts/source-sans-3-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; src: url(fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; src: url(fonts/jetbrains-mono-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF; }

:root {
  --brand-dark: #1E2426;   /* Logo: Anthrazit */
  --brand: #0B6B35;        /* Logo: Grün */
  --brand-ink: #ffffff;
  --bg: #F4F6F3;
  --surface: #ffffff;
  --surface-2: #EAEFEA;
  --line: #D2DAD3;
  --fg: #1E2426;
  --muted: #5F6B63;
  --ok: #1B8A4C; --ok-bg: #E3F5EA;
  --warn: #B8700A; --warn-bg: #FFF2DB;
  --bad: #C0392B; --bad-bg: #FBE5E2;
  --info-bg: color-mix(in srgb, var(--brand) 12%, white);
  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30,36,38,.06), 0 8px 24px -12px rgba(30,36,38,.18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121716; --surface: #1B2321; --surface-2: #243029; --line: #334238; --fg: #ECF1ED; --muted: #9FB1A5;
    --ok-bg: #10331F; --warn-bg: #3A2A0C; --bad-bg: #3D1712; --info-bg: color-mix(in srgb, var(--brand) 22%, #1B2321);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 16px/1.45 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 800; } h2 { font-size: 1.2rem; font-weight: 800; } h3 { font-size: 1rem; font-weight: 700; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { resize: vertical; min-height: 80px; }
label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); font-weight: 600; min-width: 0; }
label > input, label > select, label > textarea { color: var(--fg); font-weight: 400; font-size: 1rem; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .92rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 85%, black); }
.btn.dark { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.hidden, [hidden] { display: none !important; }

/* Shell */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100%; }
.side { background: var(--brand-dark); color: #fff; padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; }
.logo-box { background: #fff; border-radius: var(--radius); padding: 12px; display: grid; place-items: center; min-height: 70px; }
.logo-box img { max-width: 100%; max-height: 110px; object-fit: contain; }
.logo-box .wordmark { font-family: var(--display); font-weight: 800; color: var(--brand-dark); font-size: 1.3rem; }
.side .who { font-size: .85rem; opacity: .85; line-height: 1.3; }
.side .who b { display: block; font-size: 1rem; opacity: 1; }
.nav { display: grid; gap: 3px; }
.nav button { text-align: left; background: transparent; border: 0; color: #fff; padding: 10px 12px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-weight: 600; opacity: .85; }
.nav button:hover { background: rgba(255,255,255,.08); opacity: 1; }
.nav button.active { background: var(--brand); opacity: 1; }
.nav button .badge { margin-left: auto; background: #fff; color: var(--brand-dark); border-radius: 99px; font-size: .75rem; padding: 1px 8px; font-family: var(--mono); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; display: grid; gap: 10px; }
.langs { display: flex; gap: 6px; flex-wrap: wrap; }
.langs button { border: 2px solid transparent; background: transparent; padding: 2px; border-radius: 6px; cursor: pointer; line-height: 0; }
.langs button img { width: 32px; height: 24px; border-radius: 3px; object-fit: cover; display: block; }
.langs button.active { border-color: #fff; }
.langs button:hover { border-color: rgba(255,255,255,.6); }
.main { padding: 28px clamp(16px, 4vw, 44px) 60px; min-width: 0; }
.main > header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 22px; }
.main > header .spacer { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.stack { display: grid; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.muted { color: var(--muted); } .small { font-size: .88rem; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.entwurf { background: var(--surface-2); color: var(--muted); }
.pill.eingereicht, .pill.offen { background: var(--info-bg); color: var(--brand); }
.pill.geprueft, .pill.versendet { background: var(--ok-bg); color: var(--ok); }
.pill.abgelehnt { background: var(--bad-bg); color: var(--bad); }
.pill.abgerechnet, .pill.bezahlt { background: var(--brand-dark); color: #fff; }
.pill.storniert { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.note { border-radius: 8px; padding: 10px 14px; font-size: .95rem; }
.note.info { background: var(--info-bg); } .note.ok { background: var(--ok-bg); color: var(--ok); }
.note.warn { background: var(--warn-bg); color: var(--warn); } .note.bad { background: var(--bad-bg); color: var(--bad); }
.note ul { margin: 6px 0 0; padding-left: 18px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); max-width: 48ch; margin: 0 auto; }

/* Listen */
.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px 16px; align-items: center; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.item:hover { border-color: var(--brand); }
.item .nr { font-family: var(--mono); font-weight: 500; color: var(--brand-dark); }
.item .title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { grid-column: 2; font-size: .85rem; color: var(--muted); }
.item .amt { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

/* Tabellen */
.tablewrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.r, th.r { text-align: right; }
tfoot td { font-weight: 700; border-bottom: 0; padding-top: 10px; }
.edit td input, .edit td select { padding: 6px 8px; border-radius: 6px; }
.edit { min-width: 1280px; } .edit td.w-pos { min-width: 230px; } .edit td.w-str { min-width: 170px; } .edit td.w-nr { min-width: 70px; } .edit td.w-nvt { min-width: 96px; } .edit td.w-we { min-width: 96px; } .edit td.w-m { min-width: 84px; } .edit td.w-d { min-width: 150px; }
.edit td.w-bem { min-width: 150px; }
td .num { text-align: right; }
.row-bad td { background: var(--bad-bg); }
.rowtools { display: flex; gap: 2px; }
.rowtools button { border: 0; background: transparent; cursor: pointer; padding: 4px; border-radius: 6px; color: var(--muted); line-height: 0; }
.rowtools button:hover { background: var(--surface-2); color: var(--fg); }
.rowtools svg { width: 16px; height: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .95rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.total-box { background: var(--brand-dark); color: #fff; border-radius: var(--radius); padding: 14px 18px; display: grid; gap: 4px; }
.total-box .big { font-family: var(--mono); font-size: 1.6rem; font-weight: 500; }
.total-box .sub { opacity: .8; font-size: .9rem; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; background: var(--surface); }
.check input { width: auto; margin-top: 4px; }
.check.on { border-color: var(--brand); background: var(--info-bg); }
.segs { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segs button { border: 0; background: transparent; padding: 7px 14px; cursor: pointer; font-weight: 600; color: var(--muted); }
.segs button.active { background: var(--brand-dark); color: #fff; }
.sendopts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.sendopt { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 8px; align-content: start; }
.sendopt.main { border-color: var(--brand); }
.logo-prev { max-width: 260px; max-height: 120px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.swatches { display: flex; gap: 6px; } .swatches span { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 8px; background: #fff; object-fit: contain; border: 1px solid var(--line); }
.avatar.txt { display: grid; place-items: center; font-family: var(--display); font-weight: 800; color: var(--brand-dark); font-size: .9rem; }
.creds { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; font-family: var(--mono); font-size: .95rem; user-select: all; }
.mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.mini div { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.mini b { display: block; font-family: var(--mono); font-size: 1.25rem; font-weight: 500; }
.mini span { font-size: .8rem; color: var(--muted); }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--brand-dark) 0 55%, var(--brand) 55% 100%); }
.login .card { width: min(420px, 100%); padding: 28px; }
.login .brand { display: grid; gap: 6px; margin-bottom: 22px; }
.login .brand h1 { color: var(--brand-dark); }
.login .langs button.active { border-color: var(--brand); }
.login form { display: grid; gap: 14px; }

/* Modal + Toast */
.modal-bg { position: fixed; inset: 0; background: rgba(30,36,38,.5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border-radius: 14px; padding: 22px; width: min(640px, 100%); max-height: 92vh; overflow: auto; display: grid; gap: 14px; box-shadow: var(--shadow); }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--brand-dark); color: #fff; padding: 11px 18px; border-radius: 99px; box-shadow: var(--shadow); z-index: 60; font-weight: 600; max-width: calc(100% - 32px); }
#toast.bad { background: var(--bad); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 12px 16px; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
  .logo-box { min-height: 56px; padding: 8px; } .logo-box img { max-height: 56px; }
  .side .who { display: none; }
  .nav { grid-column: 1 / -1; grid-auto-flow: column; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  .nav button { white-space: nowrap; padding: 8px 10px; }
  .side .foot { margin: 0; grid-row: 1; grid-column: 2; }
  .main { padding: 18px 16px 40px; }
  .item { grid-template-columns: 1fr auto; gap: 4px 12px; } .item .nr { grid-column: 1; } .item .amt { grid-column: 2; grid-row: 1; } .item .title { grid-column: 1 / -1; white-space: normal; } .item .pill { grid-column: 2; justify-self: end; } .item .sub { grid-column: 1; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .item { transition: border-color .12s, background .12s; } }
@media print { .side, .btn, #toast { display: none !important; } .shell { display: block; } }

/* Passwort anzeigen */
.pwwrap { position: relative; display: block; }
.pwwrap input { padding-right: 42px; }
.eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 4px; line-height: 0; border-radius: 6px; }
.eye:hover { color: var(--fg); } .eye.on { color: var(--brand); }
.eye svg { width: 20px; height: 20px; }
label > .pwwrap > input { color: var(--fg); font-weight: 400; font-size: 1rem; }

/* Auswahl von Aufmaßen → gemeinsame Rechnung */
.selbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.selbar.on { border-style: solid; border-color: var(--brand); background: var(--info-bg); }
.check.sm { padding: 4px 8px; align-items: center; border: 0; background: transparent; }
.check.sm input { margin-top: 0; }
.item.selectable { grid-template-columns: auto auto 1fr auto auto auto; }
.item.selectable .sub { grid-column: 3; }
.item.selectable .del button { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: 6px; color: var(--muted); line-height: 0; }
.item.selectable .del button:hover { background: var(--bad-bg); color: var(--bad); }
.item.selectable .del svg { width: 18px; height: 18px; }
.item.selectable .chk { display: flex; align-items: center; min-width: 18px; }
.item.selectable .chk input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--brand); }
.item.selectable.sel { border-color: var(--brand); background: var(--info-bg); }
@media (max-width: 860px) {
  .item.selectable { grid-template-columns: auto 1fr auto; }
  .item.selectable .chk { grid-column: 1; grid-row: 1 / span 3; }
  .item.selectable .nr { grid-column: 2; } .item.selectable .amt { grid-column: 3; grid-row: 1; }
  .item.selectable .title { grid-column: 2 / -1; } .item.selectable .pill { grid-column: 3; } .item.selectable .sub { grid-column: 2; } .item.selectable .del { display: none; }
}
#imp-out .btn { white-space: normal; text-align: left; width: 100%; }
#imp-out .btn svg { flex: none; }
input[readonly] { background: var(--surface-2); color: var(--muted); }
