:root {
    --verde-oscuro: #1b4d2e;
    --verde: #2e7d32;
    --verde-claro: #66bb6a;
    --crema: #f5f1e8;
    --naranja: #ff8f00;
    --texto: #333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    color: var(--texto);
    background-color: var(--crema);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--verde-oscuro);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo a {
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    letter-spacing: 1px;
}

.nav a {
    color: #d0e8d0;
    text-decoration: none;
    margin-left: 1.5rem;
    transition: color 0.3s;
}

.nav a:hover {
    color: var(--naranja);
}

.site-main {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.hero {
    text-align: center;
    background: linear-gradient(rgba(27, 77, 46, 0.8), rgba(27, 77, 46, 0.8)),
                repeating-linear-gradient(45deg, transparent, transparent 15px, rgba(255, 255, 255, 0.05) 15px, rgba(255, 255, 255, 0.05) 30px);
    color: #fff;
    padding: 4rem 2rem;
    border-radius: 12px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    background: var(--naranja);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.2s, background 0.2s;
}

.btn:hover {
    background: #e67e00;
    transform: scale(1.05);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature {
    background: #fff;
    border-top: 5px solid var(--verde);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.feature h2 {
    color: var(--verde-oscuro);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--verde-oscuro);
    color: #cde5cd;
    font-size: 0.9rem;
}

/* ===== Login ===== */
.auth-body {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--verde-oscuro), var(--verde));
}

.auth-card {
    background: #fff;
    width: 100%;
    max-width: 380px;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.auth-logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--verde-oscuro);
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: #777;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.auth-form {
    text-align: left;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--texto);
}

.form-group input {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.btn-block {
    width: 100%;
    border: none;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn-primary {
    background: var(--verde);
}

.btn-primary:hover {
    background: var(--verde-oscuro);
}

.alert {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: left;
}

.alert-error {
    background: #fdecea;
    color: #b71c1c;
    border: 1px solid #f5c6cb;
}

.auth-footer {
    margin-top: 1.25rem;
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--verde);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ===== Dashboard ===== */
.welcome-text {
    margin: 1rem 0 1.5rem;
    color: #555;
}

.user-badge {
    background: var(--naranja);
    color: #fff;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 1.5rem;
    text-transform: capitalize;
}

.time-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.time-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--verde-oscuro);
    margin: 0.5rem 0;
}

.time-note {
    font-size: 0.85rem;
    color: #888;
}

/* ===== Panel (menú lateral) ===== */
.panel-body {
    background: var(--crema);
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 252px;
    background: var(--verde-oscuro);
    color: #cde5cd;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar-brand {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-brand a {
    color: #fff;
    font-size: 1.4rem;
    font-weight: bold;
    text-decoration: none;
    letter-spacing: 1px;
    white-space: nowrap;
}

