*{box-sizing:border-box}:root{--bg:#f4f6f8;--card:#fff;--ink:#111827;--muted:#6b7280;--line:#dfe4ea;--orange:#ff6b0b;--red:#b42318;--green:#147d3f;--blue:#1d4ed8}body{margin:0;background:var(--bg);color:var(--ink);font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}.top{background:#101827;color:#fff;padding:25px max(24px,calc((100vw - 1440px)/2));display:flex;justify-content:space-between;gap:20px;align-items:center}.brand{font-weight:800;letter-spacing:.18em;color:#fb923c;font-size:12px}.top h1{margin:3px 0;font-size:29px}.top p{margin:0;color:#cbd5e1}.top-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.pill,.badge{border-radius:999px;padding:8px 11px;font-size:12px;background:#253045;color:#dbe3ef}.pill.ok{background:#064e3b;color:#d1fae5}.pill.bad{background:#7f1d1d;color:#fee2e2}nav{display:flex;gap:4px;overflow:auto;background:#fff;border-bottom:1px solid var(--line);padding:9px max(16px,calc((100vw - 1440px)/2));position:sticky;top:0;z-index:10}nav button{white-space:nowrap;border:0;background:none;padding:10px 13px;border-radius:8px;font-weight:700;color:#4b5563;cursor:pointer}nav button.active{background:#fff1e8;color:#d94f00}nav b{background:#ef4444;color:#fff;border-radius:999px;padding:2px 6px;font-size:10px}main{max-width:1440px;margin:22px auto 60px;padding:0 20px}.view{display:none}.view.active{display:block}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:18px}.card{background:#fff;border:1px solid var(--line);border-radius:17px;padding:20px;margin-bottom:18px;box-shadow:0 8px 24px rgba(15,23,42,.045)}.head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:17px}.head h2,.card h2{margin:0;font-size:19px}.head i{font-style:normal;background:#fff1e8;color:#e85d04;border-radius:50%;width:28px;height:28px;display:inline-grid;place-items:center;margin-right:7px}.btn,.primary{border:1px solid var(--line);background:#fff;border-radius:9px;padding:9px 12px;font-weight:700;cursor:pointer}.primary{background:var(--orange);color:white;border-color:var(--orange)}.danger{color:var(--red)}.full{width:100%;height:49px}.drop{border:2px dashed #cad5e3;min-height:190px;border-radius:14px;display:flex;align-items:center;justify-content:center;flex-direction:column;cursor:pointer;text-align:center}.drop input,.filebtn input{display:none}.drop span{color:var(--muted);font-size:13px;margin-top:5px}.fileitem{display:flex;justify-content:space-between;align-items:center;border:1px solid var(--line);padding:9px 11px;border-radius:9px;margin:10px 0}.form2{display:grid;grid-template-columns:1fr 1fr;gap:13px}label{font-size:12px;font-weight:750;color:#374151;display:block}input,select,textarea{width:100%;border:1px solid #cfd6df;border-radius:8px;padding:9px 10px;margin-top:5px;font:inherit;color:#111827;background:#fff}textarea{min-height:70px}.inline{display:flex;gap:6px}.inline .btn{margin-top:5px}.tablewrap{overflow:auto;border:1px solid var(--line);border-radius:11px}table{width:100%;border-collapse:collapse;min-width:980px}th,td{padding:8px;border-bottom:1px solid var(--line);text-align:left;font-size:12px}th{background:#f8fafc;color:#4b5563}td input,td select{min-width:90px;margin:0;padding:7px}.num{text-align:right}.x{border:0;background:#eef2f6;border-radius:7px;width:29px;height:29px;font-size:18px}.mapstatus{font-size:11px;padding:5px 7px;border-radius:999px;white-space:nowrap;background:#f3f4f6}.mapstatus.auto{background:#dcfce7;color:#166534}.mapstatus.manual{background:#dbeafe;color:#1e40af}.mapstatus.none{background:#fee2e2;color:#991b1b}.totals{display:flex;justify-content:flex-end;gap:25px;padding-top:15px}.totals span{color:var(--muted);font-size:12px}.totals b{display:block;color:#111827;font-size:18px}.actionbar{display:flex;justify-content:space-between;align-items:center}.actionbar h2{margin-bottom:5px}.actionbar p{margin:0;color:var(--muted)}.filters{display:grid;grid-template-columns:2fr 1fr 1fr 1fr;gap:8px;margin-bottom:12px}.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:15px;margin-bottom:18px}.kpis div{background:#fff;border:1px solid var(--line);border-radius:14px;padding:17px}.kpis span{font-size:12px;color:var(--muted);display:block}.kpis b{font-size:26px;margin-top:5px;display:block}.barrow{display:grid;grid-template-columns:120px 1fr 110px;gap:9px;align-items:center;margin:10px 0;font-size:12px}.bar{height:10px;background:#eef2f6;border-radius:99px;overflow:hidden}.bar i{height:100%;display:block;background:var(--orange)}.exception{border:1px solid #fecaca;background:#fff7f7;padding:12px;border-radius:10px;margin:8px 0}.exception strong{display:block}.exception span{font-size:12px;color:#7f1d1d}.stack{display:grid;gap:9px}.msg{padding:11px;margin-top:10px;border-radius:9px;background:#fee2e2;color:#991b1b}.msg.ok{background:#dcfce7;color:#166534}.hidden{display:none}.badge{background:#f3f4f6;color:#4b5563}@media(max-width:900px){.grid2{grid-template-columns:1fr}.form2{grid-template-columns:1fr}.filters{grid-template-columns:1fr}.kpis{grid-template-columns:1fr 1fr}.actionbar{display:block}.actionbar>div:last-child{margin-top:12px}.top{display:block}.top-actions{justify-content:flex-start;margin-top:12px}}
.head-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.import-note{font-size:13px;color:var(--muted);background:#f8fafc;border:1px solid var(--line);padding:11px 12px;border-radius:9px;margin-bottom:14px}
.import-panel{border:1px solid #fed7aa;background:#fffaf5;border-radius:12px;padding:15px;margin-bottom:16px}
.import-panel h3{margin:0;font-size:17px}
.import-summary{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:12px}
.import-summary span{background:#fff;border:1px solid var(--line);border-radius:999px;padding:7px 10px;font-size:12px}
.import-preview{max-height:420px;margin-top:12px}
.import-preview tr.invalid{background:#fff1f2}
.import-preview td.error{color:#b42318;font-weight:700}
.import-actions{display:flex;justify-content:flex-end;margin-top:12px}
@media(max-width:900px){.head-actions{justify-content:flex-start}.head{align-items:flex-start;flex-direction:column}}

.subtle{color:var(--muted);font-size:13px;margin:5px 0 0}
.report-tabs{display:flex;gap:7px;margin:16px 0 12px;border-bottom:1px solid var(--line);padding-bottom:8px}
.report-tabs button{border:0;background:#f3f4f6;border-radius:8px;padding:9px 12px;font-weight:700;cursor:pointer;color:#4b5563}
.report-tabs button.active{background:#fff1e8;color:#d94f00}
.report-panel{display:none}
.report-panel.active{display:block}
#reportMonth{width:auto;min-width:150px;margin:0}
.delta-up{color:#b42318;font-weight:700}
.delta-down{color:#147d3f;font-weight:700}
.delta-flat{color:#6b7280}

.import-result{border-radius:10px;padding:13px 14px;margin-bottom:14px;font-size:14px}
.import-result.success{background:#dcfce7;border:1px solid #86efac;color:#166534}
.import-result.error{background:#fee2e2;border:1px solid #fca5a5;color:#991b1b}
.import-result strong{display:block;font-size:15px;margin-bottom:3px}
.product-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:12px 0}
.product-toolbar input{max-width:420px;margin:0}
.product-new-row{animation:productFlash 2.4s ease}
@keyframes productFlash{0%,45%{background:#dcfce7}100%{background:transparent}}
@media(max-width:700px){.product-toolbar{align-items:stretch;flex-direction:column}.product-toolbar input{max-width:none}}

.registry-hint{font-size:13px;color:var(--muted);background:#f8fafc;border:1px solid var(--line);padding:10px 12px;border-radius:9px;margin-bottom:12px}
.registry-actions{display:flex;gap:6px;white-space:nowrap}
.registry-actions button{padding:6px 8px;font-size:11px}
.registry-check{width:16px;height:16px;margin:0}
.editing-banner{display:flex;justify-content:space-between;align-items:center;gap:15px;background:#fff7ed;border:1px solid #fdba74;color:#9a3412;border-radius:12px;padding:12px 15px;margin-bottom:16px}
.editing-banner strong{display:block}
.editing-banner span{font-size:12px}
.suggestion-list{display:flex;gap:5px;flex-wrap:wrap;margin-top:5px;max-width:320px}
.suggestion-chip{border:1px solid #fed7aa;background:#fff7ed;color:#9a3412;border-radius:999px;padding:4px 7px;font-size:10px;cursor:pointer}
.suggestion-chip:hover{background:#ffedd5}
.suggestion-hint{font-size:10px;color:#6b7280;margin-top:4px;max-width:280px}
.match-reason{font-size:10px;color:#6b7280}
@media(max-width:900px){.editing-banner{align-items:flex-start;flex-direction:column}}

#rows .raw{min-width:360px;white-space:normal}
#rows .matched{min-width:360px}
#rows td:nth-child(2){min-width:390px}
#rows td:nth-child(3){min-width:390px}
.report-controls select{min-width:220px;margin:0}
.restore-options{padding:10px 0}
.restore-options select{margin-top:6px}
@media(max-width:900px){
  #rows .raw,#rows .matched{min-width:300px}
  .report-controls{width:100%}
  .report-controls input,.report-controls select,.report-controls button{width:100%}
}

.field-hint{display:block;margin-top:5px;color:#9a3412;min-height:14px;font-size:11px}
.duplicate-warning{display:flex;justify-content:space-between;align-items:center;gap:15px;background:#fef2f2;border:1px solid #fca5a5;color:#991b1b;border-radius:12px;padding:12px 15px;margin-bottom:16px}
.duplicate-warning strong{display:block}
.duplicate-warning span{display:block;font-size:12px;margin-top:2px}
.supplier-actions,.exception-actions{display:flex;gap:6px;flex-wrap:wrap}
.exception{display:flex;justify-content:space-between;align-items:center;gap:14px;border:1px solid var(--line);border-radius:11px;padding:12px 14px;margin-bottom:9px}
.exception-main{display:flex;flex-direction:column;gap:3px}
.exception-main span{color:var(--muted);font-size:13px}
.exception-main small{color:#9a3412}
@media(max-width:800px){.duplicate-warning,.exception{align-items:flex-start;flex-direction:column}}

.invoice-filters{grid-template-columns:2fr 1fr 1fr 1fr}
.month-readiness{border:1px solid var(--line);border-radius:12px;padding:14px;margin:12px 0 16px;background:#f8fafc}
.month-readiness.ready{background:#ecfdf3;border-color:#86efac;color:#166534}
.month-readiness.attention{background:#fff7ed;border-color:#fdba74;color:#9a3412}
.month-readiness.empty{color:var(--muted)}
.readiness-head{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:9px}
.readiness-head b{font-size:15px}.readiness-grid{display:flex;gap:8px;flex-wrap:wrap}.readiness-grid span{background:#fff;border:1px solid currentColor;border-radius:999px;padding:5px 9px;font-size:11px}
.compact-kpis{margin:12px 0}.compact-kpis b{font-size:20px}
.supplier-open{font-weight:700}.invoice-status{display:inline-block;border-radius:999px;padding:4px 8px;font-size:11px;font-weight:700}
.invoice-status.confirmed{background:#dcfce7;color:#166534}.invoice-status.draft{background:#fef3c7;color:#92400e}.invoice-status.attention{background:#fee2e2;color:#991b1b}
.issue-count{font-weight:700;color:#b42318}.price-alert-count{font-weight:700;color:#b45309}.clean-mark{color:#147d3f}
.invoice-detail-card{scroll-margin-top:16px}.invoice-facts{display:grid;grid-template-columns:repeat(5,minmax(130px,1fr));gap:10px;margin-bottom:15px}
.invoice-facts div{border:1px solid var(--line);border-radius:10px;padding:10px;background:#f8fafc}.invoice-facts span{display:block;font-size:11px;color:var(--muted)}.invoice-facts b{display:block;margin-top:3px}
.price-rise{background:#fff1f2}.price-drop{background:#ecfdf3}.price-alert{font-weight:700}.price-alert.rise{color:#b42318}.price-alert.drop{color:#147d3f}
.invoice-actions{display:flex;gap:5px;flex-wrap:wrap;min-width:210px}.invoice-actions button{padding:6px 8px;font-size:11px}
.price-control-settings{margin-top:16px;max-width:520px}.price-control-settings input{max-width:180px}
@media(max-width:1000px){.invoice-filters{grid-template-columns:1fr 1fr}.invoice-facts{grid-template-columns:1fr 1fr}}
@media(max-width:650px){.invoice-filters{grid-template-columns:1fr}.invoice-facts{grid-template-columns:1fr}.readiness-head{align-items:flex-start;flex-direction:column}}

.supplier-rate-source{font-size:11px;color:var(--muted)}

.report-controls select{min-width:215px}
.empty-price{color:#9ca3af}

.anomaly-kpis{margin-bottom:14px}
.anomaly-filters{grid-template-columns:repeat(6,minmax(150px,1fr))}
.anomaly-severity{display:inline-block;border-radius:999px;padding:4px 8px;font-size:11px;font-weight:700;white-space:nowrap}
.anomaly-severity.critical{background:#fee2e2;color:#991b1b}
.anomaly-severity.attention{background:#ffedd5;color:#9a3412}
.anomaly-severity.info{background:#e0f2fe;color:#075985}
.anomaly-status{display:inline-block;border-radius:999px;padding:4px 8px;font-size:11px;font-weight:700}
.anomaly-status.open{background:#f3f4f6;color:#374151}
.anomaly-status.reviewed{background:#dcfce7;color:#166534}
.anomaly-status.ignored{background:#e5e7eb;color:#4b5563}
.anomaly-actions{display:flex;gap:6px;flex-wrap:wrap;min-width:250px}
.anomaly-detail{min-width:280px;max-width:480px;white-space:normal}
.anomaly-delta.up{color:#b91c1c;font-weight:700}
.anomaly-delta.down{color:#047857;font-weight:700}
.anomaly-row-resolved{opacity:.68}
@media(max-width:1100px){.anomaly-filters{grid-template-columns:repeat(3,minmax(150px,1fr))}}
@media(max-width:700px){.anomaly-filters{grid-template-columns:1fr}.anomaly-actions{min-width:0}}

.price-source-current{color:#166534;font-weight:700}
.price-source-carried{color:#92400e;font-weight:700}
.migration-panel{margin-top:14px;padding:14px;border:1px solid var(--line,#d7dce2);border-radius:12px;background:rgba(255,255,255,.55)}
.migration-panel h3{margin:0 0 6px}.horizontal-wrap{flex-direction:row;flex-wrap:wrap}.horizontal-wrap>*{flex:0 0 auto}
.storage-ok{color:#166534;font-weight:700}.storage-warn{color:#92400e;font-weight:700}.storage-bad{color:#991b1b;font-weight:700}

.anomaly-type-panel{margin:0 0 14px;border:1px solid #e5e7eb;border-radius:12px;padding:12px;background:#fafafa}
.anomaly-type-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:10px}
.anomaly-type-head>div{display:flex;gap:6px}
.anomaly-type-checks{display:flex;flex-wrap:wrap;gap:8px}
.anomaly-type-checks label{display:flex;align-items:center;gap:6px;border:1px solid #d1d5db;background:#fff;border-radius:999px;padding:7px 10px;cursor:pointer;font-size:13px}
.anomaly-type-checks label:has(input:checked){border-color:#111827;background:#eef2ff;font-weight:700}
.anomaly-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px}
.anomaly-pagination>div{display:flex;gap:8px}
.anomaly-pagination button:disabled{opacity:.4;cursor:not-allowed}
.anomaly-loading{padding:24px;text-align:center;color:#6b7280}
@media(max-width:700px){.anomaly-type-head,.anomaly-pagination{align-items:stretch;flex-direction:column}.anomaly-type-head>div,.anomaly-pagination>div{width:100%}.anomaly-type-head button,.anomaly-pagination button{flex:1}}

.product-link{background:none;border:0;padding:0;color:#1d4ed8;text-decoration:underline;cursor:pointer;font:inherit;text-align:left}
.product-link:hover{color:#1e3a8a}
.product-history-filters{grid-template-columns:repeat(6,minmax(140px,1fr))}
#productHistoryTitle{margin-top:12px}
@media(max-width:1100px){.product-history-filters{grid-template-columns:repeat(3,minmax(140px,1fr))}}
@media(max-width:700px){.product-history-filters{grid-template-columns:1fr}}

.product-price-chart-wrap{margin:14px 0 18px;border:1px solid #e5e7eb;border-radius:12px;padding:14px;background:#fff}
.product-price-chart-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.product-price-chart-head>div{display:flex;flex-direction:column;gap:3px}
.product-price-chart-head select{max-width:250px}
.product-price-chart{display:block;width:100%;height:auto;min-height:180px;overflow:visible}
.product-chart-empty{padding:38px 12px;text-align:center;color:#6b7280;background:#f9fafb;border-radius:8px}
.product-chart-grid{stroke:#e5e7eb;stroke-width:1}
.product-chart-axis{stroke:#9ca3af;stroke-width:1}
.product-chart-line{fill:none;stroke:#2563eb;stroke-width:3;stroke-linejoin:round;stroke-linecap:round}
.product-chart-area{fill:#dbeafe;opacity:.45}
.product-chart-point{fill:#fff;stroke:#2563eb;stroke-width:2;cursor:pointer}
.product-chart-point:hover{fill:#2563eb}
.product-chart-label{fill:#6b7280;font-size:11px}
.product-chart-value{fill:#111827;font-size:11px;font-weight:700}
.product-chart-tooltip{position:fixed;z-index:9999;display:none;padding:8px 10px;border-radius:8px;background:#111827;color:#fff;font-size:12px;pointer-events:none;max-width:240px}
@media(max-width:700px){.product-price-chart-head{align-items:stretch;flex-direction:column}.product-price-chart-head select{max-width:none;width:100%}}

input[type="date"],input[type="month"]{min-height:40px}
.date-range-hint{font-size:12px;color:#6b7280}
@media(max-width:700px){
  input[type="date"],input[type="month"]{width:100%;min-width:0}
}

/* V23 audit fixes */
.anomaly-type-checks label{display:inline-flex;align-items:center;flex:0 0 auto;max-width:100%;line-height:1.25;overflow:visible}
.anomaly-type-checks input[type="checkbox"]{appearance:auto;width:16px!important;height:16px!important;min-width:16px!important;min-height:16px!important;flex:0 0 16px;margin:0!important;padding:0!important;border-radius:3px}
.anomaly-type-checks label span{white-space:normal}
.report-controls input[type="date"],.report-controls input[type="month"]{width:auto;min-width:150px;margin:0}
@media(max-width:900px){.report-controls input[type="date"],.report-controls input[type="month"]{width:100%}}
