:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --line: #e5e5ea;
  --line-2: #d2d2d7;
  --accent: #1f7a52;
  --accent-soft: #e8f3ed;
  --danger: #c4161c;
  --danger-soft: #fdeeee;
  --warn: #a35200;
  --warn-soft: #fff4e5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 8px rgba(0, 0, 0, .04);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; overflow-x: hidden; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40vh 0; text-align: center; color: var(--text-2); }
[v-cloak] { display: none; }

/* —— 布局 —— */
.shell { display: flex; min-height: 100vh; }
.side { width: 208px; flex: none; background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 12px; }
.brand { font-weight: 600; font-size: 15px; padding: 0 10px 18px; letter-spacing: .3px; }
.brand small { display: block; color: var(--text-2); font-weight: 400; font-size: 12px; margin-top: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text-2); margin-bottom: 2px; }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.on { background: var(--bg); color: var(--text); font-weight: 600; }
.nav a.primary-link { color: var(--accent); }
.side .foot { margin-top: auto; padding: 10px; color: var(--text-2); font-size: 12px; }
.side .foot button { margin-top: 6px; }
.main { flex: 1; min-width: 0; padding: 28px 32px 120px; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 600; margin: 0; letter-spacing: .2px; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* —— 基础元素 —— */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; text-decoration: none; white-space: nowrap; font-size: 14px; }
.btn:hover { border-color: #b0b0b5; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 44px; padding: 0 22px; font-size: 15px; font-weight: 600; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.link.danger { color: var(--danger); }
.link.muted { color: var(--text-2); }
input.in, select.in, textarea.in { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.in { height: auto; padding: 8px 10px; resize: vertical; min-height: 68px; line-height: 1.5; }
.in:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
.in.err { border-color: var(--danger); background: var(--danger-soft); }
.in.changed { border-color: var(--warn); background: var(--warn-soft); }
.in.num { text-align: right; font-variant-numeric: tabular-nums; }
label.f { display: block; }
label.f > span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
label.f > span b { color: var(--danger); font-weight: 400; }
.grid { display: grid; gap: 12px 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--text); }
.hint { color: var(--text-2); font-size: 12px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.section > h2 { font-size: 15px; font-weight: 600; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section > h2 .hint { font-weight: 400; }

.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px; font-size: 12px; background: var(--bg); color: var(--text-2); white-space: nowrap; }
.tag.ok { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: var(--danger-soft); color: var(--danger); }
.tag.dark { background: var(--text); color: #fff; }

.notice { border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.notice.err { background: var(--danger-soft); color: var(--danger); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.info { background: var(--bg); color: var(--text-2); }
.notice ul { margin: 4px 0 0; padding-left: 18px; }

/* —— 表格 —— */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #fafafa; }
table.t .r { text-align: right; }
table.t .c { text-align: center; }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: contain; background: var(--bg); display: block; }
.thumb.sm { width: 36px; height: 36px; }
.thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 11px; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--text-2); }
.empty-state .btn { margin-top: 12px; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; color: var(--text-2); font-size: 13px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .in { width: auto; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 360px; }

/* —— 首页 —— */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .k { color: var(--text-2); font-size: 12px; }
.stat .v { font-size: 24px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--text-3); font-size: 12px; }

/* —— 报价工作台 —— */
.workbench { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.picker { position: sticky; top: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; }
.picker h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.picker .results { overflow-y: auto; margin: 8px -6px 0; flex: 1; }
.pick { display: flex; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 8px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.pick:hover { background: var(--bg); }
.pick .meta { min-width: 0; flex: 1; }
.pick .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .sub { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .add { color: var(--accent); font-size: 20px; line-height: 1; padding: 0 4px; }
.items-table td { vertical-align: top; }
.items-table .in { height: 30px; padding: 0 8px; }
.items-table .w-qty { width: 72px; }
.items-table .w-price { width: 110px; }
.items-table .w-vol { width: 84px; }
.items-table .w-pack { width: 92px; }
.item-name { font-weight: 500; }
.item-sub { color: var(--text-2); font-size: 12px; }
.item-extra td { background: #fbfbfc; padding-top: 0; }
.item-extra .grid { padding: 8px 0 4px; }
.line-err { color: var(--danger); font-size: 12px; margin-top: 4px; }
.line-warn { color: var(--warn); font-size: 12px; margin-top: 4px; }
.calc-sub { font-size: 12px; color: var(--text-2); margin-top: 3px; white-space: nowrap; }
.fee-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.fee { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.fee .k { font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fee .v { font-size: 20px; font-weight: 600; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.fee .sys { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.fee .adj { display: flex; gap: 6px; align-items: center; }
.fee .adj .in { height: 30px; }
.fee .adj .link, .fee .adj span { white-space: nowrap; }
.fee.adjusted { border-color: var(--warn); }
.totalbar { position: fixed; left: 208px; right: 0; bottom: 0; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-top: 1px solid var(--line); padding: 12px 32px calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 20px; z-index: 20; }
.totalbar .parts { display: flex; gap: 18px; color: var(--text-2); font-size: 13px; flex-wrap: wrap; }
.totalbar .parts b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.totalbar .grand { margin-left: auto; text-align: right; }
.totalbar .grand .k { font-size: 12px; color: var(--text-2); }
.totalbar .grand .v { font-size: 26px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.2; }
.totalbar .grand .u { font-size: 12px; color: var(--text-2); }
.totalbar .errs { color: var(--danger); font-size: 13px; cursor: pointer; }

/* —— 预览 —— */
.preview-frame { width: 100%; border: 0; background: var(--bg); border-radius: var(--radius); min-height: 600px; display: block; }
.kv-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv-list dt { color: var(--text-2); }
.kv-list dd { margin: 0; }

/* —— 设备编辑 —— */
.gallery { display: flex; gap: 10px; flex-wrap: wrap; }
.gallery .gi { width: 120px; }
.gallery .gi img { width: 120px; height: 120px; object-fit: contain; background: var(--bg); border-radius: 8px; cursor: zoom-in; display: block; border: 2px solid transparent; }
.gallery .gi.main img { border-color: var(--text); }
.gallery .gi .ops { display: flex; justify-content: space-between; font-size: 12px; margin-top: 4px; }
.dropzone { width: 120px; height: 120px; border: 1.5px dashed var(--line-2); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-direction: column; color: var(--text-2); cursor: pointer; font-size: 12px; text-align: center; padding: 6px; }
.dropzone:hover { border-color: var(--text); color: var(--text); }
.kv-editor .row { display: grid; grid-template-columns: 160px 1fr 28px; gap: 8px; margin-bottom: 6px; }
.seg { display: inline-flex; background: var(--bg); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 6px; cursor: pointer; color: var(--text-2); font-size: 13px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); font-weight: 500; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .8); display: flex; align-items: center; justify-content: center; z-index: 100; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; border-radius: 6px; }

/* —— 导入 —— */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.steps { color: var(--text-2); font-size: 13px; margin: 0 0 14px; padding-left: 18px; }
.steps li { margin-bottom: 4px; }
.filepick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px; border: 1.5px dashed var(--line-2); border-radius: 10px; margin-bottom: 10px; }
.filepick .name { color: var(--text-2); font-size: 13px; }
.summary-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin: 8px 0 14px; }

/* —— 登录 —— */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 360px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 32px 28px; }
.login h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
.login .sub { color: var(--text-2); margin-bottom: 24px; }
.login .f { margin-bottom: 14px; }
.login .btn { width: 100%; height: 40px; margin-top: 6px; }

/* —— 提示 —— */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); }
.toast.err { background: var(--danger); }
.toast.warn { background: var(--warn); }
.busy { position: fixed; inset: 0; background: rgba(255, 255, 255, .6); z-index: 150; display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--text); }
.busy span { background: var(--surface); padding: 14px 22px; border-radius: 12px; box-shadow: var(--shadow); }

/* —— 窄屏 / 手机 —— */
@media (max-width: 1180px) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .picker { position: static; max-height: 380px; }
  .fee-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 24px rgba(0, 0, 0, .15); }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .25); z-index: 50; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40; background: rgba(245, 245, 247, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .topbar .title { font-weight: 600; flex: 1; }
  .main { padding: 16px 16px 160px; }
  .totalbar { left: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); gap: 10px; flex-wrap: wrap; }
  .totalbar .parts { display: none; }
  .totalbar .grand { margin-left: 0; text-align: left; flex: 1; }
  .totalbar .grand .v { font-size: 20px; }
  .totalbar .grand .u { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { padding: 16px; }
  .page-head h1 { font-size: 20px; }
}
@media (max-width: 560px) {
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .kv-editor .row { grid-template-columns: 1fr 1fr 28px; }
  .toolbar .search { max-width: none; }
}
@media print {
  .side, .topbar, .totalbar, .toasts, .no-print { display: none !important; }
}
.toolbar .seg { flex-wrap: wrap; }
.items-table .item-name-in { font-weight: 500; margin-bottom: 4px; min-width: 200px; }
.items-table .item-model-in { height: 26px; font-size: 12px; margin-bottom: 2px; }

