:root,
html[data-theme="light"] {
  --bg: #f0f4f2;
  --bg-deep: #e2ebe6;
  --card: #ffffff;
  --text: #14241c;
  --muted: #5a6f64;
  --accent: #0d7a4f;
  --accent-2: #c45c12;
  --line: rgba(20, 36, 28, 0.12);
  --danger: #b42318;
  --ok: #0d7a4f;
  --header-bg: rgba(240, 244, 242, 0.9);
  --shadow: 0 12px 40px rgba(20, 36, 28, 0.08);
  --font: "Noto Sans SC", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Sora", var(--font);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #121816;
  --bg-deep: #0c100e;
  --card: #1a221e;
  --text: #e8f0eb;
  --muted: #8fa399;
  --accent: #3ecf8e;
  --accent-2: #f0a35a;
  --line: rgba(232, 240, 235, 0.12);
  --danger: #f07167;
  --ok: #3ecf8e;
  --header-bg: rgba(18, 24, 22, 0.9);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 480px at 8% -8%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

a { color: var(--accent); }
code {
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #062a1c));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.site-brand-text strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  font-family: var(--font-display);
}
.site-brand-text small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.site-nav a {
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  opacity: 0.85;
}
.site-nav a:hover { opacity: 1; }
.theme-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.15rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
html[data-theme="dark"] .btn-primary { color: #062a1c; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
}
.btn-danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}
.btn-block { width: 100%; }

.wrap {
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}
.wrap-narrow { width: min(420px, calc(100% - 2rem)); }

.hero {
  padding: 3.5rem 0 2rem;
  text-align: center;
}
.brand-hero {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 13px;
  color: var(--accent);
}
.hero h1 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  font-weight: 700;
}
.hero-lead {
  margin: 0 auto 1.5rem;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.section {
  margin-top: 2.5rem;
  padding: 1.75rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  box-shadow: var(--shadow);
}
.section-head {
  margin-bottom: 1.25rem;
}
.section-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
}
.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.feature-grid article {
  padding: 1rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 65%, transparent);
  border: 1px solid var(--line);
}
.feature-grid h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}
.feature-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.card {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.card h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
}
.card .sub {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 0.25rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border: 1px solid var(--line);
}
.tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.65rem;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tabs button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}
.form-row label {
  font-size: 13px;
  color: var(--muted);
}
.form-row input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 55%, var(--card));
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.form-row input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
}
.form-inline {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 0.55rem;
  align-items: end;
}
.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: stretch;
}
.code-row .btn {
  white-space: nowrap;
  padding: 0.75rem 0.9rem;
}
#qrHost {
  width: 220px;
  height: 220px;
  margin: 0 auto;
}
#qrHost img,
#qrHost canvas {
  display: block;
  width: 220px !important;
  height: 220px !important;
}
@media (max-width: 640px) {
  .form-inline {
    grid-template-columns: 1fr;
  }
}

.msg {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  min-height: 1.2em;
}
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

.dash-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.25rem;
}
@media (max-width: 800px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.phone-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.phone-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 50%, var(--card));
}
.phone-item .meta {
  flex: 1;
  min-width: 0;
}
.phone-item .label {
  font-size: 12px;
  color: var(--muted);
}
.phone-item .num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  word-break: break-all;
}
.phone-item .actions {
  display: flex;
  gap: 0.35rem;
}
.phone-item .actions .btn {
  padding: 0.45rem 0.7rem;
  font-size: 13px;
}
.empty {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 1rem 0;
}

.qr-panel {
  text-align: center;
}
.qr-box {
  display: inline-block;
  padding: 1rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}
.qr-box canvas,
.qr-box img,
.qr-box #qrHost {
  display: block;
  width: 220px;
  height: 220px;
}
.qr-url {
  margin: 0.85rem 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-all;
}
.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.user-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.user-bar strong { color: var(--text); }

/* 公开扫码页 */
.public-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.public-main {
  flex: 1;
  width: min(440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}
.public-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}
.public-hero h1 {
  margin: 0.5rem 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
}
.public-hero p {
  margin: 0;
  color: var(--muted);
}
.call-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.call-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.call-btn:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.call-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 1.25rem;
  flex: none;
}
.call-meta { flex: 1; min-width: 0; }
.call-meta .label {
  font-size: 12px;
  color: var(--muted);
}
.call-meta .num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}
.call-cta {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.public-foot {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.public-foot a { color: inherit; }

.print-only { display: none; }
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .site-header,
  .no-print,
  .theme-toggle { display: none !important; }
  .print-only { display: block !important; }
  .print-sheet {
    text-align: center;
    padding: 2rem;
  }
  .print-sheet h1 {
    font-size: 28px;
    margin: 0 0 0.5rem;
  }
  .print-sheet p {
    margin: 0 0 1.25rem;
    color: #444;
  }
  .print-sheet .qr-box {
    border: 2px solid #111;
    padding: 1.25rem;
  }
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}
