/* =========================================================
   物品领用 SaaS · 设计系统
   ========================================================= */
:root {
  --brand: #2f6bff;
  --brand-dark: #1f4fd8;
  --brand-soft: #eef3ff;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #98a2b3;
  --line: #eaecf0;
  --bg: #f6f7fb;
  --card: #ffffff;
  --ok: #12b76a;
  --ok-soft: #e7f8f0;
  --warn: #f79009;
  --warn-soft: #fff5e6;
  --danger: #f04438;
  --danger-soft: #feeceb;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .16s ease; white-space: nowrap;
}
.btn:hover { border-color: #cbd5e1; color: var(--ink); background: #fbfcfe; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, #3b74ff, #2f6bff);
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .26);
}
.btn-primary:hover { background: linear-gradient(135deg, #2f6bff, #1f4fd8); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #f2f4f7; }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { background: #d92d20; color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-text { background: none; border: none; color: var(--brand); cursor: pointer; padding: 0 4px; font-size: 13px; }
.btn-text:hover { text-decoration: underline; }
.btn-text + .btn-text { margin-left: 6px; }
.btn-text.danger { color: var(--danger); }
.t-actions .btn-text + .btn-text { margin-left: 9px; }

/* --------------------------------------------------------- 卡片 */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.card-sub { font-size: 12.5px; color: var(--ink-3); margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }

/* --------------------------------------------------------- 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: #fff;
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px;
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 36px;
  background: linear-gradient(135deg, #4d84ff, #2f6bff);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px;
  box-shadow: 0 6px 14px rgba(47, 107, 255, .28);
}
.brand-name { font-size: 15px; font-weight: 600; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.nav { padding: 6px 10px; flex: 1; overflow-y: auto; }
.nav-group { font-size: 11px; color: var(--ink-3); padding: 14px 10px 6px; letter-spacing: .06em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px;
  border-radius: 10px; color: var(--ink-2); cursor: pointer; margin-bottom: 2px;
  font-size: 14px; transition: all .14s ease; position: relative;
}
.nav-item:hover { background: #f5f7fb; color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-ico { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 11px;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center;
  padding: 0 5px; font-weight: 600;
}
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.user-chip:hover { background: #f5f7fb; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  background: #e8efff; color: var(--brand); display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}
.user-meta { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: rgba(255,255,255,.86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 17px; font-weight: 650; }
.page-desc { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.content { padding: 22px 24px 40px; }

/* --------------------------------------------------------- KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: 18px 18px 16px; position: relative; overflow: hidden; }
.kpi-label { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 10px 0 2px; }
.kpi-foot { font-size: 12px; color: var(--ink-3); }
.kpi-ico {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.kpi.accent { background: linear-gradient(135deg, #2f6bff, #5b8cff); color: #fff; border-color: transparent; }
.kpi.accent .kpi-label, .kpi.accent .kpi-foot { color: rgba(255,255,255,.8); }
.kpi.accent .kpi-ico { background: rgba(255,255,255,.18); color: #fff; }
.kpi.accent::after {
  content: ""; position: absolute; right: -30px; bottom: -50px; width: 130px; height: 130px;
  border-radius: 50%; background: rgba(255,255,255,.1);
}

/* --------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th {
  text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12.5px;
  padding: 12px 14px; background: #fafbfc; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tb td { padding: 13px 14px; border-bottom: 1px solid #f2f4f7; vertical-align: middle; }
table.tb tbody tr:hover td { background: #fbfcfe; }
table.tb tbody tr:last-child td { border-bottom: none; }
.tb-empty { padding: 48px 0; text-align: center; color: var(--ink-3); font-size: 13px; }

/* --------------------------------------------------------- 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 7px; font-size: 12px; font-weight: 500; background: #f2f4f7; color: var(--ink-2);
  white-space: nowrap;
}
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag.blue { background: var(--brand-soft); color: var(--brand); }
.tag.orange { background: var(--warn-soft); color: #b54708; }
.tag.green { background: var(--ok-soft); color: #027a48; }
.tag.red { background: var(--danger-soft); color: #b42318; }
.tag.gray { background: #f2f4f7; color: #667085; }
.tag.plain::before { display: none; }

/* --------------------------------------------------------- 表单 */
.field { margin-bottom: 16px; }
.field-label { font-size: 13px; color: var(--ink-2); margin-bottom: 7px; font-weight: 500; }
.field-label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 40px; border: 1px solid #dfe3e9; border-radius: 10px;
  padding: 0 12px; font-size: 14px; color: var(--ink); background: #fff;
  outline: none; transition: all .15s ease; font-family: inherit;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}
.input::placeholder, .textarea::placeholder { color: #b4bcc8; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.switch {
  width: 42px; height: 24px; border-radius: 12px; background: #e4e7ec; position: relative;
  cursor: pointer; transition: background .18s ease; flex: 0 0 42px;
}
.switch.on { background: var(--brand); }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .18s ease;
  box-shadow: 0 1px 3px rgba(16,24,40,.2);
}
.switch.on::after { transform: translateX(18px); }

