* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
    color: #000000;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e5e5e5;
}

header {
    background: #ffffff;
    color: #000000;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 2px solid #e5e5e5;
}

header h1 {
    font-size: 2em;
    font-weight: 600;
}

nav a {
    color: #000000;
    text-decoration: none;
    padding: 10px 20px;
    background: #f5f5f5;
    border-radius: 6px;
    transition: background 0.3s;
    font-weight: 500;
    border: 1px solid #e5e5e5;
}

nav a:hover {
    background: #e5e5e5;
}

main {
    padding: 40px;
}

.form-container h2 {
    margin-bottom: 30px;
    color: #000000;
    font-size: 1.8em;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Formulario vertical en móvil */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
    background-color: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #000000;
}

.form-group select {
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    text-transform: uppercase;
}

.form-group select {
    text-transform: uppercase;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #000000;
    color: white;
    border: 1px solid #000000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #1a1a1a;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #e0e0e0;
    color: #555;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.mensaje {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
}

.mensaje-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.mensaje-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.alert {
    padding: 15px;
    margin: 20px;
    border-radius: 6px;
    font-weight: 500;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.summary {
    margin: 30px;
    padding: 25px;
    background: #f5f5f5;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.summary h2 {
    margin-bottom: 20px;
    color: #000000;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-card.highlight {
    border: 2px solid #000000;
    background: #ffffff;
}

.summary-card.highlight .label {
    color: #000000;
    font-weight: 600;
}

.summary-card .label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.summary-card .value {
    font-size: 1.5em;
    font-weight: 700;
}

.value.positive {
    color: #28a745;
}

.value.negative {
    color: #dc3545;
}

.summary-title-container {
    margin: 30px 30px 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.summary-title {
    color: #000000;
    font-size: 1.8em;
    font-weight: 600;
    margin: 0;
    padding: 0;
    flex: 1;
}

.mes-selector {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    background-color: white;
    color: #000000;
    cursor: pointer;
    transition: border-color 0.3s;
    min-width: 200px;
}

.mes-selector:focus {
    outline: none;
    border-color: #000000;
}

.summary-grid-main {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 30px;
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
}

.summary-grid-main > .summary-card-large {
    flex: 1;
    min-width: 300px;
    max-width: 100%;
}

.summary-card-large {
    background: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    border: 2px solid #d0d0d0;
}

.summary-card-large h2 {
    margin: 0 0 20px 0;
    color: #000000;
    font-size: 1.5em;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e5e5;
}

.summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.summary-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f5f5f5;
}

.summary-list li:last-child {
    border-bottom: none;
}

.summary-list li.highlight-item {
    border-top: 2px solid #000000;
    padding-top: 20px;
    margin-top: 10px;
}

.summary-list li .label {
    font-size: 1em;
    color: #666;
    font-weight: 500;
}

.summary-list li .value {
    font-size: 1.3em;
    font-weight: 700;
}

.summary-list li.highlight-item .label {
    color: #000000;
    font-weight: 600;
}

.table-container {
    margin: 30px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e5e5;
}

.data-table thead {
    background: #f5f5f5;
    color: #000000;
    border-bottom: 2px solid #e5e5e5;
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f5f5f5;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr.usuario-manuel {
    background: #e8e8e8;
}

.data-table tbody tr.usuario-manuel:hover {
    background: #d8d8d8;
}

.data-table tbody tr.nuevo-dia td {
    padding-top: 25px;
    border-top: 15px solid #f5f5f5 !important;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.observaciones-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

.edit-form-container {
    margin-bottom: 40px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: border-color 0.3s;
}

.edit-form-container:hover {
    border-color: #000000;
}

.edit-form-container h4 {
    margin-bottom: 20px;
    color: #000000;
    font-size: 1.2em;
    border-bottom: 2px solid #000000;
    padding-bottom: 10px;
}

/* Navegación de fechas en resumen diario */
.nav-fecha {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.nav-fecha-arrow {
    text-decoration: none;
    color: #000000;
    font-size: 1.5em;
    padding: 5px 10px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    transition: background 0.3s;
    cursor: pointer;
}

.nav-fecha-arrow:hover {
    background: #e5e5e5;
}

.nav-fecha-arrow:disabled,
.nav-fecha-arrow.disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #f5f5f5;
}

.nav-fecha-title {
    margin: 0;
    color: #000000;
    font-size: 1.3em;
    text-align: center;
    flex: 1;
    min-width: 200px;
}

/* Calendario Modal */
.calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.calendar-container {
    position: relative;
    z-index: 1002;
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e5e5;
}

.calendar-header h3 {
    margin: 0;
    color: #000000;
    font-size: 1.2em;
    font-weight: 600;
}

.calendar-nav-btn {
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 8px 15px;
    cursor: pointer;
    color: #000000;
    font-size: 1.2em;
    transition: background 0.3s;
}

.calendar-nav-btn:hover {
    background: #e5e5e5;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.calendar-weekdays div {
    text-align: center;
    font-weight: 600;
    color: #000000;
    font-size: 0.9em;
    padding: 8px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #ffffff;
    color: #000000;
    font-size: 0.95em;
    transition: all 0.2s;
}

.calendar-day.empty {
    border: none;
    background: transparent;
}

.calendar-day.has-records {
    background: #f0f0f0;
    border-color: #000000;
    font-weight: 600;
}

.calendar-day.has-records:hover {
    background: #000000;
    color: #ffffff;
}

.calendar-day.selected {
    background: #000000;
    color: #ffffff;
    font-weight: 700;
    border-color: #000000;
}

.calendar-day.selected.has-records {
    background: #000000;
    color: #ffffff;
}

.calendar-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e5e5e5;
    text-align: center;
}

@media (max-width: 768px) {
    .edit-form-container {
        padding: 15px;
        margin-bottom: 30px;
    }
    
    .edit-form-container h4 {
        font-size: 1em;
    }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state a {
    color: #000000;
    text-decoration: none;
    font-weight: 600;
}

.empty-state a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 8px;
    }

    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px 15px;
    }

    header h1 {
        font-size: 1.4em;
        margin: 0;
    }

    nav a {
        display: block;
        width: 100%;
        text-align: center;
        padding: 12px;
    }

    main {
        padding: 20px 15px;
    }

    .form-container h2 {
        font-size: 1.4em;
        margin-bottom: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 18px;
        margin-bottom: 25px;
    }

    .form-group label {
        font-size: 0.9em;
        margin-bottom: 6px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 14px;
        font-size: 16px; /* Evita zoom en iOS */
        border-radius: 8px;
        width: 100%;
        -webkit-appearance: none;
        appearance: none;
    }

    .form-group textarea {
        min-height: 120px;
    }

    .form-group select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 40px;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
        margin-top: 25px;
    }

    .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 1em;
        border-radius: 8px;
    }

    .mensaje {
        padding: 12px;
        font-size: 0.9em;
        margin-bottom: 15px;
    }

    .summary {
        margin: 15px;
        padding: 20px 15px;
    }

    .summary h2 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    .summary-title-container {
        margin: 15px 15px 10px 15px;
        flex-direction: column;
        align-items: flex-start;
    }

    .summary-title {
        font-size: 1.5em;
        width: 100%;
    }

    .mes-selector {
        width: 100%;
        min-width: auto;
    }

    .summary-grid-main {
        flex-direction: column;
        gap: 15px;
        margin: 15px;
        padding: 15px;
    }

    .summary-grid-main > .summary-card-large {
        min-width: 100%;
    }

    .summary-card-large {
        padding: 20px 15px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
        border: 2px solid #d0d0d0;
    }

    .summary-card-large h2 {
        font-size: 1.3em;
        margin-bottom: 15px;
        padding-bottom: 12px;
    }

    .summary-list li {
        padding: 12px 0;
    }

    .summary-list li .label {
        font-size: 0.95em;
    }

    .summary-list li .value {
        font-size: 1.2em;
    }

    .summary-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .summary-card {
        padding: 15px;
    }

    .summary-card .value {
        font-size: 1.3em;
    }

    .table-container {
        margin: 15px 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        font-size: 0.8em;
        min-width: 800px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
        white-space: nowrap;
    }

    .data-table th {
        font-size: 0.75em;
        padding: 12px 8px;
    }

    /* Resumen diario compacto en móvil */
    .summary {
        margin: 15px 10px !important;
        padding: 15px 10px !important;
    }

    .summary h2 {
        font-size: 1.1em !important;
        margin-bottom: 15px !important;
    }

    .summary-grid {
        gap: 10px !important;
    }

    .summary-card {
        padding: 12px !important;
    }

    .summary-card .label {
        font-size: 0.8em !important;
    }

    .summary-card .value {
        font-size: 1.1em !important;
    }

    .nav-fecha {
        gap: 10px !important;
        margin-bottom: 15px !important;
    }

    .nav-fecha-arrow {
        min-width: 35px !important;
        height: 35px !important;
        font-size: 1.3em !important;
    }

    .nav-fecha-title {
        font-size: 1.1em !important;
        min-width: 150px !important;
    }

    .calendar-container {
        padding: 15px !important;
        max-width: 95% !important;
    }

    .calendar-header h3 {
        font-size: 1em !important;
    }

    .calendar-nav-btn {
        padding: 6px 12px !important;
        font-size: 1em !important;
    }

    .calendar-weekdays div {
        font-size: 0.8em !important;
        padding: 6px 0 !important;
    }

    .calendar-day {
        font-size: 0.85em !important;
    }

    .table-container {
        margin: 15px 10px !important;
    }

    .table-container h3 {
        font-size: 1em !important;
        margin-bottom: 10px !important;
    }
}

/* Optimización para pantallas muy pequeñas */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    header {
        padding: 15px 10px;
    }

    header h1 {
        font-size: 1.2em;
    }

    main {
        padding: 15px 10px;
    }

    .form-container h2 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    .form-grid {
        gap: 15px;
    }

    .form-group input,
    .form-group select {
        padding: 12px;
    }
}

