/* ON2 Operations - Overview dashboard (v7.16, 2026-11-01).
 * Two looks on one layout: data-ovx-theme="dark" (navy, glowing cards) or "light" (white cards). The switch is
 * #ovx-theme-btn (js/overview.js); the choice is kept in this browser (on2_ovx_theme). Chart parts are inline SVG
 * coloured through these variables, so switching needs no redraw. Loaded after app.css (and after erp-theme.css in
 * the ERP build), only styles .ovx* classes. */
.ovx {
  --ov-bg: transparent; --ov-card: #ffffff; --ov-border: #e2e8f0; --ov-text: #0d1f3c; --ov-muted: #64748b;
  --ov-grid: #e5e7eb; --ov-track: #eef2f7; --ov-hover: #f1f5f9; --ov-glow: 0;
  --ov-cyan: #0891b2; --ov-blue: #2563eb; --ov-green: #059669; --ov-amber: #d97706; --ov-teal: #0d9488;
  --ov-red: #dc2626; --ov-rose: #e11d48; --ov-purple: #7c3aed; --ov-gray: #94a3b8;
  --ov-good: #059669; --ov-bad: #dc2626;
  color: var(--ov-text);
  background: var(--ov-bg);
  border-radius: 18px;
  padding: 4px 2px 8px;
}
.ovx[data-ovx-theme="dark"] {
  --ov-bg: radial-gradient(900px 500px at 0% 0%, rgba(34,211,238,.10), transparent 60%),
           radial-gradient(800px 500px at 100% 100%, rgba(59,130,246,.12), transparent 60%),
           linear-gradient(160deg, #0a1630 0%, #0d1d3d 55%, #0b1a36 100%);
  --ov-card: rgba(255,255,255,.035); --ov-border: rgba(148,163,184,.18); --ov-text: #e6edf7; --ov-muted: #93a4bf;
  --ov-grid: rgba(148,163,184,.14); --ov-track: rgba(148,163,184,.14); --ov-hover: rgba(255,255,255,.06); --ov-glow: 1;
  --ov-cyan: #22d3ee; --ov-blue: #3b82f6; --ov-green: #22c55e; --ov-amber: #fbbf24; --ov-teal: #2dd4bf;
  --ov-red: #f43f5e; --ov-rose: #fb7185; --ov-purple: #a78bfa; --ov-gray: #64748b;
  --ov-good: #4ade80; --ov-bad: #fb7185;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(2,8,23,.35);
}

/* header */
.ovx-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.ovx-title { font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.ovx-sub { font-size: 12px; color: var(--ov-muted); margin-top: 2px; }
.ovx-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ovx-chip { font-size: 12px; color: var(--ov-muted); border: 1px solid var(--ov-border); background: var(--ov-card);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.ovx-chip b { color: var(--ov-text); font-weight: 800; }
.ovx-chip:hover { background: var(--ov-hover); }
.ovx-theme-btn { font: inherit; font-size: 12px; font-weight: 700; color: var(--ov-text); background: var(--ov-card);
  border: 1px solid var(--ov-border); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.ovx-theme-btn:hover { background: var(--ov-hover); }

/* number cards */
.ovx-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.ovx-kpi { --c: var(--ov-cyan); position: relative; display: grid; grid-template-columns: 1fr auto; align-items: start;
  background: var(--ov-card); border: 1px solid var(--ov-border); border-top: 3px solid var(--c);
  border-radius: 16px; padding: 14px 16px 12px; cursor: pointer; transition: transform .15s, box-shadow .15s;
  box-shadow: 0 1px 2px rgba(15,27,45,.05), 0 8px 22px rgba(15,27,45,.06); }
.ovx[data-ovx-theme="dark"] .ovx-kpi {
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 16%, transparent), rgba(255,255,255,.02) 70%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 12%, transparent), 0 0 22px color-mix(in srgb, var(--c) 22%, transparent),
              inset 0 1px 0 rgba(255,255,255,.06); }
.ovx-kpi:hover, .ovx-kpi:focus-visible { transform: translateY(-2px); outline: none; }
.ovx-kpi-label { grid-column: 1; grid-row: 1; font-size: 13px; font-weight: 600; color: var(--ov-text); opacity: .9; }
.ovx-kpi-ico { grid-column: 2; grid-row: 1 / span 2; width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center;
  justify-content: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.ovx-kpi-ico svg { width: 22px; height: 22px; }
.ovx[data-ovx-theme="dark"] .ovx-kpi-ico svg { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 70%, transparent)); }
.ovx-kpi-value { grid-column: 1; grid-row: 2; font-size: 32px; font-weight: 800; line-height: 1.15; margin-top: 4px; color: var(--ov-text); }
.ovx-kpi-foot { grid-column: 1 / -1; font-size: 12px; color: var(--ov-muted); margin-top: 4px; min-height: 16px; }
.ovx-up-good, .ovx-down-good { color: var(--ov-good); font-weight: 700; }
.ovx-up-bad, .ovx-down-bad { color: var(--ov-bad); font-weight: 700; }
.ovx-cyan { --c: var(--ov-cyan); } .ovx-blue { --c: var(--ov-blue); } .ovx-green { --c: var(--ov-green); }
.ovx-amber { --c: var(--ov-amber); } .ovx-teal { --c: var(--ov-teal); } .ovx-red { --c: var(--ov-red); }
.ovx-rose { --c: var(--ov-rose); } .ovx-purple { --c: var(--ov-purple); }

/* panels */
.ovx-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ovx-panel { background: var(--ov-card); border: 1px solid var(--ov-border); border-radius: 16px; padding: 16px 18px; min-width: 0;
  box-shadow: 0 1px 2px rgba(15,27,45,.04), 0 8px 22px rgba(15,27,45,.05); }
.ovx[data-ovx-theme="dark"] .ovx-panel { box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.ovx-span2 { grid-column: span 2; } .ovx-span3 { grid-column: 1 / -1; }
.ovx-panel-title { font-size: 15px; font-weight: 700; color: var(--ov-text); }
.ovx-panel-sub { font-size: 12px; color: var(--ov-muted); margin: 2px 0 10px; }
.ovx-count { font-size: 12px; font-weight: 500; color: var(--ov-muted); }
.ovx-empty { color: var(--ov-muted); font-size: 13px; padding: 10px 2px; }

/* svg charts */
.ovx-svg { width: 100%; height: auto; display: block; overflow: visible; }
.ovx-svg .g { stroke: var(--ov-grid); stroke-width: 1; }
.ovx-svg .t { fill: var(--ov-muted); font-size: 11px; font-family: inherit; }
.ovx-svg .v { fill: var(--ov-text); font-size: 12px; font-weight: 700; font-family: inherit; }
.ovx-svg .hit { fill: transparent; cursor: pointer; }
.ovx-svg .hit:hover + .bar, .ovx-svg .bar:hover { filter: brightness(1.15); }
.ovx-svg .dot { stroke: var(--ov-card); stroke-width: 2; }
.ovx[data-ovx-theme="dark"] .ovx-svg .dot { stroke: #0d1d3d; }
.ovx[data-ovx-theme="dark"] .ovx-svg .glow { filter: drop-shadow(0 0 5px currentColor); }
.ovx-legend { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--ov-muted); }
.ovx-legend b { color: var(--ov-text); }
.ovx-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.ovx-bg-ca { background: var(--ov-teal); } .ovx-bg-us { background: var(--ov-blue); }

/* donut + its legend (product tiles) */
#ovx-donut { max-width: 230px; margin: 0 auto 8px; }
.ovx-legend-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.ovx-leg { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 6px; border-radius: 8px; cursor: pointer; min-width: 0; }
.ovx-leg:hover { background: var(--ov-hover); }
.ovx-leg-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ov-muted); }
.ovx-leg-n { font-weight: 800; color: var(--ov-text); order: 2; }

