@import url("./palette.css");

html:root { --panel:#fff; color-scheme:light }
html:root.dark { --panel:#20242d; color-scheme:dark }
html:root body {
  --module:var(--blue-ink); --wash:var(--blue-wash); --stroke:var(--blue-line);
  --paper:var(--panel); --ground:var(--bg); --blue:var(--module); --blue-soft:var(--wash); --blue-strong:var(--module);
  --ink-soft:var(--sub); --color-brand:var(--module); --color-surface:var(--panel); --color-text:var(--ink);
  background:var(--bg); color:var(--ink); font-family:Inter,-apple-system,BlinkMacSystemFont,"Helvetica Neue","PingFang SC","Microsoft YaHei",sans-serif; font-variant-numeric:tabular-nums
}
html:root body[data-page] {--line:#dce1eb;--muted:#626f84;--ground:var(--bg);background:var(--bg)}
html:root.dark body[data-page] {--line:#39404c;--muted:#a6b0c2}
html:root body:is([data-page=documents],[data-page=customers],[data-page=customerFollowups]) {--module:var(--violet-ink);--wash:var(--violet-wash);--stroke:var(--violet-line)}
html:root body:is([data-page=procurement],[data-page=invoiceLedger]) {--module:var(--teal-ink);--wash:var(--teal-wash);--stroke:var(--teal-line)}
html:root body[data-page=inventory] {--module:var(--amber-ink);--wash:var(--amber-wash);--stroke:var(--amber-line)}
html:root body[data-page=priceAudit] {--module:var(--orange-ink);--wash:var(--orange-wash)}
html:root body .app-masthead,html:root body .sidebar {background:var(--rail);border-color:var(--line)}
html:root body .sidebar nav a {min-height:34px;padding:6px 10px;border-radius:6px;font-size:13px;color:var(--sub)}
html:root body .sidebar nav {gap:3px}
html:root body .sidebar nav a:is(:hover,.active) {background:var(--wash);color:var(--module)}
html .sidebar .v2-nav-icon {width:17px;height:17px;color:var(--module)}
html .app-masthead .bi-theme {margin-left:auto;background:var(--panel);color:var(--sub);border:1px solid var(--line);border-radius:6px;padding:8px;display:grid;place-items:center;cursor:pointer}
.bi-theme svg,.bi-icon {width:18px;height:18px;stroke:currentColor;fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.7}
html .bi-theme + .account-menu,html .connection + .bi-theme {margin-left:0}
html:root body :is(.dashboard-period,.analysis-panel,.sales-analysis,.table-panel,.wb-section,.wb-feature,.ops-filters,.audit-filters,.il-months,.il-summary,.auth-card) {background-color:var(--panel);border:1px solid var(--line);border-radius:12px;box-shadow:var(--panel-shadow)}
html:root body .page-heading {background:var(--bg);color:var(--ink)}
html:root body .page-heading h1 {font-size:25px;letter-spacing:-.045em;font-weight:670}
html:root body .wb-intro {background:linear-gradient(112deg,var(--blue-wash),var(--panel));border:1px solid var(--line);border-radius:12px;color:var(--ink)}
html:root body .wb-feature:hover {border-color:var(--stroke);background:var(--wash)}
html:root body .dashboard-primary-metrics .metric {
  --card:var(--violet-wash);--tone:var(--violet-ink);--edge:var(--violet-line);
  background:linear-gradient(112deg,var(--card),color-mix(in srgb,var(--card) 63%,var(--panel)));
  border:1px solid color-mix(in srgb,var(--edge) 35%,var(--panel));border-radius:12px;
  color:var(--ink);padding:16px;min-width:0;box-shadow:var(--panel-shadow)
}
html:root body .dashboard-primary-metrics .metric.accent {--card:var(--green-wash);--tone:var(--green-ink);--edge:var(--green-line)}
html:root body .dashboard-primary-metrics .metric:has([data-key=periodOrders]) {--card:var(--blue-wash);--tone:var(--blue-ink);--edge:var(--blue-line)}
html:root body .dashboard-primary-metrics .dashboard-action {--card:var(--amber-wash);--tone:var(--amber-ink);--edge:var(--amber-line)}
html:root body .dashboard-primary-metrics .metric > span {display:flex;align-items:center;gap:8px;color:var(--tone);font-weight:620}
.metric .bi-icon {box-sizing:content-box;padding:4px;background:color-mix(in srgb,var(--edge) 16%,var(--card));border-radius:7px}
html:root body .dashboard-primary-metrics .metric strong {color:var(--ink);font-size:clamp(25px,2.4vw,40px);font-weight:610;letter-spacing:-.045em}
html:root body .dashboard-primary-metrics .metric small {color:var(--sub)}
html:root body .dashboard-secondary-metrics .metric {border-radius:9px;background:var(--panel);color:var(--ink);border-color:var(--line)}
html:root body .period-presets button {border-radius:6px;min-height:34px}
html:root body .period-presets button.active {background:var(--blue-ink);color:var(--panel)}
html:root body .analysis-rank-name {--blue-soft:var(--teal-wash)}
html:root body th {background:var(--soft);color:var(--sub);font-size:12px}
html:root body tbody tr:hover td {background-color:color-mix(in srgb,var(--wash) 55%,var(--panel))}
html:root body :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {border-color:var(--line);border-radius:5px;background:var(--panel);color:var(--ink)}
html:root :focus-visible {outline:2px solid var(--module,var(--blue-ink));outline-offset:2px}
@media(min-width:1050px){
  html:root body .dashboard-primary-metrics {display:grid;grid-template-columns:1.55fr 1.22fr 1fr 1fr;gap:12px}
  html:root .workbench-main {display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:16px;align-content:start}
  .workbench-main > :is(.page-heading,.wb-intro,.wb-footnote,.wb-section:has(.wb-feature-grid)){grid-column:1/-1}
  html:root .workbench-main > section {margin-block:0}
  html:root dialog:is(#detailDialog,#productBusinessDialog,#procurementDialog)[open] {margin:0 0 0 auto;inset:0;width:min(960px,86vw);height:100dvh;max-height:100dvh;border:0;border-left:1px solid var(--line);border-radius:14px 0 0 14px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important}}
html:root body[data-page] .dashboard-primary-metrics .metric:nth-child(n) {background:linear-gradient(112deg,var(--card),color-mix(in srgb,var(--card) 63%,var(--panel)));border:1px solid color-mix(in srgb,var(--edge) 35%,var(--panel))}
.bi-insights {display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:14px;margin:16px 0}
.bi-brand-panel {min-width:0;padding:18px 20px;border:1px solid var(--line);border-radius:12px;background:var(--panel)}
.bi-brand-panel h2 {font-size:16px;letter-spacing:-.025em;margin:0 0 3px}
.bi-brand-panel small {color:var(--muted)}
#brandChart {display:grid;gap:4px;margin-top:12px}
#brandChart button {display:grid;grid-template-columns:minmax(60px,1fr) 1.4fr auto;align-items:center;gap:10px;min-height:28px;text-align:left;background:transparent;color:var(--ink);border:0;padding:2px 4px;font:inherit;font-size:12px;cursor:pointer}
#brandChart button:hover {background:var(--soft)}
#brandChart i {position:relative;display:block;height:8px;background:var(--soft);border-radius:3px}
#brandChart b {position:absolute;inset:0 auto 0 0;background:var(--viz-1);border-radius:3px}
#brandChart button:nth-child(2) b {background:var(--viz-2)}
#brandChart button:nth-child(3) b {background:var(--viz-3)}
#brandChart button:nth-child(4) b {background:var(--viz-4)}
#brandChart button:nth-child(5) b {background:var(--viz-5)}
#brandChart.signed b {left:50%}
#brandChart.signed .negative {left:auto;right:50%;background:var(--red-line)}
html:root body .bi-insights .dashboard-secondary-metrics {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:0}
html:root body .bi-insights .metric {min-height:0;padding:12px}
@media(max-width:780px){.bi-insights{grid-template-columns:minmax(0,1fr)}}
html:root.dark body {--ink:#f1f2f6;--sub:#c6cedc;--muted:#a6b0c2;--ground:var(--bg);--line:#39404c;--line-strong:#596171;--muted-weak:var(--muted)}
html:root.dark body :is(main, .il-main,.page-heading,.auth-pane,.login-layout){color:var(--ink);background-color:var(--bg)}
html:root.dark body :is(table,td,dialog,.detail-head,.account-menu summary,.account-actions,.account-actions a,.account-actions button,.wb-feature,.wb-queue,.ops-card,.ops-counts article,.il-body,.audit-card,.analysis-panel-head,.analysis-heading,.period-heading,.period-advanced,.period-controls,.mobile-work-nav,.auth-card,.filters,.table-toolbar,.pagination,.procurement-summary article,.detail-table-wrap){background-color:var(--panel);color:var(--ink);border-color:var(--line)}
html:root.dark body :is(.btn,button:not(.login-submit),summary,.wb-feature strong){color:var(--ink);background-color:var(--soft);border-color:var(--line)}
html:root.dark body :is(h1,h2,h3,h4,.brand,.metric strong,.detail-head strong,.folio,.period-heading strong){color:var(--ink)}
html:root.dark body :is(th,thead,.analysis-table thead th){background-color:var(--soft);color:var(--sub)}
html:root.dark body :is(.page-note,.wb-muted,.period-heading span,.metric small,.auth-heading p){color:var(--muted)}
html:root.dark body :is(.active,[aria-selected=true],button[aria-current=true]){background-color:var(--wash);color:var(--module)}
html:root body .app-masthead .bi-theme:hover {background:var(--wash)}
@media(min-width:821px){html:root body .analysis-table thead th {position:sticky;top:0;z-index:2}}
.bi-nav-group {display:block;margin:12px 10px 2px;font-size:11px;color:var(--muted);font-weight:600}
.bi-nav-group:first-child {margin-top:0}
html:root body .sidebar nav a[href="/procurement"] svg,html:root body .sidebar nav a[href="/invoice-ledger"] svg {color:var(--teal-ink)}
html:root body .sidebar nav a[href="/inventory"] svg {color:var(--amber-ink)}
html:root body .sidebar nav a[href="/price-audit"] svg {color:var(--orange-ink)}
html:root body .sidebar nav a:is([href="/documents"],[href="/customers"],[href="/customer-followups"]) svg {color:var(--violet-ink)}
html:root body .login-layout {border-radius:16px;overflow:hidden;box-shadow:var(--panel-shadow)}
html:root body .brand-pane {background:linear-gradient(135deg,var(--blue-wash),var(--teal-wash));color:var(--ink)}
html:root body .auth-card {padding:20px}
html:root body .filter-bar,html:root body .procurement-quality {background:var(--panel);border:1px solid var(--line);border-radius:10px}
html:root body .procurement-quality {border-left:3px solid var(--teal-line)}
html:root body .ops-counts article,html:root body .procurement-summary article:nth-child(n),html:root body .il-summary article {background:var(--wash);color:var(--ink);border-radius:9px}
html:root body .procurement-summary article:nth-child(2),html:root body .ops-counts article:nth-child(2){background:var(--amber-wash)}
html:root body .procurement-summary article:nth-child(3),html:root body .ops-counts article:nth-child(3){background:var(--violet-wash)}
html:root.dark body .period-presets button {background:var(--soft);color:var(--ink)}
html:root.dark body .period-presets button.active {background:var(--blue-wash);color:var(--blue-ink)}
html.dark[data-ui] body .brand,html.dark[data-ui] body .brand span,html.dark[data-ui] body nav a {color:var(--sub)}
html.dark[data-ui] body .sidebar nav a.active {background:var(--blue-wash);color:var(--blue-ink)}
html.dark[data-ui] body :is(.procurement-quality,.ops-disclosure,.ops-task,.ops-daily,.detail-head,.wb-daily-list,.wb-feature-grid a,.account-actions,.table-panel,.il-months,.filter-bar,.subtype-filter,.analysis-menu,.analysis-panel,.document-track,.analysis-table-wrap tbody tr:nth-child(n)){background-color:var(--panel);color:var(--ink)}
html.dark[data-ui] body .metric-failure strong {color:var(--red-ink)}
html:root body .wb-intro {padding:20px}