/* ===== 界面主题：深色侧栏 + 蓝色主色 ===== */
:root {
  --bg: #f0f2f5;
  --accent: #1677ff;
  --accent-soft: #e6f0ff;
  --side: #1f2a3c;
  --side-2: #18212f;
}
.btn.primary, .btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, .btn.accent:hover { background: #0e62d9; border-color: #0e62d9; }
.link { color: var(--accent); }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22, 119, 255, .12); }
.check input { accent-color: var(--accent); }
.tag.ok { background: #e8f7ee; color: #18a058; }
.tag.dark { background: var(--accent-soft); color: var(--accent); }
.seg button.on { color: var(--accent); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

.side { background: var(--side); border-right: 0; padding: 0 0 16px; color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 20px; margin-bottom: 6px; color: #fff; background: var(--side-2); }
.brand small { color: rgba(255, 255, 255, .55); }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; flex: none; }
.nav { padding: 0 10px; }
.nav a { color: rgba(255, 255, 255, .72); border-radius: 6px; padding: 10px 14px; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.on { background: var(--accent); color: #fff; font-weight: 500; }
.nav a.primary-link { color: #fff; }
.nav a.primary-link:not(.on) { background: rgba(22, 119, 255, .18); }
.side .foot { color: rgba(255, 255, 255, .55); }
.side .foot .link { color: rgba(255, 255, 255, .75); }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.headbar { height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; position: sticky; top: 0; z-index: 30; }
.headbar .crumb { font-weight: 600; }
.headbar .user { color: var(--text-2); display: flex; gap: 12px; align-items: center; font-size: 13px; }
.main { padding-top: 24px; }
.section, .stat, .picker { border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, .03); border: 1px solid #e8eaee; }
table.t th { background: #fafbfc; color: #5b6475; }
.totalbar .grand .v { color: var(--accent); }

.stat.c-blue, .stat.c-red, .stat.c-green { color: #fff; border: 0; }
.stat.c-blue { background: #1677ff; }
.stat.c-red { background: #f5484a; }
.stat.c-green { background: #19be6b; }
.stat.c-blue .k, .stat.c-red .k, .stat.c-green .k, .stat.c-blue .s, .stat.c-red .s, .stat.c-green .s { color: rgba(255, 255, 255, .85); }

.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 240px; padding: 8px 4px 0; }
.bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; }
.bar-val { font-size: 11px; color: var(--text-2); height: 16px; white-space: nowrap; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); }
.bar { width: 60%; max-width: 34px; background: var(--accent); border-radius: 3px 3px 0 0; transition: height .3s; }
.bar-x { font-size: 11px; color: var(--text-3); margin-top: 6px; white-space: nowrap; }

@media (max-width: 900px) {
  .headbar { display: none; }
  .main { padding-top: 16px; }
  .topbar { background: var(--side); color: #fff; border-bottom: 0; }
  .topbar .btn.ghost { color: #fff; }
  .bar-chart { gap: 3px; height: 180px; }
  .bar-val { font-size: 9px; }
  .bar-x { font-size: 9px; }
}
@media (min-width: 901px) { .side .foot { display: none; } }
.bx-short { display: none; }
@media (max-width: 900px) { .bx-long { display: none; } .bx-short { display: inline; } }
