/* ------------------------------------------------------------------
   AM Verwaltung – Stylesheet
   ------------------------------------------------------------------ */
:root {
  --blue-900: #0b2a4a;
  --blue-800: #113c74;
  --blue-700: #164e8a;
  --blue-600: #1a5fa8;
  --blue-500: #1f6fc5;
  --blue-400: #4a8fd8;
  --blue-100: #e3eefa;
  --blue-50: #f1f6fc;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --text: #182230;
  --muted: #64748b;
  --border: #e3e8ef;
  --border-strong: #cbd5e1;
  --green: #15803d;
  --green-bg: #dcfce7;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --gray-bg: #eef2f6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(11, 42, 74, .14);
  --sidebar-w: 240px;
  --font: "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .6em; }
small, .muted { color: var(--muted); }
.muted { font-size: 13px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--gray-bg); padding: 1px 5px; border-radius: 4px; }

/* ------------------------------------------------------------ Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--blue-900), var(--blue-800));
  color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  flex-shrink: 0;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px 16px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; }
.brand-text small { font-size: 11.5px; opacity: .75; }
.nav { display: flex; flex-direction: column; padding: 6px 12px; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.82); padding: 9px 12px; border-radius: 9px; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255,255,255,.16); color: #fff; }
.nav .ico { width: 20px; text-align: center; opacity: .9; font-size: 15px; }
.nav-sep { height: 1px; background: rgba(255,255,255,.12); margin: 10px 8px; }
.sidebar-footer { margin-top: auto; padding: 16px; }
.main { flex: 1; min-width: 0; padding: 28px 32px 60px; }
.menu-toggle { display: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }

/* ------------------------------------------------------------ Cards & Grid */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.layout-side > .side { position: sticky; top: 20px; }

