/* ERP-Web – gemeinsames Design */
:root {
  --bg: #f4f6f8; --panel: #ffffff; --text: #1d2329; --muted: #5f6b76; --line: #dde3e9; --line-strong: #c4ccd4;
  --accent: #1f5fbf; --accent-hover: #194e9e; --accent-soft: #e8f0fc;
  --ok: #17803d; --ok-soft: #e6f4ea; --warn: #9a5b00; --warn-soft: #fff4e0; --err: #c0262d; --err-soft: #fdecec;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 12px; font-weight: 600; }

/* Kopfzeile */
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 52px; background: #17212b; color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar .brand { font-weight: 700; letter-spacing: .02em; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a, .topbar nav span { color: #c9d3dd; padding: 6px 10px; border-radius: 6px; }
.topbar nav a:hover { background: #24313e; color: #fff; text-decoration: none; }
.topbar nav a.active { background: #2b3b4b; color: #fff; }
.topbar nav span.soon { color: #6e7d8b; cursor: default; }
.topbar .user { color: #c9d3dd; font-size: 13px; display: flex; gap: 12px; align-items: center; }
.topbar .user a { color: #c9d3dd; }

/* Layout */
.page { max-width: 1400px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; gap: 16px; }
.page-head p { margin: 0; color: var(--muted); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }
.side { position: sticky; top: 72px; display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.side .card { margin-bottom: 0; }
.grid { display: grid; gap: 12px 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 760px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }

/* Formulare */
label.f { display: block; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
label.f > span .req { color: var(--err); }
input, select, textarea { width: 100%; font: inherit; color: inherit; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 64px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.subhead { font-weight: 600; margin: 4px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.linklike { background: none; border: 0; color: var(--accent); padding: 0; font: inherit; font-size: 12px; cursor: pointer; }
.linklike:hover { text-decoration: underline; }

/* Auswahlfeld mit Suche */
.combo { position: relative; }
.combo .list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); max-height: 280px; overflow: auto; z-index: 30; display: none; }
.combo.open .list { display: block; }
.combo .opt { padding: 7px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.combo .opt small { color: var(--muted); white-space: nowrap; }
.combo .opt.hi { background: var(--accent-soft); }
.combo .empty { padding: 8px 10px; color: var(--muted); }
.combo.chosen input { background: #fbfdff; }

/* Positionen */
table.items { width: 100%; border-collapse: collapse; }
table.items th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 6px 6px; border-bottom: 1px solid var(--line); }
table.items td { padding: 6px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
table.items .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.items td.pos { width: 44px; color: var(--muted); }
table.items td.qty { width: 110px; }
table.items td.unit { width: 56px; color: var(--muted); }
table.items td.price { width: 130px; }
table.items td.sum { width: 110px; font-weight: 600; }
table.items td.del { width: 36px; text-align: center; }
table.items input.override { text-align: right; }
table.items input.override::placeholder { color: #8a96a1; }
.iconbtn { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.iconbtn:hover { background: var(--err-soft); color: var(--err); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 14px; border: 1px solid var(--line-strong); background: #fff; color: var(--text); cursor: pointer; }
.btn:hover { background: #f1f4f7; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.big { width: 100%; padding: 12px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 13px; }

/* Preisvorschau */
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.sum-row.adj { color: var(--muted); font-size: 13px; }
.sum-row.adj.neg span:last-child { color: var(--ok); }
.sum-row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-weight: 700; }
.sum-row.gross { font-size: 18px; font-weight: 700; }
.muted { color: var(--muted); }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #eef1f4; color: var(--muted); }
.pill.NEW { background: #eef1f4; } .pill.CONFIRMED { background: #e3f1fb; color: #155a8a; } .pill.SCHEDULED { background: var(--accent-soft); color: var(--accent); }
.pill.IN_TRANSIT { background: var(--warn-soft); color: var(--warn); } .pill.DELIVERED { background: var(--ok-soft); color: var(--ok); }
.pill.INVOICED { background: #f1e9fb; color: #6a35a8; } .pill.CANCELLED { background: var(--err-soft); color: var(--err); }

/* Meldungen */
.msg { border-radius: 8px; padding: 10px 12px; white-space: pre-line; }
.msg.err { background: var(--err-soft); color: var(--err); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.warnings { display: grid; gap: 6px; }
.warnings div { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.hidden { display: none !important; }

/* Liste "zuletzt" */
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #eef1f4; font-size: 13px; }
.recent li:last-child { border-bottom: 0; }

/* Erfolg */
.success { text-align: center; padding: 32px 16px; }
.success .big { font-size: 34px; font-weight: 800; margin: 6px 0 2px; letter-spacing: .02em; }
.success .actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 360px; }
.login h1 { margin-bottom: 18px; }
.login .grid { gap: 14px; }

/* Tabellen allgemein */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 8px; border-bottom: 1px solid #eef1f4; }
table.list th { font-size: 12px; color: var(--muted); }

/* kleine Abstands-/Layout-Helfer (keine Inline-Stile wegen CSP) */
.mt { margin-top: 14px; }
.mt-s { margin-top: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.h2-note { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }
.week-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.readonly-note { margin-bottom: 16px; }
.help { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 8px; }
