:root {
  --gold: #b8860b; --gold-soft: #f3e9c8; --ink: #1f2430; --muted: #7a8294;
  --line: #e6e8ee; --bg: #f5f6f9; --card: #fff; --ok: #1aa861; --warn: #e08a00; --err: #d6453d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* 保证 hidden 属性永远压过任何 display 规则 */
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; font-size: 14px;
}
/* ===== ERP 式布局：左侧导航 + 内容区 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; flex-shrink: 0; background: linear-gradient(180deg, #262b36, #313846);
  color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { padding: 20px 18px 14px; font-size: 17px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-brand #brandSub { display: block; font-size: 12px; opacity: .65; font-weight: 400; margin-top: 4px; }
.side-nav { display: flex; flex-direction: column; padding: 12px 10px; gap: 4px; flex: 1; }
.nav-item {
  text-align: left; background: transparent; border: none; color: rgba(255,255,255,.85);
  padding: 11px 14px; border-radius: 9px; font-size: 14.5px; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: var(--gold); color: #fff; font-weight: 600; }
.side-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 8px; }
.side-foot .whoami { font-size: 13px; opacity: .85; }
.btn.side { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); }
.btn.side:hover { background: rgba(255,255,255,.16); }

.content { flex: 1; min-width: 0; padding: 0 26px 40px; }
.pagebar { display: flex; align-items: center; gap: 16px; padding: 18px 2px 4px; }
.pagebar h1 { margin: 0; font-size: 20px; }
.pagebar .status { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 3px; }
.dot.ok { background: #1aa861; } .dot.warn { background: #e08a00; }
.btn.ghost2 { background: #fff; border: 1px solid var(--line); }

section { display: flex; flex-direction: column; gap: 18px; margin-top: 14px; }
.filters { display: flex; gap: 8px; align-items: center; }
.filters input, .filters select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; }
.summary { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.summary b { color: var(--gold); font-size: 15px; }
.addrow-group { display: flex; align-items: center; gap: 6px; }
.rowcount { width: 58px; text-align: center; padding: 7px 4px; }
.inline-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.inline-label select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px; min-width: 160px; }

.wrap { max-width: 1180px; margin: 20px auto; padding: 0 16px; display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(20,30,50,.04); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); } .center { text-align: center; } .mono { font-family: ui-monospace, Consolas, monospace; }
.num { text-align: right; }

.form-row { display: flex; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.form-row label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
.form-row label.grow { flex: 1; }
.form-row input { font-size: 14px; color: var(--ink); }
input { border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; outline: none; background: #fff; }
input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

table { width: 100%; border-collapse: collapse; }
.items th, .items td { padding: 5px 4px; }
.items th { font-size: 11.5px; color: var(--muted); text-align: left; font-weight: 600; border-bottom: 1px solid var(--line); }
.items { table-layout: fixed; width: auto; }   /* 固定列宽：宽度严格按表头 th 定(表格只占各列之和,不拉伸不挤压);内容长则输入框内横向滚动 */
.items td input { width: 100%; }
.items .c-weight, .items .c-labor { font-weight: 600; }
.items .c-weight { background: #fffdf5; }

.editor-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.editor-foot .spacer { flex: 1; }
.totals { font-weight: 700; color: var(--gold); }
.hint { margin-top: 10px; font-size: 13px; color: var(--err); min-height: 18px; }

.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13.5px; }
.btn:hover { border-color: #c8ccd6; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.ship { background: var(--gold); color: #fff; border-color: var(--gold); font-weight: 600; }
.btn.ship:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.12); }
.card .btn.ghost { color: var(--ink); border-color: var(--line); }
.btn.mini { padding: 3px 9px; font-size: 12px; }
.btn.del { color: var(--err); border-color: #f0c9c6; }
.btn:disabled { opacity: .5; cursor: default; }

.list th, .list td { padding: 8px 8px; border-bottom: 1px solid var(--line); font-size: 13px; text-align: left; }
.list th { color: var(--muted); font-size: 11.5px; }
.list .acts { display: flex; gap: 6px; }
.badge { padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge.draft { background: #eef0f4; color: #6b7280; }
.badge.pushed { background: #e3f0ff; color: #1d6fd6; }
.badge.confirmed { background: #e3f7ec; color: var(--ok); }
.badge.in_stock { background: #e3f7ec; color: var(--ok); }
.badge.reserved { background: #fff3df; color: var(--warn); }
.badge.transferred { background: #e3f0ff; color: #1d6fd6; }

.login-mask { position: fixed; inset: 0; background: linear-gradient(135deg, #23272f, #3a4150); display: flex; align-items: center; justify-content: center; z-index: 50; }
.login-card { background: #fff; border-radius: 14px; padding: 34px 38px; width: 320px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.login-card h2 { margin: 0; text-align: center; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.login-card input { padding: 10px 12px; font-size: 14px; }
.btn.wide { width: 100%; padding: 10px; font-size: 15px; }
.whoami { margin-left: 6px; font-size: 12.5px; opacity: .85; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #2a2f3a; color: #fff; padding: 11px 20px; border-radius: 9px; opacity: 0; pointer-events: none; transition: .25s; font-size: 13.5px; max-width: 80vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--err); }
.toast.ok { background: #2a2f3a; }

/* 子表（折叠明细）——在手货/出货记录展开用 */
.list .sub { margin: 2px 0; }
.list .sub th, .list .sub td { padding: 5px 8px; font-size: 12.5px; }

/* ===== 移动端汉堡按钮 / 抽屉遮罩（桌面隐藏） ===== */
.mobile-nav-toggle { display: none; }
.sidebar-backdrop { display: none; }

/* ===== 移动端响应式（手机/平板竖屏） ===== */
@media (max-width: 820px) {
  .mobile-nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    position: fixed; top: 10px; left: 10px; z-index: 80;
    width: 44px; height: 44px; border-radius: 10px; border: none;
    background: var(--ink); color: #fff; font-size: 22px; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
  }
  /* 侧栏改成从左滑入的抽屉 */
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: 90;
    width: 78vw; max-width: 300px;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .layout.nav-open .sidebar { transform: translateX(0); }
  .layout.nav-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 85;
  }
  /* 内容区：顶部留出汉堡位、左右收窄 */
  .content { padding: 58px 12px 40px; }
  .pagebar { flex-wrap: wrap; gap: 8px; padding: 4px 0; }
  .pagebar h1 { font-size: 18px; }
  .pagebar .status { margin-left: 0; width: 100%; }
  .card { padding: 14px 12px; border-radius: 10px; overflow-x: auto; }  /* 宽表横向滚动，不挤破布局 */
  .card-head { flex-wrap: wrap; gap: 8px; }
  table.items, table.list { min-width: 600px; }   /* 表格保底宽度，随 card 横向滚动 */
  .form-row { flex-direction: column; gap: 10px; }
  .form-row label, .form-row label.grow { width: 100%; }
  .editor-foot { flex-wrap: wrap; gap: 8px; }
  .editor-foot .spacer { display: none; }
  .filters { flex-wrap: wrap; }
  .inline-label { width: 100%; }
  .inline-label select { flex: 1; min-width: 0; }
  .login-card { width: 88vw; max-width: 340px; padding: 28px 24px; }
}


/* ===== 电子板房：款号卡片墙 + 弹窗 ===== */
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 14px; }
.style-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; background: #fff; transition: box-shadow .15s, transform .15s; }
.style-card:hover { box-shadow: 0 5px 16px rgba(20,30,50,.12); transform: translateY(-1px); }
.sc-img { position: relative; aspect-ratio: 1/1; background: #f3f4f7; display: flex; align-items: center; justify-content: center; }
.sc-img img { width: 100%; height: 100%; object-fit: cover; }
.sc-noimg { color: var(--muted); font-size: 13px; }
.sc-sim { position: absolute; top: 6px; right: 6px; background: var(--gold); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.sc-body { padding: 8px 10px 10px; }
.sc-no { font-size: 13px; font-weight: 700; }
.sc-name { font-size: 12.5px; color: var(--ink); margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-meta { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-mask { position: fixed; inset: 0; background: rgba(20,25,35,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-card { background: #fff; border-radius: 14px; width: 580px; max-width: 96vw; max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 16px 50px rgba(0,0,0,.32); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 13px 20px; border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }
.style-form { display: flex; gap: 18px; }
.sf-img { flex-shrink: 0; width: 150px; display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
.sf-img img { width: 150px; height: 150px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #f3f4f7; }
.sf-fields { flex: 1; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.sf-fields label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.sf-fields input { width: 100%; }
@media (max-width: 820px) { .style-form { flex-direction: column; } .sf-img { width: 100%; } .sf-img img { width: 130px; height: 130px; } }

/* ===== 图片放大查看（电子板房点图看原图） ===== */
.sc-img img, .sf-img img { cursor: zoom-in; }
.imgzoom { position: fixed; inset: 0; z-index: 200; background: rgba(12,14,20,.92); }
.imgzoom .iz-stage { position: absolute; inset: 0 0 46px 0; overflow: auto; display: flex; }
.imgzoom .iz-img { margin: auto; flex-shrink: 0; max-width: none; height: auto; display: block; background: #fff; border-radius: 4px; user-select: none; -webkit-user-drag: none; }
.imgzoom .iz-cap { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; padding: 0 16px; display: flex; align-items: center; gap: 14px; color: #e8eaf0; font-size: 13px; background: rgba(0,0,0,.35); white-space: nowrap; overflow: hidden; }
.imgzoom .iz-cap b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.imgzoom .iz-dim { color: #aab1c0; }
.imgzoom .iz-tip { margin-left: auto; color: #8d95a6; font-size: 12px; }
.imgzoom .iz-btn { position: absolute; border: 0; border-radius: 50%; width: 42px; height: 42px; padding: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.imgzoom .iz-btn:hover { background: rgba(255,255,255,.28); }
.imgzoom .iz-close { top: 14px; right: 20px; }
.imgzoom .iz-prev, .imgzoom .iz-next { top: calc(50% - 44px); font-size: 28px; }
.imgzoom .iz-prev { left: 14px; }
.imgzoom .iz-next { right: 20px; }
@media (max-width: 820px) { .imgzoom .iz-tip { display: none; } .imgzoom .iz-btn { width: 38px; height: 38px; } }

/* ===== 移动端·补强(电子板房/回收站/7项导航) ===== */
.side-nav { overflow-y: auto; }
@media (max-width: 820px) {
  .style-grid { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; }
  .sc-body { padding: 7px 8px 8px; }
  .sc-name { font-size: 12px; }
  .filters { width: 100%; gap: 6px; }
  .filters input { flex: 1; min-width: 0; }
  .modal-card { max-height: 94vh; width: 96vw; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .spacer { display: none; }
  .card-head h2 { font-size: 15px; }
  .card-head { gap: 6px; }
  .list .acts { flex-wrap: wrap; }
  .summary { font-size: 12px; }
}
