/* Eligibility Check: shared tokens and controls for every page.
   Tokens = MHMG BI (MHMG - BI Tebra - Kommo/DESIGN.md). Same values, same role per color. */
:root {
  --bg: #F4F5F7; --bg-2: #ECEEF2; --card: #FFFFFF; --surface-2: #F9FAFB;
  --line: #E3E6EB; --line-strong: #CBD1DA;
  --ink: #1B2430; --ink-2: #3A4554; --sub: #5F6976; --mute: #98A2B3;
  --navy: #2D3E50; --navy-bg: #E8EDF3; --navy-hover: #23313F; --navy-press: #1B2632;
  --teal: #3D8FA6; --teal-bg: #E6F1F4; --teal-ink: #2A6E82;
  --amber: #C9962B; --amber-ink: #7E5A10; --amber-bg: #FBF3E3; --amber-line: #EBD9AE;
  --green: #2F855A; --green-bg: #E6F4EC; --green-line: #BFE0CC;
  --red: #C53030; --red-bg: #FBEAEA; --red-line: #F0C7C7;
  --radius: 8px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-pop: 0 8px 24px rgba(16, 24, 40, .12), 0 1px 2px rgba(16, 24, 40, .06);
  --font: 'IBM Plex Sans', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --control-h: 36px; --field-fs: 13.5px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
@media (max-width: 640px) {
  /* touch: 44 px targets, 16 px text in fields (iOS does not zoom on focus) */
  :root { --control-h: 44px; --field-fs: 16px; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink-2); font: 13.5px/1.5 var(--font); font-feature-settings: 'tnum'; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button, select, summary, label[for], label:has(> input), input[type=checkbox], input[type=file], input[type=date], .drop, a.btn, [role=button] { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button, a, summary, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--sub); font-size: 12.5px; }

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

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-h); padding: 0 16px; border: 1px solid var(--navy); border-radius: var(--radius-sm); background: var(--navy); color: #FCFDFE; font: 600 13px/1 var(--font); text-decoration: none; white-space: nowrap; transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.btn:hover:not(:disabled) { background: var(--navy-hover); border-color: var(--navy-hover); }
.btn:active:not(:disabled) { background: var(--navy-press); }
.btn.ghost { background: var(--card); color: var(--navy); border-color: var(--line-strong); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--mute); }
.btn.ghost:active:not(:disabled) { background: var(--bg-2); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 12px; font-weight: 500; }
.btn.block { width: 100%; }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .btn.small { min-height: 36px; padding: 0 12px; } }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; min-width: 0; }
.field > span, .field > label { font-size: 12px; font-weight: 500; color: var(--sub); }
input[type=text], input[type=email], input[type=password], input[type=date], select {
  width: 100%; min-width: 0; height: var(--control-h); padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: var(--field-fs) var(--font); color: var(--ink); background: var(--card); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input[type=date] { padding-right: 6px; }
select { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235F6976' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; text-overflow: ellipsis; }
input:hover, select:hover { border-color: var(--mute); }
input:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-bg); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
input::placeholder { color: var(--mute); }

/* password with show/hide */
.pw { position: relative; }
.pw input { padding-right: 64px; }
.pw button { position: absolute; top: 0; right: 0; height: 100%; min-width: 56px; padding: 0 12px; border: 0; background: transparent; color: var(--teal-ink); font-size: 12px; font-weight: 600; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.pw button:hover { color: var(--navy); }

/* ---------- notes ---------- */
.note { padding: 9px 12px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.45; margin: 0 0 8px; border: 1px solid transparent; }
.note.warn { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber-line); }
.note.bad { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.note.ok { background: var(--navy-bg); color: var(--navy); border-color: #D3DCE7; }

/* ---------- sign-in / password pages ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px 28px 28px; }
.auth-card .logo { margin: 0 0 24px; }
.auth-card h1 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.auth-card .lead { margin: 0 0 22px; font-size: 13px; color: var(--sub); overflow-wrap: anywhere; }
.auth-card .btn { margin-top: 8px; }
.auth-card .note { margin: 14px 0 0; }
.auth-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.link { display: inline-flex; align-items: center; min-height: 32px; padding: 0; border: 0; background: none; color: var(--teal-ink); font-size: 13px; font-weight: 500; text-decoration: none; }
.link:hover { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 640px) {
  .auth { place-items: start center; padding-top: max(40px, env(safe-area-inset-top)); }
  .auth-card { padding: 28px 20px 24px; }
  .link { min-height: 44px; }
}

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