/* ============ 设计变量 ============ */
:root {
  --primary: #1a936f;
  --primary-dark: #147a5c;
  --accent: #f39c38;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-hint: #9ca3af;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 62px;
  --topbar-height: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  height: 100%;
}
body {
  overscroll-behavior-y: contain;
}
.hidden { display: none !important; }

/* 桌面专属元素（手机/平板下隐藏） */
.topbar-divider,
.topbar-breadcrumb,
.menu-group-title,
.sidebar-brand,
.stat-icon-bg,
.user-info-avatar,
.page-toolbar { display: none; }

/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #f0f9f6 0%, #fff 55%, #fef6ec 100%);
}
.login-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; margin-bottom: 12px; }
.login-logo img { height: 72px; border-radius: var(--radius); }
.login-title { font-size: 22px; font-weight: 700; text-align: center; margin: 0 0 4px; }
.login-sub { font-size: 13px; color: var(--text-secondary); text-align: center; margin: 0 0 28px; }
.login-form .form-row { margin-bottom: 18px; }
.login-form input { height: 48px; font-size: 16px; }
.login-help {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-hint);
  text-align: center;
  line-height: 1.6;
}

/* ============ 主应用壳 ============ */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: calc(var(--topbar-height) + var(--safe-top));
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

/* ============ 顶部状态栏 ============ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--topbar-height) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 14px;
  padding-right: 12px;
  box-shadow: var(--shadow);
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topbar-logo { height: 34px; border-radius: 4px; flex-shrink: 0; }
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text); white-space: nowrap; flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: 10px; }
/* 退出账号：全端唯一入口（底栏已不再显示），必须始终可见不被压缩 */
#logout-btn {
  flex-shrink: 0;
  white-space: nowrap;
  background: #f3f5f7;
  border-color: var(--border);
  min-height: 30px;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 140px;
  min-width: 0;
}
.user-info span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.user-role {
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

/* ============ 内容区 ============ */
.content {
  flex: 1;
  padding: 14px 12px;
  overflow-x: hidden;
  overflow-y: auto;
}
.page-title { font-size: 18px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.page-title .title-ico { color: var(--primary); display: inline-flex; align-items: center; }
.page-title .title-ico svg { display: block; }
.page-sub { color: var(--text-secondary); margin: -8px 0 14px; font-size: 13px; }

/* ============ 底部导航 ============ */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  z-index: 50;
  padding-top: 6px;
}
/* 移动端：菜单分组横向铺开（分组本身不占额外空间，组内菜单项平分宽度） */
.menu-group {
  display: flex;
  flex: 1;
  align-items: flex-start;
  min-width: 0;
}
.menu-group-bottom {
  flex: 0 0 auto;
}
.menu-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  padding: 5px 0;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all .15s;
  border-radius: 10px;
  margin: 0 4px;
  min-height: 48px;
}
.menu-item .menu-text {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
.menu-item .menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0;
  line-height: 1;
}
.menu-item .menu-icon svg {
  display: block;
  width: 24px;
  height: 24px;
}
.menu-item.active .menu-icon { color: var(--primary); }
.menu-item.active { color: var(--primary); background: rgba(26,147,111,0.08); font-weight: 600; }
.menu-item:active { transform: scale(0.96); }

