:root{
  --bg:#f3f6fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#dbe3ef;
  --border-strong:#c8d3e6;
  --primary:#0d4cd3;
  --primary-hover:#0b42b7;
  --danger:#b00020;
  --ok-bg:#eaf7ee;
  --ok-border:#9be3b2;
  --radius:16px;
  --shadow:0 14px 40px rgba(15,23,42,.10);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,"Noto Sans","Helvetica Neue",sans-serif;
  color:var(--text);
  background:var(--bg);
}

.page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.card{
  width:100%;
  max-width:520px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:22px;
}

.header{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom:14px;
  align-items:center;
  text-align:center;
}

.logo{
  width:100px;
  height:auto;
  display:block;
}

.title{
  margin:0;
  font-size:20px;
  line-height:1.2;
  font-weight:750;
  letter-spacing:-0.01em;
}

.subtitle{
  margin:0;
  font-size:13px;
  line-height:1.35;
  color:var(--muted);
}

.substep{
  margin:6px 0 14px;
  font-size:13px;
  line-height:1.35;
  color:var(--muted);
}

.stepper{
  margin:14px 0 18px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.stepper-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.step-label{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}

.progress{
  width:100%;
  height:8px;
  background:#e8eef9;
  border-radius:999px;
  overflow:hidden;
  border:1px solid var(--border);
}

.progress > div{
  height:100%;
  width:0%;
  background:var(--primary);
  border-radius:999px;
  transition:width .18s ease;
}

form{ margin:0; }

.step{ display:none; }
.step.active{ display:block; }

.step h3{
  margin:0 0 12px;
  font-size:15px;
  font-weight:750;
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom:12px;
  min-width:0; /* важно для WebView */
}

label{
  font-size:13px;
  font-weight:650;
}

input,select,textarea{
  width:100%;
  max-width:100%;
  min-width:0;
  display:block;

  padding:11px 12px;
  font-size:14px;

  border:1px solid var(--border-strong);
  border-radius:12px;
  background:#fff;
  outline:none;
  transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

/* FIX: date input overflow in mobile/WebView */
input[type="date"]{
  min-width:0 !important;
  min-inline-size:0 !important;
  width:100%;
  max-width:100%;
  display:block;

  -webkit-appearance:none;
  appearance:none;

  min-height:44px;
  padding:11px 12px;
  line-height:1.2;

  padding-right:44px; /* место под иконку */
}

/* ОПИСАНИЕ: фикс ~10 строк, со скроллом внутри */
textarea{
  line-height:1.35;

  height:10em;
  min-height:10em;
  max-height:10em;

  resize:none;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;

  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
  touch-action:pan-y;
}

input:focus,select:focus,textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 4px rgba(13,76,211,.12);
}

/* (опционально) аккуратный стык select при фокусе на десктопе */
@media (min-width:521px){
  select:focus{
    border-bottom-left-radius:0;
    border-bottom-right-radius:0;
  }
}

.err{
  display:none;
  margin:0;
  padding:0;
  font-size:12px;
  line-height:1.35;
  color:var(--danger);
}

.err.has-error{
  display:block;
  margin-top:4px;
}

.input-error{
  border-color:var(--danger) !important;
  box-shadow:0 0 0 4px rgba(176,0,32,.10) !important;
}

.ok{
  display:none;
  margin:0 0 12px;
  padding:10px 12px;
  border-radius:14px;
  background:var(--ok-bg);
  border:1px solid var(--ok-border);
  color:#0f5132;
  font-size:13px;
}

.actions{
  display:flex;
  gap:10px;
  margin-top:14px;
}

.btn{
  appearance:none;
  border:1px solid var(--border-strong);
  background:#fff;
  color:var(--text);
  padding:11px 12px;
  border-radius:12px;
  font-size:14px;
  font-weight:650;
  cursor:pointer;
  width:100%;
  transition:background .15s ease, border-color .15s ease, transform .02s ease;
}

.btn:hover{ background:#f8fafc; }
.btn:active{ transform:translateY(1px); }

.btn.is-disabled,
.btn[aria-disabled="true"],
.btn:disabled{
  opacity:.55;
  cursor:not-allowed;
}

.btn.is-disabled:not(.primary):hover,
.btn[aria-disabled="true"]:not(.primary):hover,
.btn:disabled:not(.primary):hover{
  background:#fff;
}

.btn.is-disabled.primary:hover,
.btn[aria-disabled="true"].primary:hover,
.btn:disabled.primary:hover{
  background:var(--primary);
  border-color:var(--primary);
}

.btn.primary{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

.btn.primary:hover{
  background:var(--primary-hover);
  border-color:var(--primary-hover);
}

/* Mobile */
@media (max-width:520px){
  /* iOS: prevent zoom on focus */
  input,select,textarea{ font-size:16px; }

  .card{ padding:18px; border-radius:14px; }
  .title{ font-size:18px; }
  .actions{ flex-direction:column; }

  .actions{
    position:sticky;
    bottom:0;
    padding-top:10px;
    padding-bottom:calc(10px + env(safe-area-inset-bottom));
    background:var(--card);
    border-top:1px solid var(--border);
    margin-left:-18px;
    margin-right:-18px;
    padding-left:18px;
    padding-right:18px;
    border-bottom-left-radius:14px;
    border-bottom-right-radius:14px;
  }

  /* ВАЖНО: НЕ переопределяем textarea здесь, чтобы 10 строк сохранялись */
}

/* Tablets */
@media (min-width:521px) and (max-width:900px){
  .page{ padding:28px; }
  .card{ max-width:560px; }
}

@media (prefers-reduced-motion:reduce){
  *{ scroll-behavior:auto !important; transition:none !important; }
}

/* extras from your previous file */
.grid-2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

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

.errbox{
  margin:12px 0;
  padding:10px 12px;
  border:1px solid #fecaca;
  background:#fff1f2;
  color:#7f1d1d;
  border-radius:12px;
  font-size:13px;
}

.phone{
  display:flex;
  align-items:stretch;
  width:100%;
}

.phone-prefix{
  display:flex;
  align-items:center;
  padding:0 12px;
  border:1px solid var(--border-strong);
  border-right:0;
  border-radius:12px 0 0 12px;
  background:#f8fafc;
  font-weight:700;
  color:var(--text);
  user-select:none;
}

.phone input{
  border-radius:0 12px 12px 0;
}

.row{
  display:flex;
  align-items:center;
  gap:10px;
  user-select:none;
}

.row input{ width:auto; }

.footer-note{
  margin-top:14px;
  font-size:12px;
  color:var(--muted);
}

input:disabled,select:disabled,textarea:disabled{
  background:#f1f5f9 !important;
  color:#94a3b8;
  cursor:not-allowed;
}

.ok.bad{
  background:#fff1f2;
  border-color:#fecaca;
  color:#7f1d1d;
}

.success-panel{
  margin:0 0 12px;
}

.success-title{
  margin:0 0 10px;
  font-size:15px;
  font-weight:750;
}

.success-card{
  white-space:pre-wrap;
  word-break:break-word;
  margin:0;
  padding:12px;
  border:1px solid var(--border);
  background:#f8fafc;
  border-radius:12px;
  font-size:13px;
  line-height:1.35;
  color:var(--text);
}