* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 20px;
    padding: 0;
}

.contenedor {
    max-width: 1200px;
    margin: 0 auto;
}

.controles {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#tablaPrincipal {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    word-break: break-word;
}

#tabla1 {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    word-break: break-word;
}

th, td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
    white-space: normal;
    min-width: 15ch; /* 15 caracteres mínimos */
    position: relative;
}

th {
    background-color: #f5f5f5;
    position: sticky;
    top: 0;
    cursor: col-resize;
}

tr:hover {
    background-color: #f1f1f1;
}

.menu-columnas {
    position: relative;
}

.menu-opciones {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    padding: 10px;
    z-index: 1000;
    min-width: 150px;
}

.menu-opciones label {
    display: block;
    margin: 5px 0;
}

.editable {
    background-color: #ffffe0 !important;
}

.highlight {
    background-color: #ffff99 !important;
}

.resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: #ccc;
    cursor: col-resize;
}

@media (max-width: 768px) {
    th, td {
        padding: 8px;
        font-size: 14px;
    }
    
    .col-id { min-width: 5ch; }
    .col-fecha { min-width: 10ch; }
}