:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --soft: #f0f4f7;
  --line: #dce4ec;
  --text: #17202a;
  --muted: #667586;
  --accent: #16a085;
  --accent-strong: #0d7763;
  --blue: #326fd1;
  --amber: #f0a735;
  --coral: #e85d4f;
  --violet: #7c5cc4;
  --shadow: 0 14px 32px rgba(23, 32, 42, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(18px, calc((100vw - 1120px) / 2 + 18px));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: #ffffff;
  font-weight: 900;
}

.brand h1 {
  font-size: 21px;
  line-height: 1.1;
}

.brand p,
.section-head span,
.metrics span,
.match-meta,
.match-detail {
  color: var(--muted);
}

.brand p {
  margin-top: 3px;
  font-size: 13px;
}

.contact-link {
  margin-left: auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(22, 160, 133, 0.28);
  border-radius: 8px;
  background: rgba(22, 160, 133, 0.08);
  color: var(--accent-strong);
  padding: 0 12px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.contact-link:hover {
  border-color: rgba(22, 160, 133, 0.48);
  background: rgba(22, 160, 133, 0.12);
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.lang-button {
  min-width: 38px;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.lang-button.active {
  background: var(--text);
  color: #ffffff;
}

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

.metrics div {
  min-width: 82px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metrics strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.metrics span {
  font-size: 12px;
}

.page {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.intent-panel,
.match-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intent-panel {
  padding: 16px;
}

.match-panel {
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 900;
}

.section-head h2 {
  font-size: 18px;
  line-height: 1.2;
}

.intent-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

label,
fieldset {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  color: #2c3845;
  font-size: 13px;
  font-weight: 800;
}

legend {
  padding: 0;
  margin-bottom: 7px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 0 11px;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(22, 160, 133, 0.2);
  border-color: var(--accent);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  background: #ffffff;
  color: #435062;
  font-size: 12px;
  font-weight: 800;
}

.chip input:checked + span {
  border-color: rgba(22, 160, 133, 0.56);
  background: rgba(22, 160, 133, 0.1);
  color: var(--accent-strong);
}

fieldset,
.switch-row,
.range-row,
.primary-button {
  grid-column: span 2;
}

.switch-row,
.range-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch-row {
  justify-content: space-between;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #2c3845;
  font-size: 13px;
  font-weight: 800;
}

.switch {
  width: 48px;
  height: 28px;
  display: block;
  position: relative;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c8d2dc;
  transition: 180ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(23, 32, 42, 0.22);
  transition: 180ms ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.range-row input {
  min-height: auto;
  padding: 0;
  accent-color: var(--accent);
}

.range-row output {
  width: 44px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.primary-button,
.ghost-button,
.match-action {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 900;
}

.primary-button {
  background: var(--text);
  color: #ffffff;
}

.ghost-button {
  padding: 0 12px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--muted);
}

.state-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
}

.state-pill.active {
  background: rgba(22, 160, 133, 0.1);
  color: var(--accent-strong);
}

.match-list {
  display: grid;
  gap: 9px;
}

.match-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 900;
}

.match-main {
  min-width: 0;
}

.match-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.match-title h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score {
  flex: 0 0 auto;
  border-radius: 8px;
  padding: 5px 8px;
  background: rgba(22, 160, 133, 0.1);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.match-meta {
  margin-top: 4px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-detail {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
}

.reason {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 8px;
  background: var(--soft);
  color: #435062;
}

.match-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.wait {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.wait::before {
  content: "";
  width: 8px;
  height: 8px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(22, 160, 133, 0.12);
}

.match-action {
  padding: 0 12px;
  background: var(--text);
  color: #ffffff;
}

.match-action.joined {
  background: rgba(22, 160, 133, 0.12);
  color: var(--accent-strong);
}

.empty-state {
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 18px);
  min-height: 42px;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: #ffffff;
  padding: 10px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
  z-index: 20;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .contact-link {
    margin-left: 0;
    white-space: normal;
  }

  .language-toggle {
    margin-top: -4px;
  }

  .metrics {
    width: 100%;
  }

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

@media (max-width: 640px) {
  .topbar,
  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .metrics,
  .intent-form {
    grid-template-columns: 1fr;
  }

  fieldset,
  .switch-row,
  .range-row,
  .primary-button {
    grid-column: span 1;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .match-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .avatar {
    width: 48px;
    height: 48px;
  }

  .match-side {
    grid-column: 1 / -1;
    justify-items: stretch;
  }
}
