:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fd;
  --text: #172033;
  --muted: #748096;
  --line: #e6eaf2;
  --primary: #5b5ce2;
  --primary-dark: #4647c8;
  --primary-soft: #eeedff;
  --success: #159a72;
  --success-soft: #e8f8f2;
  --warning: #c47a12;
  --warning-soft: #fff5df;
  --danger: #d94b5b;
  --danger-soft: #fff0f2;
  --shadow: 0 18px 60px rgba(31, 42, 68, .08);
  --radius: 18px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--primary); }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 11px;
  background: var(--primary); color: #fff; font-weight: 650; transition: .18s ease;
}
.btn:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.secondary:hover:not(:disabled) { background: var(--surface-soft); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: #ffd9de; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 12px; border-radius: 9px; }
.btn.block { width: 100%; }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { color: #4c5870; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  color: var(--text); padding: 11px 13px; outline: none; transition: .18s ease;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.textarea { min-height: 150px; resize: vertical; font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; line-height: 1.7; }
.input::placeholder, .textarea::placeholder { color: #a4adbd; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check-option { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; }
.check-option input { accent-color: var(--primary); }
.help { color: var(--muted); font-size: 12px; }
.mono { font-family: "Cascadia Code", Consolas, monospace; }

.notice { padding: 12px 14px; border-radius: 11px; background: var(--primary-soft); color: #4b4ca9; font-size: 13px; }
.notice.warning { background: var(--warning-soft); color: #8b5b14; }
.notice.danger { background: var(--danger-soft); color: #a73543; }
.notice.success { background: var(--success-soft); color: #107256; }

.toast {
  position: fixed; z-index: 1000; left: 50%; bottom: 28px; transform: translate(-50%, 18px);
  max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 12px;
  background: #172033; color: #fff; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: .2s ease; font-size: 13px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #a73543; }

.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.spinner {
  width: 18px; height: 18px; border: 2px solid #d9dcfb; border-top-color: var(--primary);
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
}