/* horizontal bars (completed products) - count first in the markup (the tests read it), shown last */
.ovx-hbar { display: grid; grid-template-columns: minmax(80px, 38%) 1fr 34px; align-items: center; gap: 10px;
  padding: 5px 6px; border-radius: 8px; cursor: pointer; font-size: 12px; }
.ovx-hbar:hover { background: var(--ov-hover); }
.ovx-hbar-n { order: 3; text-align: right; font-weight: 800; color: var(--ov-text); }
.ovx-hbar-l { order: 1; color: var(--ov-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ovx-hbar-t { order: 2; height: 10px; border-radius: 6px; background: var(--ov-track); overflow: hidden; }
.ovx-hbar-f { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--ov-teal), var(--ov-green)); }
.ovx[data-ovx-theme="dark"] .ovx-hbar-f { box-shadow: 0 0 10px color-mix(in srgb, var(--ov-green) 60%, transparent); }

/* latest orders table */
.ovx-table-wrap { overflow-x: auto; }
.ovx-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ovx-table th { text-align: left; font-weight: 600; color: var(--ov-muted); font-size: 11.5px; padding: 6px 8px;
  border-bottom: 1px solid var(--ov-border); background: none; position: static; white-space: nowrap; }
.ovx-table td { padding: 8px; border-bottom: 1px solid var(--ov-border); color: var(--ov-text); white-space: nowrap;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ovx-table tbody tr { cursor: pointer; }
.ovx-table tbody tr:hover td { background: var(--ov-hover); }
.ovx-table tbody tr:last-child td { border-bottom: 0; }

/* status pills */
.ovx-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  color: var(--p); background: color-mix(in srgb, var(--p) 15%, transparent); border: 1px solid color-mix(in srgb, var(--p) 40%, transparent); }
.ovx-p-red { --p: var(--ov-red); } .ovx-p-amber { --p: var(--ov-amber); } .ovx-p-green { --p: var(--ov-green); }
.ovx-p-cyan { --p: var(--ov-cyan); } .ovx-p-gray { --p: var(--ov-gray); } .ovx-p-blue { --p: var(--ov-blue); }

/* alert lists */
.ovx-list { max-height: 360px; overflow-y: auto; padding-right: 2px; margin-top: 8px; }
.ovx-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; cursor: pointer;
  border-bottom: 1px solid var(--ov-border); }
.ovx-row:last-child { border-bottom: 0; }
.ovx-row:hover { background: var(--ov-hover); }
.ovx-row-main { flex: 1; min-width: 0; }
.ovx-row-title { font-size: 13px; font-weight: 600; color: var(--ov-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ovx-row-detail { font-size: 11.5px; color: var(--ov-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* narrower screens */
@media (max-width: 1150px) {
  .ovx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ovx-span3 { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .ovx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .ovx-grid { grid-template-columns: minmax(0, 1fr); }
  .ovx-span2 { grid-column: auto; }
  .ovx[data-ovx-theme="dark"] { padding: 12px; }
  .ovx-kpis { gap: 10px; }
  .ovx-kpi { padding: 12px; }
  .ovx-kpi-value { font-size: 26px; }
  .ovx-kpi-ico { width: 32px; height: 32px; }
  .ovx-head-right { width: 100%; }
}
@media print {   /* always print the light colours */
  .ovx, .ovx[data-ovx-theme="dark"] { background: none; box-shadow: none;
    --ov-card: #fff; --ov-border: #e2e8f0; --ov-text: #0d1f3c; --ov-muted: #64748b; --ov-grid: #e5e7eb; --ov-track: #eef2f7; }
  .ovx-theme-btn { display: none; }
}