.stat { padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; color: var(--blue-900); }
.stat .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat.accent { background: linear-gradient(135deg, var(--blue-700), var(--blue-500)); color: #fff; border: 0; }
.stat.accent .label, .stat.accent .hint { color: rgba(255,255,255,.8); }
.stat.accent .value { color: #fff; }

/* ------------------------------------------------------------ Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 13.5px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: #fff; color: var(--text); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--blue-50); border-color: var(--blue-400); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue-500); border-color: var(--blue-500); color: #fff; }
.btn-primary:hover { background: var(--blue-600); border-color: var(--blue-600); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #166534; }
.btn-danger { color: var(--red); border-color: #fca5a5; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--gray-bg); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px 8px; min-width: 32px; }

/* ------------------------------------------------------------ Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 600; color: #334155; }
.field label .req { color: var(--red); }
.field .help { font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=time], input[type=search], select, textarea {
  font: inherit; color: var(--text);
  padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff;
  width: 100%; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(31,111,197,.15); }
input[readonly], textarea[readonly], select:disabled, input:disabled { background: var(--gray-bg); color: #475569; }
textarea { min-height: 72px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--blue-500); }
.inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline-form .field { min-width: 160px; }
.search { max-width: 320px; }

/* ------------------------------------------------------------ Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 10px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #fafbfd; white-space: nowrap; }
.tbl tbody tr:hover { background: var(--blue-50); }
.tbl tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.actions { white-space: nowrap; text-align: right; }
.tbl .empty td { text-align: center; color: var(--muted); padding: 28px; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--border-strong); }

/* ------------------------------------------------------------ Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-bg); color: #475569; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-entwurf { background: var(--amber-bg); color: var(--amber); }
.badge-festgeschrieben { background: var(--blue-100); color: var(--blue-700); }
.badge-versendet { background: #e0e7ff; color: #3730a3; }
.badge-bezahlt { background: var(--green-bg); color: var(--green); }
.badge-storniert { background: var(--red-bg); color: var(--red); }
.badge-storno { background: var(--red-bg); color: var(--red); }
.badge-dauerrechnung { background: #ede9fe; color: #5b21b6; }
.badge-privat { background: #fce7f3; color: #9d174d; }
.badge-firma { background: var(--blue-100); color: var(--blue-700); }
.badge-ok { background: var(--green-bg); color: var(--green); }
.badge-warn { background: var(--amber-bg); color: var(--amber); }
.badge-plain::before { display: none; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--blue-100); color: var(--blue-700); font-size: 11.5px; font-weight: 600; }

/* ------------------------------------------------------------ Notices */
.notice { padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.notice + .notice { margin-top: 8px; }
.notice-info { background: var(--blue-50); border-color: #bfd7f3; color: var(--blue-800); }
.notice-warn { background: var(--amber-bg); border-color: #fcd34d; color: #78350f; }
.notice-error { background: var(--red-bg); border-color: #fca5a5; color: #7f1d1d; }
.notice-ok { background: var(--green-bg); border-color: #86efac; color: #14532d; }
.notice ul { margin: 4px 0 0; padding-left: 18px; }

/* ------------------------------------------------------------ Positions editor */
.pos-table th, .pos-table td { padding: 6px 6px; }
.pos-table { table-layout: fixed; }
.pos-table textarea { min-height: 38px; padding: 6px 9px; line-height: 1.35; width: 100%; }
.pos-table input[type=number] { text-align: right; }
.pos-table .pos-nr { width: 30px; color: var(--muted); text-align: center; padding-top: 12px; }
.pos-table .w-menge { width: 72px; }
.pos-table .w-einheit { width: 92px; }
.pos-table .w-preis { width: 104px; }
.pos-table .w-betrag { width: 100px; text-align: right; padding-top: 12px; font-variant-numeric: tabular-nums; }
.pos-table .w-act { width: 86px; white-space: nowrap; padding-left: 0; padding-right: 0; }
.pos-table .btn-icon { min-width: 26px; padding: 4px 5px; }
.pos-table input { padding-left: 8px; padding-right: 8px; }
.totals { margin-left: auto; width: 320px; margin-top: 12px; }
.totals div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.totals div.total { font-weight: 700; font-size: 16px; border-bottom: 0; border-top: 2px solid var(--border-strong); color: var(--blue-900); }

/* ------------------------------------------------------------ Attachments */
.attach-group { margin-bottom: 14px; }
.attach-group h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; display: flex; justify-content: space-between; }
.attach-list { display: flex; flex-direction: column; gap: 6px; }
.attach-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 9px; background: #fafbfd; font-size: 13px; }
.attach-item .thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--gray-bg); flex-shrink: 0; }
.attach-item .thumb.pdf { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 10px; color: var(--red); background: var(--red-bg); }
.attach-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; transition: all .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--blue-500); background: var(--blue-50); color: var(--blue-700); }
.dropzone input { display: none; }

/* ------------------------------------------------------------ Status timeline */
.timeline { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.timeline .step { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); margin-top: 5px; flex-shrink: 0; }
.timeline .step.done { color: var(--text); }
.timeline .step.done .dot { background: var(--green); }
.timeline .step.current .dot { background: var(--blue-500); box-shadow: 0 0 0 3px rgba(31,111,197,.2); }
.timeline .step.current { color: var(--blue-800); font-weight: 600; }

/* ------------------------------------------------------------ Toasts & Modal */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: var(--blue-900); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .2s ease-out; max-width: 380px; }
.toast-error { background: var(--red); }
.toast-ok { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 42, 74, .45); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 20px; }
.modal { background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; animation: toast-in .15s ease-out; }
.modal.wide { max-width: 760px; }
.modal-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 16px 22px; }
.modal-foot { padding: 0 22px 18px; display: flex; justify-content: flex-end; gap: 8px; }

