/* Sólo lo funcional del framework + piezas propias de tsConecta. Colores y fuente: panel-tokens.css / panel-ui.css. */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--ok, #26b050); }
.invalid { outline: 1px solid var(--danger, #e50000); }
.validation-message { color: var(--danger, #e50000); }

#blazor-error-ui {
    color-scheme: light dark; display: none; position: fixed; left: 0; right: 0; bottom: 0;
    padding: 0.6rem 1.25rem 0.7rem; background: var(--ts-warning-bg, lightyellow); color: var(--text, #1a1d21);
    box-shadow: 0 -1px 2px rgba(0,0,0,.2); z-index: 2000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* Ingreso (página estática) */
.ts-login-body { margin: 0; background: var(--bg); font-family: var(--sans); color: var(--text); }
.ts-login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; }
.ts-login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 14px; }
.ts-login-brand { font-size: 26px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.ts-login-brand img { width: 34px; height: 34px; border-radius: 8px; }
.ts-login-brand-txt { white-space: nowrap; }
.ts-login-brand-txt span { color: var(--primary); }
.ts-login-link { text-align: center; color: var(--text-muted); text-decoration: none; }
.ts-login-o { display: flex; align-items: center; gap: 10px; color: var(--text-faint); font-size: 12px; margin: 4px 0; }
.ts-login-o::before, .ts-login-o::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.ts-login-google { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.ts-login-confiar { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }
.ts-select-sm { height: 30px; padding: 0 8px; width: auto; }
.ts-login-link:hover { text-decoration: underline; }
.ts-topbar-usuario { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.ts-login-powered { display: inline-flex; align-items: center; gap: 6px; color: var(--text-faint); font-size: 12px; text-decoration: none; }
.ts-login-powered img { width: 16px; height: 16px; border-radius: 4px; }
.ts-login-powered strong { color: var(--ts-tecseris, #dc1414); }

/* GuardarBar sin Bootstrap */
.ts-guardar { align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.ts-guardar-ok { color: var(--ok); }
.ts-guardar-error { color: var(--danger); }
.ts-form-inline { display: inline; margin: 0; }

/* Etiqueta de origen + acciones de la cascada */
.ts-config-fila { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.ts-config-fila:last-child { border-bottom: 0; }
.ts-config-nombre { font-weight: 500; }
.ts-config-desc { color: var(--text-faint); font-size: var(--ts-text-caption, 12px); }
@media (max-width: 899.98px) { .ts-config-fila { grid-template-columns: 1fr; } }

/* Tarjetas de estado de módulos */
.ts-modulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ts-modulo { border: 1px solid var(--border); border-radius: var(--ts-radius-md, 10px); padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.ts-modulo-nombre { font-weight: 600; }

/* QR del local (orden 38): una tarjeta por QR, las mesas al final; el buscador (orden 37) esconde las que no coinciden */
.ts-qr-local-grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ts-qr-local-item { border: 1px solid var(--border); border-radius: var(--ts-radius-md, 10px); padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ts-qr-local-item[hidden], .ts-qr-local-grupo[hidden] { display: none; }
.ts-qr-local-img { align-self: center; width: 148px; max-width: 100%; background: #fff; border-radius: var(--ts-radius-sm, 6px); padding: 4px; margin-bottom: 4px; }
.ts-qr-local-img svg { display: block; width: 100%; height: auto; }
.ts-qr-local-titulo { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ts-qr-local-abrir { margin-left: auto; }
.ts-qr-local-acciones { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.ts-qr-local-grupo { margin-top: 16px; }
.ts-qr-local-grupo-titulo { font-weight: 600; margin-bottom: 8px; }
/* Un enlace con forma de botón no va subrayado (a.ts-btn: cartel, descargas, "Ver licencias"…) */
a.ts-btn { text-decoration: none; }

/* Clave mostrada una sola vez */
.ts-secreto-unavez { font-family: var(--mono); background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; word-break: break-all; user-select: all; }

/* Editor de horario de atención */
.ts-horario { display: flex; flex-direction: column; gap: 10px; }
.ts-horario-franja { border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.ts-horario-hora { width: 84px; }
.ts-horario-dias { display: flex; gap: 4px; flex-wrap: wrap; }
.ts-dia { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.ts-dia.on { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); color: var(--primary); border-color: var(--primary); font-weight: 600; }
.ts-dia:disabled { cursor: default; opacity: .7; }

/* QR en pantalla completa (la hostess lo muestra al cliente) */
.ts-qr-pantalla { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 24px; }
.ts-qr-pantalla-caja { background: #fff; color: #1a1d21; border-radius: 20px; padding: 28px; max-width: 520px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.ts-qr-pantalla-caja img { width: min(70vh, 100%); aspect-ratio: 1; margin: 0 auto; }
.ts-qr-pantalla-titulo { font-size: 22px; font-weight: 700; }
.ts-qr-pantalla-sub { color: #4b5563; }

/* Lista de espera (hostess) */
.ts-espera-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
/* Compras: la foto o el PDF del comprobante a la izquierda mientras se completa el formulario. */
.ts-espera-layout > div:has(> .ts-compra-previa) { align-self: stretch; } /* la columna ocupa todo el alto para que la foto quede fija al bajar */
.ts-compra-previa { position: sticky; top: 12px; }
.ts-compra-previa img { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; object-fit: contain; border-radius: 6px; }
.ts-compra-previa iframe { display: block; width: 100%; height: 80vh; border: 0; border-radius: 6px; }
@media (max-width: 1100px) { .ts-compra-previa { position: static; } .ts-compra-previa img { max-height: 50vh; } .ts-compra-previa iframe { height: 60vh; } }
@media (max-width: 1100px) { .ts-espera-layout { grid-template-columns: 1fr; } }
.ts-espera-tabla tbody tr { cursor: pointer; }
.ts-fila-sel { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.ts-fila-aviso { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.ts-tarde { color: var(--danger); }
.ts-nota-cliente { color: var(--text); display: flex; align-items: center; gap: 4px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-chat { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; padding: 4px 0; }
.ts-burbuja { max-width: 85%; padding: 8px 10px; border-radius: 12px; font-size: 13px; }
.ts-burbuja.in { align-self: flex-start; background: var(--surface-3); border-bottom-left-radius: 4px; }
.ts-burbuja.out { align-self: flex-end; background: color-mix(in srgb, var(--primary) 14%, var(--surface)); border-bottom-right-radius: 4px; }
.ts-burbuja.fallo { border: 1px dashed var(--danger); }

/* Celular angosto (hostess con el teléfono): sin desborde horizontal, columnas secundarias ocultas, acciones apiladas */
@media (max-width: 768px) {
  .ts-espera-layout, .ts-espera-lateral { min-width: 0; }
  /* La tabla de esperas pasa a tarjetas (reglas .ts-espera-tabla en panel-ui.css, 25/9). */
  .ts-nota-cliente { max-width: 160px; }
  .ts-page-header { flex-direction: column; align-items: stretch; }
  .ts-page-header .ts-actions { justify-content: flex-start; flex-wrap: wrap; }
}

/* ── Plano del salón (ESPEC_MESA §5.3) ── */
.ts-plano-barra { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.ts-plano-marco { overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); max-height: 72vh; }
.ts-plano-lienzo { position: relative; transform-origin: 0 0;
  background-image: linear-gradient(var(--border-soft) 1px, transparent 1px), linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 20px 20px; }
.ts-plano-lienzo.editando { background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 10px 10px; }
.ts-plano-mesa { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  border: 2px solid var(--ok); background: var(--surface); border-radius: 10px; cursor: pointer; overflow: hidden; line-height: 1.15;
  font-size: 12px; color: var(--text); user-select: none; touch-action: none; box-shadow: 0 1px 2px rgb(0 0 0 / .06); }
.ts-plano-mesa.redonda { border-radius: 50%; }
.ts-plano-mesa strong { font-size: 15px; }
.ts-plano-mesa .ts-plano-sub { font-size: 11px; color: var(--text-muted); max-width: 95%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-plano-mesa.ocupada { border-color: var(--info); background: var(--ts-info-bg); }
.ts-plano-mesa.cuenta { border-color: var(--warn); background: var(--ts-warning-bg); }
.ts-plano-mesa.pagada { border-color: var(--ok); background: var(--ts-success-bg); }
.ts-plano-mesa.reservada { border-color: #7c3aed; background: color-mix(in srgb, #7c3aed 12%, var(--surface)); }
.ts-plano-mesa.fuera { border-color: var(--text-faint); border-style: dashed; background: var(--surface-3); color: var(--text-faint); }
.ts-plano-mesa.sel, .ts-plano-obj.sel { outline: 3px solid var(--ts-brand); outline-offset: 2px; }
.ts-plano-mesa.arrastrando, .ts-plano-obj.arrastrando { opacity: .8; cursor: grabbing; z-index: 5; }
.ts-plano-lienzo.editando .ts-plano-mesa, .ts-plano-lienzo.editando .ts-plano-obj { cursor: grab; }
.ts-plano-llamado { position: absolute; top: 3px; right: 5px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; padding: 0 4px; }
.ts-plano-mesa.redonda .ts-plano-llamado { top: 12%; right: 12%; }
.ts-plano-obj { position: absolute; touch-action: none; user-select: none; }
.ts-plano-obj.pared { background: var(--text-muted); border-radius: 2px; }
.ts-plano-obj.silla { background: var(--surface-3); border: 1px solid var(--text-faint); border-radius: 50%; }
.ts-plano-obj.cuadrado { background: color-mix(in srgb, var(--text-faint) 25%, transparent); border: 1px solid var(--text-faint); border-radius: 4px; }
.ts-plano-obj.redondo { background: color-mix(in srgb, var(--text-faint) 25%, transparent); border: 1px solid var(--text-faint); border-radius: 50%; }
.ts-plano-obj.texto { display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--text-muted); font-size: 14px; white-space: nowrap; }
.ts-plano-manija { position: absolute; right: -1px; bottom: -1px; width: 14px; height: 14px; border: 0; padding: 0; background: var(--ts-brand); border-radius: 3px 0 8px 0; cursor: nwse-resize; }
.ts-plano-leyenda { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.ts-plano-leyenda span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; border: 2px solid var(--ok); background: var(--surface); }
.ts-plano-leyenda .ocupada::before { border-color: var(--info); background: var(--ts-info-bg); }
.ts-plano-leyenda .cuenta::before { border-color: var(--warn); background: var(--ts-warning-bg); }
.ts-plano-leyenda .pagada::before { border-color: var(--ok); background: var(--ts-success-bg); }
.ts-plano-leyenda .reservada::before { border-color: #7c3aed; background: color-mix(in srgb, #7c3aed 12%, var(--surface)); }
.ts-plano-leyenda .fuera::before { border-color: var(--text-faint); border-style: dashed; background: var(--surface-3); }
.ts-plano-pie { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 12px; color: var(--text-faint); }

/* Gastos y resultado (ESPEC_GASTOS §7): estado de resultados con grupos, líneas y totales */
.ts-resultado .ts-resultado-grupo td { font-weight: 600; background: var(--surface-2); }
.ts-resultado .ts-resultado-linea td:first-child { padding-left: 28px; }
.ts-resultado .ts-resultado-linea td { color: var(--text-muted); }
.ts-resultado-total td, tr.ts-resultado-total td { font-weight: 700; border-top: 2px solid var(--border); }
.ts-gasto-neg { color: var(--ts-danger-text); }
.ts-table tr.ts-anulado td { opacity: .55; }
