/* ==========================================================
   SKILLCHAIN  |  Shared components (screens, forms, sheet, toast)
   ========================================================== */

[hidden] { display: none !important; }

.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Screen layout ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bone); }

.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  min-height: calc(56px + var(--safe-t)); padding: var(--safe-t) 12px 0;
  background: var(--bone);
}
.appbar__btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; transition: background-color 0.18s ease; }
.appbar__btn:active { background: rgba(11, 11, 12, 0.08); }
.appbar__btn.is-hidden { visibility: hidden; }
.appbar__meta { padding-right: 8px; font-size: 0.8rem; font-weight: 700; color: var(--text-3); }

.screen__body { flex: 1; display: flex; flex-direction: column; padding: 8px var(--gutter) 0; }
.screen__foot {
  position: sticky; bottom: 0; margin-top: auto;
  display: grid; gap: 14px;
  padding: 20px 0 calc(var(--safe-b) + 16px);
  background: linear-gradient(to top, var(--bone) 80%, rgba(245, 243, 238, 0));
}

.head { margin: 8px 0 28px; }
.head__mark { width: 44px; height: 44px; margin-bottom: 20px; }
.head__title { font-family: var(--f-display); font-weight: 800; font-size: clamp(1.9rem, 8vw, 2.3rem); line-height: 1.05; letter-spacing: -0.035em; }
.head__sub { margin-top: 10px; font-size: 0.98rem; font-weight: 500; line-height: 1.5; color: var(--text-2); }
.head__sub strong { color: var(--text); font-weight: 700; word-break: break-all; }

.stack { display: grid; gap: 18px; }
.foot-note { text-align: center; font-size: 0.92rem; font-weight: 500; color: var(--text-2); }
.foot-note a { font-weight: 800; color: var(--text); }
.field-row { display: flex; justify-content: flex-end; }
.link { font-size: 0.9rem; font-weight: 800; color: var(--brand-deep); }

.alert { padding: 12px 14px; border-radius: 12px; background: rgba(217, 45, 32, 0.08); color: #B42318; font-size: 0.88rem; font-weight: 600; line-height: 1.4; }

/* ---------- Fields ---------- */
.field { display: grid; gap: 8px; }
.field__label { font-size: 0.8rem; font-weight: 700; color: var(--text-2); }
.field__box {
  position: relative; display: flex; align-items: center; height: 56px;
  background: var(--white); border-radius: var(--r-m);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: box-shadow 0.18s ease;
}
.field__box:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.field.has-error .field__box { box-shadow: inset 0 0 0 2px var(--danger); }
.field__input {
  flex: 1; min-width: 0; height: 100%; padding: 0 16px;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--text);
  background: transparent; border: 0; border-radius: var(--r-m); outline: 0;
}
.field__input::placeholder { color: var(--text-3); font-weight: 500; }
.field__input:-webkit-autofill { -webkit-box-shadow: 0 0 0 100px #fff inset; -webkit-text-fill-color: var(--text); }
.field__error { font-size: 0.78rem; font-weight: 600; color: var(--danger); }
.field__error:empty { display: none; }

.field__action { width: 52px; height: 100%; display: grid; place-items: center; color: var(--text-2); }
.field__action .i-hide { display: none; }
.field__action.is-shown .i-hide { display: block; }
.field__action.is-shown .i-show { display: none; }

.field__box--select .field__input { appearance: none; -webkit-appearance: none; padding-right: 48px; }
.field__chevron { position: absolute; right: 16px; pointer-events: none; color: var(--text-2); }

.field__input--otp { text-align: center; font-family: var(--f-display); font-weight: 700; font-size: 1.9rem; letter-spacing: 0.5em; padding-left: calc(16px + 0.5em); }
.field__box--otp { height: 68px; }

/* ---------- Progress (segmented) ---------- */
.progress { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 4px 0 26px; }
.progress__bar { position: relative; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress__bar::after { content: ''; position: absolute; inset: 0; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 0.45s var(--ease-out); }
.progress__bar.is-done::after, .progress__bar.is-active::after { transform: scaleX(1); }
.progress__bar.is-active::after { background: var(--brand); }

/* ---------- Steps ---------- */
.steps { flex: 1; display: flex; flex-direction: column; }
.steps > form { display: contents; }
.step { display: none; flex: 1; flex-direction: column; }
.step.is-active { display: flex; animation: step-in 0.38s var(--ease-out) both; }
.steps.is-back { --dir: -22px; }
@keyframes step-in { from { opacity: 0; transform: translateX(var(--dir, 22px)); } }

/* ---------- Choice cards ---------- */
.choices { display: grid; gap: 12px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.choice__box {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--white); border-radius: 18px; box-shadow: inset 0 0 0 1.5px var(--line);
  transition: box-shadow 0.18s ease, transform 0.18s var(--ease-out);
}
.choice:active .choice__box { transform: scale(0.985); }
.choice__icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--bone); color: var(--ink); flex-shrink: 0; transition: background-color 0.18s ease, color 0.18s ease; }
.choice__text { flex: 1; min-width: 0; }
.choice__title { display: block; font-size: 1rem; font-weight: 800; }
.choice__desc { display: block; margin-top: 2px; font-size: 0.84rem; font-weight: 500; line-height: 1.4; color: var(--text-2); }
.choice__radio { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; color: transparent; box-shadow: inset 0 0 0 2px var(--line); transition: background-color 0.18s ease, color 0.18s ease; }
.choice__radio .ic { width: 14px; height: 14px; stroke-width: 3; }
.choice input:checked + .choice__box { box-shadow: inset 0 0 0 2px var(--ink); }
.choice input:checked + .choice__box .choice__icon { background: var(--brand); color: var(--white); }
.choice input:checked + .choice__box .choice__radio { background: var(--ink); color: var(--white); box-shadow: none; }
.choice input:focus-visible + .choice__box { outline: 2px solid var(--brand); outline-offset: 3px; }

