/* Gestión de talleres (public/talleres.php). Todo va acotado a .tl / .tl-* para no pisar otras vistas. */

/* Resumen: cada tarjeta lleva a su pestaña */
.tl-stats article{padding:0}
.tl-stats a{display:grid;gap:2px;height:100%;padding:16px;border-radius:inherit;color:inherit;text-decoration:none}
.tl-stats a span{text-decoration:underline;text-decoration-color:var(--line);text-underline-offset:3px}
.tl-tab-ico{font-size:18px}
@media(max-width:640px){.tabs a .tl-tab-ico{font-size:20px;line-height:1.2}}

/* Distribución: en celular acción principal → listados → otras acciones; en escritorio las acciones van al costado */
.tl-layout{display:grid;grid-template-columns:minmax(0,1fr)}
.tl-layout>*{min-width:0}
.tl .sub{margin:6px 0 10px}
@media(min-width:1000px){
  .tl-layout{grid-template-columns:minmax(0,1fr) 350px;grid-template-rows:auto 1fr;column-gap:16px;align-items:start}
  .tl-layout>:first-child{grid-column:2;grid-row:1}
  .tl-layout>.tl-main{grid-column:1;grid-row:1/span 2}
  .tl-layout>.tl-more{grid-column:2;grid-row:2}
  .tl-layout>:first-child .cols,.tl-more .cols{grid-template-columns:1fr}
}

/* Desplegables: toda la franja es tocable (antes sólo el renglón de texto) */
.tl details.card{padding:0}
.tl details.card>summary{min-height:60px;padding:12px 18px;border-radius:var(--radius)}
.tl details.card[open]>summary{margin-bottom:0}
.tl details.card>form,.tl details.card>p{padding:4px 18px 18px;margin:0}
.tl details.card>form>.hint{margin:0}
.tl details.card>form>button.block{margin-top:4px}
/* Acción frecuente de la pestaña: se distingue por borde, fondo y el rótulo, no sólo por color */
.tl details.tl-primary{border:2px solid var(--brand)}
.tl details.tl-primary>summary{background:var(--brand-soft);color:var(--brand-dark)}
.tl details.tl-primary[open]>summary{border-radius:var(--radius) var(--radius) 0 0;margin-bottom:12px}
.tl details.tl-primary>summary::after{background:var(--brand);color:#fff}
/* Incidente: franja de seguridad amarilla */
.tl details.tl-alert{border:2px solid var(--safety);border-left-width:8px}
.tl details.tl-alert>summary{background:var(--safety-soft);color:var(--safety-ink)}
.tl details.tl-alert[open]>summary{border-radius:var(--radius) var(--radius) 0 0;margin-bottom:12px}

/* Campos */
.tl-opt{font-size:13px;font-weight:600;color:var(--muted)}
.tl textarea.tl-short{min-height:76px}
.tl-choice{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 14px;padding:0;border:0;min-width:0}
.tl-choice legend{padding:0;margin-bottom:6px;font-size:15px;font-weight:800}
.tl-choice .chip{position:relative;flex:1 1 auto;justify-content:center;min-height:48px}
.tl-choice .chip input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.tl-choice .chip:has(input:checked)::before{content:"✓";font-weight:900}

/* Encabezado de tarjeta con acción a la derecha */
.tl-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px;margin-bottom:8px}
.tl-head h2{display:flex;align-items:center;gap:10px;margin:0;font-size:21px;font-weight:900;letter-spacing:-.3px}
.tl-head h2 .emoji{font-size:26px}
.tl .card>h2{margin-bottom:12px}
.tl-summary{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 8px}

/* Tablas de máquinas e insumos (sobre table.stack / table.fit del sistema) */
.tl-table .tl-name{font-weight:500}
.tl-table .tl-name strong{display:block;line-height:1.25}
.tl-table .tl-name small,.tl-table td small{display:block;color:var(--muted);font-size:14px;font-weight:600}
.tl-table .tl-name{min-width:150px}
.tl-table .tl-actions{text-align:right;white-space:nowrap}
.tl-table .tl-actions>*+*{margin-left:8px}
@media(min-width:1000px){
  /* Con el panel de acciones al costado, los dos botones de la fila van uno sobre otro */
  .tl-table:not(.tl-supplies) .tl-actions>*{display:flex;width:100%}
  .tl-table:not(.tl-supplies) .tl-actions>*+*{margin:6px 0 0}
}
.tl-table .tl-qty .status{margin-left:6px}
.tl-table tr.tl-attention>:first-child{box-shadow:inset 4px 0 0 var(--warn)}
.tl-table tr[hidden]{display:none}
.tl-filter{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:8px}
.tl-filter .search{flex:1 1 240px}
.tl-filter+.hint{margin:0 0 6px}
@media(max-width:640px){
  .tl .table-wrap{overflow:visible}
  .tl-table.stack tr{grid-template-columns:minmax(0,1fr) auto;gap:6px 12px;align-items:center}
  .tl-table.stack tr.tl-attention{border-left:5px solid var(--warn)}
  .tl-table.stack tr.tl-attention>:first-child{box-shadow:none}
  .tl-table.stack tbody th.tl-name{display:block;grid-column:1/-1;padding:0}
  .tl-table.stack td{padding:0}
  .tl-table.stack td.tl-state{display:block;grid-column:1/-1;text-align:left}
  .tl-table.stack td.tl-state small{margin-top:4px}
  .tl-table.stack td[data-label]{grid-column:1/-1;flex-wrap:wrap;justify-content:flex-start;gap:4px 10px;text-align:left;font-weight:700}
  .tl-table.stack td.tl-actions{grid-column:1/-1;justify-content:flex-end;gap:8px;margin-top:4px}
  .tl-table.stack td.tl-actions>*+*{margin-left:0}
  /* Insumos: nombre arriba; abajo stock + ubicación en un renglón y el botón a la derecha */
  .tl-supplies.stack tr{grid-template-columns:minmax(0,1fr) auto;gap:4px 10px}
  .tl-supplies.stack tbody th.tl-name{grid-column:1;grid-row:1}
  .tl-supplies.stack td.tl-qty{grid-column:1;grid-row:2;justify-content:flex-start;flex-wrap:wrap;gap:6px;text-align:left;font-size:17px}
  .tl-supplies.stack td.tl-qty .status{margin-left:0}
  .tl-supplies.stack td[data-label]{grid-column:1;grid-row:3;font-weight:600;font-size:14px;color:var(--muted)}
  .tl-supplies.stack td[data-label]::before{content:"📍 ";font-weight:600}
  .tl-supplies.stack td.tl-actions{grid-column:2;grid-row:1/span 3;margin:0;align-self:center}
}

/* Listas */
.tl-res .tl-when{color:var(--ink);font-weight:800}
.tl .row.tl-low{border-color:#f2d59b;background:var(--warn-soft)}
.tl-stock{white-space:nowrap;font-weight:700}
.tl-stock b{font-size:18px;font-weight:900}
.tl .row .status{flex:none}
@media(max-width:640px){
  .tl .row .grow{flex:1 1 60%}
  .tl .row.tl-epp .grow{flex-basis:100%}
  .tl .row form.req-actions{width:100%}
  .tl .row form.req-actions button{flex:1}
}
