:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #14213d;
  --muted: #667085;
  --line: #e6eaf0;
  --blue: #2563eb;
  --blue-dark: #1746a2;
  --teal: #0f9f8f;
  --teal-soft: #e8f8f5;
  --purple: #7c3aed;
  --purple-soft: #f1eafe;
  --orange: #f59e0b;
  --green: #16a36a;
  --red: #e5484d;
  --shadow: 0 12px 34px rgba(29, 41, 57, 0.08);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
.dashboard {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 44px;
}
.page-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.page-nav-link {
  text-decoration: none;
  color: #475467;
  font-weight: 750;
  padding: 9px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
}
.page-nav-link.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #1669d7, #16a3a6);
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.13em;
}
h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}
.subtitle {
  max-width: 900px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}
.month-control {
  min-width: 210px;
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.month-control select {
  width: 100%;
  border: 1px solid #d6dae1;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 11px 13px;
  font: inherit;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.04);
}
.global-kpis {
  display: grid;
  grid-template-columns: 1.15fr repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.global-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 19px;
  box-shadow: 0 5px 18px rgba(16, 24, 40, 0.04);
  min-width: 0;
}
.global-card span,
.global-card small {
  display: block;
  color: var(--muted);
}
.global-card span {
  font-weight: 750;
  font-size: 13px;
}
.global-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: clamp(24px, 2.2vw, 34px);
  letter-spacing: -0.035em;
}
.global-card small {
  font-size: 11px;
  line-height: 1.35;
}
.global-card.gmv-card {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, #1659c7, #0f9f8f);
  box-shadow: 0 14px 32px rgba(22, 89, 199, 0.22);
}
.global-card.gmv-card span,
.global-card.gmv-card small {
  color: rgba(255, 255, 255, 0.82);
}
.product-total-card {
  border-color: #bfe8e1;
  background: linear-gradient(180deg, #fff, #f2fbf9);
}
.recharge-card {
  border-color: #dccdf9;
  background: linear-gradient(180deg, #fff, #f8f5ff);
}
.reconciliation-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) 2.2fr;
  gap: 1px;
  background: #dfe5ec;
  border: 1px solid #dfe5ec;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}
.reconciliation-strip > * {
  background: #fff;
  padding: 13px 15px;
}
.reconciliation-strip div span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.reconciliation-strip div strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}
.reconciliation-strip p {
  margin: 0;
  color: #475467;
  font-size: 12px;
  line-height: 1.45;
}
.channel-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 4px 0 20px;
}
.channel-button {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 18px;
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title value" "small value";
  transition: 0.18s ease;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.04);
}
.channel-button span {
  grid-area: title;
  font-size: 17px;
  font-weight: 850;
}
.channel-button small {
  grid-area: small;
  color: var(--muted);
  margin-top: 3px;
}
.channel-button strong {
  grid-area: value;
  align-self: center;
  font-size: 25px;
}
.channel-button:hover {
  transform: translateY(-1px);
}
.channel-button.active {
  border: 2px solid var(--teal);
  background: var(--teal-soft);
  box-shadow: 0 10px 26px rgba(15, 159, 143, 0.12);
}
.channel-button.recharge.active {
  border-color: var(--purple);
  background: var(--purple-soft);
  box-shadow: 0 10px 26px rgba(124, 58, 237, 0.12);
}
.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 20px 0 14px;
}
.board-header h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.02em;
}
.board-header p:not(.eyebrow) {
  margin: 5px 0 0;
  color: var(--muted);
}
.board-badge {
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}
.board-badge.recharge {
  background: var(--purple-soft);
  color: var(--purple);
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.kpi-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 17px;
  box-shadow: 0 5px 18px rgba(16, 24, 40, 0.04);
}
.kpi-card.accent-card {
  background: linear-gradient(135deg, #0c8f82, #168aad);
  color: #fff;
  border: none;
}
body.recharge-theme .kpi-card.accent-card {
  background: linear-gradient(135deg, #6d28d9, #9333ea);
}
.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.accent-card .kpi-label {
  color: rgba(255, 255, 255, 0.82);
}
.kpi-value {
  margin-top: 9px;
  font-size: clamp(23px, 2.15vw, 33px);
  font-weight: 850;
  letter-spacing: -0.04em;
}
.kpi-change {
  margin-top: 7px;
  color: var(--green);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
}
.accent-card .kpi-change {
  color: rgba(255, 255, 255, 0.85);
}
.kpi-change.negative {
  color: var(--red);
}
.kpi-change.neutral {
  color: var(--muted);
}
.insight-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #dfe5ec;
  border: 1px solid #dfe5ec;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}
.insight-strip > div {
  background: #fff;
  padding: 14px 16px;
  min-width: 0;
}
.insight-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  margin-bottom: 5px;
}
.insight-strip strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 22px 0 14px;
}
.view-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: #475467;
  border-radius: 999px;
  padding: 10px 15px;
  font-weight: 800;
  cursor: pointer;
}
.view-tab.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), var(--teal));
}
body.recharge-theme .view-tab.active {
  background: linear-gradient(135deg, var(--purple), #a855f7);
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.chart-card,
.table-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 19px;
  margin-bottom: 16px;
  overflow: hidden;
}
.card-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}
.card-heading h2 {
  margin: 0;
  font-size: 19px;
}
.card-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.chart-box {
  position: relative;
  min-height: 330px;
}
.bar-chart-box {
  min-height: 420px;
}
.trend-box {
  min-height: 380px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid #edf0f4;
  border-radius: 14px;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 900px;
}
th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid #edf0f4;
  text-align: right;
  font-size: 12px;
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #667085;
  font-weight: 850;
}
th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
  text-align: left;
}
tbody tr:hover {
  background: #fafcff;
}
.rank {
  width: 32px;
  color: #98a2b3;
  font-weight: 850;
}
.product-name {
  font-weight: 780;
  color: #24324a;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.positive {
  color: var(--green);
  font-weight: 800;
}
.negative {
  color: var(--red);
  font-weight: 800;
}
.neutral-text {
  color: var(--muted);
}
.status-pill {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
  background: #eef2f7;
  color: #475467;
}
.status-pill.good {
  background: #e8f8ef;
  color: #137a4b;
}
.status-pill.warn {
  background: #fff4db;
  color: #9a6700;
}
.status-pill.bad {
  background: #ffe9e8;
  color: #b42318;
}
.potential-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-radius: 20px;
  padding: 21px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #eef8ff, #edfcf8);
  border: 1px solid #dcecf4;
}
body.recharge-theme .potential-intro {
  background: linear-gradient(135deg, #f5f0ff, #fcf7ff);
  border-color: #e5d9fb;
}
.potential-intro h2 {
  margin: 0;
}
.potential-intro p:not(.eyebrow) {
  margin: 7px 0 0;
  color: var(--muted);
  max-width: 760px;
}
.potential-stat {
  text-align: right;
}
.potential-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.potential-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}
.mini-kpi-grid,
.missing-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.mini-kpi-grid article,
.missing-summary article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.mini-kpi-grid span,
.missing-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.mini-kpi-grid strong,
.missing-summary strong {
  display: block;
  margin-top: 7px;
  font-size: 23px;
}
footer {
  color: #7b8494;
  font-size: 11px;
  line-height: 1.55;
  margin-top: 18px;
}
.error-box {
  margin-top: 16px;
  border-radius: 14px;
  background: #fff0ef;
  color: #b42318;
  padding: 14px;
}

