/* ─── Reset / base ───────────────────────────────────────────────────────── */
.ops-root *,
.ops-root *::before,
.ops-root *::after { box-sizing: border-box; }

/* ─── Shell: sidebar + content ────────────────────────────────────────────── */
.ops-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  color: #1a1a1a;
  display: flex;
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.ops-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.ops-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  color: #f1f5f9;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-bottom: 1px solid #1e293b;
}

.ops-sidebar-brand svg { color: #3b82f6; flex-shrink: 0; }

.ops-nav {
  padding: 12px 0 20px;
  flex: 1;
}

.ops-nav-section {
  margin-bottom: 4px;
}

.ops-nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #475569;
  padding: 10px 18px 4px;
  text-transform: uppercase;
}

/* ─── Sidebar nav buttons (ops-page-tab repurposed) ──────────────────────── */
.ops-page-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px 9px 18px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #94a3b8;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  border-radius: 0;
}

.ops-page-tab svg { flex-shrink: 0; opacity: 0.75; transition: opacity 0.12s; }

.ops-page-tab:hover {
  background: #1e293b;
  color: #e2e8f0;
}
.ops-page-tab:hover svg { opacity: 1; }

.ops-page-tab.active {
  background: #1d4ed8;
  color: #fff;
  font-weight: 600;
}
.ops-page-tab.active svg { opacity: 1; }

/* ─── Content area ────────────────────────────────────────────────────────── */
.ops-content {
  flex: 1;
  min-width: 0;
  background: #f3f4f6;
  display: flex;
  flex-direction: column;
}

.ops-content-header {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  padding: 16px 28px;
}

.ops-content-title {
  font-size: 20px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}

.ops-page {
  padding: 24px 28px 40px;
}

