/* ============================================================
   PACTLY — MULTI-STEP SIGNING FLOW
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #4F6BFF;
  --blue-h: #3B54E8;
  --mid: #0D1B3E;
  --lilac: #9B8CFF;
  --white: #FFFFFF;
  --mist: #F4F7FC;
  --bdr: #E5E7EB;
  --muted: #7C869A;
  --slate: #4B5468;
  --green: #1FA971;
  --red: #E54D4D;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 100px;
  --sh-md: 0 4px 12px rgba(13,27,62,.06), 0 1px 4px rgba(13,27,62,.04);
  --sh-xl: 0 20px 40px rgba(13,27,62,.06), 0 4px 12px rgba(13,27,62,.04);
  --tr: .2s cubic-bezier(.4,0,.2,1);
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { font-family: var(--font); -webkit-font-smoothing: antialiased; background: var(--mist); color: var(--mid); }
body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* --- Background --- */
.u-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.u-bg__blob { position: absolute; border-radius: 50%; filter: blur(80px); }
.u-bg__blob--1 { width: 400px; height: 400px; top: -120px; left: -100px; background: rgba(79,107,255,.08); }
.u-bg__blob--2 { width: 350px; height: 350px; top: -80px; right: -80px; background: rgba(155,140,255,.06); }

/* --- Header --- */
.u-header { position: sticky; top: 0; z-index: 50; background: rgba(244,247,252,.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--bdr); }
.u-header__inner { max-width: 720px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.u-header__logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.u-header__logo img { height: 36px; width: 36px; border-radius: 8px; }
.u-header__wordmark { font-size: 20px; font-weight: 700; color: var(--mid); letter-spacing: -.02em; }
.u-header__badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--blue); background: rgba(79,107,255,.06); padding: 5px 12px; border-radius: var(--r-pill); }
.u-header__badge svg { stroke: var(--blue); }
.u-header__right { display: flex; align-items: center; gap: 16px; }
.u-header__nav-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--slate); text-decoration: none; padding: 6px 12px; border-radius: var(--r-sm); transition: all var(--tr); }
.u-header__nav-link:hover { color: var(--mid); background: rgba(13,27,62,.04); }
.u-header__nav-link svg { stroke: currentColor; }

/* --- Layout --- */
.u-main { flex: 1; position: relative; z-index: 10; padding: 32px 20px 60px; }
.u-container { max-width: 680px; margin: 0 auto; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.u-progress { display: flex; align-items: flex-start; justify-content: center; margin-bottom: 32px; padding: 0 8px; }
.u-progress__step { display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 1; min-width: 56px; }
.u-progress__dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--bdr); background: var(--white); font-size: 13px; font-weight: 700; color: var(--muted); display: flex; align-items: center; justify-content: center; transition: all .3s; }
.u-progress__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); transition: color .3s; }
.u-progress__line { flex: 1; height: 2px; background: var(--bdr); align-self: center; margin-top: 16px; min-width: 24px; transition: background .3s; }

/* States */
.u-progress__step.is-active .u-progress__dot { background: var(--blue); border-color: var(--blue); color: var(--white); box-shadow: 0 0 0 4px rgba(79,107,255,.15); }
.u-progress__step.is-active .u-progress__label { color: var(--blue); }
.u-progress__step.is-completed .u-progress__dot { background: var(--green); border-color: var(--green); color: var(--white); }
.u-progress__step.is-completed .u-progress__label { color: var(--green); }
.u-progress__step.is-completed + .u-progress__line { background: var(--green); }

/* ============================================================
   STEP CONTAINER
   ============================================================ */
.u-step { display: none; }
.u-step.is-visible { display: block; animation: u-fadeIn .35s ease; }
@keyframes u-fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   CARD
   ============================================================ */
.u-card { background: var(--white); border: 1px solid var(--bdr); border-radius: var(--r-xl); padding: 32px; box-shadow: var(--sh-xl); }

/* ============================================================
   STEP HEADER
   ============================================================ */
.u-step-header { margin-bottom: 24px; }
.u-step-header__title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--mid); }
.u-step-header__sub { font-size: 15px; color: var(--slate); margin-top: 4px; line-height: 1.5; }

