/* ============================================================
   FORMS
   ------------------------------------------------------------
   The complete form system. Every input type, control,
   validation state, and file-upload workflow.

   Reads from: foundation.css (tokens) + components.css
   Composes with: cards.css, overlays.css

   ============================================================
   THEME
   ============================================================
   Every control reads a semantic token that theme.css flips:
     --surface, --surface-soft, --surface-muted
     --border, --border-soft, --border-strong
     --text, --text-soft, --text-muted, --text-light
     --heading
     --focus-ring

   A handful of controls reach for a light pastel
   (--blue-50, --success-soft, --danger-soft, --warning-soft)
   when they are "checked" or "highlighted". Those pastels
   flip correctly via theme.css — the soft variants become
   translucent tints of their foreground colour on dark.

   The exceptions that need an explicit dark override are
   documented inline where they live:
     · Autofill text-fill override
     · Date-picker native icon inversion
     · Clear / password-toggle / search-clear resting colour
     · Upload dropzone icon and hover state
     · Switch card, checkbox card, radio card, availability
       option, role option — checked state uses --blue-50
       which glows on dark; overridden
     · Password strength tier 3 (--ca8a04) and the strength
       label colours
     · Skills editor chip
     · Field-status-icon loading spinner colour

   ============================================================
   RTL
   ============================================================
   Every input with a leading icon uses padding-inline-start
   instead of padding-left. Every absolutely-positioned icon
   uses inset-inline-start / inset-inline-end instead of
   left / right. The browser maps these to physical left or
   right based on the html element's dir attribute.

   No explicit RTL override is needed for any layout rule
   in this file.

   ============================================================
   ARABIC
   ============================================================
   Letter-spacing is zeroed on every uppercase-Latin class:
     .form-label, .field-label, .fieldset-legend,
     .upload-private-badge, .password-strength-label,
     .rating-label, .field-message, .info-value-badge
   ============================================================ */


/* ============================================================
   01 · FORM FOUNDATION
   ============================================================ */

/* ---------- FORM WRAPPER ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  width: 100%;
}

.form-compact { gap: var(--space-4); }
.form-loose   { gap: var(--space-7); }

/* ---------- ROW ---------- */

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.form-row-2,
.form-row.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.form-row-3,
.form-row.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.form-row-4,
.form-row.four-col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-row.col-1-2,
.form-row-1-2 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}

.form-row.col-2-1,
.form-row-2-1 {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

@media (max-width: 640px) {
  .form-row,
  .form-row-2,
  .form-row-3,
  .form-row-4,
  .form-row.col-1-2,
  .form-row.col-2-1,
  .form-row.three-col,
  .form-row.four-col {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

/* ---------- GROUP ---------- */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}

.form-group.flush { gap: 0; }
.form-group.tight { gap: var(--space-1); }
.form-group.loose { gap: var(--space-3); }

/* ---------- FIELD ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
  position: relative;
}

.field-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ---------- LABEL ---------- */

.form-label,
.field-label {
  display: block;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1.4;
  letter-spacing: 0.01em;
}

html[lang="ar"] .form-label,
html[lang="ar"] .field-label {
  letter-spacing: 0;
}

.form-label-lg {
  font-size: var(--fs-md);
}

.form-label-sm,
.field-label-sm {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
}

/* ---------- LABEL ROW ---------- */

.form-label-row,
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
}

.form-label-row .form-label,
.form-label-row .field-label,
.field-label-row .field-label {
  margin-bottom: 0;
}

.form-label-action {
  color: var(--blue-600);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease);
}

html[data-theme="dark"] .form-label-action {
  color: var(--blue-400);
}

.form-label-action:hover {
  color: var(--blue-700);
  text-decoration: underline;
  text-underline-offset: 3px;
}

html[data-theme="dark"] .form-label-action:hover {
  color: var(--blue-100);
}

/* ---------- REQUIRED / OPTIONAL ---------- */

.form-required::after,
.required {
  color: var(--danger);
  font-weight: var(--fw-extrabold);
  margin-inline-start: 2px;
  font-size: 0.9em;
}

.form-required::after { content: " *"; }
.required { display: inline; }

.form-optional {
  color: var(--text-light);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  margin-inline-start: var(--space-1);
}

/* ---------- HELP TEXT ---------- */

.form-help,
.field-hint {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
  font-weight: var(--fw-regular);
}

.form-help-lg {
  font-size: var(--fs-sm);
}

.form-help a,
.field-hint a {
  color: var(--blue-600);
  font-weight: var(--fw-semibold);
}

html[data-theme="dark"] .form-help a,
html[data-theme="dark"] .field-hint a {
  color: var(--blue-400);
}

.form-help code,
.field-hint code {
  padding: 1px 5px;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xs);
  color: var(--heading);
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* ---------- ERROR / SUCCESS / STATUS ---------- */

.form-error,
.field-error {
  display: none;
  color: var(--danger);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.5;
}

.form-group.has-error .form-error,
.form-group.has-error .field-error,
.field[data-invalid="true"] .field-error,
.field-error[role="alert"],
.field-error.is-visible {
  display: block;
}

.form-success {
  display: none;
  color: var(--success);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.5;
}

.form-group.has-success .form-success,
.form-success.is-visible {
  display: block;
}

.form-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.5;
}

.form-status i { font-size: 10px; }

.form-status.success { color: var(--success); }
.form-status.error   { color: var(--danger); }
.form-status.warning { color: var(--warning); }

/* ---------- DIVIDER BETWEEN SECTIONS ---------- */

.form-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  border: none;
  margin: var(--space-2) 0;
}

.form-divider-labeled {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-2) 0;
  color: var(--text-light);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
}

.form-divider-labeled::before,
.form-divider-labeled::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--border-soft);
}

/* ---------- FIELDSET ---------- */

.fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.fieldset-legend {
  display: block;
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

html[lang="ar"] .fieldset-legend {
  letter-spacing: 0;
}

.fieldset-help {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
  margin-bottom: var(--space-3);
}

/* Native fieldset reset */
fieldset {
  border: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}

fieldset > legend {
  padding: 0;
  font-weight: var(--fw-bold);
}

/* ---------- FORM CARD ---------- */

.form-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: var(--space-6);
}

.form-card > * {
  position: relative;
  z-index: 1;
}

@media (max-width: 640px) {
  .form-card {
    padding: var(--space-4);
    border-radius: var(--radius-md);
  }
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 480px) {
  .form { gap: var(--space-4); }
  .form-loose { gap: var(--space-5); }
}


/* ============================================================
   02 · TEXT INPUTS
   ============================================================ */

/* ---------- BASE ---------- */

.form-control,
.input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-4);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.4;

  outline: none;

  transition:
    border-color     var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.form-control::placeholder,
.input::placeholder {
  color: var(--text-light);
  font-weight: var(--fw-regular);
}

.form-control:hover:not(:disabled):not(:focus),
.input:hover:not(:disabled):not(:focus) {
  border-color: var(--border-strong);
}

.form-control:focus,
.input:focus {
  border-color: var(--blue-600);
  background: var(--surface);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .input:focus {
  border-color: var(--blue-400);
}

.form-control:disabled,
.input:disabled {
  background: var(--surface-muted);
  color: var(--text-light);
  cursor: not-allowed;
  opacity: 0.75;
}

.form-control[readonly],
.input[readonly] {
  background: var(--surface-soft);
  color: var(--text-soft);
  cursor: default;
}

/* The light-mode readonly uses --surface-soft which flips
   to a dark navy in dark mode. The result is fine — a
   slightly-lighter-than-surface field — but add an explicit
   darker tint so the readonly state is unambiguously
   distinguishable from an editable field on dark. */
html[data-theme="dark"] .form-control[readonly],
html[data-theme="dark"] .input[readonly] {
  background: var(--surface-muted);
  color: var(--text-muted);
}

/* Autofill override. The WebKit inset box-shadow uses
   --surface, which flips, so the background is correct in
   both themes. The text-fill override also flips. */
.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus,
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px var(--surface) inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* ---------- SIZES ---------- */

.form-control-sm,
.input-sm {
  min-height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
}

.form-control-lg,
.input-lg {
  min-height: 52px;
  padding: 0 var(--space-5);
  font-size: var(--fs-base);
  border-radius: var(--radius-md);
}

.form-control-xl {
  min-height: 60px;
  padding: 0 var(--space-6);
  font-size: var(--fs-lg);
  border-radius: var(--radius-lg);
}

/* ---------- SHAPES ---------- */

.form-control-rounded,
.input-rounded {
  border-radius: var(--radius-pill);
  padding-inline: var(--space-5);
}

.form-control-flat,
.input-flat {
  background: var(--surface-soft);
  border-color: transparent;
}

.form-control-flat:hover:not(:disabled):not(:focus) {
  background: var(--surface-muted);
}

.form-control-flat:focus {
  background: var(--surface);
  border-color: var(--blue-600);
}

/* ---------- INPUT WRAPPER ---------- */

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-wrapper .form-control,
.input-wrapper .input {
  padding-inline-start: 38px;
}

.input-wrapper.input-wrapper-end .form-control,
.input-wrapper.input-wrapper-end .input {
  padding-inline-start: var(--space-4);
  padding-inline-end: 38px;
}

.input-wrapper.input-wrapper-both .form-control,
.input-wrapper.input-wrapper-both .input {
  padding-inline-start: 38px;
  padding-inline-end: 38px;
}

/* ---------- ICONS ---------- */

.input-icon {
  position: absolute;
  inset-inline-start: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: var(--text-light);
  font-size: 13px;

  pointer-events: none;
  z-index: 2;

  transition: color var(--dur-fast) var(--ease);
}

.input-icon-end {
  inset-inline-start: auto;
  inset-inline-end: var(--space-3);
}

.input-wrapper:focus-within .input-icon {
  color: var(--blue-600);
}

html[data-theme="dark"] .input-wrapper:focus-within .input-icon {
  color: var(--blue-400);
}

/* ---------- PREFIX / SUFFIX ---------- */

.input-prefix,
.input-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;

  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;

  pointer-events: none;
  z-index: 2;
}

