:root {
  --ox-bg:        #EFF2ED;   /* pale mist — outdoor/foggy trail tone */
  --ox-surface:   #FFFFFF;
  --ox-ink:       #1F2A24;   /* deep forest charcoal */
  --ox-ink-soft:  #5B6B60;
  --ox-primary:   #2F5233;   /* moss green — brand */
  --ox-primary-soft: #E4ECE2;
  --ox-accent:    #3E6E8E;   /* technical slate blue — hardware/water-repellent gear */
  --ox-accent-soft: #E4EDF2;
  --ox-warm:      #D8A24A;   /* trail-marker amber — highlights */
  --ox-neg:       #B24C3C;   /* brick red — negative deltas only */
  --ox-border:    #DDE3DB;
  --ox-sidebar-bg:#182620;
  --ox-sidebar-ink: #C9D6CD;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

body {
  background: var(--ox-bg);
  color: var(--ox-ink);
  font-family: var(--font-body);
  font-size: 14px;
  margin: 0;
}

h1, h2, h3, .ox-brand-name {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

/* ---------- Layout shell ---------- */
.ox-shell {
  display: flex;
  min-height: 100vh;
}

.ox-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--ox-sidebar-bg);
  color: var(--ox-sidebar-ink);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(circle at 15% 8%, rgba(255,255,255,0.04) 0, transparent 40%),
    repeating-linear-gradient(115deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 26px);
}

.ox-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ox-brand-mark {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ox-primary);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  border-radius: 6px;
}

.ox-brand-name {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  line-height: 1.2;
}

.ox-brand-sub {
  font-size: 11px;
  color: var(--ox-sidebar-ink);
  opacity: 0.7;
}

.ox-nav-group {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(201,214,205,0.5);
  margin: 4px 8px 8px;
  font-weight: 600;
}

.ox-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ox-nav-link {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ox-sidebar-ink);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease;
}

.ox-nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.ox-nav-link.active {
  background: var(--ox-primary);
  color: #fff;
}

.ox-nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}

.ox-nav-link.active .ox-nav-dot { opacity: 1; }

.ox-nav-desc {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  opacity: 0.5;
  line-height: 1.3;
  padding-left: 15px;
  width: 100%;
  margin-top: 1px;
}

.ox-nav-link.active .ox-nav-desc { opacity: 0.75; }
.ox-nav-link:hover .ox-nav-desc { opacity: 0.7; }

.ox-nav-group-future { margin-top: 28px; }

.ox-future-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px;
  font-size: 13px;
  color: rgba(201,214,205,0.45);
}

.ox-future-tag {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255,255,255,0.08);
  padding: 2px 7px;
  border-radius: 3px;
}

/* ---------- Main content ---------- */
.ox-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ox-topbar {
  background: var(--ox-surface);
  border-bottom: 1px solid var(--ox-border);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ox-page-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--ox-ink);
}

.ox-topbar-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ox-topbar-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ox-topbar-form label {
  font-size: 12px;
  color: var(--ox-ink-soft);
  font-weight: 500;
  white-space: nowrap;
}

.ox-content {
  padding: 28px 32px 48px;
  max-width: 1400px;
}

/* ---------- Cards / KPI tiles ---------- */
.ox-card {
  background: var(--ox-surface);
  border: 1px solid var(--ox-border);
  border-radius: 10px;
  padding: 20px 22px;
}

.ox-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.ox-kpi {
  background: var(--ox-surface);
  border: 1px solid var(--ox-border);
  border-radius: 10px;
  padding: 16px 18px;
}

.ox-kpi-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ox-ink-soft);
  font-weight: 600;
  margin-bottom: 6px;
}

.ox-kpi-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--ox-ink);
}

.ox-kpi-sub {
  font-size: 12px;
  color: var(--ox-ink-soft);
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* ---------- Tables ---------- */
.ox-table-wrap {
  background: var(--ox-surface);
  border: 1px solid var(--ox-border);
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: hidden;
}

table.ox-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.ox-table th {
  text-align: right;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ox-ink-soft);
  font-weight: 600;
  padding: 10px 14px;
  background: var(--ox-primary-soft);
  border-bottom: 1px solid var(--ox-border);
  white-space: nowrap;
}