/* ------------------------------------------------------------ Misc */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }
.bar { height: 8px; background: var(--blue-100); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue-500); border-radius: 999px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { width: auto; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-strong); background: #fff; font-size: 12.5px; cursor: pointer; font-weight: 500; }
.chip.active { background: var(--blue-500); color: #fff; border-color: var(--blue-500); }
.ws-group { margin-bottom: 14px; }
.ws-group h3 { margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.ws-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.ws-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.ws-item .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border-strong); flex-shrink: 0; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--blue-500); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------ Druckansicht (Rechnungsdokument) */
.doc-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; }
.doc {
  background: #fff; width: 210mm; min-height: 296mm; margin: 0 auto; padding: 18mm 20mm 16mm;
  box-shadow: var(--shadow-lg); color: #182230; font-size: 10.5pt; line-height: 1.4; position: relative;
  display: flex; flex-direction: column;
}
.doc * { box-sizing: border-box; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14mm; }
.doc-brand { display: flex; gap: 10px; align-items: center; }
.doc-brand img { width: 46px; height: 46px; border-radius: 10px; }
.doc-brand .n { font-weight: 700; font-size: 14pt; color: var(--blue-900); letter-spacing: -.01em; line-height: 1.1; }
.doc-brand .s { font-size: 9pt; color: var(--blue-600); font-weight: 600; margin-top: 2px; }
.doc-title { text-align: right; }
.doc-title .t { font-size: 22pt; font-weight: 800; color: var(--blue-500); letter-spacing: .04em; line-height: 1; }
.doc-title .nr { font-size: 10.5pt; color: #475569; margin-top: 4px; font-weight: 600; }
.doc-addr-row { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 10mm; }
.doc-sender { font-size: 7.5pt; color: #64748b; border-bottom: 1px solid #cbd5e1; padding-bottom: 2px; margin-bottom: 6px; width: 85mm; }
.doc-recipient { white-space: pre-line; font-size: 10.5pt; min-height: 30mm; }
.doc-recipient .le { margin-top: 6px; font-size: 8.5pt; color: #475569; }
.doc-meta { font-size: 9.5pt; min-width: 72mm; }
.doc-meta table { border-collapse: collapse; }
.doc-meta td { padding: 1.5px 0; vertical-align: top; }
.doc-meta td:first-child { color: #64748b; padding-right: 12px; white-space: nowrap; }
.doc-meta td:last-child { font-weight: 600; }
.doc-h { font-size: 13pt; font-weight: 700; margin-bottom: 3mm; color: var(--blue-900); }
.doc-intro { margin-bottom: 4mm; white-space: pre-line; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 3mm; font-size: 10pt; }
.doc-table th { text-align: left; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .05em; color: #fff; background: var(--blue-700); padding: 6px 8px; }
.doc-table th.r, .doc-table td.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-table td { padding: 6px 8px; border-bottom: 1px solid #e3e8ef; vertical-align: top; }
.doc-table td.desc { white-space: pre-line; }
.doc-table tr.textonly td { color: #334155; border-bottom-style: dashed; }
.doc-totals { margin-left: auto; width: 72mm; font-size: 10pt; margin-bottom: 6mm; }
.doc-totals div { display: flex; justify-content: space-between; padding: 3px 8px; font-variant-numeric: tabular-nums; }
.doc-totals .grand { background: var(--blue-100); color: var(--blue-900); font-weight: 800; font-size: 11.5pt; border-radius: 6px; padding: 6px 8px; margin-top: 3px; }
.doc-text { font-size: 9.5pt; white-space: pre-line; margin-bottom: 3mm; }
.doc-note { font-size: 8.5pt; color: #475569; margin-top: 2mm; }
.doc-footer { margin-top: auto; border-top: 1.5px solid var(--blue-500); padding-top: 3mm; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; font-size: 7.8pt; color: #475569; line-height: 1.45; }
.doc-footer b { color: var(--blue-900); display: block; margin-bottom: 1px; }
.doc-anlagen { font-size: 9pt; color: #334155; margin-bottom: 4mm; }
.doc-storno-band { display: inline-block; background: var(--red-bg); color: var(--red); font-weight: 700; padding: 2px 10px; border-radius: 6px; font-size: 9pt; margin-bottom: 3mm; }
.doc-entwurf { position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%) rotate(-28deg); font-size: 64pt; font-weight: 900; color: rgba(180, 83, 9, .10); letter-spacing: .1em; pointer-events: none; }
.print-wrap { background: #e2e8f0; margin: -28px -32px -60px; padding: 24px 32px 60px; min-height: 100vh; }

/* ------------------------------------------------------------ Globale Suche */
.global-search { position: relative; padding: 0 14px 8px; }
.global-search input { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.15); color: #fff; font-size: 13px; padding: 7px 10px; }
.global-search input::placeholder { color: rgba(255,255,255,.55); }
.global-search input:focus { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); box-shadow: none; }
.search-results { position: absolute; left: 14px; right: 14px; top: 100%; background: #fff; color: var(--text); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 950; max-height: 70vh; overflow: auto; padding: 6px 0; }
.search-results a { display: flex; flex-direction: column; padding: 7px 12px; color: var(--text); font-size: 13px; line-height: 1.3; }
.search-results a:hover { background: var(--blue-50); text-decoration: none; }
.search-results a span { color: var(--muted); font-size: 12.5px; }
.search-results a small { color: var(--muted); font-size: 11.5px; display: flex; gap: 6px; align-items: center; }
.search-results .badge { font-size: 10.5px; padding: 0 7px; }
.sr-group { padding: 6px 12px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-600); font-weight: 700; }
.sr-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { font: inherit; font-weight: 600; font-size: 13.5px; padding: 9px 14px; border: 0; background: none; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--blue-700); border-bottom-color: var(--blue-500); }
.tabs button:hover { color: var(--blue-800); }

/* ------------------------------------------------------------ Winterdienst Tagesliste */
.ws-toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.ws-toolbar .field { min-width: 150px; }
.ws-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ws-progress .bar { flex: 1; height: 10px; }
.ws-progress .bar > span { background: var(--green); }
.ws-check { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; user-select: none; transition: background .12s, border-color .12s; min-height: 64px; }
.ws-check:hover { border-color: var(--blue-400); background: var(--blue-50); }
.ws-check.done { background: var(--green-bg); border-color: #86efac; }
.ws-check .box { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--border-strong); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 16px; background: #fff; }
.ws-check.done .box { background: var(--green); border-color: var(--green); }
.ws-check .info { flex: 1; min-width: 0; }
.ws-check .info b { display: block; font-size: 14px; }
.ws-check .info small { color: var(--muted); display: block; }
.ws-check .marks { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.ws-check .mark { font-size: 11px; font-weight: 700; color: #fff; background: var(--blue-500); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.ws-check .del { font-size: 14px; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.ws-check .del:hover { background: var(--red-bg); color: var(--red); }

/* ------------------------------------------------------------ Monatsmatrix */
.matrix-wrap { overflow-x: auto; }
.matrix { border-collapse: collapse; font-size: 12px; }
.matrix th, .matrix td { border: 1px solid var(--border); padding: 3px 4px; text-align: center; white-space: nowrap; }
.matrix th { background: #fafbfd; color: var(--muted); font-weight: 600; font-size: 11px; }
.matrix th.we, .matrix td.we { background: #f8fafc; }
.matrix td.obj { text-align: left; min-width: 220px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; position: sticky; left: 0; background: #fff; }
.matrix th.obj { text-align: left; position: sticky; left: 0; z-index: 2; }
.matrix td.hit { background: var(--blue-500); color: #fff; font-weight: 700; }
.matrix td.hit.billed { background: var(--green); }
.matrix td.sum { font-weight: 700; }
.matrix tr:hover td { filter: brightness(.97); }

/* ------------------------------------------------------------ Mahnstufe & Fälligkeit */
.badge-mahn1 { background: var(--amber-bg); color: var(--amber); }
.badge-mahn2, .badge-mahn3 { background: var(--red-bg); color: var(--red); }
.overdue { color: var(--red); font-weight: 700; }
.due-soon { color: var(--amber); font-weight: 600; }
.tbl td.check, .tbl th.check { width: 34px; text-align: center; }
.tbl td.check input, .tbl th.check input { width: 16px; height: 16px; accent-color: var(--blue-500); }
.bulkbar { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--blue-50); border: 1px solid #bfd7f3; border-radius: 10px; margin-bottom: 12px; }
.heatbar { display: flex; gap: 2px; align-items: flex-end; height: 60px; }
.heatbar span { flex: 1; background: var(--blue-500); border-radius: 3px 3px 0 0; min-height: 2px; }
.heatbar span.prev { background: var(--blue-100); }
.kategorie-row { display: grid; grid-template-columns: 180px 1fr 110px 60px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.doc-page-break { page-break-before: always; break-before: page; margin-top: 24px; }
@media print { .doc-page-break { margin-top: 0; } }
.doc-sign { display: flex; gap: 40px; margin-top: 18mm; font-size: 9pt; color: #475569; }
.doc-sign div { flex: 1; border-top: 1px solid #94a3b8; padding-top: 4px; }

/* ------------------------------------------------------------ Responsive */
@media (max-width: 1100px) {
  .layout-side { grid-template-columns: 1fr; }
  .layout-side > .side { position: static; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 800; transform: translateX(-100%); transition: transform .2s; width: 260px; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: block; position: fixed; top: 12px; left: 12px; z-index: 810; font-size: 18px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; }
  .main { padding: 60px 16px 40px; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .doc { width: 100%; padding: 14mm 12mm; }
  .print-wrap { margin: -60px -16px -40px; padding: 60px 8px 40px; }
  .ws-list { grid-template-columns: 1fr; }
  .ws-check { min-height: 72px; }
  .kategorie-row { grid-template-columns: 1fr 90px; }
  .kategorie-row .bar, .kategorie-row .pct { display: none; }
}

/* ------------------------------------------------------------ Print */
@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .no-print, .sidebar, .menu-toggle, .doc-toolbar, .toasts { display: none !important; }
  .main { padding: 0; }
  .print-wrap { background: #fff; margin: 0; padding: 0; min-height: 0; }
  .doc { box-shadow: none; margin: 0; width: 210mm; min-height: 297mm; padding: 16mm 18mm 14mm; }
  .doc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-totals .grand, .doc-storno-band { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ------------------------------------------------------------ 0.3.0: Benutzer, E-Mail, Steuerberater */
.user-box { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; justify-content: space-between; gap: 8px; color: rgba(255,255,255,.85); font-size: 13px; }
.user-box .user-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-box .user-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-box .user-info small { opacity: .65; font-size: 11.5px; }
.user-box .user-actions { display: flex; flex-direction: column; gap: 2px; }
.user-box .btn-ghost { color: rgba(255,255,255,.8); padding: 3px 8px; font-size: 12px; }
.user-box .btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.mail-anhaenge { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fafbfd; }
.mail-anhaenge .check { font-weight: 500; font-size: 13.5px; }
.mail-anhaenge .check span { flex: 1; }
.mail-anhaenge .check small { font-size: 12px; }
.monat-wahl { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "▸ "; }
details[open] summary::before { content: "▾ "; }
@media (max-width: 820px) {
  .user-box { flex-direction: column; align-items: stretch; }
  .user-box .user-actions { flex-direction: row; }
}

/* ------------------------------------------------------------ Rechnungseingang (0.4.0) */
.badge-neu { background: var(--blue-100); color: var(--blue-700); }
.badge-geprueft { background: #e0e7ff; color: #3730a3; }
.badge-freigegeben { background: var(--amber-bg); color: var(--amber); }
.badge-abgelehnt { background: var(--gray-bg); color: #64748b; }
.badge-format { background: #f1f5f9; color: #334155; font-weight: 600; }
.badge-format.zugferd, .badge-format.xrechnung-cii, .badge-format.xrechnung-ubl { background: var(--green-bg); color: var(--green); }
.viewer { width: 100%; height: min(78vh, 1000px); border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
.viewer-leer { padding: 40px; text-align: center; color: var(--muted); }
.ein-doc { border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; background: #fff; }
.ein-doc h3 { margin: 0 0 4px; font-size: 16px; }
.ein-doc .kv { grid-template-columns: 140px 1fr; }
.hinweis-liste { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.stat.warn .value { color: var(--amber); }
.stat.danger .value { color: var(--red); }
.tbl td.wrap { white-space: normal; max-width: 260px; }

/* ------------------------------------------------------------ Anlagen-Karte (0.5.1) */
.attach-pflicht { font-size: 12.5px; color: #7c5a00; background: var(--amber-bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; line-height: 1.45; }
.attach-group { margin: 0 -4px 10px; padding: 10px 10px 10px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--border); }
.attach-group.fehlt { background: #fffbeb; border-color: #fde68a; }
.attach-group h4 { display: none; }
.attach-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.attach-icon { font-size: 15px; line-height: 1; }
.attach-title { font-weight: 600; font-size: 13.5px; color: var(--text); flex: 1; text-transform: none; letter-spacing: 0; }
.attach-status { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--gray-bg); color: #64748b; white-space: nowrap; }
.attach-status.ok { background: var(--green-bg); color: var(--green); }
.attach-status.fehlt { background: #fef3c7; color: #92400e; }
.attach-item { background: #fff; }
.attach-item .thumb.pdf { text-decoration: none; }
.attach-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.attach-photo { position: relative; display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.attach-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-photo-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(15,23,42,.65); color: #fff; font-size: 11px; cursor: pointer; display: none; align-items: center; justify-content: center; }
.attach-photo:hover .attach-photo-del { display: flex; }
.dropzone.small { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 8px; padding: 8px 10px; margin-top: 6px; border-width: 1px; border-radius: 8px; background: #fff; }
.dropzone.small span { font-weight: 600; color: var(--blue-700); font-size: 13px; }
.dropzone.small small { color: var(--muted); font-size: 11.5px; }
.dropzone.small:hover, .dropzone.small.over { background: var(--blue-50); }
.attach-group .attach-list { margin-bottom: 4px; }

/* ------------------------------------------------------------ Fotodokumentation (0.5.1) */
.doc.fotodoku { display: flex; flex-direction: column; }
.fd-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 18px; font-size: 9.5pt; margin: 2mm 0 5mm; padding: 3mm 4mm; background: #f1f5f9; border-radius: 6px; }
.fd-meta div { display: flex; justify-content: space-between; gap: 10px; }
.fd-meta span { color: #64748b; }
.fd-bild { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 160mm; max-height: 200mm; }
.fd-bild img { max-width: 100%; max-height: 200mm; object-fit: contain; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.fd-caption { font-size: 9.5pt; color: #334155; margin-top: 4mm; text-align: center; }
.fd-footer { margin-top: auto; display: flex; justify-content: space-between; font-size: 8.5pt; color: #64748b; border-top: 1px solid #e2e8f0; padding-top: 2mm; }
@media print { .fd-meta { -webkit-print-color-adjust: exact; print-color-adjust: exact; } .doc.fotodoku { height: 297mm; } }
.attach-fotodoku { font-size: 12px; margin: 0 0 8px; }
.attach-fotodoku a { font-weight: 600; }

/* ------------------------------------------------------------ Angebote (0.5.1) */
.badge-a-entwurf { background: var(--amber-bg); color: var(--amber); }
.badge-a-gesendet { background: var(--blue-100); color: var(--blue-700); }
.badge-a-angenommen { background: var(--green-bg); color: var(--green); }
.badge-a-abgelehnt { background: var(--red-bg); color: var(--red); }
.badge-a-abgelaufen { background: var(--gray-bg); color: #64748b; }
.badge-a-in_rechnung { background: #ede9fe; color: #5b21b6; }
.doc-auftrag { margin-top: 10mm; padding: 5mm 6mm; border: 1px solid #cbd5e1; border-radius: 6px; page-break-inside: avoid; break-inside: avoid; }
.doc-auftrag-title { font-weight: 700; font-size: 10.5pt; color: var(--blue-900); margin-bottom: 2mm; }
.doc-auftrag-text { font-size: 9.5pt; color: #334155; margin-bottom: 9mm; }
.doc-auftrag-row { display: flex; gap: 12mm; }
.doc-auftrag-row > div { flex: 1; }
.doc-auftrag-row i { display: block; border-bottom: 1px solid #334155; height: 1px; }
.doc-auftrag-row small { display: block; font-size: 8pt; color: #64748b; margin-top: 1.5mm; }

/* ------------------------------------------------------------ Lesbarkeit (0.5.2): Inhalt nicht endlos breit, größere Felder, Schriftgrößen-Schalter */
.main > * { max-width: 1380px; }
.field label { font-size: 13.5px; }
.field .help { font-size: 12.5px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=time], input[type=search], select, textarea { padding: 10px 12px; font-size: 15px; }
.pos-table textarea, .pos-table input, .pos-table select { font-size: 15px; }
.pos-table th, .pos-table td { padding: 8px 6px; }
.btn-lg { padding: 12px 20px; font-size: 15.5px; border-radius: 11px; }
.schritte { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 16px; }
.schritte .schritt { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-size: 13.5px; color: var(--muted); }
.schritte .schritt b { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; background: var(--gray-bg); color: #475569; font-size: 12px; }
.schritte .schritt.ok { color: var(--green); border-color: #bbf7d0; background: #f0fdf4; }
.schritte .schritt.ok b { background: var(--green); color: #fff; }
.schritte .schritt.aktiv { color: var(--blue-700); border-color: var(--blue-400); background: var(--blue-50); }
.schritte .schritt.aktiv b { background: var(--blue-500); color: #fff; }
details.mehr { grid-column: 1 / -1; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 0 12px; }
details.mehr summary { cursor: pointer; padding: 10px 0; font-weight: 600; color: var(--blue-700); font-size: 13.5px; list-style: none; }
details.mehr summary::before { content: "▸ "; }
details.mehr[open] summary::before { content: "▾ "; }
details.mehr .form-grid { padding: 0 0 12px; }
html[data-schrift="gross"] body { font-size: 16.5px; }
html[data-schrift="gross"] .field label { font-size: 15px; }
html[data-schrift="gross"] .field .help, html[data-schrift="gross"] .muted { font-size: 14px; }
html[data-schrift="gross"] input[type=text], html[data-schrift="gross"] input[type=email], html[data-schrift="gross"] input[type=date], html[data-schrift="gross"] input[type=number], html[data-schrift="gross"] input[type=search], html[data-schrift="gross"] select, html[data-schrift="gross"] textarea { font-size: 17px; padding: 11px 13px; }
html[data-schrift="gross"] table.tbl { font-size: 15.5px; }
html[data-schrift="gross"] .btn { font-size: 15px; padding: 10px 16px; }
html[data-schrift="gross"] h1 { font-size: 28px; }
html[data-schrift="gross"] .card-head h2 { font-size: 19px; }
html[data-schrift="gross"] .nav a { font-size: 16px; }
html[data-schrift="gross"] .pos-table .w-menge { width: 84px; }
html[data-schrift="gross"] .pos-table .w-preis { width: 120px; }

/* ------------------------------------------------------------ Startseite (0.5.2) */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.hero > div:first-child { background: linear-gradient(135deg, var(--blue-800), var(--blue-500)); color: #fff; border-radius: var(--radius); padding: 26px 28px; display: flex; flex-direction: column; justify-content: center; }
.hero-datum { font-size: 13.5px; opacity: .85; text-transform: capitalize; }
.hero-gruss { font-size: 32px; font-weight: 800; margin: 4px 0 6px; letter-spacing: -.02em; }
.hero-sub { font-size: 15.5px; opacity: .95; }
.hero-sub .overdue { color: #fecaca; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-actions .btn { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); }
.hero-actions .btn:hover { background: rgba(255,255,255,.24); }
.hero-actions .btn-primary { background: #fff; color: var(--blue-800); border-color: #fff; }
.wetter { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.wetter-laden, .wetter-leer { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13.5px; }
.wetter-kopf { font-weight: 700; font-size: 14px; color: var(--blue-900); }
.wetter-tage { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; flex: 1; }
.wetter-tag { text-align: center; padding: 8px 4px; border-radius: 10px; background: #f8fafc; }
.wetter-tag.morgen { background: var(--blue-50); outline: 1px solid var(--blue-100); }
.wt-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.wt-icon { font-size: 30px; line-height: 1.2; margin: 2px 0; }
.wt-temp { font-size: 15px; }
.wt-text { font-size: 12.5px; color: #334155; }
.wt-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.wetter-warn { display: block; text-align: center; background: var(--amber-bg); color: var(--amber); font-weight: 600; border-radius: 8px; padding: 8px 10px; font-size: 13.5px; text-decoration: none; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kachel { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); text-decoration: none; color: var(--text); transition: transform .08s, box-shadow .12s; }
.kachel:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); text-decoration: none; }
.kachel-icon { font-size: 18px; color: var(--blue-600); }
.kachel-zahl { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--blue-900); line-height: 1.1; }
.kachel-titel { font-weight: 600; font-size: 14px; }
.kachel-sub { font-size: 12.5px; color: var(--muted); }
.kachel.warn { border-color: #fde68a; background: #fffbeb; }
.kachel.warn .kachel-zahl { color: var(--amber); }
.kachel.ok .kachel-zahl { color: var(--green); }
.tag-rechnung { background: var(--blue-100); color: var(--blue-700); }
.tag-angebot { background: #ede9fe; color: #5b21b6; }
.tag-eingang { background: var(--green-bg); color: var(--green); }
@media (max-width: 1000px) { .hero { grid-template-columns: 1fr; } }
.pos-table .w-einheit { width: 104px; }
html[data-schrift="gross"] .pos-table .w-einheit { width: 118px; }
html[data-schrift="gross"] .pos-table .w-act { width: 104px; }
html[data-schrift="gross"] .pos-table .w-betrag { width: 112px; }
