/* ============================================================
   卓优数码 网页版 - 公共样式（顶级冰蓝版 v5）
   品牌体系：单一冰蓝强调色 + 黑白灰（Apple 式克制）
   深色框架(登录页/侧栏) + 浅色业务工作区
   功能状态标签色（绿/橙/红）为行业惯例小色块，保留
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #0ba3e0;
  --primary-2: #4fc3ff;
  --primary-dark: #0871ad;
  --grad: linear-gradient(135deg, #0a86c4 0%, #3cb6f2 100%);
  --grad-soft: linear-gradient(135deg, #eaf6fd 0%, #f4fafe 100%);
  --sidebar-bg: #081826;
  --sidebar-deep: #050f18;
  --sidebar-text: #a9c4d2;
  --sidebar-active: #4fc3ff;
  --bg: #eef4f8;
  --card-bg: #ffffff;
  --border: #e2e9ee;
  --text: #1f2b31;
  --text-light: #64727a;
  --danger: #d64545;
  --warn: #d99000;
  --success: #1d8a5c;
  --shadow: 0 2px 10px rgba(20, 70, 105, .06);
  --shadow-lg: 0 12px 32px rgba(20, 70, 105, .14);
  --radius: 10px;
}
body { font-family: "Inter", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
.num, table.data, .stat-card .num { font-variant-numeric: tabular-nums; }

/* ===== 顶部工具栏 ===== */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.toolbar .title { font-size: 16px; font-weight: 700; margin-right: auto; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.toolbar input, .toolbar select { padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; background: #fff; transition: border-color .15s, box-shadow .15s; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11, 163, 224, .12); }
.toolbar label { color: var(--text-light); font-size: 13px; }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); font-size: 13px; cursor: pointer; transition: all .18s; white-space: nowrap; }
.btn:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 2px 8px rgba(11, 163, 224, .12); }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 3px 10px rgba(10, 134, 196, .25); }
.btn-primary:hover { filter: brightness(1.06); color: #fff; box-shadow: 0 4px 14px rgba(10, 134, 196, .35); }
.btn-danger { background: #fff; border-color: #eec9c9; color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-warn { background: #fff; border-color: #ecd9a8; color: var(--warn); }
.btn-warn:hover { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 卡片 ===== */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad); opacity: .85; }
.card h3 { font-size: 15px; margin-bottom: 12px; color: var(--text); }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 表头：冰蓝浅底 + 深蓝字，与白卡片 / #eef4f8 底协调（原来是深蓝渐变压白字，下半段对比度不足） */
table.data thead th { background: linear-gradient(180deg, #eff8fe 0%, #ddeffa 100%); color: #1d5673; font-weight: 600; text-align: left; padding: 9px 12px; border-bottom: 1px solid #cde3f0; white-space: nowrap; letter-spacing: .3px; }
table.data thead th:first-child { border-top-left-radius: var(--radius); }
table.data thead th:last-child { border-top-right-radius: var(--radius); }
table.data tbody td { padding: 8px 12px; border-bottom: 1px solid #f0f4f7; white-space: nowrap; }
table.data tbody tr:nth-child(even) { background: #f5fafd; }
table.data tbody tr:hover { background: #ecf6fc; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tr.sum td { background: linear-gradient(180deg, #e8f5fc, #f2fafe); color: var(--primary-dark); font-weight: 700; }
.empty { padding: 30px; text-align: center; color: var(--text-light); }

/* ===== 状态标签（胶囊，功能色保留） ===== */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; border: 1px solid transparent; }
.tag-gray { background: #eef1f3; color: #5f6e76; border-color: #dde5e9; }
.tag-green { background: #e2f4ec; color: #12805a; border-color: #c3e9d9; }
.tag-orange { background: #fdf0dd; color: #b07a00; border-color: #f5dfb6; }
.tag-blue { background: #e2f0fb; color: #0b86c8; border-color: #c6e4f8; }
.tag-red { background: #fbe9e9; color: #c22f2f; border-color: #f5cdcd; }

/* ===== 弹窗（玻璃拟态） ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(8, 26, 40, .55); backdrop-filter: blur(3px); display: none; align-items: flex-start; justify-content: center; z-index: 1000; overflow: auto; padding: 40px 20px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 640px; max-width: 100%; box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.6); overflow: hidden; }
.modal-head { display: flex; align-items: center; padding: 14px 18px; background: linear-gradient(90deg, #eef8fd, #ffffff); border-bottom: 1px solid var(--border); }
.modal-head .m-title { font-size: 15px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.modal-head .close { margin-left: auto; cursor: pointer; font-size: 20px; color: var(--text-light); border: none; background: none; transition: color .15s; }
.modal-head .close:hover { color: var(--danger); }
.modal-body { padding: 16px 18px; max-height: 70vh; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); }
/* 单据弹层统一版式：垂直居中 + 上下留 20px 呼吸位，不再贴顶
   （普通提示框/表单框不带 doc-mask 类，仍按原来的贴顶紧凑弹窗走） */
.modal-mask.doc-mask { align-items: center; padding: 20px; }
.modal.doc-shell { display: flex; flex-direction: column; height: auto; max-height: calc(100vh - 40px); }
/* 宽度统一：各页内联写的 1060 只在宽屏有意义，塞进母版中列（约 823）时一律收成「容器宽 - 40 留白」，
   免得采购订单 766、退货 783、零售 800 三种宽度来回跳 */
.modal.doc-shell { max-width: calc(100vw - 40px) !important; }
.modal.doc-shell .modal-body { display: flex; flex-direction: column; min-height: 0; max-height: none; flex: 0 1 auto; overflow: hidden; }
.modal.doc-shell .pl-wrap { flex: 0 1 auto; min-height: 0; max-height: none; overflow: auto; }
.modal.doc-shell .pl-table tfoot { position: sticky; bottom: 0; z-index: 3; background: #fff; }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.form-item { display: flex; flex-direction: column; gap: 5px; }
.form-item label { font-size: 13px; color: var(--text-light); }
.form-item input, .form-item select, .form-item textarea { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11, 163, 224, .12); }
.form-item textarea { resize: vertical; min-height: 60px; }

/* ===== 提示 ===== */
#toast-box { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 18px; border-radius: 10px; color: #fff; font-size: 13px; box-shadow: var(--shadow-lg); animation: slideIn .25s; border: 1px solid rgba(255,255,255,.25); }
.toast.success { background: linear-gradient(135deg, #148f62, #1dab77); }
.toast.error { background: linear-gradient(135deg, #c23232, #e04b4b); }
.toast.info { background: linear-gradient(135deg, #0a6fb0, #1c94dd); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== 统计卡片（工作台） ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .18s, box-shadow .18s; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .num { font-size: 26px; font-weight: 800; margin: 6px 0 2px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-card .num.small { font-size: 20px; }
.stat-card .label { color: var(--text-light); font-size: 13px; }

/* ===== 标签页 ===== */
.tabs { display: flex; gap: 2px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 14px; box-shadow: var(--shadow); width: fit-content; }
.tabs .tab { padding: 7px 16px; cursor: pointer; color: var(--text-light); border-radius: 7px; font-size: 13px; border: none; background: transparent; transition: all .15s; }
.tabs .tab:hover { color: var(--primary); }
.tabs .tab.on, .tabs .tab.active { background: var(--grad); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(10, 134, 196, .28); }

/* ===== 页面标题 ===== */
.page-h { font-size: 18px; font-weight: 800; margin-bottom: 14px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; display: flex; align-items: center; gap: 8px; }
/* 单据号链接：报表/列表里的单号点得开原始单据 */
.doc-link { color: #0a86c4; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.doc-link:hover { color: #086a9c; }
