/* ================================
   Asofix DS — Component Styles
   Estilos de los componentes Asofix
   ================================ */

/* --------------------------------
   Button
-------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-family-base);
  font-size: var(--font-size-button-1);
  font-weight: var(--font-weight-button);
  line-height: var(--line-height-button-1);
  letter-spacing: var(--letter-spacing-button-1);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

/* Primary */
.btn--primary { background-color: var(--action-primary); color: var(--text-inverse); }
.btn--primary:hover, .btn--primary.btn--hover { background-color: var(--action-primary-hover); }
.btn--primary:active, .btn--primary.btn--active { background-color: var(--action-primary-active); }
.btn--primary:focus-visible, .btn--primary.btn--focus { background-color: var(--action-primary-hover); outline: 2px solid var(--ring-focus); outline-offset: 0; }
.btn--primary:disabled { background-color: var(--color-paper-200); color: var(--text-disabled); cursor: not-allowed; }

/* Danger */
.btn--danger { background-color: var(--action-danger); color: var(--text-inverse); }
.btn--danger:hover, .btn--danger.btn--hover { background-color: var(--action-danger-hover); }
.btn--danger:active, .btn--danger.btn--active { background-color: var(--action-danger-active); }
.btn--danger:focus-visible, .btn--danger.btn--focus { background-color: var(--action-danger-hover); outline: 2px solid var(--ring-danger); outline-offset: 0; }
.btn--danger:disabled { background-color: var(--color-paper-200); color: var(--text-disabled); cursor: not-allowed; }


/* Secondary */
.btn--secondary { background-color: transparent; color: var(--action-primary); border-color: var(--action-primary); }
.btn--secondary:hover, .btn--secondary.btn--hover { background-color: var(--action-primary-subtle); border-color: var(--action-primary-hover); }
.btn--secondary:active, .btn--secondary.btn--active { background-color: var(--action-primary-subtle-active); border-color: var(--action-primary-active); }
.btn--secondary:focus-visible, .btn--secondary.btn--focus { background-color: var(--action-primary-subtle); outline: 2px solid var(--ring-focus); outline-offset: 0; }
.btn--secondary:disabled { background-color: transparent; border-color: var(--border-strong); color: var(--text-disabled); cursor: not-allowed; }

/* Tertiary */
.btn--tertiary { background-color: transparent; color: var(--action-primary); border-color: transparent; }
.btn--tertiary:hover, .btn--tertiary.btn--hover { background-color: var(--action-primary-subtle); }
.btn--tertiary:active, .btn--tertiary.btn--active { background-color: var(--action-primary-subtle-active); }
.btn--tertiary:focus-visible, .btn--tertiary.btn--focus { background-color: var(--action-primary-subtle); outline: 2px solid var(--ring-focus); outline-offset: 0; }
.btn--tertiary:disabled { color: var(--text-disabled); cursor: not-allowed; }

/* Loading (fondo tipo Active + spinner en lugar del ícono) */
.btn--primary.btn--loading { background-color: var(--action-primary-active); }
.btn--danger.btn--loading { background-color: var(--action-danger-active); }
.btn--secondary.btn--loading { background-color: var(--action-primary-subtle-active); border-color: var(--action-primary-active); }
.btn--tertiary.btn--loading { background-color: var(--action-primary-subtle-active); }
.btn--loading { cursor: default; pointer-events: none; }

.btn__spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: var(--radius-full);
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Sizes — el sm comparte el tamaño de texto del md (typography/button = 14px) */
.btn--md { height: 44px; padding: var(--space-3) var(--space-4); }
.btn--sm { height: 36px; padding: var(--space-2); }

/* Icon-only */
.btn--icon { padding: 0; }
.btn--icon.btn--md { width: 44px; }
.btn--icon.btn--sm { width: 36px; }

/* Íconos en botones — 20px en todas las jerarquías, tamaños y tipos (incluido link) */
.btn .material-icons-outlined {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  text-decoration: none !important;
  display: inline-flex;
}

.btn--link .material-icons-outlined {
  text-decoration: none !important;
  display: inline-block;
  vertical-align: middle;
}

.btn--link {
  background-color: transparent;
  color: var(--action-primary);
  border-color: transparent;
  height: auto;
  padding: 0;
  font-size: var(--font-size-button-2);
  line-height: var(--line-height-button-2);
  letter-spacing: var(--letter-spacing-button-2);
  gap: 6px;
}

.btn--link:hover, .btn--link.btn--hover {
  color: var(--action-primary-hover-subtle);
}

.btn--link:active, .btn--link.btn--active {
  color: var(--action-primary);
}

.btn--link:focus-visible, .btn--link.btn--focus {
  color: var(--action-primary);
  border-color: var(--action-primary);
  border-width: 1px;
  border-style: solid;
  border-radius: var(--radius-xs);
  outline: none;
}

.btn--link:disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
}

/* --------------------------------
   Switch
-------------------------------- */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  width: 44px;
  height: 24px;
}

.switch__input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch__track {
  position: absolute;
  inset: 0;
  background-color: var(--color-neutral-400);
  border-radius: var(--radius-full);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: var(--color-paper-50);
  border-radius: var(--radius-full);
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-low);
}

