/* MagazzinoOS — replica esatta design LineaOS ordini */

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0; padding: 0;
    font-family: var(--font-family-base);
    font-size: 16px;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

input, textarea, select {
    -webkit-user-select: text; user-select: text;
    font-size: 16px; /* previene zoom iOS */
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#loginScreen {
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 32px 24px; z-index: 2000;
}
.login-card {
    background: white; border-radius: 24px; padding: 32px 28px;
    width: 100%; max-width: 380px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}
.login-logo {
    font-size: 28px; font-weight: 800; color: #1e3a8a;
    text-align: center; margin-bottom: 4px;
}
.login-sub { font-size: 13px; color: #64748b; text-align: center; margin-bottom: 28px; }
.login-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.login-input {
    width: 100%; padding: 12px 14px;
    border: 1.5px solid #e2e8f0; border-radius: 10px;
    font-size: 16px; color: #111827; outline: none;
    transition: border-color 0.15s;
    margin-bottom: 16px;
}
.login-input:focus { border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.12); }
.login-btn {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white; border: none; border-radius: 10px;
    font-size: 16px; font-weight: 700; cursor: pointer;
    min-height: 48px;
    transition: opacity 0.15s;
}
.login-btn:active { opacity: 0.85; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.login-error {
    font-size: 13px; color: #ef4444; text-align: center;
    margin-top: 12px; min-height: 18px;
}

/* ============================================================
   APP SHELL
   ============================================================ */
#appShell { display: none; }

/* ============================================================
   ORDINI-PAGE WRAPPER
   ============================================================ */
.ordini-page {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #111827;
    --muted: #64748b;
    --border: #e2e8f0;
    min-height: 100dvh;
    background: var(--bg);
    padding-bottom: 110px;
    overflow-x: hidden;
}

/* ============================================================
   V6-C MOBILE HEADER — navy card fluttuante
   ============================================================ */
.mobile-header.v6c-header {
    background: #1e3a8a;
    padding: 16px;
    margin: 12px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(30,58,138,0.3), 0 4px 12px rgba(0,0,0,0.15);
    position: sticky;
    top: 12px;
    z-index: 100;
}

/* Row 1 search (tab prodotti) */
.header-search-row { margin-bottom: 12px; }
.v6c-search-box {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.13);
    border-radius: 12px; padding: 10px 14px;
}
.v6c-search-box i { color: rgba(255,255,255,0.6); font-size: 16px; flex-shrink: 0; }
.v6c-search-box input {
    flex: 1; background: none; border: none; outline: none;
    color: white; font-size: 15px;
}
.v6c-search-box input::placeholder { color: rgba(255,255,255,0.5); }
.v6c-fornitore-btn {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.18); border: none; border-radius: 8px;
    padding: 6px 10px; color: white; font-size: 12px; font-weight: 600;
    cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.v6c-fornitore-btn i { font-size: 11px; }

/* Row 1 alternativa: recap ordine (tab ordini) */
.header-recap-row { margin-bottom: 12px; min-height: 48px; display: none; }
.v6c-recap-box {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(255,255,255,0.1); border-radius: 10px; padding: 12px 16px;
}
.recap-left { display: flex; align-items: center; gap: 12px; }
.recap-info-block { display: flex; flex-direction: column; gap: 2px; }
.recap-info-line { font-size: 11px; color: rgba(255,255,255,0.75); }
.recap-info-line i { font-size: 9px; color: rgba(255,255,255,0.4); margin-right: 3px; }
.recap-right { display: flex; align-items: center; gap: 10px; }
.recap-total-block { display: flex; flex-direction: column; align-items: flex-end; }
.recap-total-label { font-size: 11px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.3px; }
.recap-total-value { font-weight: 700; font-size: 18px; color: white; }
.recap-total-value .euro { font-weight: 500; margin-right: 2px; opacity: 0.7; }

