/* ============================================================
   工厂进销存系统 · EN系统 —— iOS 风格 UI
   设计语汇：毛玻璃、大圆角卡片、iOS 系统色、分组列表
   桌面端 + 手机端自适应（断点 900px / 640px）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  /* iOS 系统色板 */
  --primary: #007aff;
  --primary-deep: #0066d6;
  --ios-indigo: #5e5ce6;
  --ios-teal: #32ade6;
  --ios-green: #34c759;
  --ios-orange: #ff9500;
  --ios-red: #ff3b30;
  --ios-purple: #af52de;

  --content-bg: #f2f2f7;                 /* iOS 分组背景灰 */
  --card: #ffffff;
  --fill: rgba(118, 118, 128, .12);      /* iOS 输入框填充灰 */
  --fill-2: rgba(118, 118, 128, .08);
  --hairline: rgba(60, 60, 67, .12);     /* iOS 分隔线 */
  --hairline-soft: rgba(60, 60, 67, .06);
  --text: #1c1c1e;                       /* iOS Label */
  --text-2: rgba(60, 60, 67, .62);       /* Secondary Label */
  --text-3: rgba(60, 60, 67, .38);       /* Tertiary Label */
  --danger: var(--ios-red);
  --success: var(--ios-green);
  --warning: var(--ios-orange);
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .10);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .22);
}
html, body, #app { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro SC",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; color: var(--text); background: var(--content-bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
.app-root { height: 100%; }
::selection { background: rgba(0, 122, 255, .18); }

/* ============================================================
   登录页：环境光渐变背景 + 毛玻璃卡片
   ============================================================ */
