/* =====================================================================================================
   Formularios estilo app (Contable; el punto de venta usa pdv.css y no se toca). Clases opcionales: una pantalla
   las usa solo si las pide, así que lo demás no cambia hasta que se migre.
   · .pagina-titulo  encabezado grande de la pantalla (regreso, título, estado y acciones)
   · .fs             sección del formulario: encabezado con ícono, título y explicación; cuerpo en cuadrícula
   · .campo          etiqueta + control + .campo-ayuda (la ayuda ya no desacomoda la fila)
   · .afijo          campo con prefijo o sufijo ($, %, días)
   · .opcion         interruptor (sí/no) con su explicación, en lugar de la casilla chiquita
   · .barra-acciones barra fija abajo con el total y los botones (Guardar siempre a la vista)
   ===================================================================================================== */
.pagina-titulo { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .8rem 1.2rem; margin: .4rem 0 1.4rem; }
.pagina-titulo .regreso { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .35rem; }
.pagina-titulo .regreso:hover { color: var(--brand); text-decoration: none; }
.pagina-titulo h1 { font-size: 1.75rem; line-height: 1.15; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.pagina-titulo h1 .folio { font-family: "Inter", sans-serif; font-size: .95rem; font-weight: 600; color: var(--muted-2); }
.pagina-titulo .sub { color: var(--muted); font-size: .92rem; margin-top: .3rem; }
.pagina-titulo .acciones { display: flex; flex-wrap: wrap; gap: .45rem; }
.pagina-titulo .acciones .btn { border-radius: 12px; }

.fs { background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
	box-shadow: 0 1px 2px rgba(23, 32, 28, .04), 0 6px 20px rgba(23, 32, 28, .05); margin-bottom: 1.1rem; overflow: hidden; }
.fs-cabeza { display: flex; align-items: center; gap: .85rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border);
	background: linear-gradient(180deg, #fbfcfa, var(--surface)); }
.fs-icono { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-light); color: var(--brand); }
.fs-icono svg { width: 22px; height: 22px; }
.fs-cabeza h2 { margin: 0; font-size: 1.05rem; }
.fs-cabeza p { margin: .1rem 0 0; color: var(--muted); font-size: .86rem; }
.fs-cabeza .derecha { margin-left: auto; }
.fs-cuerpo { padding: 1.3rem 1.4rem 1.4rem; }
.fs-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.1rem 1rem; align-items: start; }
.fs-grid > .c-2 { grid-column: span 2; }
.fs-grid > .c-3 { grid-column: span 3; }
.fs-grid > .c-4 { grid-column: span 4; }
.fs-grid > .c-5 { grid-column: span 5; }
.fs-grid > .c-6 { grid-column: span 6; }
.fs-grid > .c-8 { grid-column: span 8; }
.fs-grid > .c-12 { grid-column: 1 / -1; }
@media (max-width: 760px) {
	.fs-grid > [class*="c-"] { grid-column: 1 / -1; }
	.fs-cabeza, .fs-cuerpo { padding-left: 1rem; padding-right: 1rem; }
	.pagina-titulo h1 { font-size: 1.4rem; }
}

.campo { display: flex; flex-direction: column; gap: .4rem; margin: 0; min-width: 0; }
.campo > .etiqueta { font-size: .84rem; font-weight: 600; color: var(--ink); }
.campo > .etiqueta .req { color: var(--danger); margin-left: .15rem; }
.campo > .campo-ayuda { display: block; font-size: .78rem; color: var(--muted); line-height: 1.35; }
.campo > .error-campo { font-size: .8rem; color: var(--danger); font-weight: 600; }
.fs input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .fs select, .fs textarea {
	margin: 0; min-height: 46px; padding: .65rem .85rem; border-radius: 12px; border: 1.5px solid transparent;
	background: #f3f6f2; font-size: .95rem; transition: background .15s, border-color .15s, box-shadow .15s; }
.fs textarea { min-height: 5.5rem; }
.fs input:hover:not(:disabled):not(:focus), .fs select:hover:not(:disabled):not(:focus), .fs textarea:hover:not(:disabled):not(:focus) { border-color: var(--border-strong); }
.fs input:focus, .fs select:focus, .fs textarea:focus { background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-light); }
.fs input:disabled, .fs select:disabled, .fs textarea:disabled { opacity: .7; cursor: not-allowed; }
.fs .campo.con-error input, .fs .campo.con-error select { border-color: var(--danger); background: var(--danger-light); }

