/* ═══════════════════════════════════════════
   Pages – Page-specific styles
   ═══════════════════════════════════════════ */

/* ── Dashboard ── */
.dashboard-welcome {
    background: linear-gradient(135deg, var(--primary-lightest), var(--accent-lighter));
    border-radius: var(--radius-xl);
    padding: var(--sp-8);
    margin-bottom: var(--sp-8);
    position: relative;
    overflow: hidden;
}

.dashboard-welcome::before {
    content: '🍞';
    position: absolute;
    right: var(--sp-8);
    top: 50%;
    transform: translateY(-50%);
    font-size: 5rem;
    opacity: 0.2;
}

.dashboard-welcome h2 {
    font-size: var(--text-2xl);
    margin-bottom: var(--sp-2);
}

.dashboard-welcome p {
    color: var(--text-secondary);
    font-size: var(--text-base);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-5);
    margin-bottom: var(--sp-8);
}

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--sp-6);
    margin-bottom: var(--sp-8);
}

.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    box-shadow: var(--shadow-sm);
}

.chart-card h3 {
    font-size: var(--text-base);
    margin-bottom: var(--sp-4);
}

.chart-wrapper {
    position: relative;
    height: 280px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-4);
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-5);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-body);
    color: var(--text-primary);
}

.quick-action-btn:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.quick-action-btn .qa-icon { font-size: 1.75rem; }
.quick-action-btn .qa-label { font-size: var(--text-sm); font-weight: 600; }

/* ── Anagrafiche ── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-4);
}

.product-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    transition: all var(--transition-base);
    cursor: pointer;
}

.product-card:hover {
    border-color: var(--primary-lighter);
    box-shadow: var(--shadow-md);
}

.product-card .product-name { font-weight: 600; margin-bottom: var(--sp-1); }
.product-card .product-cluster { font-size: var(--text-xs); color: var(--text-secondary); }
.product-card .product-price { font-family: var(--font-mono); font-weight: 600; color: var(--primary); margin-top: var(--sp-2); }

/* ── Ordini ── */
.order-timeline {
    position: relative;
    padding-left: var(--sp-8);
}

.order-timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.order-item {
    position: relative;
    margin-bottom: var(--sp-4);
    animation: fadeIn var(--transition-base) ease-out;
}

.order-item::before {
    content: '';
    position: absolute;
    left: calc(-2rem + 5px);
    top: var(--sp-4);
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 3px solid var(--primary);
}

.order-item.completed::before { background: var(--success); border-color: var(--success); }
.order-item.in-progress::before { background: var(--warning); border-color: var(--warning); }

/* ── Produzione ── */
.production-cluster {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--sp-4);
    overflow: hidden;
    transition: all var(--transition-base);
}

.production-cluster:hover { box-shadow: var(--shadow-md); }

.production-cluster-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-4) var(--sp-5);
    background: var(--bg-muted);
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--text-primary);
}

.production-cluster-header:hover { background: var(--bg-hover); }

.production-cluster-body {
    padding: var(--sp-4) var(--sp-5);
    display: none;
    border-top: 1px solid var(--border);
}

.production-cluster.open .production-cluster-body { display: block; animation: fadeIn var(--transition-fast) ease-out; }

.weigh-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    background: linear-gradient(135deg, var(--success), #0D9488);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.weigh-btn:hover { transform: scale(1.02); box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3); }

/* ── DDT Preview ── */
.ddt-preview {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-8);
    max-width: 800px;
    margin: 0 auto;
    font-size: var(--text-sm);
    box-shadow: var(--shadow-lg);
}

.ddt-preview .ddt-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--sp-6);
    padding-bottom: var(--sp-4);
    border-bottom: 2px solid var(--text-primary);
}

.ddt-preview .ddt-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--primary);
}

.ddt-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--sp-4) 0;
}

.ddt-preview table th,
.ddt-preview table td {
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--border-strong);
    text-align: left;
    font-size: var(--text-sm);
}

.ddt-preview table th {
    background: var(--bg-muted);
    font-weight: 600;
}

/* ── Resi ── */
.reso-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    margin-bottom: var(--sp-4);
}

.reso-card .reso-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-4);
}

.ripartizione-bar {
    display: flex;
    height: 8px;
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--bg-muted);
    margin-top: var(--sp-2);
}

.ripartizione-bar .rip-segment {
    height: 100%;
    transition: width 0.5s ease;
}

