/* Utilidades Luis López — estilos comunes. Toma la tipografía del tema. */
.llu {
	--llu-bg: #ffffff;
	--llu-surface: #f4f5f7;
	--llu-text: #1a202c;
	--llu-muted: #4f5866;
	--llu-border: #d5d9e0;
	--llu-primary: #1e3a5f;
	--llu-primary-text: #ffffff;
	--llu-focus: #2f6fd1;
	--llu-ok-bg: #e5f3ea; --llu-ok: #1d5e33;
	--llu-warn-bg: #fdf1d8; --llu-warn: #7a4d00;
	--llu-ko-bg: #fbe6e4; --llu-ko: #9b1c13;
	--llu-radius: 10px;
	position: relative;
	max-width: 760px;
	margin: 1.5rem auto;
	color: var(--llu-text);
	font: inherit;
	line-height: 1.5;
}
.llu[data-theme="dark"] {
	--llu-bg: #182233;
	--llu-surface: #111a28;
	--llu-text: #e8edf4;
	--llu-muted: #a9b6c7;
	--llu-border: #34445c;
	--llu-primary: #f2b544;
	--llu-primary-text: #14294a;
	--llu-focus: #8db8ff;
	--llu-ok-bg: #173826; --llu-ok: #9de0b4;
	--llu-warn-bg: #3d2f10; --llu-warn: #f5d38b;
	--llu-ko-bg: #42201d; --llu-ko: #f6b3ac;
}
.llu *, .llu *::before, .llu *::after { box-sizing: border-box; }
.llu [hidden] { display: none !important; }
.llu-card { background: var(--llu-bg); border: 1px solid var(--llu-border); border-radius: 14px; padding: clamp(1.25rem, 4vw, 2rem); display: flex; flex-direction: column; gap: 1.25rem; }
.llu-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.llu-title { margin: 0; font-size: clamp(1.25rem, 3vw, 1.5rem); line-height: 1.25; color: var(--llu-text); }
.llu-subtitle { margin: 0; font-size: 1.05rem; }
.llu-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.llu-mono { font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace; letter-spacing: 0.02em; }

/* Formularios */
.llu-form, .llu-panel { display: flex; flex-direction: column; gap: 1rem; }
.llu-fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.llu-legend { padding: 0; margin-bottom: 0.25rem; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--llu-muted); }
.llu-field { display: flex; flex-direction: column; gap: 0.35rem; }
.llu-field label { font-weight: 600; font-size: 0.95rem; }
.llu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.llu-input, .llu-output-field { width: 100%; min-height: 46px; padding: 0.6rem 0.8rem; font: inherit; font-size: 1rem; color: var(--llu-text); background: var(--llu-bg); border: 1px solid var(--llu-border); border-radius: 8px; }
select.llu-input { appearance: auto; }
.llu-input[aria-invalid="true"] { border-color: var(--llu-ko); }
.llu-help { margin: 0; font-size: 0.875rem; color: var(--llu-muted); }
.llu-error { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--llu-ko); }

/* Botones */
.llu-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 46px; padding: 0.65rem 1.4rem; font: inherit; font-weight: 600; font-size: 1rem; border-radius: 8px; border: 1px solid transparent; cursor: pointer; text-decoration: none; }
.llu-btn-primary { background: var(--llu-primary); color: var(--llu-primary-text); align-self: flex-start; }
.llu-btn-primary:hover { filter: brightness(1.12); }
.llu-btn-ghost { background: transparent; color: var(--llu-text); border-color: var(--llu-border); min-height: 40px; padding: 0.4rem 0.9rem; font-size: 0.9rem; }
.llu-btn-ghost:hover { background: var(--llu-surface); }
.llu-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; flex: 0 0 auto; background: var(--llu-surface); color: var(--llu-text); border: 1px solid var(--llu-border); border-radius: 8px; cursor: pointer; }
.llu-icon-btn:hover { border-color: var(--llu-primary); }
.llu .llu-icon-btn svg { width: 20px; height: 20px; fill: none !important; stroke: currentColor !important; stroke-width: 1.75 !important; }
.llu-icon-sm { width: 36px; height: 36px; }
.llu svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.llu :focus-visible { outline: 3px solid var(--llu-focus); outline-offset: 2px; }

/* Modo claro / oscuro */
.llu-theme { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--llu-border); background: var(--llu-surface); color: var(--llu-text); cursor: pointer; }
.llu .llu-ico-moon { display: none; }
.llu[data-theme="dark"] .llu-ico-moon { display: block; }
.llu[data-theme="dark"] .llu-ico-sun { display: none; }

