:root{
    --app-bg:#f4f7f5;
    --app-card:#ffffff;
    --app-line:#e4ece7;
    --app-text:#17322b;
    --app-muted:#70867c;

    --app-primary:#1f8f50;
    --app-primary-dark:#157342;
    --app-primary-soft:#edf8f0;

    --app-info:#3b82f6;
    --app-warning:#f59e0b;
    --app-danger:#dc2626;
    --app-success:#16a34a;

    --app-radius-xl:24px;
    --app-radius-lg:18px;
    --app-radius-md:14px;
    --app-radius-sm:10px;

    --app-shadow:0 12px 32px rgba(16,24,40,.08);
    --app-shadow-soft:0 8px 20px rgba(16,24,40,.05);

    --app-gap:16px;
    --app-gap-lg:22px;

    --app-input-h:52px;
    --app-btn-h:50px;
    --app-topbar-h:64px;
}

html,body{
    background:var(--app-bg);
    color:var(--app-text);
}

body{
    font-family:Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Layout general */
.app-shell{
    max-width:1200px;
    margin:0 auto;
    padding:18px;
}

.app-page{
    display:grid;
    gap:18px;
}

.page-title{
    margin:0;
    font-size:1.65rem;
    line-height:1.08;
    letter-spacing:-.02em;
    color:var(--app-text);
}

.page-subtitle{
    margin:6px 0 0;
    color:var(--app-muted);
    font-size:.96rem;
    line-height:1.5;
}

.app-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    flex-wrap:wrap;
}

.app-toolbar__actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}

/* Topbar tipo app */
.app-topbar{
    position:sticky;
    top:0;
    z-index:40;
    min-height:var(--app-topbar-h);
    background:rgba(244,247,245,.88);
    backdrop-filter:blur(12px);
    border-bottom:1px solid rgba(228,236,231,.9);
}

.app-topbar__inner{
    max-width:1200px;
    margin:0 auto;
    min-height:var(--app-topbar-h);
    padding:0 18px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
}

.app-topbar__title{
    font-weight:800;
    color:var(--app-text);
    font-size:1rem;
}

.app-topbar__user{
    display:flex;
    align-items:center;
    gap:10px;
    color:var(--app-muted);
    font-size:.92rem;
}

/* Cards */
.app-card{
    background:var(--app-card);
    border:1px solid var(--app-line);
    border-radius:var(--app-radius-xl);
    box-shadow:var(--app-shadow-soft);
}

.app-card--soft{
    box-shadow:var(--app-shadow);
}

.app-card__head{
    padding:18px 18px 0;
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}

.app-card__title{
    margin:0;
    font-size:1rem;
    font-weight:800;
    color:var(--app-text);
}

.app-card__desc{
    margin:4px 0 0;
    color:var(--app-muted);
    font-size:.9rem;
    line-height:1.5;
}

.app-card__body{
    padding:18px;
}

.app-card__footer{
    padding:0 18px 18px;
}

/* KPI cards */
.app-kpi-grid{
    display:grid;
    grid-template-columns:repeat(4, minmax(0,1fr));
    gap:14px;
}

.app-kpi{
    background:#fff;
    border:1px solid var(--app-line);
    border-radius:20px;
    padding:16px;
    box-shadow:var(--app-shadow-soft);
}

.app-kpi__label{
    color:var(--app-muted);
    font-size:.85rem;
    margin-bottom:8px;
}

.app-kpi__value{
    font-size:1.7rem;
    font-weight:800;
    line-height:1;
    color:var(--app-text);
}

.app-kpi__meta{
    margin-top:8px;
    color:var(--app-muted);
    font-size:.82rem;
}

/* Grid */
.app-grid{
    display:grid;
    gap:18px;
}

.app-grid--2{
    grid-template-columns:1.1fr .9fr;
}

.app-grid--3{
    grid-template-columns:repeat(3,minmax(0,1fr));
}

/* Botones */
.app-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    min-height:var(--app-btn-h);
    padding:0 16px;
    border-radius:14px;
    border:1px solid transparent;
    font-weight:700;
    font-size:.95rem;
    text-decoration:none;
    cursor:pointer;
    transition:.18s ease;
}

