:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1c2530;
  --muted: #6b7684;
  --line: #dce0e6;
  --brand: #b5411f;      /* steel rust/orange */
  --brand-dark: #8f3116;
  --accent: #1f5c8f;
  --good: #1f8f4d;
  --warn: #b58a1f;
  --bad: #c0392b;
  --radius: 8px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- top bar --- */
header.topbar {
  background: var(--ink);
  color: #fff;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.topbar .brand {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  margin-right: 14px;
  letter-spacing: .5px;
}
.topbar .brand span { color: var(--brand); }
.topbar .brand { display: flex; align-items: center; }
.brand-logo { height: 34px; background: #fff; padding: 3px 6px; border-radius: 4px; display: block; }
.login-logo { display: block; max-width: 260px; max-height: 110px; margin: 0 auto 6px; }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; }
.topbar nav a {
  color: #cfd6de;
  padding: 14px 12px;
  display: inline-block;
  border-bottom: 3px solid transparent;
}
.topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar nav a.active { color: #fff; border-bottom-color: var(--brand); }
.topbar .spacer { flex: 1; }
.topbar .who { color: #9aa5b1; font-size: 13px; }
.topbar .who a { color: #cfd6de; margin-left: 10px; }

main { max-width: 1600px; margin: 22px auto; padding: 0 22px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.sub { color: var(--muted); margin: 0 0 18px; }

/* --- panels / cards --- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .grid.cols-4, .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

.stat { text-align: left; }
.stat .num { font-size: 30px; font-weight: 700; color: var(--brand); }
.stat .lbl { color: var(--muted); font-size: 13px; }

/* --- tables --- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
tr:hover td { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- forms --- */
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
input, select, textarea {
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.field { margin-bottom: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1; min-width: 120px; margin-bottom: 0; }

button, .btn {
  font: inherit;
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #f4f5f7; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12px; font-weight: 600; }

/* --- badges --- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 12px; font-weight: 600; background: #eef1f4; color: var(--muted);
}
.badge.good { background: #e4f4ea; color: var(--good); }
.badge.warn { background: #faf1d8; color: var(--warn); }
.badge.bad  { background: #fbe6e3; color: var(--bad); }
.badge.info { background: #e3eef7; color: var(--accent); }
.star { color: var(--brand); }

/* notification bell + count */
.bell { position: relative; font-size: 18px; margin: 0 14px; text-decoration: none; line-height: 1; }
.bell .badge-count {
  position: absolute; top: -8px; right: -10px; background: #d63b2f; color: #fff;
  font-size: 11px; font-weight: 700; min-width: 17px; height: 17px; line-height: 17px;
  text-align: center; border-radius: 9px; padding: 0 4px;
}
tr.row-current > td { background: #eef6ff; }
tr.row-unread > td { background: #fffdf2; font-weight: 500; }
details.panel > summary { cursor: pointer; font-size: 15px; }

/* --- progress bar --- */
.bar { background: #e6e9ee; border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { background: var(--good, #2f9e57); height: 100%; }

/* --- production kanban board --- */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.board-col { flex: 1 1 0; background: #f1f3f6; border-radius: 8px; min-width: 140px; }
.board-col-hd {
  font-weight: 700; font-size: 13px; padding: 8px 10px; border-bottom: 2px solid #dfe3e8;
  display: flex; justify-content: space-between; align-items: center;
}
.board-col-hd .count { background: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; color: var(--muted); }
.board-col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.card-mark { background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; padding: 7px 9px; }
.card-mark .cm-top { display: flex; align-items: center; gap: 6px; }
.card-mark .cm-sub { font-size: 12px; margin: 2px 0 6px; }
.card-mark .cm-move { display: flex; gap: 4px; }
.card-mark .cm-move select { flex: 1; padding: 3px 4px; font-size: 12px; }
.board-col-body .empty { text-align: center; padding: 6px; }

/* --- mobile scan page --- */
.scan-wrap { max-width: 520px; margin: 0 auto; }
.scan-head { text-align: center; padding: 10px 0 4px; }
.scan-mark { font-size: 42px; font-weight: 800; line-height: 1.05; }
.scan-status { margin-top: 10px; font-size: 18px; }
.scan-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 20px; }
.scan-btns form { margin: 0; }
.scan-btn {
  width: 100%; padding: 22px 10px; font-size: 20px; font-weight: 700;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  cursor: pointer;
}
.scan-btn.is-next { border-color: var(--brand); background: var(--brand); color: #fff; }
.scan-btn.is-current { border-color: var(--good); color: var(--good); }
.scan-btn:active { transform: translateY(1px); }

/* --- flashes --- */
.flashes { list-style: none; padding: 0; margin: 0 0 16px; }
.flashes li {
  padding: 10px 14px; border-radius: 6px; margin-bottom: 8px;
  border-left: 4px solid var(--muted); background: #eef1f4;
}
.flashes li.success { border-color: var(--good); background: #e4f4ea; }
.flashes li.error   { border-color: var(--bad); background: #fbe6e3; }
.flashes li.warn    { border-color: var(--warn); background: #faf1d8; }

.muted { color: var(--muted); }
.right { text-align: right; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* --- login --- */
.login-wrap { max-width: 360px; margin: 8vh auto; }
.login-wrap .brand { font-size: 26px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-wrap .brand span { color: var(--brand); }
