/* ============ Facturación por eventos ============ */

/* botones de plantilla */
.fact-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fact-tab { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none !important; transition: border-color .15s, background .15s; }
.fact-tab:hover { border-color: var(--border-strong); background: var(--surface-2); }
.fact-tab.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--primary-soft); }
.fact-tab-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-cps { background: var(--cps); }
.dot-exterior { background: var(--ext); }
.dot-auxiliar { background: var(--aux); }
.fact-tab-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.fact-tab-txt b { font-size: 15px; }
.fact-tab-txt small { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* estados */
.est { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.est-previsto { background: var(--surface-2); color: var(--muted); border-color: var(--border-strong); }
.est-confirmado { background: var(--primary-soft); color: var(--primary); }
.est-realizado { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #d97706; }
.est-facturado { background: var(--ok-soft); color: var(--ok); }
.est-cancelado { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
select.est-select { width: auto; height: 30px; padding: 0 8px; font-size: 12.5px; font-weight: 600; border-radius: 999px; }

/* cuadrante de facturación */
.fq-table .q-day, .fq-table .fq-cell, .fq-table .fq-evday, .fq-table .fq-foot { width: 46px; min-width: 46px; }
.fq-table .q-tot { min-width: 72px; }
.fq-cell, .fq-evday { vertical-align: top; padding: 3px 2px; cursor: pointer; background: var(--surface); height: 40px; position: relative; }
.fq-cell.we, .fq-evday.we { background: var(--weekend); }
.fq-cell.puente, .fq-evday.puente { background: var(--puente); }
.fq-cell.fest, .fq-evday.fest { background: var(--festivo); }
.fq-cell:hover, .fq-evday:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.fq-day { cursor: pointer; }
.fq-evrow th, .fq-evrow td { border-bottom: 2px solid var(--border-strong) !important; }
.fq-hint { margin-top: 0; }
.fq-base { display: block; font-size: 10px; font-weight: 700; color: var(--c); opacity: .8; filter: saturate(.6); line-height: 1.2; text-align: center; letter-spacing: .02em; }
.fq-chip { display: flex; align-items: center; justify-content: center; gap: 2px; margin: 2px auto 0; width: 40px; min-height: 18px; border-radius: 5px; background: var(--c); color: #fff; font-size: 10px; font-weight: 700; line-height: 1; cursor: pointer; }
.fq-chip small { font-weight: 500; opacity: .9; font-size: 9px; }
.fq-chip.est-previsto { background: transparent; color: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); border: 0; }
.fq-chip.est-confirmado, .fq-chip.est-realizado, .fq-chip.est-facturado { background: var(--c); color: #fff; }
.fq-chip.est-cancelado { opacity: .45; background: var(--c); color: #fff; }
.fq-chip.est-facturado::after { content: "✓"; font-size: 9px; margin-left: 1px; }
.fq-chip:hover { filter: brightness(1.15); }
.fq-more { display: block; text-align: center; font-size: 10px; color: var(--muted); margin-top: 2px; }
.fq-warn { position: absolute; top: 2px; right: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--warn); color: #fff; font-size: 9px; font-weight: 800; display: grid; place-items: center; }
.fq-foot { text-align: center; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* calendario de facturación */
.fc-cell { min-height: 118px; cursor: pointer; }
.fc-top { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.fc-sum { margin-left: auto; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fc-ev { display: block; font-size: 11.5px; line-height: 1.35; padding: 2px 6px; border-radius: 5px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.fc-ev b { color: var(--c); font-size: 10.5px; }
.fc-ev.est-previsto { background: transparent; border: 1px dashed var(--c); border-left: 3px solid var(--c); }
.fc-ev.est-cancelado { opacity: .5; text-decoration: line-through; }
.fc-ev:hover { background: color-mix(in srgb, var(--c) 24%, transparent); }
.cal-cell.fest { background: var(--festivo); }

/* lista */
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.bulk-bar select { width: auto; height: 30px; }
.fl-table .chk { width: 36px; }
.fl-table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.row-cancel td { opacity: .55; }

/* modales de evento */
.ev-cards { display: flex; flex-direction: column; gap: 8px; }
.ev-card { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 10px 14px; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
.ev-card:hover { background: var(--surface-2); }
.ev-card.est-cancelado { opacity: .6; text-decoration: none; }
.ev-card-main { display: flex; flex-direction: column; min-width: 0; }
.ev-card-main small, .ev-card-side small { color: var(--muted); font-size: 12px; }
.ev-card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.celda-base { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.txt-warn { color: var(--warn); font-weight: 600; }
.ev-extra { display: flex; gap: 8px; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 12px; }
.as-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 16px; }
.as-head h3 { font-size: 15px; }
.as-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.as-list { border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 340px; overflow-y: auto; }
.as-row { display: grid; grid-template-columns: 28px minmax(170px, 1.5fr) minmax(150px, 1.2fr) 110px 110px 84px; gap: 8px; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--border); }
.as-row:last-child { border-bottom: 0; }
.as-row.on { background: var(--primary-soft); }
.as-row-head { position: sticky; top: 0; z-index: 1; background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--muted); padding-top: 6px; padding-bottom: 6px; }
.as-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.as-row input[type=time], .as-row input[type=number] { height: 30px; padding: 0 6px; font-size: 13px; }
.as-row input.dirty { border-color: var(--warn); }
.as-name { display: flex; flex-direction: column; min-width: 0; font-weight: 500; }
.as-name small { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.as-base { display: flex; align-items: center; gap: 6px; min-width: 0; }
.as-base small { color: var(--muted); }

/* dashboard: eventos de hoy */
.hoy-evs { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 10px; }
.hoy-ev { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); text-decoration: none !important; }
.hoy-ev:hover { border-color: var(--border-strong); border-left-color: var(--c); background: var(--surface); }
.hoy-ev.est-cancelado { opacity: .55; text-decoration: none; }
.hoy-ev.est-cancelado b { text-decoration: line-through; }
.hoy-ev-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.hoy-ev-main small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hoy-ev-pers { color: var(--text-2) !important; }
.hoy-ev-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hoy-ev-side small { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* dashboard: turnos del día y asistencia */
.as-card { gap: 12px; }
.as-card-head h2 { flex-wrap: wrap; }
.as-sub { font-weight: 400; font-size: 13px; }
.as-resumen { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.as-pill { display: inline-flex; gap: 5px; align-items: baseline; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.as-pill b { font-size: 14px; font-variant-numeric: tabular-nums; }
.as-pill.as-presente b { color: var(--ok); }
.as-pill.as-retraso b { color: var(--warn); }
.as-pill.as-falta b { color: var(--danger); }
.as-pill.as-falta.alerta { background: var(--danger-soft); border-color: var(--danger); }
.as-aviso { font-size: 13px; font-weight: 600; color: var(--danger); }
.as-franjas { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.as-franja { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.as-franja-head { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.as-franja-head b { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.as-vacio { padding: 10px 12px; }
.as-fila { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; transition: background .15s; }
.as-fila:last-child { border-bottom: 0; }
.as-fila.is-presente { border-left-color: var(--ok); }
.as-fila.is-retraso { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 7%, transparent); }
.as-fila.is-falta { border-left-color: var(--danger); background: var(--danger-soft); }
.as-quien { display: flex; flex-direction: column; min-width: 0; }
.as-quien b { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-quien small { color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.as-quien .badge { font-size: 10px; padding: 0 6px; }
.as-btns { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.as-b { width: 32px; height: 28px; border: 0; background: var(--surface); color: var(--muted); font-size: 14px; font-weight: 700; cursor: pointer; }
.as-b + .as-b { border-left: 1px solid var(--border-strong); }
.as-b:hover { background: var(--surface-2); color: var(--text); }
.as-b-presente.on { background: var(--ok); color: #fff; }
.as-b-retraso.on { background: var(--warn); color: #fff; }
.as-b-falta.on { background: var(--danger); color: #fff; }
.as-estado { font-size: 12.5px; font-weight: 600; }
.as-ausencias { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding-top: 4px; }
.as-aus { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.as-aus small { color: var(--muted); }
.as-libres { flex-basis: 100%; }

@media (max-width: 860px) {
  .fact-tabs { grid-template-columns: 1fr; }
  .as-row { grid-template-columns: 24px 1fr 1fr; }
  .as-row-head { display: none; }
}

/* ---------- cuadrante: modo lectura / modo edición ---------- */
.actions[hidden], .palette[hidden], .q-info-ver[hidden] { display: none !important; }
[data-tema] .q-info-ver, .q-info-ver { padding: 12px 18px; }
/* En modo lectura: sin menús de fila ni pistas de edición, y el cursor no invita a pintar */
.page:not(.q-editando) [data-rowmenu], .page:not(.q-editando) .q-solo-edicion { display: none; }
.page:not(.q-editando) .q-cell, .page:not(.q-editando) thead .q-day { cursor: default; }
.q-editando .q-wrap { box-shadow: 0 0 0 2px var(--primary); }
.q-editando .q-cell { cursor: crosshair; }
.q-modo-edicion {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 10px; border-radius: var(--radius-sm);
  background: var(--primary-soft); color: var(--text-2); font-size: 13px; animation: aparece .3s ease both;
}
.q-modo-edicion .ico { width: 15px; height: 15px; color: var(--primary); }
.q-modo-edicion b { color: var(--primary); }
#acc-editar .icon-btn:disabled { opacity: .35; cursor: default; }
.save-state.err { color: var(--danger); }
.q-editando thead .q-day { cursor: pointer; }