.app-btn:hover{
    transform:translateY(-1px);
    text-decoration:none;
}

.app-btn--primary{
    background:linear-gradient(135deg, var(--app-primary), #2ab965);
    color:#fff;
    box-shadow:0 12px 24px rgba(31,143,80,.18);
}

.app-btn--primary:hover{
    color:#fff;
}

.app-btn--light{
    background:#fff;
    color:var(--app-text);
    border-color:var(--app-line);
}

.app-btn--danger{
    background:#fff2f2;
    color:var(--app-danger);
    border-color:#f5d1d1;
}

.app-btn--success-soft{
    background:var(--app-primary-soft);
    color:var(--app-primary-dark);
    border-color:#dcefe2;
}

.app-btn--block{
    width:100%;
}

/* Formularios */
.app-form{
    display:grid;
    gap:14px;
}

.app-form__row{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:14px;
}

.app-field{
    display:grid;
    gap:8px;
}

.app-label{
    font-size:.9rem;
    font-weight:700;
    color:#28423a;
}

.app-input,
.app-select,
.app-textarea{
    width:100%;
    border:1px solid var(--app-line);
    border-radius:16px;
    background:#fff;
    color:var(--app-text);
    outline:none;
    transition:border-color .18s ease, box-shadow .18s ease;
}

.app-input,
.app-select{
    min-height:var(--app-input-h);
    padding:0 15px;
}

.app-textarea{
    min-height:110px;
    padding:14px 15px;
    resize:vertical;
}

.app-input:focus,
.app-select:focus,
.app-textarea:focus{
    border-color:#8ed6ab;
    box-shadow:0 0 0 4px rgba(31,143,80,.10);
}

/* Listas tipo app */
.app-list{
    display:grid;
    gap:12px;
}

.app-list-item{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:14px;
    border:1px solid var(--app-line);
    border-radius:16px;
    background:#fff;
}

.app-list-item__main{
    min-width:0;
}

.app-list-item__title{
    font-weight:800;
    color:var(--app-text);
    margin:0 0 4px;
}

.app-list-item__meta{
    font-size:.88rem;
    color:var(--app-muted);
    line-height:1.5;
}

.app-list-item__side{
    text-align:right;
    flex:0 0 auto;
}

/* Badges */
.app-badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:28px;
    padding:0 10px;
    border-radius:999px;
    font-size:.8rem;
    font-weight:800;
    border:1px solid transparent;
}

.app-badge--warning{
    background:#fff7e8;
    color:#9a6700;
    border-color:#f3ddb0;
}

.app-badge--info{
    background:#ecf4ff;
    color:#1d4ed8;
    border-color:#cfe1ff;
}

.app-badge--primary{
    background:#eef7ff;
    color:#2563eb;
    border-color:#cfe0ff;
}

.app-badge--success{
    background:#edf9f1;
    color:#15803d;
    border-color:#d2efd9;
}

.app-badge--danger{
    background:#fff1f1;
    color:#b91c1c;
    border-color:#f5d0d0;
}

.app-badge--muted{
    background:#f3f5f4;
    color:#60786d;
    border-color:#e4ece7;
}

/* Alerts */
.app-alert{
    padding:14px 16px;
    border-radius:16px;
    font-size:.92rem;
    font-weight:600;
    border:1px solid;
}

.app-alert--success{
    background:#edf8f0;
    color:#256c42;
    border-color:#d8ebdf;
}

.app-alert--danger{
    background:#fff2f2;
    color:#b33a3a;
    border-color:#f1cccc;
}

/* Tabla más amigable */
.app-table-wrap{
    overflow:auto;
}

.app-table{
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    min-width:720px;
}

.app-table th{
    text-align:left;
    font-size:.82rem;
    color:#6d8479;
    font-weight:800;
    padding:14px 14px;
    border-bottom:1px solid var(--app-line);
    background:#fcfdfc;
}

.app-table td{
    padding:14px;
    border-bottom:1px solid #edf2ee;
    vertical-align:middle;
    color:var(--app-text);
    font-size:.94rem;
}

.app-table tr:last-child td{
    border-bottom:0;
}

/* Resumen lateral sticky */
.app-sticky{
    position:sticky;
    top:84px;
}