/* Activo */
.switch__input:checked ~ .switch__track {
  background-color: var(--action-primary);
}

.switch__input:checked ~ .switch__thumb {
  transform: translateX(20px);
}

/* Hover */
.switch:hover .switch__track {
  background-color: var(--color-neutral-500);
}

.switch:hover .switch__input:checked ~ .switch__track {
  background-color: var(--action-primary-hover);
}

/* Focus */
.switch__input:focus-visible ~ .switch__track,
.switch--focus .switch__track {
  border: 2px solid var(--color-primary-100);
}

/* Disabled */
.switch--disabled {
  cursor: not-allowed;
  opacity: 1;
  pointer-events: none;
}

.switch--disabled .switch__track {
  background-color: var(--border-default);
}

.switch--disabled .switch__input:checked ~ .switch__track {
  background-color: var(--border-default);
}

.switch--disabled .switch__thumb {
  background-color: var(--color-paper-50);
}

/* --------------------------------
   Checkbox
-------------------------------- */
.checkbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
}

.checkbox__input {
  position: absolute;
  opacity: 0;
  width: 32px;
  height: 32px;
  margin: 0;
  cursor: pointer;
}

.checkbox__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  font-size: 20px;
  color: var(--action-primary);
  transition: background-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.checkbox__label {
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  color: var(--text-emphasis);
}

/* Checked / indeterminate — mismo color que el default; la regla sigue haciendo falta para el estado indeterminate */
.checkbox__input:checked ~ .checkbox__icon,
.checkbox--indeterminate .checkbox__icon {
  color: var(--action-primary);
}

/* Hover — va después de Checked para ganarle en especificidad empatada.
   paper-100 crudo: el halo de hover es un rol propio del control (fondo de un área
   circular sobre el ícono), no una superficie de layout — ningún --bg-* lo captura */
.checkbox:hover .checkbox__icon {
  background-color: var(--color-paper-100);
  color: var(--action-primary-hover-subtle);
}

/* Focus — halo relleno en vez de anillo, igual que Figma.
   paper-200 crudo por el mismo motivo que el hover; --ring-focus no aplica porque acá
   no hay anillo, es el mismo halo un escalón más oscuro */
.checkbox__input:focus-visible ~ .checkbox__icon,
.checkbox--focus .checkbox__icon {
  background-color: var(--color-paper-200);
  outline: none;
}

/* Disabled — mismo gris para unchecked, checked e indeterminate.
   neutral-300 crudo: es el color del ícono en sí, no un borde ni un texto; --text-disabled
   (neutral-400) es más claro y no da el contraste que define Figma para este control */
.checkbox__input:disabled {
  cursor: not-allowed;
}

.checkbox__input:disabled ~ .checkbox__icon,
.checkbox--indeterminate.checkbox--disabled .checkbox__icon {
  color: var(--color-neutral-300);
}

.checkbox--disabled,
.checkbox:has(.checkbox__input:disabled) {
  cursor: not-allowed;
}

.checkbox:has(.checkbox__input:disabled) .checkbox__label,
.checkbox--disabled .checkbox__label {
  color: var(--text-disabled);
}

/* --------------------------------
   Radio button
-------------------------------- */
.radio {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
}

.radio__input {
  position: absolute;
  opacity: 0;
  width: 32px;
  height: 32px;
  margin: 0;
  cursor: pointer;
}

.radio__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  font-size: 20px;
  color: var(--action-primary);
  transition: background-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.radio__label {
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  color: var(--text-emphasis);
}

/* Selected — mismo color que el default; la regla sigue haciendo falta por especificidad frente a Hover */
.radio__input:checked ~ .radio__icon {
  color: var(--action-primary);
}

/* Hover — va después de Selected para ganarle en especificidad empatada.
   paper-100 crudo: el halo de hover es un rol propio del control (fondo de un área
   circular sobre el ícono), no una superficie de layout — ningún --bg-* lo captura.
   A diferencia del Checkbox, Figma no atenúa el ícono en el hover de Radio — el
   color se queda en --action-primary, solo cambia el fondo. */
.radio:hover .radio__icon {
  background-color: var(--color-paper-100);
}

/* Focus — halo relleno en vez de anillo, igual que Figma.
   paper-200 crudo por el mismo motivo que el hover; --ring-focus no aplica porque acá
   no hay anillo, es el mismo halo un escalón más oscuro */
.radio__input:focus-visible ~ .radio__icon,
.radio--focus .radio__icon {
  background-color: var(--color-paper-200);
  outline: none;
}

/* Disabled — mismo gris para unselected y selected.
   neutral-300 crudo: es el color del ícono en sí, no un borde ni un texto; --text-disabled
   (neutral-400) es más claro y no da el contraste que define Figma para este control */
.radio__input:disabled {
  cursor: not-allowed;
}

.radio__input:disabled ~ .radio__icon {
  color: var(--color-neutral-300);
}

.radio:has(.radio__input:disabled) {
  cursor: not-allowed;
}

.radio:has(.radio__input:disabled) .radio__label {
  color: var(--text-disabled);
}

/* --------------------------------
   Checkbox / Radio group
-------------------------------- */
.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
}

.field-group__label {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-1);
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption-emphasized);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--text-field);
}

