:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #2563eb;
  --warn: #f59e0b;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 16px 14px 88px;
}

.hero {
  min-height: 166px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 22px;
  color: #fff;
  background:
    linear-gradient(rgba(8, 47, 73, 0.28), rgba(15, 118, 110, 0.68)),
    url("https://images.unsplash.com/photo-1523050854058-8df90110c9f1?auto=format&fit=crop&w=1200&q=75");
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0;
  opacity: 0.88;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.subtitle {
  max-width: 460px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.6;
}

.icon-btn,
.close-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.hero-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-link {
  display: grid;
  place-items: center;
  min-width: 54px;
  height: 42px;
  padding: 0 12px;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.2);
}

.search-panel {
  position: relative;
  margin-top: -18px;
  padding: 16px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 38px rgba(15, 118, 110, 0.16);
}

.search-panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.42), rgba(37, 99, 235, 0.18));
}

.search-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.search-title strong {
  font-size: 18px;
}

.search-title span {
  color: var(--brand);
  font-size: 12px;
}

.search-box {
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: var(--brand-dark);
  font-weight: 600;
}

.search-box input {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border: 2px solid var(--brand);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.08);
  font-size: 15px;
}

.search-box input::placeholder {
  color: #8a96a8;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.filters select,
.filters input,
.lead-form input,
.lead-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.filters select,
.filters input {
  border-color: rgba(15, 118, 110, 0.18);
  background: #fbfefd;
}

.lead-form textarea {
  padding-top: 10px;
  resize: vertical;
}

.quick-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 4px;
}

.quick-actions button,
.tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.stats-grid article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.stats-grid span,
.section-head span,
.meta,
.pill,
.empty {
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
  background: var(--bg);
}

.tabs button.active {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.card-list {
  display: grid;
  gap: 10px;
}

.card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.35;
}

.card .school {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  color: #0f4fb5;
  background: #eaf3ff;
  font-size: 12px;
}

.tag.green {
  color: #047857;
  background: #e8fbf4;
}

.tag.yellow {
  color: #9a5b00;
  background: #fff7df;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.card-actions button,
.primary {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
}

.card-actions .secondary {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.favorite-btn.active {
  color: #fff;
  background: var(--warn);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.drawer.active {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.drawer-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(100%, 760px);
  max-height: 88vh;
  overflow-y: auto;
  transform: translateX(-50%);
  padding: 20px;
  border-radius: 14px 14px 0 0;
  background: #fff;
}

.close-btn {
  position: sticky;
  top: 0;
  margin-left: auto;
  color: var(--ink);
  background: #f3f4f6;
}

.detail-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.detail-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.detail-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--muted);
}

.important-detail {
  border-color: rgba(15, 118, 110, 0.22);
  background: #f0fdfa;
}

.detail-lines {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}

.detail-lines li::marker {
  color: var(--brand);
}

.diagnosis-form {
  margin-bottom: 14px;
}

.diagnosis-form select {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.diagnosis-result {
  margin-top: 12px;
}

.diagnosis-grid {
  display: grid;
  gap: 10px;
}

.diagnosis-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.diagnosis-card strong {
  display: block;
  margin-bottom: 8px;
}

.diagnosis-card p {
  margin-bottom: 0;
  line-height: 1.65;
  color: #374151;
}

.risk-高 {
  border-color: rgba(220, 38, 38, 0.24);
  background: #fff7f7;
}

.risk-中 {
  border-color: rgba(245, 158, 11, 0.28);
  background: #fffbeb;
}

.risk-低 {
  border-color: rgba(15, 118, 110, 0.2);
  background: #f0fdfa;
}

.lead-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-grid {
  display: grid;
  gap: 14px;
}

.admin-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-panel h2 {
  margin-bottom: 10px;
}

.upload-form {
  display: grid;
  gap: 12px;
}

.upload-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.upload-form input,
.upload-form select {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lead-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lead-table th,
.lead-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.lead-table th {
  color: var(--muted);
  font-weight: 600;
  background: #f9fafb;
}

.lead-form label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

.form-message {
  min-height: 22px;
  color: var(--accent);
}

.empty {
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 560px) {
  .hero {
    min-height: 210px;
    padding: 18px;
  }

  h1 {
    font-size: 30px;
  }

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

  .card-top {
    display: block;
  }

  .card-actions {
    flex-wrap: wrap;
  }
}