/* Mobile-friendly bundle section */
.bundle-mobile-list {
  display: none;
  gap: 10px;
}
.bundle-mobile-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 13px;
  border: 1px solid #e5eaf0;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #fbfdff);
}
.bundle-mobile-rank {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #fff4df;
  color: #b45309;
  font-size: 12px;
  font-weight: 900;
}
.bundle-mobile-content {
  min-width: 0;
}
.bundle-mobile-name {
  color: #18243a;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.bundle-mobile-title {
  margin-top: 3px;
  color: #7b8494;
  font-size: 10px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.bundle-mobile-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}
.bundle-mobile-metric {
  min-width: 0;
  padding: 8px 7px;
  border-radius: 10px;
  background: #f7f9fc;
}
.bundle-mobile-metric span,
.bundle-mobile-metric strong {
  display: block;
}
.bundle-mobile-metric span {
  color: #7b8494;
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bundle-mobile-metric strong {
  margin-top: 3px;
  color: #24324a;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.bundle-mobile-share {
  height: 5px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f5;
}
.bundle-mobile-share > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f59e0b, #fb923c);
}

@media (max-width: 1200px) {
  .global-kpis {
    grid-template-columns: repeat(3, 1fr);
  }
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .insight-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 820px) {
  .dashboard {
    width: min(100% - 24px, 1500px);
    padding-top: 16px;
  }
  .topbar {
    flex-direction: column;
  }
  .month-control {
    width: 100%;
  }
  .global-kpis,
  .kpi-grid,
  .mini-kpi-grid,
  .missing-summary {
    grid-template-columns: 1fr 1fr;
  }
  .chart-grid {
    grid-template-columns: 1fr;
  }
  .bundle-chart-grid .chart-card {
    width: 100%;
  }
  .reconciliation-strip {
    grid-template-columns: 1fr 1fr;
  }
  .reconciliation-strip p {
    grid-column: 1/-1;
  }
}
@media (max-width: 560px) {
  .global-kpis,
  .kpi-grid,
  .channel-switch,
  .mini-kpi-grid,
  .missing-summary {
    grid-template-columns: 1fr;
  }
  .insight-strip,
  .reconciliation-strip {
    grid-template-columns: 1fr;
  }
  .board-header {
    align-items: flex-start;
  }
  .channel-button {
    grid-template-columns: 1fr auto;
  }
  .chart-card,
  .table-card {
    padding: 14px;
  }
  .chart-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .bundle-trend-card .chart-box {
    min-height: 300px;
  }
  .top-bundle-chart-desktop {
    display: none;
  }
  .bundle-mobile-list {
    display: grid;
  }
  .top-bundle-card {
    overflow: visible;
  }
  .bundle-mobile-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .bar-chart-box {
    min-height: 360px;
  }
}
@media (max-width: 380px) {
  .bundle-mobile-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .bundle-mobile-metric:last-child {
    grid-column: 1 / -1;
  }
}

