/* ═══════════════════════════════════════════════════════════════════════════
   Admin form system (AdminFormBuilder). One look for every dashboard form:
   sectioned cards, a responsive grid, clear labels, inline errors, image
   uploads with previews, switches and choice chips, and an action bar that
   stays reachable on phones.
   ═══════════════════════════════════════════════════════════════════════════ */

.fx-page { max-width: 1040px; margin: 0 auto; }
.fx-page--narrow { max-width: 760px; }
.fx-page__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.fx-page__intro { color: var(--slate-500); font-size: .9rem; margin: .25rem 0 0; max-width: 60ch; }
.fx-back { font-size: .85rem; color: var(--slate-500); text-decoration: none; }
.fx-back:hover { color: var(--slate-800); text-decoration: underline; }

.fx-form { display: grid; gap: 1.25rem; }
.fx-layout { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 1100px) { .fx-layout { grid-template-columns: minmax(0, 1fr) 320px; } .fx-layout__side { position: sticky; top: 1.25rem; display: grid; gap: 1.25rem; } }

/* Cards */
.fx-card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.fx-card__head { padding: 1.25rem 1.5rem 0; }
.fx-card__title { font-size: 1rem; font-weight: 700; color: var(--slate-900); margin: 0; }
.fx-card__desc { font-size: .84rem; color: var(--slate-500); margin: .3rem 0 0; }
.fx-card__body { padding: 1.25rem 1.5rem 1.5rem; display: grid; gap: 1.1rem; }
@media (max-width: 640px) { .fx-card__head { padding: 1rem 1rem 0; } .fx-card__body { padding: 1rem; } }

/* Grid */
.fx-grid { display: grid; gap: 1.1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) {
  .fx-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fx-span-2 { grid-column: span 2; }
  .fx-span-all { grid-column: 1 / -1; }
}

/* Fields */
.fx-field { display: grid; gap: .4rem; min-width: 0; align-content: start; }
.fx-field[hidden] { display: none; }
.fx-label { font-size: .8rem; font-weight: 600; color: var(--slate-700); }
.fx-label .fx-req { color: var(--danger); margin-left: .15rem; }
.fx-label .fx-optional { color: var(--slate-400); font-weight: 500; margin-left: .3rem; }
.fx-hint { font-size: .76rem; color: var(--slate-500); margin: 0; line-height: 1.45; }
.fx-error { font-size: .78rem; color: var(--danger); margin: 0; font-weight: 500; }

.fx-input,
.fx-field select.fx-input,
.fx-field textarea.fx-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: .65rem .85rem;
  border: 1.5px solid var(--slate-200);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: .92rem;
  color: var(--slate-900);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.fx-input::placeholder { color: var(--slate-400); }
.fx-input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 196, 130, 69), .18); }
.fx-field.is-invalid .fx-input { border-color: var(--danger); }
textarea.fx-input { min-height: 110px; resize: vertical; line-height: 1.55; }
select.fx-input {
  appearance: none;
  padding-right: 2.25rem;
  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='%237E7063' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
}
.fx-input-group { display: flex; align-items: stretch; }
.fx-input-group__addon { display: inline-flex; align-items: center; padding: 0 .8rem; border: 1.5px solid var(--slate-200); border-right: 0; border-radius: 10px 0 0 10px; background: var(--slate-100); color: var(--slate-600); font-size: .85rem; font-weight: 600; }
.fx-input-group .fx-input { border-radius: 0 10px 10px 0; }

/* Choice chips (radio groups such as Male / Female) */
.fx-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.fx-chip { position: relative; }
.fx-chip input { position: absolute; opacity: 0; pointer-events: none; }
.fx-chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: .5rem 1.1rem;
  border: 1.5px solid var(--slate-200); border-radius: 999px; background: #fff;
  font-size: .88rem; font-weight: 600; color: var(--slate-600); cursor: pointer; transition: all var(--transition);
}
.fx-chip input:checked + span { border-color: var(--primary); background: var(--primary); color: #fff; }
.fx-chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 196, 130, 69), .3); }

/* Switch */
.fx-switch { display: flex; align-items: flex-start; gap: .75rem; cursor: pointer; }
.fx-switch input { position: absolute; opacity: 0; pointer-events: none; }
.fx-switch__track { flex-shrink: 0; width: 42px; height: 24px; border-radius: 999px; background: var(--slate-300); position: relative; transition: background var(--transition); margin-top: 1px; }
.fx-switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--transition); }
.fx-switch input:checked + .fx-switch__track { background: var(--primary); }
.fx-switch input:checked + .fx-switch__track::after { transform: translateX(18px); }
.fx-switch input:focus-visible + .fx-switch__track { box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 196, 130, 69), .3); }
.fx-switch__text { display: grid; gap: .1rem; }
.fx-switch__label { font-size: .9rem; font-weight: 600; color: var(--slate-800); }