.field-group__label-optional {
  font-weight: var(--font-weight-caption);
  color: var(--text-secondary);
}

.field-group__options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  width: 100%;
}

.field-group__options--vertical {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: var(--space-2);
}

.field-group__assistive {
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--text-field);
}

/* --------------------------------
   Input / Text Field
-------------------------------- */
.input {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
}

.input__label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.input__label-text {
  font-family: var(--font-family-base);
  font-weight: var(--font-weight-body-emphasized);
  color: var(--text-emphasis);
}

.input__label-text--lg {
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

.input__label-text--sm {
  font-size: var(--font-size-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
}

.input__label-optional {
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--text-secondary);
}

.input__container {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
  box-sizing: border-box;
}

.input__container--lg {
  height: 50px;
  padding: 0 var(--space-3);
}

.input__container--sm {
  height: 38px;
  padding: 0 13px;
}

.input__field {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  color: var(--text-field);
}

.input__field--sm {
  font-size: var(--font-size-caption);
}

.input__field::placeholder {
  color: var(--text-placeholder);
}

.input__field:disabled {
  color: var(--text-placeholder);
}

/* Prefix / Suffix */
.input__prefix,
.input__suffix {
  flex-shrink: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  color: var(--text-placeholder);
}

.input__container--sm .input__prefix,
.input__container--sm .input__suffix {
  font-size: var(--font-size-caption);
}

.input__assistive {
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--text-secondary);
}

.input__assistive--error {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-error);
}

.input__assistive--error .material-icons-outlined {
  font-size: 16px;
}

/* Fila de texto asistivo + contador de caracteres, opcional */
.input__assistive-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-1);
  width: 100%;
}

.input__count {
  flex-shrink: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* States */
.input__container:hover { border-color: var(--border-hover); }
.input__container:focus-within { border-color: var(--border-focus); box-shadow: 0 0 0 2px var(--ring-focus); }
.input__container--hover { border-color: var(--border-hover); }
.input__container--focus { border-color: var(--border-focus); box-shadow: 0 0 0 2px var(--ring-focus); }
.input__container--error { border-color: var(--border-error); }
.input__container--disabled { background-color: var(--bg-disabled); pointer-events: none; }

/* Read-only: sin borde ni padding horizontal (el texto queda alineado con el label), no editable pero no "apagado" como disabled */
.input__container--readonly { border-color: transparent; padding: 0; pointer-events: none; }
.input--readonly .input__label-text { color: var(--text-secondary); }

.input__label-icon {
  font-size: var(--font-size-caption);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  line-height: 1;
  user-select: none;
}

/* --------------------------------
   Text Area
-------------------------------- */
.textarea__container {
  display: flex;
  align-items: flex-start;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

/* Crece con el contenido (JS: autoGrowTextarea) hasta un tope de ~5 líneas (max-height),
   a partir de ahí scrollea internamente. Modificador --dynamic saca el tope: crece sin límite. */
.textarea__field {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  color: var(--text-field);
  padding: 9px var(--space-3);
  resize: none;
  min-height: 75px;
  max-height: 113px;
  overflow-y: auto;
}

.textarea__field--dynamic {
  max-height: none;
  overflow-y: hidden;
}

.textarea__field::placeholder { color: var(--text-placeholder); }
.textarea__field:disabled { color: var(--text-placeholder); }

.textarea__container:hover { border-color: var(--border-hover); }
.textarea__container:focus-within { border-color: var(--border-focus); box-shadow: 0 0 0 2px var(--ring-focus); }
.textarea__container.input__container--error { border-color: var(--border-error); }
.textarea__container.input__container--disabled { background-color: var(--bg-disabled); pointer-events: none; }
.textarea__container.input__container--readonly { border-color: transparent; pointer-events: none; }

/* --------------------------------
   Select
-------------------------------- */
.select {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
}

.select__container {
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  box-sizing: border-box;
}

.select__container--lg {
  height: 50px;
  padding: 0 var(--space-3);
}

.select__container--sm {
  height: 38px;
  padding: 0 13px;
}

.select__text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-placeholder);
}

.select__text--filled { color: var(--text-field); }

.select__icons {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.select__divider {
  width: 1px;
  background-color: var(--border-strong);
  flex-shrink: 0;
}

.select__container--lg .select__divider { height: 30px; }
.select__container--sm .select__divider { height: 20px; }

.select__icon {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  font-size: 16px;
}

.select__container--lg .select__icon { font-size: 20px; }
.select__icon--sm { font-size: 16px; }

/* States */
.select__container:hover { border-color: var(--border-hover); }
.select__container:focus-within { border-color: var(--border-focus); box-shadow: 0 0 0 2px var(--ring-focus); }
.select__container.input__container--error { border-color: var(--border-error); }
.select__container--disabled { pointer-events: none; }
.select__container--lg.select__container--disabled { background-color: var(--bg-disabled); }
.select__container--sm.select__container--disabled { background-color: var(--bg-disabled); }
.select__container--disabled .select__text--filled { color: var(--text-placeholder); }

/* Read-only: sin borde ni padding horizontal, sin íconos. A diferencia de Text Field/Text Area, el label NO se atenúa acá */
.select__container--readonly { border-color: transparent; padding: 0; pointer-events: none; }

/* --------------------------------
   Card — Metric
-------------------------------- */
.card-metric {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background-color: var(--bg-surface);
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.card-metric__header {
  display: flex;
  align-items: center;
  width: 100%;
}

.card-metric__title {
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption-emphasized);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--text-emphasis);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-metric__body {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  width: 100%;
}

.card-metric__value {
  flex: 1;
  min-width: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-heading);
  line-height: var(--line-height-h2);
  letter-spacing: var(--letter-spacing-h2);
  color: var(--text-body);
}

