:root {
  --ink: #1c241f;
  --muted: #6d776f;
  --paper: #f6f1e8;
  --panel: #fffaf0;
  --panel-strong: #fff4dc;
  --line: rgba(41, 53, 45, 0.13);
  --green: #1f7a61;
  --green-dark: #0f5745;
  --mint: #b9decf;
  --amber: #d7952f;
  --red: #c94c3a;
  --blue: #346f9f;
  --shadow: 0 24px 70px rgba(53, 48, 37, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 214, 133, 0.38), transparent 28rem),
    radial-gradient(circle at 90% 18%, rgba(111, 169, 145, 0.28), transparent 24rem),
    linear-gradient(135deg, #f9f4eb 0%, #eef3ec 48%, #f6efe1 100%);
}

button,
input {
  font: inherit;
}

.dashboard-shell {
  width: min(1720px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr minmax(260px, 340px);
  gap: 24px;
  min-height: 220px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    linear-gradient(125deg, rgba(255, 250, 240, 0.92), rgba(234, 242, 234, 0.86)),
    repeating-linear-gradient(90deg, rgba(31, 122, 97, 0.06) 0 1px, transparent 1px 18px);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: 18%;
  bottom: -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  border: 52px solid rgba(31, 122, 97, 0.12);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin-bottom: 16px;
  font-size: clamp(32px, 5vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.source-card {
  align-self: start;
  position: relative;
  z-index: 1;
  padding: 22px;
  border: 1px solid rgba(31, 122, 97, 0.22);
  border-radius: 24px;
  background: rgba(255, 250, 240, 0.75);
  backdrop-filter: blur(10px);
}

.source-card span,
.source-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.source-card strong {
  display: block;
  margin: 8px 0 18px;
  font-size: 18px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.kpi-card,
.dealer-card,
.module-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 250, 240, 0.84);
  box-shadow: 0 18px 50px rgba(53, 48, 37, 0.08);
}

.kpi-card {
  min-height: 138px;
  padding: 22px;
}

.kpi-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi-card strong {
  display: block;
  margin: 12px 0 8px;
  font-family: "DIN Alternate", "Avenir Next", sans-serif;
  font-size: clamp(30px, 3.8vw, 54px);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.kpi-card small {
  color: var(--muted);
}

.control-panel {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin: 32px 0 16px;
}

.control-panel h2 {
  margin-bottom: 6px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.control-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-button {
  min-width: 74px;
  padding: 11px 16px;
  border: 1px solid rgba(31, 122, 97, 0.24);
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(255, 250, 240, 0.72);
  cursor: pointer;
}

.filter-button.is-active {
  color: white;
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 10px 24px rgba(31, 122, 97, 0.23);
}

.dealer-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.dealer-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.dealer-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(31, 122, 97, 0.11), transparent 48%);
  pointer-events: none;
}

.dealer-card > * {
  position: relative;
}

.dealer-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dealer-head h3 {
  margin-bottom: 4px;
  font-size: 26px;
}

.achievement-ring {
  --value: 0deg;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--panel) 0 58%, transparent 59%),
    conic-gradient(var(--green) var(--value), rgba(31, 122, 97, 0.13) 0);
  font-weight: 900;
}

.dealer-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mini-metric {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.48);
}

.mini-metric span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.mini-metric strong {
  font-family: "DIN Alternate", "Avenir Next", sans-serif;
  font-size: 22px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.module-card {
  overflow: hidden;
}

.module-card.is-hidden {
  display: none;
}

.module-top {
  padding: 22px 22px 18px;
  background: linear-gradient(135deg, rgba(255, 244, 220, 0.9), rgba(237, 246, 237, 0.8));
  border-bottom: 1px solid var(--line);
}

.module-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.module-title h3 {
  margin-bottom: 6px;
  font-size: 25px;
}

.badge {
  align-self: start;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(31, 122, 97, 0.12);
  font-size: 13px;
  font-weight: 800;
}

.module-scoreboard {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.score-item {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.66);
}

.score-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.score-item strong {
  font-family: "DIN Alternate", "Avenir Next", sans-serif;
  font-size: 21px;
}

.progress-stack {
  display: flex;
  overflow: hidden;
  height: 18px;
  margin-top: 16px;
  border-radius: 999px;
  background: rgba(28, 36, 31, 0.1);
}

.progress-stack span {
  min-width: 2px;
}

.progress-mtd {
  background: var(--green);
}

.progress-future {
  background: var(--amber);
}

.progress-gap {
  background: rgba(28, 36, 31, 0.14);
}

.module-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 18px 22px 22px;
}

.alert-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.alert-box {
  min-height: 92px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.alert-box h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.alert-list {
  display: grid;
  gap: 7px;
}

.alert-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.alert-row strong {
  color: var(--ink);
  font-weight: 800;
}

.table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.warm-table .col-product {
  width: 20%;
}

.warm-table .col-qty {
  width: 7.2%;
}

.warm-table .col-revenue {
  width: 7.5%;
}

.warm-table .col-rate {
  width: 6%;
}

.warm-table .col-stock {
  width: 7.5%;
}

.warm-table .col-daily {
  width: 7%;
}

.warm-table .col-doi {
  width: 7%;
}

.warm-table .col-status {
  width: 9.2%;
}

.cold-table .col-product {
  width: 32%;
}

.cold-table .col-qty {
  width: 10%;
}

.cold-table .col-revenue {
  width: 11%;
}

.cold-table .col-rate {
  width: 8%;
}

.cold-table .col-note {
  width: 9%;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8f2e7;
}

th,
td {
  height: 64px;
  padding: 10px 7px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
  font-size: 13px;
  line-height: 1.25;
}

th {
  height: 44px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.product-cell strong {
  overflow: hidden;
  display: block;
  margin-bottom: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tiny-bar {
  overflow: hidden;
  width: min(122px, 100%);
  height: 7px;
  border-radius: 999px;
  background: rgba(28, 36, 31, 0.1);
}

.tiny-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 28px;
  padding: 6px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

.status-healthy {
  color: var(--green-dark);
  background: rgba(31, 122, 97, 0.13);
}

.status-tight {
  color: #7a4b00;
  background: rgba(215, 149, 47, 0.18);
}

.status-shortage,
.status-stale {
  color: #8e2e22;
  background: rgba(201, 76, 58, 0.14);
}

.status-heavy {
  color: #7b5215;
  background: rgba(215, 149, 47, 0.22);
}

.muted {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .overview-grid,
  .module-grid {
    grid-template-columns: 1fr;
  }

  .hero,
  .dealer-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dashboard-shell {
    width: min(100vw - 24px, 720px);
    padding-top: 14px;
  }

  .hero {
    padding: 24px;
    border-radius: 24px;
  }

  .overview-grid,
  .dealer-metrics,
  .module-scoreboard,
  .alert-strip {
    grid-template-columns: 1fr;
  }

  .control-panel,
  .dealer-head,
  .module-title {
    align-items: stretch;
    flex-direction: column;
  }
}
