/* ===================================
   GRUPO BULL - Sistema de Pedidos
   Chef App Styles
   =================================== */

:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --dark: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; touch-action: manipulation; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Screens — Alpine x-show handles visibility */
.screen {
    min-height: 100vh;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===================================
   LOGIN
   =================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo i { font-size: 3.5rem; color: var(--primary); display: block; margin-bottom: 0.5rem; }
.login-logo h1 { font-size: 1.8rem; font-weight: 800; color: var(--dark); margin: 0; letter-spacing: -0.5px; }
.login-logo p { font-size: 0.9rem; margin-top: 0.25rem; }

.login-form {
    width: 100%;
    max-width: 380px;
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* Local grid */
.local-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 0.5rem; }
.local-btn {
    display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
    padding: 0.9rem 0.5rem; border: 2px solid var(--gray-200); border-radius: var(--radius-sm);
    background: white; cursor: pointer; transition: all 0.2s ease;
    font-size: 0.85rem; font-weight: 600; color: var(--gray-600);
}
.local-btn i { font-size: 1.5rem; color: var(--gray-400); transition: color 0.2s; }
.local-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.local-btn.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.local-btn.selected i { color: var(--primary); }

/* PIN */
.pin-container { display: flex; justify-content: center; gap: 0.75rem; }
.pin-input {
    width: 52px; height: 56px; text-align: center; font-size: 1.5rem; font-weight: 700;
    border: 2px solid var(--gray-200); border-radius: var(--radius-sm);
    outline: none; transition: border-color 0.2s; -moz-appearance: textfield;
}
.pin-input::-webkit-outer-spin-button,
.pin-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pin-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.pin-input.filled { border-color: var(--success); background: #f0fdf4; }

/* ===================================
   CHEF: TOP BAR
   =================================== */
.chef-topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1rem; background: white; border-bottom: 1px solid var(--gray-200);
    position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm);
}
.chef-controls-sticky .chef-topbar {
    position: static; z-index: auto; box-shadow: none;
    padding: 0.5rem 1rem;
}
.cart-badge {
    position: absolute; top: -6px; right: -8px; background: var(--danger); color: white;
    font-size: 0.65rem; font-weight: 700; min-width: 18px; height: 18px; line-height: 18px;
    text-align: center; border-radius: 50%;
}
.topbar-last-login {
    font-size: 0.65rem; color: var(--gray-400); font-weight: 400;
    margin-top: 1px; line-height: 1;
}
.topbar-action {
    display: flex; flex-direction: column; align-items: center;
    text-decoration: none; gap: 1px;
}
.topbar-action-label {
    font-size: 0.55rem; font-weight: 500; line-height: 1;
}

/* ===================================
   STICKY CONTROLS WRAPPER
   =================================== */
.chef-controls-sticky {
    position: sticky; top: 0; z-index: 100; background: white;
    box-shadow: var(--shadow-sm);
}

/* ===================================
   SEARCH
   =================================== */
.chef-search { padding: 0.4rem 0.75rem; background: white; border-bottom: 1px solid var(--gray-100); }
.chef-search .input-group { border-radius: var(--radius-sm); overflow: hidden; }
.chef-search .input-group-text { border: 1px solid var(--gray-200); border-right: none; }
.chef-search .form-control { border: 1px solid var(--gray-200); border-left: none; }
.chef-search .form-control:focus { box-shadow: none; border-color: var(--gray-200); }
.search-clear-btn {
    border: 1px solid var(--gray-200); border-left: none;
    cursor: pointer; color: var(--gray-400); transition: color 0.15s;
}
.search-clear-btn:hover { color: var(--gray-600); }

/* ===================================
   CATEGORY TABS
   =================================== */
.category-tabs {
    display: flex; gap: 0.35rem; padding: 0.4rem 0.75rem;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    overscroll-behavior-x: contain; touch-action: pan-x;
    background: white; border-bottom: 1px solid var(--gray-200);
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
    white-space: nowrap; padding: 0.35rem 0.75rem; border: 1px solid var(--gray-200);
    border-radius: 50px; background: white; font-size: 0.78rem; font-weight: 500;
    color: var(--gray-600); cursor: pointer; transition: all 0.2s; flex-shrink: 0;
}
.cat-tab:hover { background: var(--gray-50); border-color: var(--gray-300); }
.cat-tab.active { background: var(--primary); border-color: var(--primary); color: white; }
.cat-tab i { margin-right: 0.2rem; }

