:root {
  color-scheme: light;
  --font-sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-mint: #e7fbf6;
  --text: #1c2731;
  --text-strong: #10202d;
  --muted: #657583;
  --muted-soft: #8795a0;
  --border: #dce4e9;
  --border-soft: #e9eef1;
  --accent: #008fbe;
  --accent-strong: #007da6;
  --accent-soft: #e4f7fc;
  --mint: #7de3d0;
  --mint-strong: #38bfa8;
  --navy: #153f5f;
  --navy-deep: #0b243c;
  --danger: #b83c43;
  --danger-soft: #fff0f1;
  --warning: #9a6a0a;
  --warning-soft: #fff7df;
  --success: #187b65;
  --success-soft: #e7f8f3;
  --info: #226b91;
  --info-soft: #eaf5fb;
  --shadow-sm: 0 4px 14px rgba(24, 49, 66, 0.06);
  --shadow-md: 0 16px 40px rgba(24, 49, 66, 0.1);
  --shadow-lg: 0 28px 72px rgba(11, 36, 60, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --focus: 0 0 0 3px rgba(0, 170, 224, 0.24);
  --motion-fast: 160ms;
  --motion-base: 240ms;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1622;
  --surface: #18222e;
  --surface-soft: #202c39;
  --surface-mint: #173832;
  --text: #e8edf1;
  --text-strong: #ffffff;
  --muted: #a7b2bc;
  --muted-soft: #8794a0;
  --border: #344250;
  --border-soft: #2a3744;
  --accent: #24b8ed;
  --accent-strong: #5bcbf2;
  --accent-soft: #15384a;
  --mint: #62d7c2;
  --mint-strong: #7de3d0;
  --danger: #ff959a;
  --danger-soft: #44262b;
  --warning: #f2c967;
  --warning-soft: #3b321d;
  --success: #75d8bd;
  --success-soft: #173a32;
  --info: #83cceb;
  --info-soft: #173446;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.34);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

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

a:hover {
  color: var(--accent-strong);
}

img,
svg {
  display: block;
}

img {
  max-width: 100%;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

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

h1,
h2,
h3 {
  color: var(--text-strong);
  line-height: 1.16;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.025em;
}

h3 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text-strong);
  font-weight: 700;
  transform: translateY(-180%);
  transition: transform var(--motion-fast) ease-out;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  transition:
    background-color var(--motion-fast) ease-out,
    border-color var(--motion-fast) ease-out,
    color var(--motion-fast) ease-out,
    box-shadow var(--motion-fast) ease-out,
    transform var(--motion-fast) ease-out;
}

.button:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.button:active {
  transform: scale(0.985);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.button svg {
  width: 18px;
  height: 18px;
}

.button-primary {
  background: var(--accent);
  box-shadow: 0 9px 22px rgba(0, 143, 190, 0.18);
  color: #ffffff;
}

.button-primary:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

.button-secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-strong);
}

.button-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
}

.button-quiet:hover {
  background: var(--accent-soft);
}

.button-danger {
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.button-block {
  width: 100%;
}

.button.is-loading .button-spinner {
  display: inline-block;
}

.button.is-loading > span:first-child {
  opacity: 0.72;
}

.button-spinner {
  width: 16px;
  height: 16px;
  display: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition:
    background-color var(--motion-fast) ease-out,
    border-color var(--motion-fast) ease-out,
    color var(--motion-fast) ease-out,
    transform var(--motion-fast) ease-out;
}

.icon-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-button:active {
  transform: scale(0.96);
}

.field,
.form-stack {
  display: grid;
}

.form-stack {
  gap: 18px;
}

.field {
  gap: 7px;
}

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

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

label {
  color: var(--text-strong);
  font-size: 0.875rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-strong);
  outline: none;
  transition:
    border-color var(--motion-fast) ease-out,
    box-shadow var(--motion-fast) ease-out,
    background-color var(--motion-fast) ease-out;
}

input,
select {
  padding: 10px 13px;
}

textarea {
  min-height: 120px;
  padding: 12px 13px;
  line-height: 1.55;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-soft);
}

input:hover,
select:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-hint,
.field-error {
  min-height: 18px;
  font-size: 0.75rem;
  line-height: 1.4;
}

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

.field-error {
  color: var(--danger);
}

.check-field {
  min-height: 44px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.5;
}

.check-field input {
  width: 19px;
  min-width: 19px;
  height: 19px;
  min-height: 19px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.form-message {
  min-height: 0;
  margin-top: 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.form-message:not(:empty) {
  padding: 11px 13px;
}

.form-message.is-error,
.status-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.form-message.is-success,
.status-success {
  background: var(--success-soft);
  color: var(--success);
}

.form-message.is-info {
  background: var(--info-soft);
  color: var(--info);
}

.badge {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-info {
  background: var(--info-soft);
  color: var(--info);
}

.is-hidden {
  display: none !important;
}

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

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 9px;
  background: var(--border-soft);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 62%, transparent), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s ease-in-out infinite;
}

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

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@media (max-width: 640px) {
  .field-grid {
    grid-template-columns: 1fr;
  }

  .button {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
