/* 如松 ERP 原型 v2 · 方向 C（深色侧栏）。只换视觉，功能/文字/位置与本机源码一致。 */
:root {
    --bg: #eef1f6;
    --surface: #fff;
    --surface-2: #f5f7fa;
    --border: #e1e6ee;
    --border-faint: #edf0f5;
    --border-strong: #cfd7e3;
    --text: #111a2b;
    --text-2: #475467;
    --text-3: #7d8aa0;
    --accent: #1f6feb;
    --accent-hover: #1858c4;
    --accent-soft: #e8f0fe;
    --ok: #0e9f6e; --ok-soft: #e3f6ee;
    --warn: #c96a04; --warn-soft: #fef3e2; --warn-btn: #e8830c;
    --bad: #dc2626; --bad-soft: #fde8e8;
    --purple: #7c3aed; --purple-soft: #f1eafe;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-xs: 4px;
    --fs: 13px;
    --fs-sm: 12px;
    --ctl-h: 32px;
    --side-w: 208px;
    --side-bg: #0f1b2d;
    --side-text: #b4c0d3;
    --side-text-2: #6f7f98;
    --side-hover: rgba(255, 255, 255, .06);
    --side-border: rgba(255, 255, 255, .08);
    --top-h: 48px;
    --shadow-pop: 0 8px 28px rgba(17, 26, 43, .16), 0 1px 3px rgba(17, 26, 43, .08);
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: var(--fs)/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12px; }

/* ---------- 框架 ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--side-bg); color: var(--side-text);
    display: flex; flex-direction: column; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 18px; border-bottom: 1px solid var(--side-border); }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: linear-gradient(135deg, #1f6feb, #38bdf8); flex: none; }
.brand strong { display: block; color: #fff; font-size: 15px; line-height: 1.2; }
.brand span { display: block; color: var(--side-text-2); font-size: 12px; }
.side-nav { padding: 10px 10px 16px; flex: 1; }
.side-group { margin-top: 10px; }
.side-group-title { padding: 6px 10px; font-size: 12px; color: var(--side-text-2); letter-spacing: .04em; }
.side-link {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px;
    border: 0; border-radius: var(--radius-sm); background: none; color: var(--side-text);
    cursor: pointer; text-align: left; font-size: 13px;
}
.side-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-link:hover { background: var(--side-hover); color: #fff; }
.side-link.is-active { background: var(--accent); color: #fff; }
.side-sub { margin: 2px 0 4px 28px; border-left: 1px solid var(--side-border); padding-left: 8px; }
.side-sub a { display: block; height: 30px; line-height: 30px; padding: 0 10px; border-radius: var(--radius-xs); color: var(--side-text); font-size: 12.5px; }
.side-sub a:hover { color: #fff; background: var(--side-hover); }
.side-sub a.is-active { color: #fff; background: rgba(31, 111, 235, .35); }
.side-foot { padding: 12px; border-top: 1px solid var(--side-border); display: grid; gap: 8px; }
.demo-box { background: rgba(255, 255, 255, .04); border: 1px dashed rgba(255, 255, 255, .16); border-radius: var(--radius-sm); padding: 8px; }
.demo-box label { display: block; font-size: 12px; color: var(--side-text-2); margin-bottom: 4px; }
.demo-box select { width: 100%; height: 28px; border-radius: var(--radius-xs); border: 1px solid rgba(255, 255, 255, .14); background: #16253c; color: #dbe3ef; padding: 0 6px; font-size: 12px; }
.side-user { display: flex; align-items: center; gap: 8px; color: #dbe3ef; font-size: 12.5px; }
.side-user .avatar { width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .1); display: grid; place-items: center; color: #fff; font-weight: 600; }
.side-user button { margin-left: auto; border: 0; background: none; color: var(--side-text-2); cursor: pointer; font-size: 12px; }
.side-user button:hover { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; height: var(--top-h);
    display: flex; align-items: center; gap: 12px; padding: 0 20px;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); min-width: 0; }
.crumb b { color: var(--text); font-weight: 600; }
.crumb i { font-style: normal; color: var(--border-strong); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.baseline-tag { font-size: 12px; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.content { padding: 16px 20px 40px; min-width: 0; }

/* ---------- 基础组件 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 0; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-head p { margin: 0; color: var(--text-3); font-size: 12px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    height: var(--ctl-h); padding: 0 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    cursor: pointer; white-space: nowrap; font-size: 13px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; color: var(--text-3); border-color: var(--border); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-warning { background: var(--warn-btn); border-color: var(--warn-btn); color: #fff; }
.btn-warning:hover { background: #c96a04; border-color: #c96a04; color: #fff; }
.btn-danger { color: var(--bad); border-color: #f3c0c0; }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-text { border-color: transparent; background: none; color: var(--accent); padding: 0 6px; }
.btn-text:hover { background: var(--accent-soft); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn .caret { font-size: 10px; opacity: .7; }
.link { color: var(--accent); cursor: pointer; background: none; border: 0; padding: 0; font-size: inherit; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--bad); }

.input, .select {
    height: var(--ctl-h); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); padding: 0 10px; min-width: 0; font-size: 13px;
}
.input:focus, .select:focus, textarea:focus { outline: 2px solid rgba(31, 111, 235, .25); border-color: var(--accent); }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; color: var(--text-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.info { color: var(--accent); } .pill.mute { color: var(--text-3); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--radius-xs); font-size: 12px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.tag.info { background: var(--accent-soft); color: var(--accent); } .tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.purple { background: var(--purple-soft); color: var(--purple); }
.tag.dashed { background: none; border: 1px dashed var(--border-strong); color: var(--text-3); }

/* chip 行（筛选项）*/
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { height: 26px; padding: 0 10px; border-radius: var(--radius-xs); border: 1px solid transparent; background: none; cursor: pointer; color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.chip:hover { color: var(--accent); }
.chip.is-active { background: var(--accent-soft); color: var(--accent); border-color: rgba(31, 111, 235, .3); font-weight: 500; }
.chip em { font-style: normal; color: var(--text-3); margin-left: 3px; }

/* 标签页 */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; height: 38px; padding: 0 12px; border: 0; background: none; cursor: pointer; color: var(--text-2); white-space: nowrap; font-size: 13px; }
.tab:hover { color: var(--accent); }
.tab.is-active { color: var(--accent); font-weight: 600; }
.tab.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.tab em { font-style: normal; color: var(--text-3); margin-left: 4px; font-weight: 400; }
.tab em.alert { color: var(--bad); }