.card-metric__comparator {
  --comparator-bg: var(--feedback-error-bg-hover);
  --comparator-text: var(--feedback-error-text);

  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.card-metric__comparator--positive {
  --comparator-bg: var(--feedback-success-bg-hover);
  --comparator-text: var(--feedback-success-text);
}

/* Neutral (sin tendencia) — paper-100 y neutral-700 crudos: ningún semántico de bg o
   texto resuelve a estos valores exactos (bg-subtle es neutral-100, no paper-100;
   no hay texto semántico en el escalón 700), mismo criterio que el resto de excepciones documentadas */
.card-metric__comparator--neutral {
  --comparator-bg: var(--color-paper-100);
  --comparator-text: var(--color-neutral-700);
}

.card-metric__icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--comparator-bg);
  border-radius: var(--radius-full);
  padding: var(--space-1);
}

.card-metric__icon-box .material-icons-outlined {
  font-size: 20px;
  color: var(--comparator-text);
  line-height: 1;
}

.card-metric__comparator-text {
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption-emphasized);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--comparator-text);
  white-space: nowrap;
}

/* --------------------------------
   Card — Tile
-------------------------------- */
.card-tile {
  --tile-border: var(--border-default);
  --tile-bg: var(--bg-surface);
  --tile-bg-hover: var(--bg-surface-hover);
  --tile-text: var(--text-primary);

  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--tile-border);
  background-color: var(--tile-bg);
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  cursor: default;
}

.card-tile:hover,
.card-tile--hover {
  background-color: var(--tile-bg-hover);
  transform: translateY(-4px);
}

/* Variantes de color — mismo criterio que Pill/Badge */
.card-tile--error {
  --tile-border: var(--feedback-error-border);
  --tile-bg: var(--feedback-error-bg);
  --tile-bg-hover: var(--feedback-error-bg-hover);
  --tile-text: var(--feedback-error-text);
}

.card-tile--success {
  --tile-border: var(--feedback-success-border);
  --tile-bg: var(--feedback-success-bg);
  --tile-bg-hover: var(--feedback-success-bg-hover);
  --tile-text: var(--feedback-success-text);
}

.card-tile--info {
  --tile-border: var(--feedback-info-border);
  --tile-bg: var(--feedback-info-bg);
  --tile-bg-hover: var(--feedback-info-bg-hover);
  --tile-text: var(--feedback-info-text);
}

.card-tile--warning {
  /* warning-200 casi no se distingue de warning-50; se sube a warning-300 solo acá */
  --tile-border: var(--color-warning-300);
  --tile-bg: var(--feedback-warning-bg);
  --tile-bg-hover: var(--feedback-warning-bg-hover);
  --tile-text: var(--feedback-warning-text);
}

.card-tile__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 31px;
}

.card-tile__title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption-emphasized);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--tile-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-tile__icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--tile-text);
  font-size: 16px;
}

.card-tile__body {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

.card-tile__value {
  font-family: var(--font-family-base);
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-heading);
  line-height: var(--line-height-h1);
  letter-spacing: var(--letter-spacing-h1);
  color: var(--tile-text);
  flex-shrink: 0;
}

.card-tile__subtitle {
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--tile-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Botón opcional dentro de Tile Card — custom de esta card, no es el componente Button de la librería */
.card-tile__button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  width: 100%;
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-6);
  border-radius: var(--radius-xs);
  border: 1px solid var(--tile-border);
  background: none;
  cursor: pointer;
  box-sizing: border-box;
}

.card-tile__button-label {
  flex: 1;
  font-family: var(--font-family-base);
  /* 10px: no hay token de este tamaño, la spec de Figma lo pide explícito solo para este botón */
  font-size: 10px;
  font-weight: var(--font-weight-caption-emphasized);
  line-height: 16.32px;
  letter-spacing: var(--letter-spacing-caption);
  color: var(--tile-text);
  text-align: center;
}

.card-tile__button-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--tile-text);
  font-size: 12px;
}

/* --------------------------------
   Tooltip
-------------------------------- */
.tooltip {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  position: relative;
}

.tooltip--top,
.tooltip--bottom {
  flex-direction: column;
  align-items: stretch;
  width: 220px;
}

.tooltip--top .tooltip__arrow,
.tooltip--bottom .tooltip__arrow {
  align-self: center;
}

.tooltip__box {
  /* neutral-700 no tiene semántico que calce: --bg-inverse es surface-dark (violeta), un valor distinto */
  background-color: var(--color-neutral-700);
  border-radius: var(--radius-sm);
  padding: 10px var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex: 1;
  min-width: 0;
}

.tooltip__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  width: 100%;
}