/* Search and clearer product names */
.search-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 24px;
  align-items: center;
  margin: 22px 0 14px;
  padding: 20px;
  border: 1px solid #d8e4ef;
  border-radius: 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f1f8ff 52%, #eefbf8 100%);
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}
body.recharge-theme .search-shell {
  border-color: #e1d8f7;
  background: linear-gradient(135deg, #ffffff 0%, #f7f3ff 54%, #fdf7ff 100%);
}
.search-copy h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.02em;
}
.search-copy p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.search-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.search-actions small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 0 13px;
  border: 1px solid #cbd5e1;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.05);
}
.search-input-wrap:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 159, 143, 0.12);
}
body.recharge-theme .search-input-wrap:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}
.search-input-wrap > span {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 23px;
  line-height: 1;
  transform: rotate(-15deg);
}
.search-input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 0;
  font: inherit;
  font-size: 14px;
}
.search-input-wrap input::placeholder {
  color: #98a2b3;
}
.clear-search {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: #475467;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
}
.clear-search:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.search-results {
  margin: 0 0 18px;
  padding: 17px;
  border: 1px solid #dfe7ef;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}
.search-results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.search-results-head strong,
.search-results-head span {
  display: block;
}
.search-results-head strong {
  font-size: 15px;
}
.search-results-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.search-result-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.search-result-group {
  min-width: 0;
  border: 1px solid #e8edf2;
  border-radius: 15px;
  padding: 12px;
  background: #fbfcfe;
}
.search-result-group h3 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 9px;
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.search-result-group h3 span {
  color: #98a2b3;
}
.search-result-list {
  display: grid;
  gap: 7px;
}
.search-result-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #e5eaf0;
  border-radius: 11px;
  background: #fff;
  padding: 10px 11px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.search-result-item:hover {
  border-color: #9ccfc7;
  transform: translateY(-1px);
}
.search-result-main,
.search-result-meta {
  min-width: 0;
}
.search-result-main strong,
.search-result-main small {
  display: block;
}
.search-result-main strong {
  overflow: hidden;
  color: #24324a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-main small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-meta {
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}
body.recharge-theme .search-result-meta {
  color: var(--purple);
}
.search-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 13px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}
.product-identity {
  display: grid;
  gap: 3px;
  min-width: 220px;
  max-width: 520px;
  white-space: normal;
}
.product-primary {
  color: #24324a;
  font-weight: 820;
  line-height: 1.35;
}
.product-secondary {
  color: #7b8494;
  font-size: 10px;
  font-weight: 560;
  line-height: 1.35;
}
.sku-code {
  display: inline-block;
  width: fit-content;
  padding: 4px 7px;
  border-radius: 7px;
  background: #eef4ff;
  color: #1d4ed8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
}
.highlight-match {
  border-radius: 3px;
  background: #fff1a8;
  color: #513c00;
  padding: 0 1px;
}
@media (max-width: 900px) {
  .search-shell {
    grid-template-columns: 1fr;
  }
  .search-result-groups {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .search-actions {
    grid-template-columns: 1fr;
  }
  .clear-search {
    width: 100%;
  }
}