/* ============ 通用 SVG 图标 ============ */
.ico {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.ico-sm { width: 14px; height: 14px; }
.ico-md { width: 18px; height: 18px; }
.ico-lg { width: 22px; height: 22px; }

/* ============ 卡片 ============ */
.card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.card-title::before { content: ''; display: inline-block; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; flex-shrink: 0; }
.card-title .title-ico { color: var(--primary); display: inline-flex; align-items: center; margin-left: 4px; }

/* ============ 表单 ============ */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 14px; color: var(--text); margin-bottom: 6px; font-weight: 500; }
.form-row label .required { color: var(--danger); margin-left: 2px; }
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,147,111,0.12);
}
.form-row textarea { resize: vertical; min-height: 90px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-actions .btn { flex: 1; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 10px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn > svg { flex-shrink: 0; }
.btn:hover { background: #f9fafb; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: #e08a26; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-float {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  z-index: 40;
}

/* ============ 状态徽章 ============ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-white_confirmed { background: #dbeafe; color: #1e40af; }
.badge-printing { background: #e0e7ff; color: #3730a3; }
.badge-printed { background: #d1fae5; color: #065f46; }
.badge-inspecting { background: #e0e7ff; color: #3730a3; }
.badge-inspected { background: #d1fae5; color: #065f46; }
.badge-packaging { background: #e0e7ff; color: #3730a3; }
.badge-packaged { background: #d1fae5; color: #065f46; }
.badge-ready_to_ship { background: #fce7f3; color: #9d174d; }
.badge-shipped { background: #d1fae5; color: #065f46; }

/* ============ 筛选条 ============ */
.filter-bar {
  display: none;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 14px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.filter-bar.open { display: flex; }
.filter-bar .filter-row { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.filter-bar label { font-size: 13px; color: var(--text-secondary); }
.filter-bar input,
.filter-bar select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  background: #fff;
  width: 100%;
  min-height: 44px;
}
.filter-actions { width: 100%; display: flex; gap: 10px; }
.filter-actions .btn { flex: 1; }
.filter-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  background: var(--panel);
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  font-size: 14px;
  color: var(--text-secondary);
}
.filter-toggle strong { color: var(--text); }

/* ============ 订单卡片列表 ============ */
.order-list { display: flex; flex-direction: column; gap: 12px; }
.order-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow);
}
.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.order-card-no { font-size: 15px; font-weight: 700; }
.order-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.order-card-body .full { grid-column: 1 / -1; }
.order-card-body strong { color: var(--text); font-weight: 500; }
.order-card-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.order-card-footer .btn { flex: 1; min-width: 72px; }