/* ============================================================
   DROPZONE
   ============================================================ */
.u-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 40px 24px; border: 2px dashed var(--bdr); border-radius: var(--r-lg); background: linear-gradient(135deg, var(--mist), var(--white)); cursor: pointer; transition: all var(--tr); text-align: center; }
.u-dropzone:hover { border-color: rgba(79,107,255,.3); background: linear-gradient(135deg, rgba(79,107,255,.03), var(--white)); }
.u-dropzone:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79,107,255,.12); }
.u-dropzone.is-dragover { border-color: var(--blue); background: rgba(79,107,255,.04); }
.u-dropzone__input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.u-dropzone__icon { width: 52px; height: 52px; border-radius: var(--r-md); background: rgba(79,107,255,.06); display: flex; align-items: center; justify-content: center; }
.u-dropzone__icon svg { width: 24px; height: 24px; stroke: var(--blue); }
.u-dropzone__text { font-size: 14px; color: var(--slate); }
.u-dropzone__cta { font-weight: 600; color: var(--blue); }
.u-dropzone__hint { font-size: 12px; color: var(--muted); }

/* ============================================================
   FILE PREVIEW
   ============================================================ */
.u-file-preview { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--mist); border: 1px solid var(--bdr); border-radius: var(--r-md); margin-top: 8px; }
.u-file-preview__info { display: flex; align-items: center; gap: 12px; }
.u-file-preview__icon { stroke: var(--blue); flex-shrink: 0; }
.u-file-preview__name { font-size: 14px; font-weight: 600; color: var(--mid); display: block; }
.u-file-preview__size { font-size: 12px; color: var(--muted); }
.u-file-preview__remove { background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 6px; transition: all var(--tr); display: flex; }
.u-file-preview__remove:hover { color: var(--red); background: rgba(229,77,77,.08); }

/* ============================================================
   INPUTS & FIELDS
   ============================================================ */
.u-input { width: 100%; padding: 11px 16px; border: 1px solid var(--bdr); border-radius: var(--r-md); font-size: 14px; font-family: var(--font); color: var(--mid); background: var(--white); transition: all var(--tr); }
.u-input::placeholder { color: var(--muted); }
.u-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79,107,255,.12); }
.u-input--sm { padding: 9px 14px; font-size: 13px; }

.u-select { width: 100%; padding: 11px 40px 11px 16px; border: 1px solid var(--bdr); border-radius: var(--r-md); font-size: 14px; font-family: var(--font); color: var(--mid); background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237C869A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 14px center; appearance: none; cursor: pointer; transition: all var(--tr); }
.u-select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79,107,255,.12); }

.u-label { font-size: 14px; font-weight: 600; color: var(--mid); display: block; margin-bottom: 6px; }
.u-field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.u-field-group { margin-bottom: 0; }
.u-field-row { display: flex; gap: 12px; }

.u-divider { border: none; border-top: 1px solid var(--bdr); margin: 20px 0; }

/* ============================================================
   SIGNERS
   ============================================================ */
.u-signers { display: flex; flex-direction: column; gap: 10px; }
.u-signer { display: flex; align-items: center; gap: 8px; }
.u-signer__input { flex: 1; }
.u-signer__remove { background: none; border: none; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; transition: all var(--tr); display: flex; flex-shrink: 0; }
.u-signer__remove:hover { color: var(--red); background: rgba(229,77,77,.08); }

.u-add-signer { margin-top: 12px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; font-size: 14px; font-weight: 600; font-family: var(--font); color: var(--blue); background: rgba(79,107,255,.04); border: 2px dashed rgba(79,107,255,.2); border-radius: var(--r-md); cursor: pointer; transition: all var(--tr); }
.u-add-signer:hover { background: rgba(79,107,255,.08); border-color: rgba(79,107,255,.35); }

/* ============================================================
   TOGGLE
   ============================================================ */
.u-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.u-toggle-row__content { display: flex; flex-direction: column; }
.u-toggle-row__label { font-size: 14px; font-weight: 600; color: var(--mid); }
.u-toggle-row__hint { font-size: 12px; color: var(--muted); }