/* ---------- Password strength ---------- */
.strength { display: flex; align-items: center; gap: 12px; }
.strength__bars { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.strength__bar { height: 4px; border-radius: 4px; background: var(--line); transition: background-color 0.2s ease; }
.strength__bar.is-weak { background: var(--danger); }
.strength__bar.is-fair { background: #F59E0B; }
.strength__bar.is-good { background: #65A30D; }
.strength__bar.is-strong { background: var(--success); }
.strength__label { min-width: 64px; text-align: right; font-size: 0.76rem; font-weight: 700; color: var(--text-2); }

/* ---------- Summary ---------- */
.summary { margin: 0; padding: 4px 16px; background: var(--white); border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line); }
.summary__row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; font-size: 0.9rem; border-bottom: 1px solid var(--line); }
.summary__row:last-child { border-bottom: 0; }
.summary__row dt { font-weight: 600; color: var(--text-2); }
.summary__row dd { font-weight: 700; text-align: right; word-break: break-all; }

.resend { text-align: center; font-size: 0.9rem; font-weight: 500; color: var(--text-2); }
.resend button { font-weight: 800; color: var(--text); }
.resend button:disabled { color: var(--text-3); cursor: default; }

/* ---------- Button loading state ---------- */
.btn { position: relative; }
.btn .ic { width: 20px; height: 20px; }
.btn--ghost { --spin-track: rgba(11, 11, 12, 0.15); --spin-head: var(--ink); }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading[disabled] { opacity: 1; }
.btn.is-loading::after {
  content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--spin-track, rgba(255, 255, 255, 0.3));
  border-top-color: var(--spin-head, #fff);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: calc(var(--safe-t) + 12px); left: 0; right: 0; z-index: 500; display: grid; gap: 8px; justify-items: center; padding: 0 16px; pointer-events: none; }
.toast {
  width: 100%; max-width: 420px; padding: 14px 16px 14px 20px; border-radius: 14px;
  background: var(--ink); color: var(--text-inv); font-size: 0.9rem; font-weight: 600; line-height: 1.4;
  box-shadow: inset 4px 0 0 var(--tone, rgba(245, 243, 238, 0.4)), 0 12px 32px -8px rgba(11, 11, 12, 0.45);
  opacity: 0; transform: translateY(-12px);
  transition: opacity 0.25s ease, transform 0.35s var(--ease-out);
}
.toast.is-in { opacity: 1; transform: none; }
.toast--error { --tone: var(--danger); }
.toast--success { --tone: var(--success); }

/* ---------- Bottom sheet ---------- */
.sheet-overlay { position: fixed; inset: 0; z-index: 400; display: flex; align-items: flex-end; background: rgba(11, 11, 12, 0); transition: background-color 0.3s ease; }
.sheet-overlay.is-open { background: rgba(11, 11, 12, 0.55); }
.sheet-panel {
  width: 100%; max-height: 88dvh; overflow: auto;
  padding: 12px var(--gutter) calc(var(--safe-b) + 20px);
  background: var(--bone); border-radius: var(--r-xl) var(--r-xl) 0 0;
  transform: translateY(100%); transition: transform 0.45s var(--ease-out);
}
.sheet-overlay.is-open .sheet-panel { transform: none; }
.sheet-handle { display: block; width: 40px; height: 4px; margin: 0 auto 20px; border-radius: 4px; background: var(--line); }
.sheet-badge { width: 56px; height: 56px; margin-bottom: 16px; display: grid; place-items: center; border-radius: 50%; background: rgba(18, 161, 80, 0.12); color: var(--success); }
.sheet-title { font-family: var(--f-display); font-weight: 800; font-size: 1.5rem; line-height: 1.1; letter-spacing: -0.03em; }
.sheet-text { margin-top: 10px; font-weight: 500; line-height: 1.5; color: var(--text-2); }
.sheet-text strong { color: var(--text); word-break: break-all; }
.sheet-body { margin-top: 18px; }
.sheet-body:empty { display: none; }
.sheet-actions { display: grid; gap: 10px; margin-top: 22px; }
