/* ============================================================
   SOLIDARITY — Components
   ============================================================ */

/* ---------- RTL — auto-flip directional icons ----------
   Lucide-style chevrons / arrows are baked LTR. In an RTL context
   (Arabic) they need to mirror so "next" still points to the visual
   end. Targets the `data-icon` attribute the <Icon/> component sets. */
html[dir="rtl"] svg[data-icon="arrowR"],
html[dir="rtl"] svg[data-icon="arrowL"],
html[dir="rtl"] svg[data-icon="chevronR"],
html[dir="rtl"] svg[data-icon="chevronL"],
html[dir="rtl"] svg[data-icon="arrowUR"] {
  transform: scaleX(-1);
}

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--sol-primary-500);
  color: #fff;
  border-color: var(--sol-primary-500);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: var(--sol-primary-600); border-color: var(--sol-primary-600); }
.btn-primary:active { background: var(--sol-primary-700); }

.btn-deep {
  background: var(--sol-primary-900);
  color: #fff;
  border-color: var(--sol-primary-900);
}
.btn-deep:hover { background: var(--sol-primary-800); }

.btn-secondary {
  background: var(--surface-panel);
  color: var(--text-primary);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--surface-subtle); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
}
.btn-ghost:hover { background: var(--surface-subtle); }

.btn-link {
  background: transparent;
  color: var(--sol-primary-500);
  padding: 4px 2px;
  border-radius: 4px;
}
.btn-link:hover { color: var(--sol-primary-700); text-decoration: underline; }

.btn-danger {
  background: var(--sol-coral);
  color: #5a1a0c;
  border-color: var(--sol-coral);
}
.btn-danger:hover { filter: brightness(0.95); }

/* Ghost button tinted to a destructive intent (still subtle) */
.btn.btn-ghost.is-danger { color: var(--sol-error); }
.btn.btn-ghost.is-danger:hover { background: var(--sol-error-soft); color: var(--sol-error); }

/* Ghost button styled as locked / non-actionable but still clickable (e.g. opens explanation modal) */
.btn.btn-ghost.is-locked { color: var(--text-disabled); cursor: not-allowed; }
.btn.btn-ghost.is-locked:hover { background: var(--surface-subtle); color: var(--text-disabled); }

/* Plain semantic colour utilities */
.text-success { color: var(--sol-success); }
.text-warning { color: var(--sol-warning); }
.text-error   { color: var(--sol-error); }
.text-info    { color: var(--sol-info); }

.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 6px; }
.btn-md { padding: 10px 16px; font-size: 14px; }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn-xl { padding: 16px 24px; font-size: 16px; }

.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
}
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn-icon.btn-lg { width: 42px; height: 42px; }

.btn-group {
  display: inline-flex;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-xs);
}
.btn-group .btn {
  border-radius: 0;
  border: none;
  border-inline-end: 1px solid var(--border-default);
  box-shadow: none;
}
.btn-group .btn:last-child { border-inline-end: none; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--r-full);
  border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.6; }

