/* ===== 诺语火客云SaaS 全局样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --sidebar-bg: #1f2937;
  --sidebar-text: #d1d5db;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

/* ===== 登录页 ===== */
.login-body { display: flex; min-height: 100vh; background: #ffffff; }
.login-left { flex: 0 0 66.666%; display: flex; flex-direction: column; justify-content: center; padding: 70px 90px; color: #fff; position: relative; overflow: hidden; background-color: #1e40af; background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(96, 165, 250, 0.55), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(59, 130, 246, 0.5), transparent 55%),
    linear-gradient(135deg, #2563eb 0%, #1d4ed8 45%, #1e40af 100%); }
.login-left::before { content: ""; position: absolute; inset: 0; opacity: 0.35; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 40%, transparent 78%);
          mask-image: radial-gradient(ellipse at 30% 40%, #000 40%, transparent 78%); }
.login-orb { position: absolute; border-radius: 50%; filter: blur(50px); pointer-events: none; }
.login-orb.o1 { width: 340px; height: 340px; top: -90px; right: -60px; background: rgba(125, 211, 252, 0.35); }
.login-orb.o2 { width: 260px; height: 260px; bottom: -80px; left: -60px; background: rgba(191, 219, 254, 0.3); }
.login-left-inner { position: relative; z-index: 1; max-width: 620px; }
.login-kicker { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: #bfdbfe; margin-bottom: 26px; }
.login-kicker::before { content: ""; width: 26px; height: 2px; background: linear-gradient(90deg, #60a5fa, transparent); }
.login-brand { font-size: 46px; font-weight: 800; line-height: 1.2; letter-spacing: 2px; }
.login-slogan { font-size: 22px; font-weight: 600; margin-top: 20px; color: #eaf2ff; }
.login-desc { font-size: 15px; line-height: 1.9; color: #c7d9fa; margin-top: 14px; }
.login-features { margin-top: 38px; display: flex; flex-direction: column; gap: 18px; }
.login-feature { display: flex; align-items: center; gap: 14px; font-size: 15px; color: #e6efff; }
.login-feature span { flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); }
.login-feature svg { width: 15px; height: 15px; stroke: #dbeafe; }
.login-right { flex: 0 0 33.333%; display: flex; align-items: center; justify-content: center; background: #ffffff; padding: 40px 20px; }
.login-card { width: 380px; background: #ffffff; border-radius: 20px; padding: 44px 38px; box-shadow: 0 30px 70px -20px rgba(30, 64, 175, 0.28); border: 1px solid #eef2fb; }
.login-badge { width: 54px; height: 54px; border-radius: 14px; margin: 0 auto 22px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%); box-shadow: 0 10px 22px -8px rgba(37, 99, 235, 0.6); }
.login-badge svg { width: 28px; height: 28px; stroke: #fff; }
.login-title { font-size: 24px; font-weight: 800; text-align: center; color: #111c34; letter-spacing: 1px; }
.login-subtitle { font-size: 13px; color: #8b95a5; text-align: center; margin: 8px 0 30px; }
.login-card .form-item { margin-bottom: 18px; }
.login-card .form-item label { display: block; font-size: 13px; color: #475569; margin-bottom: 7px; font-weight: 600; }
.login-card .form-item input { width: 100%; box-sizing: border-box; padding: 13px 15px; font-size: 14px; color: #1e293b; border: 1px solid #dbe3f0; border-radius: 10px; background: #f8faff; outline: none; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s; }
.login-card .form-item input::placeholder { color: #a8b3c4; }
.login-card .form-item input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13); background: #fff; }
.login-card .btn { background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%); border: none; color: #fff; width: 100%; padding: 14px; font-size: 15px; font-weight: 700; letter-spacing: 4px; border-radius: 10px; cursor: pointer; margin-top: 4px; transition: box-shadow 0.2s, transform 0.1s; }
.login-card .btn:hover { box-shadow: 0 12px 24px -10px rgba(37, 99, 235, 0.65); }
.login-card .btn:active { transform: translateY(1px); }
.login-card .btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-footer { margin-top: 24px; text-align: center; font-size: 12px; color: #b0bac9; }
.login-error { background: #fef2f2; color: var(--danger); padding: 8px 12px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.login-anim { animation: loginUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes loginUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 布局 ===== */
.layout { display: flex; height: 100vh; overflow: hidden; position: relative; }
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; overflow: hidden; z-index: 100; transition: width 0.2s; }
.sidebar-collapsed .sidebar { width: 56px; }
.sidebar-brand { padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.brand-text { font-size: 16px; font-weight: 700; color: #fff; white-space: nowrap; }
.sidebar-collapsed .brand-text { display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
.nav-group { margin-top: 6px; border-top: 1px solid rgba(255,255,255,0.06); padding-top: 6px; }
.nav-group-title { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 6px 12px; font-size: 14px; color: #e5e7eb; letter-spacing: 0.5px; white-space: nowrap; user-select: none; }
.nav-group-title:hover { color: #fff; }
.nav-group-toggle { flex-shrink: 0; background: none; border: none; color: #9ca3af; cursor: pointer; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 10px; padding: 0; transition: transform 0.2s; }
.nav-group-toggle:hover { color: #fff; }
.nav-group.open .nav-group-toggle { transform: rotate(90deg); }
.nav-group-label { cursor: pointer; font-weight: 600; padding: 2px 0; }
.nav-group-items { overflow: hidden; margin-top: 2px; }
.nav-group:not(.open) .nav-group-items { display: none; }
.nav-item { display: block; padding: 9px 16px 9px 36px; font-size: 14px; color: var(--sidebar-text); text-decoration: none; white-space: nowrap; border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(37,99,235,0.25); color: #fff; border-left-color: var(--primary); }
.sidebar-collapsed .nav-group-title, .sidebar-collapsed .nav-group-items { display: none; }
.sidebar-collapsed .nav-item { text-align: center; padding: 10px 0; }

.main { margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; transition: margin-left 0.2s; }
.sidebar-collapsed .main { margin-left: 56px; }
.topbar { height: 52px; flex-shrink: 0; background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 12px; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 14px; }
.content { padding: 16px; flex: 1; overflow-y: auto; }

/* ===== 卡片 ===== */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 16px; }
.card-header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.card-body { padding: 16px; }

/* ===== 商品档案：查询条件在上，下方为左侧分类树 + 右侧明细（等高） ===== */
.product-layout { display: flex; gap: 16px; align-items: stretch; }
.product-content { flex: 1; min-width: 0; }
.cat-panel { width: 240px; flex-shrink: 0; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.cat-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 600; }
.cat-panel-body { flex: 1; overflow-y: auto; padding: 6px 0; }
.cat-tree-item { display: flex; align-items: center; gap: 2px; padding: 6px 10px; cursor: pointer; font-size: 13px; border-radius: 4px; color: var(--text); }
.cat-tree-item:hover { background: #f3f4f6; }
.cat-tree-item.active { background: var(--primary); color: #fff; }
.cat-tree-item.active .tree-toggle { color: #fff; }
.cat-tree-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== 按钮 ===== */
.btn { display: inline-block; padding: 8px 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); font-size: 14px; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tabbar { display: flex; gap: 4px; }
.tabbar .btn { border-radius: 6px 6px 0 0; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-success { background: var(--success); color: #000; border-color: var(--success); }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: none; font-size: 18px; color: var(--text); cursor: pointer; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

/* ===== 表单 ===== */
.form-item { margin-bottom: 14px; }
.form-item label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text); }
.form-item input[type="text"], .form-item input[type="password"], .form-item input[type="number"], .form-item input[type="date"], .form-item input[type="datetime-local"], .form-item select, .form-item textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; background: var(--card); color: var(--text);
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-item { flex: 1; min-width: 140px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 13px; }
table.data-table th, table.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.data-table th { background: #f9fafb; font-weight: 600; color: var(--text-light); position: sticky; top: 0; }
table.data-table tbody tr:hover { background: #f9fafb; }
table.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 12px 16px; flex-wrap: wrap; }
.pagination button { padding: 4px 10px; border: 1px solid var(--border); background: var(--card); border-radius: 4px; cursor: pointer; font-size: 13px; }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--text-light); }

/* ===== 查询区 ===== */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 16px; }
.filter-bar .form-item { margin-bottom: 0; min-width: 130px; }

/* ===== 工具栏 ===== */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar-right { margin-left: auto; }

/* ===== 弹窗 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--card); border-radius: 10px; width: 680px; max-width: 94vw; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.modal-lg { width: 900px; }
.modal-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { margin-left: auto; border: none; background: none; font-size: 20px; cursor: pointer; color: var(--text-light); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* 单据页顶部操作栏 */
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #f8fafc; margin: -16px -18px 14px; }
.doc-actions .btn { flex: 0 0 auto; margin: 0; }

/* 通用下拉菜单项 */
.hm-item { padding: 8px 14px; cursor: pointer; border-radius: 6px; white-space: nowrap; }
.hm-item:hover { background: #f1f5f9; }
.hm-item[data-sep="1"] { border-top: 1px solid #f3f4f6; }
@media (max-width: 768px) {
  .doc-actions { margin: -12px -14px 12px; position: sticky; top: 0; background: #fff; z-index: 6; }
  .doc-actions .btn { flex: 1; padding: 8px 4px; }
}

/* ===== 状态标签 ===== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-draft { background: #f3f4f6; color: #6b7280; }
.tag-pending { background: #fef3c7; color: #b45309; }
.tag-approved { background: #dcfce7; color: #15803d; }
.tag-posted { background: #dcfce7; color: #15803d; }
.tag-rejected { background: #fee2e2; color: #b91c1c; }
.tag-closed { background: #e5e7eb; color: #4b5563; }
.tag-void { background: #e5e7eb; color: #4b5563; }
.tag-warning { background: #fef3c7; color: #b45309; }

/* ===== 分类树形 ===== */
.tree-toggle { display: inline-block; width: 16px; height: 16px; line-height: 15px; text-align: center; border-radius: 3px; color: #6b7280; cursor: pointer; font-size: 11px; user-select: none; }
.tree-toggle.open { background: #e5e7eb; }
.tree-toggle:hover { background: #e5e7eb; }
.tree-toggle-leaf { cursor: default; background: transparent; }

/* ===== Toast ===== */
.toast { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 8px; color: #fff; font-size: 14px; z-index: 2000; opacity: 0; transform: translateY(-10px); transition: all 0.2s; box-shadow: 0 8px 20px rgba(0,0,0,0.2); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: #3b82f6; }

/* ===== 报表指标卡 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.stat-label { font-size: 13px; color: var(--text-light); margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); }

/* ---- 工作台（均匀分栏） ---- */
.dash-section { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.dash-section.todo { grid-template-columns: repeat(4, 1fr); gap: 16px; }
.dash-card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px; overflow: hidden; transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease; }
.dash-card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -16px rgba(30, 64, 175, 0.28); border-color: #d8e2f7; }
.dash-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); }
.dash-card.green::before { background: #16a34a; }
.dash-card.amber::before { background: #f59e0b; }
.dash-card.cyan::before { background: #0891b2; }
.dash-card .dash-label { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
.dash-card .dash-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.15; letter-spacing: 0.5px; }
.dash-card .dash-extra { font-size: 12px; color: var(--text-light); margin-top: 8px; }
.dash-todo { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-decoration: none; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; transition: all 0.16s ease; }
.dash-todo:hover { border-color: var(--primary); box-shadow: 0 14px 28px -16px rgba(30, 64, 175, 0.28); }
.dash-todo .dash-todo-label { font-size: 14px; color: var(--text); font-weight: 600; }
.dash-todo .dash-todo-num { min-width: 34px; height: 34px; padding: 0 6px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; color: var(--primary); background: #eef2ff; box-sizing: border-box; }
.dash-todo:hover .dash-todo-num { background: var(--primary); color: #fff; }
.dash-trend { margin-bottom: 18px; }
.dash-trend .card-header { font-size: 15px; font-weight: 700; }
.dash-trend #trendChart.bar { justify-content: space-around; padding: 6px 4px; }

/* ===== 行内小工具 ===== */
.badge { display: inline-block; background: #e0e7ff; color: #3730a3; padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.text-muted { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.ml-auto { margin-left: auto; }
.gap-8 { gap: 8px; }

/* ===== 单据制作界面（抬头 + 明细错落布局） ===== */
.doc-form { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.doc-form-title { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.doc-form-title::before { content: ''; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; display: inline-block; }
.doc-form .form-row .form-item { min-width: 160px; }
.doc-sheet-no { font-weight: 600; color: var(--primary); font-size: 13px; }
.doc-detail { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.doc-detail-title { font-size: 15px; font-weight: 700; color: var(--primary); padding: 10px 16px; background: #f8fafc; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.doc-detail-title::before { content: ''; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; display: inline-block; }
.doc-total { display: flex; justify-content: flex-end; gap: 24px; padding: 10px 16px; font-size: 13px; background: #f8fafc; border-top: 1px solid var(--border); flex-wrap: wrap; }
.doc-total b { font-size: 14px; }
.cell-input { width: 100%; min-width: 70px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; background: #fff; color: var(--text); }
.cell-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* Excel 式网格明细：横竖网格线、单元格无框内联编辑 */
table.data-table.excel { border-collapse: collapse; }
table.data-table.excel th, table.data-table.excel td { border: 1px solid var(--border); padding: 4px 6px; }
table.data-table.excel .cell-input { border: none; border-radius: 0; box-shadow: none; background: transparent; min-width: 44px; padding: 4px 5px; font-variant-numeric: tabular-nums; }
table.data-table.excel .cell-input:focus { box-shadow: inset 0 0 0 2px var(--primary); outline: none; background: #f8fbff; }
table.data-table.excel .cell-input.r { text-align: right; }
table.data-table.excel .cell-input::-webkit-outer-spin-button,
table.data-table.excel .cell-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
table.data-table.excel .cell-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.partner-search { position: relative; }
.partner-dropdown { position: absolute; top: 100%; left: 0; right: 0; z-index: 60; max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-top: none; background: #fff; box-shadow: 0 8px 16px rgba(0,0,0,0.12); border-radius: 0 0 6px 6px; }
.partner-dropdown div { padding: 8px 10px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.partner-dropdown div:hover, .partner-dropdown div.hl { background: #f3f4f6; }
/* 放大镜（客户/货商）选择按钮：输入框右侧 */
.partner-search.pick { display: flex; align-items: center; gap: 6px; }
.partner-search.pick > input[type="text"] { flex: 1; min-width: 0; }
.picker-btn { flex: 0 0 auto; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--border); border-radius: 6px; color: #6b7280; cursor: pointer; padding: 0; }
.picker-btn:hover { color: var(--primary); border-color: var(--primary); }

/* 移动端卡片纵览：标签默认隐藏，仅窄屏 + .card-view 时显示 */
.td-label { display: none; }

/* ==========================================================================
   移动端 H5 适配（iPhone X 375×812，断点 768px）
   对应 docs/mobile/responsive-plan.md 的 WP1 + WP2
   ========================================================================== */
.mobile-overlay { display: none; }
@media (max-width: 768px) {

  /* ---- WP1 布局：侧栏抽屉 + 遮罩 ---- */
  .main,
  .sidebar-collapsed .main { margin-left: 0; }
  .sidebar { width: 240px; transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: none; }
  body.mobile-menu-open .sidebar { transform: translateX(0); box-shadow: 0 0 28px rgba(0,0,0,0.35); }
  body.mobile-menu-open { overflow: hidden; }
  .mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 90; }
  body.mobile-menu-open .mobile-overlay { display: block; }
  /* 兼容从桌面折叠状态切到移动端 */
  .sidebar, .sidebar-collapsed .sidebar { width: 240px; }
  .sidebar-collapsed .brand-text { display: block; }
  .sidebar-collapsed .nav-group-title, .sidebar-collapsed .nav-group-items { display: block; }
  .sidebar-collapsed .nav-item { text-align: left; padding: 9px 16px 9px 32px; }

  /* 顶栏：适配顶部安全区，可点目标够大 */
  .topbar { min-height: 52px; height: auto; padding-top: calc(env(safe-area-inset-top) + 6px); padding-left: 8px; padding-right: 8px; }
  .content { padding: 10px; }

  /* ---- WP2 触摸目标 & 防 iOS 聚焦缩放 ---- */
  .btn { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
  .btn-sm { min-height: 34px; padding-top: 5px; padding-bottom: 5px; }
  .form-item input[type="text"], .form-item input[type="password"], .form-item input[type="number"],
  .form-item input[type="date"], .form-item input[type="datetime-local"], .form-item select, .form-item textarea { font-size: 16px; min-height: 44px; }

  /* 查询区 / 表单区：单列铺开 */
  .filter-bar { flex-direction: column; align-items: stretch; padding: 12px; }
  .filter-bar .form-item { min-width: 0; width: 100%; }
  .filter-bar .btn { width: 100%; }
  .form-row { flex-direction: column; gap: 8px; }
  .form-row .form-item { min-width: 0; width: 100%; }
  .toolbar-right { margin-left: 0; width: 100%; text-align: right; }

  /* 商品档案：窄屏分类树置顶 */
  .product-layout { flex-direction: column; }
  .cat-panel { width: 100%; }
  .cat-panel-body { max-height: 240px; }

  /* 分页：一行、居中等大 */
  .pagination { justify-content: center; gap: 8px; padding: 12px 8px; }
  .pagination button { min-height: 36px; padding: 6px 12px; }
  .pagination .page-info { font-size: 12px; }

  /* 业务卡片与报表指标卡：2 列 */
  .card-header { padding: 10px 12px; }
  .card-body { padding: 12px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dash-section { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dash-section.todo { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* Toast：顶部居中，适配安全区 */
  .toast { left: 50%; right: auto; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 12px); }
  .toast.show { transform: translateX(-50%) translateY(0); }

  /* 弹窗：底部弹出层，接近全宽，按钮固定在底部 */
  .modal-mask { align-items: flex-end; }
  .modal, .modal-lg { width: 100vw; max-width: 100vw; max-height: 92vh; border-radius: 14px 14px 0 0; }
  .modal-header { position: sticky; top: 0; background: #fff; z-index: 5; }
  .modal-body { padding: 12px 14px; -webkit-overflow-scrolling: touch; }
  .modal-footer { position: sticky; bottom: 0; background: #fff; z-index: 5; padding-bottom: calc(env(safe-area-inset-bottom) + 12px); }
  .modal-footer .btn { flex: 1; }

  /* 单据区收窄 */
  .doc-form { padding: 12px; }
  .doc-total { justify-content: flex-start; gap: 16px; }

  /* ---- WP3 表格卡片式纵览 ---- */
  table.card-view thead { display: none; }
  table.card-view, table.card-view tbody { display: block; }
  table.card-view tbody tr { display: block; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 6px 12px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
  table.card-view tbody tr:last-child { margin-bottom: 0; }
  table.card-view td { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: none; white-space: normal; padding: 5px 0; font-size: 13px; }
  table.card-view td .td-label { display: block; flex-shrink: 0; color: var(--text-light); font-size: 12px; }
  table.card-view td a { color: var(--primary); }

  /* ---- WP4 单据编辑（Excel 明细 + 扫码录入） ---- */
  table.data-table.excel { min-width: 720px; } /* 保证横向滚动、不被挤压 */
  table.data-table.excel th:first-child,
  table.data-table.excel td:first-child { position: sticky; left: 0; background: #fff; z-index: 2; }
  table.data-table.excel thead th:first-child { z-index: 3; }
  .doc-detail input[id="fProduct"] { font-size: 16px; min-height: 44px; }
  .doc-detail .table-wrap { -webkit-overflow-scrolling: touch; }

  /* ---- WP5 页级适配 ---- */
  /* 登录页：窄屏改为上下堆叠，左区收窄、卡片贴近屏宽不溢出 */
  .login-body { flex-direction: column; }
  .login-left { flex: 1 1 auto; justify-content: center; padding: 48px 28px; min-height: auto; }
  .login-left-inner { max-width: 100%; }
  .login-brand { font-size: 32px; }
  .login-slogan { font-size: 18px; }
  .login-desc { display: none; }
  .login-features { display: none; }
  .login-right { flex: 1 1 auto; padding: 32px 16px; }
  .login-card { width: calc(100% - 32px); max-width: 380px; box-sizing: border-box; padding: 32px 24px; }
  /* 任务详情信息表窄屏更易读：标签与取值逐行堆叠 */
  table.data-table.detail-info tbody { display: block; }
  table.data-table.detail-info tr { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 3px 0; }
  table.data-table.detail-info th { width: 90px; }
  table.data-table.detail-info td { flex: 1 1 auto; min-width: 150px; }
}

/* ===== 多窗口标签栏（浏览器式） ===== */
.tabbar { position: relative; display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: #fff; border-bottom: 1px solid var(--border); overflow-x: auto; flex-shrink: 0; scrollbar-width: thin; }
.tab-tool { flex-shrink: 0; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; background: #f3f4f6; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; color: var(--text-light); font-size: 14px; line-height: 1; }
.tab-tool:hover { color: var(--primary); border-color: var(--primary); }
.tab { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; max-width: 200px; padding: 5px 8px 5px 12px; background: #f3f4f6; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-light); white-space: nowrap; user-select: none; transition: background .15s, color .15s; }
.tab:hover { background: #e5e7eb; }
.tab .tab-name { overflow: hidden; text-overflow: ellipsis; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab .tab-close { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; font-size: 15px; line-height: 1; color: inherit; opacity: .7; }
.tab .tab-close:hover { opacity: 1; background: rgba(0,0,0,.15); }
.tab.active .tab-close:hover { background: rgba(255,255,255,.25); }
.tab-menu { position: absolute; top: calc(100% - 4px); left: 12px; z-index: 300; min-width: 230px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.12); padding: 6px; }
.tab-menu-item { padding: 9px 12px; font-size: 13px; color: var(--text); border-radius: 6px; cursor: pointer; }
.tab-menu-item:hover { background: #f3f4f6; }
.tab-menu-item:last-child { margin-bottom: 0; }

/* 窗口面板 */
.content { position: relative; }
.pane { display: none; }
.pane.active { display: block; }
#winStage.active { height: 100%; }
#winStage.active { display: block; }
.win-frame { width: 100%; height: 100%; border: 0; display: none; background: var(--bg); }
.win-frame.active { display: block; }
.content.tab-mode { padding: 0; overflow: hidden; }

/* 内嵌窗口（frame=1）内容页 */
.frame-page { padding: 16px; height: 100%; overflow-y: auto; }

/* 一级分类窗口：功能图标网格 */
.window-home { padding: 4px 6px; }
.window-home-title { font-size: 18px; font-weight: 700; margin: 4px 0 18px; }
.window-home-empty { color: var(--text-light); padding: 40px 0; text-align: center; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.menu-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 22px 8px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); transition: box-shadow .15s, transform .15s; }
.menu-tile:hover { box-shadow: 0 6px 16px rgba(0,0,0,.08); transform: translateY(-2px); }
.menu-tile-icon { width: 46px; height: 46px; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; }
.menu-tile-name { font-size: 13px; text-align: center; }