.tooltip__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}

.tooltip__title {
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body-emphasized);
  line-height: var(--line-height-body);
  color: var(--text-inverse);
  display: block;
}

.tooltip__desc {
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--text-inverse);
  display: block;
}

.tooltip__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 1;
}

.tooltip__close .material-icons-outlined {
  font-size: 16px;
}

.tooltip__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.tooltip__paginator {
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption-emphasized);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: var(--text-inverse);
}

.tooltip__action {
  font-size: var(--font-size-caption) !important;
  color: var(--text-inverse) !important;
  letter-spacing: var(--letter-spacing-caption);
}

.tooltip__action:hover {
  color: rgba(255,255,255,0.75) !important;
}

/* Arrow */
.tooltip__arrow {
  width: 0;
  height: 0;
  flex-shrink: 0;
}

.tooltip--left .tooltip__arrow {
  border-top: 8.5px solid transparent;
  border-bottom: 8.5px solid transparent;
  border-right: 8px solid var(--color-neutral-700);
}

.tooltip--right .tooltip__arrow {
  border-top: 8.5px solid transparent;
  border-bottom: 8.5px solid transparent;
  border-left: 8px solid var(--color-neutral-700);
}

.tooltip--top .tooltip__arrow {
  border-left: 8.5px solid transparent;
  border-right: 8.5px solid transparent;
  border-bottom: 8px solid var(--color-neutral-700);
}

.tooltip--bottom .tooltip__arrow {
  border-left: 8.5px solid transparent;
  border-right: 8.5px solid transparent;
  border-top: 8px solid var(--color-neutral-700);
}

/* --------------------------------
   Pill — General
-------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.pill .material-icons-outlined { font-size: 16px; line-height: 1; }

/* Sizes */
.pill--sm { padding: var(--space-1) var(--space-2); }
.pill--md { padding: 6px var(--space-3); }
.pill--lg { padding: var(--space-2) var(--space-3); }

/* Default */
.pill--default { background-color: var(--pill-default-bg); border-color: var(--pill-default-border); color: var(--pill-default-text); }
.pill--default:hover, .pill--default.pill--hover { background-color: var(--pill-default-bg-hover); border-color: var(--pill-default-border); }
.pill--default:active, .pill--default.pill--active { background-color: var(--pill-default-bg-active); }
.pill--default:focus-visible, .pill--default.pill--focus { background-color: var(--pill-default-bg-hover); border-width: 2px; border-color: var(--pill-default-focus-border); outline: none; }
.pill--default:disabled, .pill--default.pill--disabled { background-color: var(--pill-default-bg); border-color: var(--pill-default-border); color: var(--text-disabled); cursor: not-allowed; }

/* Rojo */
.pill--rojo { background-color: var(--pill-error-bg); border-color: var(--pill-error-border); color: var(--pill-error-text); }
.pill--rojo:hover, .pill--rojo.pill--hover { background-color: var(--pill-error-bg-hover); }
.pill--rojo:active, .pill--rojo.pill--active { background-color: var(--pill-error-bg-active); }
.pill--rojo:focus-visible, .pill--rojo.pill--focus { background-color: var(--pill-error-bg-hover); border-width: 2px; border-color: var(--pill-error-focus-border); outline: none; }
.pill--rojo:disabled, .pill--rojo.pill--disabled { background-color: var(--pill-error-bg); border-color: var(--pill-error-border); color: var(--pill-error-disabled-text); cursor: not-allowed; }

/* Verde */
.pill--verde { background-color: var(--pill-success-bg); border-color: var(--pill-success-border); color: var(--pill-success-text); }
.pill--verde:hover, .pill--verde.pill--hover { background-color: var(--pill-success-bg-hover); }
.pill--verde:active, .pill--verde.pill--active { background-color: var(--pill-success-bg-active); }
.pill--verde:focus-visible, .pill--verde.pill--focus { background-color: var(--pill-success-bg-hover); border-width: 2px; border-color: var(--pill-success-focus-border); outline: none; }
.pill--verde:disabled, .pill--verde.pill--disabled { background-color: var(--pill-success-bg); border-color: var(--pill-success-disabled-border); color: var(--pill-success-disabled-text); cursor: not-allowed; }

/* Amarillo */
.pill--amarillo { background-color: var(--pill-warning-bg); border-color: var(--pill-warning-border); color: var(--pill-warning-text); }
.pill--amarillo:hover, .pill--amarillo.pill--hover { background-color: var(--pill-warning-bg-hover); }
.pill--amarillo:active, .pill--amarillo.pill--active { background-color: var(--pill-warning-bg-active); }
.pill--amarillo:focus-visible, .pill--amarillo.pill--focus { background-color: var(--pill-warning-bg-hover); border-width: 2px; border-color: var(--pill-warning-focus-border); outline: none; }
.pill--amarillo:disabled, .pill--amarillo.pill--disabled { background-color: var(--pill-warning-bg); border-color: var(--pill-warning-border); color: var(--pill-warning-disabled-text); cursor: not-allowed; }

