:root {
  --bg: #f4f6fc;
  --surface: #ffffff;
  --surface-2: #f8faff;
  --ink: #0f172a;
  --ink-2: #24324a;
  --muted: #5a6b85;
  --muted-2: #8a99b0;
  --line: #e1e7f3;
  --line-strong: #c9d4e8;
  --primary: #2457f5;
  --primary-deep: #173bb8;
  --primary-soft: #e8eeff;
  --primary-tint: #f1f5ff;
  --yellow: #ffd76a;
  --yellow-soft: #fff4d1;
  --green: #0e9f6e;
  --green-soft: #e7f7f0;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee9e9;
  --slate: #64748b;
  --slate-soft: #eef2f7;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 12px 32px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-pop: 0 24px 60px rgba(15, 23, 42, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: var(--primary);
  text-decoration: none;
}

svg {
  display: block;
}

.i {
  width: 24px;
  height: 24px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.i-sm {
  width: 16px;
  height: 16px;
}

.i-lg {
  width: 28px;
  height: 28px;
}

:focus-visible {
  outline: 3px solid rgba(36, 87, 245, 0.35);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(36, 87, 245, 0.22);
}

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

.btn-primary:disabled {
  background: #aebdef;
  box-shadow: none;
}

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.btn-ghost:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.btn-quiet {
  color: var(--muted);
  font-weight: 500;
}

.btn-quiet:hover {
  color: var(--ink);
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
}

.field {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field::placeholder {
  color: var(--muted-2);
}

.field:hover {
  border-color: var(--line-strong);
}

.field:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(36, 87, 245, 0.12);
}

select.field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a6b85' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-dark {
  border-color: rgba(15, 23, 42, 0.15);
  border-top-color: var(--primary);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* toast */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 480px);
}

.toast {
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  padding: 10px 16px;
  border-radius: 11px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
  animation: toast-in 0.22s ease;
  max-width: 100%;
}

.toast.is-error {
  background: #a3131f;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* overlay + sheet */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.44);
  z-index: 70;
  animation: fade-in 0.18s ease;
}

.overlay[hidden] {
  display: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sheet[hidden] {
  display: none;
}

.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--line-strong);
  margin: 4px auto 12px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 12px;
}

.sheet-title {
  font-size: 17px;
  font-weight: 700;
}

.sheet-body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

@keyframes sheet-up {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
}

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(8, 12, 24, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.empty svg {
  margin: 0 auto 12px;
  color: var(--muted-2);
}

.empty strong {
  display: block;
  color: var(--ink-2);
  font-size: 15px;
  margin-bottom: 4px;
}

@media print {
  .no-print {
    display: none !important;
  }
}