.login-wrap {
  min-height: 100vh; position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #f5f6fa; padding: 40px 20px 56px;
}
.ambient { position: absolute; inset: 0; pointer-events: none; }
.amb { position: absolute; border-radius: 50%; filter: blur(90px); animation: drift 14s ease-in-out infinite alternate; }
.amb.a1 { width: 520px; height: 520px; top: -160px; left: -120px; background: #5e9bff; opacity: .45; }
.amb.a2 { width: 460px; height: 460px; bottom: -170px; right: -100px; background: #af52de; opacity: .30; animation-delay: -4s; }
.amb.a3 { width: 380px; height: 380px; top: 22%; right: 12%; background: #64d2ff; opacity: .38; animation-delay: -8s; }
.amb.a4 { width: 320px; height: 320px; bottom: 8%; left: 16%; background: #34c759; opacity: .22; animation-delay: -11s; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(46px, 34px) scale(1.08); }
}
.login-card {
  position: relative; width: 100%; max-width: 384px;
  background: rgba(255, 255, 255, .68);
  backdrop-filter: blur(40px) saturate(1.6); -webkit-backdrop-filter: blur(40px) saturate(1.6);
  border: 0.5px solid rgba(255, 255, 255, .8); border-radius: 28px;
  box-shadow: 0 24px 70px rgba(31, 38, 135, .16);
  padding: 42px 36px 34px; animation: rise .38s cubic-bezier(.22, .9, .3, 1);
}
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.login-icon {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; color: #fff;
  background: linear-gradient(145deg, #0a84ff 0%, #5e5ce6 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 25px; font-weight: 800; letter-spacing: .5px;
  box-shadow: 0 12px 26px rgba(10, 132, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.login-title { text-align: center; font-size: 21px; font-weight: 700; margin-top: 18px; letter-spacing: .3px; }
.login-sub { text-align: center; font-size: 13px; color: var(--text-3); margin: 7px 0 26px; }
.login-field input {
  width: 100%; height: 48px; border: 1px solid transparent; border-radius: 13px;
  background: var(--fill); padding: 0 16px; font-size: 15px; color: var(--text);
  outline: none; margin-bottom: 12px; transition: .18s;
}
.login-field input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0, 122, 255, .14); }
.login-err { text-align: center; color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 4px; }
.btn-login {
  width: 100%; height: 48px; border: none; border-radius: 13px; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 600; letter-spacing: 4px;
  box-shadow: 0 10px 24px rgba(0, 122, 255, .30); transition: .16s;
}
.btn-login:hover { background: #006fe6; }
.btn-login:active { transform: scale(.975); }
.btn-login:disabled { opacity: .55; transform: none; cursor: not-allowed; }
.login-foot { position: absolute; bottom: 20px; font-size: 12px; color: var(--text-3); letter-spacing: .3px; }

/* ============================================================
   整体布局：毛玻璃浅色侧栏 + 顶栏 + 内容区
   ============================================================ */
.layout { display: flex; height: 100%; }

.side {
  width: 224px; flex-shrink: 0; z-index: 300;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(30px) saturate(1.8); -webkit-backdrop-filter: blur(30px) saturate(1.8);
  border-right: 0.5px solid var(--hairline);
  color: var(--text); display: flex; flex-direction: column; overflow: hidden;
}
.brand {
  display: flex; align-items: center; gap: 11px; padding: 17px 16px 15px;
  border-bottom: 0.5px solid var(--hairline-soft); cursor: pointer; flex-shrink: 0;
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; color: #fff;
  background: linear-gradient(145deg, #0a84ff 0%, #5e5ce6 100%);
  font-weight: 800; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px rgba(10, 132, 255, .30), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-name { color: var(--text); font-size: 15px; font-weight: 700; letter-spacing: .3px; }
.brand-sub {
  color: var(--text-3); font-size: 11px; margin-top: 2px;
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.menu { flex: 1; overflow-y: auto; padding: 6px 10px 26px; }
.menu::-webkit-scrollbar { width: 4px; }
.menu::-webkit-scrollbar-thumb { background: rgba(60, 60, 67, .18); border-radius: 2px; }
.menu-group {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 10px 6px; font-size: 12px; font-weight: 600; letter-spacing: .4px;
  color: var(--text-3); cursor: pointer; user-select: none; border-radius: 8px;
}
.menu-icon { margin-right: 7px; font-size: 13px; }
.menu-arrow { font-size: 10px; color: var(--text-3); transition: transform .18s; }
.menu-arrow.open { transform: rotate(90deg); }
.menu-item {
  display: block; margin: 1px 0 1px 12px; padding: 8px 12px; font-size: 13.5px;
  color: rgba(60, 60, 67, .85); cursor: pointer; border-radius: 10px; user-select: none;
  transition: background .14s, color .14s;
}
.menu-item:hover { background: var(--fill-2); color: var(--text); }
.menu-item.active { background: rgba(0, 122, 255, .12); color: var(--primary); font-weight: 600; }

/* 手机端：侧栏变抽屉 */
.side-mask { display: none; }
@media (max-width: 900px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 250px;
    transform: translateX(-102%); transition: transform .24s cubic-bezier(.22, .9, .3, 1);
    box-shadow: var(--shadow-lg);
  }
  .side.open { transform: translateX(0); }
  .side-mask {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .32);
    z-index: 290; backdrop-filter: blur(2px);
  }
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 56px; background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(30px) saturate(1.8); -webkit-backdrop-filter: blur(30px) saturate(1.8);
  border-bottom: 0.5px solid var(--hairline); flex-shrink: 0;
  display: flex; align-items: center; padding: 0 20px; gap: 14px; position: relative; z-index: 100;
}
.topbar-title { font-size: 17px; font-weight: 600; letter-spacing: .2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; position: relative; }
.topbar-company { color: var(--text-2); font-size: 13px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 12px 4px 5px;
  border-radius: 999px; background: var(--fill-2); transition: .15s; font-size: 13px;
}
.user-chip:hover { background: var(--fill); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; color: #fff;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.user-dropdown {
  position: absolute; right: 0; top: 46px; min-width: 152px; z-index: 120; overflow: hidden; padding: 5px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(30px) saturate(1.8);
  border: 0.5px solid var(--hairline); border-radius: 13px; box-shadow: var(--shadow-md);
  animation: pop .16s ease;
}
.ud-item { padding: 9px 12px; cursor: pointer; font-size: 13.5px; border-radius: 9px; color: var(--text); }
.ud-item:hover { background: var(--fill-2); }
.ud-item.danger { color: var(--danger); }
.ud-item.danger:hover { background: rgba(255, 59, 48, .08); }

.hamburger {
  display: none; width: 34px; height: 34px; border: none; border-radius: 10px;
  background: var(--fill); font-size: 16px; cursor: pointer; color: var(--text-2); flex-shrink: 0;
}
@media (max-width: 900px) {
  .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-title { font-size: 16px; }
  .topbar-company { display: none; }
  .user-chip { padding: 4px; background: transparent; }
  .user-chip span, .user-chip > span:last-child { display: none; }
}

.content { flex: 1; overflow: auto; padding: 20px 22px 28px; }
@media (max-width: 900px) { .content { padding: 14px 12px 22px; } }

/* ============================================================
   通用组件：卡片 / 按钮 / 表格 / 标签 / 表单 / 弹窗 / 提示
   ============================================================ */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 33px; padding: 0 15px; border: none; border-radius: 10px;
  background: var(--fill); color: var(--text); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: .15s; white-space: nowrap; user-select: none;
}
.btn:hover { background: rgba(118, 118, 128, .18); }
.btn:active { transform: scale(.965); }
.btn-primary { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 3px 10px rgba(0, 122, 255, .24); }
.btn-primary:hover { background: #006fe6; }
.btn-danger { color: var(--danger); background: rgba(255, 59, 48, .10); }
.btn-danger:hover { background: rgba(255, 59, 48, .16); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { height: 28px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }

.table { width: 100%; border-collapse: collapse; min-width: 620px; }
.table th {
  color: var(--text-2); font-weight: 600; font-size: 12px; letter-spacing: .2px;
  padding: 10px 14px; text-align: left; border-bottom: 0.5px solid var(--hairline); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 0.5px solid var(--hairline-soft); font-size: 13.5px; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f7f7fa; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag-draft { background: rgba(255, 149, 0, .14); color: #d17d00; }
.tag-shipped { background: rgba(64, 158, 255, .15); color: #2b7cd3; }
.tag-approved { background: rgba(52, 199, 89, .15); color: #1f9d4d; }

.filter-bar { display: flex; gap: 10px; padding: 14px 16px; align-items: center; flex-wrap: wrap; }
.filter-bar input, .filter-bar select, .form-grid input, .form-grid select, .form-grid textarea,
.dialog input, .dialog select, .dialog textarea, .input {
  height: 35px; border: 1px solid transparent; border-radius: 10px; padding: 0 12px;
  font-size: 13.5px; outline: none; transition: .16s; background: var(--fill); color: var(--text);
}
.filter-bar input:focus, .filter-bar select:focus, .form-grid input:focus, .form-grid select:focus,
.form-grid textarea:focus, .dialog input:focus, .dialog select:focus, .dialog textarea:focus, .input:focus {
  background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3.5px rgba(0, 122, 255, .14);
}
.empty { text-align: center; color: var(--text-3); padding: 52px 16px; font-size: 13px; line-height: 1.8; }

/* 弹窗 */
.dialog-mask, .modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .36); z-index: 400;
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 14px 20px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.dialog, .modal {
  background: #fff; border-radius: 18px; width: 560px; max-width: 100%; max-height: 82vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.22, .9, .3, 1);
}
@keyframes pop { from { transform: translateY(12px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog-head, .modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; border-bottom: 0.5px solid var(--hairline); font-weight: 700; font-size: 16px;
}
.dialog-head .x, .modal-x {
  cursor: pointer; color: var(--text-2); font-size: 13px; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  border: none; background: var(--fill); transition: .14s;
}
.dialog-head .x:hover, .modal-x:hover { background: rgba(118, 118, 128, .22); color: var(--text); }
.dialog-body, .modal-body { padding: 18px 20px; overflow: auto; }
.dialog-foot, .modal-foot {
  padding: 13px 20px; border-top: 0.5px solid var(--hairline);
  display: flex; justify-content: flex-end; gap: 10px;
}

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.form-grid label .req, .req { color: var(--danger); margin-right: 2px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
.form-grid textarea { height: auto; padding: 9px 12px; resize: vertical; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.form-row .input { width: 100%; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* 提示条（iOS HUD 风格） */
.toast {
  position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 999;
  background: rgba(28, 28, 30, .92); color: #fff; border-radius: 999px;
  padding: 10px 22px; font-size: 13.5px; font-weight: 500; max-width: 86vw;
  backdrop-filter: blur(10px); box-shadow: var(--shadow-md);
  animation: pop .2s ease;
}
.toast.err { background: rgba(255, 59, 48, .94); }

/* ============================================================
   工作台
   ============================================================ */
.dash-hello { margin: 2px 2px 16px; }
.dh-title { font-size: 26px; font-weight: 800; letter-spacing: .3px; }
.dh-sub { color: var(--text-3); font-size: 13px; margin-top: 5px; }

.stat-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.stat-card { padding: 16px 18px 15px; transition: transform .16s, box-shadow .16s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.sc-head { display: flex; align-items: center; gap: 8px; }
.sc-icon {
  width: 30px; height: 30px; border-radius: 9px; font-size: 15px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.sc-blue { background: rgba(0, 122, 255, .12); }
.sc-teal { background: rgba(50, 173, 230, .15); }
.sc-orange { background: rgba(255, 149, 0, .15); }
.sc-green { background: rgba(52, 199, 89, .15); }
.sc-purple { background: rgba(175, 82, 222, .14); }
.stat-card .label { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.stat-card .value {
  font-size: 24px; font-weight: 800; margin-top: 10px; letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
}
.stat-card .sub {
  color: var(--text-2); font-size: 13px; font-weight: 600; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-card .value.blue { color: var(--primary); }
.stat-card .value.green { color: #1f9d4d; }
.stat-card .value.orange { color: #d17d00; }
.stat-card .value.purple { color: var(--ios-purple); }
@media (max-width: 1400px) { .stat-cards { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .stat-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stat-cards { gap: 10px; } .stat-card { padding: 13px; } .stat-card .value { font-size: 19px; } }

/* 快捷入口（iOS 图标网格） */
.quick-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.qg-item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 15px 8px 13px; cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.qg-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.qg-item:active { transform: scale(.96); }
.qg-icon {
  width: 40px; height: 40px; border-radius: 12px; font-size: 19px;
  display: inline-flex; align-items: center; justify-content: center;
}
.qg-blue { background: rgba(0, 122, 255, .12); }
.qg-green { background: rgba(52, 199, 89, .14); }
.qg-orange { background: rgba(255, 149, 0, .15); }
.qg-purple { background: rgba(175, 82, 222, .14); }
.qg-teal { background: rgba(50, 173, 230, .15); }
.qg-gray { background: rgba(118, 118, 128, .12); }
.qg-label { font-size: 12.5px; font-weight: 500; color: var(--text); text-align: center; }
.dash-tip { margin-bottom: 14px; }

.section-title {
  font-size: 15px; font-weight: 700; padding: 14px 18px; border-bottom: 0.5px solid var(--hairline);
  display: flex; align-items: center; gap: 8px;
}

/* 预警条 */
.warn-banner {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 149, 0, .10); border: 0.5px solid rgba(255, 149, 0, .25);
  color: #9a4d00; border-radius: 12px; padding: 11px 15px; margin-bottom: 14px;
  font-size: 13.5px; font-weight: 500; cursor: pointer; transition: .15s;
}
.warn-banner:hover { background: rgba(255, 149, 0, .16); }
.wb-icon { font-size: 14px; }
.wb-arrow { margin-left: auto; font-size: 17px; color: rgba(154, 77, 0, .5); }
.warn-row { background: rgba(255, 59, 48, .05) !important; }
.warn-row:hover { background: rgba(255, 59, 48, .09) !important; }

/* 趋势图（纯 div 柱状图，无第三方依赖） */
.legend { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 10px; }
.dot-sales { background: #0a84ff; }
.dot-purchase { background: #32ade6; }
.trend-chart {
  display: flex; align-items: flex-end; gap: 6px; height: 190px;
  padding: 18px 22px 10px; box-sizing: border-box;
}
.tc-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; height: 100%; }
.tc-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.tc-bar { width: 30%; max-width: 15px; min-height: 2px; border-radius: 4px 4px 0 0; transition: height .3s; }
.tc-sales { background: linear-gradient(180deg, #5e9bff, #0a84ff); }
.tc-purchase { background: linear-gradient(180deg, #64d2ff, #32ade6); }
.tc-col:hover .tc-bar { opacity: .8; }
.tc-label { font-size: 11px; color: var(--text-3); margin-top: 6px; white-space: nowrap; }

/* ============================================================
   单据页（表头 + 明细表格 + 合计/制审栏 三段式）
   ============================================================ */
.doc-toolbar {
  display: flex; gap: 9px; padding: 12px 14px; margin-bottom: 14px; align-items: center;
  flex-wrap: wrap; position: sticky; top: -20px; z-index: 60;
}
.doc-toolbar .spacer { flex: 1; }
.doc-card { padding: 0 0 10px; }
.doc-head-title {
  display: flex; align-items: center; gap: 11px; padding: 18px 22px 2px;
  font-size: 19px; font-weight: 800; letter-spacing: .2px;
}
.doc-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 20px; padding: 15px 22px 8px;
}
.doc-grid label { display: block; font-size: 12.5px; color: var(--text-3); margin-bottom: 5px; font-weight: 500; }
.doc-grid .val { font-size: 14px; min-height: 35px; display: flex; align-items: center; font-weight: 600; color: var(--text-2); }
.doc-grid input, .doc-grid select {
  width: 100%; height: 35px; border: 1px solid transparent; border-radius: 10px;
  padding: 0 12px; font-size: 13.5px; outline: none; background: var(--fill); color: var(--text); transition: .16s;
}
.doc-grid input:focus, .doc-grid select:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3.5px rgba(0, 122, 255, .14); }
.doc-grid input:disabled, .doc-grid select:disabled { opacity: .65; }
.doc-grid .span2 { grid-column: span 2; }
@media (max-width: 1100px) { .doc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) {
  .doc-grid { grid-template-columns: 1fr; gap: 10px; padding: 13px 16px 6px; }
  .doc-grid .span2 { grid-column: span 1; }
}

.doc-lines { padding: 8px 22px 0; overflow-x: auto; }
.doc-lines table { width: 100%; min-width: 880px; border-collapse: collapse; border: 0.5px solid var(--hairline); border-radius: 12px; overflow: hidden; }
.doc-lines th {
  background: rgba(118, 118, 128, .07); font-size: 12px; color: var(--text-2); font-weight: 600;
  padding: 9px 6px; border-bottom: 0.5px solid var(--hairline); text-align: center; white-space: nowrap;
}
.doc-lines td { border-bottom: 0.5px solid var(--hairline-soft); padding: 3px 4px; text-align: center; }
.doc-lines tbody tr:hover { background: #f7f7fa; }
.doc-lines td.l { text-align: left; }
.doc-lines td .ro { color: var(--text-2); font-size: 13px; }
.doc-lines input {
  width: 100%; height: 32px; border: 1px solid transparent; border-radius: 8px;
  padding: 0 8px; font-size: 13.5px; outline: none; text-align: center; background: transparent; transition: .14s;
}
.doc-lines input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(0, 122, 255, .12); }
.doc-lines input:disabled { color: var(--text-2); }
.doc-lines .pname { cursor: pointer; text-align: left; color: var(--primary); font-weight: 500; padding: 7px 4px; }
.doc-lines .pname:hover { text-decoration: underline; }
.doc-lines .pname.empty { color: var(--text-3); font-weight: 400; }
.doc-lines .del { color: var(--text-3); cursor: pointer; font-size: 13px; padding: 4px 8px; border-radius: 6px; }
.doc-lines .del:hover { color: var(--danger); background: rgba(255, 59, 48, .08); }
.doc-add-line { margin: 12px 22px; }
@media (max-width: 640px) { .doc-lines { padding: 8px 16px 0; } .doc-add-line { margin: 10px 16px; } }

.doc-summary {
  display: flex; align-items: center; gap: 26px; padding: 14px 22px; flex-wrap: wrap;
  border-top: 0.5px dashed var(--hairline); margin-top: 8px; font-size: 13.5px; color: var(--text-2);
}
.doc-summary b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; margin-left: 2px; }
.doc-summary .final b { color: var(--danger); font-size: 19px; font-weight: 800; }
.doc-summary .price-masked { color: var(--text-3); font-size: 13px; letter-spacing: .3px; }
.doc-summary input {
  width: 104px; height: 32px; border: 1px solid transparent; border-radius: 9px; background: var(--fill);
  padding: 0 9px; font-size: 13.5px; text-align: right; outline: none; margin-left: 4px;
}
.doc-summary input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 122, 255, .12); }
@media (max-width: 640px) { .doc-summary { gap: 14px; padding: 12px 16px; } }

.doc-footer {
  display: flex; gap: 34px; padding: 11px 22px 15px; color: var(--text-3); font-size: 12.5px;
  border-top: 0.5px solid var(--hairline-soft); flex-wrap: wrap;
}
@media (max-width: 640px) { .doc-footer { gap: 10px 18px; padding: 10px 16px 14px; } }

/* 商品选择弹窗 */
.picker-search { display: flex; gap: 10px; margin-bottom: 12px; }
.picker-search input { flex: 1; }
.picker-list { max-height: 46vh; overflow: auto; }
.picker-list .table { min-width: 460px; }
.picker-list .table tbody tr { cursor: pointer; }
.quick-add {
  background: rgba(0, 122, 255, .05); border: 0.5px solid rgba(0, 122, 255, .14); border-radius: 12px;
  padding: 14px 14px 12px; margin-bottom: 12px;
}
.qa-grid { grid-template-columns: 2fr 1.4fr 1fr 1fr 1fr; }
@media (max-width: 900px) { .qa-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .qa-grid { grid-template-columns: 1fr; } }

/* 页面标题行 */
.page-head { display: flex; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.page-head h2 { font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.page-head .spacer { flex: 1; }

/* ============================================================
   报表 / 分段切换 / 对账单 / 进度条
   ============================================================ */
.filter-bar .spacer { flex: 1; }

/* 分段切换（iOS Segmented Control） */
.seg { display: inline-flex; background: rgba(118, 118, 128, .12); border-radius: 10px; padding: 2px; }
.seg button {
  border: none; background: transparent; padding: 0 15px; height: 30px; cursor: pointer;
  font-size: 13px; color: var(--text-2); transition: .14s; font-family: inherit; border-radius: 8px;
}
.seg button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* 对账单头部汇总 */
.stmt-head {
  display: flex; align-items: center; gap: 28px; padding: 13px 18px; flex-wrap: wrap;
  border-bottom: 0.5px dashed var(--hairline); font-size: 13.5px; color: var(--text-2);
}
.stmt-head b { color: var(--text); font-size: 15px; }
.stmt-head .final b { font-size: 17px; }

/* 表格合计行 */
.table tfoot td { padding: 11px 14px; border-top: 1px solid var(--hairline); background: rgba(118, 118, 128, .05); font-size: 13.5px; }
.table tfoot .num { text-align: right; }

/* 勾选列（批量删除） */
.table .check { width: 38px; text-align: center; }
.table input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }

/* 工单完成率进度条 */
.progress { display: inline-block; width: 90px; height: 6px; background: rgba(118, 118, 128, .16); border-radius: 99px; overflow: hidden; vertical-align: middle; }
.progress > i { display: block; height: 100%; background: var(--ios-green); border-radius: 99px; }

/* 打印抬头（屏幕上隐藏，打印时显示公司名 + 单据名） */
.print-header { display: none; }

/* ============================================================
   打印
   ============================================================ */
@media print {
  .side, .topbar, .doc-toolbar, .no-print, .doc-add-line, .side-mask, .hamburger { display: none !important; }
  .print-header {
    display: block; text-align: center; font-size: 19px; font-weight: 800;
    padding: 6px 0 12px; letter-spacing: 1px;
  }
  .content { padding: 0; overflow: visible; }
  .card { box-shadow: none; overflow: visible; }
  body { background: #fff; }
  .doc-lines table { min-width: 0; }
  .doc-lines input { border: none; }
}
