/* PHN kit-temas: estilos del selector de tema (PHNTema.montarSelector). Solo usa tokens --phn-*. */

.phn-sel { container: phn-sel / inline-size; color: var(--phn-text); font-family: var(--phn-font, system-ui, sans-serif); }
.phn-sel *, .phn-sel *::before, .phn-sel *::after { box-sizing: border-box; }
.phn-sel-cols { display: grid; gap: calc(24px * var(--phn-space, 1)); grid-template-columns: minmax(0, 1fr); }
@container phn-sel (min-width: 640px) { .phn-sel-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: calc(32px * var(--phn-space, 1)); } }
.phn-sel-col { display: flex; flex-direction: column; gap: calc(22px * var(--phn-space, 1)); min-width: 0; }
.phn-sel-set { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.phn-sel-legend { padding: 0; font-size: .8125rem; font-weight: 600; color: var(--phn-text-2); margin-bottom: 2px; }
.phn-sel-h { margin: 0; font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }

/* Modo: segmentado */
.phn-sel-seg { display: flex; gap: 2px; padding: 3px; border-radius: calc(var(--phn-radius-field) + 3px); background: var(--phn-neutral-bg); }
.phn-sel-seg button {
  flex: 1 1 0; min-width: 0; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px;
  border: 0; border-radius: var(--phn-radius-field); background: transparent; color: var(--phn-neutral-fg); font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer;
}
.phn-sel-seg button svg { width: 18px; height: 18px; flex: none; }
.phn-sel-seg button[aria-pressed="true"] { background: var(--phn-surface); color: var(--phn-text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 0 0 1px var(--phn-border); }

/* Rejilla de temas */
.phn-sel-temas { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 124px), 1fr)); }
.phn-sel-tema {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 10px; min-height: 44px; text-align: left;
  border: 2px solid var(--phn-border); border-radius: var(--phn-radius-field); background: var(--phn-surface); color: var(--phn-text); font: inherit; cursor: pointer;
}
.phn-sel-tema:hover { border-color: var(--phn-border-strong); }
.phn-sel-tema[aria-pressed="true"] { border-color: var(--phn-accent-text); background: var(--phn-accent-soft); }
.phn-sel-tema-nombre { font-size: .875rem; font-weight: 600; line-height: 1.2; padding: 0 2px; }
.phn-sel-tema-nota { display: block; font-size: .75rem; font-weight: 400; line-height: 1.25; color: var(--phn-text-2); padding: 0 2px; }
.phn-sel-tema[aria-pressed="true"] .phn-sel-tema-nota { color: var(--phn-accent-soft-text); }
.phn-sel-check { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; display: none; place-items: center; border-radius: 50%; background: var(--phn-accent-text); color: var(--phn-surface); }
.phn-sel-check svg { width: 13px; height: 13px; }
.phn-sel-tema[aria-pressed="true"] .phn-sel-check { display: grid; }
.phn-sel-muestra { position: relative; display: block; height: 48px; border-radius: calc(var(--phn-radius-field) - 4px); background: var(--phn-bg); border: 1px solid var(--phn-border-strong); overflow: hidden; }
.phn-sel-muestra::before { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; top: 14px; border-radius: 8px 8px 0 0; background: var(--phn-surface); }
.phn-sel-muestra::after { content: ""; position: absolute; left: 14px; top: 20px; width: 26px; height: 9px; border-radius: 999px; background: var(--phn-accent); }
.phn-sel-muestra i { position: absolute; display: block; border-radius: 999px; }
.phn-sel-muestra i:nth-child(1) { right: 14px; top: 20px; width: 16px; height: 9px; background: var(--phn-chart-muted); }
.phn-sel-muestra i:nth-child(2) { left: 14px; top: 34px; width: 54%; height: 6px; background: var(--phn-border); }
.phn-sel-muestra i:nth-child(3) { left: 8px; top: 4px; width: 16px; height: 8px; background: var(--phn-accent-text); }

/* Personalizado */
.phn-sel-fila { display: flex; align-items: center; gap: 10px; }
.phn-sel-color { flex: none; width: 56px; height: 44px; padding: 4px; border: 1px solid var(--phn-border-strong); border-radius: var(--phn-radius-field); background: var(--phn-surface-2); cursor: pointer; }
.phn-sel-hex {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 14px; border: 1px solid var(--phn-border-strong); border-radius: var(--phn-radius-field);
  background: var(--phn-surface-2); color: var(--phn-text); font: inherit; font-family: var(--phn-font-mono, ui-monospace, monospace); font-size: 1rem; text-transform: uppercase;
}
.phn-sel-hex[aria-invalid="true"] { border-color: var(--phn-danger-fg); background: var(--phn-danger-bg); }
.phn-sel-campo { display: flex; flex-direction: column; gap: 2px; }
.phn-sel-campo-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.phn-sel-campo label, .phn-sel-campo .phn-sel-etq { font-size: .875rem; font-weight: 500; }
.phn-sel-valor { font-size: .8125rem; color: var(--phn-text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.phn-sel input[type="range"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; }
.phn-sel input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--phn-border-strong); }
.phn-sel input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--phn-border-strong); }
.phn-sel input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--phn-accent); border: 3px solid var(--phn-surface); box-shadow: 0 0 0 2px var(--phn-text-2); }
.phn-sel input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--phn-accent); border: 3px solid var(--phn-surface); box-shadow: 0 0 0 2px var(--phn-text-2); }
.phn-sel input[type="range"]:disabled { opacity: .45; cursor: not-allowed; }
.phn-sel-tono { display: flex; align-items: center; gap: 12px; }
.phn-sel-tono-m { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--phn-border-strong); }
.phn-sel-check-fila { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-size: .875rem; font-weight: 500; }
.phn-sel-check-fila input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--phn-accent); cursor: pointer; }

