:root {
  color-scheme: light;
  --brand: #914521;
  --brand-dark: #6f3218;
  --brand-soft: #fff2e9;
  --bg: #f5f1ed;
  --surface: #fff;
  --text: #282523;
  --muted: #69625d;
  --border: #d7d0ca;
  --danger: #a02727;
  --success: #166b3a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-width: 280px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

.card {
  width: min(calc(100% - 24px), 860px);
  margin: 16px auto;
  padding: clamp(18px, 5vw, 40px);
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgb(55 37 27 / 10%);
}

.logo {
  display: block;
  width: min(100%, 280px);
  height: auto;
  margin: 0 auto 18px;
}

h1 { margin: 0; font-size: clamp(1.55rem, 5vw, 2rem); line-height: 1.2; text-align: center; }
h2 { margin: 0 0 10px; font-size: 1rem; }
.intro { max-width: 580px; margin: 10px auto 28px; color: var(--muted); text-align: center; }
.req { color: var(--danger); }

fieldset { min-width: 0; margin: 0 0 28px; padding: 0; border: 0; }
legend {
  width: 100%;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand-soft);
  color: var(--brand-dark);
  font-size: 1.15rem;
  font-weight: 700;
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
label, .label { display: block; margin-bottom: 6px; font-size: .93rem; font-weight: 700; }
small { display: block; margin-top: 5px; color: var(--muted); font-size: .82rem; }

input, select, textarea, button { max-width: 100%; font: inherit; }
input[type="text"], input[type="tel"], input[type="date"], input[type="number"], input[type="file"], select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input[type="file"] { height: auto; padding: 8px; }
textarea { min-height: 110px; resize: vertical; }
input[readonly], select:disabled { background: #f2f2f2; color: #555; opacity: 1; }

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid rgb(145 69 33 / 24%);
  outline-offset: 2px;
  border-color: var(--brand);
}

.photo-field { display: grid; grid-template-columns: 132px 1fr; gap: 18px; align-items: center; }
.photo-preview {
  display: none;
  width: 132px;
  height: 132px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f4f4f4;
}

.radio-group { display: flex; flex-wrap: wrap; gap: 10px; }
.radio {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 400;
  cursor: pointer;
}
.radio:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio input { width: 20px; height: 20px; margin: 0 8px 0 0; accent-color: var(--brand); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.button:hover { background: var(--brand-dark); }
.button.secondary { border-color: var(--brand); background: #fff; color: var(--brand-dark); }
.button.secondary:hover { background: var(--brand-soft); }
.button.danger { min-height: 40px; padding: 7px 12px; border-color: #e3b8b8; background: #fff; color: var(--danger); }
button:disabled { cursor: wait; opacity: .65; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.notice { margin-bottom: 20px; padding: 12px 14px; border-left: 4px solid var(--success); border-radius: 6px; background: #edf8f1; color: var(--success); }
.form-message { min-height: 1.5em; margin-top: 12px; color: var(--muted); text-align: center; }
.form-message.error { color: var(--danger); }
.was-validated input:invalid,
.was-validated select:invalid,
.was-validated textarea:invalid { border-color: var(--danger); background: #fff8f8; }
.was-validated .radio:has(input:invalid) { border-color: var(--danger); }

.experience-editor { margin-top: 16px; padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: #fcfaf8; }
.table-wrap { margin-top: 18px; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 980px; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: #f5f1ed; font-size: .84rem; }
.captcha-wrap { max-width: 100%; overflow-x: auto; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .card { width: 100%; margin: 0; border-radius: 0; box-shadow: none; }
  .logo { width: min(100%, 190px); }
  .form-grid, .actions { grid-template-columns: 1fr; }
  .photo-field { grid-template-columns: 1fr; }
  .photo-preview { width: 112px; height: 112px; }
  .button { width: 100%; }
  .table-wrap { overflow: visible; border: 0; }
  table, tbody, tr, td { display: block; width: 100%; min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { margin-bottom: 14px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; }
  td { display: grid; grid-template-columns: minmax(105px, 38%) 1fr; gap: 10px; padding: 8px 0; overflow-wrap: anywhere; border-bottom: 1px solid #eee; }
  td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 700; }
  td:last-child { display: block; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
