/* ===========================================================
   阳弘 ERP 物料管理平台 · 全局样式（科技蓝，与官网视觉统一）
   =========================================================== */

:root {
  --blue-900: #062a63;
  --blue-800: #0b3d91;
  --blue-700: #1155c9;
  --blue-600: #1a6fe8;
  --blue-500: #3d8bff;
  --blue-100: #e8f0fe;
  --blue-50:  #f4f8ff;

  --ink-900: #0f1c33;
  --ink-700: #2c3e56;
  --ink-500: #5b6b82;
  --ink-400: #8494a8;
  --ink-300: #b6c1d1;

  --line:    #e3e9f2;
  --bg:      #f7f9fc;
  --white:   #fff;

  --red:     #d92929;
  --red-bg:  #fdecec;
  --green:   #17915c;
  --green-bg:#e8f6ef;
  --amber:   #b7791f;
  --amber-bg:#fdf5e6;

  --shadow-sm: 0 1px 3px rgba(15, 28, 51, .06);
  --shadow:    0 4px 16px rgba(15, 28, 51, .08);
  --shadow-lg: 0 12px 40px rgba(11, 61, 145, .14);

  --radius:    10px;
  --radius-lg: 16px;
  --ease:      cubic-bezier(.4, 0, .2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink-700);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink-900); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8d3e2; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #a9b8cc; }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: all .22s var(--ease);
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue-800); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); box-shadow: 0 4px 14px rgba(11,61,145,.28); }
.btn-outline { background: #fff; color: var(--blue-800); border-color: var(--blue-100); }
.btn-outline:hover:not(:disabled) { background: var(--blue-50); border-color: var(--blue-500); }
.btn-ghost { background: transparent; color: var(--ink-500); }
.btn-ghost:hover:not(:disabled) { background: var(--blue-50); color: var(--blue-800); }
.btn-danger { background: #fff; color: var(--red); border-color: #f3c9c9; }
.btn-danger:hover:not(:disabled) { background: var(--red-bg); }
.btn-danger-solid { background: rgba(255,255,255,.14); color: #ffd9d9; border-color: rgba(255,120,120,.45); }
.btn-danger-solid:hover:not(:disabled) { background: var(--red); border-color: var(--red); color: #fff; }
.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 26px; font-size: 15px; }
.btn-block { width: 100%; }

/* ================= 表单 ================= */
.field { margin-bottom: 16px; }
/* 注意：:not(.switch) 很重要 ——
   .field label 的 display:block 会覆盖 .switch 的 inline-flex，
   导致开关被压扁、文字被裁切。 */
.field label:not(.switch) {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 7px;
}
.field label:not(.switch) .req { color: var(--red); margin-left: 3px; }
.field .hint { font-size: 12px; color: var(--ink-400); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  transition: all .2s var(--ease);
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(61,139,255,.13);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-300); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238494a8' d='M6 8.5L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
  cursor: pointer;
}
.select:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%230b3d91' d='M6 8.5L2 4h8z'/%3E%3C/svg%3E"); }

/* ================= 卡片 ================= */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--ink-900); }
.card-body { padding: 22px; }

/* ================= 标签 ================= */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}
.tag-blue { background: var(--blue-100); color: var(--blue-800); }
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-amber { background: var(--amber-bg); color: var(--amber); }
.tag-gray { background: #eef1f6; color: var(--ink-500); }

/* ================= Toast ================= */
#toastWrap {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 11px 20px;
  border-radius: var(--radius);
  background: rgba(15,28,51,.93);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .26s var(--ease);
  max-width: 76vw;
}
.toast.success { background: #17915c; }
.toast.error { background: #c62b2b; }
.toast.warn { background: #b7791f; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= 弹窗 ================= */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15,28,51,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modalIn .24s var(--ease);
}
.modal-box.wide { max-width: 860px; }
.modal-box.xwide { max-width: 1140px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  flex: 0 0 auto;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--ink-900); }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-400);
  font-size: 22px;
  line-height: 1;
  transition: all .2s;
}
.modal-close:hover { background: #f0f3f8; color: var(--ink-900); }
.modal-body { flex: 1 1 auto; overflow-y: auto; padding: 24px; }
.modal-foot {
  flex: 0 0 auto;
  padding: 15px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fafbfd;
}

/* ================= 表格 ================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  background: #f4f7fb;
  color: var(--ink-500);
  font-weight: 600;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
table.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0f3f8;
  color: var(--ink-700);
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: var(--blue-50); }
table.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-link { color: var(--blue-700); font-weight: 600; cursor: pointer; }
.tbl-link:hover { text-decoration: underline; }
.tbl-empty { text-align: center; padding: 50px 20px; color: var(--ink-400); }

/* ================= 工具条 ================= */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar .spacer { flex: 1; }
.search-box { position: relative; }
.search-box .input { padding-left: 34px; min-width: 220px; }
.search-box::before {
  content: "";
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  background: var(--ink-300);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238494a8' stroke-width='2.4'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238494a8' stroke-width='2.4'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") center/contain no-repeat;
  pointer-events: none;
}

/* ================= 空状态 ================= */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-400);
}
.empty-icon {
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--blue-50);
  display: flex; align-items: center; justify-content: center;
  color: var(--blue-500);
  font-size: 30px;
}
.empty h3 { font-size: 16px; color: var(--ink-700); margin-bottom: 8px; }
.empty p { font-size: 13px; margin-bottom: 20px; }