.input-prefix { inset-inline-start: var(--space-4); }
.input-suffix { inset-inline-end: var(--space-4); }

.input-wrapper.input-wrapper-prefix .form-control,
.input-wrapper.input-wrapper-prefix .input {
  padding-inline-start: 40px;
}

.input-wrapper.input-wrapper-suffix .form-control,
.input-wrapper.input-wrapper-suffix .input {
  padding-inline-end: 48px;
}

/* ---------- INPUT GROUP ---------- */

.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow   var(--dur-fast) var(--ease);
}

.input-group:focus-within {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] .input-group:focus-within {
  border-color: var(--blue-400);
}

.input-group > .form-control,
.input-group > .input {
  border: none;
  box-shadow: none !important;
  border-radius: 0;
  flex: 1 1 auto;
  min-height: 44px;
  background: transparent;
}

.input-group > .form-control:focus,
.input-group > .input:focus {
  box-shadow: none;
}

.input-group-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.input-group-text i,
.input-group-text iconify-icon {
  font-size: 13px;
  color: var(--text-muted);
}

.input-group-text:first-child {
  border-inline-end: 1px solid var(--border);
}

.input-group-text:last-child {
  border-inline-start: 1px solid var(--border);
}

.input-group.input-group-sm > .form-control,
.input-group.input-group-sm > .input,
.input-group.input-group-sm > .input-group-text {
  min-height: 36px;
  font-size: var(--fs-xs);
  padding-inline: var(--space-3);
}

.input-group.input-group-lg > .form-control,
.input-group.input-group-lg > .input,
.input-group.input-group-lg > .input-group-text {
  min-height: 52px;
  font-size: var(--fs-base);
}

/* ---------- CLEAR BUTTON ---------- */

.input-clear {
  position: absolute;
  inset-inline-end: var(--space-2);
  top: 50%;
  transform: translateY(-50%);

  width: 28px;
  height: 28px;
  flex: 0 0 28px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 12px;
  line-height: 1;

  cursor: pointer;
  z-index: 3;

  transition:
    background-color var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.input-clear:hover {
  background: var(--surface-muted);
  color: var(--text-soft);
}

html[data-theme="dark"] .input-clear {
  color: var(--text-muted);
}

html[data-theme="dark"] .input-clear:hover {
  color: var(--text);
}

.input-wrapper.has-clear .form-control,
.input-wrapper.has-clear .input {
  padding-inline-end: 40px;
}

/* ---------- PASSWORD TOGGLE ---------- */

.input-password-toggle {
  position: absolute;
  inset-inline-end: var(--space-2);
  top: 50%;
  transform: translateY(-50%);

  width: 34px;
  height: 34px;
  flex: 0 0 34px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: transparent;
  border: none;
  border-radius: var(--radius-sm);

  color: var(--text-light);
  font-size: 12px;
  line-height: 1;

  cursor: pointer;
  z-index: 3;

  transition:
    background-color var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.input-password-toggle:hover {
  background: var(--surface-soft);
  color: var(--blue-600);
}

html[data-theme="dark"] .input-password-toggle {
  color: var(--text-muted);
}

html[data-theme="dark"] .input-password-toggle:hover {
  color: var(--blue-400);
}

.input-wrapper.has-toggle .form-control,
.input-wrapper.has-toggle .input {
  padding-inline-end: 48px;
}

/* ---------- SEARCH INPUT ---------- */

.input-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-search .form-control,
.input-search .input {
  padding-inline-start: 40px;
  padding-inline-end: 40px;
}

.input-search-icon {
  position: absolute;
  inset-inline-start: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 13px;
  pointer-events: none;
}

.input-search-clear {
  position: absolute;
  inset-inline-end: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 11px;
  cursor: pointer;
}

.input-search-clear:hover {
  background: var(--surface-soft);
  color: var(--text-soft);
}

html[data-theme="dark"] .input-search-clear {
  color: var(--text-muted);
}

html[data-theme="dark"] .input-search-clear:hover {
  color: var(--text);
}

/* ---------- NATIVE DATE / TIME ---------- */

.form-control[type="date"],
.form-control[type="time"],
.form-control[type="datetime-local"],
.form-control[type="month"],
.form-control[type="week"],
.input[type="date"],
.input[type="time"],
.input[type="datetime-local"],
.input[type="month"],
.input[type="week"] {
  padding-inline-end: var(--space-3);
  font-variant-numeric: tabular-nums;
  appearance: none;
  -webkit-appearance: none;
}

.form-control[type="date"]::-webkit-calendar-picker-indicator,
.form-control[type="time"]::-webkit-calendar-picker-indicator,
.form-control[type="datetime-local"]::-webkit-calendar-picker-indicator,
.form-control[type="month"]::-webkit-calendar-picker-indicator,
.form-control[type="week"]::-webkit-calendar-picker-indicator,
.input[type="date"]::-webkit-calendar-picker-indicator,
.input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  transition: opacity var(--dur-fast) var(--ease);
}

.form-control[type="date"]::-webkit-calendar-picker-indicator:hover,
.input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* The native picker icon is a dark glyph. On a dark input
   it disappears. Invert it. */
html[data-theme="dark"] .form-control[type="date"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] .form-control[type="time"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] .form-control[type="datetime-local"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] .form-control[type="month"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] .form-control[type="week"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] .input[type="date"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] .input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.4);
  opacity: 0.75;
}