/* Celeste */
.pill--celeste { background-color: var(--pill-info-bg); border-color: var(--pill-info-border); color: var(--pill-info-text); }
.pill--celeste:hover, .pill--celeste.pill--hover { background-color: var(--pill-info-bg-hover); }
.pill--celeste:active, .pill--celeste.pill--active { background-color: var(--pill-info-bg-active); }
.pill--celeste:focus-visible, .pill--celeste.pill--focus { background-color: var(--pill-info-bg-hover); border-width: 2px; border-color: var(--pill-info-focus-border); outline: none; }
.pill--celeste:disabled, .pill--celeste.pill--disabled { background-color: var(--pill-info-bg); border-color: var(--pill-info-border); color: var(--pill-info-disabled-text); cursor: not-allowed; }

/* --------------------------------
   Pill — Highlight
-------------------------------- */
.pill-highlight {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  padding: var(--space-1) 6px;
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body-emphasized);
  line-height: var(--line-height-body);
  white-space: nowrap;
}
.pill-highlight .material-icons-outlined { font-size: 16px; line-height: 1; }

.pill-highlight--amarillo { background-color: var(--pill-highlight-warning-bg); border-color: var(--pill-highlight-warning-border); color: var(--pill-highlight-warning-text); }
.pill-highlight--menta    { background-color: var(--pill-highlight-secondary-bg); border-color: var(--pill-highlight-secondary-border); color: var(--pill-highlight-secondary-text); }
.pill-highlight--violeta  { background-color: var(--pill-highlight-primary-bg);   border-color: var(--pill-highlight-primary-border);  color: var(--pill-highlight-primary-text); }

/* --------------------------------
   Badge
-------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-radius: var(--radius-full);
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  white-space: nowrap;
}

/* Tamaño / forma */
.badge--fix {
  width: 20px;
  height: 20px;
  padding: 0;
}

.badge--hug {
  height: 20px;
  padding: 0 6px;
}

.badge--dot {
  width: 8px;
  height: 8px;
  padding: 0;
}

/* Color */
.badge--warning {
  background-color: var(--solid-warning);
  color: var(--text-inverse);
}

.badge--error {
  background-color: var(--solid-error);
  color: var(--text-inverse);
}

.badge--neutral {
  background-color: var(--solid-neutral);
  color: var(--text-inverse);
}

.badge--white {
  background-color: var(--bg-surface);
  color: var(--text-emphasis);
}

/* Borde — separa el badge de lo que tiene detrás (ej. sobre un Avatar) */
.badge--stroke.badge--fix,
.badge--stroke.badge--hug {
  border: 1px solid var(--bg-surface);
}

.badge--white.badge--stroke.badge--fix,
.badge--white.badge--stroke.badge--hug {
  border-color: var(--border-default);
}

.badge--stroke.badge--dot {
  box-shadow: 0 0 0 2px var(--bg-surface);
}

/* --------------------------------
   Avatar
-------------------------------- */
.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-canvas);
  box-shadow: var(--shadow-low);
  overflow: hidden;
  flex-shrink: 0;
}

/* Sizes */
.avatar--24  { width: 24px;  height: 24px; }
.avatar--32  { width: 32px;  height: 32px; }
.avatar--40  { width: 40px;  height: 40px; }
.avatar--56  { width: 56px;  height: 56px; }
.avatar--112 { width: 112px; height: 112px; }

/* Empty */
.avatar--empty {
  background-color: var(--solid-neutral);
}
.avatar--empty::before {
  font-family: 'Material Icons Outlined';
  font-style: normal;
  font-weight: normal;
  color: var(--text-inverse);
  line-height: 1;
}
.avatar--24.avatar--empty::before  { content: 'person'; font-size: 14px; }
.avatar--32.avatar--empty::before  { content: 'person'; font-size: 18px; }
.avatar--40.avatar--empty::before  { content: 'person'; font-size: 22px; }
.avatar--56.avatar--empty::before  { content: 'person'; font-size: 32px; }
.avatar--112.avatar--empty::before { content: 'person'; font-size: 64px; }

/* Initial */
.avatar--initial {
  background-color: var(--action-primary);
}
.avatar__initial {
  font-family: var(--font-family-base);
  /* 500 (Inter Medium) es el valor de Figma; la escala tipográfica no tiene peso medio (400/600) y la inicial no consume ningún text style compartido — es escala propia del componente */
  font-weight: 500;
  color: var(--text-inverse);
  line-height: 1;
  user-select: none;
}
.avatar--24  .avatar__initial { font-size: 12px; letter-spacing: 0em; }
.avatar--32  .avatar__initial { font-size: 16px; letter-spacing: 0em; }
.avatar--40  .avatar__initial { font-size: 24px; letter-spacing: -0.02em; }
.avatar--56  .avatar__initial { font-size: 32px; letter-spacing: -0.02em; }
.avatar--112 .avatar__initial { font-size: 64px; letter-spacing: -0.02em; }

/* Photo */
.avatar--photo {
  background-color: var(--bg-sunken);
}
.avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --------------------------------
   Toast / Notification
-------------------------------- */
.toast {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 350px;
  min-height: 70px;
  padding: var(--space-2);
  border: 1px solid;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-mid);
  box-sizing: border-box;
}

