/* ==========================================================================
   玖芯商品部进销存 · 样式
   ========================================================================== */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e6e9ef;
  --border-strong: #d3d8e0;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #8b93a1;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff4ff;
  --sidebar: #0f172a;
  --sidebar-2: #1a2439;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --in: #0e9f6e;
  --out: #ea580c;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .18);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 13.5px; color: var(--text); }

/* ---------------------------------- 登录 ---------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: #fff;
}
.login-brand {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #0f172a 0%, #16233c 45%, #1e3a8a 100%);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand::before {
  content: "";
  position: absolute; inset: -30% -10% auto auto;
  width: 620px; height: 620px;
  background: radial-gradient(circle, rgba(59, 130, 246, .35), transparent 62%);
}
.login-brand::after {
  content: "";
  position: absolute; left: -120px; bottom: -180px;
  width: 460px; height: 460px;
  background: radial-gradient(circle, rgba(16, 185, 129, .18), transparent 65%);
}
.brand-logo { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(140deg, #3b82f6, #06b6d4);
  display: grid; place-items: center;
  font-weight: 800; font-size: 17px; letter-spacing: -.5px;
  box-shadow: 0 8px 20px rgba(59, 130, 246, .4);
}
.brand-name { font-size: 16px; font-weight: 650; letter-spacing: .2px; }
.brand-sub { font-size: 11.5px; color: #93a5c4; letter-spacing: 1.6px; text-transform: uppercase; }
.login-hero { position: relative; z-index: 1; max-width: 460px; }
.login-hero h1 {
  font-size: 34px; line-height: 1.32; margin: 0 0 18px;
  font-weight: 700; letter-spacing: -.5px;
}
.login-hero h1 em { font-style: normal; color: #60a5fa; }
.login-hero p { color: #a8b7d0; font-size: 14px; line-height: 1.85; margin: 0 0 30px; }
.hero-points { display: grid; gap: 13px; }
.hero-point { display: flex; gap: 11px; align-items: flex-start; font-size: 13px; color: #cbd6e8; }
.hero-point b { color: #fff; font-weight: 600; }
.hero-dot {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  background: rgba(96, 165, 250, .16); border: 1px solid rgba(96, 165, 250, .35);
  display: grid; place-items: center; font-size: 10px; color: #93c5fd; margin-top: 1px;
}
.login-foot { position: relative; z-index: 1; font-size: 11.5px; color: #64748b; }

.login-panel { display: grid; place-items: center; padding: 40px; }
.login-card { width: 100%; max-width: 348px; }
.login-card h2 { font-size: 22px; margin: 0 0 6px; font-weight: 650; letter-spacing: -.3px; }
.login-card .hint { color: var(--muted); font-size: 13px; margin: 0 0 28px; }
.field { margin-bottom: 15px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; outline: none; transition: .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.input::placeholder { color: #b3bac6; }
.textarea { resize: vertical; min-height: 62px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: .15s; white-space: nowrap; background: #fff; color: var(--text-2);
}
.btn:hover { background: #f3f4f6; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 3px rgba(37, 99, 235, .3); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border-color: var(--border-strong); color: var(--text-2); }
.btn-outline:hover { background: #f8fafc; border-color: #b9c0cc; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f1f3f7; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; padding: 10px; font-size: 14px; }
.btn-icon { padding: 6px 8px; }

.login-error {
  background: var(--danger-soft); color: #b91c1c;
  border: 1px solid #fecaca; border-radius: 8px;
  padding: 9px 12px; font-size: 12.5px; margin-bottom: 14px;
}
.demo-accounts {
  margin-top: 26px; padding-top: 20px; border-top: 1px dashed var(--border);
}
.demo-accounts .t { font-size: 11.5px; color: var(--muted); margin-bottom: 9px; letter-spacing: .3px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.demo-chip {
  border: 1px solid var(--border); border-radius: 7px; padding: 6px 9px;
  font-size: 11.5px; color: var(--text-2); cursor: pointer; background: #fafbfc; transition: .15s;
}
.demo-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.demo-chip b { display: block; font-weight: 600; color: var(--text); font-size: 11.5px; }

/* ---------------------------------- 布局 ---------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 226px; flex: none;
  background: var(--sidebar);
  color: #cbd5e1;
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 40;
}
.side-head {
  height: 58px; display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.side-head .brand-mark { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; }
.side-head .n { font-size: 14px; font-weight: 650; color: #fff; letter-spacing: .1px; }
.side-head .s { font-size: 10px; color: #64748b; letter-spacing: 1.1px; }
.side-scroll { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.side-scroll::-webkit-scrollbar { width: 5px; }
.side-scroll::-webkit-scrollbar-thumb { background: #2b3852; border-radius: 4px; }
.nav-group { margin-bottom: 16px; }
.nav-title {
  font-size: 10.5px; letter-spacing: 1.1px; color: #5b6b85;
  padding: 0 10px 7px; text-transform: uppercase; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px; font-size: 13px;
  color: #aeb9cc; cursor: pointer; transition: .14s; margin-bottom: 1px;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--sidebar-2); color: #e2e8f0; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, .22), rgba(37, 99, 235, .07));
  color: #fff; border-color: rgba(59, 130, 246, .3); font-weight: 550;
}
.nav-item .ico { width: 16px; text-align: center; opacity: .85; font-size: 13px; }
.nav-badge {
  margin-left: auto; font-size: 10.5px; padding: 1px 6px; border-radius: 20px;
  background: #dc2626; color: #fff; font-weight: 600;
}
.side-foot {
  border-top: 1px solid rgba(255, 255, 255, .07);
  padding: 11px 14px; display: flex; align-items: center; gap: 9px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, #3b82f6, #06b6d4);
  display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 650;
}
.side-foot .u { font-size: 12.5px; color: #e2e8f0; font-weight: 550; line-height: 1.3; }
.side-foot .r { font-size: 10.5px; color: #64748b; }
.side-foot .out {
  margin-left: auto; cursor: pointer; color: #64748b; font-size: 15px;
  padding: 4px; border-radius: 5px;
}
.side-foot .out:hover { color: #f87171; background: rgba(248, 113, 113, .1); }

.main { flex: 1; margin-left: 226px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.crumb { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.crumb b { color: var(--text); font-weight: 600; font-size: 14px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.today-chip {
  font-size: 11.5px; color: var(--muted); background: #f6f7f9;
  border: 1px solid var(--border); padding: 4px 9px; border-radius: 6px;
}
.content { padding: 20px 22px 40px; flex: 1; }

/* ---------------------------------- 通用组件 ---------------------------------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.1px; }
.card-head .sub { font-size: 11.5px; color: var(--muted); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px; }

.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.page-head h2 { margin: 0 0 3px; font-size: 19px; font-weight: 680; letter-spacing: -.3px; }
.page-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.page-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
}

/* 统计卡 */
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat .lbl { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .val {
  font-size: 25px; font-weight: 700; margin-top: 7px; letter-spacing: -.6px;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat .val small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat .foot { font-size: 11.5px; color: var(--muted); margin-top: 7px; display: flex; gap: 8px; align-items: center; }
.stat .accent {
  position: absolute; right: -22px; top: -22px; width: 78px; height: 78px;
  border-radius: 50%; opacity: .08;
}
.stat.c-blue .accent { background: #2563eb; }
.stat.c-green .accent { background: #059669; }
.stat.c-orange .accent { background: #ea580c; }
.stat.c-purple .accent { background: #7c3aed; }
.trend-up { color: var(--success); font-weight: 600; }
.trend-down { color: var(--danger); font-weight: 600; }

/* 表格 */
.table-wrap { overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted);
  padding: 9px 12px; background: #fafbfc; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
  letter-spacing: .2px;
}
table.tbl td {
  padding: 9px 12px; border-bottom: 1px solid #f1f3f6; vertical-align: middle;
}
table.tbl tbody tr:hover td { background: #fafcff; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
table.tbl .code { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
table.tbl tfoot td { background: #fafbfc; font-weight: 650; border-top: 1px solid var(--border); }
table.tbl.compact td, table.tbl.compact th { padding: 6px 9px; }
.table-empty { padding: 40px; text-align: center; color: var(--muted); font-size: 13px; }
.link { color: var(--primary); cursor: pointer; font-weight: 550; }
.link:hover { text-decoration: underline; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 5px; font-size: 11.5px; font-weight: 550;
  background: #f1f3f6; color: var(--text-2); white-space: nowrap;
}
.tag-blue { background: var(--primary-soft); color: var(--primary-dark); }
.tag-green { background: var(--success-soft); color: #047857; }
.tag-orange { background: var(--warning-soft); color: #b45309; }
.tag-red { background: var(--danger-soft); color: #b91c1c; }
.tag-gray { background: #f3f4f6; color: #4b5563; }
.tag-purple { background: #f5f3ff; color: #6d28d9; }
.tag-cyan { background: #ecfeff; color: #0e7490; }

.qty-in { color: var(--in); font-weight: 600; }
.qty-out { color: var(--out); font-weight: 600; }
.money { font-variant-numeric: tabular-nums; font-family: var(--mono); }
.neg { color: var(--danger); }
.pos { color: var(--success); }
.mute { color: var(--muted); }
.small { font-size: 11.5px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spacer { flex: 1; }

/* 筛选栏 */
.toolbar {
  display: flex; gap: 9px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.toolbar .input, .toolbar .select { width: auto; min-width: 130px; padding: 7px 10px; font-size: 12.5px; }
.toolbar .grow { flex: 1; min-width: 160px; }
.seg {
  display: inline-flex; background: #f3f4f6; border-radius: 8px; padding: 2px;
  gap: 2px; border: 1px solid var(--border);
}
.seg button {
  border: none; background: transparent; padding: 5px 11px; border-radius: 6px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer; font-weight: 500; transition: .14s;
}
.seg button.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

/* 分页 */
.pager {
  display: flex; align-items: center; gap: 8px; padding: 11px 16px;
  border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted);
}
.pager .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 20px; overflow-y: auto;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
  display: flex; flex-direction: column; max-height: 90vh;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal.wide { max-width: 980px; }
.modal.xwide { max-width: 1180px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.modal-head .x {
  margin-left: auto; cursor: pointer; color: var(--muted); font-size: 19px;
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px;
}
.modal-head .x:hover { background: #f3f4f6; color: var(--text); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 13px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; background: #fafbfc;
  border-radius: 0 0 12px 12px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

/* 提示条 */
.alert {
  padding: 10px 13px; border-radius: 8px; font-size: 12.5px;
  display: flex; gap: 8px; align-items: flex-start; line-height: 1.6;
}
.alert-warn { background: var(--warning-soft); border: 1px solid #fde68a; color: #92400e; }
.alert-info { background: var(--primary-soft); border: 1px solid #c7dbff; color: #1e40af; }
.alert-danger { background: var(--danger-soft); border: 1px solid #fecaca; color: #991b1b; }

/* Toast */
.toast-host {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: #111827; color: #fff; padding: 9px 16px; border-radius: 8px;
  font-size: 13px; box-shadow: var(--shadow); animation: slide .2s ease;
  display: flex; gap: 8px; align-items: center; max-width: 560px;
}
.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }
@keyframes slide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* 抽屉 / 详情 */
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 12.5px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); font-weight: 500; }

/* 明细行编辑 */
.lines-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.lines-table th {
  font-size: 11px; color: var(--muted); font-weight: 600; text-align: left;
  padding: 7px 8px; background: #fafbfc; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.lines-table td { padding: 5px 8px; border-bottom: 1px solid #f1f3f6; }
.lines-table input {
  width: 100%; border: 1px solid transparent; background: transparent;
  padding: 4px 6px; border-radius: 5px; text-align: right; font-family: var(--mono); font-size: 12.5px;
}
.lines-table input:hover { border-color: var(--border); background: #fff; }
.lines-table input:focus {
  border-color: var(--primary); background: #fff; outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .1);
}
.lines-table .del {
  color: #cbd5e1; cursor: pointer; font-size: 15px; line-height: 1; padding: 3px 5px;
}
.lines-table .del:hover { color: var(--danger); }
.item-pick {
  display: flex; flex-direction: column; gap: 1px; cursor: pointer;
  padding: 2px 4px; border-radius: 5px;
}
.item-pick:hover { background: var(--primary-soft); }
.item-pick .n { font-weight: 550; }
.item-pick .c { font-size: 10.5px; color: var(--muted); font-family: var(--mono); }

/* 图表 */
.chart-box { padding: 4px 0; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12px; }
.bar-row .n { width: 74px; color: var(--text-2); flex: none; }
.bar-track { flex: 1; height: 20px; background: #f1f3f7; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width .5s ease; }
.bar-row .v { width: 96px; text-align: right; font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }

/* 空状态 */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .ic { font-size: 30px; opacity: .5; margin-bottom: 8px; }
.empty .t { font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 3px; }
.empty .d { font-size: 12px; }

/* 选择物料面板 */
.picker-list { max-height: 380px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.picker-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid #f1f3f6; cursor: pointer; font-size: 12.5px;
}
.picker-row:last-child { border-bottom: none; }
.picker-row:hover { background: var(--primary-soft); }
.picker-row .info { flex: 1; min-width: 0; }
.picker-row .nm { font-weight: 550; }
.picker-row .sp { font-size: 11px; color: var(--muted); }
.picker-row .st { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); text-align: right; }

/* 小标头 & 说明 */
.section-title {
  font-size: 12px; font-weight: 650; color: var(--text-2);
  margin: 0 0 10px; letter-spacing: .2px; display: flex; align-items: center; gap: 7px;
}
.section-title::after { content: ""; height: 1px; background: var(--border); flex: 1; }

.kpi-inline { display: flex; gap: 18px; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.kpi-inline b { font-family: var(--mono); font-size: 13px; color: var(--text); }

/* ==========================================================================
   附件（送货单照片）
   ========================================================================== */
.att-drop {
  border: 1.5px dashed var(--border-strong); border-radius: 10px;
  padding: 14px 16px; cursor: pointer; background: #fcfdff;
  transition: border-color .15s, background .15s;
}
.att-drop:hover, .att-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.att-drop-in { display: flex; align-items: center; gap: 12px; }
.att-plus {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 500;
}
.att-drop b { font-size: 13px; }
.att-drop .small { font-size: 11.5px; margin-top: 2px; }

.att-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.att-item {
  position: relative; width: 118px; border: 1px solid var(--border); border-radius: 9px;
  overflow: hidden; background: #fff; cursor: pointer; transition: box-shadow .15s, border-color .15s;
}
.att-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.att-item.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.att-item img { display: block; width: 100%; height: 86px; object-fit: cover; background: #f3f4f6; }
.att-doc {
  height: 86px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; background: #f8fafc; color: var(--text-2);
}
.att-doc b { font-size: 14px; color: var(--danger); letter-spacing: .5px; }
.att-doc span { font-size: 10px; color: var(--muted); padding: 0 4px; text-align: center; word-break: break-all; }
.att-cap { padding: 5px 6px; border-top: 1px solid #f1f3f6; }
.att-cap span {
  display: block; font-size: 10.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.att-cap em { font-style: normal; font-size: 10px; color: var(--muted); }
.att-del {
  position: absolute; top: 4px; right: 4px; width: 19px; height: 19px; border-radius: 50%;
  background: rgba(17, 24, 39, .62); color: #fff; font-size: 13px; line-height: 19px; text-align: center;
  opacity: 0; transition: opacity .15s;
}
.att-item:hover .att-del { opacity: 1; }
.att-del:hover { background: var(--danger); }

.att-badge {
  display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px;
  border-radius: 20px; background: var(--primary-soft); color: var(--primary);
  font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.att-badge:hover { background: #dbeafe; }

.att-stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; min-height: 260px;
}
.att-stage img { max-width: 100%; max-height: 58vh; object-fit: contain; border-radius: 6px; }
.att-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: rgba(255, 255, 255, .92); color: var(--text); font-size: 20px; line-height: 1;
  cursor: pointer; box-shadow: var(--shadow-sm);
}
.att-nav.prev { left: 10px; }
.att-nav.next { right: 10px; }
.att-nav:disabled { opacity: .35; cursor: default; }
.att-noview { padding: 60px 20px; text-align: center; color: var(--text-2); font-size: 13px; line-height: 2; }
.att-facts {
  display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 12.5px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
}

/* 待上传（单据尚未保存时的本地预览） */
.pend-item { position: relative; width: 104px; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: #fff; }
.pend-item img { display: block; width: 100%; height: 78px; object-fit: cover; }
.pend-item .att-cap span { font-size: 10px; }
.pend-del {
  position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(17, 24, 39, .62); color: #fff; font-size: 12px; line-height: 18px; text-align: center; cursor: pointer;
}
.pend-del:hover { background: var(--danger); }
.pend-tip { font-size: 11.5px; color: var(--warning); margin-top: 8px; }

@media print {
  .sidebar, .topbar, .page-head .right, .toolbar, .pager { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; border-color: #ddd; }
}