.badge-neutral { background: var(--surface-subtle); color: var(--text-secondary); border-color: var(--border-subtle); }
.badge-primary { background: var(--sol-primary-50); color: var(--sol-primary-700); border-color: transparent; }
.badge-success { background: var(--sol-success-soft); color: var(--sol-success); }
.badge-warning { background: var(--sol-warning-soft); color: var(--sol-warning); }
.badge-error   { background: var(--sol-error-soft);   color: var(--sol-error); }
.badge-info    { background: var(--sol-info-soft);    color: var(--sol-info); }
.badge-lilac   { background: color-mix(in oklab, var(--sol-lilac) 40%, transparent); color: #3D357A; }
[data-theme="dark"] .badge-lilac { color: var(--sol-lilac); }
[data-theme="dark"] .badge-primary { background: color-mix(in oklab, var(--sol-primary-500) 18%, transparent); color: var(--sol-primary-200); }

.badge-solid-success { background: var(--sol-success); color: #fff; }
.badge-solid-warning { background: var(--sol-warning); color: #fff; }

/* ---------- Input ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.field-hint { font-size: 12px; color: var(--text-tertiary); }
.field-error { font-size: 12px; color: var(--sol-error); }

.input {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  box-shadow: var(--shadow-xs);
}
.input::placeholder { color: var(--text-tertiary); }
.input:hover { border-color: var(--border-strong); }
.input:focus, .input:focus-within {
  outline: none;
  border-color: var(--sol-primary-500);
  box-shadow: var(--shadow-focus);
}
.input-error { border-color: var(--sol-coral); }
.input-error:focus, .input-error:focus-within { box-shadow: var(--shadow-focus-error); border-color: var(--sol-coral); }

.input-group {
  display: flex;
  align-items: center;
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 0 12px;
  gap: 8px;
  box-shadow: var(--shadow-xs);
}
.input-group:focus-within { border-color: var(--sol-primary-500); box-shadow: var(--shadow-focus); }
.input-group .adorn { color: var(--text-tertiary); font-size: 14px; display: inline-flex; }
.input-group input {
  flex: 1;
  border: none; outline: none; background: transparent;
  padding: 10px 0;
  font-family: inherit; font-size: 14px; color: var(--text-primary);
}
.input-group input::placeholder { color: var(--text-tertiary); }

/* ---------- Select ---------- */
.select {
  appearance: none;
  -webkit-appearance: none;
  padding: 10px 36px 10px 12px;
  background: var(--surface-panel) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7385' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 12px center;
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  font-family: inherit; font-size: 14px;
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
  width: 100%;
}
html[dir="rtl"] .select { padding-inline: 12px 36px; padding-inline-start: 12px; padding-inline-end: 36px; background-position: left 12px center; }

/* ---------- Form pickers (Picker + DateField) ---------- */
/* Trigger button + popover. Used by <Picker> directly and by the legacy
   IdTypePicker / NationalityPicker thin wrappers. */
.nat-picker { position: relative; width: 100%; }
.nat-picker-dismiss {
  position: fixed;
  inset: 0;
  z-index: 49;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
}
.nat-picker.is-open .nat-trigger { position: relative; z-index: 50; }
.nat-picker.is-open .nat-menu { z-index: 51; }
.nat-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.nat-trigger:hover { border-color: var(--border-strong); }
.nat-trigger:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-color: var(--sol-primary-500); }
.nat-trigger:disabled { opacity: 0.55; cursor: not-allowed; background: var(--surface-subtle); }
.nat-label { font-weight: 500; }
.nat-picker-sm .nat-trigger { height: 32px; padding: 0 10px; font-size: 13px; }
/* Inline variant — for pickers embedded inside another control (e.g. the
   currency selector inside a sum-insured input-group). Borderless, no
   shadow, auto width, smaller font. */
.nat-picker-inline { width: auto; }
.nat-picker-inline .nat-trigger {
  height: auto;
  padding: 0; padding-inline-end: 4px;
  border: none; background: transparent; box-shadow: none;
  font-size: 13px; color: var(--text-tertiary);
}
.nat-picker-inline .nat-trigger:hover, .nat-picker-inline .nat-trigger:focus-visible { box-shadow: none; border: none; }
.nat-picker-inline .nat-label { font-weight: 500; }
.nat-picker-inline .nat-menu { min-width: 140px; }
.nat-menu {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-start: 0;
  width: 100%;
  min-width: 220px;
  max-height: 320px; overflow: auto;
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 50;
  animation: jp-pop 140ms var(--ease-out);
}
.nat-menu.nat-menu-drop-up {
  top: auto;
  bottom: calc(100% + 4px);
}
.nat-option {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none; background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  text-align: start;
  transition: background var(--dur-fast);
}
.nat-option:hover, .nat-option.hover { background: var(--surface-subtle); }
.nat-option.active { background: var(--sol-primary-50); }
.nat-option:disabled { opacity: 0.5; cursor: not-allowed; }
[data-theme="dark"] .nat-option.active { background: color-mix(in oklab, var(--sol-primary-500) 14%, transparent); }
.nat-search {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  position: sticky; top: -4px;
  background: var(--surface-panel);
  z-index: 1;
}
.nat-search input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--text-primary);
}
.nat-empty {
  padding: 14px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-tertiary);
}
.nat-group {
  padding: 8px 10px 4px;
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  user-select: none;
}
.nat-group:first-child { margin-top: 0; }
.nat-menu-wide { min-width: 320px; }

