:root {
  color-scheme: light;
  --bg: #f5f6f1;
  --surface: #ffffff;
  --surface-soft: #f0f3ed;
  --text: #1d2523;
  --muted: #62716d;
  --line: #d9e0d8;
  --primary: #1f6f63;
  --primary-dark: #14564c;
  --accent: #c9553c;
  --amber: #8a6728;
  --blue: #314d6b;
  --shadow: 0 18px 44px rgba(31, 49, 46, 0.12);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0 18px;
}

.title-block p {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
}

.title-block h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.2;
}

.filter-row,
.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-panel,
.results-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 16px;
  margin-bottom: 18px;
}

.search-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.search-row label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input {
  min-height: 44px;
  padding: 0 12px;
}


input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(31, 111, 99, 0.14);
}

.primary-button,
.secondary-button,
.ghost-button,
.filter-button,
.copy-button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  min-height: 44px;
  color: #ffffff;
  background: var(--primary);
}

.primary-button:hover,
.secondary-button:hover {
  background: var(--primary-dark);
}

.secondary-button {
  color: #ffffff;
  background: var(--primary);
}

.ghost-button {
  color: var(--blue);
  border-color: var(--line);
  background: #ffffff;
}

.ghost-button:hover,
.filter-button:hover,
.copy-button:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.ghost-button.danger {
  color: var(--accent);
}

.filter-row {
  margin-top: 14px;
}

.filter-button {
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface-soft);
}

.filter-button.active {
  color: #ffffff;
  border-color: var(--primary);
  background: var(--primary);
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.results-panel {
  min-height: 560px;
  padding: 16px;
}

.panel-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-titlebar h2 {
  margin: 0;
  font-size: 1.05rem;
}

.panel-titlebar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.result-count {
  color: var(--amber);
  font-weight: 900;
  white-space: nowrap;
}

.result-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  padding-top: 14px;
}

.result-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.result-main {
  min-width: 0;
}

.result-card h3 {
  margin: 0 0 10px;
  font-size: 1.16rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.initials-chip,
.category-chip,
.match-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.initials-chip {
  color: #ffffff;
  background: var(--blue);
}

.category-chip {
  color: var(--primary-dark);
  background: #dcece6;
}

.match-chip {
  color: var(--amber);
  background: #f5ead4;
}

.alias-line {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.copy-button {
  align-self: flex-start;
  color: var(--blue);
  border-color: var(--line);
  background: #ffffff;
}


.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  color: #ffffff;
  background: #1d2523;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 22px, 780px);
    padding-top: 18px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .title-block h1 {
    font-size: 1.55rem;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .result-list {
    grid-template-columns: 1fr;
  }

  .result-card {
    flex-direction: column;
  }

  .copy-button {
    align-self: stretch;
  }
}