body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,"Microsoft YaHei",sans-serif;background:#f6f7f9;color:#20242a;margin:0}header{background:#111827;color:#fff;padding:16px 24px}header h1{margin:0 0 10px;font-size:22px}nav a{color:#dbeafe;margin-right:18px;text-decoration:none}main{padding:24px;max-width:1680px;margin:auto}.card{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:18px;margin-bottom:18px;box-shadow:0 1px 2px rgba(0,0,0,.04)}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:14px}.metric{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:18px}.metric b{display:block;font-size:28px}.metric span{color:#6b7280}.hint{color:#6b7280}.ok{color:#047857}.error{border-color:#ef4444}button{background:#2563eb;color:white;border:none;border-radius:8px;padding:8px 14px;cursor:pointer}input{padding:8px;border:1px solid #d1d5db;border-radius:8px;margin-right:8px}table{border-collapse:collapse;width:100%;font-size:13px}th,td{border-bottom:1px solid #e5e7eb;padding:8px;text-align:left;vertical-align:top}th{background:#f9fafb;position:sticky;top:0}.name{max-width:360px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}pre{background:#0b1020;color:#d1e7ff;padding:14px;border-radius:10px;overflow:auto;max-height:420px}a{color:#2563eb}
.filters{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:10px}.filters select{padding:8px;border:1px solid #d1d5db;border-radius:8px;background:#fff}.button-secondary{display:inline-block;background:#eef2ff;color:#1d4ed8;border-radius:8px;padding:8px 14px;text-decoration:none}th a{color:#111827;text-decoration:none}th a:hover{text-decoration:underline}
.filter-row th{background:#eef2f7;position:sticky;top:32px;z-index:2}.filter-row input,.filter-row select{width:100%;box-sizing:border-box;font-size:12px;padding:5px;border:1px solid #cbd5e1;border-radius:6px;background:#fff}.range-filter{display:flex;gap:4px}.range-filter input{min-width:42px}.sort-link{display:inline-block;color:#111827;font-weight:700}.table-actions{margin-top:12px;display:flex;gap:8px}.head-filter{min-width:80px}
/* Excel-like table layout */
.card{max-width:none}.table-wrap{width:100%;overflow:auto;border:1px solid #e5e7eb;border-radius:10px;background:#fff;max-height:72vh}.table-wrap table{table-layout:fixed;min-width:1540px;width:max-content;border-collapse:separate;border-spacing:0}.table-wrap th,.table-wrap td{box-sizing:border-box;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-right:1px solid #eef2f7}.table-wrap thead th{height:36px;line-height:18px;background:#f8fafc;z-index:3}.table-wrap thead tr:first-child th{top:0}.table-wrap thead tr.filter-row th{top:36px;height:42px;background:#eef2f7;z-index:3}.table-wrap tbody td{height:34px;line-height:20px}.col-id{width:58px}.col-sku{width:145px}.col-channel{width:165px}.col-name{width:420px}.col-person{width:90px}.col-num{width:105px}.col-status{width:150px}.table-wrap .name{max-width:none}.filter-row input,.filter-row select{height:26px;width:100%;font-size:12px;padding:3px 5px;margin:0}.range-filter{display:grid;grid-template-columns:1fr 1fr;gap:3px}.range-filter input{min-width:0}.sort-link{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-actions{position:sticky;left:0;background:#fff;padding-top:12px}.filters{margin-bottom:12px}
:root{--name-col-width:420px;--table-row-height:34px}.view-tools{display:flex;gap:16px;align-items:center;flex-wrap:wrap;background:#f8fafc;border:1px solid #e5e7eb;border-radius:10px;padding:10px 12px;margin:10px 0 12px}.view-tools label{display:flex;align-items:center;gap:6px;font-size:13px;color:#374151}.view-tools input[type=range]{width:150px}.small-button{background:#475569;padding:6px 10px;font-size:12px}.table-wrap .col-name{width:var(--name-col-width)!important}.table-wrap tbody td{height:var(--table-row-height);max-height:var(--table-row-height);line-height:20px}.table-wrap td.name{width:var(--name-col-width)!important}.wrap-product-name .table-wrap td.name{white-space:normal;overflow:auto;text-overflow:clip;line-height:20px}.wrap-product-name .table-wrap tbody td{vertical-align:top}
/* Drag-to-resize columns, Excel-like */
.view-tools{display:none!important}.table-wrap th{position:sticky}.table-wrap thead tr:first-child th{position:sticky;top:0}.resizable-table th{position:relative}.col-resizer{position:absolute;right:-3px;top:0;width:7px;height:100%;cursor:col-resize;user-select:none;z-index:10}.col-resizer:hover,.is-resizing-col .col-resizer{background:#2563eb55}.is-resizing-col{cursor:col-resize;user-select:none}.resizable-table th,.resizable-table td{transition:none!important}.table-wrap .col-name{width:420px}.table-wrap td.name{width:420px}
/* Sticky Excel header + compact spacing override */
main{padding-top:14px}.card{padding-top:14px}.card h2{margin:0 0 12px}.card .hint{margin:8px 0}.filters{margin:6px 0 8px}.table-wrap{max-height:calc(100vh - 230px);overflow:auto}.table-wrap table{border-collapse:separate!important;border-spacing:0!important}.table-wrap thead{position:relative}.table-wrap thead tr:first-child th{position:sticky!important;top:0!important;z-index:20!important;height:36px!important;padding:6px 8px!important;background:#f8fafc!important;border-bottom:1px solid #cbd5e1!important}.table-wrap thead tr.filter-row th{position:sticky!important;top:36px!important;z-index:19!important;height:34px!important;padding:4px 6px!important;background:#eef2f7!important;border-top:0!important;border-bottom:1px solid #cbd5e1!important}.filter-row input,.filter-row select{height:24px!important;padding:2px 5px!important}.range-filter{gap:3px!important}.sort-link{line-height:20px}.table-wrap tbody tr:first-child td{border-top:0}.table-wrap td{padding:6px 8px!important}
/* Stable wide-table layout override */
.table-wrap table.resizable-table{table-layout:fixed!important;width:auto!important;min-width:max-content!important}
.table-wrap th,.table-wrap td{white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
.table-wrap .col-id{width:58px!important;min-width:58px!important}.table-wrap .col-date{width:104px!important;min-width:104px!important}.table-wrap .col-sku{width:150px!important;min-width:150px!important}.table-wrap .col-channel{width:150px!important;min-width:150px!important}.table-wrap .col-name{width:300px!important;min-width:300px!important}.table-wrap .col-person{width:76px!important;min-width:76px!important}.table-wrap .col-site{width:58px!important;min-width:58px!important}.table-wrap .col-tier{width:76px!important;min-width:76px!important}.table-wrap .col-num{width:108px!important;min-width:108px!important}.table-wrap .col-status{width:112px!important;min-width:112px!important}
.table-wrap td.name{width:300px!important;min-width:300px!important;max-width:300px!important}
.rolling-table{min-width:1900px!important}.rolling-table th,.rolling-table td{font-size:12px!important;line-height:18px!important}.rolling-table tbody td{height:32px!important;max-height:32px!important}
/* Backtest explanations and hover tips */
.tip{cursor:help;border-bottom:1px dotted #64748b;text-decoration:none}.tip:hover{color:#1d4ed8}.metric-tip{position:relative;display:inline-block}.metric-tip summary{cursor:pointer;list-style:none;color:#111827;border-bottom:1px dotted #64748b}.metric-tip summary::-webkit-details-marker{display:none}.metric-tip summary span{display:inline-flex;align-items:center;justify-content:center;width:15px;height:15px;margin-left:4px;border-radius:50%;background:#e0ecff;color:#1d4ed8;font-size:11px;font-weight:700}.metric-tip[open] summary{color:#1d4ed8}.metric-tip-panel{position:absolute;z-index:80;top:24px;left:0;width:460px;max-width:calc(100vw - 48px);background:#fff;border:1px solid #bfdbfe;border-radius:12px;box-shadow:0 12px 28px rgba(15,23,42,.18);padding:14px;color:#374151;white-space:normal;line-height:1.55}.metric-tip-panel b{display:block;margin-bottom:8px;color:#111827;font-size:14px}.metric-tip-panel p{margin:7px 0}.explainer{border-left:4px solid #2563eb}.explain-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:10px;margin-top:10px}.explain-grid div{background:#f8fafc;border:1px solid #e5e7eb;border-radius:10px;padding:10px}.explain-grid b{display:block;color:#111827;margin-bottom:4px}.explain-grid span{color:#4b5563;line-height:1.5}
.algo-link{color:#1d4ed8;text-decoration:underline;text-underline-offset:2px;font-weight:600}.algo-link:hover{color:#1e40af}.algo-link:after{content:' ↗';font-size:11px;color:#64748b}
.example-box{border:1px solid #e5e7eb;border-radius:12px;padding:12px;margin:12px 0;background:#fff}.example-box h3{margin:0 0 10px;font-size:16px;color:#111827}
.danger-btn{background:#dc2626;color:#fff;border:0;border-radius:6px;padding:5px 10px;cursor:pointer}.danger-btn:hover{background:#b91c1c}
td form{margin:0}

/* Replenishment strategy module */
.settings-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;align-items:center}
.settings-grid input,.settings-grid select{width:100%;box-sizing:border-box;margin:0}
.settings-grid label{display:flex;gap:6px;align-items:center;font-size:13px;color:#374151;background:#f8fafc;border:1px solid #e5e7eb;border-radius:8px;padding:7px 9px}
.settings-grid label input{width:auto}
.badge{display:inline-flex;align-items:center;min-height:22px;border-radius:999px;padding:2px 8px;font-size:12px;font-weight:700;background:#e5e7eb;color:#374151}
.badge-none{background:#f1f5f9;color:#475569}.badge-regular{background:#dbeafe;color:#1d4ed8}.badge-spike{background:#fee2e2;color:#b91c1c}.badge-frozen{background:#f3f4f6;color:#111827}
.risk-low{background:#dcfce7;color:#047857}.risk-medium{background:#fef3c7;color:#92400e}.risk-high{background:#fee2e2;color:#b91c1c}
.pagination{display:flex;gap:10px;align-items:center;margin-top:12px}
.replenishment-table{min-width:1800px!important}.replenishment-table th,.replenishment-table td{font-size:12px!important;line-height:18px!important}.replenishment-table details summary{cursor:pointer;color:#1d4ed8}.replenishment-table pre{max-width:520px;max-height:260px;white-space:pre-wrap}
.module-nav-card{padding-bottom:14px}.module-nav-card h2{margin-bottom:10px}
.module-nav{display:flex;gap:8px;flex-wrap:wrap}
.module-nav a{display:inline-flex;align-items:center;min-height:34px;padding:0 12px;border:1px solid #dbeafe;border-radius:8px;background:#eff6ff;color:#1d4ed8;text-decoration:none;font-weight:700}
.module-nav a.active{background:#1d4ed8;color:#fff;border-color:#1d4ed8}
.module-card-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
.module-card{display:block;border:1px solid #e5e7eb;border-radius:10px;background:#f8fafc;padding:14px;text-decoration:none;color:#111827}
.module-card:hover{border-color:#93c5fd;background:#eff6ff}
.module-card b{display:block;margin-bottom:6px;font-size:16px}
.module-card span{display:block;color:#64748b;line-height:1.5}
.decision-form{display:grid;grid-template-columns:82px 64px minmax(88px,1fr) 48px;gap:5px;align-items:center}
.decision-form select,.decision-form input{width:100%;box-sizing:border-box;margin:0;padding:6px;border:1px solid #d1d5db;border-radius:7px;background:#fff;font-size:12px}
.decision-form button{padding:6px 8px;font-size:12px;border-radius:7px}
.diff-up{color:#b91c1c;font-weight:700}.diff-down{color:#047857;font-weight:700}.diff-flat{color:#64748b}
.table-wrap .col-decision{width:300px!important;min-width:300px!important}