/* SpinEdit — numeric input with increment/decrement controls. */
.spin-edit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 4px 0 12px;
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  cursor: text;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.spin-edit:hover { border-color: var(--border-strong); }
.spin-edit:focus-within { outline: none; box-shadow: var(--shadow-focus); border-color: var(--sol-primary-500); }
.spin-edit.is-disabled { opacity: 0.55; cursor: not-allowed; background: var(--surface-subtle); }
.spin-edit.input-error { border-color: var(--sol-coral); }
.spin-edit.input-error:focus-within { box-shadow: var(--shadow-focus-error); border-color: var(--sol-coral); }
.spin-edit input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  min-width: 0;
  padding: 0;
  -moz-appearance: textfield;
}
.spin-edit input::-webkit-inner-spin-button,
.spin-edit input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.spin-edit input::placeholder { color: var(--text-tertiary); }
.spin-edit-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  margin-inline-end: 2px;
}
.spin-edit-btn {
  width: 28px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.spin-edit-btn:hover:not(:disabled) { color: var(--sol-primary-700); background: var(--sol-primary-50); }
.spin-edit-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); color: var(--sol-primary-700); }
.spin-edit-btn:disabled { cursor: not-allowed; opacity: 0.45; }
[data-theme="dark"] .spin-edit-btn:hover:not(:disabled) { color: var(--sol-primary-200); background: color-mix(in oklab, var(--sol-primary-500) 16%, transparent); }