/* ─── Overview tab ────────────────────────────────────────────────────────── */
.ops-ov-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.ops-ov-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px 24px;
}
.ops-ov-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ca3af;
  margin-bottom: 6px;
}
.ops-ov-card-value {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
}
.ops-ov-chart-wrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.ops-ov-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 16px;
}
.ops-ov-metrics-table {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}
.ops-ov-metrics-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #f3f4f6;
}
.ops-ov-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.ops-ov-metric {
  padding: 16px 20px;
  border-right: 1px solid #f3f4f6;
  border-bottom: 1px solid #f3f4f6;
}
.ops-ov-metric:nth-child(4n) { border-right: none; }
.ops-ov-metric-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ca3af;
  margin-bottom: 4px;
}
.ops-ov-metric-value {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}
.ops-ov-metric-sub {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

/* ─── Coming soon placeholder ────────────────────────────────────────────── */
.ops-coming-soon {
  padding: 80px 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 18px;
  font-weight: 600;
}
.ops-coming-soon-sub {
  font-size: 13px;
  font-weight: 400;
  margin-top: 8px;
  color: #b0b7c3;
}

/* ─── Product Sales ───────────────────────────────────────────────────────── */
.ops-ps-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.ops-ps-compare-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ops-ps-label {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.ops-ps-btn-group {
  display: flex;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  overflow: hidden;
}

.ops-ps-period-btn,
.ops-ps-cmp-btn,
.ops-ps-metric-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: #f9fafb;
  cursor: pointer;
  color: #555;
  border-right: 1px solid #d1d5db;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.ops-ps-period-btn:last-child,
.ops-ps-cmp-btn:last-child,
.ops-ps-metric-btn:last-child { border-right: none; }

.ops-ps-period-btn:hover,
.ops-ps-cmp-btn:hover,
.ops-ps-metric-btn:hover { background: #f0f2f5; color: #374151; }

.ops-ps-period-btn.active,
.ops-ps-cmp-btn.active,
.ops-ps-metric-btn.active { background: #2563eb; color: #fff; }

/* Period & compare buttons (Meta Ads + Overview) */
.ops-meta-period-btn,
.ops-meta-cmp-btn,
.ops-ov-period-btn,
.ops-ov-cmp-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: #f9fafb;
  cursor: pointer;
  color: #555;
  border-right: 1px solid #d1d5db;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.ops-meta-period-btn:last-child,
.ops-meta-cmp-btn:last-child,
.ops-ov-period-btn:last-child,
.ops-ov-cmp-btn:last-child { border-right: none; }
.ops-meta-period-btn:hover,
.ops-meta-cmp-btn:hover,
.ops-ov-period-btn:hover,
.ops-ov-cmp-btn:hover { background: #f0f2f5; color: #374151; }
.ops-meta-period-btn.active,
.ops-meta-cmp-btn.active,
.ops-ov-period-btn.active,
.ops-ov-cmp-btn.active { background: #2563eb; color: #fff; }

/* Card comparison delta */
.ops-ps-card-delta {
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  min-height: 14px;
}
.ops-ps-card-delta--up   { color: #16a34a; }
.ops-ps-card-delta--down { color: #dc2626; }
.ops-ps-card-delta--neu  { color: #6b7280; }

/* Summary cards */
.ops-ps-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.ops-ps-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 16px 18px;
}

.ops-ps-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 6px;
}

.ops-ps-card-value {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
}

.ops-ps-card-change { margin-top: 4px; font-size: 12px; }

.ops-chg-up    { color: #16a34a; font-weight: 600; }
.ops-chg-down  { color: #dc2626; font-weight: 600; }
.ops-chg-neutral { color: #9ca3af; }

/* Google Ads section header */
.ops-ads-section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 32px 0 16px;
  padding-top: 24px;
  border-top: 2px solid #e5e7eb;
}
.ops-ads-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
}

/* Chart */
.ops-ps-chart-wrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.ops-ps-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ops-ps-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.ops-panel--spaced {
  margin-top: 16px;
}

.ops-panel--spaced .ops-ps-chart-header {
  padding: 14px 18px 0;
  margin-bottom: 0;
}

.ops-panel-sub {
  padding: 6px 18px 12px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid #e5e7eb;
}

.ops-td--insight {
  max-width: 200px;
  white-space: normal;
  word-break: break-word;
  font-size: 12px;
  color: #374151;
}

/* Table outer */
.ops-ps-table-outer {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}

.ops-ps-table-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
  gap: 8px;
}

.ops-ps-period-label { font-size: 12px; color: #6b7280; }

.ops-td--cmp  { color: #6b7280; }
.ops-td--muted { color: #9ca3af; font-size: 12px; }

.ops-ps-error {
  padding: 16px 20px;
  color: #dc2626;
  font-size: 13px;
}

@media (max-width: 768px) {
  .ops-root { flex-direction: column; }
  .ops-sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .ops-nav { display: flex; flex-wrap: wrap; padding: 6px; }
  .ops-nav-section { margin-bottom: 0; }
  .ops-nav-section-label { display: none; }
  .ops-page-tab { padding: 7px 12px; font-size: 12px; }
  .ops-page { padding: 16px; }
  .ops-ps-summary { grid-template-columns: 1fr 1fr; }
  .ops-ps-toolbar { flex-direction: column; align-items: flex-start; }
}

.ops-gate {
  padding: 60px 20px;
  text-align: center;
  font-size: 15px;
  color: #555;
}

/* ─── Settings panel ─────────────────────────────────────────────────────── */
.ops-settings-panel {
  border-left: 3px solid #e05252;
  padding: 14px 18px 10px;
  margin-bottom: 20px;
  background: #fff;
}

.ops-settings-heading {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}

.ops-settings-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ops-settings-label {
  font-size: 13px;
  color: #333;
}

.ops-settings-label--gap { margin-left: 20px; }

.ops-settings-num {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}

.ops-settings-unit {
  color: #666;
  font-size: 12px;
}

.ops-btn-link {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  text-decoration: underline;
}
.ops-btn-link:hover { color: #1d4ed8; }

.ops-saved-msg {
  font-size: 12px;
  color: #16a34a;
}

.ops-cat-overrides {
  margin-top: 8px;
  font-size: 13px;
}
.ops-cat-overrides summary {
  cursor: pointer;
  color: #2563eb;
  font-size: 12px;
  user-select: none;
}
.ops-cat-overrides-body {
  padding: 10px 0 4px 12px;
}
.ops-hint { color: #777; font-size: 12px; margin: 0 0 8px; }

/* ─── Main panel ─────────────────────────────────────────────────────────── */
.ops-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}

.ops-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.ops-inventory-title {
  font-size: 17px;
  font-weight: 700;
}

/* ─── View tabs ──────────────────────────────────────────────────────────── */
.ops-view-tabs {
  display: flex;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  overflow: hidden;
}

.ops-view-tab {
  padding: 6px 14px;
  font-size: 13px;
  border: none;
  background: #f9fafb;
  cursor: pointer;
  color: #555;
  border-right: 1px solid #d1d5db;
  transition: background 0.15s;
}
.ops-view-tab:last-child { border-right: none; }
.ops-view-tab:hover { background: #f0f2f5; }
.ops-view-tab.active {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}

/* ─── Status badges ──────────────────────────────────────────────────────── */
.ops-status-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.ops-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 100px;
  background: #f9fafb;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  color: #333;
  transition: background 0.1s;
}
.ops-status-badge:hover { background: #f0f2f5; }
.ops-status-badge.active { background: #e0edff; border-color: #93c5fd; }

.ops-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.ops-dot--stockout { background: #374151; }
.ops-dot--critical { background: #ef4444; }
.ops-dot--below    { background: #f59e0b; }
.ops-dot--healthy  { background: #84cc16; }
.ops-dot--high     { background: #22c55e; }
.ops-dot--over     { background: #16a34a; }
.ops-dot--nodata   { background: #9ca3af; }

.ops-badge-pct { color: #777; font-weight: 400; }

/* ─── Load bar ───────────────────────────────────────────────────────────── */
.ops-load-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.ops-sales-period {
  font-size: 12px;
  color: #555;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ops-btn-primary {
  padding: 6px 16px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ops-btn-primary:hover { background: #1d4ed8; }
.ops-btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }

.ops-load-status {
  font-size: 12px;
  color: #777;
}

.ops-select-sm {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
  background: #fff;
  cursor: pointer;
}

/* ─── Loading ────────────────────────────────────────────────────────────── */
.ops-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: #555;
  font-size: 13px;
}

.ops-spinner {
  width: 20px; height: 20px;
  border: 2px solid #d1d5db;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: ops-spin 0.7s linear infinite;
}
@keyframes ops-spin { to { transform: rotate(360deg); } }

/* ─── View container ─────────────────────────────────────────────────────── */
.ops-view { padding: 0; }

/* ─── Toolbar ────────────────────────────────────────────────────────────── */
.ops-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.ops-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}
.ops-search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}
.ops-search-input {
  width: 100%;
  padding: 5px 8px 5px 26px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
}
.ops-search-input:focus { outline: none; border-color: #93c5fd; }

.ops-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #333;
  cursor: pointer;
}

.ops-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  border: none;
  background: #d1d5db;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.ops-toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.ops-toggle.active { background: #2563eb; }
.ops-toggle.active::after { transform: translateX(16px); }

.ops-sort-label { font-size: 12px; color: #555; }

.ops-sort-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #f9fafb;
  cursor: pointer;
  color: #555;
}
.ops-sort-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}

/* ─── Expand/Collapse bar ────────────────────────────────────────────────── */
.ops-expand-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 6px 18px;
  border-bottom: 1px solid #e5e7eb;
  background: #fafafa;
}

.ops-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-size: 12px;
  color: #2563eb;
  cursor: pointer;
  padding: 2px 0;
}
.ops-text-btn:hover { color: #1d4ed8; }

/* ─── Stock Cover Table ──────────────────────────────────────────────────── */
.ops-table-wrap {
  overflow-x: auto;
}

.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ops-th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
  position: relative;
}

.ops-th-btn {
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ops-th-btn:hover { color: #374151; }
.ops-th-btn--active { color: #2563eb; }

.ops-ps-th-btn {
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.ops-ps-th-btn:hover { color: #374151; }
.ops-ps-th-btn--active { color: #2563eb; }
.ops-ps-sort-arrow { font-size: 10px; }

.ops-th-arrow { font-size: 10px; }

.ops-th-product  { min-width: 200px; }
.ops-th-category { min-width: 100px; }
.ops-th-variant  { min-width: 80px; }
.ops-th-num      { min-width: 60px; text-align: right; }
.ops-th-inc      { min-width: 64px; text-align: right; cursor: help; }
.ops-th-status   { min-width: 90px; text-align: center; }
.ops-th-cover    { min-width: 310px; }
.ops-th-weeks    { min-width: 65px; text-align: right; }

/* Cover axis ticks */
.ops-cover-axis {
  display: flex;
  margin-top: 3px;
  padding-left: 0;
  height: 10px;
  position: relative;
}
.ops-cover-axis-tick {
  position: absolute;
  font-size: 9px;
  color: #9ca3af;
  transform: translateX(-50%);
}

/* Table rows */
.ops-tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.1s;
}
.ops-tr:hover { background: #fafafa; }

.ops-tr--category {
  background: #fafafa;
  font-weight: 600;
}
.ops-tr--category:hover { background: #f3f4f6; }

.ops-tr--product { }
.ops-tr--variant {
  background: #fff;
  color: #444;
}

.ops-td {
  padding: 7px 12px;
  vertical-align: middle;
}
.ops-td--right { text-align: right; }
.ops-td--center { text-align: center; }
.ops-td--num { text-align: right; font-variant-numeric: tabular-nums; }

/* Product cell with indent + chevron */
.ops-product-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ops-indent-1 { padding-left: 14px; }
.ops-indent-2 { padding-left: 28px; }

.ops-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
  color: #9ca3af;
  transition: transform 0.2s;
}
.ops-chevron.expanded { transform: rotate(90deg); }
.ops-chevron svg { display: block; }

.ops-product-name {
  font-weight: 500;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.ops-variant-name { color: #555; }

.ops-product-sub {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 1px;
}

/* Category % badge */
.ops-cat-pct {
  font-size: 11px;
  color: #6b7280;
  font-weight: 400;
  margin-left: 4px;
}

/* Variant count badge */
.ops-variant-count {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 400;
  white-space: nowrap;
}

/* Status pills */
.ops-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.ops-pill--stockout { background: #f3f4f6; color: #374151; }
.ops-pill--critical { background: #fee2e2; color: #b91c1c; }
.ops-pill--below    { background: #fef3c7; color: #92400e; }
.ops-pill--healthy  { background: #dcfce7; color: #166534; }
.ops-pill--high     { background: #bbf7d0; color: #15803d; }
.ops-pill--over     { background: #d1fae5; color: #065f46; }
.ops-pill--nodata   { background: #f3f4f6; color: #6b7280; }

/* ─── Stock Cover Bar ─────────────────────────────────────────────────────── */
.ops-sc-bar {
  display: flex;
  align-items: center;
  position: relative;
  height: 20px;
}

.ops-sc-cells {
  display: flex;
  gap: 1px;
  align-items: center;
}

.ops-sc-cell {
  width: 11px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Cell colors */
.ops-cell--over     { background: #16a34a; }
.ops-cell--high     { background: #86efac; } /* light green for approaching desired */
.ops-cell--healthy  { background: #4ade80; }
.ops-cell--below    { background: #f59e0b; }
.ops-cell--critical { background: #ef4444; }
.ops-cell--empty    { background: #e5e7eb; }
.ops-cell--nodata   { background: #e5e7eb; }

/* Lead time dashed vertical line */
.ops-sc-bar { position: relative; }
.ops-sc-lead-line {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 0;
  border-left: 1.5px dashed #9ca3af;
  pointer-events: none;
}

/* Weeks value */
.ops-weeks-val {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}
.ops-weeks-val--null { color: #9ca3af; }

/* ─── Size Mix View ───────────────────────────────────────────────────────── */
.ops-view-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid #e5e7eb;
}
.ops-label-sm { font-size: 12px; color: #555; }

.ops-mix-stats {
  display: flex;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.ops-stat-box {
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 10px 16px;
  min-width: 100px;
}
.ops-stat-box-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 4px;
}
.ops-stat-box-value {
  font-size: 22px;
  font-weight: 700;
  color: #111;
  font-variant-numeric: tabular-nums;
}

.ops-chart-container {
  padding: 18px 18px 8px;
  position: relative;
}

.ops-chart-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  font-size: 11px;
  color: #555;
  margin-top: 6px;
  padding-bottom: 8px;
}
.ops-legend-swatch {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.ops-legend-swatch--blue { background: #3b82f6; }
.ops-legend-swatch--grey { background: #9ca3af; }

/* Size by category accordion */
.ops-size-by-cat {
  padding: 0 18px 18px;
}

.ops-cat-section {
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  margin-top: 10px;
  overflow: hidden;
}

.ops-cat-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f9fafb;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border: none;
  width: 100%;
  text-align: left;
}
.ops-cat-section-header:hover { background: #f3f4f6; }

.ops-cat-section-body {
  padding: 12px 14px;
  border-top: 1px solid #e5e7eb;
}

/* ─── Category Mix View ──────────────────────────────────────────────────── */
.ops-chart-container--horizontal {
  padding: 18px;
  min-height: 300px;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.ops-footer {
  font-size: 11px;
  color: #9ca3af;
  padding: 8px 0 0;
}

/* ─── Utility ────────────────────────────────────────────────────────────── */
.ops-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}
.ops-btn-sm:hover { background: #f9fafb; }

/* ─── Toolbar separator + upload button ─────────────────────────────────── */
.ops-toolbar-sep {
  width: 1px;
  height: 20px;
  background: #e5e7eb;
  margin: 0 2px;
  flex-shrink: 0;
}
.ops-btn-link--sm {
  font-size: 12px;
  padding: 0 4px;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
}
.ops-btn-link--sm:hover { color: #2563eb; text-decoration: underline; }

/* ─── Upload Preview Modal ───────────────────────────────────────────────── */
.ops-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.ops-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 680px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ops-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.ops-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}
.ops-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.ops-modal-close:hover { color: #374151; }
.ops-modal-summary {
  display: flex;
  gap: 12px;
  padding: 10px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
  flex-shrink: 0;
}
.ops-modal-sum-good { color: #16a34a; font-weight: 500; }
.ops-modal-sum-warn { color: #d97706; font-weight: 500; }
.ops-modal-body {
  overflow-y: auto;
  flex: 1;
}
.ops-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ops-modal-table th {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e5e7eb;
}
.ops-modal-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
.ops-modal-table tbody tr:last-child td { border-bottom: none; }
.ops-modal-row--warn td { background: #fffbeb; }
.ops-modal-prod { font-weight: 500; color: #111827; }
.ops-modal-var { color: #6b7280; font-size: 11px; }
.ops-modal-notfound { color: #d97706; font-style: italic; }
.ops-modal-num { text-align: right; font-variant-numeric: tabular-nums; }
.ops-modal-ok { color: #16a34a; font-weight: 600; }
.ops-modal-warn { color: #d97706; font-weight: 600; }
.ops-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

/* ─── Purchase Orders / INC column ──────────────────────────────────────── */
.ops-td--inc {
  cursor: pointer;
  min-width: 64px;
  text-align: right;
  vertical-align: middle;
}
.ops-td--inc:hover { background: #f0f7ff; }
.ops-td--inc-ro { text-align: right; vertical-align: middle; }

.ops-inc-val {
  font-weight: 500;
  color: #2563eb;
}
.ops-inc-empty {
  color: #d1d5db;
  font-size: 13px;
}
.ops-td--inc:hover .ops-inc-empty {
  color: #9ca3af;
}
.ops-inc-date-sub {
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
  white-space: nowrap;
}

.ops-inc-editor {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 2px;
  min-width: 110px;
}
.ops-inc-input {
  width: 68px;
  padding: 3px 5px;
  font-size: 12px;
  border: 1px solid #3b82f6;
  border-radius: 3px;
  outline: none;
  text-align: right;
}
.ops-inc-date-input {
  width: 100%;
  padding: 3px 5px;
  font-size: 11px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  outline: none;
}
.ops-inc-actions {
  display: flex;
  gap: 4px;
}
.ops-inc-save {
  padding: 2px 8px;
  font-size: 11px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}
.ops-inc-save:hover { background: #1d4ed8; }
.ops-inc-cancel {
  padding: 2px 6px;
  font-size: 11px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  cursor: pointer;
}

/* Projected values shown below current values */
.ops-weeks-projected {
  font-size: 10px;
  color: #16a34a;
  margin-top: 2px;
  white-space: nowrap;
}
.ops-proj-status {
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
  white-space: nowrap;
}

/* ─── Growth tab ─────────────────────────────────────────────────────────── */

.ops-gr-view-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  margin: 20px 0 0;
}

.ops-gr-view-tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.ops-gr-view-tab:hover { color: #374151; }

.ops-gr-view-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.ops-gr-view {
  margin-top: 0;
  border-top: none;
  border-radius: 0 0 6px 6px;
}

.ops-gr-footnote {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 12px;
}

/* ─── Cohort grid ────────────────────────────────────────────────────────── */

.ops-cohort-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 100%;
}

.ops-cohort-th {
  padding: 6px 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
  background: #f9fafb;
}

.ops-cohort-th-label {
  text-align: left;
  min-width: 90px;
}

.ops-cohort-td {
  padding: 5px 10px;
  text-align: center;
  font-size: 12px;
  border-bottom: 1px solid #f3f4f6;
  white-space: nowrap;
  min-width: 52px;
}

.ops-cohort-td-label {
  text-align: left;
  font-weight: 500;
  color: #374151;
}

.ops-cohort-td-size {
  color: #6b7280;
}

.ops-cohort-td-empty {
  background: #f9fafb;
}

/* ─── Win-back stats ─────────────────────────────────────────────────────── */

.ops-gr-winback-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

/* ─── GMROI badges ───────────────────────────────────────────────────────── */

.ops-gmroi-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.ops-gmroi-badge--good {
  background: #dcfce7;
  color: #15803d;
}

.ops-gmroi-badge--ok {
  background: #fef9c3;
  color: #854d0e;
}

.ops-gmroi-badge--bad {
  background: #fee2e2;
  color: #b91c1c;
}

/* ─── Claude Chat ──────────────────────────────────────────────────────────── */

.ops-chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #1a1a2e;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  transition: background .15s, transform .15s;
}
.ops-chat-fab:hover { background: #16213e; transform: scale(1.06); }

.ops-chat-panel {
  position: fixed;
  bottom: 90px;
  right: 28px;
  z-index: 8999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.ops-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #1a1a2e;
  color: #fff;
  flex-shrink: 0;
}
.ops-chat-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .3px;
}
.ops-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ops-chat-icon-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: background .12s, color .12s;
}
.ops-chat-icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

.ops-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.ops-chat-welcome {
  color: #6b7280;
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
  margin: auto 0;
  padding: 16px 8px;
}
.ops-chat-welcome p { margin: 0 0 6px; }
.ops-chat-hint { font-size: 11.5px; color: #9ca3af; }

.ops-chat-msg { display: flex; }
.ops-chat-msg--user { justify-content: flex-end; }
.ops-chat-msg--assistant { justify-content: flex-start; }

.ops-chat-bubble {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.ops-chat-msg--user .ops-chat-bubble {
  background: #1a1a2e;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ops-chat-msg--assistant .ops-chat-bubble {
  background: #f3f4f6;
  color: #111827;
  border-bottom-left-radius: 4px;
}
.ops-chat-bubble code {
  background: rgba(0,0,0,.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}
.ops-chat-msg--user .ops-chat-bubble code { background: rgba(255,255,255,.18); }

.ops-chat-cursor {
  display: inline-block;
  width: 8px;
  height: 13px;
  background: #6b7280;
  border-radius: 2px;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: ops-blink .8s step-end infinite;
}
@keyframes ops-blink { 50% { opacity: 0; } }

.ops-chat-footer {
  border-top: 1px solid #e5e7eb;
  padding: 10px 12px;
  flex-shrink: 0;
  background: #fafafa;
}

.ops-chat-ctx-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #6b7280;
  margin-bottom: 8px;
  cursor: pointer;
}
.ops-chat-ctx-toggle input { cursor: pointer; }

.ops-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ops-chat-textarea {
  flex: 1;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  font-family: inherit;
  background: #fff;
  color: #111;
  outline: none;
  transition: border-color .15s;
  min-height: 38px;
  max-height: 100px;
  overflow-y: auto;
}
.ops-chat-textarea:focus { border-color: #1a1a2e; }
.ops-chat-textarea::placeholder { color: #9ca3af; }

.ops-chat-send-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: #1a1a2e;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, opacity .15s;
}
.ops-chat-send-btn:hover { background: #16213e; }
.ops-chat-send-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ops-root { padding: 10px 12px 30px; }
  .ops-panel-header { flex-direction: column; gap: 10px; align-items: flex-start; }
  .ops-toolbar { gap: 6px; }
  .ops-search-wrap { min-width: 140px; }
  .ops-th-product { min-width: 140px; }
  .ops-product-name { max-width: 180px; }
}
