/* ============================================================
   印刷ERP管理系统 - 设计系统 v3（Apple 风格）
   设计语言：极简 / 留白 / 浅色 / 精致排版
   参考 apple.com.cn
   ============================================================ */

:root {
  /* Apple 色板 */
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --blue-active: #006edb;
  --blue-light: #e8f0fe;
  --link: #06c;

  --bg: #f5f5f7;            /* Apple 经典浅灰 */
  --card-bg: #ffffff;
  --text: #1d1d1f;          /* Apple 主文字 */
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --border: #d2d2d7;
  --border-light: #e8e8ed;

  /* 语义色（Apple 风格柔和色） */
  --success: #34c759;
  --success-bg: #e8f8ee;
  --warning: #ff9f0a;
  --warning-bg: #fff4e5;
  --danger: #ff3b30;
  --danger-bg: #ffe9e8;
  --info: #32ade6;
  --info-bg: #e5f6fd;

  /* 侧栏（浅色） */
  --sidebar-bg: #ffffff;
  --sidebar-border: #e8e8ed;
  --sidebar-hover: #f5f5f7;
  --sidebar-active-bg: var(--blue-light);
  --sidebar-text: #1d1d1f;
  --sidebar-text-muted: #86868b;

  /* 阴影（苹果几乎无阴影，用极淡的） */
  --shadow-sm: 0 0 0 1px rgba(0, 0, 0, 0.02);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --pill: 980px;            /* Apple 胶囊按钮 */

  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Display",
    "SF Pro Text", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 滚动条（极简） ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #c7c7cc;
  border-radius: 5px;
  border: 2.5px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #aeaeb2; background-clip: content-box; border: 2.5px solid transparent; }

.hidden { display: none !important; }

/* ============================================================
   登录页（Apple 极简风）
   ============================================================ */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: 100vh;
  position: relative;
  background: #fafafc;
}
.login-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 35% at 50% -5%, rgba(0, 113, 227, 0.06), transparent 60%),
    radial-gradient(ellipse 45% 30% at 90% 105%, rgba(0, 113, 227, 0.04), transparent 60%);
  pointer-events: none;
}
.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 48px 44px 40px;
  width: 400px;
  max-width: 92vw;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 2;
  border: 1px solid var(--border-light);
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo .icon {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  background: var(--blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px; font-weight: 600;
  box-shadow: 0 10px 24px -8px rgba(0, 113, 227, 0.45);
}
.login-logo h1 {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.login-logo .subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

/* 登录方式切换（账号密码 / 扫码） */
.login-tabs {
  display: flex;
  gap: 4px;
  background: rgba(118, 118, 128, 0.1);
  padding: 3px;
  border-radius: var(--pill);
  margin-bottom: 22px;
}
.login-tab {
  flex: 1;
  padding: 7px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--pill);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.login-tab:hover { color: var(--text); }
.login-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.remember-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: -2px 0 14px;
  cursor: pointer;
  user-select: none;
}
.remember-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
  margin: 0;
  flex-shrink: 0;
  vertical-align: middle;
}
/* 防止 .login-card label 的块级规则覆盖（登录页专属） */
.login-card .remember-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  margin: -2px 0 14px;
}
.login-card .remember-row span {
  line-height: 1.3;
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.login-card .remember-row input {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--blue);
  vertical-align: middle;
}

.login-card .form-group { margin-bottom: 18px; }
.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.login-card input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  background: #fafafc;
  color: var(--text);
  font-family: inherit;
  letter-spacing: 0;
}
.login-card input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}
.login-card .btn-login {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--pill);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.05em;
  font-family: inherit;
}
.login-card .btn-login:hover { background: var(--blue-hover); }
.login-card .btn-login:active { background: var(--blue-active); transform: scale(0.99); }
.login-card .error-msg {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-top: 14px;
  min-height: 20px;
}

.login-divider {
  display: flex; align-items: center;
  margin: 22px 0 16px;
  color: var(--text-tertiary);
  font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border-light);
}
.login-divider span { padding: 0 14px; }

.btn-wecom-login {
  width: 100%;
  padding: 11px 0;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: #fff;
  color: #07c160;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-wecom-login:hover { background: #f5fbf7; border-color: #a8e6c2; }
.btn-wecom-login svg { flex-shrink: 0; }

/* ============================================================
   主布局
   ============================================================ */
.app { display: flex; flex: 1; min-height: 0; }

/* ---------- 侧栏（浅色极简） ---------- */
.sidebar {
  width: 236px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
  border-right: 1px solid var(--sidebar-border);
}
.sidebar .logo {
  padding: 22px 20px 18px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar .logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}
.sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 16px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  color: var(--sidebar-text-muted);
  text-decoration: none;
  border-radius: var(--radius-xs);
  margin-bottom: 2px;
  font-size: 13.5px;
  transition: all 0.15s;
  white-space: nowrap;
  font-weight: 400;
}
.sidebar nav a:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}
.sidebar nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--blue);
  font-weight: 500;
}
.nav-icon {
  width: 18px; height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.9;
}
.nav-icon svg { width: 17px; height: 17px; }

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--sidebar-border);
  margin: 10px 16px;
}
.sidebar-section-label {
  padding: 2px 16px 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
}
.admin-only { display: none; }