/* ===================================
   SORT + VIEW TOGGLE
   =================================== */
.sort-view-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.25rem 0.75rem 0; background: var(--gray-100);
    overflow: hidden; max-width: 100%; gap: 0.4rem;
}
.sort-toggle {
    display: flex; gap: 0.3rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; min-width: 0;
}
.sort-toggle::-webkit-scrollbar { display: none; }
.sort-btn {
    padding: 0.25rem 0.55rem; border: 1px solid var(--gray-200); border-radius: 6px;
    background: white; color: var(--gray-500); cursor: pointer;
    font-size: 0.7rem; font-weight: 500; transition: all 0.15s;
    display: flex; align-items: center; gap: 0.2rem;
}
.sort-btn:hover { border-color: var(--gray-300); }
.sort-btn.active { background: var(--dark); color: white; border-color: var(--dark); }
.sort-btn i { font-size: 0.7rem; }
.view-toggle { display: flex; gap: 0.25rem; flex-shrink: 0; }
.vt-btn {
    width: 28px; height: 28px; border: 1px solid var(--gray-200); border-radius: 6px;
    background: white; color: var(--gray-400); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 0.9rem; transition: all 0.15s;
}
.vt-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===================================
   SUPPLIER FILTER
   =================================== */
.supplier-select {
    appearance: none; -webkit-appearance: none;
    padding: 0.25rem 1.4rem 0.25rem 0.5rem;
    border: 1px solid var(--gray-200); border-radius: 6px;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat right 0.4rem center;
    color: var(--gray-500); cursor: pointer;
    font-size: 0.7rem; font-weight: 500;
    max-width: 120px; height: 28px; line-height: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: all 0.15s;
}
.supplier-select:focus { outline: none; border-color: var(--primary); }
.supplier-select.active {
    background-color: var(--primary); color: white; border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='white' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
}

/* ===================================
   PRODUCT CONTAINER
   =================================== */
.product-container { padding: 0.5rem 0.75rem; padding-bottom: 120px; }
.product-container.view-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem;
    padding: 0.75rem; padding-bottom: 120px;
}

.list-category-header {
    font-weight: 700; font-size: 0.78rem; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-top: 0.75rem; margin-bottom: 0.35rem; padding: 0.4rem 0.5rem;
    background: var(--gray-100); border-radius: 6px;
}

