:root {
  color-scheme: light;
  --ink: #12141d;
  --muted: #777d8b;
  --line: #dde2ea;
  --panel: #ffffff;
  --surface: #f1f4f8;
  --sidebar: #15151e;
  --lime: #ccff29;
  --violet: #7768e8;
  --green: #3bd98b;
  --blue: #3577ff;
  --amber: #ffb84d;
  --danger: #ef5b66;
  --shadow: 0 18px 50px rgba(34, 38, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  width: 306px;
  min-height: 100vh;
  padding: 44px 20px 26px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: #fff;
}

.brand {
  margin-bottom: 52px;
  padding-left: 4px;
}

.brand-name {
  font-size: 29px;
  font-weight: 950;
  letter-spacing: 0;
}

.brand-name span {
  color: var(--lime);
}

.brand-subtitle,
.eyebrow {
  letter-spacing: 5px;
  font-size: 12px;
  font-weight: 900;
}

.brand-subtitle {
  margin-top: 16px;
  color: #9799a5;
}

.nav-list,
.nav-group {
  display: grid;
  gap: 14px;
}

.nav-group {
  margin-top: 34px;
}

.nav-group p {
  margin: 0 0 2px 20px;
  color: #696b78;
  font-size: 13px;
  font-weight: 900;
}

.nav-item {
  width: 100%;
  min-height: 64px;
  padding: 0 18px;
  border: 0;
  border-radius: 18px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  background: transparent;
  color: #92939e;
  text-align: left;
  font-size: 17px;
  font-weight: 850;
}

.nav-item.slim {
  min-height: 46px;
}

.nav-item i {
  font-style: normal;
  color: #8b8d99;
  font-weight: 900;
}

.nav-item b {
  min-width: 34px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(119, 104, 232, 0.24);
  color: #bcb4ff;
  font-size: 12px;
}

.nav-item.active {
  color: #171921;
  background: var(--lime);
  box-shadow: 0 0 0 4px #7768e8, 0 22px 44px rgba(204, 255, 41, 0.18);
}

.nav-item.active i,
.nav-item.active b {
  color: #171921;
}

.nav-item.active b {
  background: rgba(255, 255, 255, 0.32);
}

.sidebar-footer {
  margin-top: auto;
  color: #8d909a;
}

.mini-status {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
}

.mini-status i,
.sync-pill i,
.store-card p i {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(59, 217, 139, 0.12);
}

.workspace {
  flex: 1;
  min-width: 0;
  padding: 36px 54px 54px;
}

.topbar {
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow,
.lede,
p {
  margin: 0;
}

.eyebrow {
  color: var(--violet);
}

h1,
h2 {
  margin: 0;
}

h1 {
  margin-top: 10px;
  font-size: 44px;
  line-height: 1.08;
  letter-spacing: 0;
}

.lede {
  margin-top: 14px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

.top-actions {
  padding-top: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.sync-pill,
.soft-button,
.primary-button {
  min-height: 50px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 900;
}

.sync-pill {
  padding: 0 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
}

.soft-button,
.primary-button {
  border: 1px solid var(--line);
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.88);
  color: #242833;
}

.primary-button {
  border-color: #151722;
  background: #11131a;
  color: #fff;
}

.small {
  min-height: 42px;
  padding: 0 16px;
  font-size: 14px;
}

.control-bar {
  min-height: 112px;
  margin-bottom: 16px;
  padding: 28px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto 176px 176px auto auto;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.store-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.store-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #11131a;
  color: var(--lime);
  font-size: 21px;
  font-weight: 950;
}

.store-card h2 {
  font-size: 22px;
  line-height: 1.2;
}

.store-card p {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.range-tabs {
  padding: 6px;
  border-radius: 999px;
  display: grid;
  grid-auto-flow: column;
  gap: 2px;
  background: #eef1f5;
}

.range-tabs button {
  min-width: 84px;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6d7280;
  font-weight: 900;
}

.range-tabs button.active {
  background: #fff;
  color: #11131a;
  box-shadow: 0 8px 20px rgba(25, 30, 38, 0.08);
}

.date-field,
.api-field {
  display: grid;
  gap: 7px;
}

.date-field span,
.api-field span {
  color: #777d8b;
  font-size: 12px;
  font-weight: 900;
}

input {
  width: 100%;
  height: 50px;
  border: 1px solid #d9e0e8;
  border-radius: 12px;
  padding: 0 13px;
  background: #f9fbfd;
  color: var(--ink);
  outline: none;
  font-weight: 850;
}

input:focus {
  border-color: #a8d625;
  box-shadow: 0 0 0 4px rgba(204, 255, 41, 0.18);
}

.api-panel {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #e0e6ee;
  border-radius: 16px;
  display: grid;
  grid-template-columns: minmax(280px, 520px) auto 1fr;
  gap: 14px;
  align-items: end;
  background: rgba(255, 255, 255, 0.62);
}

.api-panel p {
  padding-bottom: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.45fr repeat(3, minmax(190px, 1fr));
  gap: 18px;
}

.hero-card,
.metric-card,
.workspace-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.hero-card {
  min-height: 504px;
  grid-row: span 2;
  padding: 32px;
  background: #151821;
  color: #fff;
}

.card-head,
.top-products-head,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-head span,
.top-products-head span {
  color: #9aa0ad;
  font-weight: 850;
}

.card-head b,
.top-products-head b {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.07);
  color: #c4c8d1;
  font-size: 13px;
}

.hero-card > strong {
  display: block;
  margin-top: 58px;
  font-size: clamp(48px, 5vw, 72px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-card > small {
  display: block;
  margin-top: 22px;
  color: #8f96a5;
  font-weight: 850;
}

.top-products-head {
  margin-top: 44px;
}

.product-bars {
  margin-top: 24px;
  display: grid;
  gap: 22px;
}

.product-bar {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 1.4fr auto;
  gap: 14px;
  align-items: center;
}

.product-bar span {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e9edf3;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8377ef, #cfff29);
}

.product-bar b {
  color: #fff;
  font-size: 14px;
}

.metric-card {
  min-height: 240px;
  padding: 30px;
  display: grid;
  align-content: space-between;
}

.metric-card .card-head b {
  background: #f0f2f5;
  color: #727887;
}

.metric-card strong {
  margin-top: 24px;
  display: block;
  font-size: clamp(38px, 3.8vw, 56px);
  line-height: 0.96;
  letter-spacing: 0;
}

#ctrValue,
#cartRateValue,
#conversionValue {
  font-size: 28px;
  line-height: 1.15;
}

.metric-card small {
  color: var(--muted);
  font-weight: 800;
}

.insight-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.2fr 0.85fr;
  gap: 18px;
}

.workspace-panel {
  padding: 24px;
}

.panel-title {
  margin-bottom: 22px;
}

.panel-title h2 {
  margin-top: 6px;
  font-size: 22px;
}

.panel-title > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.chart {
  height: 260px;
  display: grid;
  grid-template-columns: repeat(10, minmax(18px, 1fr));
  gap: 12px;
  align-items: end;
}

.trend-bar {
  min-height: 22px;
  border-radius: 999px 999px 6px 6px;
  position: relative;
  background: linear-gradient(180deg, #2f73ff, #b7f833);
}

.trend-bar::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  color: #8b909b;
  font-size: 11px;
  font-weight: 900;
}

.funnel {
  display: grid;
  gap: 14px;
}

.funnel-row {
  display: grid;
  gap: 8px;
}

.funnel-row p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #4b5260;
  font-weight: 900;
}

.funnel-track {
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: #edf1f5;
}

.funnel-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #151821, #7768e8, #ccff29);
}

.table-panel {
  grid-column: span 2;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 15px 10px;
  border-bottom: 1px solid #edf0f4;
  text-align: left;
}

th {
  color: #858b98;
  font-size: 12px;
  font-weight: 950;
}

td {
  color: #222631;
  font-weight: 850;
}

td small {
  display: block;
  margin-top: 5px;
  color: #858b98;
  font-weight: 750;
}

.diagnosis-list {
  display: grid;
  gap: 12px;
}

.diagnosis-item {
  padding: 16px;
  border: 1px solid #e5ebf2;
  border-radius: 14px;
  background: #fbfcfe;
}

.diagnosis-item b {
  display: block;
  margin-bottom: 8px;
}

.diagnosis-item p {
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
  font-weight: 760;
}

.diagnosis-item.warning {
  border-color: rgba(255, 184, 77, 0.5);
  background: #fff9ed;
}

.diagnosis-item.good {
  border-color: rgba(59, 217, 139, 0.45);
  background: #f1fff8;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  transform: translateY(28px);
  opacity: 0;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 18px;
  border-radius: 14px;
  background: #151821;
  color: #fff;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.2);
  font-weight: 850;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1600px) {
  .workspace {
    padding: 30px;
  }

  .control-bar {
    grid-template-columns: minmax(260px, 1fr) 1fr 160px 160px auto auto;
  }

  .range-tabs button {
    min-width: 72px;
  }
}

@media (max-width: 1280px) {
  body {
    display: block;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
  }

  .nav-list,
  .nav-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-bar,
  .api-panel,
  .dashboard-grid,
  .insight-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-card,
  .table-panel {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 24px 16px;
  }

  .topbar,
  .top-actions {
    display: grid;
  }

  h1 {
    font-size: 36px;
  }

  .nav-list,
  .nav-group,
  .control-bar,
  .api-panel,
  .dashboard-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .table-panel {
    grid-column: auto;
  }

  .range-tabs {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 16px;
  }

  .metric-card {
    min-height: 190px;
  }
}
