/* ============ 物品出入库管理 H5 —— 设计系统 ============ */
:root {
  --primary: #2F54EB;
  --primary-light: #EEF2FF;
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --text: #1F2329;
  --text-2: #4E5566;
  --text-3: #8A93A6;
  --border: #E5E8EF;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(31, 35, 41, 0.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; background: var(--bg); padding-bottom: 76px; }

/* ---- 导航栏 ---- */
.navbar {
  position: sticky; top: 0; z-index: 100; display: flex; align-items: center; height: 48px;
  background: var(--card); border-bottom: 1px solid var(--border); padding: 0 12px; gap: 8px;
}
.navbar .nav-back { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--text-2); cursor: pointer; border: none; background: none; }
.navbar .nav-title { flex: 1; font-size: 16px; font-weight: 600; text-align: center; }
.navbar .nav-action { font-size: 13px; color: var(--primary); cursor: pointer; border: none; background: none; padding: 4px 6px; }

/* ---- 登录页 ---- */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #2F54EB 0%, #1D39C4 55%, #10239E 100%); }
.login-card { width: 100%; max-width: 360px; background: var(--card); border-radius: 16px; padding: 28px 22px; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.login-logo { width: 64px; height: 64px; border-radius: 16px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 30px; margin: 0 auto 14px; }
.login-title { text-align: center; font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-3); font-size: 12px; margin-bottom: 22px; }
.login-net { text-align: center; margin-top: 14px; font-size: 12px; color: var(--text-3); cursor: pointer; text-decoration: underline; }

