/* 物料管理 · 手机与电脑自适应 */
:root {
  --ink: #16233a;
  --ink-2: #4a5b74;
  --line: #d9e0ea;
  --bg: #f4f6fa;
  --card: #ffffff;
  --brand: #12233f;
  --accent: #c98a12;
  --accent-soft: #fdf3e0;
  --ok: #1c7a4a;
  --ok-soft: #e6f5ec;
  --down: #b23c3c;
  --down-soft: #fbebeb;
  --focus: #2f6fd0;
  --r: 12px;
  --shadow: 0 1px 2px rgba(22, 35, 58, .06), 0 8px 24px rgba(22, 35, 58, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--focus); text-decoration: none; }
b, strong { font-weight: 600; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: #fff;
  padding: 10px 14px 0;
  box-shadow: 0 2px 10px rgba(18, 35, 63, .25);
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(140deg, var(--accent), #7d5410); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .18); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 16px; letter-spacing: .5px; }
.brand-text i { font-style: normal; font-size: 11px; color: #9fb2cd; }
.nav { display: flex; align-items: center; gap: 2px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: #c3d2e6; padding: 8px 12px 10px; font-size: 14px; white-space: nowrap;
  border-bottom: 3px solid transparent; border-radius: 0;
}
.nav a:hover { color: #fff; }
.nav a.on { color: #fff; border-bottom-color: var(--accent); font-weight: 600; }
.who {
  margin-left: auto; background: rgba(255, 255, 255, .1); color: #dbe6f4;
  border: 0; border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; min-height: 40px;
}
.who:hover { background: rgba(255, 255, 255, .2); }

/* 版面 */
.view { max-width: 1180px; margin: 0 auto; padding: 16px 14px 60px; }
.boot { padding: 40px 0; text-align: center; color: var(--ink-2); }
.page-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.page-title h1 { font-size: 19px; margin: 0; }
.page-title .sub { color: var(--ink-2); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .hint { font-weight: 400; font-size: 12px; color: var(--ink-2); }

/* 数字概览 */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12px; color: var(--ink-2); }
.kpi .v { font-size: 21px; font-weight: 600; letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.kpi .u { font-size: 12px; color: var(--ink-2); margin-left: 3px; }

/* 表格 → 窄屏变卡片 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { background: #f7f9fc; color: var(--ink-2); font-weight: 600; font-size: 12.5px; position: sticky; top: 0; }
th:first-child, td:first-child { text-align: left; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--accent-soft); }
tbody tr.click:hover td:first-child { color: var(--accent); }
tr.total td { font-weight: 600; background: #f7f9fc; border-top: 2px solid var(--ink); }
td.model, th.model { white-space: normal; min-width: 120px; }
.muted { color: var(--ink-2); }
.flag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: #8a5c08; margin-left: 6px; }
.dir-in { color: var(--ok); }
.dir-out { color: var(--down); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--ok-soft); color: var(--ok); }
.chip.out { background: var(--down-soft); color: var(--down); }

/* 表单 */
form.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.span { grid-column: 1 / -1; }
label { font-size: 12.5px; color: var(--ink-2); }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; min-height: 42px; width: 100%;
}
textarea { min-height: 66px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input[type="date"] { min-width: 140px; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }
button.btn {
  font: inherit; font-size: 14px; border-radius: 9px; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink); min-height: 42px;
}
button.btn:hover { border-color: var(--ink-2); }
button.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.btn.primary:hover { background: #1b3358; }
button.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.btn.warn { color: var(--down); border-color: #e6b7b7; background: var(--down-soft); }
button.btn:disabled { opacity: .5; cursor: progress; }
button.link { background: none; border: 0; color: var(--focus); font: inherit; font-size: 13px; cursor: pointer; padding: 10px 10px; min-height: 40px; }
.search { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.search input { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-size: 14px; border: 0; background: #fff; padding: 10px 18px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--brand); color: #fff; font-weight: 600; }

/* 登录 */
.login-wrap { max-width: 380px; margin: 8vh auto 0; }
.login-wrap .card { padding: 22px 20px; }
.login-title { font-size: 20px; margin: 0 0 4px; }

/* 提示 */
.err { color: var(--down); font-size: 13.5px; margin-top: 10px; min-height: 1em; }
.ok-line { color: var(--ok); font-size: 13.5px; margin-top: 10px; }
.empty { text-align: center; color: var(--ink-2); padding: 26px 0; font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .22s ease; z-index: 60; max-width: 90vw; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--down); }
.detail-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.detail-head .big { font-size: 22px; font-weight: 600; letter-spacing: .3px; word-break: break-all; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pill { background: #f0f4fa; border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; font-size: 13px; }
.pill b { font-variant-numeric: tabular-nums; }
.split { display: grid; grid-template-columns: 1fr; gap: 14px; }
.notes { font-size: 13.5px; color: var(--ink-2); background: #f7f9fc; border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: 0 8px 8px 0; }

@media (min-width: 860px) {
  .topbar { display: flex; align-items: center; gap: 22px; padding: 12px 22px; }
  .nav { margin-top: 0; overflow: visible; }
  .nav a { padding: 6px 10px; border-bottom: 0; border-radius: 8px; }
  .nav a.on { background: rgba(201, 138, 18, .18); color: #fff; border-bottom: 0; }
  .split { grid-template-columns: 1fr 1fr; }
  .view { padding: 22px 22px 60px; }
}
@media (max-width: 700px) {
  th { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tbody tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 4px 0; background: #fff; overflow: hidden; }
  tbody tr.click:active { background: var(--accent-soft); }
  td { border-bottom: 1px dashed var(--line); text-align: left; display: flex; justify-content: space-between; gap: 12px; white-space: normal; padding: 8px 12px; }
  td:last-child { border-bottom: 0; }
  td::before { content: attr(data-label); color: var(--ink-2); font-size: 12.5px; flex: none; }
  .form-grid, form.grid { grid-template-columns: 1fr; }
  .kpi .v { font-size: 19px; }
  .actions button.btn { flex: 1; min-width: 45%; }
}
@media print {
  .topbar, .nav, .actions, .search, button { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