.u-toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.u-toggle input { opacity: 0; width: 0; height: 0; }
.u-toggle__track { position: absolute; inset: 0; background: var(--bdr); border-radius: var(--r-pill); transition: .3s; cursor: pointer; }
.u-toggle__track::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: var(--white); border-radius: 50%; transition: .3s; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.u-toggle input:checked + .u-toggle__track { background: var(--blue); }
.u-toggle input:checked + .u-toggle__track::before { transform: translateX(20px); }

/* ============================================================
   INFO BLOCK
   ============================================================ */
.u-info-block { display: flex; gap: 14px; padding: 16px 20px; background: var(--mist); border-radius: var(--r-md); margin-top: 8px; }
.u-info-block__icon { flex-shrink: 0; margin-top: 2px; }
.u-info-block__icon svg { stroke: var(--blue); }
.u-info-block__title { font-size: 14px; font-weight: 600; color: var(--mid); margin-bottom: 4px; }
.u-info-block__text { font-size: 13px; color: var(--slate); line-height: 1.55; }

/* ============================================================
   REVIEW
   ============================================================ */
.u-review { border: 1px solid var(--bdr); border-radius: var(--r-lg); padding: 20px 24px; background: rgba(244,247,252,.5); }
.u-review__section { padding: 4px 0; }
.u-review__section-header { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--mid); margin-bottom: 10px; }
.u-review__section-header svg { stroke: var(--blue); flex-shrink: 0; }
.u-review__value { font-size: 14px; color: var(--mid); font-weight: 500; }

.u-review__signers { display: flex; flex-direction: column; gap: 8px; }
.u-review__signer { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--white); border: 1px solid var(--bdr); border-radius: var(--r-sm); }
.u-review__signer-email { font-size: 14px; color: var(--mid); font-weight: 500; }
.u-review__signer-status { font-size: 12px; font-weight: 600; color: var(--green); display: flex; align-items: center; gap: 5px; }
.u-review__signer-status svg { stroke: var(--green); }

.u-review__badges { display: flex; flex-wrap: wrap; gap: 8px; }
.u-review__badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--green); background: rgba(31,169,113,.06); padding: 5px 12px; border-radius: var(--r-pill); }
.u-review__badge svg { stroke: var(--green); }

/* ============================================================
   ACCORDION
   ============================================================ */
.u-accordion__trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: none; cursor: pointer; padding: 4px 0; font-family: var(--font); }
.u-accordion__chevron { transition: transform .2s; stroke: var(--muted); }
.u-accordion.is-open .u-accordion__chevron { transform: rotate(180deg); }

/* ============================================================
   CHECKBOX
   ============================================================ */
.u-checkbox { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; color: var(--slate); }
.u-checkbox input { display: none; }
.u-checkbox__mark { width: 20px; height: 20px; border: 2px solid var(--bdr); border-radius: 5px; flex-shrink: 0; transition: .2s; display: flex; align-items: center; justify-content: center; background: var(--white); position: relative; }
.u-checkbox input:checked + .u-checkbox__mark { background: var(--blue); border-color: var(--blue); }
.u-checkbox input:checked + .u-checkbox__mark::after { content: ''; display: block; width: 5px; height: 9px; border: solid var(--white); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.u-checkbox__text { padding-top: 1px; line-height: 1.4; }

/* ============================================================
   PRICING
   ============================================================ */
.u-pricing { border: 1px solid var(--bdr); border-radius: var(--r-lg); padding: 20px 24px; background: rgba(244,247,252,.5); }
.u-pricing__row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; color: var(--slate); }
.u-pricing__row--total { font-size: 18px; font-weight: 700; color: var(--mid); padding-top: 12px; }
.u-pricing__row--total small { font-size: 12px; font-weight: 400; color: var(--muted); }

/* ============================================================
   PAYMENT METHODS
   ============================================================ */
.u-payment-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.u-payment-method { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border: 2px solid var(--bdr); border-radius: var(--r-md); background: var(--white); cursor: pointer; font-size: 12px; font-weight: 600; color: var(--slate); font-family: var(--font); transition: all var(--tr); }
.u-payment-method:hover { border-color: rgba(79,107,255,.3); }
.u-payment-method.is-active { border-color: var(--blue); background: rgba(79,107,255,.03); color: var(--blue); }
.u-payment-method.is-active svg { stroke: var(--blue); }
.u-payment-method svg { stroke: var(--slate); transition: stroke var(--tr); }

