:root {
  --ink: #1d2433;
  --muted: #687386;
  --line: #d9dee8;
  --surface: #ffffff;
  --band: #f4f7fb;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --warm: #d97706;
  --rose: #be3f61;
  --blue: #2563eb;
  --shadow: 0 14px 34px rgba(29, 36, 51, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.10), transparent 34%),
    linear-gradient(225deg, rgba(217, 119, 6, 0.12), transparent 38%),
    #eef3f8;
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 32px clamp(18px, 4vw, 56px) 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

main {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto 36px;
}

.time-box {
  min-width: 160px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.time-box span,
.summary-grid span,
.field label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.time-box strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.control-band,
.workspace,
.source-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.control-band {
  display: grid;
  grid-template-columns: 180px 150px minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

select,
input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.primary-button,
.secondary-button,
.live-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  padding: 0 14px;
  border-color: var(--line);
  background: #fff;
}

.head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.mall-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.mall-card {
  display: grid;
  gap: 10px;
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(29, 36, 51, 0.05);
}

.mall-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.mall-logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
}

.mall-card strong {
  display: block;
  font-size: 15px;
}

.mall-card span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.summary-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.exclude-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.exclude-note strong {
  margin-right: 4px;
}

.exclude-note span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #f0c4c4;
  border-radius: 999px;
  background: #fff7f7;
  color: #9f1239;
  font-size: 13px;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  overflow: hidden;
}

.category-panel {
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

.panel-title {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title span {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.panel-title strong {
  display: block;
  font-size: 22px;
}

.category-tabs {
  display: grid;
}

.category-tab {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  width: 100%;
  min-height: 78px;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.category-tab.active {
  background: #fff;
  border-left: 5px solid var(--accent);
  padding-left: 13px;
}

.rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #e8f3f1;
  color: var(--accent-dark);
  font-weight: 900;
}

.category-tab strong {
  display: block;
}

.category-tab span:last-child {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.products-panel {
  min-width: 0;
}

.products-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.products-head p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.products-head h2 {
  margin: 0;
  font-size: 26px;
}

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

.product-card {
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  min-height: 154px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-name {
  display: flex;
  align-items: center;
  margin: 16px 0;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.32;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.live-link {
  min-height: 38px;
  margin-top: 12px;
  background: #f1f6f6;
  color: var(--accent-dark);
}

.live-link:hover {
  background: #dff0ed;
}

.rise {
  color: var(--accent-dark);
}

.fall {
  color: var(--rose);
}

.trend-meter {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.trend-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--warm));
}

.trend-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.empty {
  grid-column: 1 / -1;
  padding: 38px;
  color: var(--muted);
  text-align: center;
}

.source-note {
  margin-top: 14px;
  padding: 16px 18px;
}

.source-note p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .control-band {
    grid-template-columns: repeat(2, 1fr);
  }

  .grow,
  .primary-button {
    grid-column: span 2;
  }

  .mall-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .category-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .category-tabs {
    grid-template-columns: repeat(5, minmax(180px, 1fr));
    overflow-x: auto;
  }

  .category-tab {
    border-right: 1px solid var(--line);
  }

  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .app-header,
  .products-head {
    align-items: stretch;
    flex-direction: column;
  }

  .control-band,
  .summary-grid,
  .mall-strip,
  .product-grid {
    grid-template-columns: 1fr;
  }

  .grow,
  .primary-button {
    grid-column: span 1;
  }
}
