:root {
    --color-texto:      #1a1c2c;
    --color-rojo:       #e31b23;
    --color-rojo-hover: #b3141a;
    --color-verde:      #3b6d11;
    --color-verde-bg:   #e8f5e9;
    --gris-fondo:       #f6f8fb;
}

/* ── Cabecera de sección ─────────────────────────────────── */
.header-admin {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 32px 16px;
}

.header-admin h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-texto);
    margin: 0 0 4px;
}

.subtitulo {
    font-size: 0.88rem;
    color: #595959;
    margin: 0;
}

hr {
    border: none;
    border-top: 1px solid #e8e8e8;
    margin: 0 32px 24px;
}

/* ── Cuadrícula de pedidos ───────────────────────────────── */
.cuadricula_reservas {
    padding: 0 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ── Bloque por usuario ──────────────────────────────────── */
.usuario-grupo {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.nombre-cliente {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    background: var(--color-texto);
    padding: 12px 20px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nombre-cliente span:not(.badge-pendientes-header) {
    opacity: .65;
    font-weight: 400;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0;
}

.badge-pendientes-header {
    background: var(--color-rojo);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 20px;
    text-transform: none;
    letter-spacing: 0;
    opacity: 1;
}

/* ── Lista de pedidos ────────────────────────────────────── */
.lista-reservas {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Tarjeta individual ──────────────────────────────────── */
.item-reserva {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background .15s;
}

.item-reserva:last-child {
    border-bottom: none;
}

.item-reserva:hover {
    background: #fafafa;
}

/* ── Imagen ──────────────────────────────────────────────── */
.item-reserva img {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: 10px;
    background: #ebebeb;
    flex-shrink: 0;
}

/* ── Info del pedido ─────────────────────────────────────── */
.item-info {
    flex: 1;
    min-width: 0;
}

.item-info .nombre {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-texto);
    margin: 0 0 3px;
}

.item-info .descripcion {
    font-size: 0.88rem;
    color: #666;
    margin: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.badge-cantidad {
    font-size: 0.82rem;
    font-weight: 600;
    color: #444;
    background: #f0f0f5;
    border: 1px solid #e0e0e8;
    border-radius: 20px;
    padding: 2px 9px;
}

.badge-pendiente {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: #b45309;
    border-radius: 20px;
    padding: 2px 9px;
}

.badge-realizado {
    font-size: 0.78rem;
    font-weight: 700;
    color: #2e7d32;
    background: var(--color-verde-bg);
    border-radius: 20px;
    padding: 2px 9px;
}

.badge-fecha {
    font-size: 0.78rem;
    font-weight: 600;
    color: #3a5fbf;
    background: #eef2ff;
    border: 1px solid #c7d2f8;
    border-radius: 20px;
    padding: 2px 9px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Fila con retraso ────────────────────────────────────── */
.item-reserva-retraso {
    border-left: 4px solid #e31b23;
    background: #fff8f8;
    flex-wrap: wrap;
    padding-left: 16px;
}

.banner-retraso {
    width: 100%;
    background: #e31b23;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 4px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Badge tiempo restante ───────────────────────────────── */
.badge-tiempo {
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 20px;
    padding: 2px 9px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-tiempo-ok {
    color: #2e7d32;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}

.badge-tiempo-urgente {
    color: #b45309;
    background: #fff7ed;
    border: 1px solid #fcd34d;
}

.badge-tiempo-hoy {
    color: #c2410c;
    background: #fff1ee;
    border: 1px solid #fca5a5;
}

.badge-tiempo-vencido {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fca5a5;
}

.badge-mensaje {
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
    background: #f0f0f5;
    border: 1px solid #e0e0e8;
    border-radius: 20px;
    padding: 2px 9px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-mensaje-btn {
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.badge-mensaje-btn:hover {
    background: #e0e0f0;
    border-color: #b0b0d0;
    color: #222;
}

.item-mensaje {
    font-size: 0.82rem;
    color: #595959;
    font-style: italic;
    margin: 6px 0 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ── Bloque precio + botones ─────────────────────────────── */
.item-accion {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.precio-unit {
    font-size: 0.83rem;
    color: #767676;
    white-space: nowrap;
    text-align: right;
    margin: 0;
}

.item-accion .precio {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-texto);
    white-space: nowrap;
    min-width: 72px;
    text-align: right;
    margin: 0;
}

.contador {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Botón completar ─────────────────────────────────────── */
.btn-completar {
    background: var(--color-verde);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    transition: background .2s, transform .1s;
    white-space: nowrap;
}

.btn-completar:hover {
    background: #2d5a0d;
    transform: translateY(-1px);
}

/* ── Botón eliminar ──────────────────────────────────────── */
.btn-eliminar {
    background: var(--color-rojo);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    transition: background .2s, transform .1s;
    white-space: nowrap;
}

.btn-eliminar:hover {
    background: var(--color-rojo-hover);
    transform: translateY(-1px);
}

.btn-eliminar:active,
.btn-completar:active {
    transform: translateY(0);
}

/* ── Fila total por usuario ──────────────────────────────── */
.fila-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f6f8fb;
    border-top: 1px solid #e8e8e8;
    font-size: 0.92rem;
    color: #666;
}

.total-importe {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-texto);
}

/* ── Estado vacío ────────────────────────────────────────── */
.vacio-contenedor {
    text-align: center;
    padding: 60px 0;
}

.vacio {
    font-size: 1rem;
    color: #ccc;
}

/* ── Modal overlay ───────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 28, 44, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-width: 420px;
    padding: 32px 28px 28px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,.18);
    animation: slideUp .25s ease-out;
}

.modal-header i {
    font-size: 2.8rem;
    color: var(--color-rojo);
    margin-bottom: 12px;
    display: block;
    text-align: center;
}

.modal-content h2 {
    text-align: center;
    color: var(--color-texto);
    margin: 0 0 8px;
    font-size: 1.4rem;
}

.modal-descripcion {
    text-align: center;
    color: #777;
    font-size: 0.88rem;
    margin-bottom: 22px;
    line-height: 1.5;
}

/* ── Textarea ────────────────────────────────────────────── */
.campo-nota {
    margin-bottom: 22px;
}

.campo-nota label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.campo-nota textarea {
    width: 100%;
    min-height: 88px;
    padding: 11px 13px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #f9f9f9;
    font-family: inherit;
    font-size: 0.88rem;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
}

.campo-nota textarea:focus {
    outline: none;
    border-color: var(--color-rojo);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(227, 27, 35, 0.1);
}

/* ── Botones del modal ───────────────────────────────────── */
.modal-actions {
    display: flex;
    gap: 10px;
}

.btn-cancelar, .btn-confirmar-borrar, .btn-confirmar-completar {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: background .2s, transform .1s;
}

.btn-cancelar {
    background: #f0f0f0;
    color: #666;
}

.btn-cancelar:hover { background: #e5e5e5; }

.btn-confirmar-borrar {
    background: var(--color-rojo);
    color: #fff;
}

.btn-confirmar-borrar:hover { background: var(--color-rojo-hover); }

.btn-confirmar-completar {
    background: var(--color-verde);
    color: #fff;
}

.btn-confirmar-completar:hover { background: #2d5a0d; }

/* ── Modal nota ──────────────────────────────────────────── */
.modal-nota-content {
    max-width: 500px;
    padding: 0;
    overflow: hidden;
    position: relative;
}

.modal-nota-header {
    background: var(--color-texto);
    padding: 22px 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.modal-nota-icon {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    flex-shrink: 0;
}

.modal-nota-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    margin: 0 0 2px;
}

.modal-nota-titulo {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.modal-nota-cuerpo {
    padding: 24px 24px 16px;
    background: #f4f5f9;
    margin: 20px 20px 0;
    border-radius: 14px;
    position: relative;
}

.modal-nota-texto {
    font-size: 1.18rem;
    font-weight: 500;
    color: #1a1c2c;
    line-height: 1.75;
    margin: 8px 0 6px;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 0 4px;
    letter-spacing: 0.01em;
}

.modal-nota-content .modal-actions {
    padding: 20px 24px 24px;
}

/* ── Animación modal ─────────────────────────────────────── */
@keyframes slideUp {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Responsive tablet ───────────────────────────────────── */
@media (max-width: 768px) {
    .header-admin { padding: 20px 20px 12px; }
    hr { margin: 0 20px 18px; }
    .cuadricula_reservas { padding: 0 20px 32px; }
    .item-reserva { gap: 12px; padding: 12px 16px; }
    .item-reserva img { width: 56px; height: 56px; }
    .btn-completar, .btn-eliminar { font-size: 0.8rem; padding: 7px 10px; }
}

/* ── Responsive móvil ────────────────────────────────────── */
@media (max-width: 480px) {
    .header-admin { padding: 16px 14px 10px; }
    hr { margin: 0 14px 14px; }
    .cuadricula_reservas { padding: 0 14px 24px; gap: 20px; }

    .item-reserva {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
    }

    .item-accion {
        width: 100%;
        justify-content: space-between;
        padding-left: calc(56px + 10px);
        flex-wrap: wrap;
    }

    .item-reserva img { width: 52px; height: 52px; }
    .contador { flex-wrap: wrap; }
}
