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

:root {
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-focus: #94a3b8;
  --input-bg: #f8fafc;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-light: rgba(15, 118, 110, 0.08);
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --success: #0f766e;
  --success-bg: #f0fdfa;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  padding: 32px 20px 40px;
}

.card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  padding: 28px 28px 24px;
  background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--card) 100%);
  border-bottom: 1px solid var(--border);
}

.card-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 480px;
}

.card-header-actions {
  margin-left: auto;
  flex-shrink: 0;
}

.card-header-actions .small-link {
  white-space: nowrap;
}

.form {
  padding: 24px 28px 32px;
}

.field-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.required {
  color: var(--danger);
  margin-left: 2px;
}

.hint {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

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

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
select:focus {
  outline: none;
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

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

.type-section {
  display: none;
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.type-section .section-title {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-title h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.checkbox:hover {
  border-color: var(--border-focus);
  background: var(--input-bg);
}

.checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.alert {
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 0.9rem;
  margin: 20px 28px;
  line-height: 1.5;
}

.alert:first-of-type {
  margin-top: 24px;
}

.alert ul {
  margin: 0;
  padding-left: 20px;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  color: var(--danger);
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid #99f6e4;
  color: var(--success);
}

.alert-success div:first-child {
  font-weight: 500;
}

.form-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  padding: 14px 28px;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  font-family: inherit;
  background: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.2);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}

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

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.small-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.small-link:hover {
  border-color: var(--border-focus);
  color: var(--text);
  background: var(--input-bg);
}

.page-footer {
  max-width: 720px;
  margin: 24px auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
}

@media (max-width: 640px) {
  .page {
    padding: 20px 16px 32px;
  }

  .card-header,
  .form {
    padding-left: 20px;
    padding-right: 20px;
  }

  .card-header {
    padding-top: 24px;
    padding-bottom: 20px;
  }

  .card-header h1 {
    font-size: 1.25rem;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .grid-2 .field-group {
    margin-bottom: 18px;
  }

  .type-section {
    padding: 16px;
    margin-top: 16px;
  }

  .alert {
    margin-left: 20px;
    margin-right: 20px;
  }

  .form-footer {
    margin-top: 24px;
  }

  .btn-primary {
    width: 100%;
  }
}