/* Image upload with preview */
.fx-upload { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.fx-upload__preview {
  flex-shrink: 0; width: 96px; height: 96px; border-radius: 14px; overflow: hidden;
  border: 1.5px dashed var(--slate-300); background: var(--slate-50); display: grid; place-items: center;
}
.fx-upload--wide .fx-upload__preview { width: 100%; max-width: 360px; height: auto; aspect-ratio: 16 / 9; }
.fx-upload--round .fx-upload__preview { border-radius: 50%; }
.fx-upload__preview img { width: 100%; height: 100%; object-fit: cover; }
.fx-upload__placeholder { font-size: .72rem; font-weight: 600; color: var(--slate-400); text-transform: uppercase; letter-spacing: .06em; text-align: center; padding: .5rem; }
.fx-upload__controls { display: grid; gap: .45rem; min-width: 0; }
.fx-upload__button {
  display: inline-flex; align-items: center; gap: .4rem; width: max-content; cursor: pointer;
  padding: .5rem 1rem; border-radius: 999px; border: 1.5px solid var(--slate-300); background: #fff;
  font-size: .82rem; font-weight: 600; color: var(--slate-700);
}
.fx-upload__button:hover { border-color: var(--primary-light); }
.fx-upload__button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fx-upload__name { font-size: .78rem; color: var(--slate-500); word-break: break-all; }
.fx-upload__remove { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--slate-600); cursor: pointer; }

/* Error summary */
.fx-alert { border-radius: var(--radius); padding: 1rem 1.25rem; font-size: .88rem; }
.fx-alert--error { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }
.fx-alert--info { background: var(--crema-badge); border: 1px solid var(--slate-200); color: var(--slate-700); }
.fx-alert ul { margin: .35rem 0 0; padding-left: 1.1rem; }

/* Actions: inline on desktop, a bar pinned to the bottom of the screen on phones */
.fx-actions { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; flex-wrap: wrap; }
.fx-actions .btn { min-height: 44px; }
@media (max-width: 640px) {
  .fx-actions {
    position: sticky; bottom: 0; z-index: 20; margin: 0 -1rem; padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--slate-200);
  }
  .fx-actions .btn { flex: 1; }
}

/* Read-only summaries (profile, settings) */
.fx-summary { display: flex; align-items: center; gap: 1rem; }
.fx-avatar { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--crema-badge); color: var(--primary); font-weight: 700; font-size: 1.2rem; flex-shrink: 0; }
.fx-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fx-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--slate-100); color: var(--slate-600); }
.fx-badge--success { background: #E8F5EC; color: var(--success); }
.fx-badge--warning { background: var(--crema-badge); color: var(--accent-hover); }
.fx-check-list { display: grid; gap: .6rem; }
@media (min-width: 640px) { .fx-check-list--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fx-option { display: flex; gap: .65rem; align-items: flex-start; padding: .85rem 1rem; border: 1.5px solid var(--slate-200); border-radius: 12px; cursor: pointer; transition: border-color var(--transition), background var(--transition); }
.fx-option:has(input:checked) { border-color: var(--primary); background: var(--crema-badge); }
.fx-option input { margin-top: .2rem; accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }
.fx-option__title { font-size: .88rem; font-weight: 600; color: var(--slate-800); display: block; }
.fx-option__desc { font-size: .78rem; color: var(--slate-500); display: block; margin-top: .1rem; }

/* Profile */
.fx-avatar--lg { width: 88px; height: 88px; font-size: 1.8rem; }
.fx-profile-hero__name { font-size: 1.4rem; font-weight: 800; color: var(--slate-900); margin: 0 0 .15rem; }
.fx-profile-hero__badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
@media (max-width: 480px) { .fx-profile-hero .fx-summary { flex-direction: column; text-align: center; } .fx-profile-hero__badges { justify-content: center; } }

/* Bank account verification */
.fx-input--mono { font-family: var(--font-mono, ui-monospace, monospace); letter-spacing: .06em; }
.fx-input--readonly { background: var(--slate-50); font-weight: 600; cursor: default; }
.fx-verify { font-size: .8rem; margin: 0; min-height: 1.1em; color: var(--slate-500); }
.fx-verify.is-pending { color: var(--slate-600); }
.fx-verify.is-success { color: var(--success); font-weight: 600; }
.fx-verify.is-error { color: var(--danger); font-weight: 500; }
.fx-profile-form { margin-top: 1.25rem; }