/* Resultados */
.llu-result { text-align: center; background: var(--llu-surface); border-radius: var(--llu-radius); padding: 1.5rem 1rem; }
.llu-result-label { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--llu-muted); }
.llu-result-value { margin: 0.25rem 0 0.75rem; font-size: clamp(2.5rem, 8vw, 3.5rem); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.llu-badge { display: inline-block; margin: 0; padding: 0.35rem 0.9rem; border-radius: 999px; font-weight: 700; font-size: 0.9rem; }
.llu-badge-ok { background: var(--llu-ok-bg); color: var(--llu-ok); }
.llu-badge-warn { background: var(--llu-warn-bg); color: var(--llu-warn); }
.llu-badge-ko { background: var(--llu-ko-bg); color: var(--llu-ko); }
.llu-out:empty { display: none; }
.llu-box { display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem 1.1rem; border-radius: var(--llu-radius); border: 1px solid var(--llu-border); background: var(--llu-surface); }
.llu-box-title { margin: 0; font-weight: 700; }
.llu-box .llu-btn { align-self: flex-start; }
.llu-box-ok .llu-box-title { color: var(--llu-ok); }
.llu-box-ko { background: var(--llu-ko-bg); border-color: transparent; }
.llu-box-ko .llu-box-title { color: var(--llu-ko); }
.llu-kv { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.llu-kv-k { flex: 0 0 9.5rem; color: var(--llu-muted); font-size: 0.9rem; }
.llu-kv-v { flex: 1 1 12rem; font-weight: 600; font-size: 1.05rem; word-break: break-all; }

/* Pestañas */
.llu-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.25rem; background: var(--llu-surface); border-radius: var(--llu-radius); }
.llu-tab { flex: 1 1 auto; min-height: 44px; padding: 0.5rem 0.9rem; font: inherit; font-weight: 600; font-size: 0.95rem; color: var(--llu-muted); background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.llu-tab[aria-selected="true"] { background: var(--llu-bg); color: var(--llu-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

/* Generados e historial */
.llu-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.llu-chip { min-height: 40px; padding: 0.4rem 0.8rem; font-size: 0.95rem; background: var(--llu-bg); color: var(--llu-text); border: 1px solid var(--llu-border); border-radius: 8px; cursor: pointer; }
.llu-chip:hover { border-color: var(--llu-primary); }
.llu-history { display: flex; flex-direction: column; gap: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--llu-border); }
.llu-history-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.llu-count { font-weight: 400; font-size: 0.85rem; color: var(--llu-muted); }
.llu-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.llu-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--llu-border); border-radius: 8px; }
.llu-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.llu-table th, .llu-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--llu-border); }
.llu-table th { position: sticky; top: 0; background: var(--llu-surface); }

