/* AGENDA */
.agenda-pagina {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0 14px;
    scrollbar-gutter: auto;
}

.app-page-area > .agenda-pagina {
    width: min(1100px, calc(100% - 24px));
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
}

.agenda-panel {
    width: 100%;
    max-width: none;
    margin-bottom: 14px;
}

.agenda-listado-panel {
    margin-bottom: 0;
}

.agenda-alerta {
    border-radius: 7px;
    padding: 9px 12px;
    margin-bottom: 12px;
    font-weight: bold;
}

.agenda-alerta-ok {
    background: #e8f0ff;
    border: 1px solid #2f5fb3;
    color: #17458d;
}

.agenda-alerta-error {
    background: #fff1f1;
    border: 1px solid #c62828;
    color: #8c1d1d;
}

.agenda-form-panel {
    min-height: 218px;
    overflow: hidden;
}

.agenda-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 255px;
    gap: 10px;
    align-items: start;
}

.agenda-formulario {
    min-width: 0;
    display: grid;
    grid-template-columns: 370px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.agenda-form-datos,
.agenda-form-detalle,
.agenda-filtros {
    min-width: 0;
}

.agenda-cabecera {
    margin-bottom: 10px;
}

.agenda-cabecera h2 {
    margin: 0 0 2px;
}

.agenda-cabecera small {
    color: var(--muted);
}

.agenda-datos-grid {
    display: grid;
    grid-template-columns: 1fr 120px;
    column-gap: 16px;
    row-gap: 12px;
    align-items: start;
}

.agenda-campo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agenda-campo label {
    font-size: 12px;
    font-weight: bold;
}

.agenda-campo input,
.agenda-campo select,
.agenda-campo textarea,
.agenda-filtros input,
.agenda-filtros select,
.agenda-estado {
    width: 100%;
    border: 1px solid var(--borde);
    border-radius: 5px;
    background: #fff;
    color: var(--texto);
    padding: 7px 8px;
    font: inherit;
}

.agenda-campo input,
.agenda-campo select,
.agenda-filtros input,
.agenda-filtros select {
    min-height: 35px;
    height: 35px;
}

.agenda-form-detalle {
    display: grid;
    grid-template-rows: auto 35px;
    row-gap: 8px;
    align-items: start;
}

.agenda-campo-detalle textarea {
    min-height: 122px;
    height: 122px;
    max-height: 122px;
    resize: none;
}

.agenda-form-acciones {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.agenda-limpiar {
    background: #6b7280;
}

.agenda-limpiar:hover,
.agenda-ver-todos:hover {
    background: #4b5563;
}

.agenda-filtros {
    display: grid;
    grid-template-rows: 35px 35px 35px 35px;
    gap: 8px;
    padding-top: 18px;
    align-content: start;
}

.agenda-filtros-acciones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.agenda-filtros-acciones .btn {
    width: 100%;
}

.agenda-ver-todos {
    background: #6b7280;
}

.agenda-listado-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.agenda-listado-cabecera h2 {
    margin: 0 0 2px;
}

.agenda-listado-cabecera small {
    color: var(--muted);
}

.agenda-tabla-contenedor {
    overflow-x: auto;
}

.agenda-tabla {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 12px;
}

.agenda-tabla col.col-agenda-fecha { width: 9%; }
.agenda-tabla col.col-agenda-hora { width: 7%; }
.agenda-tabla col.col-agenda-responsable { width: 12%; }
.agenda-tabla col.col-agenda-tarea { width: 19%; }
.agenda-tabla col.col-agenda-detalle { width: 19%; }
.agenda-tabla col.col-agenda-estado { width: 13%; }
.agenda-tabla col.col-agenda-acciones { width: 11%; }

.agenda-tabla th,
.agenda-tabla td {
    border: 1px solid var(--borde);
    padding: 7px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-tabla th {
    background: var(--azul);
    color: #fff;
    text-align: left;
    font-weight: normal;
    white-space: nowrap;
}

.agenda-tabla td:nth-child(1),
.agenda-tabla td:nth-child(2),
.agenda-tabla td:nth-child(3),
.agenda-tabla td:nth-child(6),
.agenda-tabla td:nth-child(7) {
    white-space: nowrap;
}

.agenda-tabla td:nth-child(4),
.agenda-tabla td:nth-child(5) {
    white-space: normal;
    overflow-wrap: anywhere;
}

.agenda-detalle {
    overflow-wrap: anywhere;
}

.agenda-vencida td {
    background: #fff5f5;
}

.agenda-estado {
    width: 100%;
    border: 0;
    border-radius: 14px;
    padding: 5px 7px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
}

.estado-agenda-pendiente {
    background: #fff4cc;
    color: #765600;
}

.estado-agenda-confirmado {
    background: #e8f0ff;
    color: #17458d;
}

.estado-agenda-realizado {
    background: #e5f5e9;
    color: #226232;
}

.estado-agenda-cancelado {
    background: #eceff1;
    color: #455a64;
}

.agenda-acciones-fila {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.agenda-acciones-fila .btn {
    padding: 5px 8px;
    font-size: 11px;
}

.agenda-eliminar {
    background: #c62828;
}

.agenda-eliminar:hover {
    background: #9f1f1f;
}

.agenda-vacia {
    text-align: center;
    color: var(--muted);
    padding: 20px !important;
}

@media (max-width: 1000px) {
    .agenda-form-panel {
        min-height: 0;
        overflow: visible;
    }

    .agenda-form-layout {
        grid-template-columns: 1fr;
    }

    .agenda-formulario {
        grid-template-columns: 1fr;
    }

    .agenda-filtros {
        grid-template-rows: auto;
        grid-template-columns: 1fr 1fr 1fr;
        padding-top: 0;
        margin-top: 10px;
    }

    .agenda-filtros-acciones {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .agenda-datos-grid {
        grid-template-columns: 1fr 1fr;
    }

    .agenda-tabla {
        min-width: 900px;
    }
}

@media (max-width: 520px) {
    .agenda-datos-grid,
    .agenda-filtros {
        grid-template-columns: 1fr;
    }

    .agenda-filtros-acciones {
        grid-column: auto;
    }

    .agenda-form-acciones {
        flex-direction: column;
        align-items: stretch;
    }
}


/* v4.22 - ALINEACIÓN EXACTA Y BOTONES IGUALES */
.agenda-form-acciones,
.agenda-filtros-acciones {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.agenda-form-acciones .btn,
.agenda-filtros-acciones .btn {
    width: 124px;
    min-width: 124px;
    max-width: 124px;
    height: 30px;
    min-height: 30px;
    max-height: 30px;
    box-sizing: border-box;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
}

.agenda-filtros {
    padding-top: 18px;
}


/* v4.23 - MISMA ALTURA EXTERIOR QUE MENSAJES */
.app-page-area > .agenda-pagina > .agenda-form-panel {
    flex: 0 0 202px;
    height: 202px;
    min-height: 202px;
    max-height: 202px;
    box-sizing: border-box;
    overflow: hidden;
}

.agenda-form-layout {
    height: 176px;
    min-height: 176px;
    max-height: 176px;
}

.agenda-form-detalle {
    height: 176px;
    grid-template-rows: 138px 30px;
    row-gap: 8px;
}

.agenda-campo-detalle {
    min-height: 0;
}

.agenda-campo-detalle textarea {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
}

.agenda-filtros {
    height: 176px;
    grid-template-rows: 35px 35px 35px 30px;
    gap: 8px;
    padding-top: 17px;
    box-sizing: border-box;
}

.agenda-form-acciones,
.agenda-filtros-acciones {
    height: 30px;
    min-height: 30px;
    max-height: 30px;
}


/* v4.24 - RESTAURAR SOLO LA ALTURA DEL CAMPO DETALLE */
.agenda-form-detalle {
    align-items: stretch;
}

.agenda-campo-detalle {
    height: 138px;
    min-height: 138px;
    max-height: 138px;
}

.agenda-campo-detalle textarea {
    height: 120px;
    min-height: 120px;
    max-height: 120px;
    flex: 0 0 120px;
}


/* v4.25 - SEPARACIÓN ENTRE INGRESO Y LISTADO */
.app-page-area > .contenedor.agenda-pagina > .agenda-form-panel {
    margin-bottom: 14px !important;
}

.app-page-area > .contenedor.agenda-pagina > .agenda-listado-panel {
    margin-top: 0 !important;
}