/* ── Fatturazione ── */
.sync-status {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    background: var(--bg-muted);
    border-radius: var(--radius-lg);
    margin-bottom: var(--sp-6);
}

.sync-indicator {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--success);
    animation: pulse 2s infinite;
}

.sync-indicator.disconnected { background: var(--danger); animation: none; }

/* ── Report ── */
.report-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-6);
}

/* ── Vista Autista (semplificata) ── */
.driver-view .card {
    border-radius: var(--radius-xl);
}

.driver-view .btn {
    padding: var(--sp-4) var(--sp-6);
    font-size: var(--text-lg);
    border-radius: var(--radius-lg);
}

.driver-big-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-8);
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-body);
    width: 100%;
}

.driver-big-btn:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.driver-big-btn .dbb-icon { font-size: 3rem; }
.driver-big-btn .dbb-label { font-size: var(--text-lg); font-weight: 700; color: var(--text-primary); }
.driver-big-btn .dbb-count { font-family: var(--font-mono); font-size: var(--text-2xl); color: var(--primary); font-weight: 700; }

/* ── Bilancia Digitale ── */
.scale-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    animation: fadeIn 0.3s ease-out;
}

.scale-container {
    background: linear-gradient(160deg, #1a1a2e, #16213e);
    border-radius: var(--radius-xl);
    padding: var(--sp-8);
    max-width: 600px;
    width: 100%;
    box-shadow: 0 0 60px rgba(232, 89, 12, 0.15), 0 20px 40px rgba(0,0,0,0.5);
    animation: scaleIn 0.3s ease-out;
    color: #fff;
}

.scale-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-6);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.scale-header h2 {
    color: #fff;
    font-size: var(--text-xl);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.scale-close {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}
.scale-close:hover { background: rgba(255,255,255,0.2); }

.scale-product-info {
    text-align: center;
    margin-bottom: var(--sp-6);
}

.scale-product-name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: var(--sp-1);
}

.scale-product-cluster {
    font-size: var(--text-sm);
    color: rgba(255,255,255,0.5);
}

.scale-display {
    background: #0a0f1a;
    border: 2px solid rgba(232, 89, 12, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--sp-6) var(--sp-8);
    text-align: center;
    margin-bottom: var(--sp-6);
    position: relative;
    overflow: hidden;
}

.scale-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.scale-display::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(232,89,12,0.03) 0%, transparent 50%);
    pointer-events: none;
}

.scale-weight-value {
    font-family: var(--font-mono);
    font-size: 5rem;
    font-weight: 700;
    color: #4ADE80;
    line-height: 1;
    letter-spacing: 2px;
    text-shadow: 0 0 30px rgba(74, 222, 128, 0.3);
    transition: all 0.3s ease;
}

.scale-weight-value.reading {
    color: var(--accent);
    text-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
    animation: pulse 0.6s infinite;
}

.scale-weight-value.stable {
    color: #4ADE80;
    text-shadow: 0 0 30px rgba(74, 222, 128, 0.3);
}

.scale-weight-unit {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    color: rgba(255,255,255,0.4);
    margin-left: var(--sp-2);
}

.scale-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    margin-top: var(--sp-3);
    font-size: var(--text-sm);
    color: rgba(255,255,255,0.5);
}

.scale-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ADE80;
    animation: pulse 1.5s infinite;
}

.scale-status-dot.reading { background: var(--accent); }

.scale-weight-value.manual {
    color: #38BDF8;
    text-shadow: 0 0 30px rgba(56, 189, 248, 0.35);
}

.scale-keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
}

.scale-key {
    padding: var(--sp-4);
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: 700;
    color: #fff;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    min-height: 52px;
}

.scale-key:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.3); }
.scale-key:active { transform: scale(0.96); background: rgba(56,189,248,0.2); }

.scale-key-fn {
    color: #FCD34D;
    border-color: rgba(245,158,11,0.3);
}
.scale-key-fn:hover { background: rgba(245,158,11,0.15); border-color: var(--accent); }

.scale-key-zero { grid-column: 1 / -1; }

.scale-actions-manual { grid-template-columns: 1fr 2fr; }

.scale-tare-info {
    display: flex;
    justify-content: space-between;
    padding: var(--sp-3) var(--sp-4);
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-6);
    font-size: var(--text-sm);
}

.scale-tare-info span { color: rgba(255,255,255,0.5); }
.scale-tare-info strong { color: rgba(255,255,255,0.8); font-family: var(--font-mono); }