/* Borde en -400: más contraste que --feedback-*-border (200), a propósito para que el toast se destaque como overlay flotante */
.toast--success { background-color: var(--feedback-success-bg-hover); border-color: var(--color-success-400); }
.toast--error   { background-color: var(--feedback-error-bg-hover);   border-color: var(--color-error-400); }
.toast--info    { background-color: var(--feedback-info-bg-hover);    border-color: var(--color-info-400); }
.toast--alert   { background-color: var(--feedback-warning-bg-hover); border-color: var(--color-warning-400); }

.toast__content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  width: 100%;
}

.toast__icon {
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
}
.toast__icon .material-icons-outlined { font-size: 16px; line-height: 1; }

.toast--success .toast__icon { color: var(--feedback-success-text); }
.toast--error   .toast__icon { color: var(--feedback-error-text); }
.toast--info    .toast__icon { color: var(--feedback-info-text); }
/* warning-900: warning-700 no distingue lo suficiente sobre el fondo warning-100, mismo criterio que card-tile--warning */
.toast--alert   .toast__icon { color: var(--color-warning-900); }

.toast__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body-emphasized);
  line-height: var(--line-height-body);
  display: block;
}

.toast__desc {
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  display: block;
}

.toast--success .toast__title,
.toast--success .toast__desc  { color: var(--feedback-success-text); }
.toast--error   .toast__title,
.toast--error   .toast__desc  { color: var(--feedback-error-text); }
.toast--info    .toast__title,
.toast--info    .toast__desc  { color: var(--feedback-info-text); }
.toast--alert   .toast__title,
.toast--alert   .toast__desc  { color: var(--color-warning-900); }

.toast__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
}
.toast__close .material-icons-outlined { font-size: 16px; line-height: 1; }

.toast--success .toast__close { color: var(--feedback-success-text); }
.toast--error   .toast__close { color: var(--feedback-error-text); }
.toast--info    .toast__close { color: var(--feedback-info-text); }
.toast--alert   .toast__close { color: var(--color-warning-900); }

/* Track time */
.toast__track {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 5px;
  border-radius: 0 0 0 var(--radius-xs);
  width: 75%;
}

.toast--success .toast__track { background-color: var(--feedback-success-icon); }
.toast--error   .toast__track { background-color: var(--feedback-error-icon); }
.toast--info    .toast__track { background-color: var(--feedback-info-icon); }
.toast--alert   .toast__track { background-color: var(--feedback-warning-icon); }

.toast__track--anim {
  width: 100%;
  animation: toast-progress var(--toast-duration, 4000ms) linear forwards;
}

.toast:hover .toast__track--anim {
  animation-play-state: paused;
}

@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(calc(100% + 24px)); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(calc(100% + 24px)); }
}

.toast--in  { animation: toast-in  0.25s ease forwards; }
.toast--out { animation: toast-out 0.25s ease forwards; }

/* --------------------------------
   Modal
-------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: var(--space-6);
}
.modal-overlay[hidden] { display: none; }

.modal {
  display: flex;
  flex-direction: column;
  width: 600px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-high);
}

.modal__header {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-4) var(--space-6);
  background-color: var(--bg-canvas);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  flex-shrink: 0;
}

.modal__titles {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* neutral-700 crudo en título/desc/close: mismo caso que el Tooltip y el Dropdown —
   cae entre --text-body (800) y --text-field (600), no hay semántico en ese escalón */
.modal__title {
  font-family: var(--font-family-base);
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-heading);
  line-height: var(--line-height-h4);
  letter-spacing: var(--letter-spacing-h4);
  color: var(--color-neutral-700);
}

.modal__desc {
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  color: var(--color-neutral-700);
}

.modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-neutral-700);
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}
.modal__close:hover { background-color: var(--bg-surface-hover); }
.modal__close .material-icons-outlined { font-size: 20px; line-height: 1; width: 20px; display: inline-flex; justify-content: center; overflow: hidden; }

.modal__body {
  padding: var(--space-6);
  background-color: var(--bg-surface);
  overflow-y: auto;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-shrink: 0;
}

.modal__footer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: auto;
}

/* Animaciones */
@keyframes modal-overlay-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-overlay-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes modal-in  { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes modal-out { from { opacity: 1; transform: scale(1) translateY(0); } to { opacity: 0; transform: scale(0.96) translateY(8px); } }

.modal-overlay--in  { animation: modal-overlay-in  0.2s ease forwards; }
.modal-overlay--out { animation: modal-overlay-out 0.2s ease forwards; }
.modal--in          { animation: modal-in  0.2s ease forwards; }
.modal--out         { animation: modal-out 0.2s ease forwards; }

/* --------------------------------
   Dropdown
--------------------------------- */

.dropdown {
  display: inline-flex;
  flex-direction: column;
  background-color: var(--bg-surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-mid);
  width: 380px;
  overflow: hidden;
  animation: dropdown-in 0.15s ease forwards;
}
.dropdown[hidden] { display: none; }

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown__list {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--space-1);
  overflow-y: auto;
  max-height: 408px;
}
/* Si hay footer, el padding-bottom se traslada a él: en Figma la lista y los botones comparten un solo contenedor con un padding, no dos paddings apilados */
.dropdown__list:has(+ .dropdown__footer) {
  padding-bottom: 0;
}
.dropdown__list::-webkit-scrollbar       { width: 6px; }
.dropdown__list::-webkit-scrollbar-track { background: var(--bg-surface); }
/* neutral-300 crudo: es el pulgar de un scrollbar, no un borde ni un texto — ningún semántico
   cubre ese rol. En Figma este color todavía referencia el token viejo V2.0/Gray/300 (#C7C7C7),
   de antes del rediseño de paleta; Bumper ya está en la escala nueva */
