* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #1f2329;
}
button, input, select, textarea { font: inherit; }
button {
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: #1f6feb;
  color: #fff;
  cursor: pointer;
}
button.secondary { background: #eef4ff; color: #1f6feb; }
button.danger { color: #d93025; }
button.small { padding: 6px 10px; font-size: 13px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.hidden { display: none !important; }
.error { color: #d93025; margin-top: 10px; }
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-card {
  width: 380px;
  padding: 32px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 50px rgba(0,0,0,.08);
}
.login-card h1 { margin: 0 0 6px; }
.login-card p { color: #8a8f99; margin: 0 0 24px; }
.login-card input { margin-bottom: 12px; }
.login-card button { width: 100%; }
.main-view { min-height: 100vh; display: flex; }
.sidebar {
  width: 220px;
  background: #111827;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.brand { color: #fff; font-weight: 800; font-size: 18px; padding: 10px 10px 18px; }
.nav { text-align: left; background: transparent; color: #cbd5e1; display:block; width:100%; padding:10px 16px; text-decoration:none; }
.nav.active { background: #1f2937; color: #fff; }
.spacer { flex: 1; }
.content { flex: 1; padding: 34px; overflow: auto; min-width:0; }
.inventory-frame { display:block; width:100%; height:calc(100vh - 68px); min-height:620px; border:0; border-radius:10px; background:#f3f6fa; }
.header-row { display: flex; justify-content: space-between; align-items: start; margin-bottom: 20px; }
.header-row h2 { margin: 0 0 6px; }
.header-row p { color: #8a8f99; margin: 0; }
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}
.table th, .table td {
  padding: 13px 14px;
  border-bottom: 1px solid #eef0f2;
  text-align: left;
  vertical-align: top;
}
.table th { background: #fafbfc; color: #646a73; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #f1f3f5; border-radius: 999px; padding: 4px 8px; font-size: 12px; }
.quote-pair { display: flex; gap: 12px; margin: 8px 0; }
.quote-pair input:first-child { flex: 1.3; }
.quote-pair input:nth-child(2) { flex: 1; }
.quote-pair button { background: #fff1f0; color: #d93025; }
dialog {
  border: 0;
  border-radius: 12px;
  width: min(640px, 92vw);
  padding: 0;
  box-shadow: 0 30px 80px rgba(0,0,0,.24);
}
dialog::backdrop { background: rgba(0,0,0,.32); }
dialog form { padding: 26px; }
dialog label { display: block; margin: 14px 0 6px; color: #646a73; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.subhead { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }
.inline { display: flex; gap: 8px; margin-top: 8px; }
.inline input { flex: 1; }
.alias-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid #f0f2f5; }
.alias-row button { background: transparent; color: #d93025; padding: 4px 8px; }
.muted { color: #8a8f99; }
.status-on { color: #137333; }
.status-off { color: #d93025; }
.danger-soft { background:#fff1f0; color:#d93025; }
.multiline-cell { white-space:pre-line; line-height:1.65; min-width:180px; }
.thumb { max-width: 160px; max-height: 120px; border-radius: 6px; cursor: pointer; }

#ocrDialog{width:min(920px,94vw);max-width:94vw;overflow:hidden}
.ocr-dialog-body{width:100%;min-width:0;max-width:100%;padding:8px;display:flex;flex-direction:column;max-height:86vh;overflow:hidden}
.ocr-dialog-body .subhead{position:sticky;top:0;z-index:2;background:#fff;padding:8px 4px 12px;margin:0;flex:0 0 auto}
.ocr-dialog-body #ocrMeta{padding:0 4px 10px;flex:0 0 auto;overflow-wrap:anywhere;word-break:break-word}
.ocr-raw{margin:0;background:#f5f6f8;border-radius:12px;padding:18px;max-width:100%;min-width:0;max-height:72vh;overflow-y:auto;overflow-x:hidden;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;line-height:1.7;tab-size:2}
.link-btn{background:#eef4ff;color:#1f6feb;border:0;border-radius:8px;padding:6px 10px;cursor:pointer;white-space:nowrap}

.header-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.import-note{font-size:13px;color:#8a8f99;margin-top:10px}
.replace-import-toggle{display:inline-flex;align-items:center;gap:7px;margin:0;padding:9px 11px;border:1px solid #dfe3e8;border-radius:8px;background:#fff;color:#646a73;font-size:14px;cursor:pointer;white-space:nowrap}.replace-import-toggle:has(input:checked){border-color:#f0a43c;background:#fff8e8;color:#ad6800}.replace-import-toggle input{width:16px;height:16px;margin:0;accent-color:#e68a00}

.company-search-bar{display:flex;align-items:center;gap:10px;margin:0 0 16px}.company-search-bar input{width:min(560px,55vw)}.company-search-bar button{white-space:nowrap}.company-search-bar .muted{margin-left:4px;white-space:nowrap}.form-hint{font-size:13px;color:#8a8f99;margin-top:7px;line-height:1.5}

/* V1.15 OCR A/B Benchmark */
.benchmark-stats{display:grid;grid-template-columns:repeat(2,minmax(280px,1fr));gap:14px;margin-bottom:16px}
.benchmark-stat-card{background:#fff;border-radius:12px;padding:16px;border:1px solid #eef0f2}
.benchmark-stat-title{font-size:17px;font-weight:800;margin-bottom:12px;display:flex;gap:8px;align-items:center}
.benchmark-stat-grid{display:grid;grid-template-columns:140px 1fr;gap:8px 12px;font-size:14px}
.benchmark-stat-grid span{color:#8a8f99}.benchmark-stat-grid strong{font-weight:700}
.benchmark-score-note{grid-column:1/-1;color:#8a8f99;font-size:13px;line-height:1.6}
.benchmark-upload-card{background:#fff;border-radius:12px;padding:18px;margin-bottom:16px;border:1px solid #eef0f2}
.benchmark-upload-grid{display:grid;grid-template-columns:1.4fr 1fr 1fr 1fr;gap:12px;align-items:end}
.benchmark-upload-grid label{display:block;margin:0 0 6px;color:#646a73;font-size:13px}
.benchmark-upload-actions{display:flex;justify-content:flex-end;margin-top:14px}
.benchmark-table td{min-width:160px}.benchmark-table td:first-child{min-width:145px}.benchmark-table td:nth-child(2){min-width:220px}
.benchmark-table button{margin-top:6px;margin-right:6px}
.bench-ok{color:#137333;font-weight:700}.bench-bad{color:#d93025;font-weight:700}
button:disabled{opacity:.6;cursor:not-allowed}
@media(max-width:1100px){.benchmark-upload-grid{grid-template-columns:1fr 1fr}.benchmark-stats{grid-template-columns:1fr}}


/* V1.23 四渠道白名单在线维护 */
.whitelist-card{background:#fff;border:1px solid #eef0f2;border-radius:12px;padding:16px;margin:0 0 16px}.whitelist-head{margin:0 0 12px}.whitelist-grid{display:flex;flex-direction:column;gap:8px}.whitelist-row{display:grid;grid-template-columns:minmax(180px,1fr) minmax(200px,1fr) auto;gap:16px;align-items:center;padding:12px 14px;border:1px solid #eef0f2;border-radius:10px}.whitelist-actions{display:flex;gap:8px;align-items:center;justify-content:flex-end}.whitelist-actions .link-btn{text-decoration:none}.hidden{display:none!important}@media(max-width:900px){.whitelist-row{grid-template-columns:1fr}.whitelist-actions{justify-content:flex-start}}

.site-footer{padding:24px 12px;text-align:center;font-size:12px;color:#75849a}.site-footer a{color:inherit;text-decoration:none}.site-footer a:hover{text-decoration:underline}

.quote-pair {display:grid;grid-template-columns:1fr 1.3fr 1fr auto;align-items:end;gap:10px;padding:12px;border:1px solid #e4e9f2;border-radius:8px;margin:12px 0;}
.quote-pair label{margin:0;font-size:13px}.quote-pair input,.quote-pair textarea{width:100%;min-width:0;box-sizing:border-box;margin-top:5px}.quote-pair .quote-note-field{grid-column:1/4;grid-row:2}.quote-pair button{grid-column:4;grid-row:1/3;align-self:center}.quote-note{white-space:pre-wrap;overflow-wrap:anywhere}.quote-extra{margin-bottom:10px;min-width:180px}.quote-extra details div{padding:4px 0}.quote-extra summary{cursor:pointer}.table td{vertical-align:top}#companiesTable{overflow-x:auto}#companyDialog{width:min(850px,95vw);max-width:95vw}
@media(max-width:650px){.quote-pair{grid-template-columns:1fr 1fr}.quote-pair .quote-note-field{grid-column:1/3;grid-row:auto}.quote-pair button{grid-column:auto;grid-row:auto}}

.company-quotes-table{table-layout:fixed;min-width:1220px;width:100%;border-collapse:collapse}.company-quotes-table .col-company{width:220px}.company-quotes-table .col-platform{width:100px}.company-quotes-table .col-price{width:140px}.company-quotes-table .col-bank{width:90px}.company-quotes-table .col-note{width:160px}.company-quotes-table .col-funding{width:185px}.company-quotes-table .col-aliases{width:110px}.company-quotes-table .col-updated{width:120px}.company-quotes-table .col-actions{width:80px}.company-quotes-table th,.company-quotes-table td{border:1px solid #e6ebf2;padding:10px 12px;overflow-wrap:anywhere;vertical-align:top}.company-quotes-table .company-start td{border-top:2px solid #dfe6f0}.company-quotes-table td[rowspan]{vertical-align:middle}.aliases-cell .chips{display:flex;flex-direction:column;align-items:flex-start;gap:5px}.aliases-cell .chip{font-size:11px;padding:3px 6px;white-space:normal}.company-actions button{display:block;margin:4px 0}.company-actions .danger{background:#fff1f0;color:#d93025}.funding-history{font-size:12px}.funding-history summary{cursor:pointer;white-space:nowrap}.funding-history div{padding:4px 0}.quote-pair .quote-row-actions{grid-column:4;grid-row:1/3;display:flex;flex-direction:column;gap:6px;align-items:stretch}.quote-pair .quote-row-actions button{grid-column:auto;grid-row:auto;align-self:stretch;background:#eef3fc;color:#2568ba;font-size:12px;padding:6px 8px}.quote-pair .quote-row-actions .remove-quote{background:#fff1f0;color:#d93025}.quote-order{font-size:12px;color:#75849a;text-align:center}.quote-pair .quote-row-actions button:disabled{opacity:.4;cursor:default}
@media(max-width:650px){.quote-pair .quote-row-actions{grid-column:1/3;grid-row:auto;flex-direction:row;align-items:center}.quote-pair .quote-note-field{grid-row:auto}}