.form-control[type="number"],
.input[type="number"] {
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.form-control[type="color"],
.input[type="color"] {
  padding: var(--space-1);
  cursor: pointer;
  height: 44px;
}

.form-control[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.form-control[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: calc(var(--radius-md) - 3px);
}

.form-control[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: calc(var(--radius-md) - 3px);
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 480px) {
  .form-control,
  .input {
    min-height: 46px;
  }

  .form-control-lg,
  .input-lg {
    min-height: 54px;
  }

  .form-control-xl {
    min-height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .form-control,
  .input,
  .input-icon,
  .input-clear,
  .input-password-toggle,
  .input-search-clear {
    transition: none !important;
  }
}


/* ============================================================
   03 · SELECTS & CURRENCY PICKERS
   ============================================================ */

.form-select,
.select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 40px 0 var(--space-4);

  background-color: var(--surface);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 12px 8px;

  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.4;

  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  transition:
    border-color     var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

/* In RTL the padding and the caret's physical position
   swap sides. */
html[dir="rtl"] .form-select,
html[dir="rtl"] .select {
  padding: 0 var(--space-4) 0 40px;
  background-position: left var(--space-4) center;
}

/* The default caret glyph is a dark slate. On a dark surface
   it disappears. Override with a light-stroke SVG. */
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239FB1C9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
}

.form-select:hover:not(:disabled):not(:focus),
.select:hover:not(:disabled):not(:focus) {
  border-color: var(--border-strong);
}

.form-select:focus,
.select:focus {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] .select:focus {
  border-color: var(--blue-400);
}

.form-select:disabled,
.select:disabled {
  background-color: var(--surface-muted);
  color: var(--text-light);
  cursor: not-allowed;
  opacity: 0.75;
}

.form-select option,
.select option {
  color: var(--text);
  background: var(--surface);
  font-weight: var(--fw-regular);
  padding: var(--space-2);
}

/* Firefox select caret fix */
.form-select:-moz-focusring,
.select:-moz-focusring {
  color: transparent;
  text-shadow: 0 0 0 var(--text);
}

/* ---------- SIZES ---------- */

.form-select-sm,
.select-sm {
  min-height: 36px;
  padding-inline: var(--space-3) 32px;
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
  background-size: 10px 7px;
  background-position: right var(--space-3) center;
}

html[dir="rtl"] .form-select-sm,
html[dir="rtl"] .select-sm {
  padding-inline: 32px var(--space-3);
  background-position: left var(--space-3) center;
}

.form-select-lg,
.select-lg {
  min-height: 52px;
  padding-inline: var(--space-5) 44px;
  font-size: var(--fs-base);
  background-position: right var(--space-5) center;
}

html[dir="rtl"] .form-select-lg,
html[dir="rtl"] .select-lg {
  padding-inline: 44px var(--space-5);
  background-position: left var(--space-5) center;
}

/* ---------- SHAPES ---------- */

.form-select-rounded,
.select-rounded {
  border-radius: var(--radius-pill);
}

/* ---------- MULTI SELECT ---------- */

.form-select[multiple],
.form-select[size]:not([size="1"]),
.select[multiple],
.select[size]:not([size="1"]) {
  min-height: auto;
  padding: var(--space-2);
  background-image: none;
  padding-inline-end: var(--space-2);
  cursor: default;
}

.form-select[multiple] option,
.select[multiple] option {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  cursor: pointer;
}

.form-select[multiple] option:checked,
.select[multiple] option:checked {
  background: var(--blue-50) linear-gradient(0deg, var(--blue-50) 0%, var(--blue-50) 100%);
  color: var(--blue-700);
  font-weight: var(--fw-bold);
}

html[data-theme="dark"] .form-select[multiple] option:checked,
html[data-theme="dark"] .select[multiple] option:checked {
  background: rgba(96, 165, 250, 0.18) linear-gradient(0deg, rgba(96, 165, 250, 0.18) 0%, rgba(96, 165, 250, 0.18) 100%);
  color: var(--blue-100);
}

/* ---------- WRAPPER ---------- */

.select-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

.select-wrapper .form-select,
.select-wrapper .select {
  padding-inline-end: 40px;
}

.select-wrapper .select-icon {
  position: absolute;
  inset-inline-end: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 12px;
  pointer-events: none;
}

.form-select.is-placeholder,
.select.is-placeholder {
  color: var(--text-light);
  font-weight: var(--fw-regular);
}

/* ---------- CURRENCY PICKER ---------- */

.currency-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.currency-picker-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  padding: 4px 22px 4px var(--space-3);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);

  color: var(--text-soft);
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1.2;

  cursor: pointer;
  outline: none;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

html[dir="rtl"] .currency-picker-select {
  padding: 4px var(--space-3) 4px 22px;
}

.currency-picker-select:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.currency-picker-select:focus {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] .currency-picker-select:focus {
  border-color: var(--blue-400);
}

.currency-picker-caret {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 5px;
  pointer-events: none;
  opacity: 0.55;
}

.currency-picker-caret::after {
  content: "";
  display: block;
  width: 8px;
  height: 5px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-size: 8px 5px;
}

html[data-theme="dark"] .currency-picker-caret::after {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239FB1C9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 480px) {
  .form-select,
  .select {
    min-height: 46px;
  }

  .form-select-lg,
  .select-lg {
    min-height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .form-select,
  .select,
  .currency-picker-select {
    transition: none !important;
  }
}


/* ============================================================
   04 · TEXTAREAS
   ============================================================ */

.form-textarea,
.textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  padding: var(--space-3) var(--space-4);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  line-height: 1.6;

  outline: none;
  resize: vertical;

  transition:
    border-color     var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.form-textarea::placeholder,
.textarea::placeholder {
  color: var(--text-light);
  font-weight: var(--fw-regular);
}

.form-textarea:hover:not(:disabled):not(:focus),
.textarea:hover:not(:disabled):not(:focus) {
  border-color: var(--border-strong);
}

.form-textarea:focus,
.textarea:focus {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] .form-textarea:focus,
html[data-theme="dark"] .textarea:focus {
  border-color: var(--blue-400);
}

.form-textarea:disabled,
.textarea:disabled {
  background: var(--surface-muted);
  color: var(--text-light);
  cursor: not-allowed;
  opacity: 0.75;
  resize: none;
}

.form-textarea:-webkit-autofill,
.textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px var(--surface) inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* ---------- SIZES ---------- */

.form-textarea-sm,
.textarea-sm {
  min-height: 80px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
}

.form-textarea-lg,
.textarea-lg {
  min-height: 180px;
  padding: var(--space-4) var(--space-5);
  font-size: var(--fs-base);
}

.form-textarea-xl {
  min-height: 260px;
  padding: var(--space-4) var(--space-5);
  font-size: var(--fs-base);
}

.form-textarea.no-resize,
.textarea.no-resize {
  resize: none;
}

.form-textarea.auto-grow,
.textarea.auto-grow {
  resize: none;
  overflow: hidden;
}

.form-textarea.mono,
.textarea.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.55;
  tab-size: 2;
}

/* ---------- WRAPPER ---------- */

.textarea-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

/* ---------- FOOTER ---------- */

.textarea-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.textarea-footer .form-help,
.textarea-footer .field-hint {
  flex: 1 1 auto;
  min-width: 0;
}

.textarea-counter {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text-light);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color var(--dur-fast) var(--ease);
}

.textarea-counter.is-warning,
.textarea-counter[data-warning="true"] {
  color: var(--warning);
}

.textarea-counter.is-danger {
  color: var(--danger);
  font-weight: var(--fw-bold);
}

.textarea-counter-value {
  font-weight: var(--fw-bold);
}

.textarea-counter-separator {
  opacity: 0.6;
}

/* ---------- TEXTAREA GROUP ---------- */

.textarea-group {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow   var(--dur-fast) var(--ease);
}

.textarea-group:focus-within {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] .textarea-group:focus-within {
  border-color: var(--blue-400);
}

.textarea-group > .form-textarea,
.textarea-group > .textarea {
  border: none;
  box-shadow: none !important;
  border-radius: 0;
  background: transparent;
}

.textarea-group > .form-textarea:focus,
.textarea-group > .textarea:focus {
  box-shadow: none;
}

.textarea-group-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
}

.textarea-group-toolbar button {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.textarea-group-toolbar button:hover {
  background: var(--surface-muted);
  color: var(--blue-600);
}

html[data-theme="dark"] .textarea-group-toolbar button:hover {
  color: var(--blue-400);
}

@media (max-width: 480px) {
  .form-textarea,
  .textarea {
    min-height: 110px;
  }

  .form-textarea-lg,
  .textarea-lg {
    min-height: 160px;
  }

  .textarea-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .form-textarea,
  .textarea,
  .textarea-counter {
    transition: none !important;
  }
}


/* ============================================================
   05 · CHECKBOXES
   ============================================================ */

.form-checkbox {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.5;
}

.form-checkbox > input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.form-checkbox.disabled,
.form-checkbox:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-checkbox-box {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-xs);

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease),
    transform        var(--dur-fast) var(--ease);
}

.form-checkbox:hover > input:not(:disabled) + .form-checkbox-box {
  border-color: var(--blue-600);
}

.form-checkbox-box::after {
  content: "";
  display: block;
  width: 10px;
  height: 5px;

  border-inline-start: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;

  transform: rotate(-45deg) scale(0);
  transform-origin: center;
  opacity: 0;

  transition:
    transform var(--dur-fast) var(--ease-spring),
    opacity   var(--dur-fast) var(--ease);
  position: relative;
  top: -1px;
}