/* --------------------------------------------------------- 模态 */
.mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px;
  animation: fade .16s ease;
}
.modal {
  background: #fff; border-radius: 16px; width: 520px; max-width: 100%;
  max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal.wide { width: 760px; }
.modal-head { padding: 20px 22px 0; }
.modal-title { font-size: 16px; font-weight: 650; margin: 0; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }

/* --------------------------------------------------------- 抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 90; animation: fade .16s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 94vw;
  background: #fff; z-index: 91; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide .22s ease;
}
@keyframes slide { from { transform: translateX(24px); opacity: .6 } to { transform: none; opacity: 1 } }
.drawer-head {
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 24px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* --------------------------------------------------------- 其他 */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ml-auto { margin-left: auto; }
.search { position: relative; }
.search .input { padding-left: 34px; width: 230px; height: 38px; }
.search svg { position: absolute; left: 11px; top: 11px; color: #98a2b3; }
.seg { display: inline-flex; background: #eceff4; padding: 3px; border-radius: 10px; gap: 2px; }
.seg button {
  border: none; background: transparent; height: 30px; padding: 0 14px; border-radius: 8px;
  font-size: 13px; color: var(--ink-2); cursor: pointer; transition: all .15s ease;
}
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 4px 0; font-size: 13px; color: var(--ink-3); }
.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.avatar-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 16px; }

.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #101828; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow); animation: pop .18s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.ok { background: #054f31; }
.toast.err { background: #7a271a; }

.empty { text-align: center; padding: 42px 0; color: var(--ink-3); }
.empty-ico { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px; background: #f2f4f7; display: grid; place-items: center; }

/* 详情 */
.detail-hero { background: linear-gradient(135deg, #f4f7ff, #eef3ff); border-radius: 12px; padding: 16px; margin-bottom: 18px; }
.detail-no { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; font-size: 13.5px; border-bottom: 1px dashed #f0f1f4; }
.kv:last-child { border-bottom: none; }
.kv-k { color: var(--ink-3); }
.kv-v { color: var(--ink); font-weight: 500; text-align: right; }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: #eef1f6; }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: #fff; border: 2px solid var(--brand);
}
.tl-item.reject::before { border-color: var(--danger); }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { padding: 16px; }
}

/* ---------------- 打印申请单 ---------------- */
#print-area { display: none; }

@media print {
  /* 打印时把 body 下除单据外的元素整体 display:none（visibility 会保留占位高度，导致多出空白页） */
  body > *:not(#print-area) { display: none !important; }
  #print-area {
    display: block !important;
    position: static;
    width: 100%;
    color: #000;
    font-family: "SimSun", "宋体", serif;
    font-size: 12.5px;
    line-height: 1.7;
  }
  @page { margin: 15mm 12mm; }
}

#print-area .pa-head { text-align: center; margin-bottom: 10px; }
#print-area .pa-title { font-size: 19px; font-weight: 700; letter-spacing: 2px; }
#print-area .pa-sub { font-size: 12px; color: #333; margin-top: 2px; }
#print-area table { width: 100%; border-collapse: collapse; }
#print-area .pa-info { margin: 8px 0 6px; }
#print-area .pa-info td { padding: 2px 0; font-size: 12.5px; width: 33.3%; }
#print-area .pa-reason { margin: 8px 0; font-size: 12.5px; }
#print-area .pa-reject { margin: 6px 0; font-size: 12.5px; color: #a00; }
#print-area .pa-sect { margin: 12px 0 6px; font-size: 13px; }
#print-area .pa-table th, #print-area .pa-table td {
  border: 1px solid #000;
  padding: 5px 7px;
  font-size: 12px;
  text-align: left;
}
#print-area .pa-table th { background: #f0f0f0; font-weight: 700; }
#print-area .pa-sign { margin-top: 26px; }
#print-area .pa-sign td { font-size: 12.5px; padding: 4px 0; width: 33.3%; }
#print-area .pa-foot { margin-top: 18px; font-size: 10.5px; color: #666; text-align: center; }
