:root {
  --bg: #f7f8fa;
  --panel: #fff;
  --fg: #1f2937;
  --muted: #6b7280;
  --accent: #0d9488;
  --accent-dark: #0b766e;
  --ok: #16a34a;
  --ok-bg: #ecfdf5;
  --abw: #dc2626;
  --abw-bg: #fef2f2;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --border: #e5e7eb;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--fg);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo { font-weight: 700; font-size: 17px; color: var(--accent-dark); }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: var(--fg); font-weight: 500; padding: 4px 8px; border-radius: 6px; }
.topbar nav a:hover { background: var(--bg); text-decoration: none; }
.user { color: var(--muted); font-size: 13px; }

.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
h1 { margin: 0 0 4px; font-size: 22px; }
h2 { margin: 24px 0 8px; font-size: 17px; color: var(--accent-dark); }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 12px; }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; }

.form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.form .row { display: flex; flex-direction: column; gap: 4px; }
.form .row.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 13px; color: var(--muted); }
.form input, .form select, .form textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--fg);
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.small { padding: 4px 10px; font-size: 13px; }

.toolbar { display: flex; gap: 8px; margin: 12px 0 20px; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 28px 20px;
  background: #fafbfc;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.dropzone:hover,
.dropzone:focus {
  border-color: var(--accent);
  background: #f2fbfa;
  outline: none;
}
.dropzone.drag {
  border-color: var(--accent);
  border-style: solid;
  background: #ecfdfa;
  box-shadow: inset 0 0 0 3px rgba(13,148,136,0.12);
}
.dz-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); }
.dz-empty svg { color: var(--accent); margin-bottom: 4px; }
.dz-title { font-weight: 600; color: var(--fg); font-size: 15px; }
.dz-hint { font-size: 12px; }
.dz-filled { display: none; flex-direction: column; align-items: center; gap: 8px; }
.dz-filename { font-weight: 600; word-break: break-all; }
.dz-size { margin-bottom: 4px; }
.dropzone.has-file .dz-empty { display: none; }
.dropzone.has-file .dz-filled { display: flex; }

.samples-row { gap: 6px; margin-top: 4px; }
.samples-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sample-btn { font-size: 12px; }

.tbl tr.editing { background: #ecfdfa; border-left: 3px solid var(--accent); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
}
.filter-bar input[type="search"] {
  flex: 1 1 240px;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.filter-bar input[type="search"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
}
.inline-check input { margin: 0; }

.tbl.sortable th[data-sort] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px;
}
.tbl.sortable th[data-sort]:hover {
  color: var(--fg);
}
.tbl.sortable th[data-sort]::after {
  content: "↕";
  position: absolute;
  right: 8px;
  opacity: 0.35;
  font-size: 11px;
}
.tbl.sortable th[data-sort-dir="asc"]::after {
  content: "▲";
  opacity: 1;
  color: var(--accent);
}
.tbl.sortable th[data-sort-dir="desc"]::after {
  content: "▼";
  opacity: 1;
  color: var(--accent);
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 14px;
}
.tbl th, .tbl td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.tbl th {
  background: var(--bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.strong { font-weight: 700; }
.tbl tr:hover { background: var(--bg); }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.abw { background: var(--abw-bg); color: var(--abw); }
.pill.err { background: #fce7f3; color: #be185d; }

.tbl.report tr.zeile-ok { background: #f0fdf4; }
.tbl.report tr.zeile-abweichung,
.tbl.report tr.zeile-nur_lieferant,
.tbl.report tr.zeile-nur_wir { background: var(--abw-bg); }

/* Paar-Darstellung: CSB-Zeile + Lieferanten-Zeile gehoeren zusammen */
.tbl.paired tr.csb-row td { border-bottom: none; padding-bottom: 4px; }
.tbl.paired tr.lief-row td { padding-top: 4px; border-top: 1px dotted rgba(0,0,0,0.08); }
.tbl.paired tr.lief-row td:first-child { padding-left: 24px; }

.ok-box {
  padding: 14px 18px;
  background: var(--ok-bg);
  border-left: 4px solid var(--ok);
  border-radius: 6px;
  color: var(--ok);
  font-weight: 500;
}

.warn {
  padding: 12px 16px;
  background: var(--warn-bg);
  border-left: 4px solid var(--warn);
  border-radius: 6px;
  margin: 12px 0;
}
.warn ul { margin: 4px 0 0 16px; padding: 0; }

.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.report-stats { display: flex; gap: 12px; }
.stat {
  padding: 12px 18px;
  border-radius: 8px;
  text-align: center;
  min-width: 90px;
}
.stat.ok { background: var(--ok-bg); color: var(--ok); }
.stat.abw { background: var(--abw-bg); color: var(--abw); }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1; }
.stat .l { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }

@media print {
  .topbar, .footer, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: none; padding: 0; }
  .container { max-width: none; margin: 0; padding: 0; }
  a { color: inherit; }
}