.u-pay-fields { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.u-pay-mock { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; background: var(--mist); border-radius: var(--r-md); border: 1px solid var(--bdr); }

.u-company-fields { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.u-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 28px; font-size: 15px; font-weight: 700; font-family: var(--font); border-radius: var(--r-md); cursor: pointer; transition: all var(--tr); border: none; }
.u-btn--primary { background: var(--blue); color: var(--white); box-shadow: var(--sh-md); }
.u-btn--primary:hover:not(:disabled) { background: var(--blue-h); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(13,27,62,.1); }
.u-btn--primary:disabled { opacity: .45; cursor: not-allowed; }
.u-btn--secondary { background: var(--white); color: var(--slate); border: 1px solid var(--bdr); }
.u-btn--secondary:hover { background: var(--mist); border-color: #D1D5DB; }

.u-nav-buttons { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; gap: 12px; }
.u-nav-buttons .u-btn--primary { margin-left: auto; }

/* ============================================================
   AI BANNER
   ============================================================ */
.u-ai-banner { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-radius: var(--r-md); border: 1px solid var(--bdr); background: var(--mist); margin-top: 24px; transition: all var(--tr); }
.u-ai-banner:hover { box-shadow: var(--sh-md); }
.u-ai-banner__icon { width: 42px; height: 42px; border-radius: var(--r-md); background: rgba(79,107,255,.06); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.u-ai-banner__icon svg { stroke: var(--blue); }
.u-ai-banner__title { font-size: 14px; font-weight: 600; color: var(--mid); margin-bottom: 2px; }
.u-ai-banner__text { font-size: 13px; color: var(--slate); }

.u-link { color: var(--blue); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 2px; }
.u-link:hover { color: var(--blue-h); }

/* ============================================================
   SUCCESS
   ============================================================ */
.u-card--success { text-align: center; padding: 48px 32px; }
.u-success-icon { width: 72px; height: 72px; border-radius: 50%; background: rgba(31,169,113,.1); display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.u-success-icon svg { stroke: var(--green); }
.u-success__title { font-size: 24px; font-weight: 700; color: var(--mid); margin-bottom: 6px; }
.u-success__sub { font-size: 15px; color: var(--slate); }

.u-success-summary { margin-top: 28px; border: 1px solid var(--bdr); border-radius: var(--r-lg); padding: 20px 24px; text-align: left; background: rgba(244,247,252,.5); }
.u-success-summary__row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.u-success-summary__label { color: var(--muted); font-weight: 500; }
.u-success-summary__value { color: var(--mid); font-weight: 600; }
.u-success-summary__value--status { display: flex; align-items: center; gap: 6px; color: var(--green); }

.u-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: u-pulse 2s infinite; }
@keyframes u-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.u-success-actions { margin-top: 28px; display: flex; flex-direction: column; gap: 10px; }
.u-success-actions .u-btn { width: 100%; }

/* ============================================================
   FOOTER
   ============================================================ */
.u-footer { border-top: 1px solid var(--bdr); padding: 20px; text-align: center; position: relative; z-index: 10; font-size: 12px; color: var(--muted); }
.u-footer a { color: var(--muted); text-decoration: underline dotted; }
.u-footer a:hover { color: var(--blue); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .u-main { padding: 24px 16px 48px; }
  .u-card { padding: 24px 20px; }
  .u-step-header__title { font-size: 20px; }
  .u-payment-methods { grid-template-columns: repeat(2, 1fr); }
  .u-progress__label { font-size: 10px; }
  .u-progress__dot { width: 28px; height: 28px; font-size: 12px; }
}

@media (max-width: 480px) {
  .u-card { padding: 20px 16px; border-radius: var(--r-lg); }
  .u-header__badge { display: none; }
  .u-progress__label { display: none; }
  .u-field-row { flex-direction: column; }
  .u-review__badges { flex-direction: column; }
}