.scale-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--sp-3);
}

.scale-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-4);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.scale-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.scale-btn .scale-btn-icon { font-size: 1.5rem; }

.scale-btn-tare { border-color: rgba(245,158,11,0.3); }
.scale-btn-tare:hover { background: rgba(245,158,11,0.15); border-color: var(--accent); }

.scale-btn-read { border-color: rgba(74,222,128,0.3); }
.scale-btn-read:hover { background: rgba(74,222,128,0.15); border-color: #4ADE80; }

.scale-btn-confirm {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
}
.scale-btn-confirm:hover { 
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 89, 12, 0.4);
}

.scale-history {
    margin-top: var(--sp-6);
    padding-top: var(--sp-4);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.scale-history h4 {
    color: rgba(255,255,255,0.5);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--sp-3);
}

.scale-history-item {
    display: flex;
    justify-content: space-between;
    padding: var(--sp-2) 0;
    font-size: var(--text-sm);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.scale-history-item .shi-name { color: rgba(255,255,255,0.7); }
.scale-history-item .shi-weight { font-family: var(--font-mono); color: #4ADE80; font-weight: 600; }

/* ── Responsive page adjustments ── */
.warehouse-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-4);
}

.warehouse-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    box-shadow: var(--shadow-sm);
}

.warehouse-card-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.warehouse-icon { font-size: 1.75rem; }

.warehouse-notice {
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.warehouse-notice.warning {
    background: var(--warning-light);
    color: var(--warning-dark);
    border-color: var(--warning);
}

.warehouse-notice.success {
    background: var(--success-light);
    color: var(--success-dark);
    border-color: var(--success);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.stock-heatmap td:not(:first-child), .stock-heatmap th:not(:first-child) { text-align: center; }

.stock-heat-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 30px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
}

.stock-heat-cell.level-0 { background: var(--bg-muted); color: var(--text-tertiary); }
.stock-heat-cell.level-1 { background: var(--primary-lightest); color: var(--primary-dark); }
.stock-heat-cell.level-2 { background: var(--primary-lighter); color: var(--primary-darker); }
.stock-heat-cell.level-3 { background: var(--primary); color: white; }

.heatmap-legend .stock-heat-cell { min-width: 18px; min-height: 18px; }

.margin-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-4);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.margin-summary strong { color: var(--text-primary); font-family: var(--font-mono); margin-left: var(--sp-1); }

.smart-suggestion-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-4);
}

.smart-suggestion {
    background: var(--bg-muted);
    border-left: 4px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: var(--sp-4);
}

.smart-suggestion.up { border-left-color: var(--success); }
.smart-suggestion.down { border-left-color: var(--danger); }
.smart-suggestion.stable { border-left-color: var(--info); }

.smart-suggestion-trend {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    font-weight: 700;
}

.smart-suggestion-action { margin: var(--sp-3) 0 var(--sp-1); font-size: var(--text-sm); font-weight: 700; color: var(--primary); }
.smart-suggestion-footer { display: flex; align-items: center; justify-content: space-between; margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-secondary); }

.price-list-clients {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-2);
    max-height: 220px;
    overflow-y: auto;
    padding: var(--sp-3);
    background: var(--bg-muted);
    border-radius: var(--radius-md);
}

.price-list-clients label { font-size: var(--text-sm); }

.customer-welcome { display:flex;align-items:center;justify-content:space-between;gap:var(--sp-6);padding:var(--sp-8);background:linear-gradient(135deg,var(--primary-lightest),var(--accent-lighter));border-radius:var(--radius-xl); }
.customer-welcome h2 { font-size:var(--text-2xl); }
.customer-welcome p { color:var(--text-secondary);margin-top:var(--sp-2); }
.customer-order-row { display:flex;justify-content:space-between;align-items:center;gap:var(--sp-3);padding:var(--sp-3) 0;border-bottom:1px solid var(--border); }
.customer-order-row:last-child { border:0; }
.quick-template-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:var(--sp-3); }
.quick-template { display:flex;flex-direction:column;align-items:center;gap:var(--sp-1);padding:var(--sp-4);background:var(--bg-muted);border:1px solid var(--border);border-radius:var(--radius-lg);cursor:pointer;font-family:var(--font-body);color:var(--text-primary); }
.quick-template:hover { border-color:var(--primary);background:var(--primary-lightest); }
.quick-template span { font-size:1.6rem; }.quick-template small{color:var(--text-secondary)}
.customer-fast-order { display:grid;gap:var(--sp-5);max-width:1000px;margin:auto; }
.customer-product-list { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-3); }
.customer-product { display:flex;align-items:center;justify-content:space-between;gap:var(--sp-3);padding:var(--sp-3);background:var(--bg-muted);border-radius:var(--radius-md); }
.quantity-stepper { display:flex;align-items:center;gap:var(--sp-1); }.quantity-stepper button{width:32px;height:32px;border:0;border-radius:var(--radius-sm);background:var(--bg-surface);cursor:pointer;font-size:1.1rem}.quantity-stepper input{width:62px;text-align:center;padding:6px;border:1px solid var(--border);border-radius:var(--radius-sm)}.quantity-stepper span{font-size:var(--text-xs);color:var(--text-secondary)}