.dropdown__list::-webkit-scrollbar-thumb { background-color: var(--color-neutral-300); border-radius: var(--radius-full); }

/* Item base */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: 0;
  background-color: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-family-base);
  text-align: left;
  transition: background-color 0.15s ease;
  width: 100%;
}
.dropdown-item:hover,
.dropdown-item--active                 { background-color: var(--action-primary-subtle); }
.dropdown-item--disabled               { cursor: default; pointer-events: none; }

/* Item: status types */
.dropdown-item--loading:hover,
.dropdown-item--no-matches:hover      { background-color: transparent; }

/* Checkbox icon */
.dropdown-item__checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 6px;
  color: var(--action-primary);
  line-height: 1;
}
.dropdown-item__checkbox .material-icons-outlined { font-size: 20px; line-height: 1; }
/* neutral-300 crudo: mismo criterio que el disabled del Checkbox real — es el color del ícono
   en sí, y --text-disabled (neutral-400) es más claro que el contraste que define Figma */
.dropdown-item--disabled .dropdown-item__checkbox { color: var(--color-neutral-300); }

/* Content */
/* neutral-700 crudo: cae entre --text-body (800) y --text-field (600), no hay semántico en ese
   escalón. Mismo caso que el gris del Tooltip */
.dropdown-item__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  color: var(--color-neutral-700);
}
.dropdown-item--disabled .dropdown-item__content { color: var(--text-disabled); }

.dropdown-item__title-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
}
.dropdown-item__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body-emphasized);
  line-height: var(--line-height-body);
  color: inherit;
}
.dropdown-item__number {
  flex-shrink: 0;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body-emphasized);
  line-height: var(--line-height-body);
  text-align: right;
  color: inherit;
}
/* En Figma el número baja a peso regular cuando el ítem está disabled (el título se
   mantiene semibold) — único lugar del componente donde el peso cambia por estado */
.dropdown-item--disabled .dropdown-item__number { font-weight: var(--font-weight-body); }
.dropdown-item__desc {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: inherit;
}

/* Status text */
.dropdown-item__status {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body-emphasized);
  line-height: var(--line-height-body);
  /* neutral-700 crudo, mismo motivo que .dropdown-item__content */
  color: var(--color-neutral-700);
}

/* Group title (Title h2) — encabezado de grupo, no interactivo, sin checkbox */
.dropdown-item__group-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4) var(--space-6) var(--space-4);
  width: 100%;
  box-sizing: border-box;
  /* neutral-700 crudo, mismo motivo que .dropdown-item__content */
  color: var(--color-neutral-700);
}
.dropdown-item__group-title-text {
  font-family: var(--font-family-base);
  font-size: var(--font-size-subtitle-1);
  font-weight: var(--font-weight-subtitle-1-emphasized);
  line-height: var(--line-height-subtitle-1);
  letter-spacing: var(--letter-spacing-subtitle-1-emphasized);
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Section title (Title h5) — subencabezado. Variante base: fila con checkbox opcional
   (ej. "Seleccionar todos"). Variante --desc: columna con descripción, sin checkbox. */
.dropdown-item__section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-4) var(--space-4);
  width: 100%;
  box-sizing: border-box;
  background: none;
  border: none;
  font-family: var(--font-family-base);
  text-align: left;
  /* neutral-700 crudo, mismo motivo que .dropdown-item__content */
  color: var(--color-neutral-700);
}
.dropdown-item__section-title--desc {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}
.dropdown-item__section-title-text {
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-subtitle-2);
  font-weight: var(--font-weight-subtitle-2);
  line-height: var(--line-height-subtitle-2);
  letter-spacing: var(--letter-spacing-subtitle-2);
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Compartida por Group title y Section title--desc */
.dropdown-item__group-desc,
.dropdown-item__section-desc {
  font-family: var(--font-family-base);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-caption);
  line-height: var(--line-height-caption);
  letter-spacing: var(--letter-spacing-caption);
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Footer */
.dropdown__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
  padding: var(--space-4);
  flex-shrink: 0;
}

/* --------------------------------
   Tabs
-------------------------------- */
.tabs {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  background-color: var(--bg-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-1);
  position: relative;
}

.tabs__indicator {
  position: absolute;
  top: 4px;
  left: 0;
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-low);
  border-radius: var(--radius-xs);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.25s ease, width 0.25s ease;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-xs);
  border: none;
  background-color: transparent;
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  letter-spacing: var(--letter-spacing-body);
  color: var(--text-body);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  transition: color 0.2s ease;
}

.tab--active {
  color: var(--action-primary);
  font-weight: var(--font-weight-body-emphasized);
}

.tab .material-icons-outlined {
  font-size: 20px;
  line-height: 1;
  width: 20px;
  flex-shrink: 0;
  display: inline-flex;
  justify-content: center;
  overflow: hidden;
}
