body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f9;
    color: #222;
}

a {
    color: inherit;
}

* {
    box-sizing: border-box;
}

/* LOGIN */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #ff7043, #ffb74d);
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    box-sizing: border-box;
    box-shadow: 0 12px 34px rgba(0,0,0,.18);
}

.login-box h1 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 32px;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-box p {
    margin-top: 0;
    margin-bottom: 20px;
    color: #5f6b7a;
}

/* CONTENEDOR GENERAL */
.contenedor {
    max-width: 1280px;
    margin: auto;
    padding: 18px;
}

/* INPUTS GENERALES */
.input-text,
.select-estado,
.input-textarea,
.input-file {
    width: 100%;
    display: block;
    padding: 14px 16px;
    box-sizing: border-box;
    margin-top: 6px;
    border: 1px solid #d8dee8;
    border-radius: 14px;
    font-size: 15px;
    background: #fff;
    transition: all 0.2s ease;
}

.input-textarea {
    min-height: 110px;
    resize: vertical;
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

.input-text:focus,
.select-estado:focus,
.input-textarea:focus,
.input-file:focus,
.input-tabla:focus,
.select-tabla:focus,
.input-tabla-area:focus {
    outline: none;
    border-color: #d84315;
    box-shadow: 0 0 0 3px rgba(216, 67, 21, 0.12);
}

.input-text::placeholder,
.input-textarea::placeholder,
.input-tabla::placeholder,
.input-tabla-area::placeholder {
    color: #9aa4b2;
}

/* BOTONES */
.btn-principal,
.btn-salir,
.btn-secundario {
    display: inline-block;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.btn-principal:hover,
.btn-secundario:hover,
.btn-salir:hover {
    transform: translateY(-1px);
    opacity: 0.96;
}

.btn-principal {
    background: #d84315;
    color: #fff;
    box-shadow: 0 8px 18px rgba(216, 67, 21, 0.18);
}

.btn-secundario {
    background: #455a64;
    color: #fff;
    box-shadow: 0 8px 18px rgba(69, 90, 100, 0.16);
}

.btn-salir {
    background: #c81e1e;
    color: #fff;
    box-shadow: 0 8px 18px rgba(200, 30, 30, 0.16);
}

.btn-ancho-completo {
    width: 100%;
}

.btn-mini {
    padding: 10px 12px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.btn-sonido {
    background: #facc15; /* amarillo */
    color: #000;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.btn-sonido:hover {
    background: #eab308;
}

.btn-sonido:active {
    transform: scale(0.97);
}

/* ALERTAS */
.alerta {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    font-weight: bold;
}

.alerta.error {
    background: #fff0f0;
    color: #b42318;
    border-color: #f1b4b4;
}

.alerta.exito,
.exito {
    background: #e9f8ee;
    color: #17653a;
    border-color: #bfe5c9;
}

/* CABECERAS */
.barra-superior {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.barra-superior h1 {
    margin: 0 0 6px 0;
    font-size: 30px;
}

.acciones-top {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.texto-menor,
.texto-menor-admin {
    color: #5f6b7a;
    font-size: 14px;
    margin: 0;
}

/* CONTADOR */
.contador-nuevos {
    background: #1976d2;
    color: #fff;
    font-weight: bold;
    padding: 10px 14px;
    border-radius: 12px;
    min-width: 100px;
    text-align: center;
    box-shadow: 0 8px 18px rgba(25, 118, 210, 0.18);
}

/* LEYENDA */
.leyenda {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.badge {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}

.estado-registrado { background: #e3f2fd; color: #0d47a1; }
.estado-preparacion { background: #fff3e0; color: #e65100; }
.estado-recojo { background: #f3e5f5; color: #6a1b9a; }
.estado-despacho { background: #e8f5e9; color: #1b5e20; }

/* FILTROS */
.filtros {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 14px;
    margin-bottom: 18px;
    background: #fff;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,.06);
    border: 1px solid #eef1f6;
}

.filtro-item label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

.filtro-item .input-text,
.filtro-item .select-estado {
    margin-bottom: 0;
}

/* TARJETAS PEDIDOS */
.card-pedido {
    background: #fff;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,.06);
    border-left: 8px solid #ccc;
}

.fila-registrado { border-left-color: #1976d2; background: #f5fbff; }
.fila-preparacion { border-left-color: #ef6c00; background: #fff8f1; }
.fila-recojo { border-left-color: #8e24aa; background: #fcf6ff; }
.fila-despacho { border-left-color: #2e7d32; background: #f5fff7; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.estado-actual {
    font-weight: bold;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(0,0,0,.06);
}

.grid-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.bloque-info {
    margin-bottom: 10px;
    line-height: 1.5;
}

/* TABLAS */
.tabla-responsive {
    overflow-x: auto;
    margin-top: 8px;
}

.tabla-detalle {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

.tabla-detalle th,
.tabla-detalle td {
    border: 1px solid #e2e8f0;
    padding: 10px 8px;
    text-align: left;
    font-size: 14px;
    vertical-align: top;
}

.tabla-detalle th {
    background: #f8fafc;
    font-weight: bold;
}

.form-estado {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 12px;
}

.form-estado .select-estado {
    max-width: 260px;
    margin: 0;
}

.sin-registros {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0,0,0,.06);
    border: 1px solid #eef1f6;
}

/* ADMIN PRODUCTOS */
.admin-body {
    background: #f4f6fb;
}

.barra-admin h1 {
    margin-bottom: 6px;
}

.panel-admin-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 18px;
    margin-bottom: 18px;
}

.panel-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 10px 24px rgba(28, 39, 60, 0.08);
    border: 1px solid #eef1f6;
    margin-bottom: 18px;
}

.panel-card h2 {
    margin-top: 0;
}

.panel-card-header h2 {
    margin: 0 0 6px 0;
    font-size: 28px;
}

.panel-card-header p {
    margin: 0 0 16px 0;
    color: #6b7280;
    font-size: 14px;
}

.form-profesional .campo {
    margin-bottom: 16px;
}

.form-profesional label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.campo-completo {
    grid-column: 1 / -1;
}

/* INPUT CON ICONO PRECIO */
.input-con-icono {
    position: relative;
}

.input-prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #d84315;
    font-weight: bold;
    z-index: 2;
}

.input-precio {
    padding-left: 48px;
}

/* VISTA PREVIA */
.preview-box {
    width: 100%;
    min-height: 220px;
    border: 2px dashed #d8dee8;
    border-radius: 16px;
    background: #fafbfc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
}

.preview-imagen {
    max-width: 100%;
    max-height: 320px;
    border-radius: 14px;
    object-fit: contain;
    display: block;
}

.preview-vacio {
    color: #7b8794;
    font-size: 14px;
    text-align: center;
}

/* TABLA PRODUCTOS */
.tabla-productos {
    min-width: 1450px;
}

.input-tabla,
.select-tabla {
    width: 100%;
    padding: 10px 12px;
    box-sizing: border-box;
    border: 1px solid #d8dee8;
    border-radius: 10px;
    font-size: 13px;
    background: #fff;
    display: block;
}

.input-tabla-area {
    width: 100%;
    min-width: 220px;
    min-height: 90px;
    padding: 10px 12px;
    box-sizing: border-box;
    border: 1px solid #d8dee8;
    border-radius: 10px;
    font-size: 13px;
    resize: vertical;
    font-family: Arial, sans-serif;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    display: block;
}

.input-con-icono-tabla {
    position: relative;
}

.input-prefix-tabla {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #d84315;
    font-weight: bold;
    font-size: 13px;
}

.input-tabla-precio {
    padding-left: 38px;
}

/* IMAGENES EN ADMIN */
.celda-imagen-admin {
    min-width: 90px;
    width: 90px;
}

.miniatura-producto {
    width: 31px;
    height: 32px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.miniatura-vacia {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    text-align: center;
    padding: 2px;
    overflow: hidden;
}

.input-file-tabla {
    width: 100%;
    font-size: 11px;
}

.badge-estado-producto {
    display: inline-block;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
}

.badge-activo {
    background: #e8f5e9;
    color: #1b5e20;
}

.badge-inactivo {
    background: #ffebee;
    color: #b71c1c;
}

.fila-activo {
    background: #fcfffc;
}

.fila-inactivo {
    background: #fff8f8;
    opacity: 0.92;
}

.acciones-celda {
    display: flex;
    gap: 8px;
    flex-direction: column;
    min-width: 130px;
}

/* RESPONSIVE */
@media (max-width: 980px) {
    .panel-admin-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .panel-admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .filtros {
        grid-template-columns: 1fr;
    }

    .grid-info {
        grid-template-columns: 1fr;
    }

    .form-estado {
        flex-direction: column;
        align-items: stretch;
    }

    .form-estado .select-estado,
    .btn-principal,
    .btn-secundario,
    .btn-salir {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

    .card-pedido {
        padding: 14px;
    }

    .acciones-top {
        width: 100%;
    }

    .contador-nuevos {
        flex: 1;
    }

    .panel-card {
        padding: 16px;
    }

    .panel-card-header h2 {
        font-size: 24px;
    }

    .login-box {
        padding: 22px;
    }

    .miniatura-producto {
        width: 32px;
        height: 32px;
    }

    .miniatura-vacia {
        width: 32px;
        height: 32px;
        font-size: 9px;
    }
}