:root {
  --bg: #f4f5f2; --panel: #ffffff; --ink: #1d2320; --ink-2: #4b5550; --ink-3: #87908b; --line: #e3e6e1; --line-2: #eef0ec;
  --brand: #0f5c4c; --brand-2: #0b4539; --brand-soft: #e3f0ec; --accent: #c8792b;
  --green: #1f7a4d; --green-soft: #e3f3ea; --amber: #9a5b0f; --amber-soft: #fbf0dd; --red: #b42318; --red-soft: #fde8e6; --blue: #1d5fa8; --blue-soft: #e5eef9;
  --radius: 8px; --sidebar: 216px;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  font-size: 14px; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; letter-spacing: .2px; } h2 { font-size: 15px; margin: 0; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-3); } .small { font-size: 12px; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---------- 布局 ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: #13231e; color: #c9d4cf; display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 18px 18px 14px; color: #fff; text-decoration: none !important; }
.logo { font-size: 20px; font-weight: 700; letter-spacing: 3px; } .brand-sub { font-size: 12px; color: #8fa59c; }
.nav-group { font-size: 11px; color: #6f857c; padding: 14px 18px 4px; letter-spacing: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 18px; color: #c9d4cf; text-decoration: none !important; border-left: 3px solid transparent; }
.nav-item:hover { background: #1b3029; color: #fff; }
.nav-item.active { background: #1f3a31; color: #fff; border-left-color: var(--accent); }
.nav-item .ico { width: 16px; text-align: center; opacity: .8; }
.nav-item .phase { margin-left: auto; font-size: 10px; color: #6f857c; border: 1px solid #34493f; border-radius: 4px; padding: 0 4px; }
.sidebar .env { margin-top: auto; padding: 14px 18px; }
.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: rgba(244,245,242,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.gsearch { flex: 1; max-width: 560px; }
.gsearch input { width: 100%; padding: 8px 12px 8px 32px; border: 1px solid var(--line); border-radius: 999px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2387908b' stroke-width='2'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath d='M9.5 9.5 13 13'/%3E%3C/svg%3E") no-repeat 12px center; font-size: 14px; }
.gsearch input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me .who { display: flex; flex-direction: column; text-align: right; line-height: 1.2; } .me small { color: var(--ink-3); font-size: 11px; }
.hamburger { display: none; font-size: 20px; cursor: pointer; padding: 0 4px; }
.scrim { display: none; }
.content { padding: 20px 24px 60px; max-width: 1400px; width: 100%; }
.crumbs { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; } .crumbs span { margin: 0 6px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 组件 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.card > .pad, .card .pad { padding: 14px 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.grid2 > *, .grid3 > *, .card, .main, .content { min-width: 0; }
.stack > * + * { margin-top: 16px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font-size: 13.5px; cursor: pointer; text-decoration: none !important; white-space: nowrap; font-family: inherit; }
.btn:hover { background: var(--brand-2); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); } .btn.ghost:hover { border-color: var(--ink-3); }
.btn.warn { background: var(--accent); border-color: var(--accent); } .btn.danger { background: #fff; color: var(--red); border-color: #f1b8b2; } .btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 18px; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.badge.blue { background: var(--blue-soft); color: var(--blue); } .badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); } .badge.red { background: var(--red-soft); color: var(--red); }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: var(--green-soft); border-color: #b9dfc9; color: var(--green); }
.flash.err { background: var(--red-soft); border-color: #f1b8b2; color: var(--red); }
.notice { padding: 10px 14px; border-radius: 6px; background: var(--amber-soft); color: var(--amber); border: 1px solid #f0d9b0; margin: 0 0 12px; }
.notice.info { background: var(--blue-soft); color: var(--blue); border-color: #c7d9f0; }
.notice.good { background: var(--green-soft); color: var(--green); border-color: #b9dfc9; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--ink-3); background: #fafbf9; white-space: nowrap; position: sticky; top: 0; }
tbody tr:hover td { background: #fafcfb; }
td.empty { text-align: center; color: var(--ink-3); padding: 28px; }
tfoot td { font-weight: 600; background: #fafbf9; }

.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 16px; color: var(--ink-3); font-size: 12.5px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.filters input, .filters select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff; min-width: 120px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; padding: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.field.wide { grid-column: 1 / -1; }
.field small { color: var(--ink-3); }
.field input, .field select, .field textarea, .lines input, .lines select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink); width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink); line-height: 1.35; margin: 2px 14px 2px 0; cursor: pointer; }
/* 勾选框：不要被表单输入框的 100% 宽度和内边距撑开 */
.check input[type=checkbox], .field input[type=checkbox], .field input[type=radio], .lines input[type=checkbox], td input[type=checkbox] { width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 0; flex: none; accent-color: var(--brand); }
.field:has(> .check) { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 0; }
.form-actions .check { white-space: normal; }
.form-actions { display: flex; gap: 8px; padding: 0 16px 16px; flex-wrap: wrap; align-items: center; }
.lines td { padding: 4px 6px; } .lines th { padding: 6px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; padding: 14px 16px; }
.kv dt { color: var(--ink-3); font-size: 12.5px; } .kv dd { margin: 0; word-break: break-word; }

details.panel { border-top: 1px solid var(--line-2); }
details.panel summary { cursor: pointer; padding: 10px 16px; color: var(--brand); font-weight: 500; list-style: none; }
details.panel summary::before { content: '＋ '; } details.panel[open] summary::before { content: '－ '; }
details.panel .panel-body { padding: 0 0 4px; }

/* 首页待办 */
ul.todo { list-style: none; margin: 0; padding: 6px 16px 10px; } ul.todo li { padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; } ul.todo li:last-child { border-bottom: 0; }
ul.todo .badge { margin-right: 4px; }
/* 订单进度条 */
.steps { display: flex; gap: 0; margin: 0 0 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; }
.steps .step { flex: 1; display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; white-space: nowrap; position: relative; padding-right: 10px; min-width: 96px; }
.steps .step:not(:last-child)::after { content: ''; flex: 1; height: 2px; background: var(--line); margin-left: 6px; min-width: 12px; }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; background: var(--line-2); color: var(--ink-3); flex: none; }
.steps .done { color: var(--green); } .steps .done .dot { background: var(--green); color: #fff; } .steps .done::after { background: var(--green) !important; }
.steps .now { color: var(--ink); font-weight: 600; } .steps .now .dot { background: var(--brand); color: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.steps.off { opacity: .45; }
/* 表格内可编辑小输入框 */
input.tin { padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; font-family: inherit; background: #fff; max-width: 100%; }
input.tin:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
td.num input.tin { text-align: right; }
table.track td, table.track th { vertical-align: middle; padding: 6px 6px; } table.track { font-size: 13px; }
tr.sub td { padding: 0 12px; border-bottom: 1px solid var(--line); background: #fcfcfb; }
tr.sub details.panel { border-top: 0; } tr.sub details.panel summary { padding: 4px 0; font-size: 12.5px; }

/* 看板卡片 */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); text-decoration: none !important; transition: border-color .15s, transform .15s; }
a.kpi:hover { border-color: var(--brand); transform: translateY(-1px); }
.kpi .k { font-size: 12.5px; color: var(--ink-3); } .kpi .v { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.kpi.alert .v { color: var(--red); } .kpi.later { background: transparent; border-style: dashed; } .kpi.later .v { font-size: 14px; color: var(--ink-3); font-weight: 400; margin-top: 8px; }

/* 库存数量块 */
.qtys { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1px; background: var(--line-2); }
.qtys > div { background: #fff; padding: 12px 16px; } .qtys .k { font-size: 12px; color: var(--ink-3); } .qtys .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.qtys .v.good { color: var(--green); } .qtys .v.warn { color: var(--amber); }

/* 时间线 */
.timeline { list-style: none; margin: 0; padding: 12px 16px 12px 28px; }
.timeline li { position: relative; padding: 0 0 12px 8px; border-left: 2px solid var(--line); }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline .t { font-size: 12px; color: var(--ink-3); }

/* 搜索结果 */
.result-group h2 .count { color: var(--ink-3); font-weight: 400; margin-left: 6px; }
mark { background: #fff1bf; padding: 0 1px; }

/* 建议框 */
.suggest { border: 1px solid #c7d9f0; background: #f6f9fd; border-radius: 6px; padding: 10px 12px; margin: 6px 0; font-size: 13px; }
.suggest b { color: var(--ink); } .suggest .row { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; color: var(--ink-2); }

/* 登录页 / 门户 */
body.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #13231e; }
.login { width: 360px; max-width: calc(100vw - 32px); background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login .logo { color: var(--brand); font-size: 26px; } .login p { color: var(--ink-3); margin: 4px 0 18px; }
.login .field { margin-bottom: 12px; } .login .btn { width: 100%; justify-content: center; padding: 10px; }
.demo-accounts { margin-top: 16px; font-size: 12px; color: var(--ink-3); border-top: 1px dashed var(--line); padding-top: 10px; }

/* ---------- 手机 ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  #navtoggle:checked ~ .sidebar { transform: none; }
  #navtoggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .topbar { padding: 8px 12px; } .me .who { display: none; }
  .content { padding: 14px 12px 60px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .steps .step { min-width: 0; font-size: 12px; } .steps .step span:last-child { display: none; } .steps .step.now span:last-child { display: inline; }
  .form-grid { grid-template-columns: 1fr; padding: 12px; }
  .filters input, .filters select { min-width: 0; flex: 1 1 140px; }
  th, td { padding: 7px 8px; }
  .table-wrap > table:not(.responsive) { min-width: 680px; }
  .table-wrap td, .table-wrap th { white-space: nowrap; }
  .table-wrap td.small, .table-wrap td .small { white-space: normal; }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 10px; text-align: right; }
  table.responsive td::before { content: attr(data-l); color: var(--ink-3); text-align: left; font-size: 12px; }
  table.responsive td.empty { display: block; text-align: center; } table.responsive td.empty::before { content: none; }
}
@media print { .sidebar, .topbar, .actions, form, details { display: none !important; } .main { margin: 0; } }

/* 首页本月收入卡片（银行卡样式，默认隐藏金额） */
.moneycard { position: relative; overflow: hidden; color: #fff; border-radius: 14px; padding: 12px 16px 10px; margin-bottom: 16px; max-width: 400px;
  background: linear-gradient(135deg, #0f5c4c 0%, #0b4539 60%, #c8792b 150%); box-shadow: 0 6px 16px rgba(11, 69, 57, .2); }
.moneycard::after { content: ""; position: absolute; right: -50px; top: -50px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.07); }
.moneycard a { color: #fff; }
.mc-top { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; opacity: .9; position: relative; z-index: 1; }
.mc-eye { background: rgba(255,255,255,.15); border: 0; color: #fff; border-radius: 999px; width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer; }
.mc-eye:hover { background: rgba(255,255,255,.25); }
.mc-eye .eye-on { display: none; } .moneycard.show .mc-eye .eye-on { display: block; } .moneycard.show .mc-eye .eye-off { display: none; }
.mc-main { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 6px; text-decoration: none !important; position: relative; z-index: 1; }
.mc-main div { display: flex; flex-direction: column; } .mc-main span:first-child { font-size: 12px; opacity: .75; }
.moneycard .secret.big { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mc-foot { font-size: 12px; opacity: .85; position: relative; z-index: 1; }
.mc-foot .secret { font-weight: 600; font-variant-numeric: tabular-nums; }
