:root {
  color-scheme: light;
  --primary: #5148f5;
  --primary-light: #efeeff;
  --bg: #f5f6fc;
  --surface: #fff;
  --text: #141b35;
  --muted: #848ba4;
  --border: #e8ebf4;
  --success: #119650;
  --warning: #d98a06;
  --danger: #df515b;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-family: var(--font);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: inline-block; flex-shrink: 0; vertical-align: middle; }
::selection { background: #dfddff; color: var(--text); }
:focus-visible { outline: 3px solid #aaa4ff; outline-offset: 3px; }
input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
[hidden] { display: none !important; }

.btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap; transition: background .16s ease, box-shadow .16s ease, border-color .16s ease, transform .16s ease; }
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; box-shadow: 0 3px 7px #5148f519; }
.btn-primary:hover:not(:disabled) { background: #453adf; box-shadow: 0 4px 12px #5148f52b; }
.btn-secondary { background: white; color: var(--text); border-color: #dfe3ef; }
.btn-secondary:hover:not(:disabled) { background: #f9f9ff; border-color: #c9c5fb; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover:not(:disabled) { background: var(--primary-light); }
.btn-danger { background: #fff0f1; color: var(--danger); border-color: #ffd8db; }
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--primary-light); color: var(--primary); }
.input { display: block; width: 100%; min-height: 41px; padding: 10px 13px; border: 1px solid #dfe3ef; border-radius: 7px; outline: 0; background: white; color: var(--text); transition: border-color .15s ease, box-shadow .15s ease; }
.input::placeholder { color: #a0a6bb; }
.input:focus { border-color: #8a82ff; box-shadow: 0 0 0 3px #5148f50d; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge-success { color: #128646; background: #e9f8ef; }
.badge-warning { color: #b97809; background: #fff4da; }
.badge-danger, .badge-error { color: #d04a55; background: #fff0f1; }
.badge-primary { color: var(--primary); background: var(--primary-light); }
.badge-info { color: #3f77d2; background: #eaf2ff; }
.badge-muted { color: var(--muted); background: #f0f2f7; }
.sr-only, .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.toast-region { position: fixed; z-index: 10000; right: 24px; top: 24px; display: flex; flex-direction: column; gap: 10px; width: min(430px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 14px 15px; border: 1px solid #e2e6f2; border-radius: 10px; background: white; box-shadow: 0 8px 32px #22294a18; color: var(--text); pointer-events: auto; animation: toast-in .2s ease both; }
.toast > span:first-child { padding-top: 1px; color: var(--success); }
.toast > span:nth-child(2) { flex: 1; overflow-wrap: anywhere; }
.toast-error > span:first-child { color: var(--danger); }
.toast-warning > span:first-child { color: var(--warning); }
.toast-info > span:first-child { color: var(--primary); }
.toast-close { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); }
.toast-close:hover { background: var(--bg); }
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: #131a355c; backdrop-filter: blur(4px); }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 48px); overflow-y: auto; padding: 25px; border: 1px solid white; border-radius: 15px; background: white; box-shadow: 0 22px 80px #11173538; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) {
  .toast-region { top: 14px; right: 16px; }
  .modal-backdrop { padding: 14px; }
  .modal { max-height: calc(100dvh - 28px); padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