/* ---------- 内容区 ---------- */
.content { flex: 1; overflow-y: auto; overflow-x: hidden; background: var(--bg); }
.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: 14px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .breadcrumb {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
.topbar .btn-logout {
  padding: 6px 16px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--pill);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.15s;
  font-family: inherit;
}
.topbar .btn-logout:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
/* 手机端"扫一扫"入口（仅小屏显示） */
.scan-entry { display: none; }
@media (max-width: 768px) {
  .scan-entry { display: inline-flex; align-items: center; gap: 4px; }
}
.inner-content { padding: 28px 30px 40px; }

/* ---------- 加载中 ---------- */
#pageBody > p:only-child {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  padding: 36px 4px;
  font-size: 14px;
}
#pageBody > p:only-child::before {
  content: '';
  width: 18px; height: 18px;
  border: 2px solid var(--border-light);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   通用组件
   ============================================================ */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid var(--border-light);
  transition: box-shadow 0.25s;
}
.card:hover { box-shadow: var(--shadow-lg); }

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- 统计卡 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px 24px;
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.25s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .num {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-card .label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 400;
}
.stat-card::after {
  content: '';
  position: absolute;
  right: -30px; top: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.05), transparent 65%);
  pointer-events: none;
}
.stat-card:nth-child(2)::after { background: radial-gradient(circle, rgba(52, 199, 89, 0.06), transparent 65%); }
.stat-card:nth-child(3)::after { background: radial-gradient(circle, rgba(255, 159, 10, 0.07), transparent 65%); }
.stat-card:nth-child(4)::after { background: radial-gradient(circle, rgba(175, 82, 222, 0.07), transparent 65%); }

/* ---------- 表格（极简） ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
th:first-child, td:first-child { padding-left: 4px; }
th:last-child, td:last-child { padding-right: 4px; }
thead th {
  color: var(--text-tertiary);
  font-weight: 500;
  font-size: 12px;
}
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: #fafafc; }
tbody tr:last-child td { border-bottom: none; }
.clickable-row { cursor: pointer; }

.mat-code {
  background: #f5f5f7;
  color: #1d1d1f;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12.5px;
}

/* ---------- 按钮（Apple 胶囊） ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 18px;
  border: 1px solid transparent;
  border-radius: var(--pill);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.18s;
  font-family: inherit;
  line-height: 1.4;
  white-space: nowrap;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:active { background: var(--blue-active); transform: scale(0.98); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #28b74e; }
.btn-danger { background: #fff; color: var(--danger); border-color: #ffd1cf; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 5px 14px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.btn:not(.btn-primary):not(.btn-success):not(.btn-danger) {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}
.btn:not(.btn-primary):not(.btn-success):not(.btn-danger):hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: var(--pill);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-primary { background: var(--blue-light); color: var(--blue); }
.badge-pending { background: var(--warning-bg); color: #b25000; border-color: #ffe0b0; }
.badge-processing, .badge-info { background: var(--info-bg); color: #0071a1; border-color: #b8e8fa; }
.badge-success { background: var(--success-bg); color: #1d9e43; border-color: #baf0cc; }
.badge-warning { background: var(--warning-bg); color: #b25000; border-color: #ffe0b0; }
.badge-danger { background: var(--danger-bg); color: #e02018; border-color: #ffc5c2; }
.badge-default { background: #f5f5f7; color: #6e6e73; border-color: var(--border-light); }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  outline: none;
  transition: all 0.15s;
  font-family: inherit;
  background: #fafafc;
  color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.form-row .field { flex: 1; min-width: 160px; }

.form-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 26px;
  border: 1px solid var(--border-light);
}
.form-section-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}
.form-row-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  transition: all 0.15s;
  background: #fafafc;
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.field input:focus, .field select:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}
.field input[readonly] {
  background: #f5f5f7;
  color: var(--text-tertiary);
  cursor: default;
}
.form-actions { margin-top: 22px; display: flex; gap: 10px; align-items: center; }

/* ---------- 提示与空态 ---------- */
.warning {
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: #7c3f00;
}
.empty, .empty-state {
  text-align: center;
  padding: 46px 0;
  color: var(--text-tertiary);
  font-size: 13.5px;
}
.empty-state::before {
  content: '📭';
  display: block;
  font-size: 32px;
  margin-bottom: 10px;
  opacity: 0.5;
}

