/* 物流登记站 · P1 基础样式（桌面浏览器优先，浅色） */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #d9dce1;
  --border-soft: #e8eaee;
  --text: #1f2329;
  --text-muted: #6b7280;
  --accent: #185fa5;
  --accent-hover: #134a80;
  --danger: #a32d2d;
  --danger-bg: #fcebeb;
  --ok: #0f6e56;
  --ok-bg: #e1f5ee;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { font-size: 15px; font-weight: 500; }

.who { display: flex; align-items: center; gap: 12px; }

.who-name { font-size: 13px; }

.link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}
.link:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.wrap {
  max-width: 1180px;
  margin: 20px auto 40px;
  padding: 0 24px;
}

.h1 { font-size: 18px; font-weight: 500; margin: 0 0 4px; }
.h2 { font-size: 14px; font-weight: 500; margin: 0 0 12px; }

.muted { color: var(--text-muted); font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 16px 0;
}

.plain { margin: 6px 0 8px; padding-left: 20px; }
.plain li { margin: 2px 0; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: #f2f4f7;
  color: #3f4652;
  white-space: nowrap;
}
.badge.role-forwarder { background: #e6f1fb; border-color: #b5d4f4; color: #0c447c; }
.badge.role-internal  { background: #f1efe8; border-color: #d3d1c7; color: #444441; }
.badge.role-admin     { background: #faeeda; border-color: #fac775; color: #633806; }

/* ---------- 提示条 ---------- */
.banner {
  border-radius: var(--radius);
  padding: 10px 16px;
  margin: 12px 24px;
  font-size: 13px;
}
.banner-inline { margin: 12px 0; }
.banner-danger { background: var(--danger-bg); border: 1px solid #f0c0c0; color: var(--danger); }
.banner-ok { background: var(--ok-bg); border: 1px solid #a9dcc9; color: var(--ok); }
.banner ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: var(--text-muted); }

.input {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.input:focus { outline: 2px solid #b5d4f4; outline-offset: 0; border-color: var(--accent); }
.input-sm { height: 28px; width: 130px; }

select.input { height: 32px; }

.form-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

/* ---------- 按钮 ---------- */
.btn {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { border-color: #b9bec7; background: #fafbfc; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger { color: var(--danger); border-color: #e4bcbc; }
.btn-danger:hover { background: var(--danger-bg); }

.btn-ghost { border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: #f2f4f7; border-color: transparent; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 4px; }

/* ---------- 表格 ---------- */
.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.grid th, .grid td {
  border-bottom: 1px solid var(--border-soft);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}
.grid th {
  font-weight: 500;
  color: var(--text-muted);
  background: #fafbfc;
  white-space: nowrap;
}
.grid tbody tr:hover { background: #fafbfc; }
.grid .num { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.grid .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.row-off { opacity: .55; }

/* ---------- 登录页 ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-card {
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 28px 26px 22px;
}
.login-title { font-size: 17px; font-weight: 500; margin: 0 0 18px; text-align: center; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-hint { margin: 16px 0 0; font-size: 12px; color: var(--text-muted); text-align: center; }

/* ---------- 页脚 ---------- */
.foot {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 20px 0 28px;
}

/* ============================================================
   物流登记表（P2）
   ============================================================ */

body.wide .wrap { max-width: none; padding: 0 16px; }

.ship-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.ship-meta { font-size: 13px; color: var(--text-muted); }

/* ---------- 月份标签 ---------- */
.month-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 12px 0 10px;
}
.mtab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.mtab:hover { border-color: #b9bec7; }
.mtab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.mtab-count {
  font-size: 11px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef1f5;
  color: #5b6270;
}
.mtab.active .mtab-count { background: rgba(255,255,255,.25); color: #fff; }

/* ---------- 工具条 ---------- */
.ship-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 0;
}
.ship-toolbar .input[type="text"] { width: 380px; }

.ship-legend {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 8px;
}
.lg { padding: 1px 8px; border-radius: 4px; border: 1px solid var(--border); }
.lg-internal { background: #eef4fb; border-color: #cfe0f2; color: #2b5f92; }
.lg-external { background: #eef8f2; border-color: #cbe8d8; color: #2c6b4f; }
.lg-shared   { background: #faf3e6; border-color: #f0e0bd; color: #7a5a1f; }

/* ---------- 表格骨架 ---------- */
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 260px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: #fff;
}

table.grid.shipments { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.grid.shipments th,
table.grid.shipments td {
  border-bottom: 1px solid var(--border-soft);
  border-right: 1px solid #f0f2f5;
  padding: 5px 8px;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 表头固定 */
table.grid.shipments thead th {
  position: sticky; top: 0; z-index: 3;
  background: #fafbfc;
}
/* 前两列固定（行号 + 进仓编号） */
table.grid.shipments .col-idx { position: sticky; left: 0; z-index: 2; background: #fff; width: 38px; min-width: 38px; }
table.grid.shipments thead .col-idx { z-index: 4; background: #fafbfc; }
table.grid.shipments td.lv-order:first-of-type { position: sticky; left: 38px; z-index: 2; background: #fff; }

.sortlnk { color: var(--text-muted); text-decoration: none; }
.sortlnk:hover { color: var(--accent); }
.sortmark { margin-left: 3px; color: var(--accent); }

/* ---------- 分组底纹（同收件人+邮编+地址相邻） ---------- */
tbody tr.grp-1 td { background: #fbfcfe; }
tbody tr.new-group td { border-top: 1px solid #e2e6ec; }
tbody tr:hover td { background: #f3f7fc; }
tbody tr.is-signed td { color: #7b848f; }
tbody tr.is-signed td.col-idx { box-shadow: inset 3px 0 0 var(--ok); }

/* ---------- 可编辑单元格 ---------- */
table.grid.shipments td.editable {
  cursor: text;
  background: #f7fbff;
}
table.grid.shipments td.editable:hover { background: #edf5ff; }
table.grid.shipments td.readonly { background: #fff; color: #4b5563; }
table.grid.shipments td.dup { color: #aeb6c0; font-style: italic; }
.dup-mark { font-size: 11px; }
.cell-editor {
  width: 100%; min-width: 60px;
  font: inherit;
  padding: 2px 4px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: #fff;
}
textarea.cell-editor { min-height: 54px; resize: vertical; white-space: pre-wrap; }
.saving { color: var(--text-muted); font-size: 11px; }
.empty { color: #c3c9d1; }
.edited-mark {
  display: inline-block; margin-left: 4px;
  font-size: 10px; padding: 0 4px; border-radius: 3px;
  background: #faeeda; color: #7a5a1f; border: 1px solid #f0e0bd;
}
.cell-bool { text-align: center; }
.sign-box { width: 16px; height: 16px; cursor: pointer; }

/* ---------- 附件单元格 ---------- */
.att-box { display: flex; align-items: center; gap: 4px; }
.att-thumb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--border); border-radius: 4px;
  overflow: hidden; background: #fff; text-decoration: none;
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-file { font-size: 9px; color: #6b7280; }
.att-count { font-size: 11px; color: var(--text-muted); }
.att-add {
  width: 22px; height: 22px; line-height: 1;
  border: 1px dashed var(--border); border-radius: 4px;
  background: #fff; color: var(--accent); cursor: pointer; font-size: 14px; padding: 0;
}
.att-add:hover { border-color: var(--accent); background: #f2f8ff; }

.col-act { white-space: nowrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1f2329; color: #fff;
  padding: 8px 16px; border-radius: 999px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
  z-index: 60;
}
.toast.show { opacity: .96; }
.toast.err { background: var(--danger); }

/* ---------- hidden 兜底（用 !important，与出现位置无关）----------
   `.modal` 这类规则里的 display 属于**作者样式**，会盖掉浏览器默认样式表里的
   `[hidden] { display: none }`，于是带 hidden 的元素**照样可见、而且关不掉**
   （JS 置 hidden=true 也不生效）。2026-09-17 T31 界面验收真实踩到：
   物流登记表的「改动历史」弹窗在打开 /shipments 时就全屏遮挡，点「关闭」无效。
   与 stock_inventory_mobile 里的同款兜底保持一致。 */
[hidden] { display: none !important; }

/* ---------- 模态 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(20,24,30,.45);
  display: flex; align-items: center; justify-content: center; z-index: 70;
}
.modal-card {
  width: min(920px, 92vw); max-height: 82vh;
  background: #fff; border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft);
}
.modal-body { padding: 12px 16px; overflow: auto; }

