/* ============================================================
   PdP Cotizador — components.css
   Todos los componentes reutilizables de UI
   ============================================================ */

/* ── Form fields ────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.field__label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.field__hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.field__error {
  font-size: var(--text-xs);
  color: var(--err);
  margin-top: 2px;
}

/* Input base */
.input {
  width: 100%;
  padding: 8px var(--sp-3);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.4;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
  -webkit-appearance: none;
}

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

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

.input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.input--mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.input--sm {
  padding: 5px var(--sp-2);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.input--error {
  border-color: var(--err);
}
.input--error:focus {
  box-shadow: 0 0 0 2px rgba(230, 60, 90, 0.15);
}

/* Select */
select.input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234a6080' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  padding-right: var(--sp-8);
}

/* Textarea */
textarea.input {
  resize: vertical;
  min-height: 72px;
}

/* Input con botón inline */
.input-group {
  display: flex;
  gap: var(--sp-2);
}
.input-group .input { flex: 1; }

/* Input numérico de cantidad — con +/- */
.qty-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-input);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.qty-input:focus-within {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.qty-input__btn {
  width: 30px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-md);
  background: transparent;
  border: none;
  transition: color var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
}
.qty-input__btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.qty-input input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  text-align: center;
  min-width: 0;
  padding: 0;
}

/* ── Checkbox y Radio ───────────────────────────────────────── */
.checkbox, .radio {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  user-select: none;
}

.checkbox input[type="checkbox"],
.radio input[type="radio"] {
  width: 15px;
  height: 15px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t-fast), border-color var(--t-fast);
  position: relative;
}

.radio input[type="radio"] { border-radius: 50%; }

.checkbox input[type="checkbox"]:checked,
.radio input[type="radio"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.radio input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}

.checkbox__label, .radio__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Checkbox toggle (on/off) */
.toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  user-select: none;
}

.toggle__track {
  width: 32px;
  height: 18px;
  background: var(--border);
  border-radius: 9px;
  position: relative;
  transition: background var(--t-base);
  flex-shrink: 0;
}

.toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--t-base), background var(--t-base);
}

.toggle input { display: none; }

.toggle input:checked ~ .toggle__track { background: var(--accent); }
.toggle input:checked ~ .toggle__track .toggle__thumb {
  transform: translateX(14px);
  background: #fff;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 7px var(--sp-4);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-glow);
  outline: 1px solid var(--accent);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Variantes */
.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn--primary:hover {
  background: #1a4fd4;
  border-color: #1a4fd4;
}

.btn--secondary {
  background: var(--bg-card-raised);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn--secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn--ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn--danger {
  background: transparent;
  color: var(--err);
  border-color: var(--err);
}
.btn--danger:hover {
  background: var(--err-bg);
}

.btn--ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok);
}

/* Tamaños */
.btn--sm {
  padding: 4px var(--sp-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: 10px var(--sp-6);
  font-size: var(--text-md);
}

.btn--icon {
  padding: 6px;
  width: 30px;
  height: 30px;
}

.btn--full { width: 100%; }

/* ── Badges / Pills ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--sp-2);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid;
  white-space: nowrap;
}

.badge--ok    { color: var(--ok);   border-color: var(--ok);   background: var(--ok-bg); }
.badge--warn  { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.badge--err   { color: var(--err);  border-color: var(--err);  background: var(--err-bg); }
.badge--info  { color: var(--info); border-color: var(--info); background: var(--info-bg); }
.badge--muted {
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--bg-input);
}

/* Badges de estado de trabajo */
.badge--borrador    { color: var(--estado-borrador);   border-color: var(--estado-borrador);   background: rgba(74,96,128,0.1); }
.badge--cotizado    { color: var(--estado-cotizado);   border-color: var(--estado-cotizado);   background: rgba(43,159,255,0.1); }
.badge--aprobado    { color: var(--estado-aprobado);   border-color: var(--estado-aprobado);   background: rgba(167,139,250,0.1); }
.badge--produccion  { color: var(--estado-produccion); border-color: var(--estado-produccion); background: rgba(230,168,23,0.1); }
.badge--listo       { color: var(--estado-listo);      border-color: var(--estado-listo);      background: rgba(29,184,112,0.1); }
.badge--entregado   { color: var(--estado-entregado);  border-color: var(--estado-entregado);  background: rgba(74,96,128,0.1); }
.badge--facturado   { color: var(--estado-facturado);  border-color: var(--estado-facturado);  background: rgba(43,101,255,0.1); }
.badge--cancelado   { color: var(--estado-cancelado);  border-color: var(--estado-cancelado);  background: rgba(230,60,90,0.1); }

/* ── Radio group tipo pill (para tipo cover, tintas, etc) ───── */
.pill-group {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
}

.pill-option {
  padding: 5px var(--sp-3);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-input);
  transition: all var(--t-fast);
  white-space: nowrap;
  user-select: none;
}
.pill-option:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}
.pill-option--selected {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Servicio tercerizado (checklist de acabados) ───────────── */
.service-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.service-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--t-fast);
}

.service-item--active {
  border-color: rgba(43,101,255,0.3);
  background: rgba(43,101,255,0.03);
}

.service-item__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  transition: background var(--t-fast);
}
.service-item__header:hover { background: var(--bg-hover); }

.service-item__name {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}
.service-item--active .service-item__name { color: var(--text-primary); }

.service-item__cost {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.service-item--active .service-item__cost { color: var(--warn); }

.service-item__body {
  padding: var(--sp-3);
  border-top: 1px solid var(--border);
  display: none;
}
.service-item--active .service-item__body { display: block; }

/* ── Inserto item ────────────────────────────────────────────── */
.insert-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  position: relative;
}

