:root {
  --bg: #f3f4f6; --card: #fff; --ink: #1c2530; --muted: #6b7684; --line: #e3e6ea;
  --brand: #1f4e79; --brand-ink: #fff; --accent: #c2410c; --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.top { background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; gap: 16px;
  padding: 0 16px; position: sticky; top: 0; z-index: 5; }
.top .logo { font-weight: 700; font-size: 17px; white-space: nowrap; color: #fff; padding: 12px 0; }
.top nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a { color: #d6e2ee; padding: 13px 11px; white-space: nowrap; border-bottom: 3px solid transparent; }
.top nav a:hover { color: #fff; text-decoration: none; }
.top nav a.on { color: #fff; border-bottom-color: #f5b041; }
.top .out { color: #d6e2ee; white-space: nowrap; font-size: 13px; }

main { max-width: 1180px; margin: 0 auto; padding: 16px; }
h1 { font-size: 20px; margin: 4px 0 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 13px; font-weight: 400; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  margin-bottom: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 400; color: var(--muted); }
.cols { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.flash { background: #fff7e6; border: 1px solid #f5d491; color: #7a4b00; padding: 9px 14px; border-radius: 8px;
  margin-bottom: 12px; }

.tw { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: #fafbfc; }
td.r, th.r { text-align: right; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 7px;
  padding: 8px 16px; font-size: 14px; cursor: pointer; font-family: inherit; }
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid var(--bad); }
.linkbtn { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; }
.linkbtn.danger { color: var(--bad); }
form.inline { display: inline; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #cfd5dc; border-radius: 7px;
  font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #9fc0df; border-color: var(--brand); }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 12px; }
.fields .wide { grid-column: 1 / -1; }
.lines td { padding: 5px 4px; border: 0; }
.lines th { background: none; padding: 4px; }
.lines input, .lines select { min-width: 86px; }
.lines select { min-width: 220px; }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.bar .sp { flex: 1; }
.total { font-size: 18px; font-weight: 700; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef2f6; color: #44505c; }
.tag.ok { background: #e3f4e8; color: var(--ok); }
.tag.warn { background: #fdf0d9; color: var(--warn); }
.tag.bad { background: #fde4e4; color: var(--bad); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 6px 18px; }
.kv div span { color: var(--muted); margin-right: 6px; }

.login { max-width: 340px; margin: 12vh auto; }
.login h1 { justify-content: center; }
.login .fields { grid-template-columns: 1fr; }

@media (max-width: 640px) {
  main { padding: 10px; }
  .top { padding: 0 10px; gap: 8px; }
  .stat .v { font-size: 19px; }
}
@media print {
  .top, .noprint, .flash { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; }
}

.est { color: var(--muted); font-size: 13px; line-height: 1.7; }
.est .big { font-size: 20px; color: var(--brand); }
.est .big.ok { color: var(--ok); }
.est .big.bad { color: var(--bad); font-size: 16px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal .wd { text-align: center; font-size: 12px; color: var(--muted); padding: 2px 0; }
.cal .day { min-height: 62px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 4px; background: #fff;
  overflow: hidden; }
.cal .day.past { background: #f6f7f9; color: #a3abb5; }
.cal .day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal .dn { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.cal .dn span { font-weight: 400; color: var(--brand); margin-left: 3px; font-size: 11px; }
.chip { font-size: 11px; line-height: 1.35; border-radius: 4px; padding: 1px 4px; margin-top: 2px; white-space: nowrap;
  overflow: hidden; }
.cal .chip b { display: block; }
.chip.prod { background: #e3edf8; color: #1f4e79; }
.chip.ship { background: #e3f4e8; color: #15803d; }
@media (max-width: 640px) { .cal .day { min-height: 54px; padding: 2px; } .chip { font-size: 10px; padding: 0 2px; } }