/* 下拉菜单 */
.dd { position: relative; display: inline-flex; }
.menu {
    position: absolute; top: calc(100% + 4px); left: 0; min-width: 180px; z-index: 60;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop);
    padding: 6px; display: none; max-height: 70vh; overflow-y: auto;
}
.dd.right .menu { left: auto; right: 0; }
.dd.is-open .menu { display: block; }
.menu-title { padding: 6px 10px 4px; font-size: 12px; color: var(--text-3); }
.menu-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: var(--radius-xs); cursor: pointer; text-align: left; font-size: 13px; color: var(--text); white-space: nowrap; }
.menu-item:hover { background: var(--accent-soft); color: var(--accent); }
.menu-item.placeholder { color: var(--text-3); }
.menu-item .tag { margin-left: 8px; }
.menu-sep { height: 1px; background: var(--border-faint); margin: 4px 0; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 27, 45, .45); z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-pop); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { width: min(980px, 100%); }
.modal.mid { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-faint); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .x { margin-left: auto; border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text-3); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border-faint); }
.form-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 12px; }
.form-row > label { color: var(--text-2); text-align: right; font-size: 13px; }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* 提示 */
.toast-wrap { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast { background: #111a2b; color: #fff; padding: 9px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); font-size: 13px; display: flex; gap: 8px; align-items: center; animation: toastIn .18s ease-out; }
.toast.ok::before { content: "✓"; color: #34d399; }
.toast.warn::before { content: "!"; color: #fbbf24; font-weight: 700; }
.toast.bad::before { content: "✕"; color: #f87171; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } }
.banner { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.banner.bad { background: var(--bad-soft); color: #9b1c1c; }
.banner.warn { background: var(--warn-soft); color: #8a4b05; }
.banner.info { background: var(--accent-soft); color: #1e4fa8; }
.banner .btn { margin-left: auto; }
.suggest { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; line-height: 1.5; color: var(--purple); background: var(--purple-soft); border-radius: 10px; padding: 1px 8px; min-height: 20px; max-width: 100%; }
.suggest::before { flex: none; }
.suggest::before { content: "建议"; font-weight: 600; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.grid th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-3); font-weight: 500; font-size: 12px; text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.grid td { padding: 10px; border-bottom: 1px solid var(--border-faint); vertical-align: top; }
table.grid tbody tr:hover td { background: #f8faff; }
table.grid tr.is-selected td { background: #f1f6fe; }
table.grid .ck { width: 36px; text-align: center; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; margin: 0; vertical-align: middle; }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .ill { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; font-size: 28px; }
.empty b { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 4px; }
.skel { height: 12px; border-radius: 4px; background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 50%, #eef1f6 75%); background-size: 200% 100%; animation: skel 1.2s infinite; }

.progress { height: 6px; border-radius: 3px; background: var(--border-faint); overflow: hidden; min-width: 120px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }

/* 二级侧导航（产品 / 订单状态队列 共用外观） */
.with-subnav { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 16px; align-items: start; }
.subnav { position: sticky; top: calc(var(--top-h) + 16px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.subnav h2 { margin: 4px 8px 8px; font-size: 13px; color: var(--text-3); font-weight: 500; }
.subnav a { display: block; height: 34px; line-height: 34px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text-2); }
.subnav a:hover { background: var(--surface-2); color: var(--text); }
.subnav a.is-active { background: var(--accent); color: #fff; font-weight: 500; }

/* 页头 */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; font-size: 18px; }
.page-head .tip { color: var(--text-3); font-size: 12.5px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* 窄屏 */
@media (max-width: 960px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .side { position: fixed; left: 0; top: 0; width: var(--side-w); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-pop); }
    body.side-open .side { transform: none; }
    body.side-open::after { content: ""; position: fixed; inset: 0; background: rgba(15, 27, 45, .4); z-index: 35; }
    .menu-btn { display: inline-flex; }
    .baseline-tag { display: none; }
    .with-subnav { grid-template-columns: minmax(0, 1fr); }
    .subnav { position: static; display: flex; gap: 4px; overflow-x: auto; padding: 6px; }
    .subnav h2 { display: none; }
    .subnav a { white-space: nowrap; flex: none; }
}
@media (max-width: 600px) {
    .content { padding: 12px 12px 32px; }
    .topbar { padding: 0 12px; }
    .form-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .form-row > label { text-align: left; }
}

/* 顶栏用户区（复用 .side-user 结构，换浅色） */
.topbar .side-user { color: var(--text); }
.topbar .side-user .avatar { background: var(--accent-soft); color: var(--accent); }
.thumb { border-radius: 6px; flex: none; display: block; }

/* ---------- 加载骨架 / 空状态（只改外观，文案不变） ---------- */
:root { --sk-base: #e7ecf4; --sk-hi: #f7f9fc; }
.skel, .sk { background: linear-gradient(100deg, var(--sk-base) 30%, var(--sk-hi) 50%, var(--sk-base) 70%); background-size: 300% 100%; animation: skel 1.4s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes skel { from { background-position: 100% 0; } to { background-position: 0 0; } }
.sk { display: block; height: 10px; border-radius: 999px; }
.sk.box { border-radius: 6px; }
.sk-row > td { padding: 12px 10px !important; border-bottom: 1px solid var(--border-faint); }
.sk-line { display: flex; align-items: center; gap: 18px; min-width: 640px; }
.sk-line .sk-cell { flex: 1; display: grid; gap: 7px; min-width: 0; }
.sk-line .sk-cell.w2 { flex: 2.4; }
.sk-line .sk-tick { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.sk-line .sk-img { width: 40px; height: 40px; border-radius: 8px; flex: none; }
.sk-head > td { background: var(--surface-2); padding: 8px 10px !important; }
.sk-head .sk-line .sk-cell { flex: none; }
.sk-status { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 0 10px; color: var(--text-3); font-size: 12px; }
.sk-status::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: skSpin .8s linear infinite; }
@keyframes skSpin { to { transform: rotate(360deg); } }
td.sk-status { display: table-cell; }
td.sk-status::before { display: inline-block; vertical-align: -2px; margin-right: 8px; }

.empty { --ill: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='132' height='92' viewBox='0 0 132 92'%3E%3Cellipse cx='66' cy='84' rx='44' ry='5' fill='%23e8edf5'/%3E%3Cpath d='M34 38 66 27l32 11-32 11z' fill='%23d5deec'/%3E%3Cpath d='M34 38v29l32 11V49z' fill='%23eef3fa' stroke='%23c3cfe0' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M98 38v29L66 78V49z' fill='%23e2e9f4' stroke='%23c3cfe0' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M34 38 21 49l32 11 13-11z' fill='%23f7f9fd' stroke='%23c3cfe0' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='m98 38 13 11-32 11-13-11z' fill='%23f7f9fd' stroke='%23c3cfe0' stroke-width='1.5' stroke-linejoin='round'/%3E%3Ccircle cx='66' cy='15' r='9' fill='none' stroke='%231f6feb' stroke-opacity='.55' stroke-width='2.5'/%3E%3Cpath d='m72.5 21.5 6 6' stroke='%231f6feb' stroke-opacity='.55' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M24 18v8M20 22h8M108 12v6M105 15h6' stroke='%23b9c9e3' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='112' cy='34' r='2.5' fill='%23cfdcf0'/%3E%3Ccircle cx='17' cy='40' r='2' fill='%23cfdcf0'/%3E%3C/svg%3E");
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 36px 20px 40px; }
.empty:not(:has(.ill)):not(.rp-loading)::before { content: ""; width: 132px; height: 92px; margin-bottom: 10px; background: var(--ill) center/contain no-repeat; }
.empty.is-bad { --ill: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='132' height='92' viewBox='0 0 132 92'%3E%3Cellipse cx='66' cy='84' rx='40' ry='5' fill='%23f6e7e7'/%3E%3Cpath d='M42 66a16 16 0 0 1-1-32 22 22 0 0 1 42-6 16 16 0 0 1 9 38z' fill='%23fdf1f1' stroke='%23f0c4c2' stroke-width='1.8' stroke-linejoin='round'/%3E%3Ccircle cx='66' cy='50' r='13' fill='%23d64545'/%3E%3Cpath d='M66 43v8' stroke='%23fff' stroke-width='3' stroke-linecap='round'/%3E%3Ccircle cx='66' cy='56.5' r='1.8' fill='%23fff'/%3E%3Cpath d='M22 24v7M18.5 27.5h7M110 18v6M107 21h6' stroke='%23f0c4c2' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.empty b { font-size: 14px; margin-bottom: 2px; }
.empty .muted { max-width: 420px; line-height: 1.6; }
td > .empty { background: radial-gradient(ellipse at 50% 38%, #f7f9fd 0, transparent 62%); }