table.ox-table th:first-child,
table.ox-table td:first-child {
  text-align: left;
}

table.ox-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--ox-border);
  text-align: right;
  font-family: var(--font-mono);
  white-space: nowrap;
}

table.ox-table td.ox-label-cell {
  font-family: var(--font-body);
  text-align: left;
  white-space: normal;
  max-width: 320px;
}

table.ox-table tbody tr:hover {
  background: var(--ox-bg);
}

table.ox-table tbody tr:last-child td { border-bottom: none; }

table.ox-table tbody tr.ox-product-row.active { background: var(--ox-primary-soft); }

.ox-pos { color: var(--ox-primary); }
.ox-neg { color: var(--ox-neg); }
.ox-muted { color: var(--ox-ink-soft); }

.ox-delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.ox-delta-badge.up { background: var(--ox-primary-soft); color: var(--ox-primary); }
.ox-delta-badge.down { background: #F6E7E4; color: var(--ox-neg); }

.ox-chip-year-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
  border-top: 1px solid var(--ox-border);
}

.ox-chip-year-group:first-of-type {
  border-top: none;
}

.ox-chip-year-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ox-ink);
  background: var(--ox-bg);
  border: 1px solid var(--ox-border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  margin-right: 4px;
  min-width: 52px;
  text-align: center;
}

.ox-chip-year-label:hover {
  border-color: var(--ox-primary);
  color: var(--ox-primary);
}

.ox-chip-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.ox-chip-year-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.ox-chip-year {
  font-weight: 700;
  background: var(--ox-accent-soft);
  border-color: var(--ox-accent);
  color: var(--ox-accent);
  min-width: 52px;
}

.ox-chip-year.active {
  background: var(--ox-accent);
  border-color: var(--ox-accent);
  color: #fff;
}

/* ---------- Month filter chips + table footer totals ---------- */
.ox-chip-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
}

.ox-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--ox-border);
  background: var(--ox-surface);
  color: var(--ox-ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ox-chip:hover {
  border-color: var(--ox-primary);
}

.ox-chip.active {
  background: var(--ox-primary);
  border-color: var(--ox-primary);
  color: #fff;
}

.ox-chip-action {
  font-size: 11px;
  color: var(--ox-accent);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  padding: 0 4px;
}

table.ox-table tfoot td {
  font-weight: 700;
  background: var(--ox-primary-soft);
  border-top: 2px solid var(--ox-primary);
  font-family: var(--font-mono);
  color: var(--ox-ink);
}

table.ox-table tfoot td.ox-label-cell {
  font-family: var(--font-body);
}

table.ox-table th.ox-total-col,
table.ox-table td.ox-total-col {
  font-weight: 700;
  background: var(--ox-accent-soft);
  border-left: 2px solid var(--ox-accent);
  border-right: 2px solid var(--ox-accent);
}

table.ox-table tbody tr:hover td.ox-total-col {
  background: #d8e4ea;
}

/* ---------- Sortable tables + export toolbar ---------- */
.ox-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ox-table-toolbar-hint {
  font-size: 11px;
  color: var(--ox-ink-soft);
}

.ox-table-toolbar-actions {
  display: flex;
  gap: 6px;
}

.ox-btn-export {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border: 1px solid var(--ox-border);
  background: var(--ox-surface);
  border-radius: 6px;
  cursor: pointer;
  color: var(--ox-ink-soft);
  transition: all 0.15s ease;
}

.ox-btn-export:hover {
  background: var(--ox-primary-soft);
  color: var(--ox-primary);
  border-color: var(--ox-primary);
}

table.ox-table th.ox-sortable-th {
  cursor: pointer;
  user-select: none;
}

table.ox-table th.ox-sortable-th:hover {
  background: var(--ox-accent-soft);
  color: var(--ox-accent);
}

table.ox-table th.sort-asc::after {
  content: ' \2191';
}

table.ox-table th.sort-desc::after {
  content: ' \2193';
}

.ox-search-field {
  margin-bottom: 14px;
  max-width: 320px;
}

/* ---------- Tab header (tabs + inline selectors on same row) ---------- */
.ox-tab-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--ox-border);
}