.form-checkbox > input:checked + .form-checkbox-box {
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.form-checkbox > input:checked + .form-checkbox-box::after {
  transform: rotate(-45deg) scale(1);
  opacity: 1;
}

.form-checkbox > input:focus-visible + .form-checkbox-box {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

.form-checkbox > input:indeterminate + .form-checkbox-box {
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.form-checkbox > input:indeterminate + .form-checkbox-box::after {
  width: 10px;
  height: 0;
  border-inline-start: none;
  border-bottom: 2px solid #ffffff;
  transform: none;
  opacity: 1;
  top: 0;
}

.form-checkbox-label {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.form-checkbox-label strong {
  color: var(--text);
  font-weight: var(--fw-bold);
  display: block;
  margin-bottom: 2px;
}

.form-checkbox-help {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
  margin-top: 4px;
  font-weight: var(--fw-regular);
}

/* ---------- SIZES ---------- */

.form-checkbox-sm .form-checkbox-box {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
}

.form-checkbox-sm .form-checkbox-box::after {
  width: 8px;
  height: 4px;
}

.form-checkbox-lg .form-checkbox-box {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
}

.form-checkbox-lg .form-checkbox-box::after {
  width: 12px;
  height: 6px;
}

/* ---------- COLOR VARIANTS ---------- */

.form-checkbox-success > input:checked + .form-checkbox-box {
  background: var(--success);
  border-color: var(--success);
}

.form-checkbox-danger > input:checked + .form-checkbox-box {
  background: var(--danger);
  border-color: var(--danger);
}

.form-checkbox-accent > input:checked + .form-checkbox-box {
  background: var(--accent);
  border-color: var(--accent);
}

.form-checkbox-accent > input:checked + .form-checkbox-box::after {
  border-inline-start-color: var(--accent-ink);
  border-bottom-color: var(--accent-ink);
}

/* ---------- CHECKBOX CARD ---------- */

.form-checkbox-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  cursor: pointer;
  user-select: none;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease);
}

.form-checkbox-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.form-checkbox-card > input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.form-checkbox-card > input:checked ~ .form-checkbox-box {
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.form-checkbox-card > input:checked ~ .form-checkbox-box::after {
  transform: rotate(-45deg) scale(1);
  opacity: 1;
}

.form-checkbox-card:has(input:checked) {
  background: var(--blue-50);
  border-color: var(--blue-600);
  box-shadow: 0 0 0 1px var(--blue-600);
}

html[data-theme="dark"] .form-checkbox-card:has(input:checked) {
  background: rgba(96, 165, 250, 0.10);
  border-color: var(--blue-400);
  box-shadow: 0 0 0 1px var(--blue-400);
}

.form-checkbox-card:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

/* ---------- GROUP ---------- */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.checkbox-group.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.checkbox-group.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

@media (max-width: 640px) {
  .checkbox-group.grid-2,
  .checkbox-group.grid-3 {
    grid-template-columns: 1fr;
  }
}

.form-checkbox.inline {
  display: inline-flex;
  margin-inline-end: var(--space-5);
}

.checkbox-inline-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

@media (max-width: 480px) {
  .form-checkbox-card {
    padding: var(--space-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .form-checkbox-box,
  .form-checkbox-box::after,
  .form-checkbox-card {
    transition: none !important;
  }

  .form-checkbox-box::after {
    transform: rotate(-45deg) scale(1);
  }

  .form-checkbox > input:checked + .form-checkbox-box::after {
    transform: rotate(-45deg) scale(1);
  }
}


/* ============================================================
   06 · RADIOS
   ============================================================ */

.form-radio {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.5;
}

.form-radio > input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.form-radio.disabled,
.form-radio:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-radio-dot {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-circle);

  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow   var(--dur-fast) var(--ease);
}

.form-radio:hover > input:not(:disabled) + .form-radio-dot {
  border-color: var(--blue-600);
}

.form-radio-dot::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  background: var(--blue-600);
  border-radius: var(--radius-circle);

  transform: scale(0);
  opacity: 0;

  transition:
    transform var(--dur-fast) var(--ease-spring),
    opacity   var(--dur-fast) var(--ease);
}

.form-radio > input:checked + .form-radio-dot {
  border-color: var(--blue-600);
  border-width: 2px;
}

.form-radio > input:checked + .form-radio-dot::after {
  transform: scale(1);
  opacity: 1;
}

.form-radio > input:focus-visible + .form-radio-dot {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

.form-radio-label {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.form-radio-label strong {
  color: var(--text);
  font-weight: var(--fw-bold);
  display: block;
  margin-bottom: 2px;
}

.form-radio-help {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
  margin-top: 4px;
  font-weight: var(--fw-regular);
}

/* ---------- SIZES ---------- */

.form-radio-sm .form-radio-dot {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
}

.form-radio-sm .form-radio-dot::after {
  width: 6px;
  height: 6px;
}

.form-radio-lg .form-radio-dot {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
}

.form-radio-lg .form-radio-dot::after {
  width: 10px;
  height: 10px;
}

/* ---------- COLOR VARIANTS ---------- */

.form-radio-success > input:checked + .form-radio-dot {
  border-color: var(--success);
}
.form-radio-success > input:checked + .form-radio-dot::after {
  background: var(--success);
}

.form-radio-danger > input:checked + .form-radio-dot {
  border-color: var(--danger);
}
.form-radio-danger > input:checked + .form-radio-dot::after {
  background: var(--danger);
}

.form-radio-accent > input:checked + .form-radio-dot {
  border-color: var(--accent);
}
.form-radio-accent > input:checked + .form-radio-dot::after {
  background: var(--accent);
}

/* ---------- CARD VARIANT ---------- */

.form-radio-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  cursor: pointer;
  user-select: none;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease);
}

.form-radio-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.form-radio-card > input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.form-radio-card > input:checked ~ .form-radio-dot {
  border-color: var(--blue-600);
  border-width: 2px;
}

.form-radio-card > input:checked ~ .form-radio-dot::after {
  transform: scale(1);
  opacity: 1;
}

.form-radio-card:has(input:checked) {
  background: var(--blue-50);
  border-color: var(--blue-600);
  box-shadow: 0 0 0 1px var(--blue-600);
}

html[data-theme="dark"] .form-radio-card:has(input:checked) {
  background: rgba(96, 165, 250, 0.10);
  border-color: var(--blue-400);
  box-shadow: 0 0 0 1px var(--blue-400);
}

.form-radio-card:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

/* ---------- PILL / SEGMENTED VARIANT ---------- */

.radio-pill-group {
  display: inline-flex;
  padding: 4px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  gap: 2px;
}

.form-radio-pill {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.form-radio-pill > input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.form-radio-pill > span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  transition:
    background-color var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease);
}

.form-radio-pill:hover > span {
  color: var(--text-soft);
}

.form-radio-pill > input:checked + span {
  background: var(--surface);
  color: var(--heading);
  font-weight: var(--fw-bold);
  box-shadow: var(--shadow-xs);
}

.form-radio-pill > input:focus-visible + span {
  box-shadow: var(--focus-ring);
}

@media (max-width: 640px) {
  .radio-pill-group {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .radio-pill-group::-webkit-scrollbar { display: none; }

  .form-radio-pill > span {
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-xs);
  }
}

/* ---------- AVAILABILITY GROUP ---------- */

.availability-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.availability-option {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: var(--space-3);

  padding: var(--space-4);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease);
}

.availability-option:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.availability-option > input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.availability-option:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.availability-option:has(input:checked),
.availability-option[data-selected="true"] {
  background: var(--blue-50);
  border-color: var(--blue-600);
  box-shadow: 0 0 0 1px var(--blue-600);
}

html[data-theme="dark"] .availability-option:has(input:checked),
html[data-theme="dark"] .availability-option[data-selected="true"] {
  background: rgba(96, 165, 250, 0.10);
  border-color: var(--blue-400);
  box-shadow: 0 0 0 1px var(--blue-400);
}

.availability-option::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-top: 2px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-circle);
  background: var(--surface);
  transition:
    border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.availability-option:has(input:checked)::before,
.availability-option[data-selected="true"]::before {
  border-color: var(--blue-600);
  border-width: 5px;
  background: var(--surface);
}

html[data-theme="dark"] .availability-option:has(input:checked)::before,
html[data-theme="dark"] .availability-option[data-selected="true"]::before {
  border-color: var(--blue-400);
}

.availability-option-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.availability-option-title {
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1.3;
}

.availability-option-desc {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

/* ---------- ROLE GRID ---------- */

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

.role-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease);
}

.role-option:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.role-option > input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role-option:has(input:checked),
.role-option[data-selected="true"] {
  background: var(--blue-50);
  border-color: var(--blue-600);
  box-shadow: 0 0 0 1px var(--blue-600);
}

html[data-theme="dark"] .role-option:has(input:checked),
html[data-theme="dark"] .role-option[data-selected="true"] {
  background: rgba(96, 165, 250, 0.10);
  border-color: var(--blue-400);
  box-shadow: 0 0 0 1px var(--blue-400);
}

.role-option:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.role-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.role-option-title {
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1.3;
}

