:root {
  --bg: #f4f6f8;
  --fg: #1d2329;
  --muted: #5f6b76;
  --line: #d6dce1;
  --accent: #1f5f99;
  --accent-fg: #fff;
  --error: #b42318;
  --card: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
body.center { display: grid; place-items: center; padding: 16px; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
}

form { display: grid; gap: 14px; }
label { display: grid; gap: 4px; font-size: 0.9rem; color: var(--muted); }
input {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  font: inherit;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
}
button:disabled { opacity: 0.6; cursor: default; }
button.secondary { background: transparent; color: var(--accent); }

.error { color: var(--error); margin: 0; }
.muted { color: var(--muted); }

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.top .who { margin-left: auto; color: var(--muted); }
.content { padding: 24px 16px; max-width: 960px; margin: 0 auto; }

.card.wide { max-width: none; margin-bottom: 16px; }
.card h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ok { color: #067647; }
.top a { color: inherit; text-decoration: none; }
.top .pw-link { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.top .pw-link:hover, .top .pw-link.active { color: var(--accent); }
.nav { display: flex; gap: 12px; margin-bottom: 1rem; }
table.list { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.list th, table.list td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.list th { color: var(--muted); font-weight: 600; }
.status-ok { color: #067647; }
.status-with_errors { color: #b54708; }
.status-failed { color: var(--error); }
.status-running { color: var(--accent); }
details summary { cursor: pointer; color: var(--muted); }

/* Gemeinsame Bausteine für Aufträge und Plantafel (nach erp-web/public/style.css) */
.top { flex-wrap: wrap; row-gap: 6px; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px; }
.top nav a { color: var(--muted); padding: 4px 10px; border-radius: 6px; }
.top nav a:hover { background: var(--bg); color: var(--fg); }
.top nav a.active { color: var(--accent); background: #e8f0fc; font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 1rem; }
.tiles a { display: block; padding: 18px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; color: var(--fg);
  font-weight: 600; text-decoration: none; }
.tiles a:hover { border-color: var(--accent); color: var(--accent); }
select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--fg); background: #fff; }
.combo { position: relative; }
.combo input { width: 100%; }
.combo .list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); 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; color: var(--fg); }
.combo .opt small { color: var(--muted); white-space: nowrap; }
.combo .opt.hi { background: #e6eef6; }
.combo .empty { padding: 8px 10px; color: var(--muted); }
.combo.chosen input { background: #fbfdff; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #eef1f4; color: var(--muted); white-space: nowrap; }
.pill.CONFIRMED { background: #e3f1fb; color: #155a8a; }
.pill.SCHEDULED { background: #e6eef6; color: var(--accent); }
.pill.IN_TRANSIT { background: #fff4e5; color: #b54708; }
.pill.DELIVERED { background: #e3f4ea; color: #067647; }
.pill.INVOICED { background: #f1e9fb; color: #6a35a8; }
.pill.CANCELLED { background: #fde8e7; color: var(--error); }
.pill.LEGACY { background: #eef1f4; color: #4a5866; }
.warnings { display: grid; gap: 6px; }
.warnings div { background: #fff4e5; color: #b54708; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.notice { background: #e3f4ea; color: #067647; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.hidden { display: none !important; }

/* Lieferschein und Unterschrift (public/signature-panel.js) */
.sign-panel .sign-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sign-panel .sign-actions button { min-height: 44px; }
.sign-panel .sign-done { color: #067647; font-weight: 600; margin: 0 0 8px; }
.sign-panel .msg { font-size: 13px; margin: 6px 0 0; }
.sign-panel .msg.err { color: var(--error); }
.btn-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; color: var(--accent); }
dialog.sign-sheet { border: 0; border-radius: 12px; padding: 16px; width: min(420px, calc(100vw - 16px)); }
dialog.sign-sheet::backdrop { background: rgba(16, 24, 40, .45); }
dialog.sign-sheet h2 { font-size: 1.1rem; margin: 0 0 8px; }
dialog.sign-sheet .sign-body { display: grid; gap: 10px; }
dialog.sign-sheet img.qr { width: min(260px, 100%); height: auto; margin: 0 auto; display: block; image-rendering: pixelated; }
dialog.sign-sheet input { width: 100%; font-size: 16px; }
dialog.sign-sheet .sheet-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Kopfzeile auf dem Handy (ab 360 px): umbrechen statt waagrecht scrollen */
@media (max-width: 600px) {
  .top { gap: 6px 10px; padding: 8px 12px; }
  .top nav { order: 3; width: 100%; }
  .top nav a { padding: 6px 10px; }
  .top .who { margin-left: auto; font-size: 0.85rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 0; text-align: right; }
  .top button { padding: 6px 10px; }
}

/* Diagramme (public/charts.js) */
svg.chart { width: 100%; height: auto; display: block; }
/* Balken nicht über Lesegrösse hinaus vergrössern */
svg.chart.bars { max-width: 760px; }
svg.chart .chart-bar { fill: var(--accent); }
svg.chart .chart-bar.prev { fill: #a7c3de; }
svg.chart .chart-grid { stroke: var(--line); stroke-width: 1; }
svg.chart .chart-tick { fill: var(--muted); font-size: 11px; }
svg.chart .chart-label { fill: var(--fg); font-size: 12px; }
.chart-legend { display: flex; gap: 14px; font-size: 0.85rem; color: var(--muted); margin: 4px 0 8px; }
.chart-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--accent); margin-right: 4px; }
.chart-legend .swatch.prev { background: #a7c3de; }