/* Contraste */
.phn-sel-contraste { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.phn-sel-contraste li { display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: .8125rem; }
.phn-sel-contraste li > span:first-child { flex: 1; min-width: 0; color: var(--phn-text-2); }
.phn-sel-ratio { font-weight: 700; font-variant-numeric: tabular-nums; }
.phn-sel-nivel { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 1px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--phn-ok-bg); color: var(--phn-ok-fg); }
.phn-sel-nivel svg { width: 13px; height: 13px; }
.phn-sel-nivel[data-nivel="bajo"] { background: var(--phn-danger-bg); color: var(--phn-danger-fg); }
.phn-sel-aviso { margin: 0; min-height: 0; font-size: .8125rem; line-height: 1.45; color: var(--phn-warn-fg); background: var(--phn-warn-bg); border-radius: 12px; padding: 0; }
.phn-sel-aviso:not(:empty) { padding: 10px 12px; }

/* Vista previa */
.phn-sel-prev { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--phn-radius-card); background: var(--phn-bg); border: 1px solid var(--phn-border); }
.phn-sel-prev-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: calc(var(--phn-radius-card) - 6px); background: var(--phn-surface); box-shadow: var(--phn-shadow-card); }
.phn-sel-prev-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.phn-sel-prev-t { font-size: .9375rem; font-weight: 600; }
.phn-sel-prev-n { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.phn-sel-prev-bar { height: 8px; border-radius: 999px; background: var(--phn-chart-muted); overflow: hidden; }
.phn-sel-prev-bar span { display: block; width: 68%; height: 100%; background: var(--phn-chart-1); border-radius: inherit; }
.phn-sel-prev-bar.b2 span { width: 42%; background: var(--phn-chart-2); }
.phn-sel-prev-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.phn-sel-prev-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 11px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.phn-sel-prev-chip.ok { background: var(--phn-ok-bg); color: var(--phn-ok-fg); }
.phn-sel-prev-chip.w { background: var(--phn-warn-bg); color: var(--phn-warn-fg); }
.phn-sel-prev-chip.ac { background: var(--phn-accent-soft); color: var(--phn-accent-soft-text); }

/* Acciones */
.phn-sel-acciones { display: flex; flex-wrap: wrap; gap: 10px; }
.phn-sel-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 16px;
  border: 1px solid var(--phn-border-strong); border-radius: var(--phn-radius-field); background: var(--phn-surface); color: var(--phn-text); font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer;
}
.phn-sel-btn svg { width: 18px; height: 18px; flex: none; }
.phn-sel-btn:hover { background: var(--phn-surface-2); }
.phn-sel-btn-prim { background: var(--phn-accent); color: var(--phn-on-accent); border-color: transparent; font-weight: 600; }
.phn-sel-btn-prim:hover { background: var(--phn-accent); filter: brightness(.94); }
.phn-sel-estado { margin: 0; min-height: 1.3em; font-size: .8125rem; color: var(--phn-text-2); }
.phn-sel-estado[data-tipo="error"] { color: var(--phn-danger-fg); font-weight: 500; }
.phn-sel-estado[data-tipo="ok"] { color: var(--phn-ok-fg); font-weight: 500; }
.phn-sel-estado[data-tipo="error"]:empty { display: none; }
.phn-sel details { border-radius: var(--phn-radius-field); }
.phn-sel summary { display: flex; align-items: center; min-height: 44px; font-size: .875rem; font-weight: 500; color: var(--phn-accent-text); cursor: pointer; }
.phn-sel-texto {
  display: block; width: 100%; min-height: 96px; padding: 10px 14px; border: 1px solid var(--phn-border-strong); border-radius: var(--phn-radius-field);
  background: var(--phn-surface-2); color: var(--phn-text); font-family: var(--phn-font-mono, ui-monospace, monospace); font-size: .875rem; resize: vertical; margin-bottom: 10px;
}
.phn-sel-texto::placeholder, .phn-sel-hex::placeholder { color: var(--phn-text-3); opacity: 1; }
.phn-sel :focus-visible { outline: 3px solid var(--phn-focus); outline-offset: 2px; }
.phn-sel-tema:focus-visible { outline-offset: 1px; }
.phn-sel-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); opacity: 0; }