.insert-item__header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.insert-item__num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.insert-item__title {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

/* ── Selector de papel con toggle recomendados/todos ─────────── */
.paper-select-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.paper-select-toggle {
  font-size: var(--text-xs);
  color: var(--accent);
  cursor: pointer;
  align-self: flex-start;
  padding: 0;
  background: none;
  border: none;
  transition: opacity var(--t-fast);
}
.paper-select-toggle:hover { opacity: 0.7; }

/* ── Estrategia de producción por componente ────────────────── */
.strat-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: var(--sp-2);
}

.strat-block__title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
}

.strat-option {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  transition: background var(--t-fast);
}
.strat-option:last-child { border-bottom: none; }
.strat-option:hover { background: var(--bg-hover); }

.strat-option--selected { background: rgba(43,101,255,0.06); }
.strat-option--best .strat-option__name { color: var(--strat-best); }
.strat-option--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.strat-option__radio {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-focus);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--t-fast);
  margin-top: 3px;
}
.strat-option--selected .strat-option__radio {
  border-color: var(--accent);
}
.strat-option--selected .strat-option__radio::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.strat-option__info {
  flex: 1;
  min-width: 0;
}

.strat-option__row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.strat-option__name {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.strat-option--selected .strat-option__name { color: var(--text-primary); }

.strat-option__cost {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-left: auto;
}
.strat-option--selected .strat-option__cost { color: var(--text-primary); }

.strat-option__unit {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
}

.strat-option__tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid var(--strat-best);
  color: var(--strat-best);
  white-space: nowrap;
}

.strat-option__warn {
  font-size: 10px;
  color: var(--warn);
}

.strat-option__detail {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: var(--sp-1);
  padding-top: var(--sp-1);
  border-top: 1px dashed rgba(0,0,0,0.06);
}

.strat-detail-line {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.5;
}
.strat-detail-line strong {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.strat-qty-header {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3) 0;
}
.strat-qty-header span {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.strat-option__costs {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
}
.strat-option__costs .strat-option__cost {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}
.strat-option__costs .strat-option__cost small {
  font-size: 10px;
  opacity: 0.7;
}
.strat-option--selected .strat-option__costs .strat-option__cost {
  color: var(--text-primary);
}

/* ── Kanban board ───────────────────────────────────────────── */
.kanban {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  padding: var(--sp-5);
  align-items: flex-start;
  min-height: calc(100vh - var(--topbar-h));
}

.kanban-col {
  min-width: 240px;
  max-width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.kanban-col__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.kanban-col__title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.kanban-col__count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 999px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.kanban-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow);
}

.kanban-card__id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: var(--sp-1);
}

.kanban-card__client {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.kanban-card__product {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
}

.kanban-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.due-date {
  font-family: var(--font-mono);
  font-size: 10px;
}
.due-date--ok   { color: var(--ok); }
.due-date--warn { color: var(--warn); }
.due-date--late { color: var(--err); }

/* ── Tabla de datos (listas) ────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td {
  background: var(--bg-hover);
  cursor: pointer;
}

.data-table td.mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* ── Notificaciones / Toasts ────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: 1000;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  color: var(--text-primary);
  pointer-events: all;
  animation: slideIn var(--t-base) ease;
  max-width: 360px;
}

.toast--ok   { border-left: 3px solid var(--ok); }
.toast--warn { border-left: 3px solid var(--warn); }
.toast--err  { border-left: 3px solid var(--err); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 26, 0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  animation: fadeIn 150ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 150ms ease;
}

@keyframes modalIn {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
}

.modal__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.modal__footer {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-10) var(--sp-5);
  text-align: center;
  gap: var(--sp-3);
}

.empty-state__icon {
  font-size: 32px;
  opacity: 0.3;
}

.empty-state__title {
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--text-secondary);
}

.empty-state__sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 280px;
}

/* ── Loader ─────────────────────────────────────────────────── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  flex-shrink: 0;
}

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

/* ── Número de trabajo ──────────────────────────────────────── */
.job-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(43,101,255,0.2);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* ── Steps de proceso ───────────────────────────────────────── */
.steps {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.step__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--border-focus);
  flex-shrink: 0;
  transition: background var(--t-base), border-color var(--t-base);
}

.step--done .step__dot {
  background: var(--ok);
  border-color: var(--ok);
}
.step--active .step__dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}
.step--done   { color: var(--text-secondary); }
.step--active { color: var(--text-primary); font-weight: 500; }

/* ── Dropdown ───────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: var(--bg-card-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
  animation: fadeIn 100ms ease;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.dropdown__item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.dropdown__item--danger:hover {
  background: var(--err-bg);
  color: var(--err);
}
.dropdown__divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Utilidades generales ───────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1        { gap: var(--sp-1); }
.gap-2        { gap: var(--sp-2); }
.gap-3        { gap: var(--sp-3); }
.gap-4        { gap: var(--sp-4); }
.mt-1         { margin-top: var(--sp-1); }
.mt-2         { margin-top: var(--sp-2); }
.mt-3         { margin-top: var(--sp-3); }
.mt-4         { margin-top: var(--sp-4); }
.hidden       { display: none !important; }
.w-full       { width: 100%; }

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
}
.user-dropdown.hidden { display: none; }
.user-dropdown__item {
  display: block;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast);
}
.user-dropdown__item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.user-dropdown__item--danger { color: var(--err); }
.user-dropdown__item--danger:hover { background: var(--err-bg); }
.user-dropdown__divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-1) 0;
}
 
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-lg);
}
.modal__title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-4);
}