/* Generador */
.llu-output { display: flex; gap: 0.5rem; }
.llu-output-field { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 1.15rem; font-weight: 600; }
.llu-strength { display: flex; align-items: center; gap: 0.75rem; }
.llu-strength-bar { flex: 1; height: 8px; background: var(--llu-surface); border-radius: 999px; overflow: hidden; }
.llu-strength-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--llu-ko); transition: width 0.25s; }
.llu-strength-bar span[data-level="2"] { background: #c97a00; }
.llu-strength-bar span[data-level="3"] { background: #2f8a4e; }
.llu-strength-bar span[data-level="4"] { background: #1d5e33; }
.llu-strength-text { min-width: 6rem; font-size: 0.9rem; font-weight: 600; text-align: right; }
.llu-range { width: 100%; accent-color: var(--llu-primary); min-height: 32px; }
.llu-checks { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 1.25rem; }
@media (max-width: 480px) { .llu-checks { grid-template-columns: 1fr; } }
.llu-check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; cursor: pointer; }
.llu-check input { width: 20px; height: 20px; accent-color: var(--llu-primary); }

/* Aviso flotante */
.llu-toast { position: absolute; left: 50%; bottom: 1rem; transform: translate(-50%, 1rem); max-width: calc(100% - 2rem); padding: 0.6rem 1rem; background: var(--llu-text); color: var(--llu-bg); border-radius: 8px; font-size: 0.9rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.llu-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
	.llu-toast, .llu-strength-bar span { transition: none; }
}

/* ===== Conversor de puntuaciones ===== */
.llu-conversor { max-width: 1000px; container-type: inline-size; }
.llu-block.alignwide .llu, .llu-block.alignfull .llu { max-width: none; }
.llu-cn-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; align-items: start; }
.llu-cn-inputs { display: flex; flex-direction: column; gap: 1.25rem; }
.llu-cn-step { border: 1px solid var(--llu-border); border-radius: var(--llu-radius); margin: 0; padding: 1rem 1.1rem 1.15rem; }
.llu-cn-step-title { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.35rem; font-weight: 700; font-size: 0.95rem; }
.llu-cn-num { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--llu-primary); color: var(--llu-primary-text); font-size: 0.85rem; }
.llu-cn-grid { display: grid; grid-template-columns: 1fr; gap: 0.9rem 1rem; }
.llu-cn-field label { font-size: 0.9rem; }
.llu-label-row { display: flex; align-items: center; gap: 0.4rem; }
.llu-affix { position: relative; }
.llu-affix .llu-input { padding-right: 4.2rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.llu-affix-unit { position: absolute; right: 0.8rem; top: 50%; transform: translateY(-50%); font-size: 0.85rem; color: var(--llu-muted); pointer-events: none; }
.llu-cn-inputs .llu-btn-ghost { align-self: flex-start; }

/* Tooltips */
.llu-tip { position: relative; display: inline-flex; }
.llu-tip-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid var(--llu-border); background: var(--llu-surface); color: var(--llu-muted); font: 700 0.75rem/1 Georgia, serif; font-style: italic; cursor: pointer; }
.llu-tip-btn::before { content: ""; position: absolute; inset: -10px; }
.llu-tip-text { position: absolute; z-index: 10; left: -10px; bottom: calc(100% + 10px); width: max-content; max-width: min(260px, 78vw); padding: 0.6rem 0.75rem; border-radius: 8px; background: var(--llu-text); color: var(--llu-bg); font-size: 0.85rem; font-weight: 400; line-height: 1.4; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); display: none; }
.llu-tip-text::after { content: ""; position: absolute; top: 100%; left: 16px; border: 6px solid transparent; border-top-color: var(--llu-text); }
.llu-tip:hover .llu-tip-text, .llu-tip:focus-within .llu-tip-text, .llu-tip.is-open .llu-tip-text { display: block; }

/* Panel de resultado */
.llu-cn-result { min-height: 12rem; display: flex; flex-direction: column; justify-content: center; padding: 1.5rem; border-radius: var(--llu-radius); background: var(--llu-surface); }
.llu-cn-empty { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; text-align: center; color: var(--llu-muted); }
.llu-cn-empty svg { width: 40px; height: 40px; stroke-width: 1.5; }
.llu-cn-empty p { margin: 0; max-width: 18rem; }
.llu-cn-score { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }
.llu-cn-value { margin: 0; font-size: clamp(2.75rem, 7vw, 3.75rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.llu-cn-of { font-size: 0.4em; font-weight: 600; color: var(--llu-muted); }
.llu-cn-scale { width: 100%; margin-top: 0.75rem; }
.llu-cn-track { position: relative; height: 12px; border-radius: 999px; background: var(--llu-border); }
.llu-cn-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit; background: var(--llu-ko); transition: width 0.45s cubic-bezier(.2,.7,.2,1); }
.llu-cn-score[data-level="ok"] .llu-cn-fill { background: #2f8a4e; }
.llu-cn-score[data-level="warn"] .llu-cn-fill { background: #c97a00; }
.llu-cn-cut { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--llu-text); }
.llu-cn-ticks { position: relative; height: 1.4rem; margin-top: 0.35rem; font-size: 0.8rem; color: var(--llu-muted); }
.llu-cn-ticks span { position: absolute; top: 0; white-space: nowrap; }
.llu-cn-ticks span:first-child { left: 0; }
.llu-cn-ticks span:last-child { right: 0; }
.llu-cn-ticks [data-cut-label] { transform: translateX(-50%); font-weight: 600; color: var(--llu-text); }
.llu-cn-facts { width: 100%; margin: 0.5rem 0 0; padding-top: 0.75rem; border-top: 1px solid var(--llu-border); display: grid; gap: 0.5rem; text-align: left; font-size: 0.9rem; }
.llu-cn-facts div { display: flex; justify-content: space-between; gap: 1rem; }
.llu-cn-facts dt { color: var(--llu-muted); }
.llu-cn-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

/* Se adapta al ancho del hueco donde está el conversor, no al de la pantalla. */
@container (min-width: 480px) {
	.llu-cn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (min-width: 860px) {
	.llu-cn-layout { grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); }
	.llu-cn-result { position: sticky; top: 1.5rem; min-height: 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.llu-cn-fill { transition: none; }
}