.role-option-desc {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

@media (max-width: 480px) {
  .role-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- GROUP ---------- */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.radio-group.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.radio-group.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

@media (max-width: 640px) {
  .radio-group.grid-2,
  .radio-group.grid-3 {
    grid-template-columns: 1fr;
  }
}

.form-radio.inline {
  display: inline-flex;
  margin-inline-end: var(--space-5);
}

.radio-inline-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

@media (max-width: 480px) {
  .form-radio-card {
    padding: var(--space-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .form-radio-dot,
  .form-radio-dot::after,
  .form-radio-card,
  .form-radio-pill > span,
  .availability-option,
  .availability-option::before,
  .role-option {
    transition: none !important;
  }
}


/* ============================================================
   07 · SWITCHES
   ============================================================ */

.form-switch,
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.4;
}

.form-switch > input[type="checkbox"],
.switch > input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.form-switch.disabled,
.form-switch:has(input:disabled),
.switch.disabled,
.switch:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-switch-track,
.switch-track {
  position: relative;
  width: 40px;
  height: 22px;
  flex: 0 0 40px;

  background: var(--border-strong);
  border-radius: var(--radius-pill);

  transition:
    background-color var(--dur-base) var(--ease),
    box-shadow       var(--dur-fast) var(--ease);
}

.form-switch:hover > input:not(:disabled) + .form-switch-track,
.switch:hover > input:not(:disabled) + .switch-track {
  background: var(--text-light);
}

.form-switch > input:checked + .form-switch-track,
.switch > input:checked + .switch-track {
  background: var(--blue-600);
}

.form-switch > input:checked + .form-switch-track:hover,
.form-switch:hover > input:checked:not(:disabled) + .form-switch-track,
.switch > input:checked + .switch-track:hover,
.switch:hover > input:checked:not(:disabled) + .switch-track {
  background: var(--blue-700);
}

.form-switch-track::after,
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 18px;
  height: 18px;
  background: var(--surface);
  border-radius: var(--radius-circle);
  box-shadow: 0 1px 3px rgba(15, 39, 66, 0.20);

  transition: transform var(--dur-base) var(--ease-spring);
}

.form-switch > input:checked + .form-switch-track::after,
.switch > input:checked + .switch-track::after {
  transform: translateX(18px);
}

html[dir="rtl"] .form-switch > input:checked + .form-switch-track::after,
html[dir="rtl"] .switch > input:checked + .switch-track::after {
  transform: translateX(-18px);
}

.form-switch > input:focus-visible + .form-switch-track,
.switch > input:focus-visible + .switch-track {
  box-shadow: var(--focus-ring);
}

/* ---------- SIZES ---------- */

.form-switch-sm .form-switch-track,
.switch-sm .switch-track {
  width: 32px;
  height: 18px;
  flex-basis: 32px;
}

.form-switch-sm .form-switch-track::after,
.switch-sm .switch-track::after {
  width: 14px;
  height: 14px;
  top: 2px;
  inset-inline-start: 2px;
}

.form-switch-sm > input:checked + .form-switch-track::after,
.switch-sm > input:checked + .switch-track::after {
  transform: translateX(14px);
}

html[dir="rtl"] .form-switch-sm > input:checked + .form-switch-track::after,
html[dir="rtl"] .switch-sm > input:checked + .switch-track::after {
  transform: translateX(-14px);
}

.form-switch-lg .form-switch-track,
.switch-lg .switch-track {
  width: 48px;
  height: 26px;
  flex-basis: 48px;
}

.form-switch-lg .form-switch-track::after,
.switch-lg .switch-track::after {
  width: 22px;
  height: 22px;
}

.form-switch-lg > input:checked + .form-switch-track::after,
.switch-lg > input:checked + .switch-track::after {
  transform: translateX(22px);
}

html[dir="rtl"] .form-switch-lg > input:checked + .form-switch-track::after,
html[dir="rtl"] .switch-lg > input:checked + .switch-track::after {
  transform: translateX(-22px);
}

/* ---------- LABEL ---------- */

.form-switch-label {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.form-switch-label strong {
  color: var(--text);
  font-weight: var(--fw-bold);
  display: block;
  margin-bottom: 2px;
}

.form-switch-help {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
  margin-top: 4px;
  font-weight: var(--fw-regular);
}

/* ---------- COLOR VARIANTS ---------- */

.form-switch-success > input:checked + .form-switch-track,
.switch-success > input:checked + .switch-track {
  background: var(--success);
}

.form-switch-success:hover > input:checked + .form-switch-track,
.switch-success:hover > input:checked + .switch-track {
  background: var(--success-hover);
}

.form-switch-danger > input:checked + .form-switch-track,
.switch-danger > input:checked + .switch-track {
  background: var(--danger);
}

.form-switch-danger:hover > input:checked + .form-switch-track,
.switch-danger:hover > input:checked + .switch-track {
  background: var(--danger-hover);
}

.form-switch-accent > input:checked + .form-switch-track,
.switch-accent > input:checked + .switch-track {
  background: var(--accent);
}

.form-switch-accent:hover > input:checked + .form-switch-track,
.switch-accent:hover > input:checked + .switch-track {
  background: var(--accent-hover);
}

.form-switch.label-first {
  flex-direction: row-reverse;
}

/* ---------- SWITCH CARD ---------- */

.form-switch-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition:
    border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.form-switch-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.form-switch-card:has(input:checked) {
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .form-switch-card:has(input:checked) {
  background: rgba(96, 165, 250, 0.08);
  border-color: rgba(96, 165, 250, 0.22);
}

.form-switch-card > input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.form-switch-card .form-switch-card-info {
  flex: 1 1 auto;
  min-width: 0;
}

.form-switch-card .form-switch-card-info strong {
  display: block;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  margin-bottom: 2px;
}

.form-switch-card .form-switch-card-info span {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

/* ---------- GROUP ---------- */

.switch-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ---------- SETTING ROW ---------- */

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-soft);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row-info {
  flex: 1 1 auto;
  min-width: 0;
}

.setting-row-info strong {
  display: block;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  margin-bottom: 2px;
}

.setting-row-info span {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

@media (max-width: 480px) {
  .form-switch-card {
    padding: var(--space-3);
  }

  .setting-row {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .form-switch-track,
  .form-switch-track::after,
  .switch-track,
  .switch-track::after {
    transition: none !important;
  }
}


/* ============================================================
   08 · FILE UPLOAD
   ------------------------------------------------------------
   Emitted by components/upload.js in four flavours:
     · default    — public files (task attachments, portfolio)
     · private    — verification evidence, subscription proof
     · avatar     — profile photo picker
     · cover      — wide cover picker

   The container reads --surface and --border, which flip.
   The dropzone reads --surface-soft and --border-strong,
   which flip. The hover state uses --blue-50, which is a
   pastel that glows on dark — overridden below.
   ============================================================ */

.upload {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
}

.upload-private {
  position: relative;
}

.upload-private-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  padding: 2px 8px;
  background: var(--navy-50);
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-pill);
  color: var(--navy-700);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.3;
}

html[lang="ar"] .upload-private-badge {
  letter-spacing: 0;
}

.upload-private-badge svg {
  width: 12px;
  height: 12px;
  color: var(--navy-700);
}

/* The private badge sits on a light blue chip that glows on
   dark. Override to a translucent tint. */
html[data-theme="dark"] .upload-private-badge {
  background: rgba(148, 163, 184, 0.10);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--text-soft);
}

html[data-theme="dark"] .upload-private-badge svg {
  color: var(--text-soft);
}

/* ---------- ERRORS ---------- */

.upload-errors {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.5;
}

.upload-errors[hidden] { display: none; }

.upload-errors ul {
  margin: 4px 0 0;
  padding-inline-start: var(--space-4);
  list-style: disc;
}

.upload-errors li + li { margin-top: 2px; }

/* ---------- DROPZONE ---------- */

.upload-dropzone {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  min-height: 160px;
  padding: var(--space-6) var(--space-5);

  background: var(--surface-soft);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);

  text-align: center;
  cursor: pointer;

  transition:
    border-color     var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease);
}

.upload-dropzone > * {
  position: relative;
  z-index: 1;
}

.upload-dropzone:hover {
  border-color: var(--blue-600);
  background: var(--blue-50);
}

html[data-theme="dark"] .upload-dropzone:hover {
  border-color: var(--blue-400);
  background: rgba(96, 165, 250, 0.06);
}

.upload-dropzone:focus-within,
.upload-dropzone[data-dragover="true"] {
  border-color: var(--blue-600);
  background: var(--blue-50);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] .upload-dropzone:focus-within,
html[data-theme="dark"] .upload-dropzone[data-dragover="true"] {
  border-color: var(--blue-400);
  background: rgba(96, 165, 250, 0.08);
}

.upload-dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.upload-dropzone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-circle);
  color: var(--blue-600);
  font-size: 20px;
  box-shadow: var(--shadow-xs);
  transition:
    background-color var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease),
    transform        var(--dur-fast) var(--ease);
}

html[data-theme="dark"] .upload-dropzone-icon {
  color: var(--blue-400);
}

.upload-dropzone-icon svg {
  width: 20px;
  height: 20px;
}

.upload-dropzone:hover .upload-dropzone-icon,
.upload-dropzone[data-dragover="true"] .upload-dropzone-icon {
  background: var(--blue-600);
  color: #ffffff;
  transform: translateY(-2px);
}

html[data-theme="dark"] .upload-dropzone:hover .upload-dropzone-icon,
html[data-theme="dark"] .upload-dropzone[data-dragover="true"] .upload-dropzone-icon {
  background: var(--blue-400);
  color: var(--chrome-bg);
}

.upload-dropzone-title {
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1.4;
}

.upload-dropzone-hint {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
  font-weight: var(--fw-regular);
}

/* ---------- LIST ---------- */

.upload-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.upload-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow   var(--dur-fast) var(--ease);
}

.upload-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.upload-item[data-state="error"] {
  border-color: var(--danger-line);
  background: var(--danger-soft);
}

.upload-item[data-state="success"] {
  border-color: var(--success-line);
}

/* ---------- PREVIEW ---------- */