/* ── Vendita al Banco / POS ── */
.pos-statusbar{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-4);padding:var(--sp-3) var(--sp-4);background:var(--bg-surface);border:1px solid var(--border);border-radius:var(--radius-lg);font-size:var(--text-sm)}
.pos-live-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:var(--success);box-shadow:0 0 0 5px var(--success-light);margin:0 var(--sp-3) 0 var(--sp-1)}
.pos-layout{display:grid;grid-template-columns:minmax(0,1fr) 390px;gap:var(--sp-5);align-items:start}
.pos-catalog,.pos-cart-panel{background:var(--bg-surface);border:1px solid var(--border);border-radius:var(--radius-xl);box-shadow:var(--shadow-sm)}
.pos-catalog{padding:var(--sp-5)}.pos-catalog-head{display:flex;justify-content:space-between;align-items:center;gap:var(--sp-4);margin-bottom:var(--sp-4)}.pos-search{max-width:280px}
.pos-categories{display:flex;gap:var(--sp-2);overflow-x:auto;padding-bottom:var(--sp-3);margin-bottom:var(--sp-3);scrollbar-width:thin}
.pos-category{border:1px solid var(--border);background:var(--bg-muted);color:var(--text-secondary);padding:var(--sp-2) var(--sp-3);border-radius:var(--radius-full);font-family:var(--font-body);font-size:var(--text-xs);font-weight:600;cursor:pointer;white-space:nowrap}.pos-category:hover,.pos-category.active{background:var(--primary);border-color:var(--primary);color:#fff}
.pos-product-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--sp-3)}
.pos-product{display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto auto;gap:var(--sp-1) var(--sp-2);align-items:center;text-align:left;min-height:128px;padding:var(--sp-4);border:1px solid var(--border);border-radius:var(--radius-lg);background:linear-gradient(145deg,var(--bg-surface),var(--bg-muted));font-family:var(--font-body);color:var(--text-primary);cursor:pointer;transition:all var(--transition-fast)}.pos-product:hover{transform:translateY(-2px);border-color:var(--primary);box-shadow:var(--shadow-md)}.pos-product:active{transform:scale(.98)}
.pos-product-emoji{grid-row:1/3;font-size:1.8rem}.pos-product strong{font-size:var(--text-sm);line-height:1.25}.pos-product-price{font-family:var(--font-mono);font-weight:700;color:var(--primary)}.pos-product small{grid-column:1/3;color:var(--text-tertiary)}
.pos-cart-panel{position:sticky;top:calc(var(--header-height) + var(--sp-4));overflow:hidden}.pos-cart-head{display:flex;align-items:center;justify-content:space-between;padding:var(--sp-5);border-bottom:1px solid var(--border)}
.pos-customer-row,.pos-discount-row{display:grid;grid-template-columns:80px 1fr;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-5);border-bottom:1px solid var(--border);font-size:var(--text-sm);font-weight:600}.pos-discount-row{border-top:1px solid var(--border)}
.pos-cart-items{max-height:340px;overflow-y:auto;padding:0 var(--sp-5)}.pos-empty{min-height:210px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-2);color:var(--text-secondary)}.pos-empty span{font-size:2.5rem}.pos-empty small{color:var(--text-tertiary)}
.pos-cart-item{display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:var(--sp-3);padding:var(--sp-3) 0;border-bottom:1px solid var(--border)}.pos-cart-item-main{display:flex;flex-direction:column}.pos-cart-item-main strong{font-size:var(--text-sm)}.pos-cart-item-main small{font-size:var(--text-xs);color:var(--text-secondary)}
.pos-cart-stepper{display:flex;align-items:center;gap:var(--sp-2)}.pos-cart-stepper button{width:28px;height:28px;border:0;border-radius:var(--radius-sm);background:var(--bg-muted);cursor:pointer;font-size:1rem}.pos-cart-stepper span{min-width:26px;text-align:center;font-family:var(--font-mono);font-size:var(--text-sm)}
.pos-totals{padding:var(--sp-4) var(--sp-5)}.pos-totals>div{display:flex;justify-content:space-between;margin-bottom:var(--sp-2);font-size:var(--text-sm)}.pos-totals .pos-total-final{margin:var(--sp-3) 0 0;padding-top:var(--sp-3);border-top:2px solid var(--text-primary);font-size:var(--text-xl);font-weight:800}
.pos-pay-button{display:flex;align-items:center;justify-content:space-between;width:calc(100% - 40px);margin:0 var(--sp-5) var(--sp-3);padding:var(--sp-4);border:0;border-radius:var(--radius-lg);background:linear-gradient(135deg,var(--primary),var(--primary-dark));color:#fff;font-family:var(--font-body);font-size:var(--text-base);cursor:pointer;box-shadow:0 8px 20px rgba(232,89,12,.25)}.pos-pay-button strong{font-family:var(--font-mono);font-size:var(--text-xl)}.pos-pay-button:disabled{opacity:.45;cursor:not-allowed;box-shadow:none}.pos-shortcuts{display:flex;justify-content:center;gap:var(--sp-3);padding-bottom:var(--sp-4);font-size:.65rem;color:var(--text-tertiary)}
.pos-payment-total{display:flex;align-items:center;justify-content:space-between;padding:var(--sp-4);background:var(--primary-lightest);border-radius:var(--radius-lg);margin-bottom:var(--sp-5)}.pos-payment-total strong{font-family:var(--font-mono);font-size:var(--text-2xl);color:var(--primary-dark)}
.pos-payment-methods{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--sp-3);margin-bottom:var(--sp-5)}.pos-payment-method{display:flex;flex-direction:column;gap:var(--sp-2);align-items:center;padding:var(--sp-5);border:2px solid var(--border);border-radius:var(--radius-lg);background:var(--bg-surface);font-size:1.7rem;cursor:pointer}.pos-payment-method strong{font-family:var(--font-body);font-size:var(--text-sm)}.pos-payment-method.active{border-color:var(--primary);background:var(--primary-lightest)}
.pos-change,.pos-variance-preview{display:flex;justify-content:space-between;padding:var(--sp-3);border-radius:var(--radius-md);background:var(--bg-muted);margin-bottom:var(--sp-4)}.pos-terminal-ok,.pos-closed-ok{display:flex;flex-direction:column;align-items:center;gap:var(--sp-2);padding:var(--sp-6);border-radius:var(--radius-lg);background:var(--success-light);color:var(--success-dark);text-align:center;font-size:1.5rem}.pos-terminal-ok span{font-size:var(--text-sm)}
.pos-receipt{max-width:380px;margin:auto;font-family:var(--font-mono);padding:var(--sp-4)}.pos-receipt-brand{text-align:center}.pos-receipt-brand h2{margin-top:var(--sp-1)}.pos-receipt-rule{border-top:1px dashed var(--border-strong);margin:var(--sp-4) 0}.pos-receipt-lines{border-top:1px dashed var(--border-strong);border-bottom:1px dashed var(--border-strong);margin:var(--sp-4) 0;padding:var(--sp-3) 0}.pos-receipt-lines>div{display:flex;justify-content:space-between;gap:var(--sp-3);font-size:var(--text-xs);margin-bottom:var(--sp-2)}.pos-receipt-total{display:flex;justify-content:space-between;font-size:var(--text-xl);font-weight:800;margin:var(--sp-4) 0}
.pos-closing-hero{display:flex;align-items:center;justify-content:space-between;padding:var(--sp-6);border-radius:var(--radius-xl);background:linear-gradient(135deg,#172033,#303c55);color:#fff}.pos-closing-hero h2{margin:var(--sp-2) 0}.pos-closing-hero p,.pos-closing-hero small{color:rgba(255,255,255,.7)}.pos-closing-hero>div:last-child{display:flex;flex-direction:column;text-align:right}.pos-closing-hero>div:last-child strong{font-family:var(--font-mono);font-size:var(--text-3xl);color:#fbbf24}
.pos-closing-summary>div{display:flex;justify-content:space-between;padding:var(--sp-3) 0;border-bottom:1px solid var(--border)}.pos-closing-summary .total{font-size:var(--text-lg);font-weight:700;border-bottom:0;border-top:2px solid var(--text-primary);margin-top:var(--sp-2)}

@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .report-grid { grid-template-columns: 1fr; }
    .warehouse-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .smart-suggestion-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pos-layout{grid-template-columns:1fr}.pos-cart-panel{position:static}.pos-product-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}

@media (max-width: 640px) {
    /* Dashboard */
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
    .dashboard-welcome { padding: var(--sp-5); margin-bottom: var(--sp-5); }
    .dashboard-welcome h2 { font-size: var(--text-lg); }
    .dashboard-welcome p { font-size: var(--text-sm); }
    .dashboard-welcome::before { font-size: 3rem; right: var(--sp-4); }
    .charts-row { gap: var(--sp-4); }
    .chart-card { padding: var(--sp-4); }
    .chart-card h3 { font-size: var(--text-sm); }
    .chart-wrapper { height: 200px; }
    .quick-actions { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
    .quick-action-btn { padding: var(--sp-3); }
    .quick-action-btn .qa-icon { font-size: 1.3rem; }
    .quick-action-btn .qa-label { font-size: var(--text-xs); }

    /* Production */
    .production-cluster-header {
        padding: var(--sp-3) var(--sp-4);
        flex-wrap: wrap;
        gap: var(--sp-2);
    }
    .production-cluster-header > div:first-child span:first-child { font-size: 1.2rem; }
    .production-cluster-header > div:last-child { 
        width: 100%; 
        justify-content: space-between;
        font-size: var(--text-sm);
    }
    .production-cluster-body { padding: var(--sp-3); }
    .weigh-btn { padding: var(--sp-2) var(--sp-3); font-size: var(--text-xs); }
    .weigh-input { width: 80px !important; font-size: var(--text-sm) !important; }

    /* DDT Preview */
    .ddt-preview { padding: var(--sp-4); font-size: var(--text-xs); }
    .ddt-preview .ddt-header { flex-direction: column; gap: var(--sp-3); }
    .ddt-preview .ddt-title { font-size: var(--text-lg); }
    .ddt-preview table th, .ddt-preview table td { padding: var(--sp-1) var(--sp-2); font-size: 0.65rem; }

    /* Resi */
    .reso-card { padding: var(--sp-3); }
    .reso-card .reso-header { flex-direction: column; align-items: flex-start; gap: var(--sp-2); }

    /* Fatturazione */
    .sync-status { padding: var(--sp-3); flex-wrap: wrap; gap: var(--sp-2); font-size: var(--text-sm); }

    /* Report */
    .report-grid { gap: var(--sp-4); }
    .warehouse-overview { grid-template-columns: 1fr; }
    .warehouse-kpis { grid-template-columns: repeat(2, 1fr); }
    .smart-suggestion-grid { grid-template-columns: 1fr; }
    .price-list-clients { grid-template-columns: 1fr; }
    .customer-welcome { flex-direction:column;align-items:flex-start;padding:var(--sp-5); }.quick-template-grid,.customer-product-list{grid-template-columns:1fr}.customer-product{align-items:flex-start;flex-direction:column}.quantity-stepper{width:100%;justify-content:flex-end}
    .pos-statusbar,.pos-catalog-head,.pos-closing-hero{align-items:flex-start;flex-direction:column}.pos-product-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.pos-search{max-width:none}.pos-closing-hero>div:last-child{text-align:left}.pos-cart-item{grid-template-columns:1fr auto}.pos-cart-item>strong{grid-column:2}.pos-payment-methods{grid-template-columns:repeat(3,1fr)}

    /* Bilancia Digitale */
    .scale-container { padding: var(--sp-5); }
    .scale-weight-value { font-size: 3.5rem; }
    .scale-weight-unit { font-size: var(--text-base); }
    .scale-actions { grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-2); }
    .scale-btn { padding: var(--sp-3); }
    .scale-btn .scale-btn-icon { font-size: 1.2rem; }
    .scale-btn span:last-child { font-size: var(--text-xs); }
    .scale-tare-info { flex-direction: column; gap: var(--sp-2); }
    .scale-product-name { font-size: var(--text-base); }
    .scale-key { min-height: 44px; padding: var(--sp-3); font-size: var(--text-lg); }
}

/* SlideUp animation for mobile modals */
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