/* DateField — styled wrapper around native <input type="date">. */
.date-field-wrap { position: relative; width: 100%; }
.date-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  cursor: text;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.date-field:hover { border-color: var(--border-strong); }
.date-field:focus-within { outline: none; box-shadow: var(--shadow-focus); border-color: var(--sol-primary-500); }
.date-field.is-disabled { opacity: 0.55; cursor: not-allowed; background: var(--surface-subtle); }
.date-field input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--text-primary);
  min-width: 0;
}
.date-field input::-webkit-calendar-picker-indicator { display: none; }
.date-field-picker {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-inline-end: -7px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.date-field-picker:hover { color: var(--sol-primary-700); background: var(--sol-primary-50); }
.date-field-picker:focus-visible { outline: none; box-shadow: var(--shadow-focus); color: var(--sol-primary-700); }
.date-field-picker:disabled { cursor: not-allowed; }
[data-theme="dark"] .date-field-picker:hover { color: var(--sol-primary-200); background: color-mix(in oklab, var(--sol-primary-500) 16%, transparent); }
.date-calendar-dismiss {
  position: fixed;
  inset: 0;
  z-index: 9998;
  border: 0;
  padding: 0;
  background: transparent;
}
.date-calendar {
  position: fixed;
  z-index: 9999;
  width: min(320px, calc(100vw - 32px));
  padding: 12px;
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  color: var(--text-primary);
  animation: jp-pop 140ms var(--ease-out);
}
.date-calendar-head {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.date-calendar-title { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.date-calendar-year {
  height: 32px;
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  background: var(--surface-panel);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: var(--fw-semibold);
  outline: none;
}
.date-calendar-month-picker { width: 112px; }
.date-calendar-month-picker .nat-trigger { font-weight: var(--fw-semibold); }
.date-calendar-month-menu { max-height: 220px; overflow-y: auto; }
.date-calendar-year { width: 72px; padding: 0 6px; text-align: center; appearance: textfield; }
.date-calendar-year::-webkit-inner-spin-button { opacity: .55; }
.date-calendar-year:focus { border-color: var(--sol-primary-500); box-shadow: var(--shadow-focus); }
.date-calendar-nav {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.date-calendar-nav:hover { background: var(--surface-subtle); color: var(--text-primary); }
.date-calendar-nav:focus-visible,
.date-calendar-day:focus-visible,
.date-calendar-action:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.date-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.date-calendar-weekday {
  padding: 5px 0 7px;
  color: var(--text-tertiary);
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-align: center;
  text-transform: uppercase;
}
.date-calendar-day {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.date-calendar-day:hover:not(:disabled) { background: var(--sol-primary-50); color: var(--sol-primary-700); }
.date-calendar-day.is-outside { color: var(--text-disabled); }
.date-calendar-day.is-today { border-color: var(--sol-primary-300); color: var(--sol-primary-700); font-weight: var(--fw-semibold); }
.date-calendar-day.is-selected,
.date-calendar-day.is-selected:hover { background: var(--sol-primary-500); border-color: var(--sol-primary-500); color: white; font-weight: var(--fw-semibold); }
.date-calendar-day:disabled { opacity: .3; cursor: not-allowed; }
.date-calendar-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.date-calendar-action {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: var(--fw-medium);
  cursor: pointer;
}
.date-calendar-action:hover { background: var(--surface-subtle); color: var(--text-primary); }
.date-calendar-action--primary { background: var(--sol-primary-50); color: var(--sol-primary-700); }
.date-calendar-action:disabled { opacity: .4; cursor: not-allowed; }
[data-theme="dark"] .date-calendar-day:hover:not(:disabled),
[data-theme="dark"] .date-calendar-action--primary { background: color-mix(in oklab, var(--sol-primary-500) 16%, transparent); color: var(--sol-primary-200); }
[data-theme="dark"] .date-calendar-day.is-selected,
[data-theme="dark"] .date-calendar-day.is-selected:hover { background: var(--sol-primary-500); color: white; }
.date-field-sm { height: 32px; padding: 0 10px; }
.date-field-sm input { font-size: 13px; }
.date-field-clear {
  border: none; background: transparent; padding: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); cursor: pointer; border-radius: 4px;
}
.date-field-clear:hover { background: var(--surface-subtle); color: var(--text-secondary); }

/* ---------- Checkbox / Radio ---------- */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}
.check input { display: none; }
.check .box {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-panel);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: all var(--dur-fast);
  margin-top: 1px;
}
.check.radio .box { border-radius: 50%; }
.check input:checked + .box {
  background: var(--sol-primary-500);
  border-color: var(--sol-primary-500);
}
.check input:checked + .box::after {
  content: "";
  width: 10px; height: 10px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center/contain no-repeat;
}
.check.radio input:checked + .box::after {
  width: 8px; height: 8px;
  background: #fff;
  border-radius: 50%;
}

/* ---------- Switch ---------- */
.switch {
  position: relative;
  display: inline-block;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.switch input { display: none; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--border-default);
  border-radius: 999px;
  transition: background var(--dur-fast);
}
.switch .thumb {
  position: absolute;
  top: 2px; inset-inline-start: 2px;
  width: 16px; height: 16px;
  background: var(--sol-gray-0);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-out);
}
.switch input:checked ~ .track { background: var(--sol-primary-500); }
.switch input:checked ~ .thumb { transform: translateX(16px); }
html[dir="rtl"] .switch input:checked ~ .thumb { transform: translateX(-16px); }

/* ---------- Chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}
.chip.active {
  background: var(--sol-primary-50);
  color: var(--sol-primary-700);
  border-color: color-mix(in oklab, var(--sol-primary-500) 25%, transparent);
}
[data-theme="dark"] .chip.active {
  background: color-mix(in oklab, var(--sol-primary-500) 18%, transparent);
  color: var(--sol-primary-200);
}

/* ---------- Avatar ---------- */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--sol-primary-100);
  color: var(--sol-primary-700);
  display: inline-grid; place-items: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
  border: 2px solid var(--surface-panel);
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }
.avatar-group { display: inline-flex; }
.avatar-group .avatar + .avatar { margin-inline-start: -8px; }

