:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d9e1ee;
  --brand: #176b5b;
  --brand-2: #d9f3e9;
  --accent: #ff7a45;
  --shadow: 0 18px 48px rgba(16, 24, 40, .09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(20px, calc((100vw - 1180px) / 2));
  background: rgba(244, 247, 251, .92);
  border-bottom: 1px solid rgba(217, 225, 238, .8);
  backdrop-filter: blur(14px);
}

.topbar h1, .hero h2, .detail h2 {
  margin: 0;
  line-height: 1.1;
}

.topbar h1 { font-size: 22px; }

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 52px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  padding: 28px 0 22px;
}

.hero h2 {
  max-width: 760px;
  font-size: clamp(32px, 6vw, 64px);
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 92px);
  gap: 10px;
}

.stats div, .card, .controls, .quick-plan {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats div {
  padding: 14px 12px;
  border-radius: 8px;
}

.stats strong {
  display: block;
  font-size: 26px;
}

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

.controls {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
}

label span {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

input:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, .16);
}

.quick-plan {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 18px;
  padding: 14px;
  border-radius: 8px;
}

.quick-plan p {
  margin: 0 0 0 auto;
  color: var(--muted);
}

button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover { border-color: var(--brand); }

.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.ghost {
  background: transparent;
}

.hidden { display: none !important; }

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

.card {
  overflow: hidden;
  border-radius: 8px;
}

.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #e8f5f1, #f7fafc);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.badge-row {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.card-body {
  padding: 12px;
}

.card h3 {
  min-height: 44px;
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.35;
}

.card-meta {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.is-active {
  border-color: var(--accent);
  background: #fff1eb;
  color: #9a3412;
}

.sentinel {
  height: 44px;
}

dialog {
  width: min(980px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 28px 80px rgba(16, 24, 40, .26);
}

dialog::backdrop {
  background: rgba(15, 23, 42, .52);
}

.detail {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 42%) 1fr;
  max-height: min(82vh, 760px);
  background: #fff;
}

.detail img {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: contain;
  background: #eef7f4;
}

.detail-body {
  overflow: auto;
  padding: 28px;
}

.icon-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  font-size: 26px;
  line-height: 1;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin: 18px 0;
}

dl {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px 12px;
  margin: 0 0 20px;
  padding: 14px;
  border-radius: 8px;
  background: #f8fafc;
}

dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; }
ol { padding-left: 22px; line-height: 1.7; }

@media (max-width: 900px) {
  .hero, .detail { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .controls { grid-template-columns: 1fr 1fr; }
  .search { grid-column: 1 / -1; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail img { min-height: 280px; max-height: 42vh; }
}

@media (max-width: 560px) {
  main { width: min(100vw - 20px, 1180px); padding-top: 12px; }
  .topbar { padding: 12px 10px; }
  .hero { padding-top: 18px; }
  .hero h2 { font-size: 34px; }
  .hero-copy { font-size: 16px; }
  .controls { grid-template-columns: 1fr; }
  .quick-plan { align-items: stretch; flex-direction: column; }
  .quick-plan p { margin-left: 0; }
  .grid { grid-template-columns: 1fr; }
  .detail-body { padding: 20px; }
}
