/*
 * Estilos del heatmap de cumplimiento de Condiciones de Almacenamiento (temperatura y humedad).
 * Compartidos por las vistas de SEDE (ópticas) y POR ÁREA (oftalmología) — clases con prefijo
 * "thc-" (sin colisión). Global (no scoped) para no duplicar entre ambas páginas.
 * Enlazado en Pages/_Host.cshtml.
 */

.thc-root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1d1d1f;
}

/* ---------- Toolbar ---------- */
.thc-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.thc-spacer {
    flex: 1;
}

.thc-monthnav {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #E6E6E8;
    border-radius: 10px;
    overflow: hidden;
}

.thc-navbtn {
    border: none;
    background: #fff;
    padding: 7px 13px;
    color: #1d1d1f;
    cursor: pointer;
}

.thc-navbtn:hover {
    background: #F5F5F7;
}

.thc-navbtn:disabled {
    color: #C7C7CC;
    cursor: default;
    background: #fff;
}

.thc-monthlbl {
    padding: 7px 16px;
    font-weight: 500;
    border-left: 1px solid #ECECEE;
    border-right: 1px solid #ECECEE;
    min-width: 134px;
    text-align: center;
}

.thc-sortwrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.thc-sortlbl {
    font-size: 13px;
    color: #86868B;
}

.thc-sort {
    height: 34px;
    padding: 0 30px 0 12px;
    border: 1px solid #E6E6E8;
    border-radius: 10px;
    background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    color: #1d1d1f;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.thc-sort:focus {
    border-color: #0A84FF;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, .15);
}

.thc-segment {
    display: inline-flex;
    background: #F1F1F3;
    border-radius: 10px;
    padding: 3px;
    font-size: 13px;
}

.thc-seg {
    border: none;
    background: transparent;
    color: #6e6e73;
    padding: 5px 14px;
    border-radius: 8px;
    cursor: pointer;
}

