:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #64748b;
  --accent: #0b6efd;
  --accent-dark: #0857c6;
  --border: #dbe2ea;
  --ok: #167a3d;
  --ok-bg: #e4f5ea;
  --err: #b3261e;
  --err-bg: #fdeae8;
  --warn-bg: #fff4d6;
  --warn: #8a6100;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  background: #101c2c;
  color: #fff;
  padding: 0 24px;
  height: 56px;
}
.brand { font-weight: 600; font-size: 17px; white-space: nowrap; }
.brand span { color: #8fb3e8; font-weight: 400; font-size: 13px; margin-left: 6px; }
.tabs { display: flex; gap: 4px; flex: 1; height: 100%; }
.tabs a {
  color: #c5d2e2;
  text-decoration: none;
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-bottom: 3px solid transparent;
}
.tabs a:hover { color: #fff; }
.tabs a.active { color: #fff; border-bottom-color: var(--accent); }
.logout { color: #c5d2e2; text-decoration: none; font-size: 13px; }
.logout:hover { color: #fff; }
main { max-width: 1180px; margin: 24px auto; padding: 0 20px 60px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 120px; font-family: Consolas, monospace; font-size: 13px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 220px; }
button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 7px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #e5eaf1; color: var(--text); }
.btn.secondary:hover { background: #d5dde8; }
.btn.danger { background: var(--err); }
.btn.small, button.small { padding: 5px 10px; font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:hover td { background: #f8fafc; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge.confirmed { background: var(--ok-bg); color: var(--ok); }
.badge.manual_check { background: var(--warn-bg); color: var(--warn); }
.badge.waiting_mapping { background: #e3ecfc; color: var(--accent-dark); }
.badge.waiting_serials { background: #efe3fc; color: #6d28d9; }
.badge.error, .badge.duplicate { background: var(--err-bg); color: var(--err); }
.badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.csv_confirmed { background: #e0f2f1; color: #00695c; }
.supplier-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.supplier-tabs a {
  padding: 7px 14px;
  border-radius: 8px 8px 0 0;
  background: #e5eaf1;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-bottom: none;
}
.supplier-tabs a.active { background: var(--card); font-weight: 600; }
.supplier-tabs a.new { background: transparent; border-style: dashed; color: var(--muted); }
pre.example {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 8px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 13px;
  user-select: text;
}
.mark-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.rule-list { font-size: 13px; }
.rule-list code { background: #eef2f7; padding: 1px 6px; border-radius: 4px; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0; }
.login-box { max-width: 380px; margin: 80px auto; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters > div { min-width: 160px; }
.filters label { margin-top: 0; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, monospace; font-size: 13px; }
.pager { display: flex; gap: 10px; margin-top: 14px; }
#serial-test-result table { font-size: 13px; }