/* ============ 看板卡片 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: var(--panel);
  padding: 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  position: relative;
}
.stat-card.c-warning { border-left-color: var(--warning); }
.stat-card.c-info { border-left-color: var(--info); }
.stat-card.c-success { border-left-color: var(--success); }
.stat-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(26,147,111,0.08);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-card.c-warning .stat-icon { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-card.c-info .stat-icon { background: rgba(59,130,246,0.12); color: var(--info); }
.stat-card.c-success .stat-icon { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin: 4px 0 6px; padding-right: 40px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.2; }

/* ============ 待办区域 ============ */
.todo-section { margin-bottom: 18px; }
.todo-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.todo-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.todo-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.todo-card-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.todo-card-meta { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.todo-card-actions { display: flex; gap: 8px; }
.todo-card-actions .btn { flex: 1; }

/* ============ 表格（桌面端保留） ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
}
.table tbody tr:hover { background: #f9fafb; }
.table .actions { display: flex; gap: 6px; }

/* ============ 弹窗（移动端底部 Sheet / 桌面居中） ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0;
}
.modal {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  animation: sheetUp .25s ease-out;
}
.modal-lg { max-height: 92vh; }
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; margin: 0; }
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-hint);
  padding: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.modal-close:hover { background: #f3f4f6; color: var(--text); }
.modal-body { padding: 18px; }
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fff;
  position: sticky;
  bottom: 0;
  z-index: 1;
}
.modal-footer .btn { flex: 1; }

/* ============ 详情页 ============ */
.stage-flow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px;
  background: #f9fafb;
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.stage-node {
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.stage-node.done { background: var(--success); color: #fff; border-color: var(--success); }
.stage-node.current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.stage-arrow { color: var(--text-hint); font-size: 11px; }

.stage-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.stage-block-header {
  background: #f9fafb;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stage-block-body { padding: 12px 14px; }
.field-row { display: flex; padding: 7px 0; font-size: 14px; }
.field-label { width: 100px; color: var(--text-secondary); flex-shrink: 0; }
.field-value { flex: 1; color: var(--text); word-break: break-all; }
.empty-hint { color: var(--text-hint); font-size: 13px; padding: 8px 0; }

/* ============ 分页 ============ */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; align-items: center; }
.pagination .page-btn { padding: 8px 14px; border: 1px solid var(--border); background: #fff; border-radius: var(--radius); cursor: pointer; font-size: 14px; min-height: 40px; }
.pagination .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .page-btn:disabled { opacity: .5; cursor: not-allowed; }
.pagination .page-info { color: var(--text-secondary); font-size: 13px; padding: 0 8px; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: calc(var(--topbar-height) + var(--safe-top) + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 200;
  box-shadow: var(--shadow-md);
  animation: toastIn .2s;
  max-width: 90vw;
  text-align: center;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============ 空状态 ============ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-hint);
  font-size: 14px;
}

/* ============ PWA 安装提示 ============ */
.install-prompt,
.ios-install-tip,
.update-toast {
  position: fixed;
  left: 12px;
  right: 12px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 250;
  padding: 14px;
}
.install-prompt {
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 10px);
}
.install-body { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.install-icon { width: 48px; height: 48px; border-radius: 10px; }
.install-text { display: flex; flex-direction: column; }
.install-text strong { font-size: 15px; margin-bottom: 2px; }
.install-text span { font-size: 13px; color: var(--text-secondary); }
.install-actions { display: flex; gap: 10px; }
.install-actions .btn { flex: 1; }

.ios-install-tip {
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 10px);
  padding: 12px 14px;
}
.ios-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  gap: 10px;
}
.ios-share { width: 18px; height: 18px; fill: var(--primary); vertical-align: -3px; }
.ios-close { background: none; border: none; font-size: 22px; color: var(--text-hint); cursor: pointer; width: 28px; height: 28px; }

.update-toast {
  top: calc(var(--topbar-height) + var(--safe-top) + 10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

/* ============ 打印样式 ============ */
.print-root { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-root, .print-root * { visibility: visible; }
  .print-root {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  @page { size: A4; margin: 15mm; }
}
.print-doc { font-family: 'SimSun', serif; color: #000; background: #fff; }
.print-header { text-align: center; margin-bottom: 16px; border-bottom: 2px solid #000; padding-bottom: 12px; }
.print-logo { height: 50px; margin-bottom: 8px; }
.print-title { font-size: 22px; font-weight: bold; margin: 8px 0 4px; }
.print-subtitle { font-size: 13px; color: #333; }
.print-section { margin: 14px 0; }
.print-section-title { font-weight: bold; font-size: 14px; border-left: 3px solid #000; padding-left: 8px; margin-bottom: 8px; }
.print-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.print-table td, .print-table th { border: 1px solid #333; padding: 6px 8px; }
.print-table th { background: #f0f0f0; font-weight: bold; }
.print-footer { margin-top: 24px; display: flex; justify-content: space-between; font-size: 12px; }

/* ============ 桌面版（≥1024px） ============ */
@media (min-width: 1024px) {
  :root {
    --sidebar-width: 200px;
    --topbar-height: 52px;
    --nav-height: 0px;
    --radius: 6px;
    --radius-lg: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  }

  /* ===== 基础字号 + 全局 ===== */
  body { font-size: 14px; }
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
  ::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
  ::-webkit-scrollbar-track { background: transparent; }

  /* ===== 登录页：紧凑桌面尺寸 ===== */
  .login-page {
    background: #f6f8f9;
  }
  .login-card {
    padding: 22px 26px;
    max-width: 320px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  }
  .login-logo { margin-bottom: 8px; }
  .login-logo img { height: 40px; }
  .login-title { font-size: 16px; margin: 0 0 3px; }
  .login-sub { font-size: 11px; margin: 0 0 14px; }
  .login-form .form-row { margin-bottom: 10px; }
  .login-form .form-row label { font-size: 12px; margin-bottom: 3px; }
  .login-form input {
    height: 34px !important;
    min-height: 34px !important;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 6px;
    transition: border-color .15s, box-shadow .15s;
  }
  .login-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,147,111,0.12);
  }
  #login-btn {
    min-height: 34px !important;
    height: 34px !important;
    padding: 5px 14px !important;
    font-size: 13px !important;
    margin-top: 4px;
  }
  .login-help {
    margin-top: 12px;
    font-size: 11px;
  }
  .login-tip .tip-row { line-height: 1.5; }

  /* ===== 布局：顶部 + 左侧导航 + 内容 ===== */
  .app {
    max-width: none;
    margin: 0;
    padding-left: var(--sidebar-width);
    padding-bottom: 0;
    min-height: 100vh;
  }

  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--topbar-height) + var(--safe-top));
    padding-top: var(--safe-top);
    padding-left: 18px;
    padding-right: 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    z-index: 60;
  }
  .topbar-left { gap: 10px; }
  .topbar-logo { height: 26px; border-radius: 4px; }
  .topbar-title { font-size: 15px; font-weight: 600; }
  .topbar-divider {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 4px;
  }
  .topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
  }
  .topbar-breadcrumb .crumb-sep { color: var(--text-hint); font-size: 12px; }
  .topbar-breadcrumb .crumb-current { color: var(--text); font-weight: 500; }
  .user-info { font-size: 12px; max-width: 180px; gap: 6px; }
  .user-info-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #2cb687);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
  }
  .user-role { font-size: 10px; padding: 1px 7px; }
  #logout-btn {
    min-height: 28px !important;
    height: 28px !important;
    padding: 4px 10px !important;
    font-size: 12px !important;
  }

  /* ===== 左侧导航：分组 + 品牌底部 ===== */
  .bottom-nav {
    position: fixed;
    top: calc(var(--topbar-height) + var(--safe-top));
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: auto;
    padding: 8px 8px 60px;
    background: #fafbfc;
    border-top: none;
    border-right: 1px solid var(--border);
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    overflow-y: auto;
    z-index: 50;
  }
  .menu-group {
    display: block;
    flex: 0 0 auto;
    margin-bottom: 6px;
  }
  .menu-group-bottom {
    margin-top: auto;
  }
  .menu-group-title {
    display: block;
    font-size: 11px;
    color: var(--text-hint);
    padding: 6px 10px 4px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
  }
  .menu-item {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    padding: 6px 10px;
    font-size: 13px;
    min-height: 32px;
    height: 32px;
    width: 100%;
    margin: 0 0 1px;
    border-radius: 5px;
    color: var(--text-secondary);
    position: relative;
    transition: background .12s, color .12s;
  }
  .menu-item .menu-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }
  .menu-item .menu-icon svg {
    width: 16px;
    height: 16px;
  }
  .menu-item .menu-text {
    line-height: 1.2;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .menu-item.active {
    background: #e6f5ef;
    color: var(--primary);
    font-weight: 600;
  }
  .menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
  }
  .menu-item:hover:not(.active) {
    background: rgba(0,0,0,0.04);
    color: var(--text);
  }
  /* 侧边栏底部品牌区 */
  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
  }
  .sidebar-brand img {
    width: 22px;
    height: 22px;
    border-radius: 4px;
  }
  .sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
  }
  .sidebar-brand-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
  }
  .sidebar-brand-ver {
    font-size: 10px;
    color: var(--text-hint);
  }

  /* ===== 内容区 ===== */
  .content {
    padding: 16px 24px;
    max-width: 1600px;
    margin: 0 auto;
  }
  .page-title {
    font-size: 16px;
    margin: 0 0 10px;
    gap: 7px;
    display: flex;
    align-items: center;
  }
  .page-title .title-ico {
    width: 28px;
    height: 28px;
    background: rgba(26,147,111,0.1);
    color: var(--primary);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .page-title .title-ico svg { width: 16px; height: 16px; }
  .page-sub { font-size: 12px; margin: -6px 0 12px; color: var(--text-hint); }

  /* ===== 卡片 ===== */
  .card {
    padding: 16px 18px;
    border-radius: 8px;
    margin-bottom: 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: box-shadow .15s;
  }
  .card:hover { box-shadow: var(--shadow-md); }
  .card-title {
    font-size: 13px;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
  }
  .card-title::before { width: 3px; height: 14px; }
  .card-title .title-ico svg { width: 14px; height: 14px; }

  /* ===== 表单：桌面紧凑尺寸 ===== */
  .form-row { margin-bottom: 10px; }
  .form-row label {
    font-size: 12px;
    margin-bottom: 4px;
    font-weight: 500;
    color: var(--text-secondary);
  }
  .form-row input,
  .form-row select,
  .form-row textarea {
    min-height: 32px;
    height: 32px;
    padding: 5px 10px;
    font-size: 13px;
    border-radius: 5px;
    border: 1px solid var(--border);
    transition: border-color .15s, box-shadow .15s;
  }
  .form-row input:hover:not(:focus),
  .form-row select:hover:not(:focus),
  .form-row textarea:hover:not(:focus) {
    border-color: #cbd5e1;
  }
  .form-row input:focus,
  .form-row select:focus,
  .form-row textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,147,111,0.12);
  }
  .form-row textarea { min-height: 70px; height: auto; }
  .form-actions { gap: 8px; margin-top: 4px; justify-content: flex-end; }

  /* ===== 表单：桌面双列布局 ===== */
  .form-grid { grid-template-columns: repeat(2, 1fr); gap: 0 24px; }
  .form-grid-3 { grid-template-columns: repeat(3, 1fr); gap: 0 24px; }
  /* 表单卡片限宽居中，避免输入框横跨整屏 */
  .form-card {
    max-width: 900px;
    padding: 22px 26px 20px;
  }
  .form-card .form-row { margin-bottom: 14px; }
  .form-card .form-row label { font-size: 13px; margin-bottom: 5px; }
  .form-card .form-row input,
  .form-card .form-row select,
  .form-card .form-row textarea {
    min-height: 36px;
    height: 36px;
    padding: 7px 12px;
    font-size: 14px;
    border-radius: 6px;
  }
  .form-card .form-row textarea { min-height: 84px; height: auto; }
  .form-card .form-actions { margin-top: 10px; }
  .form-card .form-actions .btn {
    min-height: 36px;
    height: 36px;
    padding: 6px 22px;
    font-size: 14px;
  }
  /* 页面工具条（新建订单等入口） */
  .page-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }

  /* ===== 按钮：桌面紧凑 + 焦点态 ===== */
  .btn {
    min-height: 30px;
    height: 30px;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 13px;
    gap: 5px;
    transition: all .12s;
  }
  .btn > svg { width: 14px; height: 14px; }
  .btn:hover { background: #f9fafb; border-color: #cbd5e1; }
  .btn:active { transform: scale(0.98); }
  .btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(26,147,111,0.2);
  }
  .btn-sm { min-height: 24px; height: 24px; padding: 2px 8px; font-size: 12px; }
  .btn-sm > svg { width: 12px; height: 12px; }
  /* 桌面端必须重新声明按钮变体，避免被上方 .btn:hover 覆盖 */
  .btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
  .btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
  .btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
  .btn-accent:hover { background: #e08a26; border-color: #e08a26; }
  .btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
  .btn-danger:hover { background: #dc2626; border-color: #dc2626; }
  .btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
  .btn-ghost:hover { background: rgba(0,0,0,0.04); border-color: transparent; }

  /* ===== 徽章 ===== */
  .badge {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 10px;
  }

  /* ===== 筛选条 ===== */
  .filter-toggle { display: none; }
  .filter-bar {
    display: flex !important;
    padding: 8px 10px;
    gap: 8px;
    margin-bottom: 8px;
    border-radius: 6px;
  }
  .filter-bar .filter-row {
    width: auto;
    flex: 1;
    min-width: 120px;
    font-size: 12px;
  }
  .filter-bar .filter-row label { font-size: 11px; margin-bottom: 3px; }
  .filter-bar input,
  .filter-bar select {
    min-height: 26px !important;
    height: 26px !important;
    padding: 3px 8px !important;
    font-size: 12px !important;
  }
  .filter-actions { width: auto; gap: 6px; align-self: flex-end; }

  /* ===== 订单列表：桌面显示表格 ===== */
  .order-list { display: none; }
  .order-table-wrap { display: block; }

  /* ===== 待办：桌面显示表格 ===== */
  .todo-card { display: none; }
  .todo-table-wrap { display: block; }

  /* ===== 统计卡片：增强 ===== */
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 12px;
  }
  .stat-card {
    padding: 16px 18px;
    border-radius: 8px;
    border-left-width: 3px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    box-shadow: var(--shadow);
    transition: all .15s;
    cursor: default;
  }
  .stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
  .stat-card.c-warning { border-left-color: var(--warning); }
  .stat-card.c-info { border-left-color: var(--info); }
  .stat-card.c-success { border-left-color: var(--success); }
  .stat-label {
    font-size: 12px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
  }
  .stat-icon-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(26,147,111,0.1);
    color: var(--primary);
  }
  .stat-icon-bg svg { width: 14px; height: 14px; }
  .stat-card.c-warning .stat-icon-bg { background: rgba(245,158,11,0.1); color: var(--warning); }
  .stat-card.c-info .stat-icon-bg { background: rgba(59,130,246,0.1); color: var(--info); }
  .stat-card.c-success .stat-icon-bg { background: rgba(16,185,129,0.1); color: var(--success); }

  /* ===== 表格：吸顶 header + 选中态 + 状态点 ===== */
  .table-wrap {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    background: var(--panel);
  }
  .table-scroll { max-height: calc(100vh - 260px); overflow-y: auto; }
  .table {
    font-size: 12px;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
  }
  .table thead { background: #f8fafc; }
  .table th {
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 2;
    white-space: nowrap;
  }
  .table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text);
    transition: background .1s;
  }
  .table tbody tr { transition: background .1s; }
  .table tbody tr:hover { background: #f8fafc; }
  .table tbody tr:hover td { background: #f8fafc; }
  .table tbody tr:last-child td { border-bottom: none; }
  .table .actions { white-space: nowrap; text-align: right; }
  .table .btn {
    min-height: 24px;
    height: 24px;
    padding: 2px 8px;
    font-size: 11px;
    margin-right: 4px;
  }
  .table .btn:last-child { margin-right: 0; }
  .table .btn > svg { width: 11px; height: 11px; }
  /* 状态点（在 .badge 前） */
  .status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
  }
  .status-dot-pending { background: #f59e0b; }
  .status-dot-white_confirmed { background: #3b82f6; }
  .status-dot-printing { background: #6366f1; }
  .status-dot-printed { background: #10b981; }
  .status-dot-inspecting { background: #6366f1; }
  .status-dot-inspected { background: #10b981; }
  .status-dot-packaging { background: #6366f1; }
  .status-dot-packaged { background: #10b981; }
  .status-dot-shipped { background: #059669; }
  .table td .order-no {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 11.5px;
    color: var(--primary);
    font-weight: 500;
  }

  /* ===== 弹窗 ===== */
  .modal-mask { justify-content: center; padding: 20px; }
  .modal {
    border-radius: 10px;
    max-width: 540px;
    max-height: 88vh;
    animation: fadeIn .18s ease-out;
    box-shadow: var(--shadow-lg);
  }
  .modal-lg { max-width: 720px; }
  .modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    min-height: 44px;
  }
  .modal-title { font-size: 14px; font-weight: 600; }
  .modal-close { width: 24px; height: 24px; }
  .modal-close svg { width: 14px; height: 14px; }
  .modal-body { padding: 14px 16px; max-height: 70vh; }
  .modal-footer { padding: 10px 14px; gap: 8px; }
  .modal-footer .btn { flex: 0 0 auto; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

  /* ===== 详情页 ===== */
  .detail-section {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
  }
  .detail-section-title {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 12px;
  }
  .detail-item { padding: 3px 0; font-size: 12px; }
  .detail-label { font-size: 11px; }
  .timeline { padding-left: 14px; }
  .timeline-item { padding: 3px 0 3px 12px; font-size: 12px; }
  .timeline-dot { width: 7px; height: 7px; left: -16px; }

  /* ===== 分页 ===== */
  .pagination { margin-top: 8px; padding: 6px 10px; gap: 6px; }
  .page-btn {
    min-height: 26px;
    height: 26px;
    padding: 3px 9px;
    font-size: 12px;
  }
  .page-info { font-size: 12px; }

  /* ===== Toast ===== */
  .toast { font-size: 12px; padding: 8px 14px; max-width: 340px; }

  /* ===== 空状态 ===== */
  .empty-state {
    padding: 32px 14px;
    font-size: 13px;
    color: var(--text-hint);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .empty-state svg {
    width: 48px;
    height: 48px;
    color: #d1d5db;
  }

  /* ===== 待办分组 ===== */
  .todo-section { margin-bottom: 14px; }
  .todo-section-title {
    font-size: 13px;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }
  .todo-card-actions .btn { flex: 0 0 auto; min-width: 70px; }

  /* ===== 阶段流程 ===== */
  .stage-flow { gap: 4px; margin-bottom: 14px; }
  .stage-node {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
  }
  .stage-arrow { font-size: 12px; }
  .stage-block {
    margin-bottom: 12px;
    border-radius: 6px;
  }
  .stage-block-header {
    padding: 9px 14px;
    font-size: 13px;
  }
  .stage-block-body { padding: 10px 14px; }

  /* ===== 安装提示：右上角浮动 ===== */
  .install-prompt,
  .ios-install-tip {
    left: auto;
    right: 14px;
    bottom: 14px;
    width: 280px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  }
  .install-body { padding: 8px 10px; gap: 8px; }
  .install-icon { width: 28px; height: 28px; border-radius: 6px; }
  .install-text strong { font-size: 12px; }
  .install-text span { font-size: 11px; }
  .install-actions { padding: 6px 10px; gap: 6px; }
  .install-actions .btn { flex: 0 0 auto; min-width: 54px; min-height: 26px; }
  .update-toast {
    left: auto;
    right: 14px;
    bottom: 14px;
    width: auto;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    gap: 6px;
  }

  /* ===== PWA 浮动按钮隐藏（桌面无需） ===== */
  .btn-float { display: none; }
}

/* ============ 平板（769px ~ 1023px） ============ */
@media (min-width: 769px) and (max-width: 1023px) {
  .app { max-width: 900px; margin: 0 auto; }
  .topbar,
  .bottom-nav { max-width: 900px; left: 50%; transform: translateX(-50%); }
  .modal-mask { justify-content: center; padding: 20px; }
  .modal {
    border-radius: var(--radius-lg);
    max-width: 640px;
    animation: fadeIn .2s ease-out;
  }
  .modal-lg { max-width: 860px; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .filter-bar { display: flex !important; }
  .filter-toggle { display: none; }
  .filter-bar .filter-row { width: auto; flex: 1; min-width: 160px; }
  .filter-actions { width: auto; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .order-card-body { grid-template-columns: repeat(3, 1fr); }
}
