/* Mi semana en la cocina (js/semana-cocina.js). Móvil primero: recetas en
   un carrusel arriba, los siete días debajo y la compra en su pestaña. En
   escritorio, las tres columnas a la vez. */
:root {
    --sc-acento: #B5651D;
    --sc-acento-osc: #8A4B14;
    --sc-acento-claro: #FDF0DC;
    --sc-tinta: #1A202C;
    --sc-tinta-2: #4A5568;
    --sc-tinta-3: #718096;
    --sc-borde: #E2E8F0;
    --sc-fondo: #FBF8F3;
    --sc-tarjeta: #FFFFFF;
    --sc-ok: #2F7D5B;
}

.sc-hero { background: linear-gradient(135deg, #FFF7EC 0%, #FDE9CF 100%); border-color: #F3D3A6; }
.sc-hero-icon { background: var(--sc-acento); color: #fff; box-shadow: 0 6px 16px rgba(181, 101, 29, .28); }

#sc-contenido { margin-top: 14px; }

/* Pestañas (solo en el móvil) */
.sc-pestanas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: #F1ECE4; margin-bottom: 14px; position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); z-index: 6; }
.sc-pestanas button { border: 0; background: none; padding: 9px 6px; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 700; color: var(--sc-tinta-2); cursor: pointer; }
.sc-pestanas button.is-on { background: #fff; color: var(--sc-acento-osc); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.sc-rejilla { display: grid; gap: 16px; min-width: 0; }
.sc-rejilla[data-vista="tablero"] .sc-lateral { display: none; }
.sc-rejilla[data-vista="menu"] .sc-recetas,
.sc-rejilla[data-vista="menu"] .sc-bloque-compra { display: none; }
.sc-rejilla[data-vista="compra"] .sc-recetas,
.sc-rejilla[data-vista="compra"] .sc-tablero,
.sc-rejilla[data-vista="compra"] .sc-bloque-junto { display: none; }

.sc-titulo { font-size: 16px; font-weight: 800; color: var(--sc-tinta); }
.sc-titulo small { font-size: 12.5px; font-weight: 600; color: var(--sc-tinta-3); margin-left: 6px; }
.sc-ayuda { font-size: 13px; color: var(--sc-tinta-2); line-height: 1.45; margin: 8px 0; }
.sc-ayuda b { color: var(--sc-acento-osc); }
.sc-ayuda-mover { padding: 10px 12px; border-radius: 12px; background: var(--sc-acento-claro); }
.sc-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--sc-acento-osc); text-decoration: underline; cursor: pointer; }
.sc-vacio, .sc-nota { font-size: 13px; color: var(--sc-tinta-3); line-height: 1.45; }

/* Recetas */
.sc-recetas { min-width: 0; }
.sc-buscar { width: 100%; padding: 11px 14px; border: 1.5px solid var(--sc-borde); border-radius: 12px; font: inherit; font-size: 15px; background: #fff; color: var(--sc-tinta); }
.sc-buscar:focus { outline: none; border-color: var(--sc-acento); box-shadow: 0 0 0 3px var(--sc-acento-claro); }
.sc-filtros-btn { margin-top: 8px; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--sc-borde); background: #fff; font: inherit; font-size: 13px; font-weight: 700; color: var(--sc-tinta-2); cursor: pointer; }
.sc-filtros-btn[aria-expanded="true"] { border-color: var(--sc-acento); color: var(--sc-acento-osc); background: var(--sc-acento-claro); }
.sc-filtros { display: none; }
.sc-filtros.is-abierto { display: block; }
.sc-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.sc-selects label { display: grid; gap: 3px; min-width: 0; }
.sc-selects span { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--sc-tinta-3); }
.sc-selects select { width: 100%; min-width: 0; padding: 8px 10px; border: 1.5px solid var(--sc-borde); border-radius: 10px; font: inherit; font-size: 14px; background: #fff; color: var(--sc-tinta); }
.sc-foto { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--sc-tinta-2); }
.sc-foto input { accent-color: var(--sc-acento); width: 16px; height: 16px; }

.sc-cartas { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 10px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px; scroll-snap-type: x proximity; }
.sc-cartas > li { scroll-snap-align: start; min-width: 0; }
.sc-carta {
    width: 100%; display: grid; grid-template-rows: auto 1fr; text-align: left; padding: 0; border-radius: 14px;
    border: 2px solid transparent; background: var(--sc-tarjeta); box-shadow: 0 1px 4px rgba(0,0,0,.08); overflow: hidden;
    font: inherit; color: var(--sc-tinta); cursor: grab; touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.sc-carta.is-elegida { border-color: var(--sc-acento); box-shadow: 0 0 0 3px var(--sc-acento-claro); }
.sc-carta-foto { display: block; aspect-ratio: 4 / 3; background: #F1ECE4; overflow: hidden; }
.sc-carta-foto img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.sc-sin-foto { display: grid; place-items: center; height: 100%; font-size: 28px; opacity: .6; }
.sc-carta-txt { display: grid; gap: 3px; padding: 8px 10px 10px; min-width: 0; }
.sc-carta-txt b { font-size: 13px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sc-carta-txt small { font-size: 11px; color: var(--sc-tinta-3); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sc-mas { align-self: center; font-size: 12.5px; color: var(--sc-tinta-3); padding: 0 10px; width: 160px; }

/* Tablero */
.sc-tablero { min-width: 0; }
.sc-tablero-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.sc-dias { list-style: none; display: grid; gap: 8px; }
.sc-dia { display: grid; grid-template-columns: 40px 1fr; gap: 8px; align-items: stretch; }
.sc-dia h4 { font-size: 13px; font-weight: 800; color: var(--sc-tinta); align-self: center; }
.sc-dia-largo { display: none; }
.sc-tomas { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; min-width: 0; }
.sc-hueco {
    position: relative; min-height: 76px; border-radius: 12px; border: 1.5px dashed #D9CFC1; background: var(--sc-fondo);
    display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 7px 8px; text-align: left;
    font: inherit; color: var(--sc-tinta); cursor: pointer; overflow: hidden; min-width: 0; touch-action: pan-y;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.sc-hueco img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.sc-hueco.is-lleno { border-style: solid; border-color: transparent; background: #3A2F25; color: #fff; }
.sc-hueco.is-lleno::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 20%, rgba(0,0,0,.72) 100%); pointer-events: none; }
.sc-hueco > span { position: relative; z-index: 1; }
.sc-hueco-toma { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--sc-tinta-3); }
.sc-hueco.is-lleno .sc-hueco-toma { color: rgba(255,255,255,.82); }
.sc-hueco-vacio { font-size: 20px; color: #C8B9A4; line-height: 1; margin-bottom: auto; order: -1; }
.sc-hueco-nom { font-size: 12.5px; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sc-quitar { position: absolute !important; top: 5px; right: 5px; z-index: 2 !important; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; font-size: 15px; line-height: 1; }
.sc-hueco.is-destino { border-color: var(--sc-acento); border-style: dashed; }
.sc-hueco.is-destino:not(.is-lleno) { background: var(--sc-acento-claro); }
.sc-hueco.is-origen { outline: 3px solid var(--sc-acento); outline-offset: 1px; }
.sc-hueco.is-sobre { outline: 3px solid var(--sc-acento); outline-offset: 1px; transform: scale(1.02); }

/* Arrastrar */
.sc-fantasma { position: fixed !important; left: 0; top: 0; z-index: 9999; pointer-events: none; opacity: .92; box-shadow: 0 16px 34px rgba(0,0,0,.25) !important; transform-origin: 0 0; }
body.sc-arrastrando { cursor: grabbing; user-select: none; -webkit-user-select: none; }
body.sc-arrastrando .sc-cartas { overflow-x: hidden; }

/* Lateral */
.sc-lateral { display: grid; gap: 14px; min-width: 0; }
.sc-bloque { background: var(--sc-tarjeta); border-radius: 16px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05); min-width: 0; }
.sc-junto { list-style: none; display: grid; gap: 8px; margin-top: 8px; }
.sc-junto li { padding: 10px 12px; border-radius: 12px; background: var(--sc-fondo); display: grid; gap: 4px; }
.sc-junto b { font-size: 14px; }
.sc-junto small { font-size: 12px; color: var(--sc-tinta-2); line-height: 1.5; }
.sc-compra-cab { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.sc-paso { display: inline-flex; align-items: center; gap: 6px; background: var(--sc-fondo); border-radius: 999px; padding: 3px; }
.sc-paso button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: #fff; font-size: 17px; font-weight: 700; color: var(--sc-tinta); cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.sc-paso b { font-size: 13px; padding: 0 4px; }
.sc-quedan { font-size: 13px; color: var(--sc-tinta-2); margin: 10px 0 4px; }
.sc-quedan b { color: var(--sc-acento-osc); font-size: 15px; }
.sc-hueco-dato { overflow-wrap: break-word; min-width: 0; font-size: 12.5px; line-height: 1.4; padding: 8px 10px; border-radius: 10px; background: #FFF8EC; border: 1px solid #F5D49A; color: var(--sc-tinta); margin: 8px 0; }
.sc-sec { font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--sc-tinta-3); margin: 14px 0 6px; }
.sc-compra { list-style: none; display: grid; gap: 4px; }
.sc-item { width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; border: 0; background: var(--sc-fondo); font: inherit; text-align: left; color: var(--sc-tinta); cursor: pointer; }
.sc-check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid #C8B9A4; background: #fff; }
.sc-item.is-hecho .sc-check, .sc-sa.is-hecho .sc-check { background: var(--sc-ok); border-color: var(--sc-ok); box-shadow: inset 0 0 0 3px #fff; }
.sc-item.is-hecho .sc-item-nom, .sc-item.is-hecho .sc-item-cant { text-decoration: line-through; color: var(--sc-tinta-3); }
/* Nombre y cantidad en una fila que se parte: si la cantidad es larga
   («1 ud (redondeado hacia arriba)») baja a la línea de abajo en vez de
   estrechar el nombre; el nombre solo se corta si una palabra no cabe sola. */
.sc-item-linea { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; min-width: 0; }
.sc-item-nom { font-size: 14px; flex: 1 1 9em; min-width: 0; overflow-wrap: break-word; }
.sc-item-orig { grid-column: 2 / -1; font-size: 11.5px; color: var(--sc-tinta-3); line-height: 1.35; overflow-wrap: break-word; margin-top: -4px; }
.sc-item > .sc-check { align-self: start; }
.sc-item::first-letter { text-transform: uppercase; }
.sc-item-cant { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--sc-tinta-2); flex: 0 1 auto; min-width: 0; margin-left: auto; overflow-wrap: break-word; }
.sc-lote { margin-top: 8px; padding: 10px 12px; border-radius: 12px; border: 1px dashed #D9CFC1; }
.sc-lote b { font-size: 14px; }
.sc-lote small { font-size: 12px; color: var(--sc-tinta-3); }
.sc-lote ul { margin: 6px 0 0 18px; font-size: 13px; color: var(--sc-tinta-2); line-height: 1.5; }
.sc-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* En papel */
.sc-papel { display: none; }
#sc-hoja { display: none; }
@media print { body.sc-imprimiendo #sc-hoja { display: block; } }
@media print {
    body.sc-imprimiendo > *:not(#sc-hoja) { display: none !important; }
    body.sc-imprimiendo #sc-hoja .sc-papel { display: block; color: #000; font-family: inherit; }
    .sc-papel h1 { font-size: 20pt; margin-bottom: 4mm; }
    .sc-papel h2 { font-size: 14pt; margin: 6mm 0 2mm; }
    .sc-papel h3 { font-size: 10pt; text-transform: uppercase; letter-spacing: .05em; margin: 3mm 0 1mm; break-after: avoid; }
    .sc-papel table { width: 100%; border-collapse: collapse; font-size: 10pt; }
    .sc-papel th, .sc-papel td { border: 1px solid #999; padding: 2mm 3mm; text-align: left; vertical-align: top; }
    .sc-papel thead th { background: #eee; }
    .sc-papel-lista { columns: 2; column-gap: 8mm; font-size: 10pt; }
    .sc-papel-receta { margin: 2mm 0 0; break-after: avoid; }
    .sc-papel-lista ul { list-style: none; margin: 0 0 2mm; padding: 0; break-inside: avoid-column; }
    .sc-papel-pie { margin-top: 6mm; font-size: 8pt; color: #555; }
    @page { margin: 12mm; }
}

/* Escritorio: las tres columnas a la vez */
@media (min-width: 1024px) {
    #main-content:has(#page-semana-cocina.active) { max-width: none; margin-left: 220px; margin-right: 0; }
    #page-semana-cocina { max-width: none; }
    .sc-pestanas { display: none; }
    .sc-rejilla, .sc-rejilla[data-vista] { grid-template-columns: 290px minmax(0, 1fr) 320px; align-items: start; }
    .sc-rejilla[data-vista] .sc-recetas,
    .sc-rejilla[data-vista] .sc-tablero,
    .sc-rejilla[data-vista] .sc-lateral,
    .sc-rejilla[data-vista] .sc-bloque-junto,
    .sc-rejilla[data-vista] .sc-bloque-compra { display: block; }
    .sc-rejilla[data-vista] .sc-lateral { display: grid; }
    .sc-recetas { position: sticky; top: 76px; }
    .sc-filtros-btn { display: none; }
    .sc-filtros, .sc-filtros.is-abierto { display: block; }
    .sc-cartas { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr 1fr; overflow-x: visible; overflow-y: auto; max-height: calc(100vh - 330px); padding-right: 4px; }
    .sc-mas { width: auto; grid-column: 1 / -1; }
    .sc-dia { grid-template-columns: 92px 1fr; }
    .sc-dia-largo { display: inline; }
    .sc-dia-corto { display: none; }
    .sc-hueco { min-height: 92px; }
    .sc-hueco-nom { font-size: 14px; }
}

/* Totales (solo recetas con raciones) y, aparte, lo que va sin ajustar. */
.sc-sub { font-size: 13px; font-weight: 800; color: var(--sc-tinta); margin: 14px 0 2px; }
.sc-item-tambien { color: #A0611B; }
.sc-sinajustar { margin-top: 16px; padding-top: 4px; border-top: 1px dashed #E3C48F; }
.sc-sa-aviso { font-size: 12px; color: var(--sc-tinta-3); margin: 0 0 8px; }
.sc-sa { display: grid; grid-template-columns: 22px 1fr; gap: 2px 8px; width: 100%; text-align: left; font: inherit; color: inherit; background: #FFFBF3; border: 1px solid #F1DDB7; border-radius: 12px; padding: 10px 12px; margin: 0 0 8px; cursor: pointer; }
.sc-sa .sc-check { grid-row: 1 / span 3; margin-top: 2px; }
.sc-sa-tit { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.sc-sa-nota { font-size: 11.5px; color: #A0611B; line-height: 1.35; }
.sc-sa-lineas { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.4; margin-top: 4px; overflow-wrap: anywhere; }
.sc-sa-lineas > span::before { content: '· '; color: var(--sc-tinta-3); }
.sc-sa.is-hecho .sc-sa-tit, .sc-sa.is-hecho .sc-sa-lineas { text-decoration: line-through; opacity: .55; }