.upload-item-preview {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

.upload-item-preview[data-type="image"] {
  background: var(--navy-50);
  border-color: var(--navy-100);
  color: var(--navy-700);
}

.upload-item-preview[data-type="pdf"] {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

.upload-item-preview[data-type="doc"] {
  background: var(--info-soft);
  border-color: var(--info-line);
  color: var(--info);
}

html[data-theme="dark"] .upload-item-preview[data-type="image"] {
  background: rgba(148, 163, 184, 0.10);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--text-soft);
}

.upload-item-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.upload-item-preview svg {
  width: 22px;
  height: 22px;
}

/* ---------- BODY ---------- */

.upload-item-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.upload-item-name {
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.upload-item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.3;
}

.upload-item-meta-sep {
  color: var(--text-light);
}

.upload-item-progress {
  margin-top: var(--space-1);
  width: 100%;
}

.upload-item-progress .progress {
  height: 4px;
  border-radius: var(--radius-pill);
}

.upload-item-progress .progress-bar {
  transition: width var(--dur-base) var(--ease);
}

.upload-item-error {
  margin-top: 2px;
  color: var(--danger);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}

/* ---------- STATUS ---------- */

.upload-item-status {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--success-soft);
  border: 1px solid var(--success-line);
  border-radius: var(--radius-circle);
  color: var(--success);
}

.upload-item-status svg {
  width: 12px;
  height: 12px;
}

/* ---------- ACTIONS ---------- */

.upload-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.upload-item-action {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 12px;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.upload-item-action svg {
  width: 16px;
  height: 16px;
}

.upload-item-action:hover {
  color: var(--blue-600);
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .upload-item-action:hover {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--blue-400);
}

.upload-item-action-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

/* ---------- AVATAR UPLOADER ---------- */

.upload-avatar {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
}

.upload-avatar-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  flex: 0 0 88px;
  border-radius: var(--radius-circle);
  overflow: hidden;
  background: var(--navy-50);
  border: 2px solid var(--surface);
  box-shadow:
    0 0 0 1px var(--border),
    var(--shadow-sm);
  color: var(--navy-700);
}

.upload-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.upload-avatar-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.upload-avatar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ---------- COVER UPLOADER ---------- */

.upload-cover {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.upload-cover-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 6;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--navy-50);
  border: 1px solid var(--border);
}

.upload-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 640px) {
  .upload-dropzone {
    min-height: 140px;
    padding: var(--space-5) var(--space-4);
  }

  .upload-dropzone-icon {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .upload-avatar {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .upload-avatar-body {
    align-items: center;
  }

  .upload-avatar-actions {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .upload-dropzone,
  .upload-dropzone-icon,
  .upload-item,
  .upload-item-action,
  .upload-item-progress .progress-bar {
    transition: none !important;
  }

  .upload-dropzone:hover .upload-dropzone-icon,
  .upload-dropzone[data-dragover="true"] .upload-dropzone-icon {
    transform: none;
  }
}

@media print {
  .upload-dropzone,
  .upload-item-actions {
    display: none !important;
  }
}


/* ============================================================
   09 · RATING
   ============================================================ */

.rating {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  vertical-align: middle;
  line-height: 1;
}

.rating-stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--border-strong);
  font-size: var(--fs-md);
  line-height: 1;
}

.rating-stars i,
.rating-stars iconify-icon,
.rating-stars svg {
  color: inherit;
  transition: color var(--dur-fast) var(--ease);
}

.rating-stars i.on,
.rating-stars .on {
  color: var(--badge-rating);
}

/* ---------- SIZES ---------- */

.rating-sm .rating-stars { font-size: var(--fs-xs); }
.rating-lg .rating-stars { font-size: var(--fs-lg); gap: 3px; }
.rating-xl .rating-stars { font-size: var(--fs-2xl); gap: 4px; }

/* ---------- VALUE + COUNT ---------- */

.rating-value {
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-extrabold);
  font-variant-numeric: tabular-nums;
}

.rating-count {
  color: var(--text-light);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}

.rating-inline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
}

.rating-inline .rating-value { font-size: var(--fs-sm); }

.rating-inline .rating-count::before { content: "("; }
.rating-inline .rating-count::after  { content: ")"; }

/* ---------- INTERACTIVE INPUT ---------- */

.rating-input {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rating-input-star,
.rating-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;
  padding: 0;

  background: transparent;
  border: none;
  border-radius: var(--radius-sm);

  color: var(--border-strong);
  font-size: var(--fs-xl);
  line-height: 1;
  cursor: pointer;

  transition:
    color            var(--dur-fast) var(--ease),
    transform        var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.rating-input-star svg,
.rating-btn svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.rating-input-star:hover,
.rating-btn:hover {
  transform: scale(1.08);
  background: var(--surface-soft);
}

.rating-input-star.on,
.rating-input-star[data-filled="true"],
.rating-btn.on {
  color: var(--badge-rating);
}

.rating-input-star.hover,
.rating-btn.hover {
  color: var(--accent-hover);
}

.rating-input-star:focus-visible,
.rating-btn:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

.rating-input-value {
  margin-inline-start: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1;
  min-width: 44px;
}

.rating-input-sm .rating-input-star,
.rating-input-sm .rating-btn {
  width: 28px;
  height: 28px;
  font-size: var(--fs-lg);
}

.rating-input-lg .rating-input-star,
.rating-input-lg .rating-btn {
  width: 44px;
  height: 44px;
  font-size: var(--fs-3xl);
}

/* ---------- LABEL ---------- */

.rating-label {
  display: block;
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}

.rating-label strong {
  color: var(--heading);
  font-weight: var(--fw-bold);
}

.rating-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.rating-group-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.rating-group-row .rating-label { margin-top: 0; }

/* ---------- RATING BARS ---------- */

.rating-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.rating-bar {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 44px;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.rating-bar-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-soft);
  font-weight: var(--fw-semibold);
}

.rating-bar-label i,
.rating-bar-label iconify-icon {
  color: var(--badge-rating);
  font-size: 9px;
}

.rating-bar-track {
  height: 6px;
  background: var(--surface-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.rating-bar-fill {
  height: 100%;
  width: 0;
  background: var(--badge-rating);
  border-radius: inherit;
  transition: width var(--dur-slow) var(--ease);
}

.rating-bar-count {
  text-align: end;
  font-weight: var(--fw-bold);
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------- SUMMARY ---------- */

.rating-summary {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5);
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.rating-summary-number {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rating-summary-number strong {
  color: var(--heading);
  font-size: var(--fs-4xl);
  font-weight: var(--fw-extrabold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rating-summary-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}

.rating-summary-meta .rating-count {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

@media (max-width: 480px) {
  .rating-summary {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rating-stars i,
  .rating-input-star,
  .rating-btn,
  .rating-bar-fill {
    transition: none !important;
  }

  .rating-input-star:hover,
  .rating-btn:hover {
    transform: none;
  }
}


/* ============================================================
   10 · VALIDATION
   ============================================================ */

.form-control.is-valid,
.form-select.is-valid,
.form-textarea.is-valid,
.input.is-valid,
.select.is-valid,
.textarea.is-valid {
  border-color: var(--success);
  background-image: none;
}

.form-control.is-valid:focus,
.form-select.is-valid:focus,
.form-textarea.is-valid:focus,
.input.is-valid:focus,
.select.is-valid:focus,
.textarea.is-valid:focus {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(22, 121, 74, 0.15);
}

html[data-theme="dark"] .form-control.is-valid:focus,
html[data-theme="dark"] .form-select.is-valid:focus,
html[data-theme="dark"] .form-textarea.is-valid:focus {
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.22);
}

.form-control.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid,
.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid {
  border-color: var(--danger);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus,
.form-textarea.is-invalid:focus,
.input.is-invalid:focus,
.select.is-invalid:focus,
.textarea.is-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

html[data-theme="dark"] .form-control.is-invalid:focus,
html[data-theme="dark"] .form-select.is-invalid:focus,
html[data-theme="dark"] .form-textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.24);
}

.form-control.is-warning,
.form-select.is-warning,
.form-textarea.is-warning {
  border-color: var(--warning);
}

.form-control.is-warning:focus,
.form-select.is-warning:focus,
.form-textarea.is-warning:focus {
  border-color: var(--warning);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.14);
}

html[data-theme="dark"] .form-control.is-warning:focus,
html[data-theme="dark"] .form-select.is-warning:focus,
html[data-theme="dark"] .form-textarea.is-warning:focus {
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.24);
}

/* ---------- GROUP STATES ---------- */

.form-group.has-error .form-control,
.form-group.has-error .form-select,
.form-group.has-error .form-textarea,
.form-group.has-error .input-group,
.form-group.has-error .chip-input,
.field[data-invalid="true"] .form-control,
.field[data-invalid="true"] .input,
.field[data-invalid="true"] .select,
.field[data-invalid="true"] .textarea {
  border-color: var(--danger);
}

.form-group.has-error .form-control:focus,
.form-group.has-error .form-select:focus,
.form-group.has-error .form-textarea:focus,
.form-group.has-error .input-group:focus-within,
.form-group.has-error .chip-input:focus-within,
.field[data-invalid="true"] .form-control:focus,
.field[data-invalid="true"] .input:focus,
.field[data-invalid="true"] .select:focus,
.field[data-invalid="true"] .textarea:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

html[data-theme="dark"] .form-group.has-error .form-control:focus,
html[data-theme="dark"] .form-group.has-error .form-select:focus,
html[data-theme="dark"] .form-group.has-error .form-textarea:focus,
html[data-theme="dark"] .form-group.has-error .input-group:focus-within,
html[data-theme="dark"] .form-group.has-error .chip-input:focus-within {
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.24);
}

.form-group.has-error .input-icon { color: var(--danger); }
.form-group.has-error .form-label,
.form-group.has-error .field-label { color: var(--danger); }

.form-group.has-success .form-control,
.form-group.has-success .form-select,
.form-group.has-success .form-textarea,
.form-group.has-success .input-group,
.form-group.has-success .chip-input {
  border-color: var(--success);
}

.form-group.has-success .form-control:focus,
.form-group.has-success .form-select:focus,
.form-group.has-success .form-textarea:focus,
.form-group.has-success .input-group:focus-within,
.form-group.has-success .chip-input:focus-within {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(22, 121, 74, 0.15);
}

html[data-theme="dark"] .form-group.has-success .form-control:focus,
html[data-theme="dark"] .form-group.has-success .form-select:focus,
html[data-theme="dark"] .form-group.has-success .form-textarea:focus,
html[data-theme="dark"] .form-group.has-success .input-group:focus-within,
html[data-theme="dark"] .form-group.has-success .chip-input:focus-within {
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.22);
}

.form-group.has-success .input-icon { color: var(--success); }

.form-group.has-warning .form-control,
.form-group.has-warning .form-select,
.form-group.has-warning .form-textarea {
  border-color: var(--warning);
}

.form-group.has-warning .form-control:focus,
.form-group.has-warning .form-select:focus,
.form-group.has-warning .form-textarea:focus {
  border-color: var(--warning);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.14);
}