/* ---------- Tabs ---------- */
.tabs {
  display: inline-flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
}
.tab {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--sol-primary-500); border-bottom-color: var(--sol-primary-500); }
.tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tab:disabled:hover { color: var(--text-secondary); }

.segmented {
  display: inline-flex;
  background: var(--surface-subtle);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.segmented .seg {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
}
.segmented .seg.active {
  background: var(--surface-panel);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* ---------- Alert ---------- */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
}
.alert-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.alert-title { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.alert-msg { font-size: 13px; color: var(--text-secondary); margin: 0; line-height: 1.5; }

.alert-info { background: var(--sol-info-soft); border-color: color-mix(in oklab, var(--sol-info) 20%, transparent); }
.alert-info .alert-title { color: var(--sol-primary-700); }
.alert-success { background: var(--sol-success-soft); border-color: color-mix(in oklab, var(--sol-success) 25%, transparent); }
.alert-success .alert-title { color: var(--sol-success); }
.alert-warning { background: var(--sol-warning-soft); border-color: color-mix(in oklab, var(--sol-warning-bg) 40%, transparent); }
.alert-warning .alert-title { color: var(--sol-warning); }
.alert-error { background: var(--sol-error-soft); border-color: color-mix(in oklab, var(--sol-error-bg) 35%, transparent); }
.alert-error .alert-title { color: var(--sol-error); }

/* ---------- Card ---------- */
.card {
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: box-shadow var(--dur-base);
}
.card.hover:hover { box-shadow: var(--shadow-lg); }
.card-head {
  padding: 20px 20px 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.card-title { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.card-sub { font-size: 13px; color: var(--text-secondary); margin: 4px 0 0; }
.card-body { padding: 12px 20px; }
.card-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------- Progress ---------- */
.progress {
  height: 8px;
  background: var(--surface-subtle);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--sol-primary-500);
  border-radius: 999px;
  transition: width var(--dur-slow) var(--ease-out);
}

/* ---------- Tooltip (static style demo) ---------- */
.tooltip {
  display: inline-block;
  background: var(--sol-gray-900);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .tooltip { background: var(--sol-gray-0); color: var(--sol-gray-900); }

.field-info-label {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 6px;
  vertical-align: middle;
}

/* ---------- SolTooltip (interactive) ---------- */
.sol-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.sol-tooltip.is-disabled { opacity: 0.6; }

.sol-tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: help;
  color: inherit;
}
.sol-tooltip-trigger:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: 6px; }
.sol-tooltip-trigger:disabled { cursor: not-allowed; }

.sol-tooltip-qmark {
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--surface-panel);
  color: var(--text-secondary);
  font-weight: 700;
  line-height: 1;
}

.sol-tooltip-bubble {
  position: absolute;
  z-index: 10050;
  pointer-events: none;
  white-space: normal;
  text-align: start;
}

.sol-tooltip--top {
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
}
.sol-tooltip--bottom {
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
}
.sol-tooltip--right {
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
}
.sol-tooltip--left {
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
}

.sol-tooltip-size-sm .sol-tooltip-bubble {
  width: 170px;
  max-width: min(170px, calc(100vw - 200px));
  padding: 4px 7px;
  font-size: 10px;
}
.sol-tooltip-size-sm .sol-tooltip-qmark {
  width: 12px;
  height: 12px;
  font-size: 9px;
}

.sol-tooltip-size-md .sol-tooltip-bubble {
  width: 200px;
  max-width: min(200px, calc(100vw - 160px));
  padding: 5px 8px;
  font-size: 12px;
}
.sol-tooltip-size-md .sol-tooltip-qmark {
  width: 14px;
  height: 14px;
  font-size: 10px;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast-container .toast {
  pointer-events: auto;
}
.toast {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xl);
  min-width: 320px;
  max-width: 420px;
}
.toast-leading {
  width: 28px; height: 28px; border-radius: 999px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.toast--success .toast-leading {
  background: color-mix(in srgb, var(--sol-green-500, #22c55e) 15%, transparent);
  color: var(--sol-green-600, #16a34a);
}
.toast--error .toast-leading {
  background: color-mix(in srgb, var(--sol-red-500, #ef4444) 15%, transparent);
  color: var(--sol-red-600, #dc2626);
}
.toast--warning .toast-leading {
  background: color-mix(in srgb, var(--sol-amber-500, #f59e0b) 15%, transparent);
  color: var(--sol-amber-600, #d97706);
}
.toast-title { font-size: 14px; font-weight: 600; margin: 0; }
.toast-msg { font-size: 13px; color: var(--text-secondary); margin: 2px 0 0; }
.toast-dismiss {
  margin-inline-start: auto;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--r-sm, 4px);
}
.toast-dismiss:hover {
  background: var(--surface-hover, rgba(0, 0, 0, 0.05));
  color: var(--text-secondary);
}

/* ---------- Table ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: start;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-subtle); }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-tertiary);
}
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb .sep { color: var(--border-default); }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 24px 0;
  border: none;
}

/* ---------- Empty State ---------- */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}
.empty-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--surface-subtle);
  display: inline-grid; place-items: center;
  margin-bottom: 16px;
  color: var(--text-tertiary);
}

/* ---------- Modal / Dialog ---------- */
.dialog {
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2xl);
  max-width: 420px;
  width: 100%;
  overflow: hidden;
}
.dialog-head { padding: 20px 24px 8px; }
.dialog-title { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.dialog-sub { font-size: 14px; color: var(--text-secondary); margin: 6px 0 0; line-height: 1.5; }
.dialog-body { padding: 12px 24px; }
.dialog-foot {
  padding: 16px 24px;
  background: var(--surface-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Code ---------- */
code.inline {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--sol-primary-700);
}
[data-theme="dark"] code.inline { color: var(--sol-primary-200); }

/* ==========================================================================
   Client Intake — sectioned form (Phase 11)
   ========================================================================== */
.intake-section {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.intake-section:first-of-type {
  margin-top: 18px;
}
.intake-section-head {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}
.intake-section-head svg { color: var(--sol-primary-500); }

/* CRM look-up modal results */
.crm-results { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.crm-empty {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 16px; border-radius: 10px;
  background: var(--surface-subtle);
  color: var(--text-tertiary); font-size: 13px;
}
.crm-row {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  cursor: pointer; text-align: start;
  transition: all 120ms var(--ease-out);
}
.crm-row:hover { border-color: var(--sol-primary-500); transform: translateY(-1px); background: var(--surface-elevated); }
.crm-row-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(43, 90, 158, 0.10); color: var(--sol-primary-700, var(--sol-primary-500));
  font-size: 12px; font-weight: 700;
}
.crm-row-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.crm-row-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.crm-row-meta {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-tertiary);
}
.crm-row-dot { opacity: 0.5; }
.crm-row-source { font-size: 11px; color: var(--sol-primary-500); font-weight: 500; }
.crm-row-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--sol-primary-500);
  white-space: nowrap;
}

/* ============================================================
   Phase 28 — Form primitives
   ============================================================ */

/* ---------- Checkbox / Radio enhancements ----------
   The `.check` block already exists; these add description text +
   disabled visuals + radio-group layout. */
.check-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.check-label { font-weight: 500; color: var(--text-primary); line-height: 1.35; }
.check-desc  { font-size: 12px; color: var(--text-tertiary); line-height: 1.4; }
.check.check-disabled { opacity: 0.5; cursor: not-allowed; }
.check.check-disabled input { pointer-events: none; }

.radio-group { display: flex; gap: 8px; }
.radio-group-vertical   { flex-direction: column; }
.radio-group-horizontal { flex-direction: row; flex-wrap: wrap; gap: 16px; }

/* ---------- Segmented size variant ---------- */
.segmented-sm .seg { padding: 4px 8px; font-size: 12px; }
.segmented-sm .seg svg { width: 12px; height: 12px; }

/* ---------- Modal ---------- */
/* `.modal-overlay` and `.modal-panel` are pre-existing in admin-pcm.css.
   These selectors layer the new `<Modal/>` primitive on top with size
   variants, header, body, foot, close button, and focus-ring polish. */
.modal-panel-sm { max-width: 420px; }
.modal-panel-md { max-width: 600px; }
.modal-panel-lg { max-width: 840px; }
.modal-panel-xl { max-width: 1080px; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-title {
  margin: 0;
  font-size: 16px; font-weight: 600;
  color: var(--text-primary);
}
.modal-close {
  appearance: none; border: 0; background: transparent;
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.modal-close:hover { background: var(--surface-subtle); color: var(--text-primary); }
.modal-close:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.modal-body {
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex; gap: 8px; justify-content: flex-end;
  flex-wrap: wrap;
}

/* Allow SolPicker menus to escape modal / section overflow while open
   (same pattern as .security-card:has(.nat-picker.is-open)). */
.section:has(.nat-picker.is-open),
.modal-body:has(.nat-picker.is-open),
.modal-panel:has(.nat-picker.is-open) {
  overflow: visible;
}

/* ---------- Empty state — tone variants ----------
   Layered on top of the existing `.empty-state` + `.empty-icon` rules
   in app.css. Each `.empty-icon-{tone}` swaps the halo color/background
   via tokens that auto-flip in dark mode. */
.empty-icon-info    { background: var(--tone-info-bg-strong);    color: var(--sol-primary-500); }
.empty-icon-success { background: var(--tone-success-bg-strong); color: var(--sol-success); }
.empty-icon-warning { background: var(--tone-warning-bg-strong); color: var(--sol-warning); }
.empty-icon-error   { background: var(--tone-error-bg-strong);   color: var(--sol-error); }
.empty-icon-lilac   { background: var(--accent-irp-bg);          color: var(--accent-irp-strong); }

/* ---------- Skeleton (loading state) ---------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-subtle) 0%,
    var(--surface-muted)  50%,
    var(--surface-subtle) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1400ms ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card { display: flex; flex-direction: column; }

/* ---------- Spinner (loading overlay) ---------- */
.component-spinner {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  background: color-mix(in srgb, var(--surface-base) 82%, transparent);
}
.spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.spinner-content {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 80px;
}
.spinner-content div {
  transform-origin: 40px 40px;
  animation: spinner-fadeout 1.2s linear infinite;
}
.spinner-content div:after {
  content: " ";
  display: block;
  position: absolute;
  top: 3px;
  left: 37px;
  width: 6px;
  height: 18px;
  border-radius: 20%;
  background: var(--sol-primary-500);
}
.spinner-content div:nth-child(1)  { transform: rotate(0deg);   animation-delay: -1.1s; }
.spinner-content div:nth-child(2)  { transform: rotate(30deg);  animation-delay: -1s; }
.spinner-content div:nth-child(3)  { transform: rotate(60deg);  animation-delay: -0.9s; }
.spinner-content div:nth-child(4)  { transform: rotate(90deg);  animation-delay: -0.8s; }
.spinner-content div:nth-child(5)  { transform: rotate(120deg); animation-delay: -0.7s; }
.spinner-content div:nth-child(6)  { transform: rotate(150deg); animation-delay: -0.6s; }
.spinner-content div:nth-child(7)  { transform: rotate(180deg); animation-delay: -0.5s; }
.spinner-content div:nth-child(8)  { transform: rotate(210deg); animation-delay: -0.4s; }
.spinner-content div:nth-child(9)  { transform: rotate(240deg); animation-delay: -0.3s; }
.spinner-content div:nth-child(10) { transform: rotate(270deg); animation-delay: -0.2s; }
.spinner-content div:nth-child(11) { transform: rotate(300deg); animation-delay: -0.1s; }
.spinner-content div:nth-child(12) { transform: rotate(330deg); animation-delay: 0s; }
.spinner-message-container {
  margin-top: 10px;
  color: var(--text-secondary);
  text-align: center;
}
.spinner-message-container h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}
@keyframes spinner-fadeout {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}