.ox-tab-header .ox-tabs {
  border-bottom: none;
  margin-bottom: 0;
}

.ox-tab-header .ox-inline-selectors {
  margin-bottom: 6px;
}

/* ---------- Inline platform/shop selectors (content area) ---------- */
.ox-inline-selectors {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.ox-inline-selector-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ox-inline-selector-form label {
  font-size: 12px;
  color: var(--ox-ink-soft);
  font-weight: 500;
  white-space: nowrap;
}

.ox-inline-selectors-standalone {
  margin-bottom: 22px;
}

/* ---------- Tabs (Trend / Compare) ---------- */
.ox-tabs {
  border-bottom: 1px solid var(--ox-border);
  margin-bottom: 24px;
}

.ox-tabs .nav-link {
  color: var(--ox-ink-soft);
  font-weight: 500;
  font-size: 14px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 4px;
  margin-right: 24px;
}

.ox-tabs .nav-link:hover {
  color: var(--ox-ink);
  border-color: var(--ox-border);
}

.ox-tabs .nav-link.active {
  color: var(--ox-primary);
  border-color: var(--ox-primary);
  background: transparent;
}

.ox-variance-table td.ox-delta-pos { color: var(--ox-primary); }
.ox-variance-table td.ox-delta-neg { color: var(--ox-neg); }

/* ---------- Business flags (Overview page) ---------- */
.ox-flag-card {
  background: var(--ox-surface);
  border: 1px solid var(--ox-border);
  border-left: 4px solid var(--ox-warm);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.ox-flag-platform-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ox-accent);
  background: var(--ox-primary-soft);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.ox-flag-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ox-ink);
}

.ox-flag-card p {
  font-size: 13px;
  color: var(--ox-ink-soft);
  margin: 0 0 8px;
}

.ox-flag-card a.ox-flag-action {
  font-size: 12.5px;
  color: var(--ox-accent);
  text-decoration: none;
  font-weight: 500;
}

.ox-flag-card a.ox-flag-action:hover {
  text-decoration: underline;
}

.ox-flag-empty {
  background: var(--ox-primary-soft);
  border: 1px solid var(--ox-border);
  border-left: 4px solid var(--ox-primary);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
  font-size: 13.5px;
  color: var(--ox-ink);
}

/* ---------- Danger zone (data management) ---------- */
.ox-danger-card {
  background: var(--ox-surface);
  border: 1px solid #E8C6C0;
  border-left: 4px solid var(--ox-neg);
  border-radius: 10px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.ox-danger-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ox-neg);
  margin: 0 0 6px;
}

.ox-danger-card p {
  font-size: 13px;
  color: var(--ox-ink-soft);
  margin-bottom: 14px;
}

.ox-stat-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.ox-stat-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--ox-bg);
  border: 1px solid var(--ox-border);
  border-radius: 20px;
  padding: 3px 10px;
  color: var(--ox-ink-soft);
}

.ox-btn-danger {
  background: var(--ox-neg);
  border-color: var(--ox-neg);
  color: #fff;
}

.ox-btn-danger:hover {
  background: #9a3d30;
  border-color: #9a3d30;
  color: #fff;
}

.ox-btn-danger:disabled {
  background: #E8C6C0;
  border-color: #E8C6C0;
  color: #fff;
  cursor: not-allowed;
}

/* ---------- Filter bar (month / compare selectors) ---------- */
.ox-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--ox-surface);
  border: 1px solid var(--ox-border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 22px;
}

.ox-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ox-filter-field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ox-ink-soft);
  font-weight: 600;
}

.ox-filter-field select {
  min-width: 160px;
}

/* ---------- Section headers ---------- */
.ox-section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--ox-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ox-section-title:first-child { margin-top: 0; }

.ox-chart-card {
  background: var(--ox-surface);
  border: 1px solid var(--ox-border);
  border-radius: 10px;
  padding: 20px 22px;
  margin-bottom: 24px;
}

