/* Póster por Hojas — estilos (todo bajo .pph-app para no chocar con el tema) */

.pph-app {
	--pph-bg: #ffffff;
	--pph-fg: #0f172a;
	--pph-muted: #64748b;
	--pph-line: #e2e8f0;
	--pph-soft: #f8fafc;
	--pph-accent: #2563eb;
	--pph-accent-d: #1d4ed8;
	--pph-ok: #15803d;
	--pph-warn: #b45309;
	--pph-bad: #b91c1c;
	container-type: inline-size;
	max-width: 1280px;
	margin: 0 auto;
	padding: 4px 0 24px;
	color: var(--pph-fg);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	text-align: left;
}
.pph-app *,
.pph-app *::before,
.pph-app *::after { box-sizing: border-box; }
.pph-app [hidden] { display: none !important; }
.pph-app .pph-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0; border: 0;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Cabecera */
.pph-app .pph-head { margin: 0 0 14px; }
.pph-app .pph-title { margin: 0 0 4px; font-size: 1.6em; line-height: 1.2; color: var(--pph-fg); }
.pph-app .pph-sub { margin: 0; color: var(--pph-muted); max-width: 70ch; }

/* Distribución */
.pph-app .pph-layout { display: grid; gap: 16px; }
@container (min-width: 860px) {
	.pph-app .pph-layout { grid-template-columns: 370px minmax(0, 1fr); align-items: start; }
	.pph-app .pph-preview { position: sticky; top: 12px; }
}
.pph-app .pph-panel {
	background: var(--pph-bg);
	border: 1px solid var(--pph-line);
	border-radius: 14px;
	padding: 16px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
	min-width: 0;
}

/* Secciones del panel */
.pph-app .pph-sec { padding: 0 0 14px; margin: 0 0 14px; border-bottom: 1px solid var(--pph-line); }
.pph-app .pph-sec:last-of-type { border-bottom: 0; margin-bottom: 4px; }
.pph-app .pph-sec h3 {
	margin: 0 0 10px; padding: 0;
	font-size: 0.78em; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
	color: var(--pph-muted);
}
.pph-app .pph-f { display: block; margin: 0 0 10px; }
.pph-app .pph-f > span { display: block; margin: 0 0 4px; font-size: 0.86em; color: var(--pph-fg); font-weight: 600; }
.pph-app .pph-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.pph-app .pph-hint { margin: 2px 0 0; font-size: 0.82em; color: var(--pph-muted); }

.pph-app .pph-in {
	display: block; width: 100%; min-height: 38px;
	margin: 0; padding: 7px 10px;
	font: inherit; font-size: 14px; line-height: 1.3;
	color: var(--pph-fg); background: #fff;
	border: 1px solid #cbd5e1; border-radius: 8px;
	box-shadow: none;
}
.pph-app .pph-in:focus,
.pph-app .pph-seg button:focus-visible,
.pph-app .pph-go:focus-visible,
.pph-app .pph-ico:focus-visible,
.pph-app .pph-link:focus-visible {
	outline: 2px solid var(--pph-accent); outline-offset: 2px;
}
.pph-app .pph-in:disabled { background: var(--pph-soft); color: var(--pph-muted); }
.pph-app .pph-color { display: block; width: 56px; height: 36px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; cursor: pointer; }
.pph-app input[type="range"] { width: 100%; accent-color: var(--pph-accent); }
.pph-app .pph-chk { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; font-size: 0.92em; cursor: pointer; }
.pph-app .pph-chk input { margin-top: 3px; accent-color: var(--pph-accent); flex: none; }
.pph-app .pph-chk-bottom { margin-bottom: 18px; }

