:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-2: #f4f6fa;
  --line: #e3e8ef;
  --text: #1d2633;
  --muted: #667085;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --ok: #0f9d58;
  --warn: #b25e09;
  --bad: #d92d20;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; letter-spacing: .3px; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13.5px;
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.who { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }

main { max-width: 1180px; margin: 24px auto 60px; padding: 0 24px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 20px; font-size: 13px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card.flush { padding: 0; overflow: hidden; }

.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 880px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }

label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12.5px; }
label.check { display: flex; align-items: center; gap: 6px; margin-bottom: 0; }
input, select, textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; }
input[type="checkbox"] { width: auto; margin: 0; }
label.check, .row label { margin-bottom: 0; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.row label { flex: 1 1 160px; }
.row.wrap label { min-width: 130px; }

button, .button {
  display: inline-block;
  padding: 8px 14px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font: inherit;
  cursor: pointer;
}
button:hover, .button:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1d4ed8; color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }

.filters, .inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 130px; margin: 0; }
.inline { margin-top: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: none; background: var(--panel-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfd; }
table.compact th, table.compact td { padding: 8px 10px; }
td.empty, .empty { color: var(--muted); text-align: center; padding: 26px; }

.strong { font-weight: 600; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.delta { color: var(--ok); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.tag.success { color: #067647; border-color: #abefc6; background: #ecfdf3; }
.tag.partial { color: var(--warn); border-color: #fedf89; background: #fffaeb; }
.tag.failed, .tag.disabled { color: var(--bad); border-color: #fecdca; background: #fef3f2; }
.tag.running { color: var(--accent); border-color: #c7d7fe; background: var(--accent-soft); }
.tag.active, .tag.pending { color: var(--muted); }

.facts { list-style: none; margin: 0; padding: 0; }
.facts li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.facts li:last-child { border-bottom: none; }
.facts span { color: var(--muted); }

.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 12px; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; padding: 14px; color: var(--muted); }

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  background: var(--accent-soft);
  border: 1px solid #c7d7fe;
  color: #1e40af;
}
.flash.error { background: #fef3f2; border-color: #fecdca; color: #b42318; }

.login-wrap { max-width: 380px; margin: 12vh auto; }
.login-wrap .card { padding: 26px; }
.login-wrap h1 { margin-bottom: 18px; font-size: 20px; }

footer { color: var(--muted); text-align: center; font-size: 12px; padding-bottom: 30px; }

.card.narrow { max-width: 400px; margin: 6vh auto; }

.progress {
  height: 8px;
  margin: 4px 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}
.progress .bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width .35s ease;
}

/* ---- supplier dashboard ------------------------------------------------ */

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .value {
  margin-top: 6px;
  font-size: 23px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
}
.kpi .value small { font-size: 12px; font-weight: 500; color: var(--muted); }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi.pending .value { color: var(--warn); }

.live-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 13px;
}
.live-bar .muted { font-size: 12.5px; }

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}
.chart-head strong { color: var(--text); font-size: 18px; font-variant-numeric: tabular-nums; }
.chart-head strong small { color: var(--muted); font-size: 12px; font-weight: 500; }

canvas.spark { width: 100%; height: 150px; display: block; }
.card canvas.spark + .hint { margin-bottom: 0; }

.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 190px;
  margin-top: 14px;
}
.bars .bar {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.bars .bar .n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars .bar .fill {
  width: 100%;
  max-width: 46px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #3b82f6, #6366f1);
  box-shadow: 0 1px 2px rgba(37, 99, 235, .25);
}
.bars .bar .d { font-size: 11px; color: var(--muted); white-space: nowrap; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
  .bars .bar .d { display: none; }
}