:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f1f3fa;
  --text: #17182b;
  --muted: #72768d;
  --border: #e7e8f1;
  --accent: #7457e8;
  --hp: #e94b9b;
  --fp: #3979e8;
  --ok: #1fa463;
  --warn: #d98217;
  --bad: #de3d73;
  --shadow: 0 16px 42px rgba(39, 42, 68, 0.08);
  color: var(--text);
  background: var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(140deg, rgba(116, 87, 232, 0.055), transparent 34%),
    linear-gradient(30deg, transparent 56%, rgba(57, 121, 232, 0.045)),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.page {
  width: min(1440px, calc(100% - 56px));
  margin: 0 auto;
  padding: 40px 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(620px, 1.4fr);
  gap: 28px;
  align-items: center;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 16px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(42px, 4.4vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 128px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 22px 26px;
}

.metric + .metric {
  border-left: 1px solid var(--border);
}

.metric span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric strong {
  color: var(--text);
  font-size: 34px;
  line-height: 1.05;
}

.metric-hp strong {
  color: var(--hp);
}

.metric-fp strong {
  color: var(--fp);
}

.metric-time strong {
  font-size: 20px;
  line-height: 1.35;
}

.toolbar {
  display: flex;
  align-items: center;
  margin: 28px 0 26px;
}

.search {
  height: 48px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(39, 42, 68, 0.055);
}

.search span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.search svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 16px;
}

.search input::placeholder {
  color: var(--muted);
}

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

.stock-card {
  min-height: 178px;
  display: grid;
  grid-template-columns: minmax(158px, 0.92fr) minmax(190px, 1fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(39, 42, 68, 0.055);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.stock-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  box-shadow: 0 18px 38px rgba(39, 42, 68, 0.08);
}

.group-side {
  min-height: 132px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 22px 24px;
  border-right: 1px solid var(--border);
}

.group-logo-wrap {
  width: 120px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111322;
}

.group-logo {
  max-width: 100%;
  max-height: 54px;
  object-fit: contain;
}

.group-logo-wrap picture {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 72px;
}

.logo-fallback {
  display: none;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
}

.logo-missing .group-logo {
  display: none;
}

.logo-missing .logo-fallback {
  display: block;
}

.logo-bts {
  max-height: 56px;
}

.logo-bts,
.logo-seventeen,
.logo-txt,
.logo-enhypen,
.logo-le-sserafim,
.logo-newjeans,
.logo-boynextdoor,
.logo-illit,
.logo-tws {
  max-width: 74px;
  max-height: 74px;
}

.group-name {
  color: var(--text);
  font-size: 17px;
  font-weight: 850;
  letter-spacing: 0;
  text-align: center;
}

.stock-side {
  display: grid;
  gap: 18px;
  padding: 24px 26px;
}

.stock-status {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 850;
}

.stock-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.stock-status.ok {
  background: color-mix(in srgb, var(--ok) 13%, transparent);
  color: var(--ok);
}

.stock-status.low {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
}

.stock-status.out {
  background: color-mix(in srgb, var(--bad) 13%, transparent);
  color: var(--bad);
}

.counts {
  display: grid;
  gap: 13px;
}

.count {
  display: grid;
  grid-template-columns: 48px minmax(42px, auto) 1fr;
  gap: 16px;
  align-items: baseline;
  min-height: 34px;
}

.count .label {
  font-size: 18px;
  font-weight: 900;
}

.count.hp .label {
  color: var(--hp);
}

.count.fp .label {
  color: var(--fp);
}

.count b {
  color: var(--text);
  font-size: 25px;
  line-height: 1;
}

.recovery-list {
  color: var(--warn);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.35;
}

.empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1120;
    --surface: #181a2a;
    --surface-soft: #1d2032;
    --text: #f4f5fa;
    --muted: #a1a5ba;
    --border: rgba(255, 255, 255, 0.08);
    --accent: #8066e8;
    --hp: #f05ca9;
    --fp: #5d8ff0;
    --ok: #4fca86;
    --warn: #f0a034;
    --bad: #f05c8f;
    --shadow: none;
  }

  body {
    background:
      linear-gradient(140deg, rgba(128, 102, 232, 0.08), transparent 34%),
      linear-gradient(30deg, transparent 58%, rgba(93, 143, 240, 0.055)),
      var(--bg);
  }

  .eyebrow,
  .summary,
  .search,
  .stock-card {
    background: var(--surface);
    box-shadow: none;
  }

  .group-logo-wrap {
    color: #f4f5fa;
  }

  .stock-card:hover {
    box-shadow: none;
  }
}

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

  .stock-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 18px, 1440px);
    padding: 12px 0 18px;
  }

  .topbar {
    gap: 12px;
  }

  .eyebrow {
    margin-bottom: 8px;
    padding: 5px 10px;
    font-size: 12px;
  }

  h1 {
    font-size: 30px;
  }

  .summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 72px;
    border-radius: 14px;
  }

  .metric {
    gap: 5px;
    min-width: 0;
    padding: 10px 8px;
  }

  .metric + .metric {
    border-left: 1px solid var(--border);
  }

  .metric:nth-child(n + 3) {
    border-top: 0;
  }

  .metric span {
    font-size: 11px;
  }

  .metric strong {
    font-size: 20px;
  }

  .metric-time strong {
    font-size: 13px;
    line-height: 1.18;
  }

  .toolbar {
    margin: 12px 0;
  }

  .search {
    width: 100%;
    height: 40px;
    border-radius: 12px;
    padding: 0 12px;
  }

  .search input {
    font-size: 14px;
  }

  .stock-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stock-card {
    position: relative;
    min-height: 116px;
    grid-template-columns: 1fr;
    align-content: start;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(39, 42, 68, 0.045);
  }

  .group-side {
    min-height: 0;
    gap: 5px;
    padding: 10px 5px 4px;
    border-right: 0;
    border-bottom: 0;
  }

  .group-logo-wrap {
    width: 52px;
    height: 40px;
  }

  .group-logo-wrap picture {
    max-height: 40px;
  }

  .logo-bts,
  .logo-seventeen,
  .logo-txt,
  .logo-enhypen,
  .logo-le-sserafim,
  .logo-newjeans,
  .logo-boynextdoor,
  .logo-illit,
  .logo-tws {
    max-width: 40px;
    max-height: 40px;
  }

  .group-name {
    max-width: 100%;
    font-size: 11px;
    line-height: 1.08;
    overflow-wrap: anywhere;
  }

  .stock-side {
    gap: 5px;
    padding: 0 6px 8px;
  }

  .stock-status {
    position: absolute;
    top: 7px;
    right: 7px;
    gap: 3px;
    padding: 2px 4px;
    border-radius: 6px;
    font-size: 9px;
    line-height: 1.1;
  }

  .stock-status::before {
    width: 4px;
    height: 4px;
  }

  .counts {
    gap: 3px;
  }

  .count {
    display: flex;
    min-height: 18px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  .count .label {
    font-size: 11px;
  }

  .count b {
    font-size: 16px;
  }

  .recovery-list {
    width: 100%;
    font-size: 9px;
    line-height: 1.12;
    text-align: center;
  }
}
