:root {
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --primary-soft: #dbeafe;
  --teal: #0f766e;
  --teal-soft: #ccfbf1;
  --amber: #b45309;
  --rose: #be123c;
  --ink: #0f172a;
  --text: #172033;
  --muted: #64748b;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-blue: #eff6ff;
  --surface-green: #ecfdf5;
  --border: #dbe3ee;
  --border-strong: #bfdbfe;
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.09);
  --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    linear-gradient(180deg, #eaf3ff 0, rgba(245, 247, 251, 0) 300px),
    linear-gradient(90deg, rgba(204, 251, 241, 0.42), rgba(239, 246, 255, 0) 44%, rgba(254, 243, 199, 0.28)),
    var(--bg);
  color: var(--text);
  line-height: 1.58;
  animation: page-in 0.18s ease-out;
}

@keyframes page-in {
  from { opacity: 0.35; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.62; }
code { font-family: Consolas, "SFMono-Regular", monospace; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(219, 227, 238, 0.9);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 66px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 10px 20px rgba(29, 78, 216, 0.18);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: block;
  box-shadow: 0 10px 20px rgba(29, 78, 216, 0.16);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 780;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav a:hover, .nav a.active {
  background: var(--surface-blue);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.42);
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 20px 76px;
}

.section { margin-top: 18px; }

.card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.card.pad { padding: 22px; }

.card.focus, .focus {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
  align-items: stretch;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

h1 {
  color: var(--ink);
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  line-height: 1.14;
  letter-spacing: 0;
  margin-bottom: 10px;
}

h2 {
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1.28;
  letter-spacing: 0;
}

h3 {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.3;
}

.muted { color: var(--muted); }
.lead { color: var(--muted); max-width: 780px; }

.sublead {
  color: #475569;
  font-size: 0.94rem;
  max-width: 720px;
}

.btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 24px rgba(29, 78, 216, 0.2);
}

.btn.primary:hover { background: var(--primary-dark); }

.btn.ghost {
  background: var(--surface-soft);
  color: #334155;
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  border-color: #93c5fd;
  color: var(--primary);
}

.btn.dark {
  background: var(--ink);
  color: #fff;
}

.btn.danger {
  color: var(--rose);
  background: #fff1f2;
  border: 1px solid #fecdd3;
}

.btn.block { width: 100%; }

.btn.big {
  min-height: 50px;
  padding: 0 18px;
  font-size: 1rem;
}

.input, .select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  min-height: 38px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 0 12px;
  color: #475569;
  font-weight: 850;
}

.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

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

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

.stat b {
  display: block;
  color: var(--primary);
  font-size: 1.38rem;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

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

.item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 15px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.item:hover {
  border-color: var(--border-strong);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.06);
  transform: translateY(-1px);
}

.pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.74rem;
  font-weight: 850;
}

.pill.blue { background: #dbeafe; color: #1d4ed8; }
.pill.teal { background: #ccfbf1; color: #0f766e; }
.pill.amber { background: #fef3c7; color: #92400e; }
.pill.rose { background: #ffe4e6; color: #be123c; }

.split-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
  color: #334155;
  font-size: 0.9rem;
}

.split-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.code {
  background: #0f172a;
  color: #dbeafe;
  border-radius: 8px;
  padding: 12px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  overflow: auto;
}

.notice {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.9rem;
}

.path-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.path-step {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  padding: 13px;
}

.path-step b {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

.path-step span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.decision-box {
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: linear-gradient(180deg, #ecfdf5, #ffffff);
  padding: 16px;
}

.decision-box b {
  display: block;
  color: var(--teal);
  margin-bottom: 6px;
}

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

.simple-list .row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.simple-list .row span {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.simple-list .row b {
  display: block;
  color: var(--ink);
  line-height: 1.28;
}

.simple-list .row small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 12px;
  font-size: 0.9rem;
}

th {
  color: #475569;
  background: var(--surface-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.empty {
  padding: 34px;
  text-align: center;
  color: var(--muted);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
}

.auth-info {
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--ink);
  color: white;
}

.auth-info .brand { color: white; }
.auth-info .brand-mark { background: #2563eb; color: white; }
.auth-info .brand-logo { box-shadow: none; }
.auth-copy { max-width: 660px; }
.auth-copy p { color: #cbd5e1; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: var(--bg);
}

.auth-box { width: min(100%, 440px); }
.form-stack { display: grid; gap: 14px; }

.field label {
  display: block;
  color: #334155;
  font-size: 0.84rem;
  font-weight: 850;
  margin-bottom: 6px;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.msg {
  display: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.msg.error { display: block; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.msg.success { display: block; background: #ecfdf5; color: #047857; border: 1px solid #bbf7d0; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
}

.modal.open { display: flex; }

.dialog {
  width: min(760px, 100%);
  max-height: 86vh;
  overflow: auto;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-body { padding: 18px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 100;
  display: none;
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.toast.show { display: block; }

@media (max-width: 980px) {
  .hero-grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .path-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-info { min-height: auto; gap: 28px; }
}

@media (max-width: 640px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }
  .nav { justify-content: flex-start; }
  .wrap { padding: 18px 14px 54px; }
  .stats { grid-template-columns: 1fr; }
  .path-strip { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .auth-info { padding: 24px 18px; }
  .auth-panel { padding: 18px 14px 34px; }
}