/* List item row */
.product-list-item {
    display: grid; grid-template-columns: auto 1fr auto;
    gap: 0 0.65rem; padding: 0.65rem 0.5rem;
    background: white; border-bottom: 1px solid var(--gray-100);
    border-left: 3px solid transparent; transition: all 0.15s;
    align-items: center;
}
.product-list-item.has-items { border-left-color: var(--primary); background: #fafbff; }

.pli-note-row {
    padding: 0.2rem 0.5rem 0.5rem 4.5rem;
    background: white; border-bottom: 1px solid var(--gray-100);
}
.pli-note-row .vsi-note { width: 100%; }

.card-note-row { padding: 0 0.6rem 0.5rem; }
.card-note-row .vri-note { margin-top: 0; }

/* Thumbnail */
.pli-thumb {
    width: 56px; height: 56px; border-radius: 8px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; font-size: 1.4rem; position: relative; overflow: hidden;
    grid-row: 1 / 3;
}
.pli-thumb img {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: contain; border-radius: 8px; z-index: 1; background: white;
}

.pli-info { min-width: 0; }
.pli-bottom-meta {
    grid-column: 2 / 4; display: flex; align-items: center; gap: 0.35rem;
    font-size: 0.62rem; color: var(--gray-400); margin-top: -2px;
}
.pli-name {
    font-weight: 600; font-size: 0.88rem; color: var(--dark);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis; line-height: 1.2;
}
.pli-meta { font-size: 0.72rem; color: var(--gray-400); display: flex; align-items: center; gap: 0.4rem; }
.pli-formato { color: var(--gray-500); font-weight: 600; }
.pli-supplier { color: var(--gray-400); font-weight: 500; font-style: italic; }
.pli-last-order { font-size: 0.72rem; color: #888; font-style: italic; margin-top: 1px; }
.habitual-icon { font-size: 0.65rem; color: #ef4444; margin-left: 0.25rem; vertical-align: middle; opacity: 0.8; }
.product-card-name .habitual-icon { font-size: 0.6rem; }
.vsi-name .habitual-icon, .vri-name .habitual-icon { font-size: 0.6rem; }
.pli-variants-badge {
    background: var(--gray-200); color: var(--gray-600); font-size: 0.65rem;
    font-weight: 600; padding: 0.1rem 0.4rem; border-radius: 4px;
}

.pli-controls { display: flex; align-items: center; gap: 0.2rem; flex-shrink: 0; }
.pli-expand { cursor: pointer; padding: 0.3rem; color: var(--gray-400); transition: transform 0.2s; }
.pli-expand.open { transform: rotate(180deg); color: var(--primary); }

/* Variant sub-list */
.variant-sublist {
    background: var(--gray-50); border-left: 3px solid var(--primary);
    border-radius: 0 0 8px 8px; overflow: hidden;
    animation: panelSlideDown 0.2s ease-out; margin-bottom: 0.25rem;
}
.variant-subitem {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.55rem 0.5rem 0.55rem 1.2rem; border-bottom: 1px solid var(--gray-100); flex-wrap: wrap;
}
.variant-subitem:last-child { border-bottom: none; }
.variant-subitem.has-qty { background: #eef4ff; }
.vsi-info { flex: 1; min-width: 100px; }
.vsi-name { font-weight: 600; font-size: 0.82rem; color: var(--dark); }
.vsi-meta { font-size: 0.68rem; color: var(--gray-400); }
.vsi-controls { display: flex; align-items: center; gap: 0.2rem; flex-shrink: 0; }
.vsi-note {
    width: 100%; border: 1px solid var(--gray-200); border-radius: 5px;
    padding: 0.25rem 0.5rem; font-size: 0.75rem; color: var(--gray-600);
}
.vsi-note::placeholder { color: var(--gray-300); }
.vsi-note:focus { outline: none; border-color: var(--primary); }

/* ===================================
   GRID VIEW
   =================================== */
.grid-category-header {
    grid-column: 1 / -1; font-weight: 700; font-size: 0.85rem; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.5px; margin-top: 0.5rem; padding: 0 0.25rem;
}

.product-card-v2 {
    background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
    border: 2px solid transparent; cursor: pointer; transition: all 0.2s; position: relative;
}
.product-card-v2:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.product-card-v2:active { transform: scale(0.98); }
.product-card-v2.has-items { border-color: var(--primary); }

.product-img {
    width: 100%; height: 130px; display: flex; align-items: center;
    justify-content: center; position: relative; overflow: hidden;
}
.product-img > i { font-size: 2.5rem; opacity: 0.6; }
.product-img img {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; z-index: 1; background: white;
}

/* Category-based colors */
.img-bebidas { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); color: #92400e; }
.img-carnes { background: linear-gradient(135deg, #fce7f3 0%, #f9a8d4 100%); color: #9d174d; }
.img-pescado { background: linear-gradient(135deg, #cffafe 0%, #67e8f9 100%); color: #155e75; }
.img-frutas { background: linear-gradient(135deg, #dcfce7 0%, #86efac 100%); color: #166534; }
.img-lacteos { background: linear-gradient(135deg, #faf5ff 0%, #d8b4fe 100%); color: #6b21a8; }
.img-limpieza { background: linear-gradient(135deg, #ecfeff 0%, #a5f3fc 100%); color: #0e7490; }
.img-secos { background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%); color: #9a3412; }

.card-badge {
    position: absolute; top: 6px; right: 6px; background: var(--primary); color: white;
    font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 50px; z-index: 2;
}
.variant-bubble {
    position: absolute; bottom: 6px; left: 6px; background: rgba(0,0,0,0.65); color: white;
    font-size: 0.65rem; font-weight: 600; padding: 0.15rem 0.45rem; border-radius: 4px; z-index: 2;
}
.img-zoom-hint {
    position: absolute; bottom: 6px; right: 6px; z-index: 2;
    width: 24px; height: 24px; border-radius: 50%;
    background: rgba(0,0,0,0.4); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; opacity: 0.7; transition: opacity 0.15s;
}
.product-img:hover .img-zoom-hint { opacity: 1; }
.img-zoom-hint-sm {
    width: 18px; height: 18px; bottom: 3px; right: 3px;
    font-size: 0.55rem; opacity: 0.6;
}
.pli-thumb-clickable:hover .img-zoom-hint-sm { opacity: 1; }

.product-card-info { padding: 0.6rem 0.7rem; }
.product-card-name {
    font-weight: 600; font-size: 0.82rem; color: var(--dark); line-height: 1.2;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-card-sub { font-size: 0.7rem; color: var(--gray-400); margin-top: 0.15rem; }

/* Inline controls */
.card-inline-controls {
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.4rem 0.6rem 0.6rem; border-top: 1px solid var(--gray-100);
}
.cic-btn {
    width: 40px; height: 40px; border: 1px solid var(--gray-200); border-radius: 8px;
    background: var(--gray-50); cursor: pointer; font-size: 1.2rem; font-weight: 700;
    color: var(--gray-600); display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0;
}
.cic-btn:hover { background: var(--gray-200); }
.cic-btn:active { background: var(--gray-300); transform: scale(0.95); }
.cic-btn-plus { background: var(--primary); color: white; border-color: var(--primary); }
.cic-btn-plus:hover { background: #1d4ed8; }
.cic-qty-wrap {
    display: flex; align-items: center; flex-shrink: 0;
    border: 1px solid var(--gray-200); border-radius: 6px;
    height: 40px; min-width: 44px; padding: 0 4px;
    background: white;
}
.cic-qty-wrap:focus-within { border-color: var(--primary); background: var(--primary-light); }
.cic-input {
    width: 1.6em; height: 100%; border: none; background: transparent;
    text-align: right; padding: 0;
    font-weight: 700; font-size: 1rem; color: var(--dark);
    -moz-appearance: textfield;
}
.cic-input::-webkit-outer-spin-button,
.cic-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cic-input:focus { outline: none; }
.cic-qty-fmt {
    font-size: 0.7rem; font-weight: 700; color: var(--gray-500);
    line-height: 1; padding-left: 2px; cursor: pointer;
    -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.cic-qty-fmt.fmt-toggleable {
    color: var(--primary); text-decoration: underline; text-decoration-style: dotted;
    text-underline-offset: 2px; animation: fmtPulse 2.5s ease-in-out 1;
}
.cic-qty-fmt.fmt-changed {
    color: #ea580c; background: #fff7ed; border-radius: 3px; padding: 1px 3px;
    text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px;
}
@keyframes fmtPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.product-card-expandable { cursor: pointer; }
.product-card-expandable.expanded { border-color: var(--primary); box-shadow: var(--shadow-md); }

/* Variant panel (grid view) */
.variant-panel {
    grid-column: 1 / -1; background: white; border-radius: var(--radius);
    box-shadow: var(--shadow-md); border: 2px solid var(--primary);
    overflow: hidden; animation: panelSlideDown 0.2s ease-out;
}
@keyframes panelSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.variant-panel-title {
    padding: 0.65rem 0.9rem; font-weight: 700; font-size: 0.82rem; color: var(--primary);
    background: var(--primary-light); border-bottom: 1px solid var(--gray-200);
}
.variant-row-inline {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
    padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--gray-100); transition: background 0.15s;
}
.variant-row-inline:last-child { border-bottom: none; }
.variant-row-inline.has-qty { background: #f0f7ff; }
.vri-info { flex: 1; min-width: 120px; }
.vri-name { font-weight: 600; font-size: 0.85rem; color: var(--dark); }
.vri-code { font-size: 0.7rem; color: var(--gray-400); }
.vri-controls { display: flex; align-items: center; gap: 0.3rem; }
.vri-note {
    width: 100%; border: 1px solid var(--gray-200); border-radius: 6px;
    padding: 0.3rem 0.6rem; font-size: 0.78rem; color: var(--gray-600); margin-top: 0.2rem;
}
.vri-note::placeholder { color: var(--gray-300); }
.vri-note:focus { outline: none; border-color: var(--primary); }

/* ===================================
   FAB
   =================================== */
.fab-container {
    position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
    z-index: 200; animation: fabSlideUp 0.3s ease-out;
}
@keyframes fabSlideUp {
    from { transform: translateX(-50%) translateY(100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.fab {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.9rem 1.8rem;
    background: var(--primary); color: white; border: none; border-radius: 50px;
    font-size: 1rem; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4); transition: all 0.2s; white-space: nowrap;
}
.fab:hover { background: #1d4ed8; box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5); transform: translateY(-1px); }
.fab.fab-pulse { animation: fabPulse 1.5s ease-in-out infinite; }
@keyframes fabPulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4); }
    50% { box-shadow: 0 4px 24px rgba(37, 99, 235, 0.8), 0 0 0 8px rgba(37, 99, 235, 0.15); }
}
.fab i { font-size: 1.2rem; }

/* ===================================
   RESUMEN
   =================================== */
.resumen-item {
    background: white; border-radius: var(--radius-sm); padding: 0.8rem;
    margin-bottom: 0.5rem; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100);
}
.resumen-item-header { display: flex; justify-content: space-between; align-items: flex-start; }
.resumen-item-name { font-weight: 600; font-size: 0.88rem; color: var(--dark); }
.resumen-item-variant { font-size: 0.78rem; color: var(--gray-500); }
.resumen-item-qty { font-weight: 700; font-size: 0.95rem; color: var(--primary); white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.fmt-changed-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%; background: #ea580c; color: white;
    font-size: 0.6rem; font-weight: 900;
}
.resumen-item-note { font-size: 0.8rem; color: var(--danger); font-style: italic; margin-top: 0.2rem; }
.resumen-item-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; align-items: center; }
.resumen-remove { background: none; border: none; color: var(--danger); cursor: pointer; padding: 0.25rem; font-size: 1.1rem; }
.resumen-total { border: 2px solid var(--primary); border-radius: var(--radius-sm); }
.quick-qty-group { display: flex; align-items: center; border: 1px solid var(--gray-200); border-radius: 6px; overflow: hidden; }
.quick-qty-formato { min-width: 32px; text-align: center; font-size: 0.75rem; font-weight: 700; color: var(--gray-500); white-space: nowrap; -webkit-tap-highlight-color: transparent; padding: 4px 6px; cursor: pointer; }
.quick-qty-formato.fmt-toggleable { color: var(--primary); text-decoration: underline dotted; text-underline-offset: 2px; }
.quick-qty-formato.fmt-changed { color: #ea580c; background: #fff7ed; text-decoration: underline dotted; text-underline-offset: 2px; }
.quick-qty-btn {
    width: 36px; height: 36px; border: none; background: var(--gray-50); cursor: pointer;
    font-size: 1.1rem; font-weight: 700; color: var(--gray-600);
    display: flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.quick-qty-btn:hover { background: var(--gray-200); }
.quick-qty-input {
    width: 42px; height: 36px; border: none; border-left: 1px solid var(--gray-200);
    border-right: 1px solid var(--gray-200); text-align: center; font-weight: 700;
    font-size: 0.9rem; -moz-appearance: textfield;
}
.quick-qty-input::-webkit-outer-spin-button,
.quick-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.quick-qty-input:focus { outline: none; background: var(--primary-light); }

/* ===================================
   MIS PEDIDOS
   =================================== */
.pedido-card {
    background: white; border-radius: var(--radius-sm); padding: 1rem;
    margin-bottom: 0.75rem; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100);
}
.pedido-card-clickable { cursor: pointer; transition: all 0.15s; }
.pedido-card-clickable:active { transform: scale(0.98); background: var(--gray-50); }

/* ===================================
   DETALLE PEDIDO
   =================================== */
.detalle-fecha { font-size: 0.82rem; }
.detalle-notas-general {
    background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem; margin-bottom: 0.75rem;
    font-size: 0.82rem; color: #92400e;
    display: flex; align-items: flex-start; gap: 0.5rem;
}
.detalle-notas-general i { margin-top: 0.1rem; flex-shrink: 0; }

.detalle-proveedor {
    background: white; border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow-sm); margin-bottom: 0.75rem;
}
.detalle-proveedor-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1rem; background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}
.detalle-proveedor-header i { color: var(--primary); }

.detalle-linea {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.6rem 1rem; border-bottom: 1px solid var(--gray-100);
}
.detalle-linea:last-child { border-bottom: none; }
.detalle-linea-info { flex: 1; min-width: 0; }
.detalle-linea-nombre { font-weight: 500; font-size: 0.85rem; color: var(--dark); }
.detalle-linea-nota {
    font-size: 0.72rem; color: var(--gray-400);
    display: flex; align-items: center; gap: 0.3rem; margin-top: 0.15rem;
}
.detalle-linea-nota i { font-size: 0.65rem; }
.detalle-linea-qty {
    font-weight: 700; font-size: 1rem; color: var(--primary);
    text-align: right; white-space: nowrap; flex-shrink: 0; margin-left: 0.75rem;
}
.detalle-linea-qty small { font-size: 0.7rem; font-weight: 500; }

/* Status messages in detalle */
.detalle-status-msg {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.85rem 1rem; border-radius: var(--radius-sm);
    margin-bottom: 0.75rem; font-size: 0.82rem; line-height: 1.4;
}
.detalle-status-msg > i { font-size: 1.3rem; flex-shrink: 0; margin-top: 0.1rem; }
.detalle-status-pending {
    background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
}
.detalle-status-pending > i { color: #f59e0b; }
.detalle-status-ready {
    background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534;
}
.detalle-status-ready > i { color: #16a34a; }

/* ===================================
   SUCCESS CHECK
   =================================== */
.success-check { animation: successPop 0.5s ease-out; }
@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===================================
   UTILITIES
   =================================== */
.badge { font-weight: 600; font-size: 0.75rem; padding: 0.35em 0.65em; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Toast */
.toast-notification {
    position: fixed; top: 1rem; right: 1rem; background: var(--dark); color: white;
    padding: 0.75rem 1.25rem; border-radius: var(--radius-sm); font-size: 0.88rem;
    font-weight: 500; z-index: 10000; box-shadow: var(--shadow-lg);
    animation: toastSlide 0.3s ease-out;
}
@keyframes toastSlide {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===================================
   FAVORITOS
   =================================== */

.fav-star {
    position: absolute; top: 2px; left: 2px; z-index: 5;
    background: none; border: none; cursor: pointer; padding: 0;
    font-size: 0.75rem; color: var(--gray-300); line-height: 1;
    opacity: 0.7; transition: all 0.15s;
}
.fav-star:hover, .fav-star.active { opacity: 1; }
.fav-star.active { color: #f59e0b; }

.fav-star-grid {
    top: 6px; left: 6px; font-size: 0.9rem;
}

/* ===================================
   PEDIDO HABITUAL
   =================================== */
.habitual-banner {
    display: flex; align-items: center; gap: 0.75rem;
    margin: 0.75rem 1rem; padding: 0.85rem 1rem;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px solid var(--primary); border-radius: var(--radius);
    cursor: pointer; transition: all 0.2s;
}
.habitual-banner:active { transform: scale(0.98); }
.habitual-banner-icon {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.habitual-banner-text { flex: 1; }
.habitual-banner-title { font-weight: 700; font-size: 0.9rem; color: var(--dark); }
.habitual-banner-sub { font-size: 0.75rem; color: var(--gray-500); }

.habitual-screen {
    position: fixed; inset: 0; z-index: 150;
    background: var(--gray-100); overflow-y: auto;
}
.habitual-section {
    background: white; border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.habitual-section-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.85rem 1rem; border-bottom: 1px solid var(--gray-100);
}
.habitual-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.7rem 1rem; border-bottom: 1px solid var(--gray-100);
}
.habitual-item:last-child { border-bottom: none; }
.habitual-item-pf { cursor: pointer; transition: background 0.15s; }
.habitual-item-pf:active { background: var(--gray-50); }
.habitual-item-info { flex: 1; min-width: 0; }
.habitual-item-name { font-weight: 600; font-size: 0.85rem; color: var(--dark); }
.habitual-item-meta {
    font-size: 0.72rem; color: var(--gray-400);
    display: flex; gap: 0.5rem; align-items: center; margin-top: 0.15rem;
}
.habitual-item-qty {
    font-weight: 700; font-size: 1rem; color: var(--primary);
    text-align: right; white-space: nowrap; flex-shrink: 0; margin-left: 0.5rem;
}
.habitual-item-qty small { font-size: 0.7rem; font-weight: 500; }
.habitual-freq-badge {
    background: #fee2e2; color: #dc2626; font-size: 0.65rem;
    font-weight: 600; padding: 0.1rem 0.4rem; border-radius: 4px;
}
.habitual-freq-badge.pf { background: var(--gray-100); color: var(--gray-500); }

/* ===================================
   DEADLINE PILL (topbar)
   =================================== */
.deadline-pill {
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.15rem 0.5rem; border-radius: 50px;
    font-size: 0.65rem; font-weight: 600; white-space: nowrap;
}
.deadline-green { background: #dcfce7; color: #166534; }
.deadline-amber { background: #fef3c7; color: #92400e; }
.deadline-red   { background: #fee2e2; color: #991b1b; }
.deadline-red-pulse { background: #fee2e2; color: #991b1b; animation: deadlinePulse 1.5s infinite; }

@keyframes deadlinePulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* Deadline banner (resumen) */
.deadline-banner {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem; border-radius: 8px;
    font-size: 0.85rem;
}
.deadline-banner-green     { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.deadline-banner-amber     { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.deadline-banner-red,
.deadline-banner-red-pulse { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ===================================
   PRODUCT DETAIL POPUP
   =================================== */
.pli-thumb-clickable { cursor: pointer; }

.product-detail-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}

.product-detail-modal {
    width: 100%; max-width: 420px; max-height: 90vh;
    background: white; border-radius: 16px; margin: 1rem;
    overflow-y: auto; position: relative;
    animation: detailSlideUp 0.25s ease-out;
}
@keyframes detailSlideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.product-detail-close {
    position: absolute; top: 10px; right: 10px; z-index: 5;
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(0,0,0,0.45); color: white; border: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; cursor: pointer; transition: background 0.15s;
}
.product-detail-close:hover { background: rgba(0,0,0,0.65); }

.product-detail-img {
    width: 100%; height: 250px; display: flex;
    align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.product-detail-img img {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; object-fit: contain; z-index: 1; background: white;
}

.fav-star-detail {
    position: absolute; top: 10px; left: 10px; z-index: 5;
    background: rgba(255,255,255,0.85); border: none; cursor: pointer;
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem; color: var(--gray-300);
    transition: all 0.15s;
}
.fav-star-detail:hover, .fav-star-detail.active { color: #f59e0b; }

.product-detail-body { padding: 1rem 1.2rem 1.5rem; }

.product-detail-name {
    font-weight: 700; font-size: 1.15rem; color: var(--dark);
    margin-bottom: 0.4rem;
}

.product-detail-meta {
    display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
    font-size: 0.78rem; color: var(--gray-400); margin-bottom: 0.75rem;
}

.product-detail-controls {
    display: flex; align-items: center; gap: 0.3rem;
}

.product-detail-variant {
    padding: 0.7rem 0; border-bottom: 1px solid var(--gray-100);
}
.product-detail-variant:last-child { border-bottom: none; }
.product-detail-variant.has-qty { background: #f0f7ff; margin: 0 -1.2rem; padding: 0.7rem 1.2rem; }

.product-detail-variant-info { margin-bottom: 0.4rem; }
.product-detail-variant-name {
    font-weight: 600; font-size: 0.88rem; color: var(--dark);
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (min-width: 500px) {
    .product-container.view-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
    .product-container.view-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; padding: 1rem; }
}