.thc-seg-on {
    background: #fff;
    color: #1d1d1f;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

/* ---------- KPIs ---------- */
.thc-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.thc-kpi {
    background: #fff;
    border: 1px solid #EFEFF1;
    border-radius: 13px;
    padding: 13px 16px;
}

.thc-kpi-label {
    font-size: 12.5px;
    color: #86868B;
    margin-bottom: 4px;
}

.thc-kpi-num {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -.5px;
    line-height: 1.1;
}

.thc-kpi-unit {
    font-size: 18px;
}

.thc-kpi-danger {
    color: #E5484D;
}

.thc-kpi-bar {
    margin-top: 8px;
}

/* ---------- Progress bars ---------- */
.thc-bar {
    height: 5px;
    border-radius: 3px;
    background: #EDEEF0;
    overflow: hidden;
    flex: 1;
}

.thc-barf {
    height: 100%;
    border-radius: 3px;
}

/* ---------- Loading / empty ---------- */
.thc-loading {
    display: flex;
    align-items: center;
    color: #86868B;
    padding: 28px 4px;
    font-size: 14px;
}

.thc-empty {
    background: #F4F8FF;
    border: 1px solid #E1ECFB;
    color: #3a5a87;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
}

/* ---------- Calendar card ---------- */
.thc-card {
    background: #fff;
    border: 1px solid #ECECEE;
    border-radius: 16px;
    padding: 16px 18px;
}

.thc-scroll {
    overflow-x: auto;
}

.thc-cal {
    border-collapse: separate;
    border-spacing: 0;
    width: auto;
}

/* Sticky first column (entidad: sede o sede·área) */
.thc-name {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    padding: 6px 16px 6px 4px;
    vertical-align: middle;
    white-space: nowrap;
    box-shadow: 8px 0 8px -8px rgba(0, 0, 0, .07);
}

.thc-cal thead .thc-name {
    z-index: 3;
}

.thc-namehead {
    font-size: 12px;
    color: #86868B;
    font-weight: 500;
    vertical-align: bottom;
    padding-bottom: 6px;
}

.thc-sede {
    font-size: 13.5px;
    font-weight: 500;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thc-meter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    width: 150px;
}

.thc-pct {
    font-size: 11.5px;
    font-weight: 600;
    min-width: 32px;
    text-align: right;
}

/* Day header */
.thc-dayhead {
    text-align: center;
    vertical-align: bottom;
    padding: 0 0 6px;
    width: 22px;
}

.thc-daynum {
    font-size: 11.5px;
    color: #1d1d1f;
}

.thc-dayletter {
    font-size: 10px;
    color: #86868B;
    margin-top: 1px;
}

.thc-dim {
    color: #C7C7CC;
}

.thc-today {
    background: #1d1d1f;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    line-height: 18px;
    margin: 0 auto;
    font-weight: 600;
}

/* Day cells */
.thc-daycell {
    text-align: center;
    padding: 3px 2px;
}

.thc-wkstart {
    padding-left: 11px;
}

.thc-row:hover td {
    background: #FAFAFB;
}

.thc-row:hover .thc-name {
    background: #FAFAFB;
}

.thc-cell {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    width: 18px;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    vertical-align: middle;
}

.thc-h {
    flex: 1;
    border-radius: 2px;
}

.thc-wknd {
    background: #F1F2F4;
}

.thc-future {
    border: 1.5px dashed #D9DBDF;
    background: #fff;
}

/* ---------- Legend ---------- */
.thc-legend {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #F0F0F2;
}

.thc-legend-title {
    font-size: 12px;
    color: #86868B;
    font-weight: 500;
    margin-bottom: 9px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.thc-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.thc-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #3a3a3c;
}

.thc-sw {
    display: inline-flex;
    flex-direction: column;
    gap: 1.5px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    overflow: hidden;
}

.thc-sw .thc-h {
    border-radius: 1px;
}

/* ---------- Agrupación por sede (vista por área) ---------- */

/* Banda de sede: una sola celda a todo el ancho, con franja degradada y acento a la izquierda.
   El contenido (nombre + %) queda fijado a la izquierda (sticky) para verse al hacer scroll. */
.thc-groupcell {
    padding: 0;
    background: linear-gradient(90deg, #EAF0FA 0%, #F2F6FC 45%, #FAFCFE 100%);
    border-top: 1px solid #DCE3EF;
    border-bottom: 1px solid #E7ECF4;
    box-shadow: inset 3px 0 0 0 #0A84FF;
}

.thc-grouphdr {
    position: sticky;
    left: 0;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    white-space: nowrap;
}

.thc-grouphdr-icon {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #0A84FF;
    border: 1px solid #DCE3EF;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(10, 60, 120, .06);
}

.thc-grouphdr-name {
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -.2px;
    color: #14213d;
}

.thc-grouphdr-pct {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 4px 11px;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

.thc-grouphdr-pend {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* Filas de área dentro de la sede */
.thc-area {
    font-size: 13px;
    font-weight: 500;
    padding-left: 18px;
    max-width: 230px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thc-meter-area {
    padding-left: 18px;
    width: 168px;
}

/* ---------- Subsanar: celda clickeable ---------- */
.thc-click {
    cursor: pointer;
    transition: filter .12s ease, box-shadow .12s ease;
}

.thc-click:hover {
    filter: brightness(1.06) saturate(1.1);
    box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .28);
}

/* ---------- Formulario del modal (cuerpo provisto a UxModal) ---------- */
.thc-fieldrow {
    display: flex;
    gap: 14px;
}

.thc-field {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.thc-field-label {
    font-size: 13px;
    font-weight: 500;
    color: #3a3a3c;
}

.thc-input {
    width: 100%;
    box-sizing: border-box;
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid #E0E2E6;
    border-radius: 10px;
    font-size: 15px;
    color: #1d1d1f;
    outline: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.thc-input:focus {
    border-color: #0A84FF;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, .15);
}

.thc-input-err {
    border-color: #E0362B;
}

.thc-input-err:focus {
    border-color: #E0362B;
    box-shadow: 0 0 0 3px rgba(224, 54, 43, .15);
}

.thc-field-err {
    font-size: 12px;
    color: #C0362C;
}

.thc-modal-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 9px 11px;
    border-radius: 9px;
    background: #FDECEC;
    color: #C0362C;
    font-size: 13px;
}

/* ---------- Modal multi-categoría (control de residuos) ---------- */
.thc-modal-hint {
    margin: 0 0 14px;
    font-size: 13px;
    color: #6b6b70;
}

.thc-modal-group {
    margin-bottom: 16px;
}

.thc-modal-grouptitle {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #8a8a8e;
    padding-bottom: 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid #EEF0F2;
}

/* Grilla fluida: el ancho de cada campo manda, así fluye sola 4→3→2→1 columnas según el espacio
   disponible (en el modal Large da 4; al encogerse, baja sin breakpoints). Totalmente responsive.
   auto-fill (no auto-fit): mantiene el ancho de columna constante entre grupos con distinto número
   de campos, para que todos los inputs queden del mismo tamaño y alineados. */
.thc-fieldgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
    align-items: end;
}

/* Ítem de labor (control de limpieza): checkbox + nombre, en la grilla del modal. */
.thc-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1d1d1f;
    cursor: pointer;
    min-height: 34px;
}

.thc-check input {
    width: 16px;
    height: 16px;
    flex: none;
    cursor: pointer;
    accent-color: #0A84FF;
}

/* Reserva 2 líneas para TODA etiqueta del grid, así los inputs de una misma fila quedan alineados
   aunque unas etiquetas ocupen una línea y otras dos. Scope: solo la grilla de residuos. */
.thc-fieldgrid .thc-field-label {
    line-height: 1.3;
    min-height: 2.6em;
    display: flex;
    align-items: flex-end;
}