/* Control segmentado */
.pph-app .pph-seg { display: flex; border: 1px solid #cbd5e1; border-radius: 9px; overflow: hidden; background: #fff; margin: 0 0 10px; }
.pph-app .pph-seg button {
	flex: 1 1 0; margin: 0; padding: 8px 6px; min-height: 38px;
	font: inherit; font-size: 13px; line-height: 1.2; text-align: center;
	color: var(--pph-fg); background: #fff; border: 0; border-right: 1px solid #e2e8f0; border-radius: 0;
	cursor: pointer; box-shadow: none; text-transform: none; letter-spacing: 0;
}
.pph-app .pph-seg button:last-child { border-right: 0; }
.pph-app .pph-seg button[aria-pressed="true"] { background: var(--pph-accent); color: #fff; font-weight: 600; }
.pph-app .pph-seg button[aria-pressed="false"]:hover { background: var(--pph-soft); }

/* Zona de carga */
.pph-app .pph-drop {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
	margin: 0; padding: 22px 12px; text-align: center; cursor: pointer;
	color: var(--pph-muted); background: var(--pph-soft);
	border: 2px dashed #cbd5e1; border-radius: 12px;
	transition: border-color .15s, background .15s;
}
.pph-app .pph-drop strong { color: var(--pph-fg); font-size: 0.95em; }
.pph-app .pph-drop small { font-size: 0.82em; }
.pph-app .pph-drop:hover,
.pph-app .pph-drop:focus-within,
.pph-app .pph-drop.pph-drop-over { border-color: var(--pph-accent); background: #eff6ff; }
.pph-app .pph-drop.pph-drop-small { padding: 10px 12px; flex-direction: row; justify-content: center; }
.pph-app .pph-drop.pph-drop-small .pph-drop-ico { width: 20px; height: 20px; }
.pph-app .pph-drop.pph-drop-small small { display: none; }
.pph-app .pph-file { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 0.88em; }
.pph-app .pph-file-txt { min-width: 0; display: flex; flex-direction: column; }
.pph-app .pph-file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pph-app .pph-file-meta { color: var(--pph-muted); }
.pph-app .pph-link { flex: none; padding: 4px 6px; font: inherit; font-size: 0.95em; color: var(--pph-accent); background: none; border: 0; cursor: pointer; text-decoration: underline; box-shadow: none; }

/* Botón principal y avisos */
.pph-app .pph-actions { margin-top: 4px; }
.pph-app .pph-go {
	display: block; width: 100%; margin: 0; padding: 12px 14px; min-height: 46px;
	font: inherit; font-size: 15px; font-weight: 700; line-height: 1.2; text-align: center; text-transform: none; letter-spacing: 0;
	color: #fff; background: var(--pph-accent); border: 0; border-radius: 10px; cursor: pointer; box-shadow: none;
}
.pph-app .pph-go:hover:not(:disabled) { background: var(--pph-accent-d); }
.pph-app .pph-go:disabled { background: #94a3b8; cursor: not-allowed; }
.pph-app .pph-progress { margin-top: 12px; }
.pph-app .pph-bar { height: 8px; background: var(--pph-line); border-radius: 99px; overflow: hidden; }
.pph-app .pph-bar span { display: block; height: 100%; width: 0; background: var(--pph-accent); transition: width .2s; }
.pph-app .pph-ptext { margin: 6px 0 0; font-size: 0.85em; color: var(--pph-muted); }
.pph-app .pph-msg { margin: 12px 0 0; padding: 10px 12px; font-size: 0.9em; border-radius: 8px; background: var(--pph-soft); border: 1px solid var(--pph-line); }
.pph-app .pph-msg-ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.pph-app .pph-msg-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.pph-app .pph-msg-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* Vista previa */
.pph-app .pph-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; min-height: 4px; }
.pph-app .pph-chip { display: inline-block; padding: 4px 10px; font-size: 0.82em; color: var(--pph-fg); background: var(--pph-soft); border: 1px solid var(--pph-line); border-radius: 99px; }
.pph-app .pph-chip-ok { color: var(--pph-ok); background: #f0fdf4; border-color: #bbf7d0; }
.pph-app .pph-chip-warn { color: var(--pph-warn); background: #fffbeb; border-color: #fde68a; }
.pph-app .pph-chip-bad { color: var(--pph-bad); background: #fef2f2; border-color: #fecaca; }
.pph-app .pph-notes { margin: 0 0 10px; padding: 0 0 0 18px; font-size: 0.85em; color: var(--pph-warn); }
.pph-app .pph-tabs { max-width: 360px; }

.pph-app .pph-stage {
	display: flex; justify-content: center; align-items: flex-start;
	min-height: 220px; padding: 10px; overflow: auto;
	background-color: #e5e9f0;
	background-image: linear-gradient(45deg, #dde2ea 25%, transparent 25%, transparent 75%, #dde2ea 75%), linear-gradient(45deg, #dde2ea 25%, transparent 25%, transparent 75%, #dde2ea 75%);
	background-size: 20px 20px; background-position: 0 0, 10px 10px;
	border: 1px solid var(--pph-line); border-radius: 10px;
}
.pph-app .pph-overview { display: block; max-width: none; background: #fff; box-shadow: 0 4px 18px rgba(15, 23, 42, 0.18); }
.pph-app .pph-empty { align-self: center; margin: 40px 12px; text-align: center; color: var(--pph-muted); background: rgba(255, 255, 255, 0.85); padding: 10px 14px; border-radius: 8px; }
.pph-app .pph-sheets > .pph-empty { background: var(--pph-soft); }

.pph-app .pph-sheets { padding: 10px; overflow: auto; max-height: 80vh; background: var(--pph-soft); border: 1px solid var(--pph-line); border-radius: 10px; }
.pph-app .pph-sheetgrid { display: grid; gap: 10px; grid-template-columns: repeat(var(--pph-cols, 2), minmax(84px, 1fr)); }
.pph-app .pph-thumb { margin: 0; padding: 6px; background: #fff; border: 1px solid var(--pph-line); border-radius: 8px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08); }
.pph-app .pph-thumb-cv { display: block; width: 100%; height: auto; border: 1px solid #cbd5e1; background: #fff; }
.pph-app .pph-thumb figcaption { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: 0.85em; }
.pph-app .pph-ico { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: 0; padding: 0; color: var(--pph-accent); background: #fff; border: 1px solid var(--pph-line); border-radius: 6px; cursor: pointer; box-shadow: none; }
.pph-app .pph-ico:hover { background: #eff6ff; border-color: var(--pph-accent); }
.pph-app.pph-busy .pph-ico { opacity: 0.4; pointer-events: none; }

.pph-app .pph-help { margin-top: 14px; font-size: 0.9em; }
.pph-app .pph-help summary { cursor: pointer; font-weight: 600; }
.pph-app .pph-help ol { margin: 8px 0 0; padding-left: 20px; }
.pph-app .pph-help li { margin: 0 0 4px; }

@media (prefers-reduced-motion: reduce) {
	.pph-app * { transition: none !important; }
}