/* ================= 分页 ================= */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 4px 0;
  font-size: 13px;
  color: var(--ink-500);
}
.pager-btns { display: flex; gap: 6px; }
.pager-btn {
  min-width: 34px; height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-700);
  font-size: 13px;
  transition: all .2s;
}
.pager-btn:hover:not(:disabled) { border-color: var(--blue-500); color: var(--blue-800); }
.pager-btn.active { background: var(--blue-800); border-color: var(--blue-800); color: #fff; }
.pager-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ================= 加载 ================= */
.loading { text-align: center; padding: 50px; color: var(--ink-400); }
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--blue-100);
  border-top-color: var(--blue-800);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= 开关 ================= */
/* 开关行：左侧标题+说明，右侧开关，两行文字不会被挤压 */
.switch-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  margin-bottom: 6px;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.switch-row:hover { border-color: var(--blue-500); background: var(--blue-50); }
.switch-row.on { border-color: var(--blue-500); background: var(--blue-50); }
.switch-text { flex: 1; min-width: 0; }
.switch-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.switch-title .ic { width: 15px; height: 15px; color: var(--blue-700); }
.switch-desc { font-size: 12.5px; color: var(--ink-500); line-height: 1.55; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-700);
  margin-bottom: 0;
  flex-shrink: 0;
}
.switch input { display: none; }
.switch .track {
  width: 44px; height: 24px;
  border-radius: 12px;
  background: #cdd6e3;
  position: relative;
  transition: background .24s var(--ease);
  flex-shrink: 0;
  box-shadow: inset 0 1px 2px rgba(15,28,51,.12);
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.22);
  transition: transform .24s var(--ease);
}
.switch input:checked + .track { background: var(--blue-800); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch .switch-label { font-size: 13px; color: var(--ink-700); font-weight: 400; margin-bottom: 0; }

/* ================= 图标 ================= */
.ic {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -2px;
}

/* ================= 密码确认弹窗 ================= */
.pw-warn {
  padding: 13px 16px;
  background: var(--red-bg);
  border: 1px solid #f3c9c9;
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: #9c2626;
  line-height: 1.8;
  margin-bottom: 18px;
}
.pw-warn b { color: var(--red); }

/* ================= 通用工具 ================= */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--ink-400); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mono { font-family: Consolas, Monaco, monospace; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   移动端表单组件（图标输入框 / 品牌头）
   ============================================================ */

/* 桌面端显示为正常标签；移动端用 placeholder 代替可见 label */
.sr-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 7px;
}
.sr-label .req { color: var(--red); margin-left: 3px; }
@media (max-width: 640px) {
  .sr-label {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
  }
}

/* 图标输入框 */
.ic-input {
  position: relative;
  display: flex;
  align-items: center;
}
.ic-input .ic-lead {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--ink-400);
  pointer-events: none;
  transition: color .2s var(--ease);
}
.ic-input .ic-lead svg { width: 100%; height: 100%; display: block; }
.ic-input .input { padding-left: 40px; }
.ic-input:focus-within .ic-lead { color: var(--blue-600); }

/* 移动端品牌头（登录/注册页） */
.m-brand {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.m-brand-mark {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--blue-700), var(--blue-500));
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(17, 85, 201, .32);
  flex-shrink: 0;
}
.m-brand-name { font-size: 19px; font-weight: 800; color: var(--ink-900); letter-spacing: .4px; }
.m-brand-sub { font-size: 12.5px; color: var(--ink-400); margin-top: 1px; }

/* ============================================================
   升级弹窗（移动端 + 桌面客户端）
   放在 base.css：登录页 index.html 只引 base.css，
   桌面端更新弹窗在登录页也会弹出
   ============================================================ */
.app-update-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.app-update-box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 26px 22px 20px;
  text-align: center;
  box-shadow: 0 18px 48px rgba(10, 20, 40, .28);
  animation: appUpdateIn .26s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes appUpdateIn {
  from { transform: translateY(16px) scale(.96); opacity: 0 }
  to { transform: none; opacity: 1 }
}
.app-update-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-800), var(--blue-600));
  color: #fff;
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(11, 61, 145, .3);
}
.app-update-title { font-size: 18px; font-weight: 700; color: var(--ink-900); margin-bottom: 10px; }
.app-update-notes {
  font-size: 13.5px;
  color: var(--ink-500);
  line-height: 1.7;
  text-align: left;
  background: #f5f8fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  max-height: 30vh;
  overflow-y: auto;
}
.app-update-meta { font-size: 12px; color: var(--ink-400); margin-bottom: 18px; }
.app-update-force {
  display: inline-block;
  background: var(--red-bg);
  color: var(--red);
  border-radius: 20px;
  padding: 2px 9px;
  font-weight: 600;
  margin-left: 6px;
}
.app-update-actions { display: flex; gap: 10px; }
.app-update-actions .btn { flex: 1; }

/* 下载进度条（桌面客户端更新） */
.app-update-progress {
  height: 8px;
  border-radius: 20px;
  background: #eaf0fa;
  overflow: hidden;
  margin-bottom: 12px;
}
.app-update-progress .up-bar {
  height: 100%;
  width: 0;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--blue-700), var(--blue-500));
  transition: width .25s var(--ease);
}
