/* ============ 组件样式：表单、弹窗、分页、时间线、二维码 ============ */

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.form-item { display: flex; flex-direction: column; margin-bottom: 12px; }
.form-item.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; color: var(--c-text); margin-bottom: 6px; }
.form-label .req { color: var(--c-red); margin-right: 3px; }
.form-item input[type="text"], .form-item input[type="number"], .form-item input[type="password"],
.form-item input[type="date"], .form-item select, .form-item textarea {
  height: 34px; border: 1px solid var(--c-border); border-radius: 4px; padding: 0 10px;
  font-size: 13px; outline: none; font-family: inherit; background: #fff; color: var(--c-text); width: 100%;
}
.form-item textarea { height: 64px; padding: 8px 10px; resize: vertical; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  border-color: var(--c-primary); box-shadow: 0 0 0 2px rgba(16,185,129,.12);
}
.form-item input[readonly] { background: #F5F7FA; color: var(--c-text2); cursor: not-allowed; }
.form-err { color: var(--c-red); font-size: 12px; margin-top: 4px; display: none; }
.form-item.error input, .form-item.error select, .form-item.error textarea { border-color: var(--c-red); }
.form-item.error .form-err { display: block; }
.form-hint { color: var(--c-text2); font-size: 12px; margin-top: 4px; }

/* 明细行表格 */
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-table th { background: #F7F9FB; font-weight: 600; color: var(--c-text2); font-size: 12px; padding: 7px 8px; border: 1px solid var(--c-border); text-align: left; }
.detail-table td { padding: 5px 8px; border: 1px solid var(--c-border); }
.detail-table input, .detail-table select {
  width: 100%; height: 30px; border: 1px solid var(--c-border); border-radius: 3px; padding: 0 8px; font-size: 13px; outline: none; background: #fff;
}
.detail-table input:focus, .detail-table select:focus { border-color: var(--c-primary); }
.detail-table input[readonly] { background: #F5F7FA; color: var(--c-text2); }
.detail-del { color: var(--c-red); cursor: pointer; font-size: 15px; padding: 0 4px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(13, 27, 42, .45); z-index: 1000;
  display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 16px;
}
.modal {
  background: #fff; border-radius: 8px; width: 720px; max-width: 96vw; box-shadow: 0 8px 40px rgba(0,0,0,.2);
  animation: modalIn .18s ease;
}
.modal.modal-lg { width: 960px; }
.modal.modal-sm { width: 460px; }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--c-border); }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-drag-hint { flex: 1; margin: 0 10px; font-size: 12px; color: #64748b; }
.modal-close { cursor: pointer; color: var(--c-text2); font-size: 20px; line-height: 1; padding: 2px 6px; }
.modal-close:hover { color: var(--c-red); }
.modal-body { padding: 18px 20px; max-height: 66vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--c-border); }

/* 查看详情描述列表 */
.desc-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--c-border); border-radius: 6px; overflow: hidden; }
.desc-list .d-item { display: flex; border-bottom: 1px solid #F2F4F7; font-size: 13px; }
.desc-list .d-item:last-child, .desc-list .d-item:nth-last-child(2):nth-child(odd) { border-bottom: none; }
.d-label { width: 110px; background: #F7F9FB; color: var(--c-text2); padding: 8px 12px; flex-shrink: 0; }
.d-value { padding: 8px 12px; flex: 1; word-break: break-all; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 9px 20px; border-radius: 6px; color: #fff; font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.18);
  animation: toastIn .2s ease; max-width: 80vw;
}
.toast-success { background: #10B981; }
.toast-error { background: #EF4444; }
.toast-warn { background: #F59E0B; }
.toast-info { background: #3B82F6; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 14px; font-size: 13px; color: var(--c-text2); }
.pagination button {
  min-width: 28px; height: 28px; border: 1px solid var(--c-border); background: #fff; border-radius: 4px;
  cursor: pointer; color: #606266; font-size: 13px; padding: 0 8px;
}
.pagination button:hover:not([disabled]) { color: var(--c-primary); border-color: var(--c-primary); }
.pagination button.cur { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.pagination button[disabled] { opacity: .4; cursor: not-allowed; }
.pagination select { height: 28px; border: 1px solid var(--c-border); border-radius: 4px; font-size: 12px; }

/* ---------- 审批流时间线 ---------- */
.timeline { padding: 4px 0; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; z-index: 1; }
.tl-dot.done { background: #D1FAE5; color: #047857; }
.tl-dot.wait { background: #FEF3C7; color: #B45309; }
.tl-dot.reject { background: #FEE2E2; color: #B91C1C; }
.tl-dot.info { background: #E5E7EB; color: #6B7280; }
.tl-line { position: absolute; left: 10.5px; top: 22px; bottom: 0; width: 1.5px; background: #E5E7EB; }
.tl-item:last-child .tl-line { display: none; }
.tl-main { flex: 1; }
.tl-title { font-size: 13px; font-weight: 600; }
.tl-desc { font-size: 12px; color: var(--c-text2); margin-top: 3px; }

/* ---------- 二维码弹窗 ---------- */
.qr-box { display: flex; flex-direction: column; align-items: center; padding: 8px 0 14px; }
.qr-box canvas { border: 1px solid var(--c-border); padding: 10px; border-radius: 6px; background: #fff; }
.qr-caption { margin-top: 12px; font-size: 14px; font-weight: 600; }
.qr-sub { margin-top: 4px; font-size: 12px; color: var(--c-text2); }

/* ---------- 权限矩阵 ---------- */
.perm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.perm-table th, .perm-table td { border: 1px solid var(--c-border); padding: 6px 8px; text-align: center; }
.perm-table th { background: #F7F9FB; color: var(--c-text2); font-weight: 600; }
.perm-table td:first-child { text-align: left; font-weight: 600; }
.perm-table input[type="checkbox"] { accent-color: var(--c-primary); width: 15px; height: 15px; cursor: pointer; }

/* ---------- 进度条 ---------- */
.progress { background: #F3F4F6; border-radius: 8px; height: 14px; overflow: hidden; position: relative; min-width: 90px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #34D399, #10B981); border-radius: 8px; transition: width .3s; }
.progress.warn .progress-bar { background: linear-gradient(90deg, #FBBF24, #F59E0B); }
.progress.late .progress-bar { background: linear-gradient(90deg, #F87171, #EF4444); }
.progress-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #374151; }

/* ---------- 简易图表 ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 14px; height: 150px; padding: 8px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.chart-col .bar { width: 70%; max-width: 46px; background: linear-gradient(180deg, #34D399, #10B981); border-radius: 4px 4px 0 0; transition: height .4s; }
.chart-col .bar.warn { background: linear-gradient(180deg, #FBBF24, #F59E0B); }
.chart-col .bar.late { background: linear-gradient(180deg, #F87171, #EF4444); }
.chart-col .v { font-size: 11px; color: var(--c-text); font-weight: 600; }
.chart-col .n { font-size: 11px; color: var(--c-text2); white-space: nowrap; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--c-text2); margin-top: 8px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* 环形占比 */
.ring-chart { display: flex; align-items: center; gap: 18px; }
.donut { width: 120px; height: 120px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut::after { content: ""; position: absolute; inset: 18px; background: #fff; border-radius: 50%; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.donut-center b { font-size: 20px; }
.donut-center span { font-size: 11px; color: var(--c-text2); }

/* ---------- 仓位网格图 ---------- */
.bin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.bin-cell { border: 1px solid var(--c-border); border-radius: 6px; padding: 10px 8px; text-align: center; cursor: default; transition: box-shadow .15s; }
.bin-cell:hover { box-shadow: 0 2px 10px rgba(16,185,129,.25); }
.bin-cell b { display: block; font-size: 13px; }
.bin-cell span { font-size: 12px; color: var(--c-text2); }
.bin-cell.lv-ok { background: #F0FDF4; border-color: #A7F3D0; }
.bin-cell.lv-low { background: #FEF2F2; border-color: #FECACA; }
.bin-cell.lv-zero { background: #F9FAFB; border-color: var(--c-border); }

/* ---------- 消息中心 ---------- */
.msg-item { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #F2F4F7; align-items: flex-start; }
.msg-item:hover { background: #FAFCFE; }
.msg-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-red); margin-top: 6px; flex-shrink: 0; }
.msg-item.read .msg-dot { background: #D1D5DB; }
.msg-title { font-weight: 600; font-size: 13px; }
.msg-item.read .msg-title { color: var(--c-text2); font-weight: normal; }
.msg-body { font-size: 12px; color: var(--c-text2); margin-top: 3px; }
.msg-time { font-size: 11px; color: var(--c-text2); white-space: nowrap; margin-left: auto; }

/* ---------- 搜索高亮 & 杂项 ---------- */
.kv-strip { display: flex; flex-wrap: wrap; gap: 22px; font-size: 13px; background: #F7F9FB; border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; }
.kv-strip b { color: var(--c-primary-dark); }
.badge-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.money { font-variant-numeric: tabular-nums; }

select.master-source { display:none !important; }
.master-button { max-width:100%; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; }
.form-item .master-button,.detail-table .master-button { width:100%; }
.master-button:not(:disabled)::after { content:' ⌕'; color:#43786d; }
.q-combo.master-filter { display:flex; gap:4px; align-items:center; }
.q-combo.master-filter input { flex:1; min-width:0; padding-right:6px; }
.q-combo.master-filter .master-button { width:auto; flex:none; }
.lookup-mask { z-index:2200; }
.master-search { width:100%; height:36px; border:1px solid #bbc7c4; border-radius:4px; padding:0 10px; }
.lookup-list { overflow-x:auto; }
.master-pages { display:flex; align-items:center; gap:10px; padding-top:8px; }
.lookup-mask .modal-close { background:none;border:0; }
.delivery-sheet { background: white; color: #20252c; padding: 12px; border: 1px solid var(--c-border); overflow-x: auto; font-size: 12px; }
.delivery-sheet .meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 10px; margin: 8px 0; }
.delivery-sheet table { width: 100%; border-collapse: collapse; }
.delivery-sheet td, .delivery-sheet th { text-align: center; border: 1px solid #555; padding: 4px; }
.delivery-sheet .sign { display: flex; justify-content: space-between; gap: 6px; margin: 20px 0 8px; }
.delivery-sheet .ft { line-height: 1.6; }
