* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.6 "Microsoft YaHei", system-ui, sans-serif; background: #f4f6f9; color: #1c2733; }
header { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; background: #0f2b4c; color: #fff; }
header h1 { font-size: 17px; margin: 0; font-weight: 600; }
.header-actions { display: flex; gap: 10px; align-items: center; }
#saveStatus { font-size: 12px; color: #9fd3ff; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#saveStatus a { color: #fff; text-decoration: underline; }
.login-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(15, 43, 76, .74); backdrop-filter: blur(4px); }
.login-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 26px; border-radius: 10px; background: #fff; box-shadow: 0 24px 70px rgba(15, 43, 76, .28); }
.login-card h2 { margin: 0; color: #0f2b4c; font-size: 24px; }
.login-card p { margin: 0; }
.user-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 10px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; color: #dbeafe; font-size: 12px; }
.role-hidden { display: none !important; }

nav#tabs { display: flex; gap: 2px; background: #16385f; padding: 0 14px; flex-wrap: wrap; }
nav#tabs button { border: 0; background: transparent; color: #b9c9dc; padding: 10px 16px; cursor: pointer; font-size: 14px; }
nav#tabs button.active { background: #f4f6f9; color: #0f2b4c; border-radius: 6px 6px 0 0; font-weight: 600; }

main { padding: 18px 24px 60px; max-width: 1400px; margin: 0 auto; }
#tab-preview.active { display: block; }
#tab-preview { max-width: none; }
#previewPane { position: relative; height: calc(100vh - 170px); min-height: 620px; background: #fff; border: 1px solid #cfd9e5; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.preview-head { height: 42px; flex: 0 0 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; background: #0f2b4c; color: #fff; }
.preview-head a { color: #fff; font-size: 12px; }
#pptPreview { flex: 1; width: 100%; border: 0; background: #f8fafc; }
#previewEmpty { position: absolute; inset: 42px 0 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; background: #f8fafc; }
.tab { display: none; }
.tab.active { display: block; }
h3 { margin: 20px 0 8px; font-size: 15px; color: #0f2b4c; }
.guide-hero { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: stretch; padding: 22px; background: #fff; border: 1px solid #dbe3ec; border-radius: 8px; }
.guide-hero h2 { margin: 4px 0 8px; font-size: 26px; line-height: 1.25; color: #0f2b4c; letter-spacing: 0; }
.guide-hero p { margin: 0; max-width: 760px; color: #47586c; }
.eyebrow { color: #2f7fd4 !important; font-weight: 700; font-size: 13px; }
.guide-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.guide-status { background: #f8fafc; border: 1px solid #dbe3ec; border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.guide-progress { height: 10px; background: #e5edf5; border-radius: 999px; overflow: hidden; }
.guide-progress span { display: block; height: 100%; background: #2f7fd4; border-radius: inherit; transition: width .2s ease; }
.guide-next { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 6px; border-top: 1px solid #dbe3ec; }
.guide-next span { color: #64748b; font-size: 12px; }
.workflow-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.workflow-card { text-align: left; min-height: 122px; padding: 14px; display: flex; flex-direction: column; gap: 8px; border-radius: 8px; background: #fff; }
.workflow-card span { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #e8f2ff; color: #0f2b4c; font-weight: 700; }
.workflow-card strong { color: #0f2b4c; font-size: 15px; }
.workflow-card em { color: #64748b; font-style: normal; font-size: 12px; line-height: 1.4; }
.workflow-card.primary-step { border-color: #2f7fd4; box-shadow: inset 0 0 0 1px rgba(47,127,212,.18); }
.guide-checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.guide-check { display: grid; grid-template-columns: 28px 1fr; gap: 2px 8px; text-align: left; padding: 10px 12px; background: #fff; border-radius: 8px; }
.guide-check span { grid-row: span 2; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #eef2f7; color: #64748b; font-weight: 700; }
.guide-check strong { color: #0f2b4c; }
.guide-check em { color: #64748b; font-style: normal; font-size: 12px; }
.guide-check.done span { background: #dff4e6; color: #087443; }
.prep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.prep-grid div, .page-help { background: #fff; border: 1px solid #dbe3ec; border-radius: 8px; padding: 12px 14px; }
.prep-grid strong, .page-help strong { display: block; color: #0f2b4c; margin-bottom: 3px; }
.prep-grid span, .page-help span { color: #64748b; font-size: 13px; }
.page-help { margin-bottom: 14px; }
.page-help.core { border-color: #b8d4f5; background: #f4f9ff; }
.module-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.module-head h3 { margin-top: 0; }
.metric-pill { flex: 0 0 auto; max-width: 520px; padding: 8px 12px; border: 1px solid #b8d4f5; background: #e8f2ff; color: #0f2b4c; border-radius: 8px; font-weight: 700; font-variant-numeric: tabular-nums; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px 18px; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: #47586c; }
input, select { padding: 7px 9px; border: 1px solid #ccd6e0; border-radius: 6px; font-size: 14px; background: #fff; }
input:focus, select:focus { outline: 2px solid #2f7fd4; border-color: transparent; }

button { border: 1px solid #ccd6e0; background: #fff; border-radius: 6px; padding: 7px 14px; cursor: pointer; font-size: 13px; }
button:hover { background: #eef4fb; }
button.primary { background: #2f7fd4; border-color: #2f7fd4; color: #fff; font-weight: 600; }
button.primary:hover { background: #2668b0; }
button:disabled { opacity: .58; cursor: not-allowed; }
button.small { padding: 4px 10px; font-size: 12px; margin-top: 6px; }
button.danger { color: #b3261e; border-color: #e2b6b3; }
button.mode.active { background: #2f7fd4; color: #fff; border-color: #2f7fd4; }

.editable-table { border-collapse: collapse; width: 100%; background: #fff; font-size: 13px; }
.editable-table th, .editable-table td { border: 1px solid #dbe3ec; padding: 4px 6px; text-align: center; }
.editable-table th { background: #eef2f7; font-weight: 600; white-space: nowrap; }
.editable-table td input, .editable-table td select { border: 0; width: 100%; min-width: 52px; padding: 3px 4px; text-align: center; background: transparent; }
.editable-table td.computed { background: #f2f8f2; color: #14532d; font-variant-numeric: tabular-nums; white-space: nowrap; }
.computed-h { background: #e2efe2 !important; }
.table-scroll { overflow-x: auto; }
.structured-table { min-width: 920px; margin: 8px 0 6px; }
.structured-table td input, .structured-table td select { min-width: 72px; }
.structured-table td:last-child { width: 54px; }
.check-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 16px; margin: 12px 0; }
.check-form .pick { min-height: 38px; }
.compact-picks { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
#calcTotal { text-align: right; font-weight: 700; color: #0f2b4c; background: #f7fafc; }

.zone-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.zone-tabs button { padding: 6px 14px; }
.zone-tabs button.active { background: #0f2b4c; color: #fff; border-color: #0f2b4c; }
.zone-actions { margin-top: 16px; display: flex; gap: 8px; }

.canvas-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; padding: 6px 8px; background: #fff; border: 1px solid #dbe3ec; border-radius: 8px; }
.canvas-toolbar .sep { width: 1px; height: 20px; background: #dbe3ec; margin: 0 4px; }
.chk, .inline { flex-direction: row; align-items: center; gap: 4px; font-size: 12px; }
.inline input[type=range] { width: 100px; padding: 0; }
.inline input[type=color] { width: 36px; height: 30px; padding: 2px; }
.inline input[type=number] { width: 86px; padding: 4px 6px; }
.muted { color: #7b8a9b; font-size: 12px; }

#canvasWrap { position: relative; border: 1px solid #dbe3ec; border-radius: 8px; background: repeating-conic-gradient(#fafbfc 0 25%, #f1f4f7 0 50%) 0 0/24px 24px; min-height: 360px; overflow: auto; max-height: 76vh; }
#fpCanvas { display: block; cursor: crosshair; }
#canvasHint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 30px; text-align: center; }

.sel-props { margin-top: 6px; min-height: 28px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sel-props input, .sel-props select { padding: 4px 6px; font-size: 13px; }

.summary { background: #fff; border: 1px solid #dbe3ec; border-radius: 8px; padding: 12px 16px; white-space: pre-wrap; font-variant-numeric: tabular-nums; }

/* 全局品牌与主题页 */
.scheme-preview { display: flex; align-items: center; gap: 6px; margin: 10px 0 4px; }
.scheme-preview span { width: 44px; height: 26px; border-radius: 4px; border: 1px solid #ccd6e0; }
.scheme-preview em { font-style: normal; color: #47586c; font-size: 13px; margin-left: 8px; }
.logo-preview { margin: 10px 0; min-height: 40px; display: flex; align-items: center; }
.logo-preview img { max-height: 56px; max-width: 320px; object-fit: contain; background: #fff; border: 1px solid #dbe3ec; border-radius: 6px; padding: 4px 10px; }

/* 场景/优势 选择网格 */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; margin: 8px 0; }
.pick { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: #1c2733; background: #fff; border: 1px solid #dbe3ec; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.pick input { width: auto; }

/* 逐页微调面板 */
.pg-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px 16px; margin-top: 12px; }
.pg-ctl { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid #dbe3ec; border-radius: 6px; padding: 8px 12px; }
.pg-ctl label { font-size: 13px; color: #47586c; }
.pg-ctl input[type=checkbox] { width: auto; align-self: flex-start; }

/* 活表格 输入格/公式格 分色 + 图例（需求7） */
.editable-table.calc td:not(.computed) input { background: #E8F2FF; border: 1px solid #9EC5FE; border-radius: 3px; }
.editable-table.calc td.computed { background: #DFF4E6; color: #064E3B; font-weight: 600; }
.editable-table.calc th:not(.computed-h) { background: #D9EAFE; }
.editable-table.calc .computed-h { background: #BFE8CE !important; color: #064E3B; }
.calc-legend { display: flex; gap: 22px; align-items: center; margin: 6px 0 10px; font-size: 12px; color: #7b8a9b; }
.calc-legend i { font-style: normal; display: inline-flex; align-items: center; gap: 6px; }
.calc-legend b { width: 18px; height: 12px; border-radius: 3px; border: 1px solid #ccd6e0; display: inline-block; }
.calc-legend .lg-input { background: #F4F9FF; }
.calc-legend .lg-formula { background: #EAF6EF; }
.calc-legend .lg-total { background: #E7EFF9; }
.calc-param-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 12px; margin: 8px 0 10px; padding: 10px; background: #fff; border: 1px solid #dbe3ec; border-radius: 8px; }
.calc-param-bar label { font-size: 12px; }
.calc-param-bar input { padding: 5px 7px; }

/* 货架选型 */
.rack-toolbar { display: grid; grid-template-columns: minmax(260px, 1.2fr) repeat(3, minmax(140px, .6fr)); gap: 10px 14px; margin: 8px 0 12px; }
.rack-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.rack-card { position: relative; display: grid; grid-template-columns: 92px 1fr; gap: 10px; min-height: 128px; padding: 10px; background: #fff; border: 1px solid #dbe3ec; border-radius: 8px; cursor: pointer; color: #1c2733; }
.rack-card.selected { border-color: #2f7fd4; box-shadow: 0 0 0 2px rgba(47,127,212,.16); }
.rack-card > input { position: absolute; top: 8px; right: 8px; width: auto; }
.rack-img { width: 92px; height: 104px; display: flex; align-items: center; justify-content: center; background: #f8fafc; border: 1px solid #e4ebf3; border-radius: 6px; overflow: hidden; }
.rack-img img { width: 100%; height: 100%; object-fit: contain; }
.rack-noimg { color: #94a3b8; font-size: 12px; }
.rack-info { display: flex; flex-direction: column; gap: 4px; padding-right: 22px; min-width: 0; }
.rack-info strong { color: #0f2b4c; font-size: 14px; }
.rack-info span, .rack-info em, .rack-info small { font-style: normal; color: #64748b; font-size: 12px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* 配送路线列表（需求4 精修） */
.route-list-title { margin: 14px 0 6px; font-size: 15px; color: #0f2b4c; }
.route-list-title .muted { font-weight: 400; font-size: 12px; }
.route-list, .point-list { display: flex; flex-direction: column; gap: 6px; }
.point-list { max-height: 260px; overflow: auto; padding-right: 4px; }
.point-group { background: #fff; border: 1px solid #dbe3ec; border-radius: 6px; overflow: hidden; }
.point-group summary { display: grid; grid-template-columns: 88px 52px 1fr; gap: 8px; align-items: center; padding: 7px 10px; cursor: pointer; color: #0f2b4c; }
.point-group summary span { color: #64748b; font-size: 12px; }
.point-group summary em { color: #47586c; font-style: normal; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.point-grid { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 8px; border-top: 1px solid #e5edf5; background: #f8fafc; }
.route-row, .point-row { display: grid; align-items: center; gap: 8px; background: #fff; border: 1px solid #dbe3ec; border-radius: 6px; padding: 6px 10px; }
.route-row { grid-template-columns: 38px 64px minmax(170px, 1fr) 74px minmax(180px, 1.3fr) 34px; }
.point-row { grid-template-columns: 28px 80px 86px 96px 136px 126px minmax(110px, 1fr) 112px 42px; }
.point-row.selected { outline: 2px solid #2f7fd4; }
.route-row .rl-color { width: 30px; height: 28px; padding: 2px; }
.route-row .rl-label { width: 64px; flex: 0 0 64px; font-weight: 600; text-align: center; }
.route-row .rl-meta { font-size: 13px; color: #47586c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-row .rl-width { width: 70px; }
.route-row .rl-desc { flex: 1; min-width: 160px; }

@media (max-width: 1100px) {
  #previewPane { height: 70vh; min-height: 520px; }
  .guide-hero { grid-template-columns: 1fr; }
  .workflow-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-head { flex-direction: column; }
  .metric-pill { max-width: none; width: 100%; }
  .rack-toolbar { grid-template-columns: 1fr; }
  .point-row { grid-template-columns: 28px 80px 86px 96px 1fr; overflow-x: auto; }
}