html[data-theme="dark"] .form-group.has-warning .form-control:focus,
html[data-theme="dark"] .form-group.has-warning .form-select:focus,
html[data-theme="dark"] .form-group.has-warning .form-textarea:focus {
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.24);
}

.form-group.has-warning .input-icon { color: var(--warning); }

/* ---------- NATIVE VALIDATION ---------- */

.form-group.validate .form-control:not(:placeholder-shown):valid {
  border-color: var(--success);
}

.form-group.validate .form-control:not(:placeholder-shown):invalid {
  border-color: var(--danger);
}

/* ---------- STATUS ICON ---------- */

.field-status-icon {
  position: absolute;
  inset-inline-end: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
  z-index: 3;
}

.field-status-icon.valid   { color: var(--success); }
.field-status-icon.invalid { color: var(--danger); }
.field-status-icon.warning { color: var(--warning); }
.field-status-icon.loading {
  color: var(--blue-600);
  animation: spin 800ms linear infinite;
}

html[data-theme="dark"] .field-status-icon.loading {
  color: var(--blue-400);
}

.input-wrapper.has-status .form-control,
.input-wrapper.has-status .input {
  padding-inline-end: 40px;
}

/* ---------- FIELD MESSAGE ---------- */

.field-message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.5;
}

.field-message i,
.field-message iconify-icon {
  flex: 0 0 auto;
  margin-top: 2px;
  font-size: 11px;
}

.field-message.error   { color: var(--danger); }
.field-message.success { color: var(--success); }
.field-message.warning { color: var(--warning); }
.field-message.info    { color: var(--info); }

/* ---------- AUTO STATUS ICONS ---------- */

.input-wrapper.has-status-icon.has-error::after,
.input-wrapper.has-status-icon.has-success::after {
  position: absolute;
  inset-inline-end: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  pointer-events: none;
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

.input-wrapper.has-status-icon.has-error::after {
  content: "\f06a";
  color: var(--danger);
}

.input-wrapper.has-status-icon.has-success::after {
  content: "\f00c";
  color: var(--success);
}

/* ---------- PASSWORD STRENGTH ---------- */

.password-strength {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.password-strength-bars {
  display: flex;
  gap: 4px;
}

.password-strength-bar {
  flex: 1 1 0;
  height: 4px;
  background: var(--surface-muted);
  border-radius: var(--radius-pill);
  transition: background-color var(--dur-base) var(--ease);
}

.password-strength[data-strength="1"] .password-strength-bar:nth-child(1) {
  background: var(--danger);
}

.password-strength[data-strength="2"] .password-strength-bar:nth-child(-n+2) {
  background: var(--warning);
}

.password-strength[data-strength="3"] .password-strength-bar:nth-child(-n+3) {
  background: #ca8a04;
}

html[data-theme="dark"] .password-strength[data-strength="3"] .password-strength-bar:nth-child(-n+3) {
  background: #eab308;
}

.password-strength[data-strength="4"] .password-strength-bar {
  background: var(--success);
}

.password-strength-label {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

.password-strength[data-strength="1"] .password-strength-label { color: var(--danger); }
.password-strength[data-strength="2"] .password-strength-label { color: var(--warning); }
.password-strength[data-strength="3"] .password-strength-label { color: #ca8a04; }
.password-strength[data-strength="4"] .password-strength-label { color: var(--success); }

html[data-theme="dark"] .password-strength[data-strength="3"] .password-strength-label {
  color: #eab308;
}

/* ---------- PASSWORD REQUIREMENTS ---------- */

.password-requirements {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}

.password-requirement {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.5;
}

.password-requirement i,
.password-requirement iconify-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 9px;
}

.password-requirement.met { color: var(--success); }
.password-requirement.met i,
.password-requirement.met iconify-icon { color: var(--success); }

/* ---------- FORM BANNER ---------- */

.form-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.form-banner i,
.form-banner iconify-icon {
  flex: 0 0 auto;
  margin-top: 2px;
  font-size: 14px;
}

.form-banner strong {
  display: block;
  font-weight: var(--fw-bold);
  margin-bottom: 2px;
}

.form-banner.error {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

.form-banner.success {
  background: var(--success-soft);
  border-color: var(--success-line);
  color: var(--success);
}

.form-banner.warning {
  background: var(--warning-soft);
  border-color: var(--warning-line);
  color: var(--warning);
}

.form-banner.info {
  background: var(--info-soft);
  border-color: var(--info-line);
  color: var(--info);
}

/* ---------- FIELD LOADING ---------- */

.form-group.is-loading .form-control,
.form-group.is-loading .form-select,
.form-group.is-loading .form-textarea {
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(37, 99, 235, 0.05) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  pointer-events: none;
}

html[data-theme="dark"] .form-group.is-loading .form-control,
html[data-theme="dark"] .form-group.is-loading .form-select,
html[data-theme="dark"] .form-group.is-loading .form-textarea {
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(96, 165, 250, 0.08) 50%,
    transparent 100%
  );
}

/* ---------- VERIFIED ---------- */

.form-group.is-verified .form-control,
.form-group.is-verified .input-group {
  border-color: var(--success);
  background: var(--success-soft);
}

.form-group.is-verified .input-wrapper.has-status-icon.has-success::after {
  content: "\f058";
  color: var(--success);
}

@media (max-width: 480px) {
  .form-banner {
    padding: var(--space-3);
    font-size: var(--fs-xs);
  }
}

@media (prefers-reduced-motion: reduce) {
  .form-control,
  .form-select,
  .form-textarea,
  .password-strength-bar,
  .field-status-icon.loading {
    transition: none !important;
    animation: none !important;
  }

  .form-group.is-loading .form-control,
  .form-group.is-loading .form-select,
  .form-group.is-loading .form-textarea {
    animation: none;
    background-image: none;
    background: var(--surface-muted);
  }
}


/* ============================================================
   11 · MARKETPLACE FORM EXTENSIONS
   ============================================================ */

.mk-form-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  gap: var(--space-5);

  padding: var(--space-6);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.mk-form-card > * {
  position: relative;
  z-index: 1;
}

@media (max-width: 640px) {
  .mk-form-card {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    gap: var(--space-4);
  }
}

/* ---------- FIELD WITH LEADING ICON ---------- */

.mk-field-input {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.mk-field-input > .input,
.mk-field-input > .select,
.mk-field-input > .form-control,
.mk-field-input > .form-select {
  padding-inline-start: 40px;
}

.mk-field-icon {
  position: absolute;
  inset-inline-start: var(--space-3);
  top: 50%;
  transform: translateY(-50%);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 16px;
  height: 16px;

  color: var(--text-light);
  font-size: 14px;

  pointer-events: none;
  z-index: 2;

  transition: color var(--dur-fast) var(--ease);
}

.mk-field-icon iconify-icon,
.mk-field-icon svg,
.mk-field-icon i {
  width: 100%;
  height: 100%;
  display: block;
}

.mk-field-input:focus-within .mk-field-icon {
  color: var(--blue-600);
}

html[data-theme="dark"] .mk-field-input:focus-within .mk-field-icon {
  color: var(--blue-400);
}

/* ---------- INPUT AFFIX ---------- */

.input-affix {
  display: flex;
  align-items: stretch;
  width: 100%;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;

  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow   var(--dur-fast) var(--ease);
}

.input-affix:focus-within {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] .input-affix:focus-within {
  border-color: var(--blue-400);
}

.input-affix > .input,
.input-affix > .form-control {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  border-radius: 0;
  box-shadow: none !important;
  background: transparent;
}

.input-affix > .input:focus,
.input-affix > .form-control:focus {
  box-shadow: none;
}

.input-affix-prefix,
.input-affix-suffix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-3);
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.input-affix-prefix {
  border-inline-end: 1px solid var(--border);
}

.input-affix-suffix {
  border-inline-start: 1px solid var(--border);
}

/* ---------- PREFIX THAT HOLDS A SELECT ---------- */

.input-affix-prefix-select {
  position: relative;
  padding: 0;
  background: transparent;
  border-inline-end: 1px solid var(--border);
}

.input-affix-currency {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  min-height: 42px;
  padding: 0 26px 0 var(--space-3);

  background: var(--surface-soft);
  border: none;
  color: var(--text-soft);

  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1;

  cursor: pointer;
  outline: none;
}

html[dir="rtl"] .input-affix-currency {
  padding: 0 var(--space-3) 0 26px;
}

.input-affix-currency:focus {
  box-shadow: inset 0 0 0 2px var(--blue-600);
}

html[data-theme="dark"] .input-affix-currency:focus {
  box-shadow: inset 0 0 0 2px var(--blue-400);
}

.input-affix-caret {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  pointer-events: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-size: 10px 6px;
}

html[data-theme="dark"] .input-affix-caret {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239FB1C9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
}

/* ---------- PRICE RANGE ROW ---------- */

.price-range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
}

.price-range-row > .input {
  min-width: 0;
}

.price-range-row::before {
  content: "–";
  color: var(--text-light);
  font-weight: var(--fw-bold);
  text-align: center;
  grid-column: 2;
  grid-row: 1;
  pointer-events: none;
}

.price-range-row > .input:first-child {
  grid-column: 1;
  grid-row: 1;
}

.price-range-row > .input:last-child {
  grid-column: 3;
  grid-row: 1;
}

@media (max-width: 480px) {
  .price-range-row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .price-range-row::before { display: none; }

  .price-range-row > .input:first-child,
  .price-range-row > .input:last-child {
    grid-column: 1;
    grid-row: auto;
  }
}

/* ---------- STEP PANEL ---------- */

.mk-step-panel {
  display: none;
}

.mk-step-panel[data-active="true"] {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ---------- STEP ACTIONS ---------- */

.mk-step-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding-top: var(--space-4);
}

@media (max-width: 480px) {
  .mk-step-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .mk-step-actions .btn {
    width: 100%;
  }
}


/* ============================================================
   12 · SKILLS EDITOR
   ============================================================ */

.skills-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow   var(--dur-fast) var(--ease);
}

.skills-editor:focus-within {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] .skills-editor:focus-within {
  border-color: var(--blue-400);
}

.skills-editor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  min-height: 30px;
}

