/* ===== Shared: registration, login, user portal forms ===== */

/* --- Registration page --- */
.register-page {
  max-width: 880px;
  margin: 0 auto;
  padding: 8px 0 56px;
}
.register-hero {
  text-align: center;
  margin-bottom: 36px;
}
.register-hero__badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 212, 255, 0.25);
  margin-bottom: 16px;
}
.register-hero__title {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 400;
  margin: 0 0 12px;
  line-height: 1.2;
}
.register-hero__title em {
  font-style: italic;
  color: var(--cyan);
}
.register-hero__sub {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 560px;
  margin: 0 auto 28px;
}
.register-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.register-steps li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}
.register-steps li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.65rem;
  color: var(--cyan);
  background: var(--cyan-dim);
}
.register-form {
  padding: 2%;
}
.register-section {
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.register-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.register-section__head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.register-section__num {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cyan);
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 212, 255, 0.2);
}
.register-section__head h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 600;
}
.register-section__head p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.register-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}
.register-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.register-field--full {
  grid-column: 1 / -1;
}
.register-field__hint {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.register-consent {
  margin-top: 28px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.register-consent__label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
}

.register-consent__label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--cyan);
  cursor: pointer;
}

.register-actions {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.register-actions__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.register-actions .btn-primary-custom,
.register-actions__cancel {
  flex: 1 1 200px;
  max-width: 280px;
  padding: 14px 24px;
  font-size: 1rem;
  text-align: center;
  justify-content: center;
}

.register-actions__cancel {
  display: inline-flex;
  align-items: center;
}
.register-success {
  padding: 2%;
  text-align: center;
}
.register-success__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.35);
}
.register-success__icon svg {
  width: 32px;
  height: 32px;
}
.register-success h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin: 0 0 10px;
}
.register-success p {
  color: var(--text-muted);
  margin: 0 auto 24px;
  max-width: 480px;
}
.register-footer-link {
  text-align: center;
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.register-footer-link a {
  color: var(--cyan);
  font-weight: 600;
}
.register-footer-link a:hover {
  text-decoration: underline;
}

/* --- Login (public layout) --- */
.user-auth-page {
  max-width: 440px;
  margin: 0 auto;
  padding: 16px 0 48px;
}
.user-auth-card {
  padding: 2%;
}
.user-auth-card__head {
  text-align: center;
  margin-bottom: 28px;
}
.user-auth-card__head h1 {
  font-family: var(--serif);
  font-size: 1.65rem;
  margin: 0 0 8px;
}
.user-auth-card__head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.user-auth-card__foot {
  margin-top: 22px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.user-auth-card__foot a {
  color: var(--cyan);
  font-weight: 600;
}

/* --- Form controls (public + portal) --- */
.form-label,
.u-form label,
.form-stack label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-control,
.u-form input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
.u-form select,
.u-form textarea,
.form-stack input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
.form-stack select,
.form-stack textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus,
.u-form input:focus,
.u-form select:focus,
.u-form textarea:focus,
.form-stack input:focus,
.form-stack select:focus,
.form-stack textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}
.form-control:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.u-form textarea,
.form-stack textarea {
  resize: vertical;
  min-height: 88px;
}
.u-form--stack .u-field,
.form-stack .u-field {
  margin-bottom: 16px;
}
.u-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}
.u-form-grid--1 {
  grid-template-columns: 1fr;
}
.u-field--full {
  grid-column: 1 / -1;
}
.loan-form-group__title {
  grid-column: 1 / -1;
  margin-top: 6px;
  margin-bottom: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.u-field__hint {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.u-form-actions {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.u-form-actions .btn {
  width: 100%;
}

/* File uploads */
.file-input-wrap {
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 18px 16px;
  background: rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s, background 0.2s;
}
.file-input-wrap:hover,
.file-input-wrap:focus-within {
  border-color: rgba(0, 212, 255, 0.45);
  background: rgba(0, 212, 255, 0.04);
}
.file-input {
  width: 100%;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: inherit;
}
.file-input::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: var(--gradient-btn);
  color: #050a14;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}

/* Password toggle */
.password-field {
  position: relative;
  display: block;
}
.u-form .password-field,
.form-stack .password-field {
  margin-bottom: 16px;
}
.password-field .form-control {
  padding-right: 2.75rem;
}
.password-field__toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.password-field__toggle:hover {
  color: var(--cyan);
  background: var(--cyan-dim);
}
.password-field__toggle:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.password-field__svg {
  width: 20px;
  height: 20px;
  display: block;
}
.password-field__icon--hide {
  display: none;
}
.password-field.is-visible .password-field__icon--show {
  display: none;
}
.password-field.is-visible .password-field__icon--hide {
  display: block;
}

/* Portal panel forms */
.admin-page-content .panel .u-form,
.admin-page-content .panel .form-stack {
  margin-top: 4px;
}
.admin-page-content .modal-card__body.u-form-grid {
  padding: 2%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}
.admin-page-content .modal-card__body .u-field--full {
  grid-column: 1 / -1;
}

/* User portal — card padding handled by portal-cards.css */
body.user-portal .sidebar__profile.card {
  padding: 18px;
}

body.user-portal .panel--flush-table > .panel__title,
body.user-portal .panel--flush-table .panel__title,
body.user-portal .panel__title--flush {
  padding: 18px 22px 14px;
}

body.user-portal .panel__title--flush {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* User dashboard */
.user-dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-dashboard__leads {
  margin-bottom: 0;
}

.user-dashboard__empty {
  text-align: center;
  padding: 28px 16px !important;
}

.user-dashboard__empty p {
  margin: 0 0 14px;
}

.stats-row--primary {
  margin-bottom: 0;
}

.stats-row--secondary {
  margin-bottom: 0;
}

.stat-mini--compact .stat-mini__label {
  font-size: 0.65rem;
  margin-bottom: 4px;
}

body.user-portal .panel--flush-table .table-foot {
  padding: 14px 22px;
}

@media (max-width: 768px) {
  .register-form,
  .user-auth-card {
    padding: 16px;
  }
  .register-grid,
  .register-grid--3,
  .u-form-grid,
  .admin-page-content .modal-card__body.u-form-grid {
    grid-template-columns: 1fr;
  }
  .register-section__head {
    flex-direction: column;
    gap: 10px;
  }

  .register-page {
    padding: 0 8px 40px;
  }

  .register-hero {
    margin-bottom: 24px;
  }

  .register-steps li {
    flex: 1 1 calc(50% - 10px);
    justify-content: center;
  }

  .user-auth-page {
    padding: 8px 12px 40px;
  }

  .file-input::file-selector-button {
    display: block;
    width: 100%;
    margin: 0 0 10px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .register-steps {
    flex-direction: column;
    align-items: stretch;
  }

  .register-steps li {
    flex: 1 1 auto;
  }
}

/* KYC document actions */
.kyc-grid__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kyc-doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kyc-doc-actions .btn {
  flex: 1 1 auto;
  min-width: 88px;
  justify-content: center;
}

/* User portal — document scroll (profile, KYC, password tabs) */
html:has(body.user-portal.admin-layout) {
  height: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.user-portal.admin-layout {
  display: block;
  position: relative;
  height: auto;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

body.user-portal .main {
  display: block;
  height: auto;
  min-height: 0;
  overflow: visible;
}

body.user-portal .admin-page-content {
  flex: none;
  height: auto;
  min-height: 0;
  overflow: visible;
  overflow-x: hidden;
}

body.user-portal .tab-nav {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

body.user-portal .detail-grid {
  overflow: visible;
}

/* ===== User portal — mobile partner experience ===== */
.user-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
  margin: 0;
}

.user-mobile-nav {
  display: none;
}

@media (max-width: 768px) {
  /* Use document scroll instead of nested flex scroll container */
  body.user-portal.admin-layout {
    min-height: 100dvh;
  }

  body.user-portal .admin-page-content {
    padding: 14px 12px calc(108px + env(safe-area-inset-bottom, 0px));
  }

  body.user-portal .panel.card {
    margin-bottom: 12px;
  }

  body.user-portal .panel .u-form--stack .u-field:last-of-type,
  body.user-portal .panel .u-form .u-field:last-of-type {
    margin-bottom: 4px;
  }

  body.user-portal .panel--flush-table {
    overflow: visible;
  }

  /* Modal: pin Save/Cancel footer while body scrolls */
  body.user-portal .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  body.user-portal .modal-card {
    display: flex;
    flex-direction: column;
    max-height: min(92dvh, 92vh);
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    max-width: 100%;
  }

  body.user-portal .modal-card > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: inherit;
    flex: 1;
  }

  body.user-portal .modal-card__header {
    flex-shrink: 0;
  }

  body.user-portal .modal-card__body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    overscroll-behavior: contain;
  }

  body.user-portal .modal-card__footer {
    flex-shrink: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  body.user-portal .modal-card__footer .btn {
    width: 100%;
    min-height: 44px;
  }

  body.user-portal.modal-open .user-mobile-nav {
    display: none;
  }

  body.user-portal.admin-layout.sidebar-open .user-mobile-nav {
    display: none;
  }

  /* Page forms — normal flow so fields are not covered by sticky submit bar */
  body.user-portal .panel .u-form-actions {
    position: static;
    z-index: auto;
    margin-top: 20px;
    margin-left: -16px;
    margin-right: -16px;
    margin-bottom: 0;
    padding: 14px 16px 16px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: none;
  }

  body.user-portal .panel .u-form-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  body.user-portal .admin-page-content .panel:not(.panel--flush-table),
  body.user-portal .admin-page-content .stat-mini.card,
  body.user-portal .admin-page-content .profile-card.panel {
    padding: 16px;
  }

  body.user-portal .panel--flush-table > .panel__title,
  body.user-portal .panel--flush-table .panel__title,
  body.user-portal .panel__title--flush {
    padding: 16px 16px 0;
    flex-direction: column;
    align-items: flex-start;
  }

  body.user-portal .panel__title--flush .btn {
    width: 100%;
    justify-content: center;
  }

  body.user-portal .panel--flush-table .table-foot {
    padding: 12px 16px;
  }

  body.user-portal .user-dashboard {
    gap: 12px;
  }

  body.user-portal .user-dashboard .page-header--row {
    margin-bottom: 4px;
  }

  body.user-portal .user-dashboard .page-header__sub {
    font-size: 0.85rem;
  }

  body.user-portal .user-dashboard .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 12px;
  }

  body.user-portal .user-dashboard .stat-mini.card {
    min-height: 108px;
  }

  body.user-portal .user-dashboard .stat-mini--compact {
    min-height: 108px;
    padding: 16px 14px;
  }

  body.user-portal .user-dashboard .stat-mini__label {
    min-height: 2.4em;
    font-size: 0.62rem;
  }

  body.user-portal .user-dashboard .stat-mini__value {
    font-size: 1.25rem;
  }

  body.user-portal .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  /* Dashboard lead cards */
  body.user-portal .user-dashboard .data-table--mobile tbody tr {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
  }

  body.user-portal .user-dashboard .data-table--mobile tbody td.lead-card__name {
    order: 1;
    display: block;
    padding: 14px 16px 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    border-bottom: none;
  }

  body.user-portal .user-dashboard .data-table--mobile tbody td.lead-card__name::before {
    display: none;
  }

  body.user-portal .user-dashboard .data-table--mobile tbody td.lead-card__status {
    order: 2;
    display: block;
    padding: 0 16px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
  }

  body.user-portal .user-dashboard .data-table--mobile tbody td.lead-card__status::before {
    display: none;
  }

  body.user-portal .user-dashboard .data-table--mobile tbody td.lead-card__meta {
    display: none;
  }

  body.user-portal .user-dashboard .data-table--mobile tbody td[data-label="Action"] {
    order: 10;
    margin-top: 0;
    border-top: none;
    padding: 12px 16px 14px;
  }

  body.user-portal .stat-mini__value {
    font-size: 1.25rem;
  }

  body.user-portal .topbar {
    padding: 10px 12px;
    gap: 8px;
  }

  body.user-portal .topbar__left {
    flex: 1;
    min-width: 0;
  }

  body.user-portal .topbar__title {
    font-size: 1.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  body.user-portal .topbar__right {
    width: 100%;
    margin-left: 0;
    order: 3;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  body.user-portal .topbar__right .topbar__theme-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  body.user-portal .topbar__right #open-add-lead {
    flex: 0 0 auto;
    width: auto;
    min-height: 36px;
    padding: 7px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  body.user-portal .filters__actions {
    width: 100%;
  }

  body.user-portal .filters__actions .btn {
    flex: 1;
    justify-content: center;
  }

  body.user-portal .user-info-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  body.user-portal .back-link {
    font-size: 0.8125rem;
    margin-bottom: 12px;
  }

  body.user-portal .page-header__title {
    font-size: 1.15rem;
    line-height: 1.35;
    word-break: break-word;
  }

  body.user-portal .detail-sidebar .panel + .panel {
    margin-top: 0;
  }

  /* Tables → card rows on small screens */
  body.user-portal .data-table--mobile thead {
    display: none;
  }

  body.user-portal .data-table--mobile tbody tr {
    display: block;
    margin-bottom: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
  }

  body.user-portal .data-table--mobile tbody tr:hover td {
    background: transparent;
  }

  body.user-portal .data-table--mobile tbody tr:last-child {
    margin-bottom: 0;
  }

  body.user-portal .data-table--mobile tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border-bottom: none;
    text-align: right;
    font-size: 0.875rem;
  }

  body.user-portal .data-table--mobile tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    flex-shrink: 0;
  }

  body.user-portal .data-table--mobile tbody td[colspan] {
    display: block;
    text-align: center;
    padding: 24px 0;
  }

  body.user-portal .data-table--mobile tbody td[colspan]::before {
    display: none;
  }

  body.user-portal .data-table--mobile tbody td[data-label="Action"] {
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
  }

  body.user-portal .data-table--mobile tbody td[data-label="Action"] .btn {
    width: 100%;
    justify-content: center;
  }

  body.user-portal .data-table-wrap--scroll {
    overflow: visible;
  }

  body.user-portal .panel--flush-table .data-table-wrap {
    padding: 0 12px 12px;
  }

  /* Sticky bottom navigation */
  .user-mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(5, 10, 20, 0.96);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .user-mobile-nav__link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    transition: color 0.2s, background 0.2s;
  }

  .user-mobile-nav__link svg {
    flex-shrink: 0;
  }

  .user-mobile-nav__link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
  }

  .user-mobile-nav__link--active {
    color: var(--cyan);
    background: var(--cyan-dim);
  }
}

@media (max-width: 480px) {
  body.user-portal .user-dashboard .stats-row,
  body.user-portal .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.user-portal .stat-mini__value {
    font-size: 1.35rem;
  }
}

@media (max-width: 380px) {
  .user-mobile-nav__link span {
    font-size: 0.6rem;
  }
}