/* Row 2: date + tabs */
.header-bottom-row { display: flex; align-items: center; gap: 10px; }
.v6c-date-picker {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.13); border-radius: 10px;
    padding: 8px 12px; cursor: pointer; flex-shrink: 0;
    border: none; outline: none;
    transition: background 0.15s;
}
.v6c-date-picker:hover { background: rgba(255,255,255,0.2); }
.v6c-date-picker:focus-visible { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 2px; }
.v6c-date-picker i { color: rgba(255,255,255,0.8); font-size: 14px; }
.v6c-date-picker .date-text { color: white; font-size: 13px; font-weight: 600; white-space: nowrap; }
.v6c-date-picker .cal-chevron { font-size: 11px; color: rgba(255,255,255,0.5); transition: transform 0.2s; }
.v6c-date-picker.cal-open .cal-chevron { transform: rotate(180deg); }
.v6c-tabs-row {
    flex: 1; display: flex; gap: 2px;
    background: rgba(0,0,0,0.2); border-radius: 10px; padding: 3px;
}
.v6c-tab-btn {
    flex: 1; border: none; background: transparent; border-radius: 7px;
    color: rgba(255,255,255,0.6); font-size: 12px; font-weight: 600;
    padding: 8px 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 5px;
    transition: all 0.15s;
}
.v6c-tab-btn i { font-size: 13px; }
.v6c-tab-btn.active {
    background: white; color: #1e3a8a;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* ============================================================
   FILTRI FORNITORE (dropdown sotto header)
   ============================================================ */
.fornitore-filter-panel {
    margin: 0 12px 8px; background: white; border-radius: 12px;
    padding: 12px; box-shadow: var(--shadow-md);
    display: none;
}
.fornitore-filter-panel.visible { display: block; }
.filter-chips {
    display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
    -ms-overflow-style: none; padding-bottom: 2px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
    padding: 6px 12px; border-radius: 16px; font-size: 12px; font-weight: 500;
    background: var(--card); border: 1px solid var(--border); color: var(--muted);
    white-space: nowrap; flex-shrink: 0; cursor: pointer; transition: all 0.15s;
}
.filter-chip.active {
    background: var(--primary-light); border-color: var(--primary);
    color: var(--primary-dark); font-weight: 600;
}

/* ============================================================
   TAB CONTENT
   ============================================================ */
.tab-content { display: none; padding: 8px 12px; }
.tab-content.active { display: block; }

/* ============================================================
   PRODUCT ITEMS
   ============================================================ */
.product-item {
    background: var(--card); border-radius: var(--radius-lg);
    padding: 14px; margin-bottom: 8px;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: var(--shadow-xs); cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}
.product-item:active { background: var(--primary-light); }
.product-item.added {
    border-color: var(--primary);
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}
.product-info { flex: 1; min-width: 0; }
.product-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.product-desc {
    font-size: 11px; color: #9ca3af; margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.product-meta { font-size: 12px; color: var(--muted); }
.product-supplier { color: var(--primary-dark); font-weight: 500; }
.product-pricing { text-align: right; margin-right: 10px; }
.price-collo { font-weight: 700; font-size: 15px; color: var(--primary-dark); }
.price-um { font-size: 11px; color: var(--muted); }
.add-indicator {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
    transition: all 0.15s;
}
.product-item.added .add-indicator {
    background: white; color: var(--primary);
    border: 2px solid var(--primary); font-size: 14px;
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton-row {
    display: flex; align-items: center; gap: 12px;
    padding: 14px; background: white; border-radius: 12px;
    margin-bottom: 8px;
}
.skeleton { background: #e5e7eb; border-radius: 6px; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skeleton-line { height: 12px; }
.w-40 { width: 40%; } .w-60 { width: 60%; } .w-80 { width: 80%; }

/* ============================================================
   ORDINE CARDS (tab Ordini)
   ============================================================ */
.ordini-date-group { margin-bottom: 20px; }
.ordini-date-header {
    font-size: 15px; font-weight: 700; color: var(--text);
    padding: 10px 0 8px; border-bottom: 2px solid var(--primary);
    margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.ordini-date-header i { color: var(--primary); }

.ordine-card {
    background: var(--card); border-radius: 12px;
    margin-bottom: 10px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: pointer;
}
.ordine-header {
    padding: 14px; display: flex;
    justify-content: space-between; align-items: center;
}
.ordine-info { flex: 1; min-width: 0; }
.ordine-id { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.ordine-fornitori { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.ordine-meta { font-size: 12px; color: var(--muted); }
.ordine-right { text-align: right; }
.ordine-status {
    padding: 4px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600; margin-bottom: 4px;
    display: inline-block;
}
.ordine-status.bozza    { background: #fef3c7; color: #d97706; }
.ordine-status.inviato  { background: #dbeafe; color: #1d4ed8; }
.ordine-status.ricevuto { background: #d1fae5; color: #059669; }
.ordine-status.annullato{ background: #f3f4f6; color: #9ca3af; }
.ordine-total { font-size: 16px; font-weight: 700; color: var(--primary-dark); }

/* Dettagli fornitore all'interno ordine */
.fornitore-section {
    margin-bottom: 16px; background: var(--card);
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.fornitore-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    font-weight: 600; font-size: 14px; color: white;
    display: flex; justify-content: space-between; align-items: center;
}

/* ============================================================
   ORDINE DETAIL (full screen overlay)
   ============================================================ */
#ordineDetail {
    position: fixed; inset: 0; background: var(--bg);
    z-index: 500; overflow-y: auto; display: none;
}
.detail-topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 16px; background: white;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.detail-back-btn {
    width: 40px; height: 40px; border: none; background: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; cursor: pointer; color: var(--text);
    border-radius: 8px;
}
.detail-back-btn:active { background: var(--color-bg); }
.detail-title { font-size: 17px; font-weight: 700; flex: 1; }
.detail-body { padding: 16px; }

.detail-info-card {
    background: white; border-radius: 12px; padding: 16px;
    margin-bottom: 12px; box-shadow: var(--shadow-xs);
}
.detail-info-label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.detail-info-value { font-size: 15px; font-weight: 600; }

.detail-riga {
    background: white; border-radius: 10px; padding: 12px 14px;
    margin-bottom: 8px; box-shadow: var(--shadow-xs);
}
.detail-riga-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.detail-riga-meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.detail-riga-foot {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px;
}
.detail-riga-qty { color: var(--muted); }
.detail-riga-price { font-weight: 700; color: var(--primary-dark); }

.detail-total-card {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid var(--primary); border-radius: 12px;
    padding: 16px; margin: 12px 0; display: flex;
    justify-content: space-between; align-items: center;
}
.detail-total-label { font-size: 14px; color: var(--primary-dark); font-weight: 600; }
.detail-total-value { font-size: 22px; font-weight: 800; color: var(--primary-dark); }

.btn-action {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px; border: none; border-radius: 12px;
    font-size: 15px; font-weight: 700; cursor: pointer;
    min-height: 50px; margin-bottom: 10px;
    transition: opacity 0.15s;
}
.btn-action:active { opacity: 0.8; }
.btn-action.primary { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: white; }
.btn-action.ghost { background: white; color: var(--text); border: 1.5px solid var(--border); }
.btn-action.danger { background: #fef2f2; color: #ef4444; border: 1.5px solid #fecaca; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty-state i { font-size: 48px; opacity: 0.3; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 15px; margin: 0; }

/* ============================================================
   NO-RESULTS
   ============================================================ */
.no-results-message {
    display: none; text-align: center; padding: 40px 20px; color: var(--muted);
}
.no-results-message.visible { display: block; }
.no-results-message i { font-size: 3rem; color: #cbd5e1; margin-bottom: 16px; display: block; }
.no-results-message h3 { font-size: 1.1rem; color: #374151; margin-bottom: 8px; }

/* ============================================================
   B4 CART — floating bottom (solo mobile)
   ============================================================ */
.b4-cart-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); z-index: 999;
}
.b4-cart-overlay.visible { display: block; }

.b4-cart {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 12px; right: 12px;
    background: white; border-radius: 24px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.04), 0 10px 40px rgba(0,0,0,0.12);
    z-index: 1000; overflow: hidden;
    max-height: 84px;
    transition: max-height 0.5s cubic-bezier(0.4,0,0.2,1), box-shadow 0.4s ease;
}
.b4-cart.open {
    max-height: 80vh;
    box-shadow: 0 8px 16px rgba(0,0,0,0.08), 0 24px 64px rgba(0,0,0,0.16);
}
.b4-cart.empty { max-height: 76px; }

.b4-cart-header {
    display: flex; align-items: center; padding: 16px 18px;
    gap: 14px; cursor: pointer; background: white;
    transition: background 0.2s;
}
.b4-cart-header:active { background: #f9fafb; }
.b4-cart.open .b4-cart-header { border-bottom: 1px solid #f3f4f6; }

.b4-cart-icon-wrap { position: relative; flex-shrink: 0; }
.b4-cart-icon {
    width: 52px; height: 52px;
    background: linear-gradient(145deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 22px;
    box-shadow: 0 4px 12px rgba(37,99,235,0.35);
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
}
.b4-cart.open .b4-cart-icon { transform: scale(0.92); }
.b4-cart.empty .b4-cart-icon {
    background: linear-gradient(145deg, #d1d5db 0%, #9ca3af 100%);
    box-shadow: none;
}
.b4-cart-badge {
    position: absolute; top: -6px; right: -6px;
    background: #ef4444; color: white; font-size: 11px; font-weight: 700;
    min-width: 24px; height: 24px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    border: 3px solid white; box-shadow: 0 2px 8px rgba(239,68,68,0.4);
    animation: b4BadgePop 0.3s cubic-bezier(0.4,0,0.2,1);
}
.b4-cart-badge.hidden { display: none; }
@keyframes b4BadgePop { 0%{transform:scale(0)} 50%{transform:scale(1.2)} 100%{transform:scale(1)} }

.b4-cart-info { flex: 1; min-width: 0; }
.b4-cart-title { font-size: 16px; font-weight: 700; color: #1f2937; margin-bottom: 2px; }
.b4-cart-preview { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #6b7280; }
.b4-cart-preview-empty { color: #9ca3af; font-style: italic; }

.b4-cart-right { display: flex; align-items: center; gap: 10px; }
.b4-cart-total-pill {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1d4ed8; padding: 10px 16px; border-radius: 14px;
    font-size: 15px; font-weight: 700; transition: all 0.3s;
}
.b4-cart.empty .b4-cart-total-pill { background: #f3f4f6; color: #9ca3af; }
.b4-cart-arrow {
    width: 36px; height: 36px; background: #f3f4f6; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #6b7280; font-size: 14px;
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
}
.b4-cart.open .b4-cart-arrow { transform: rotate(180deg); background: #2563eb; color: white; }
.b4-cart.empty .b4-cart-arrow { opacity: 0.5; }

.b4-cart-content {
    max-height: 0; overflow: hidden; opacity: 0;
    transform: translateY(-8px);
    transition: max-height 0.5s cubic-bezier(0.4,0,0.2,1), opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}
.b4-cart.open .b4-cart-content { max-height: 65vh; opacity: 1; transform: translateY(0); }

.b4-cart-empty-state { padding: 24px; text-align: center; }
.b4-cart-empty-illustration { font-size: 40px; margin-bottom: 8px; }
.b4-cart-empty-title { font-size: 15px; font-weight: 700; color: #1f2937; margin-bottom: 4px; }
.b4-cart-empty-desc { font-size: 13px; color: #9ca3af; }

.b4-cart-swipe-hint {
    padding: 10px 16px; background: #eff6ff; text-align: center;
    font-size: 12px; color: #1d4ed8;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.b4-cart-items {
    padding: 12px 16px; max-height: 42vh; overflow-y: auto;
    background: linear-gradient(180deg, #f9fafb 0%, white 100%);
}
.b4-cart-item-wrapper {
    position: relative; margin-bottom: 10px;
    overflow: hidden; border-radius: 18px;
}
.b4-cart-item-wrapper:last-child { margin-bottom: 0; }
.b4-cart-item-delete {
    position: absolute; right: 0; top: 0; bottom: 0; width: 80px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 20px; border-radius: 0 18px 18px 0; cursor: pointer;
}
.b4-cart-item {
    display: flex; align-items: center; background: white;
    padding: 14px; gap: 12px; position: relative;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    border-radius: 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #f3f4f6;
}
.b4-cart-item.swiped { transform: translateX(-80px); }
.b4-cart-item-emoji {
    font-size: 22px; width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: #f9fafb; border-radius: 12px; flex-shrink: 0;
}
.b4-cart-item-info { flex: 1; min-width: 0; }
.b4-cart-item-name {
    font-size: 14px; font-weight: 600; color: #1f2937; margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.b4-cart-item-meta { font-size: 12px; color: #6b7280; }
.b4-cart-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.b4-cart-item-total { font-size: 15px; font-weight: 700; color: #1f2937; }
.b4-cart-item-stepper {
    display: flex; align-items: center; gap: 6px;
    background: #f3f4f6; border-radius: 20px; padding: 3px 6px;
}
.b4-stepper-btn {
    width: 26px; height: 26px; border: none; background: none;
    font-size: 18px; font-weight: 700; cursor: pointer; color: #374151;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: background 0.1s;
}
.b4-stepper-btn:active { background: #e5e7eb; }
.b4-stepper-val { font-size: 14px; font-weight: 700; min-width: 24px; text-align: center; color: #1f2937; }

.b4-cart-footer {
    display: flex; gap: 10px; padding: 12px 16px;
    background: white; border-top: 1px solid #f3f4f6;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.b4-cart-btn {
    flex: 1; padding: 14px; border: none; border-radius: 14px;
    font-size: 15px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: opacity 0.15s;
}
.b4-cart-btn:active { opacity: 0.8; }
.b4-cart-btn.clear { background: #f3f4f6; color: #6b7280; flex: 0 0 auto; padding: 14px 20px; }
.b4-cart-btn.order {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white; box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}
.b4-cart-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* utility — sostituisce style="display:none" inline */
.hidden-init { display: none; }

/* ============================================================
   CUSTOM CALENDAR
   ============================================================ */
.cal-overlay {
    position: fixed; inset: 0; z-index: 1100;
    background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none;
    transition: opacity 0.35s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.cal-overlay.active { opacity: 1; pointer-events: auto; }

/* Mobile default: floating bottom sheet */
.cal-panel {
    position: fixed; z-index: 1110;
    bottom: 10px; left: 10px; right: 10px;
    background: white; border-radius: 24px;
    box-shadow: 0 -4px 40px rgba(0,0,0,0.18), 0 4px 40px rgba(0,0,0,0.18);
    transform: translate3d(0, calc(100% + 20px), 0);
    transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.cal-panel.open { transform: translate3d(0, 0, 0); }

.cal-handle { padding: 10px 0 2px; display: flex; justify-content: center; }
.cal-handle-bar { width: 36px; height: 4px; border-radius: 2px; background: #e2e8f0; }

.cal-inner { padding: 8px 20px 28px; }

.cal-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px;
}
.cal-nav-btn {
    width: 38px; height: 38px; border: none;
    background: #f1f5f9; border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #334155; font-size: 14px;
    transition: background 0.15s;
}
.cal-nav-btn:hover { background: #e2e8f0; }
.cal-nav-btn:active { background: #cbd5e1; }
.cal-month-year { font-size: 16px; font-weight: 700; color: #111827; }

.cal-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    margin-bottom: 6px;
}
.cal-weekdays span {
    text-align: center; font-size: 11px; font-weight: 600;
    color: #94a3b8; padding: 4px 0;
    text-transform: uppercase; letter-spacing: 0.4px;
}
.cal-weekdays span:nth-child(6),
.cal-weekdays span:nth-child(7) { color: #f87171; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }

.cal-day {
    aspect-ratio: 1; border: none; background: none; cursor: pointer;
    border-radius: 50%; font-size: 13px; font-weight: 500; color: #1f2937;
    display: flex; align-items: center; justify-content: center;
    width: 100%; transition: background 0.12s, color 0.12s;
    position: relative;
}
.cal-day:hover:not(.other):not(.selected) { background: #f1f5f9; }
.cal-day:active:not(.other) { background: #e2e8f0; }
.cal-day.other { color: #cbd5e1; pointer-events: none; }
.cal-day.today:not(.selected) {
    color: #1d4ed8; font-weight: 700;
}
.cal-day.today:not(.selected)::after {
    content: '';
    position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 50%; background: #1d4ed8;
}
.cal-day.selected {
    background: #1e3a8a; color: white; font-weight: 700;
    box-shadow: 0 2px 10px rgba(30,58,138,0.35);
}
.cal-day.today.selected { background: #10b981; box-shadow: 0 2px 10px rgba(16,185,129,0.35); }
.cal-day.today.selected::after { display: none; }

.cal-today-btn {
    display: block; width: 100%; margin-top: 14px;
    padding: 12px; background: #f8fafc; border: 1.5px solid #e2e8f0;
    border-radius: 12px; font-size: 14px; font-weight: 600;
    color: #334155; cursor: pointer; transition: background 0.15s;
}
.cal-today-btn:hover { background: #f1f5f9; }
.cal-today-btn:active { background: #e2e8f0; }

/* Desktop layout hidden on mobile */
.desktop-layout-wrapper { display: none; }

/* ============================================================
   APP SIDEBAR
   ============================================================ */

/* Mobile hamburger button */
.v6c-menu-btn {
    width: 36px; height: 36px; flex-shrink: 0;
    background: rgba(255,255,255,0.15);
    border: none; border-radius: 8px;
    color: #fff; font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 150ms ease;
}
.v6c-menu-btn:hover { background: rgba(255,255,255,0.25); }

/* Overlay (mobile drawer) */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 1190;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* Sidebar base */
.app-sidebar {
    position: fixed;
    top: 0; left: -280px; bottom: 0;
    width: 260px;
    background: #1F2937;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transition: left 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
    overflow: hidden;
}
.app-sidebar.open { left: 0; }

/* Brand header */
.sidebar-header {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: 64px; flex-shrink: 0;
}
.sidebar-logo {
    width: 36px; height: 36px; flex-shrink: 0;
    background: #10B981; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px;
}
.sidebar-app-name {
    color: #F9FAFB; font-weight: 700; font-size: 15px;
    letter-spacing: -0.2px; white-space: nowrap; flex: 1;
}
.sidebar-close-mobile {
    background: none; border: none;
    color: #9CA3AF; font-size: 16px; cursor: pointer;
    padding: 6px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background 150ms ease, color 150ms ease;
}
.sidebar-close-mobile:hover { background: rgba(255,255,255,0.08); color: #F9FAFB; }

/* Desktop-only toggle button (hidden on mobile) */
.sidebar-toggle-btn { display: none; }

/* Nav */
.sidebar-nav {
    flex: 1; padding: 12px 8px;
    display: flex; flex-direction: column; gap: 2px;
    overflow-y: auto;
}
.sidebar-bottom {
    padding: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

/* Nav items */
.sidebar-item {
    width: 100%; display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 8px;
    background: none; border: none;
    color: #9CA3AF; font-size: 14px; font-weight: 500;
    cursor: pointer; text-align: left;
    transition: background 150ms ease, color 150ms ease;
    white-space: nowrap;
}
.sidebar-item i { font-size: 18px; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sidebar-item-soon {
    font-size: 10px; font-weight: 600;
    background: rgba(255,255,255,0.07); color: #6B7280;
    padding: 2px 6px; border-radius: 10px; flex-shrink: 0;
}
.sidebar-item:hover { background: rgba(255,255,255,0.06); color: #F9FAFB; }
.sidebar-item.active { background: rgba(16,185,129,0.15); color: #10B981; }
.sidebar-item.active i { color: #10B981; }

/* ============================================================
   DESKTOP LAYOUT (≥ 769px)
   ============================================================ */
@media (min-width: 769px) {

    /* --- Hide mobile elements --- */
    .ordini-page { display: none !important; }
    .b4-cart, .b4-cart-overlay { display: none !important; }
    .v6c-menu-btn { display: none !important; }
    .sidebar-overlay { display: none !important; }

    /* --- Desktop sidebar --- */
    .app-sidebar {
        top: 16px; left: 16px; bottom: 16px;
        width: 60px;
        border-radius: 12px;
        box-shadow: 0 4px 24px rgba(0,0,0,0.2);
        transition: width 280ms cubic-bezier(0.2,0,0,1);
    }
    .app-sidebar.open { left: 16px; } /* override mobile .open */
    .sidebar-close-mobile { display: none; }
    .sidebar-toggle-btn {
        display: flex; align-items: center; justify-content: center;
        width: 100%; padding: 12px 0; flex-shrink: 0;
        background: none; border: none;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        color: #6B7280; font-size: 18px; cursor: pointer;
        transition: background 150ms ease, color 150ms ease;
    }
    .sidebar-toggle-btn:hover { background: rgba(255,255,255,0.06); color: #F9FAFB; }
    /* Collapsed: center icons, hide text */
    .sidebar-header { justify-content: center; padding: 16px 12px; }
    .sidebar-item { justify-content: center; padding: 10px 8px; }
    .sidebar-item-label,
    .sidebar-item-soon,
    .sidebar-app-name {
        opacity: 0; width: 0; overflow: hidden;
        transition: opacity 120ms ease, width 0ms linear 130ms;
        pointer-events: none;
    }
    /* Expanded state */
    body.sidebar-expanded .app-sidebar { width: 220px; }
    body.sidebar-expanded .sidebar-header { justify-content: flex-start; }
    body.sidebar-expanded .sidebar-item { justify-content: flex-start; padding: 10px 12px; }
    body.sidebar-expanded .sidebar-item-label,
    body.sidebar-expanded .sidebar-item-soon,
    body.sidebar-expanded .sidebar-app-name {
        opacity: 1; width: auto;
        transition: opacity 180ms ease 140ms, width 0ms linear;
        pointer-events: auto;
    }

    /* --- Desktop wrapper fills viewport, offset for sidebar --- */
    .desktop-layout-wrapper {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: 0;
        background: #F3F4F6;
        padding: 16px 16px 16px 76px; /* 60px sidebar + 16px gap */
        box-sizing: border-box;
        transition: padding-left 280ms cubic-bezier(0.2,0,0,1);
    }
    body.sidebar-expanded .desktop-layout-wrapper {
        padding-left: 236px; /* 220px sidebar + 16px gap */
    }

    /* --- Grid 2 colonne --- */
    .layout-container {
        display: grid;
        grid-template-columns: 1fr 360px;
        gap: 16px;
        flex: 1;
        min-height: 0;
    }

    /* --- Colonna sinistra: toolbar + content --- */
    .col-left {
        display: grid;
        grid-template-rows: auto 1fr;
        gap: 12px;
        min-height: 0;
    }

    .col-left-header {
        background: white;
        border-radius: 12px;
        padding: 12px 16px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    .col-left-content {
        background: white;
        border-radius: 12px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    .col-left-content .tab-content {
        display: none;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }
    .col-left-content .tab-content.active {
        display: flex;
        flex-direction: column;
    }
    #tab-prodotti-desktop.active { padding: 16px; }
    #tab-ordini-desktop.active   { padding: 0; }
    .ordini-main-content { flex: 1; overflow-y: auto; padding: 16px; }

    /* --- Colonna destra: dark sidebar --- */
    .col-right {
        background: #1F2937;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    /* Tab switching: cart ↔ sidebar */
    .col-right .desktop-cart-panel   { display: flex; flex-direction: column; flex: 1; min-height: 0; }
    .col-right .ordini-sidebar-panel { display: none; flex-direction: column; flex: 1; min-height: 0; }
    .desktop-layout-wrapper.tab-ordini-active .col-right .desktop-cart-panel   { display: none; }
    .desktop-layout-wrapper.tab-ordini-active .col-right .ordini-sidebar-panel { display: flex; }

    /* Toolbar */
    .ordini-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        width: 100%;
    }

    .desktop-layout-wrapper.tab-ordini-active .toolbar-search-wrapper { display: none; }
    .desktop-layout-wrapper.tab-ordini-active .ordini-toolbar { justify-content: flex-end; }

    /* Date picker nella toolbar */
    .toolbar-date-picker {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 10px 6px 6px;
        border: none;
        background: none;
        border-radius: 10px;
        cursor: pointer;
        flex-shrink: 0;
        transition: background 0.15s;
    }
    .toolbar-date-picker:hover { background: #F3F4F6; }
    .toolbar-date-icon {
        width: 36px; height: 36px;
        background: #F0FDF4; border-radius: 8px;
        display: flex; align-items: center; justify-content: center;
    }
    .toolbar-date-icon i { color: #10B981; font-size: 16px; }
    .toolbar-date-text {
        font-size: 14px; font-weight: 600; color: #1F2937; white-space: nowrap;
    }

    /* Search box con fornitore dropdown */
    .toolbar-search-wrapper { position: relative; flex: 1; max-width: 520px; }
    .toolbar-search-box {
        display: flex; align-items: center;
        background: white; border-radius: 12px;
        border: 1px solid #E5E7EB;
        box-shadow: 0 1px 2px rgba(0,0,0,0.05);
        overflow: visible; position: relative;
        transition: border-color 0.15s, box-shadow 0.15s;
    }
    .toolbar-search-box:focus-within {
        border-color: #10B981;
        box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
    }
    .toolbar-search-input-wrapper {
        flex: 1; display: flex; align-items: center; gap: 10px;
        padding: 10px 16px;
        padding-right: 180px;
    }
    .toolbar-search-input-wrapper i { color: #94A3B8; font-size: 16px; }
    .toolbar-search-input-wrapper input {
        border: none; background: transparent; font-size: 15px;
        color: #1F2937; outline: none; width: 100%;
    }
    .toolbar-search-input-wrapper input::placeholder { color: #94A3B8; }

    /* Fornitore select dentro search box */
    .toolbar-fornitore-select-wrapper {
        position: absolute; right: 6px; top: 50%; transform: translateY(-50%); z-index: 10;
    }
    .toolbar-fornitore-select-btn {
        display: flex; align-items: center; gap: 6px;
        padding: 6px 10px;
        background: #F3F4F6; border: none; border-radius: 6px;
        cursor: pointer; transition: background 0.15s;
    }
    .toolbar-fornitore-select-btn:hover { background: #E5E7EB; }
    .toolbar-fornitore-name { font-size: 13px; font-weight: 500; color: #374151; white-space: nowrap; }
    .toolbar-dropdown-arrow { color: #6B7280; font-size: 10px; transition: transform 0.2s; }
    .toolbar-fornitore-select-btn.active .toolbar-dropdown-arrow { transform: rotate(180deg); }

    .toolbar-fornitore-dropdown {
        position: absolute; top: calc(100% + 6px); right: 0;
        min-width: 200px; background: white; border-radius: 8px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.15);
        padding: 4px; display: none; z-index: 200;
        max-height: 280px; overflow-y: auto;
    }
    .toolbar-fornitore-dropdown.active {
        display: block;
        animation: toolbarSlideDown 0.15s ease;
    }
    @keyframes toolbarSlideDown {
        from { opacity: 0; transform: translateY(-6px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .toolbar-fornitore-item {
        display: flex; align-items: center; gap: 10px;
        padding: 8px 12px; border-radius: 6px; cursor: pointer;
        transition: background 0.12s;
    }
    .toolbar-fornitore-item:hover { background: #F3F4F6; }
    .toolbar-fornitore-item.selected { background: #F0FDF4; }
    .toolbar-fornitore-item-name { font-size: 13px; font-weight: 500; color: #1F2937; flex: 1; }
    .toolbar-check-icon { color: #10B981; font-size: 14px; opacity: 0; }
    .toolbar-fornitore-item.selected .toolbar-check-icon { opacity: 1; }

    /* Tabs con sliding indicator */
    .toolbar-tabs {
        display: flex; gap: 0;
        background: #F3F4F6; padding: 4px; border-radius: 10px;
        position: relative; flex-shrink: 0;
    }
    .toolbar-tabs-slider {
        position: absolute; top: 4px; bottom: 4px; left: 4px;
        width: calc(50% - 4px);
        background: white; border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
        z-index: 0;
    }
    .toolbar-tabs.ordini-active .toolbar-tabs-slider { transform: translateX(100%); }
    .toolbar-tab {
        padding: 10px 24px; border: none; background: transparent;
        font-size: 14px; font-weight: 600; color: #6B7280;
        cursor: pointer; display: flex; align-items: center; gap: 8px;
        border-radius: 8px; transition: color 0.2s;
        z-index: 1; position: relative;
    }
    .toolbar-tab:hover:not(.active) { color: #374151; }
    .toolbar-tab.active { color: #1F2937; }
    .toolbar-tab i { font-size: 16px; }
    .toolbar-tab.active i { color: #10B981; }

    /* Product list desktop: colonna singola (stesso stile LineaOS) */
    .products-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
    #productListDesktop .product-item { margin-bottom: 0; }

    /* --- Cart Panel (colonna destra) --- */
    .desktop-cart-panel { background: transparent; overflow: hidden; }

    .desktop-cart-header {
        flex-shrink: 0;
        padding: 16px 24px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        color: white;
    }
    .cart-header-top {
        display: flex; align-items: center; justify-content: space-between;
    }
    .desktop-cart-header h2 {
        font-size: 16px; font-weight: 700; margin: 0;
        display: flex; align-items: center; gap: 8px; color: white;
    }
    .desktop-cart-header h2 i { font-size: 18px; }

    .cart-date-inline { display: flex; align-items: center; gap: 4px; }
    .cart-date-text {
        font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.7);
        white-space: nowrap;
    }
    .nav-arrow {
        width: 22px; height: 22px; border: none; border-radius: 4px;
        background: transparent; color: rgba(255,255,255,0.5);
        display: flex; align-items: center; justify-content: center;
        cursor: pointer; transition: all 0.15s; font-size: 11px;
    }
    .nav-arrow:hover { background: rgba(255,255,255,0.1); color: white; }

    .desktop-cart-content {
        flex: 1; overflow-y: auto; overflow-x: hidden;
        min-height: 100px; background: #1F2937;
    }
    .desktop-cart-empty {
        display: flex; flex-direction: column;
        align-items: center; justify-content: center;
        padding: 32px 24px; text-align: center;
    }
    .desktop-cart-empty i { font-size: 48px; color: rgba(255,255,255,0.2); margin-bottom: 12px; display: block; }
    .desktop-cart-empty p { margin: 0; color: rgba(255,255,255,0.6); font-size: 14px; }
    .desktop-cart-empty .hint { font-size: 12px; margin-top: 4px; color: rgba(255,255,255,0.4); }

    .desktop-cart-supplier-group { border-bottom: 1px solid rgba(255,255,255,0.07); }
    .desktop-cart-supplier-header {
        display: flex; justify-content: space-between; align-items: center;
        padding: 6px 16px; background: rgba(255,255,255,0.05);
        font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
    }
    .desktop-cart-supplier-header .supplier-name { font-weight: 700; color: white; }
    .desktop-cart-supplier-header .supplier-stats { display: flex; align-items: center; gap: 10px; }
    .desktop-cart-supplier-header .supplier-count { color: rgba(255,255,255,0.4); }
    .desktop-cart-supplier-header .supplier-total { font-weight: 700; color: #10B981; }

    .desktop-cart-item {
        display: flex; align-items: center;
        padding: 8px 16px; border-bottom: 1px solid rgba(255,255,255,0.05);
        transition: background 0.12s;
    }
    .desktop-cart-item:hover { background: rgba(255,255,255,0.04); }
    .desktop-cart-item-details { flex: 1; min-width: 0; }
    .desktop-cart-item-name {
        font-weight: 600; font-size: 12px; color: white; margin-bottom: 2px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .desktop-cart-item-price { font-size: 11px; color: rgba(255,255,255,0.45); }

    .desktop-cart-item-controls {
        display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
        margin-left: 10px;
    }
    .desktop-item-subtotal { font-size: 13px; font-weight: 700; color: #10B981; }
    .desktop-qty-row {
        display: flex; align-items: center; gap: 2px;
        background: rgba(255,255,255,0.1); border-radius: 6px; padding: 2px;
    }
    .desktop-qty-btn {
        width: 24px; height: 24px; border-radius: 4px; border: none; cursor: pointer;
        font-size: 12px; font-weight: 700;
        display: flex; align-items: center; justify-content: center;
        transition: background 0.12s;
    }
    .desktop-qty-btn.minus { background: rgba(255,255,255,0.1); color: #EF4444; }
    .desktop-qty-btn.minus:hover { background: rgba(239,68,68,0.2); }
    .desktop-qty-btn.plus  { background: #10B981; color: white; }
    .desktop-qty-btn.plus:hover  { background: #059669; }
    .desktop-qty-value { min-width: 24px; text-align: center; font-weight: 700; font-size: 12px; color: white; }
    .desktop-btn-remove {
        background: none; border: none; color: rgba(255,255,255,0.3);
        font-size: 10px; cursor: pointer; padding: 2px 4px; border-radius: 4px;
        transition: all 0.12s;
    }
    .desktop-btn-remove:hover { background: rgba(239,68,68,0.2); color: #EF4444; }

    .desktop-cart-footer {
        flex-shrink: 0; padding: 16px;
        background: rgba(0,0,0,0.2); border-top: 1px solid rgba(255,255,255,0.08);
        display: flex; flex-direction: column; gap: 8px;
    }
    .desktop-cart-totals { display: flex; flex-direction: column; gap: 4px; }
    .desktop-cart-total-row { display: flex; justify-content: space-between; align-items: center; }
    .desktop-cart-total-row .label { color: rgba(255,255,255,0.55); font-size: 13px; }
    .desktop-cart-total-row .value { font-weight: 600; color: white; font-size: 14px; }
    .desktop-cart-total-row.subtotal .value { font-size: 13px; }
    .desktop-cart-total-row.final {
        padding-top: 8px; margin-top: 4px;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    .desktop-cart-total-row.final .label { font-size: 14px; font-weight: 600; color: white; }
    .desktop-cart-total-row.final .value { font-size: 20px; font-weight: 700; color: #10B981; }

    .btn-send-desktop {
        width: 100%; padding: 10px 16px;
        background: #10B981; color: white; border: none; border-radius: 8px;
        font-size: 14px; font-weight: 600; cursor: pointer;
        display: flex; align-items: center; justify-content: center; gap: 8px;
        transition: all 0.2s;
        box-shadow: 0 4px 12px rgba(16,185,129,0.3);
    }
    .btn-send-desktop:hover:not(:disabled) {
        background: #059669;
        box-shadow: 0 6px 16px rgba(16,185,129,0.4);
    }
    .btn-send-desktop:disabled { background: #374151; box-shadow: none; cursor: not-allowed; }

    /* --- Sidebar Panel (tab Ordini, colonna destra) --- */
    .ordini-sidebar-panel { background: transparent; overflow: hidden; }

    .sidebar-header {
        display: flex; align-items: center; gap: 12px;
        padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .sidebar-header-icon {
        width: 40px; height: 40px; border-radius: 10px;
        background: rgba(255,255,255,0.1);
        display: flex; align-items: center; justify-content: center;
        color: white; font-size: 18px; flex-shrink: 0;
    }
    .sidebar-title { font-size: 15px; font-weight: 700; color: white; margin: 0; }

    .sidebar-content { flex: 1; overflow-y: auto; padding: 16px; }

    .stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card {
        background: rgba(255,255,255,0.07); border-radius: 10px;
        padding: 14px 12px; text-align: center;
    }
    .stat-card.highlight { background: rgba(16,185,129,0.15); }
    .stat-value { font-size: 24px; font-weight: 800; color: white; line-height: 1; margin-bottom: 4px; }
    .stat-card.highlight .stat-value { color: #10B981; }
    .stat-label { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.3px; }

    .sidebar-footer {
        flex-shrink: 0; padding: 16px;
        background: rgba(0,0,0,0.2); border-top: 1px solid rgba(255,255,255,0.08);
    }
    .total-row { display: flex; justify-content: space-between; align-items: center; }
    .total-row.final { padding-top: 8px; }
    .total-label { color: rgba(255,255,255,0.55); font-size: 13px; }
    .total-value.final,
    .total-row.final .total-value {
        font-size: 22px; font-weight: 800; color: #10B981;
    }

    /* Calendar: popover dropdown */
    .cal-overlay { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
    .cal-panel {
        position: fixed; bottom: auto; left: auto; right: auto; width: 316px;
        border-radius: 16px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.06), 0 12px 40px rgba(0,0,0,0.14);
        transform: translateY(-6px) scale(0.98); opacity: 0; pointer-events: none;
        transition: transform 0.18s cubic-bezier(0.4,0,0.2,1), opacity 0.18s ease;
    }
    .cal-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
    .cal-handle { display: none; }
    .cal-inner { padding: 16px 20px 20px; }
    .cal-day { font-size: 14px; }

}

/* ============================================================
   TOAST
   ============================================================ */
#toast {
    position: fixed; bottom: calc(110px + env(safe-area-inset-bottom, 0px));
    left: 50%; transform: translateX(-50%) translateY(20px);
    background: #1f2937; color: white; padding: 10px 18px;
    border-radius: 99px; font-size: 14px; font-weight: 500;
    opacity: 0; transition: opacity 0.2s, transform 0.2s;
    pointer-events: none; white-space: nowrap; z-index: 9999;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