/* Mobile */
@media (max-width: 992px){
    .app-kpi-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .app-grid--2,
    .app-grid--3{
        grid-template-columns:1fr;
    }

    .app-sticky{
        position:static;
    }
}

@media (max-width: 768px){
    .app-shell{
        padding:14px;
    }

    .page-title{
        font-size:1.35rem;
    }

    .app-form__row{
        grid-template-columns:1fr;
    }

    .app-toolbar{
        align-items:flex-start;
    }

    .app-toolbar__actions{
        width:100%;
    }

    .app-toolbar__actions .app-btn{
        flex:1 1 auto;
    }

    .app-card,
    .app-kpi{
        border-radius:18px;
    }

    .app-card__body,
    .app-card__head,
    .app-card__footer{
        padding-left:14px;
        padding-right:14px;
    }

    .app-list-item{
        align-items:flex-start;
        flex-direction:column;
    }

    .app-list-item__side{
        width:100%;
        text-align:left;
    }
}

@media (max-width: 520px){
    .app-kpi-grid{
        grid-template-columns:1fr;
    }

    .app-topbar__inner{
        padding:0 14px;
    }

    .app-input,
    .app-select{
        min-height:50px;
    }

    .app-btn{
        min-height:48px;
        font-size:.92rem;
    }

    .app-table{
        min-width:640px;
    }
}
:root{
    --app-nav-h: 74px;
}

/* Espacio para que el contenido no quede tapado */
@media (max-width: 991.98px){
    body{
        padding-bottom: calc(var(--app-nav-h) + 14px);
    }
}

.app-bottom-nav{
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 10px;
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 8px;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(228,236,231,.95);
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(16,24,40,.14);
    backdrop-filter: blur(14px);
}

.app-bottom-nav__item{
    min-height: 58px;
    border: 0;
    background: transparent;
    color: #6f857b;
    text-decoration: none;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: .74rem;
    font-weight: 700;
    transition: .18s ease;
    padding: 6px 4px;
}

.app-bottom-nav__item:hover,
.app-bottom-nav__item:focus{
    text-decoration: none;
    color: #17322b;
    background: #f4f8f5;
    outline: none;
}

.app-bottom-nav__item.is-active{
    color: var(--app-primary-dark);
    background: var(--app-primary-soft);
}

.app-bottom-nav__icon{
    font-size: 1.1rem;
    line-height: 1;
}

.app-bottom-nav__label{
    line-height: 1;
    white-space: nowrap;
}

/* Bottom sheet */
.app-sheet-backdrop{
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.35);
    opacity: 0;
    pointer-events: none;
    transition: .2s ease;
    z-index: 95;
}

.app-sheet-backdrop.is-open{
    opacity: 1;
    pointer-events: auto;
}

.app-bottom-sheet{
    position: fixed;
    left: 0;
    right: 0;
    bottom: -100%;
    z-index: 100;
    background: #fff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -14px 40px rgba(16,24,40,.14);
    padding: 10px 16px 26px;
    transition: .24s ease;
}

.app-bottom-sheet.is-open{
    bottom: 0;
}

.app-bottom-sheet__handle{
    width: 54px;
    height: 5px;
    border-radius: 999px;
    background: #d7e1db;
    margin: 4px auto 10px;
}

.app-bottom-sheet__head{
    text-align: center;
    color: var(--app-text);
    margin-bottom: 12px;
}

.app-bottom-sheet__body{
    display: grid;
    gap: 8px;
}

.app-sheet-link{
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    border-radius: 16px;
    color: var(--app-text);
    text-decoration: none;
    background: #f8fbf9;
    border: 1px solid #e8efea;
    font-weight: 700;
}

.app-sheet-link:hover{
    text-decoration: none;
    color: var(--app-text);
    background: #f1f7f3;
}

.app-sheet-link--danger{
    color: #b42318;
    background: #fff5f5;
    border-color: #f4d2d2;
}

/* Desktop: ocultar */
@media (min-width: 992px){
    .app-bottom-nav,
    .app-sheet-backdrop,
    .app-bottom-sheet{
        display: none;
    }
}

.app-topbar{
    position: sticky;
    top: 0;
    z-index: 80;
    min-height: 64px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(228,236,231,.95);
}