.ox-empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--ox-ink-soft);
}

.ox-empty-state-icon {
  font-family: var(--font-mono);
  font-size: 28px;
  margin-bottom: 8px;
  color: var(--ox-border);
}

.ox-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Narrow fixed-width chart beside a wide (often horizontally-scrolling) table */
.ox-chart-table-row {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .ox-shell { flex-direction: column; }
  .ox-sidebar { width: 100%; }
  .ox-two-col { grid-template-columns: 1fr; }
  .ox-chart-table-row { grid-template-columns: 1fr; }
  .ox-tab-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .ox-tab-header .ox-inline-selectors { margin-bottom: 8px; }
}

/* ---------- Price Simulator ---------- */
.ox-sim-label {
  font-size: 12px;
  color: var(--ox-ink-soft);
  font-weight: 500;
}

.ox-sim-hint {
  display: block;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--ox-ink-soft);
  margin-top: 3px;
}

.ox-sim-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ox-border);
  flex-wrap: wrap;
}

.ox-sim-toggle-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ox-sim-subcheck {
  padding: 6px 0 10px 4px;
  font-size: 12px;
  color: var(--ox-ink-soft);
}

.ox-sim-bar {
  display: flex;
  height: 24px;
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
  background: var(--ox-primary-soft);
}

.ox-sim-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.ox-sim-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ox-ink-soft);
}

.ox-sim-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.ox-sim-ideal-price {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--ox-primary);
}

.ox-sim-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--ox-border);
  background: var(--ox-primary-soft);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.ox-sim-chip-del {
  color: var(--ox-neg) !important;
}


/* ---------- Login page ---------- */
.ox-login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ox-sidebar-bg);
}

.ox-login-card {
  background: var(--ox-surface);
  border: 1px solid var(--ox-border);
  border-radius: 12px;
  padding: 32px 36px;
  width: 100%;
  max-width: 360px;
}

.ox-login-error {
  background: var(--ox-neg);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Monthly Report ─────────────────────────────────────── */
.ox-narrative {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--ox-muted);
  border-left: 3px solid var(--ox-accent, #6366f1);
  padding: 0.6rem 1rem;
  margin-bottom: 1.25rem;
  background: rgba(99,102,241, 0.05);
}

.ox-subsection-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ox-muted);
  margin-bottom: 0.5rem;
}

.ox-report-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ox-muted);
  border-bottom: 2px solid var(--ox-border, #e2e8f0);
}

.ox-report-table tfoot tr {
  border-top: 2px solid var(--ox-border, #e2e8f0);
}

.ox-best-sellers {
  padding-left: 1.2rem;
  font-size: 0.875rem;
  line-height: 1.9;
  margin-bottom: 0;
}

.ox-best-sellers .ox-bs-name { color: var(--ox-text); }
.ox-best-sellers .ox-bs-qty  { color: var(--ox-muted); font-size: 0.78rem; margin-left: 0.25rem; }

/* ── Monthly Report charts ──────────────────────────────── */
.ox-chart-wrap {
  position: relative;
  height: 220px;
  margin-top: 1rem;
}

/* ── Print / PDF ─────────────────────────────────────────── */
@media print {
  .ox-sidebar,
  .ox-topbar,
  .d-print-none { display: none !important; }

  .ox-shell { display: block !important; }
  .ox-main  { margin: 0 !important; padding: 0 !important; }
  .ox-content { padding: 0.5rem !important; }

  .ox-card {
    break-inside: avoid;
    page-break-after: always;
    border: 1px solid #ccc !important;
    margin-bottom: 0 !important;
    padding: 0.75rem;
  }
  .ox-card:last-child { page-break-after: auto; }

  table { font-size: 9pt; width: 100% !important; }

  .nav-tabs { display: none !important; }
  .tab-pane { display: none !important; }
  .tab-pane.show.active { display: block !important; }

  canvas { max-width: 100% !important; }

  h2.ox-section-title { font-size: 16pt; margin-bottom: 0.25rem; }

  form .form-select { display: none !important; }
}