/* ---------- 标签页（分段控件风格） ---------- */
.page-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(118, 118, 128, 0.08);
  padding: 3px;
  border-radius: var(--pill);
  width: fit-content;
}
.page-tab {
  padding: 7px 22px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--pill);
  transition: all 0.2s;
  white-space: nowrap;
}
.page-tab:hover { color: var(--text); }
.page-tab.active {
  background: #fff;
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.tab-count {
  font-size: 11px;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: var(--pill);
  background: #e5e5ea;
  color: #6e6e73;
  font-weight: 500;
}
.page-tab.active .tab-count { background: var(--blue-light); color: var(--blue); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.25s; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 记录统计 ---------- */
.record-summary { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.record-stat {
  flex: 1;
  min-width: 150px;
  padding: 16px 20px;
  background: #fafafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.record-stat .stat-label {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.record-stat .stat-value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------- 库存状态徽章 ---------- */
.stock-badge {
  display: inline-block;
  padding: 3.5px 12px;
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 500;
  min-width: 42px;
  text-align: center;
  border: 1px solid transparent;
}
.stock-ok   { background: var(--success-bg); color: #1d9e43; border-color: #baf0cc; }
.stock-warn { background: var(--warning-bg); color: #b25000; border-color: #ffe0b0; }
.stock-low  { background: var(--danger-bg); color: #e02018; border-color: #ffc5c2; animation: pulseWarn 1.6s infinite; }
.stock-zero { background: #f5f5f7; color: var(--text-tertiary); border-color: var(--border-light); }
@keyframes pulseWarn { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------- 编码预览 ---------- */
.code-preview-box {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--blue-light);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--blue);
  display: none;
}
.code-tag {
  display: inline-block;
  background: #f5f5f7;
  border: 1px solid var(--border-light);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-secondary);
}
.code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  max-height: 160px;
  overflow-y: auto;
}
.code-summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 500;
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  user-select: none;
  transition: all 0.15s;
  font-size: 12.5px;
}
.code-summary:hover { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------- 下拉选择 ---------- */
.dropdown-list {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  z-index: 100;
  max-height: 210px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
}
.dropdown-item {
  padding: 9px 13px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
}
.dropdown-item:hover { background: var(--blue-light); color: var(--blue); }

/* ---------- 库存物品选择 ---------- */
#outItemsBox {
  background: #fafafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}
#outItemsContainer label {
  display: inline-block;
  margin: 2px 6px;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 6px;
  transition: background 0.12s;
  font-family: var(--mono);
}
#outItemsContainer label:hover { background: var(--blue-light); }
#outItemsContainer input[type="checkbox"] {
  accent-color: var(--blue);
  width: 14px; height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
}

/* ============================================================
   组织架构
   ============================================================ */
.org-tree { padding: 6px 0; }
.org-node { border-left: 1.5px solid var(--border-light); margin-left: 12px; margin-bottom: 2px; }
.org-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fafafc;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  flex-wrap: wrap;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.org-row:hover { background: #fff; border-color: var(--border-light); box-shadow: var(--shadow-sm); }
.org-icon { font-size: 17px; }
.org-name { font-weight: 500; font-size: 14.5px; }
.org-type-tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: var(--pill);
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 500;
}
.org-leader { font-size: 12px; color: var(--text-secondary); }

/* ============================================================
   权限管理
   ============================================================ */
.perm-user-card {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: #fff;
  transition: box-shadow 0.2s;
}
.perm-user-card:hover { box-shadow: var(--shadow); }
.perm-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.perm-user-name { font-weight: 600; font-size: 14.5px; }
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.perm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: all 0.15s;
  background: #fff;
}
.perm-item:hover { background: var(--blue-light); border-color: #c5dcfa; }
.perm-item input[type="checkbox"] {
  width: 15px; height: 15px;
  cursor: pointer;
  accent-color: var(--blue);
}
.perm-item.perm-disabled { opacity: 0.5; cursor: not-allowed; background: #fafafc; }
.perm-select {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}
.perm-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12); }
.mr-4 { margin-right: 4px; }

/* ============================================================
   弹窗
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayIn 0.2s;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: #fff;
  border-radius: 20px;
  width: 700px;
  max-width: 92vw;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
  border-radius: 20px 20px 0 0;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-close {
  background: #f5f5f7;
  border: none;
  font-size: 17px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  line-height: 1;
  width: 30px; height: 30px;
  border-radius: 50%;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--danger); color: #fff; }
.modal-body { padding: 24px; }
.modal-body .form-group { margin-bottom: 16px; }
.modal-body .form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-secondary);
}
.modal-body .form-group input,
.modal-body .form-group select {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  outline: none;
  transition: all 0.15s;
  background: #fafafc;
  font-family: inherit;
  color: var(--text);
}
.modal-body .form-group input:focus,
.modal-body .form-group select:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

/* ============================================================
   详情弹窗
   ============================================================ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-item {
  padding: 12px 15px;
  background: #fafafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.detail-label {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.detail-value { font-size: 13.5px; color: var(--text); word-break: break-all; }
.detail-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.detail-photo {
  width: 120px; height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s;
}
.detail-photo:hover { border-color: var(--blue); transform: scale(1.04); }

.photo-preview-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo-thumb {
  width: 84px; height: 84px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s;
}
.photo-thumb:hover { border-color: var(--danger); opacity: 0.85; }

/* ============================================================
   多端适配
   ============================================================ */
.menu-toggle {
  display: none;
  background: #fff;
  border: 1px solid var(--border-light);
  font-size: 18px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 10px;
  line-height: 1.4;
  border-radius: var(--radius-xs);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 90;
  backdrop-filter: blur(4px);
}
.sidebar-overlay.show { display: block; }

/* 刘海屏安全区 */
@supports (padding: env(safe-area-inset-top)) {
  .topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
  .site-footer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .sidebar { padding-top: env(safe-area-inset-top); }
}

/* ---------- 大屏（≥1680px）：内容限宽居中 ---------- */
@media (min-width: 1680px) {
  .inner-content {
    max-width: 1640px;
    margin: 0 auto;
    width: 100%;
  }
}

/* ---------- 平板（769-1180px）：侧栏收窄、紧凑间距 ---------- */
@media (min-width: 769px) and (max-width: 1180px) {
  .sidebar { width: 208px; }
  .topbar { padding: 12px 20px; }
  .inner-content { padding: 20px 20px 28px; }
  .stat-card { padding: 18px 18px; }
  .stat-card .num { font-size: 28px; }
  .card { padding: 20px; }
  .form-card { padding: 22px; }
}

/* ---------- 手机（≤768px） ---------- */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed;
    left: -270px;
    top: 0; bottom: 0;
    z-index: 100;
    width: 270px;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-block; }
  .content { margin-left: 0 !important; width: 100%; }
  .topbar { padding: 10px 12px; flex-wrap: nowrap; }
  .breadcrumb { font-size: 15px; }
  .inner-content { padding: 14px 12px 28px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 15px 14px; }
  .stat-card .num { font-size: 24px; }
  .form-row { flex-direction: column; gap: 8px; }
  .field { min-width: 100%; }
  .login-card { width: 92vw; padding: 34px 24px; }
  table { font-size: 13px; }
  th, td { padding: 10px 8px; }
  .btn { font-size: 13px; padding: 8px 16px; min-height: 38px; }
  .btn-sm { min-height: 34px; }
  .modal-card { width: 95vw; max-height: 90vh; }
  .modal-body { padding: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .user-info { font-size: 13px; gap: 8px; }
  .btn-logout { font-size: 12px; padding: 6px 12px; min-height: 34px; }
  .record-stat { min-width: 130px; padding: 13px 15px; }
  .page-tabs { width: 100%; }
  .page-tab { flex: 1; text-align: center; padding: 9px 12px; }
  .tab-count { display: none; }
  .form-row-compact { grid-template-columns: 1fr; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1; }
  .site-footer { font-size: 11px; }
  /* 弹窗顶部对齐（键盘弹出时不遮挡） */
  .modal-overlay { align-items: flex-start; padding-top: 8vh; }
}

/* ---------- 小屏手机（≤480px） ---------- */
@media (max-width: 480px) {
  .inner-content { padding: 10px 8px 24px; }
  .login-card { padding: 26px 18px; }
  .login-logo h1 { font-size: 20px; }
  .stats { gap: 8px; }
  .stat-card { padding: 13px 12px; }
  .stat-card .num { font-size: 22px; }
  .card { padding: 16px; border-radius: 14px; }
  .topbar .breadcrumb { font-size: 14px; }
  /* 极窄屏隐藏用户名文本，保留操作按钮 */
  .topbar .user-info > span { display: none; }
  .perm-grid { grid-template-columns: repeat(2, 1fr); }
  .record-summary { gap: 8px; }
  .record-stat { min-width: 45%; }
  .detail-photo { width: 100px; height: 100px; }
  .photo-thumb { width: 72px; height: 72px; }
}

/* ============================================================
   页脚（备案）
   ============================================================ */
.site-footer {
  flex-shrink: 0;
  background: #fafafc;
  color: var(--text-tertiary);
  padding: 10px 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.02em;
  border-top: 1px solid var(--border-light);
}
.site-footer a { color: var(--text-tertiary); text-decoration: none; transition: color 0.2s; }
.site-footer a:hover { color: var(--blue); }
.site-footer .footer-sep { margin: 0 8px; color: var(--border-strong); }
.site-footer .police-icon { width: 14px; height: 15px; vertical-align: -2px; margin-right: 4px; }