/* ---- 表单 ---- */
.form-item { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.form-label .req { color: var(--danger); margin-right: 2px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 15px; background: #fff; color: var(--text); outline: none; transition: border-color .15s;
  font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.textarea { min-height: 72px; resize: vertical; }
.input:disabled, .select:disabled { background: #F3F4F8; color: var(--text-3); }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 11px 18px; font-size: 15px; font-weight: 600;
  cursor: pointer; background: var(--primary); color: #fff; width: 100%; transition: opacity .15s;
}
.btn:active { opacity: .85; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.gray { background: #F0F1F5; color: var(--text-2); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }
.btn.sm { padding: 7px 12px; font-size: 13px; width: auto; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---- 卡片 ---- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin: 12px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.card-title .more { font-size: 12px; color: var(--text-3); font-weight: 400; cursor: pointer; }

/* ---- 首页 ---- */
.home-header { background: linear-gradient(135deg, #2F54EB, #1D39C4); color: #fff; padding: 18px 16px 46px; }
.home-header .hi { font-size: 12px; opacity: .85; }
.home-header .school { font-size: 18px; font-weight: 700; margin-top: 2px; }
.home-header .role-chip { display: inline-block; background: rgba(255,255,255,.18); border-radius: 20px; padding: 2px 10px; font-size: 11px; margin-top: 8px; }
.home-stats { display: flex; gap: 10px; margin: -34px 12px 0; }
.stat-card { flex: 1; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 8px; text-align: center; cursor: pointer; }
.stat-card .num { font-size: 22px; font-weight: 800; color: var(--primary); }
.stat-card .num.red { color: var(--danger); }
.stat-card .num.orange { color: var(--warning); }
.stat-card .lbl { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.stat-card .badge-dot { display: inline-block; min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; padding: 0 4px; margin-left: 4px; vertical-align: top; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 4px 0; }
.quick-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px; border-radius: 10px; cursor: pointer; }
.quick-item:active { background: var(--primary-light); }
.quick-item .qi-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 21px; color: #fff; }
.quick-item .qi-name { font-size: 12px; color: var(--text-2); }

.todo-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.todo-item:last-child { border-bottom: none; }
.todo-item .t-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.todo-item .t-body { flex: 1; min-width: 0; }
.todo-item .t-title { font-size: 14px; font-weight: 600; }
.todo-item .t-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.todo-item .t-num { font-size: 18px; font-weight: 800; color: var(--danger); }

.notice-item { padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.notice-item:last-child { border-bottom: none; }
.notice-item .n-title { font-size: 13px; font-weight: 600; }
.notice-item .n-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- 列表 ---- */
.list-item { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px 14px; margin: 10px 12px; cursor: pointer; }
.list-item:active { background: #FAFBFF; }
.li-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.li-no { font-size: 13px; font-weight: 700; font-family: ui-monospace, monospace; }
.li-sub { font-size: 12px; color: var(--text-3); }
.li-body { font-size: 13px; color: var(--text-2); }
.li-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-3); }

.tag { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.tag.gray { background: #F0F1F5; color: var(--text-2); }
.tag.blue { background: var(--primary-light); color: var(--primary); }
.tag.green { background: #E8F7EE; color: var(--success); }
.tag.orange { background: #FDF3E3; color: var(--warning); }
.tag.red { background: #FDECEC; color: var(--danger); }

/* ---- 筛选栏 ---- */
.filter-bar { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 48px; z-index: 90; }
.filter-bar .select { width: auto; min-width: 96px; flex-shrink: 0; padding: 7px 10px; font-size: 13px; border-radius: 8px; background: #F7F8FB; }
.filter-bar .search-input { flex: 1; min-width: 120px; padding: 7px 10px; font-size: 13px; border-radius: 8px; }

/* ---- 详情 ---- */
.detail-section { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin: 12px; }
.detail-section .ds-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; padding-left: 8px; border-left: 3px solid var(--primary); }
.kv-row { display: flex; padding: 7px 0; font-size: 13px; }
.kv-row .k { width: 92px; color: var(--text-3); flex-shrink: 0; }
.kv-row .v { flex: 1; color: var(--text); word-break: break-all; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mini-table th { background: #F7F8FB; color: var(--text-2); font-weight: 600; padding: 7px 6px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.mini-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.mini-table tr:last-child td { border-bottom: none; }

/* ---- 图片 ---- */
.img-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.img-cell { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #F0F1F5; cursor: pointer; }
.img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-cell .img-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; line-height: 1; }
.img-upload { aspect-ratio: 1; border: 1px dashed #C7CDDB; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-3); font-size: 11px; gap: 2px; cursor: pointer; background: #FAFBFC; }
.img-upload .plus { font-size: 22px; font-weight: 300; line-height: 1; }

/* ---- 物品选择弹层 ---- */
.sheet-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: var(--card); border-radius: 16px 16px 0 0; max-height: 82vh; display: flex; flex-direction: column; animation: slideUp .2s ease; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.sheet-head .sh-title { font-size: 16px; font-weight: 700; }
.sheet-body { overflow-y: auto; padding: 12px 16px; flex: 1; }
.sheet-foot { padding: 12px 16px; border-top: 1px solid var(--border); }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick-row:last-child { border-bottom: none; }
.pick-row.selected { background: var(--primary-light); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.pick-row .pr-body { flex: 1; min-width: 0; }
.pick-row .pr-name { font-size: 14px; font-weight: 600; }
.pick-row .pr-sub { font-size: 12px; color: var(--text-3); }
.pick-row .pr-check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #C7CDDB; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; }
.pick-row.selected .pr-check { background: var(--primary); border-color: var(--primary); }

/* ---- 明细行（新建单据） ---- */
.line-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: #FAFBFD; }
.line-row .lr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.line-row .lr-name { font-size: 14px; font-weight: 600; flex: 1; }
.line-row .lr-del { color: var(--danger); font-size: 12px; cursor: pointer; border: none; background: none; }
.line-row .lr-fields { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.line-row .lr-fields .input, .line-row .lr-fields .select { padding: 7px 10px; font-size: 13px; border-radius: 8px; }
.line-row .qty-input { width: 76px; text-align: center; }
.line-add { width: 100%; border: 1px dashed var(--primary); color: var(--primary); background: var(--primary-light); border-radius: 10px; padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer; }

/* ---- tabBar ---- */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; background: var(--card); border-top: 1px solid var(--border); display: flex; z-index: 150; padding-bottom: env(safe-area-inset-bottom); }
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 7px 0 6px; font-size: 11px; color: var(--text-3); cursor: pointer; border: none; background: none; gap: 2px; }
.tabbar .tab .t-ico { font-size: 21px; line-height: 1; }
.tabbar .tab.active { color: var(--primary); font-weight: 600; }
.tabbar .tab .t-badge { position: absolute; transform: translate(14px, -2px); background: var(--danger); color: #fff; border-radius: 8px; font-size: 9px; padding: 0 4px; min-width: 14px; height: 14px; line-height: 14px; }

/* ---- 消息 ---- */
.msg-item { display: flex; gap: 10px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px; margin: 10px 12px; cursor: pointer; }
.msg-item.unread { background: #F3F7FF; }
.msg-item .m-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.msg-item .m-body { flex: 1; min-width: 0; }
.msg-item .m-title { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; }
.msg-item .m-time { font-size: 11px; color: var(--text-3); font-weight: 400; }
.msg-item .m-content { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.msg-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex-shrink: 0; margin-top: 6px; }

/* ---- 报表 ---- */
.report-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin: 10px 12px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.report-card .r-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; flex-shrink: 0; }
.report-card .r-body { flex: 1; }
.report-card .r-name { font-size: 15px; font-weight: 700; }
.report-card .r-sub { font-size: 12px; color: var(--text-3); }
.report-table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px; }

/* ---- 我的 ---- */
.mine-header { background: linear-gradient(135deg, #2F54EB, #1D39C4); color: #fff; padding: 22px 16px; display: flex; align-items: center; gap: 14px; }
.mine-avatar { width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; }
.mine-name { font-size: 18px; font-weight: 700; }
.mine-role { font-size: 12px; opacity: .85; margin-top: 2px; }
.menu-list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px; overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px; }
.menu-item:last-child { border-bottom: none; }
.menu-item .mi-ico { font-size: 18px; width: 24px; text-align: center; }
.menu-item .mi-name { flex: 1; }
.menu-item .mi-arrow { color: #C7CDDB; font-size: 14px; }
.menu-item .mi-val { font-size: 12px; color: var(--text-3); }

/* ---- 通用 ---- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .e-ico { font-size: 44px; margin-bottom: 10px; opacity: .5; }
.empty .e-txt { font-size: 13px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 16px 14px 8px; }
.safe-bottom { height: 20px; }
.loading { text-align: center; padding: 30px; color: var(--text-3); font-size: 13px; }

.toast { position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.78); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 999; display: none; max-width: 76%; text-align: center; }
.toast.show { display: block; }

.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 32px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 320px; overflow: hidden; }
.modal .m-head { padding: 18px 18px 8px; font-size: 16px; font-weight: 700; text-align: center; }
.modal .m-body { padding: 4px 18px 14px; font-size: 14px; color: var(--text-2); text-align: center; white-space: pre-wrap; }
.modal .m-foot { display: flex; border-top: 1px solid var(--border); }
.modal .m-foot button { flex: 1; padding: 13px; border: none; background: none; font-size: 15px; cursor: pointer; color: var(--text-2); }
.modal .m-foot button.primary { color: var(--primary); font-weight: 700; border-left: 1px solid var(--border); }
.modal .m-foot button.danger { color: var(--danger); font-weight: 700; border-left: 1px solid var(--border); }
.modal-input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; font-size: 14px; margin-top: 10px; font-family: inherit; }

.qr-box { background: #fff; padding: 16px; border-radius: 12px; text-align: center; }
.qr-box svg { width: 220px; height: 220px; }
.qr-box .qr-code { font-size: 13px; color: var(--text-2); margin-top: 8px; font-family: ui-monospace, monospace; }
.qr-box .qr-tip { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.img-preview { position: fixed; inset: 0; background: #000; z-index: 400; display: flex; align-items: center; justify-content: center; }
.img-preview img { max-width: 100%; max-height: 100%; }
.img-preview .ip-close { position: absolute; top: 16px; right: 16px; color: #fff; font-size: 26px; background: none; border: none; }