.afijo { position: relative; display: flex; align-items: center; }
.afijo > input { flex: 1 1 auto; }
.afijo > .af { z-index: 1; position: absolute; color: var(--muted); font-weight: 600; font-size: .92rem; pointer-events: none; }
.afijo > .af.izq { left: .9rem; }
.afijo > .af.der { right: .9rem; }
.afijo > .af.izq ~ input { padding-left: 1.9rem !important; }
.afijo > input:has(~ .af.der) { padding-right: 3.4rem !important; }

.opcion { display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer;
	margin: 0; font-weight: 400; color: var(--ink); transition: border-color .15s, background .15s; }
.opcion:hover { border-color: var(--border-strong); }
.opcion:has(input:checked) { border-color: var(--brand); background: #f3f9f6; }
.opcion .texto { display: flex; flex-direction: column; gap: .1rem; }
.opcion .texto strong { font-size: .92rem; }
.opcion .texto small { color: var(--muted); font-size: .8rem; }
.opcion input[type="checkbox"] { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 44px; height: 26px; margin: 0; border-radius: 999px;
	background: var(--border-strong); cursor: pointer; transition: background .2s; }
.opcion input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.opcion input[type="checkbox"]:checked { background: var(--brand); }
.opcion input[type="checkbox"]:checked::after { transform: translateX(18px); }
.opcion input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--brand-light); }
.opcion input[type="checkbox"]:disabled { opacity: .6; cursor: not-allowed; }

/* El editor de partidas dentro de una sección */
.fs .conceptos-editor .elegir-producto label { font-size: .84rem; color: var(--ink); margin-bottom: .6rem; }
.fs table.conceptos { border-collapse: separate; border-spacing: 0; }
.fs table.conceptos th { background: transparent; border-bottom: 1.5px solid var(--border); padding: .5rem .35rem; }
.fs table.conceptos td { border-bottom: 1px dashed var(--border); padding: .45rem .3rem; }
.fs table.conceptos input:not([type="hidden"]), .fs table.conceptos select { min-height: 40px; border-radius: 10px; font-size: .88rem; padding: .4rem .55rem; }
.fs .conceptos-pie .casilla { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-size: .86rem; }
.fs .conceptos-totales { background: var(--surface-2); border-radius: 14px; padding: .8rem 1rem; min-width: 260px; }
.fs .conceptos-totales .total { color: var(--brand-dark); font-family: "Sora", sans-serif; font-size: 1.2rem; }

.barra-acciones { position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem 1rem;
	margin: 1.4rem 0 0; padding: .85rem 1.2rem; border: 1px solid var(--border); border-radius: 18px 18px 0 0;
	background: rgba(255, 255, 255, .9); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
	box-shadow: 0 -6px 24px rgba(23, 32, 28, .08); }
.barra-acciones .resumen { display: flex; align-items: baseline; gap: .5rem; color: var(--muted); font-size: .88rem; }
.barra-acciones .resumen strong { font-family: "Sora", sans-serif; font-size: 1.45rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.barra-acciones .botones { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }
.barra-acciones button, .barra-acciones .btn { min-height: 46px; padding: .6rem 1.4rem; border-radius: 12px; font-size: .95rem; }
.barra-acciones .btn.ghost { background: var(--surface); }
@media (max-width: 760px) {
	.barra-acciones { border-radius: 14px 14px 0 0; padding: .55rem .7rem; flex-wrap: nowrap; }
	.barra-acciones .resumen { flex-direction: column; gap: 0; font-size: .75rem; min-width: 0; }
	.barra-acciones .resumen strong { font-size: 1.15rem; }
	.barra-acciones button, .barra-acciones .btn { min-height: 42px; padding: .5rem .9rem; font-size: .88rem; }
	.barra-acciones .btn.ghost { display: none; }
}
.campo[hidden], .opcion[hidden] { display: none; }

/* Dos secciones lado a lado en pantallas anchas */
.fs-dos { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 1.1rem; align-items: start; }
.fs-grid[hidden], .fs[hidden] { display: none; }

/* Sección plegable (details.fs): el encabezado abre y cierra */
details.fs > summary::-webkit-details-marker { display: none; }
details.fs:not([open]) > summary.fs-cabeza { border-bottom: 0; }
details.fs[open] > summary .derecha { display: none; }
.fs .crm-proximo { border-radius: 14px; }

/* El interruptor también funciona suelto, en tarjetas que no son secciones nuevas */
.card .opcion { margin: .5rem 0; }