.brand-short {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.nav-section {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 1px;
    color: var(--verde-claro);
    padding: 1rem 1.5rem 0.3rem;
    font-weight: 700;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.5rem;
    color: #d0e8d0;
    text-decoration: none;
    font-size: 0.92rem;
    transition: background 0.2s, color 0.2s;
    border-left: 3px solid transparent;
    min-height: 44px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.nav-link.active {
    background: rgba(46, 125, 50, 0.55);
    color: #fff;
    border-left-color: var(--naranja);
}

.nav-icon {
    width: 1.4rem;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.3rem 0;
}

.panel-content {
    flex: 1;
    margin-left: 252px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.panel-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    padding: 0.8rem 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 20;
}

.panel-topbar h2 {
    font-size: 1.15rem;
    color: var(--verde-oscuro);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-toggle {
    background: var(--verde);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.15rem;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    min-height: 44px;
    min-width: 46px;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--verde-oscuro);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.topbar-user .user-badge {
    margin-left: 0;
}

.topbar-name {
    color: var(--verde-oscuro);
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel-main {
    flex: 1;
    padding: 1.5rem;
}

.panel-welcome {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    margin-top: 1rem;
    color: #555;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: #fff;
    border-top: 5px solid var(--verde);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-card h3 {
    color: var(--verde-oscuro);
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

/* ===== Sidebar colapsado a iconos (PC) ===== */
.sidebar.icon-nav {
    width: 68px;
}

.sidebar.icon-nav .brand-full {
    display: none;
}

.sidebar.icon-nav .brand-short {
    display: block;
    font-size: 1.15rem;
    letter-spacing: 0;
}

.sidebar.icon-nav .sidebar-brand {
    padding: 1.2rem 0.5rem;
    text-align: center;
}

.sidebar.icon-nav .nav-section {
    display: none;
}

.sidebar.icon-nav .nav-link {
    justify-content: center;
    padding: 0.65rem 0;
    gap: 0;
}

.sidebar.icon-nav .nav-label {
    display: none;
}

.sidebar.icon-nav .nav-icon {
    width: auto;
}

.panel-content.expanded {
    margin-left: 68px;
}

/* ===== Backdrop (móvil/tablet) ===== */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 25;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* ===== Tablet y móvil: menú como cortina (drawer) ===== */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-104%);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.icon-nav {
        transform: translateX(-104%);
        width: 252px;
    }

    .sidebar.icon-nav .brand-full { display: block; }
    .sidebar.icon-nav .brand-short { display: none; }
    .sidebar.icon-nav .sidebar-brand { padding: 1.2rem 1.5rem; text-align: left; }
    .sidebar.icon-nav .nav-section { display: block; }
    .sidebar.icon-nav .nav-link { justify-content: flex-start; padding: 0.65rem 1.5rem; gap: 0.6rem; }
    .sidebar.icon-nav .nav-label { display: inline; }
    .sidebar.icon-nav .nav-icon { width: 1.4rem; }

    .panel-content,
    .panel-content.expanded {
        margin-left: 0;
    }

    .panel-main {
        padding: 1.1rem;
    }
}

/* ===== Móvil pequeño ===== */
@media (max-width: 560px) {
    .topbar-name {
        display: none;
    }

    .panel-topbar {
        padding: 0.7rem 0.8rem;
        gap: 0.6rem;
    }

    .panel-topbar h2 {
        font-size: 1rem;
    }

    .panel-main {
        padding: 0.9rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .panel-welcome {
        padding: 1rem;
    }
}

/* ===== Header público y login en pantallas pequeñas ===== */
@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
        gap: 0.6rem;
        padding: 0.8rem 1rem;
    }

    .nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.6rem;
    }

    .nav a {
        margin-left: 0;
        font-size: 0.9rem;
    }

    .hero {
        padding: 2.5rem 1rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .auth-card {
        margin: 1rem;
        max-width: none;
        padding: 2rem 1.25rem;
    }
}

/* ===== Tablas responsivas (para los módulos) ===== */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 1rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.table th,
.table td {
    padding: 0.7rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    white-space: nowrap;
}

.table th {
    background: var(--verde-oscuro);
    color: #fff;
}

.table tbody tr:hover {
    background: #f7fbf7;
}

/* ===== Módulos CRUD ===== */
.module-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.module-title {
    color: var(--verde-oscuro);
    font-size: 1.15rem;
}

.btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #555e66;
}

.th-actions,
.td-actions {
    text-align: right;
    white-space: nowrap;
}

.td-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
}

.btn-action {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}

.btn-action.edit {
    background: #e8f5e9;
    color: var(--verde-oscuro);
}

.btn-action.edit:hover {
    background: #c8e6c9;
}

.btn-action.delete {
    background: #fdecea;
    color: #b71c1c;
}

.btn-action.delete:hover {
    background: #f5c6cb;
}

.inline-form {
    display: inline;
    margin: 0;
}

.empty-row {
    text-align: center;
    color: #999;
    padding: 1.5rem !important;
}

.badge-role {
    display: inline-block;
    background: var(--verde);
    color: #fff;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ===== Formularios ===== */
.card-form {
    background: #fff;
    border-radius: 8px;
    padding: 1.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    margin-top: 1rem;
    max-width: 720px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.form-group select {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    background: #fff;
}

.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.form-actions {
    display: flex;
    gap: 0.7rem;
    margin-top: 1.5rem;
}

/* ===== Filtros de catálogo ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    align-items: flex-end;
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    margin-top: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--texto);
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 0.5rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 150px;
}

.filter-busqueda input {
    min-width: 220px;
}

.badge-mini {
    display: inline-block;
    background: var(--naranja);
    color: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.badge-mini.badge-pizza {
    background: var(--verde);
}

.badge-mini.badge-inmediato {
    background: var(--jp4, #8e24aa);
}

.badge-mini.badge-receta {
    background: #6a1b9a;
}

.badge-mini.badge-ingrediente {
    background: #0277bd;
}

.badge-tipo {
    text-transform: capitalize;
}

.badge-compuesto { background: #7b1fa2; }
.badge-materia_prima { background: #1565c0; }
.badge-venta_directa { background: #c62828; }

.badge-ok { background: #2e7d32; }
.badge-bajo { background: #ef6c00; }
.badge-agotado { background: #c62828; }

.badge-area { background: #01579b; }

/* ===== Tabs de áreas ===== */
.area-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.area-tab {
    padding: 0.45rem 1.1rem;
    border-radius: 20px;
    background: #fff;
    color: var(--verde-oscuro);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #ddd;
    transition: all 0.2s;
}

.area-tab:hover {
    border-color: var(--verde);
    color: var(--verde);
}

.area-tab.active {
    background: var(--verde);
    color: #fff;
    border-color: var(--verde);
}

.summary-sub {
    display: block;
    margin-top: 0.3rem;
}

/* ===== Recetas ===== */
.receta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.card-list {
    background: #fff;
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.card-list-title {
    color: var(--verde-oscuro);
    font-size: 1rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.empty-row-text {
    color: #999;
    font-style: italic;
    padding: 0.8rem 0;
    font-size: 0.9rem;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-main {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    display: block;
    font-weight: 600;
    color: var(--texto);
}

.list-item-sub {
    display: block;
    font-size: 0.8rem;
    color: #888;
}

.list-item-cost {
    font-weight: 700;
    color: var(--verde-oscuro);
    font-size: 0.9rem;
    white-space: nowrap;
}

.receta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--verde-oscuro);
    color: #fff;
    border-radius: 8px;
    padding: 1.1rem 1.3rem;
    margin-bottom: 1.25rem;
}

.receta-cat {
    font-size: 1.1rem;
    font-weight: 600;
}

.receta-costo {
    text-align: right;
}

.receta-costo-num {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.tabla-receta input[type="number"] {
    width: 100px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.tabla-receta select {
    min-width: 220px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.btn-quitar-fila {
    background: #fdecea;
}

.receta-filas-wrap {
    margin-bottom: 1rem;
}

/* ===== Compras ===== */
.compra-form .tabla-compra input[type="number"] {
    width: 100px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.compra-form .tabla-compra select {
    min-width: 220px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 6px;
}

/* ===== Formulario de compra ===== */
.compra-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.8rem;
    background: #fafbfc;
    border: 1px solid #e8ecf1;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.2rem;
}

.compra-grid .form-group { margin-bottom: 0; }

.campo-compacto {
    padding: 0.5rem 0.7rem;
    font-size: 0.9rem;
}

.compra-grid select.campo-compacto,
.compra-grid input.campo-compacto {
    padding: 0.5rem 0.7rem;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
}

.compra-art-titulo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1rem 0 0.6rem;
}

/* ===== Tabla de artículos con buscador ===== */
.compra-form .tabla-compra td {
    padding: 0.6rem 0.6rem;
    vertical-align: middle;
}

.compra-form .tabla-compra td.td-select { min-width: 260px; }

.compra-form .tabla-compra td input[type="number"] {
    padding: 0.6rem 0.7rem;
    font-size: 0.95rem;
    border-radius: 6px;
    border: 1.5px solid #cbd5e1;
    width: 100px;
    box-sizing: border-box;
}

.compra-form .tabla-compra .c-sub { font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.compra-form .tabla-compra .td-elim { text-align: center; }
.compra-form .tabla-compra .td-elim .btn-quitar-fila { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ===== Buscador dinámico de producto ===== */
.combo-wrap { position: relative; width: 100%; }

.combo-buscar {
    width: 100%;
    padding: 0.6rem 0.7rem;
    font-size: 0.95rem;
    border-radius: 6px;
    border: 1.5px solid #cbd5e1;
    box-sizing: border-box;
    background: #fff;
}

.combo-buscar:focus {
    outline: none;
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.combo-seleccionado {
    background: #e8f5e9;
    color: var(--verde-oscuro);
    border: 1.5px solid var(--verde-claro);
    border-radius: 6px;
    padding: 0.6rem 0.7rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.combo-seleccionado::after {
    content: '✕';
    color: #b91c1c;
    font-weight: 700;
    font-size: 0.85rem;
}

.combo-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 50;
    display: none;
}

.combo-opt {
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

.combo-opt:hover {
    background: var(--verde);
    color: #fff;
}

.combo-opt.combo-vacio {
    color: #94a3b8;
    cursor: default;
}

.combo-vacio:hover { background: #fff; color: #94a3b8; }

.compra-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    background: var(--verde-oscuro);
    color: #fff;
    padding: 0.9rem 1.4rem;
    border-radius: 10px;
}

.compra-total-izq { display: flex; flex-direction: column; gap: 0.1rem; }

.compra-total-lineas {
    font-size: 0.8rem;
    color: #cde5cd;
    font-weight: 600;
}

.compra-total-label {
    font-size: 1rem;
    font-weight: 700;
}

.compra-total-num {
    font-size: 1.7rem;
    font-weight: 800;
    color: #ffe082;
}

.compra-actions {
    justify-content: flex-end;
}

/* ===== Zona de captura de artículos (fuera de la tabla) ===== */
.captura-fila {
    display: grid;
    grid-template-columns: 1fr 140px 150px auto;
    gap: 0.8rem;
    align-items: end;
    background: #fafbfc;
    border: 1px solid #e8ecf1;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.8rem;
}

.captura-col { display: flex; flex-direction: column; gap: 0.3rem; }

.captura-col input[type="number"] {
    padding: 0.65rem 0.7rem;
    font-size: 0.95rem;
    border-radius: 6px;
    border: 1.5px solid #cbd5e1;
    width: 100%;
    box-sizing: border-box;
    font-weight: 600;
}

.captura-agregar {
    padding: 0.65rem 1.4rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

.combo-buscar#capBuscar { padding: 0.65rem 0.7rem; font-size: 0.95rem; }

@media (max-width: 800px) {
    .captura-fila {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "art art"
            "cant precio"
            "btn btn";
    }
    .captura-art { grid-area: art; }
    .captura-cant { grid-area: cant; }
    .captura-precio { grid-area: precio; }
    .captura-btn { grid-area: btn; }
    .captura-agregar { width: 100%; }
}

/* ===== Empresas separadores ===== */

.compra-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    background: var(--verde-oscuro);
    color: #fff;
    border-radius: 8px;
    padding: 1.2rem 1.3rem;
    margin-top: 1rem;
}

.compra-header-val {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 0.2rem;
}

.compra-header .compra-total-num {
    color: #ffe082;
}

.compra-obs {
    background: #fff3e0;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin-top: 0.8rem;
    font-size: 0.9rem;
    color: #e65100;
}

.compra-note {
    margin-top: 1rem;
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
}

/* ===== Pedidos ===== */
.fila-extras,
.fila-sabores {
    margin-top: 0.4rem;
    padding: 0.4rem;
    background: #f7fbf7;
    border-radius: 6px;
    max-width: 420px;
}

.fila-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--verde-oscuro);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.extra-item {
    display: block;
    font-size: 0.8rem;
    color: #555;
    margin: 0.15rem 0;
    white-space: nowrap;
}

.extra-item input {
    margin-right: 0.35rem;
}

.extra-tag {
    display: inline-block;
    background: #fff3e0;
    color: #e65100;
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    font-size: 0.78rem;
    margin: 0.1rem 0.1rem 0 0;
}

.detalle-sabores {
    margin-top: 0.3rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-style: normal;
}

.estado-select {
    padding: 0.5rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: 6px;
}

/* ===== Mapa de mesas ===== */
.mapa-area {
    margin-bottom: 1.8rem;
}

.mapa-area-titulo {
    color: var(--verde-oscuro);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--verde-claro);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mapa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
}

.mapa-mesa {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    text-decoration: none;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 1.1rem 0.5rem;
    min-height: 110px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}

/* cuando la mesa es un botón de formulario */
.mapa-mesa-form {
    margin: 0;
    display: block;
}

.mapa-mesa-form .mapa-mesa {
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    box-sizing: border-box;
}

.mapa-mesa-form .mapa-mesa:active {
    transform: scale(0.97);
}

.mapa-mesa:active {
    transform: scale(0.97);
}

.mapa-mesa-num {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--texto);
    line-height: 1.1;
}

.mapa-mesa-cap {
    font-size: 0.75rem;
    color: #888;
}

.mapa-mesa-accion {
    margin-top: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

/* estados */
.mesa-disponible {
    border-color: var(--verde-claro);
}

.mesa-disponible .mapa-mesa-accion {
    background: var(--verde-claro);
    color: #fff;
}

.mesa-ocupada {
    border-color: var(--naranja);
    background: #fff8f0;
}

.mesa-ocupada .mapa-mesa-accion {
    background: var(--naranja);
    color: #fff;
}

/* mesa con pedido activo -> roja */
.mesa-ocupada-activa {
    border-color: #c62828;
    background: #fdecea;
}

.mesa-ocupada-activa .mapa-mesa-accion {
    background: #c62828;
    color: #fff;
}

.mesa-reservada {
    border-style: dashed;
    border-color: #1565c0;
    background: #e8f1fb;
}

.mesa-reservada .mapa-mesa-accion {
    background: #1565c0;
    color: #fff;
}

@media (max-width: 768px) {
    .mapa-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.7rem;
    }

    .mapa-mesa {
        min-height: 96px;
        padding: 0.9rem 0.4rem;
    }
}

/* ===== POS táctil (pedido en tablet) ===== */
.pos-wrapper {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1rem;
    margin-top: 1rem;
    align-items: start;
}

.pos-catalogo {
    min-width: 0;
}

.pos-datos {
    background: #fff;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.6rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    margin-bottom: 0.8rem;
}

.pos-datos .form-group {
    margin-bottom: 0;
}

.pos-datos select,
.pos-datos input {
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
}

.pos-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}

.pos-tab {
    padding: 0.55rem 1rem;
    border-radius: 20px;
    background: #fff;
    color: var(--texto);
    border: 1px solid #ddd;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.pos-tab.active {
    background: var(--verde);
    color: #fff;
    border-color: var(--verde);
}

.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.7rem;
}

.pos-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    padding: 0.9rem 0.5rem;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.pos-item:active {
    transform: scale(0.96);
    border-color: var(--verde);
    box-shadow: 0 4px 14px rgba(46,125,50,0.25);
}

.pos-item-img {
    font-size: 1.9rem;
    line-height: 1;
}

.pos-item-nombre {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    color: var(--texto);
    line-height: 1.15;
    min-height: 2.2em;
}

.pos-item-precio {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--verde-oscuro);
}

/* Carrito */
.pos-carrito {
    position: sticky;
    top: 72px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 90px);
}

.pos-carrito-head {
    background: var(--verde-oscuro);
    color: #fff;
    padding: 0.8rem 1rem;
}

.pos-carrito-head h4 {
    font-size: 1rem;
}

.pos-carrito-items {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem;
    min-height: 120px;
}

.pos-vacio {
    color: #aaa;
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.9rem;
}

.pos-item-linea {
    border-bottom: 1px solid #f0f0f0;
    padding: 0.5rem 0.2rem;
}

.pos-linea-nombre {
    font-weight: 600;
    font-size: 0.9rem;
}

.pos-linea-extras {
    font-size: 0.75rem;
    color: #e65100;
    margin-top: 0.15rem;
}

.pos-linea-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.pos-qty {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: #f5f5f5;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pos-qty:active {
    background: var(--verde-claro);
    color: #fff;
}

.pos-qty-num {
    min-width: 22px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.pos-linea-sub {
    margin-left: auto;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--verde-oscuro);
}

.pos-remover {
    background: none;
    border: none;
    color: #c62828;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}

.pos-carrito-foot {
    border-top: 2px solid #eee;
    padding: 0.8rem 1rem;
    background: #fafafa;
}

.pos-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    padding: 0.2rem 0;
}

.pos-total-final {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--verde-oscuro);
    border-top: 1px dashed #ccc;
    margin-top: 0.3rem;
    padding-top: 0.5rem;
}

.pos-input-s {
    width: 90px;
    padding: 0.3rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: right;
}

.pos-guardar {
    margin-top: 0.8rem;
    font-size: 1.05rem;
    padding: 0.9rem;
}

/* Modal de extras */
.pos-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.pos-modal.visible {
    display: flex;
}

.pos-modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 1.3rem;
    width: 90%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
}

.pos-modal-extras {
    margin: 1rem 0;
}

.pos-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

.extra-precio {
    color: #888;
}

@media (max-width: 1200px) {
    .pos-wrapper {
        grid-template-columns: 1fr 320px;
    }
}

@media (max-width: 900px) {
    .pos-wrapper {
        grid-template-columns: 1fr;
    }

    .pos-carrito {
        position: static;
        max-height: none;
    }
}

@media (max-width: 900px) {
    .receta-grid {
        grid-template-columns: 1fr;
    }
}

.btn-action.view {
    background: #eceff1;
    color: #37474f;
}

.btn-action.view:hover {
    background: #cfd8dc;
}

.ajuste-wrap {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1rem;
}

.stock-actual {
    background: var(--verde-oscuro);
    color: #fff;
    border-radius: 8px;
    padding: 1.2rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.stock-label {
    display: block;
    font-size: 0.85rem;
    color: #cde5cd;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-valor {
    display: block;
    font-size: 1.9rem;
    font-weight: 700;
    margin: 0.3rem 0;
}

.stock-min {
    font-size: 0.85rem;
    color: #cde5cd;
}

.kardex-title {
    color: var(--verde-oscuro);
    margin-bottom: 0.75rem;
}

@media (max-width: 1023px) {
    .ajuste-wrap {
        grid-template-columns: 1fr;
    }
}

/* ===== Checkboxes en formularios ===== */
.form-checks {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    padding-top: 1.2rem;
}

.field-hint {
    color: #888;
    font-size: 0.8rem;
}

/* ===== Resumen / tarjetas de conteo ===== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.summary-card {
    background: #fff;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-top: 4px solid var(--verde);
}

.summary-num {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--verde-oscuro);
}

.summary-label {
    font-size: 0.8rem;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

/* ===== Paginación y encabezados de tablas responsivas ===== */
@media (max-width: 560px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group select,
    .filter-group input[type="text"],
    .filter-busqueda input {
        width: 100%;
        min-width: 0;
    }

    .form-checks {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ===== Logo de empresa ===== */
.logo-upload {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 1.2rem;
    background: #fafafa;
    margin-bottom: 1.25rem;
    text-align: center;
}

.logo-upload label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--texto);
}

.logo-preview {
    display: inline-block;
    padding: 0.5rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 0.8rem;
}

.logo-preview img {
    max-width: 180px;
    max-height: 100px;
    display: block;
    object-fit: contain;
}

.logo-empty {
    color: #999;
    font-style: italic;
    padding: 1rem 0;
}

.file-field {
    text-align: left;
    margin-top: 0.5rem;
}

.file-field input[type="file"] {
    display: block;
    font-size: 0.9rem;
}

.file-field small {
    color: #888;
    font-size: 0.8rem;
}

.alert-success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
}

/* ===== Móvil: formularios ===== */
@media (max-width: 560px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .card-form {
        padding: 1.2rem;
    }

    .module-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .module-toolbar .btn {
        text-align: center;
    }
}

/* ===== Secciones de formulario (catálogo) ===== */
.form-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.1rem 1.2rem;
    margin-bottom: 1rem;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 800;
    color: #1b4d2e;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 0.9rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eef1f4;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Opciones de uso (tarjetas) */
.uso-opts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.7rem;
}

.uso-opt {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.65rem 0.75rem;
    border: 1px solid #e6e9ef;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.uso-opt:hover {
    border-color: var(--verde);
    background: #f6fbf6;
}

.uso-opt input[type=checkbox] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--verde);
    flex-shrink: 0;
}

.uso-opt-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #333;
    line-height: 1.2;
}

.uso-opt-desc {
    font-size: 0.76rem;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.3;
}

.uso-info {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.7rem;
}

.form-checks-inline {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.8rem;
}

.form-checks-inline .check-item {
    font-weight: 600;
    font-size: 0.9rem;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.form-checks-inline .check-item input {
    width: 17px;
    height: 17px;
    accent-color: var(--verde);
}

@media (max-width: 768px) {
    .form-grid-3 { grid-template-columns: 1fr; }
    .uso-opts { grid-template-columns: 1fr; }
}