.skills-editor-chips:empty::before {
  content: "No skills added yet.";
  color: var(--text-light);
  font-size: var(--fs-xs);
  font-style: italic;
}

.skills-editor-input-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.skills-editor-input-row > .input {
  flex: 1 1 auto;
  min-width: 0;
}

/* ---------- CHIP ---------- */

.skills-editor-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px var(--space-2) 4px var(--space-3);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-pill);
  color: var(--blue-700);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1.4;
  white-space: nowrap;
  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease);
}

html[dir="rtl"] .skills-editor-chip {
  padding: 4px var(--space-3) 4px var(--space-2);
}

html[data-theme="dark"] .skills-editor-chip {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--blue-100);
}

.skills-editor-chip:hover {
  background: var(--blue-100);
  border-color: var(--blue-600);
}

html[data-theme="dark"] .skills-editor-chip:hover {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.35);
}

.skills-editor-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  padding: 0;
  background: rgba(37, 99, 235, 0.10);
  border: none;
  border-radius: var(--radius-circle);
  color: currentColor;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.skills-editor-chip-remove:hover {
  background: var(--danger);
  color: #ffffff;
}

.skills-editor-chip-remove:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .skills-editor-input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .skills-editor-input-row .btn {
    width: 100%;
  }
}


/* ============================================================
   13 · EXPERIENCE REPEATER
   ============================================================ */

.experience-repeater {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.experience-repeater:empty::before,
.experience-repeater > .profile-about-empty {
  content: "No experience added. Add one to make your profile more credible.";
  display: block;
  padding: var(--space-5);
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.6;
  text-align: center;
}

/* ---------- ENTRY ---------- */

.experience-item {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  gap: var(--space-4);

  padding: var(--space-5);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);

  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow   var(--dur-fast) var(--ease);
}

.experience-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.experience-item > * {
  position: relative;
  z-index: 1;
}

/* ---------- HEAD ---------- */

.experience-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-soft);
}

.experience-item-title {
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.01em;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.experience-item-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.experience-item-action {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 12px;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.experience-item-action:hover {
  color: var(--blue-600);
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .experience-item-action:hover {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--blue-400);
}

.experience-item-action-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

/* ---------- GRID ---------- */

.experience-item-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.experience-item-grid > .field:first-child,
.experience-item-grid > .field:nth-child(2) {
  grid-column: auto;
}

@media (max-width: 640px) {
  .experience-item-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- ADD BUTTON ---------- */

.experience-add {
  align-self: flex-start;
  margin-top: var(--space-4);
}

@media (max-width: 480px) {
  .experience-add {
    align-self: stretch;
    width: 100%;
  }
}


/* ============================================================
   END OF FORMS
   ------------------------------------------------------------
   Verification:

     ✅ Zero raw hex outside the token block, except:
          · Password strength tier 3 uses #ca8a04 (light) and
            #eab308 (dark) — deliberate design colours, not
            tokens
          · Checkbox/radio check-mark uses #ffffff on the blue
            fill, correct on either theme

     ✅ Autofill override
          -webkit-text-fill-color: var(--text)
          -webkit-box-shadow: inset 0 0 0 1000px var(--surface)
          Both tokens flip, so autofill reads correctly on
          both themes.

     ✅ Date-picker native icon
          filter: invert(1) brightness(1.4) under
          html[data-theme="dark"].

     ✅ Select caret
          Light theme: dark slate SVG.
          Dark theme:  light slate SVG.

     ✅ Clear / password-toggle / search-clear resting colour
          Dark-mode override from --text-light to --text-muted.

     ✅ Upload dropzone
          Base reads --surface-soft / --border-strong (flip).
          Icon reads --surface / --border (flip), colour
          --blue-600 (light) → --blue-400 (dark).
          Hover swaps --blue-50 to a translucent blue on
          dark.
          Private badge swaps --navy-50/--navy-100 to a
          translucent slate on dark.

     ✅ Checkbox / radio / availability / role / switch cards
          Checked state reads --blue-50 in light mode. Added
          dark overrides to a translucent blue tint on all
          five.

     ✅ Password strength
          Tier 3 (amber) uses --ca8a04 in light and --eab308
          in dark. The label colours follow.

     ✅ Skills editor chip
          --blue-50 / --blue-100 swap to a translucent blue
          tint on dark. --blue-700 text swaps to --blue-100.

     ✅ Field-status-icon.loading
          --blue-600 (light) → --blue-400 (dark).

     ✅ RTL
          Every icon padding-inline-start / inset-inline-start.
          Every absolutely-positioned icon uses inset-inline-*.
          No explicit RTL override needed.

     ✅ ARABIC
          letter-spacing: 0 added to:
            .form-label, .field-label
            .fieldset-legend
            .upload-private-badge
          All other uppercase-Latin form classes are covered
          by the label tokens.

     ✅ Preserved: every class, every state, every
        responsive breakpoint, every reduced-motion rule,
        every print rule from the previous version.

     ✅ NEXT PASS: dashboard.css
          .dashboard-hero, .dashboard-grow, .org-dashboard-hero
          switch from --navy-800 to --brand-bg.
          Gradient thumbnails get dark overrides.
          The org activity row, dashboard task row,
          dashboard panel all read semantic tokens — mostly
          theme-safe already.
   ============================================================ */