.app-topbar__inner{
    max-width: 1280px;
    margin: 0 auto;
    min-height: 64px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-topbar__brand-mark{
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1f8f50, #2ecb71);
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 10px 20px rgba(31,143,80,.18);
}

.app-topbar__title{
    font-weight: 800;
    color: var(--app-text);
    font-size: 1rem;
    line-height: 1.1;
}

.app-topbar__desk-link{
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #61796e;
    font-size: .9rem;
    font-weight: 700;
    transition: .18s ease;
}

.app-topbar__desk-link:hover{
    text-decoration: none;
    color: var(--app-text);
    background: #f3f7f5;
}

.app-topbar__desk-link.is-active{
    color: var(--app-primary-dark);
    background: var(--app-primary-soft);
}

.app-topbar__icon-btn{
    width: 42px;
    height: 42px;
    border: 1px solid var(--app-line);
    background: #fff;
    border-radius: 14px;
    color: var(--app-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(16,24,40,.05);
}

.app-topbar__user-name{
    color: var(--app-muted);
    font-size: .9rem;
    font-weight: 700;
}

@media (max-width: 991.98px){
    .app-topbar__title{
        max-width: 180px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

body{
    background:#f6f8f7;
}

/* MAIN */
.app-main{
    max-width:1280px;
    margin:auto;
    padding:18px;
    padding-bottom:110px;
}

/* TOPBAR */
.app-topbar{
    position:sticky;
    top:0;
    z-index:90;
    background:rgba(255,255,255,.92);
    backdrop-filter:blur(14px);
    border-bottom:1px solid #edf1ef;
}

.app-topbar__inner{
    max-width:1280px;
    margin:auto;
    min-height:64px;
    padding:0 14px;
    display:flex;
    align-items:center;
    justify-content:space-between;
}

.app-topbar__brand{
    display:flex;
    align-items:center;
    gap:10px;
    text-decoration:none;
}

.app-topbar__brand-mark{
    width:38px;
    height:38px;
    border-radius:12px;
    background:#27ae60;
    display:flex;
    align-items:center;
    justify-content:center;
}

.app-topbar__brand-text{
    font-weight:800;
    color:#17322b;
}

/* BOTTOM NAV */
.app-bottom-nav{
    position:fixed;
    left:10px;
    right:10px;
    bottom:10px;
    background:#fff;
    border-radius:24px;
    box-shadow:0 15px 35px rgba(0,0,0,.10);
    display:grid;
    grid-template-columns:repeat(5,1fr);
    padding:8px;
    z-index:100;
}

.app-bottom-nav__item{
    border:0;
    background:none;
    color:#6d7f76;
    text-decoration:none;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    min-height:58px;
    font-size:.75rem;
    gap:4px;
    border-radius:18px;
}

.app-bottom-nav__item.is-active{
    background:#eef8f1;
    color:#1f8f50;
}

.app-bottom-nav__item--primary{
    background:#27ae60;
    color:#fff !important;
}

/* SHEET */
.app-sheet-backdrop{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.35);
    opacity:0;
    pointer-events:none;
    transition:.2s;
    z-index:110;
}

.app-sheet-backdrop.is-open{
    opacity:1;
    pointer-events:auto;
}

.app-bottom-sheet{
    position:fixed;
    left:0;
    right:0;
    bottom:-100%;
    background:#fff;
    border-radius:24px 24px 0 0;
    padding:20px;
    z-index:120;
    transition:.25s;
}

.app-bottom-sheet.is-open{
    bottom:0;
}

.app-bottom-sheet__handle{
    width:60px;
    height:5px;
    background:#d9e1dc;
    border-radius:999px;
    margin:auto;
    margin-bottom:18px;
}

.app-sheet-link{
    display:flex;
    gap:14px;
    align-items:center;
    min-height:56px;
    padding:0 14px;
    border-radius:16px;
    text-decoration:none;
    color:#17322b;
    background:#f7faf8;
    margin-bottom:8px;
}

.app-sheet-link--danger{
    color:#b42318;
}

/* desktop */
@media(min-width:992px){
    .app-bottom-nav,
    .app-bottom-sheet,
    .app-sheet-backdrop{
        display:none;
    }

    .app-main{
        padding-bottom:24px;
    }
}
.app-btn--sm{
    min-height:38px;
    padding:0 12px;
    font-size:.85rem;
    border-radius:12px;
}

.receta-expand{
    animation: recetaExpandFade .18s ease;
}

@keyframes recetaExpandFade{
    from{ opacity:0; transform:translateY(-4px); }
    to{ opacity:1; transform:translateY(0); }
}

.app-image-modal{
    position:fixed;
    inset:0;
    z-index:200;
    display:none;
    align-items:center;
    justify-content:center;
    padding:18px;
}

.app-image-modal__backdrop{
    position:absolute;
    inset:0;
    background:rgba(15,23,42,.65);
    backdrop-filter:blur(4px);
}

.app-image-modal__dialog{
    position:relative;
    z-index:2;
    width:min(100%, 720px);
    background:#fff;
    border-radius:24px;
    padding:18px;
    box-shadow:0 20px 60px rgba(0,0,0,.22);
}

.app-image-modal__close{
    position:absolute;
    right:14px;
    top:14px;
    width:40px;
    height:40px;
    border:0;
    border-radius:12px;
    background:#f3f6f4;
    color:#17322b;
}

.app-image-modal__title{
    font-weight:800;
    margin-bottom:14px;
    padding-right:42px;
}

.app-image-modal__img{
    width:100%;
    max-height:70vh;
    object-fit:contain;
    border-radius:18px;
    display:block;
    background:#f4f7f5;
}
.pedido-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:16px;
}

.pedido-card{
    background:#fff;
    border:1px solid var(--app-line);
    border-radius:22px;
    padding:18px;
    box-shadow:var(--app-shadow-soft);
    display:grid;
    gap:14px;
}

.pedido-card__top{
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:flex-start;
}

.pedido-card__id{
    font-size:.88rem;
    color:var(--app-muted);
    margin-bottom:4px;
}

.pedido-card__cliente{
    font-size:1.02rem;
    font-weight:800;
    color:var(--app-text);
    line-height:1.25;
}

.pedido-card__meta{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
    padding:12px;
    border-radius:16px;
    background:#f8fbf9;
    border:1px solid #edf2ee;
}

.pedido-card__meta-label{
    display:block;
    font-size:.78rem;
    color:var(--app-muted);
    margin-bottom:4px;
}

.pedido-card__money{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
}

.pedido-money{
    border-radius:16px;
    padding:12px;
    border:1px solid #edf2ee;
    background:#fff;
}

.pedido-money span{
    display:block;
    font-size:.76rem;
    color:var(--app-muted);
    margin-bottom:6px;
}

.pedido-money strong{
    font-size:.95rem;
    color:var(--app-text);
    line-height:1.2;
}

.pedido-money--total{
    background:#f8fbf9;
}

.pedido-money--paid{
    background:#eef8f1;
}

.pedido-money--pending{
    background:#fff8ef;
}

.pedido-card__progress-wrap{
    display:grid;
    gap:8px;
}

.pedido-card__progress-label{
    display:flex;
    justify-content:space-between;
    gap:12px;
    font-size:.82rem;
    color:var(--app-muted);
}

.pedido-card__progress-label strong{
    color:var(--app-text);
}

.pedido-card__progress{
    width:100%;
    height:10px;
    border-radius:999px;
    background:#edf2ee;
    overflow:hidden;
}

.pedido-card__progress span{
    display:block;
    height:100%;
    border-radius:999px;
    background:linear-gradient(90deg, var(--app-primary), #31be6b);
}

.pedido-card__actions{
    display:flex;
    justify-content:flex-end;
}

@media (max-width: 991px){
    .pedido-grid{
        grid-template-columns:1fr;
    }
}

@media (max-width: 640px){
    .pedido-card{
        padding:16px;
        border-radius:18px;
    }

    .pedido-card__meta{
        grid-template-columns:1fr;
    }

    .pedido-card__money{
        grid-template-columns:1fr;
    }

    .pedido-card__actions{
        justify-content:stretch;
    }

    .pedido-card__actions .app-btn{
        width:100%;
    }
}
