/* ======================================================================
   Smart Alerts
   ====================================================================== */
.alert-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: var(--bg-card, #ffffff);
}
.alert-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}
.alert-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    font-size: 20px;
}
.alert-content {
    flex: 1;
}
.alert-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.alert-sub {
    font-size: 12.5px;
    color: var(--text-muted);
}
/* Success Tone */
.alert-success {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}
.alert-success:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
}
.alert-success .alert-icon {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.alert-success .alert-title {
    color: #059669;
}
/* Danger/Warning Tone */
.alert-danger {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}
.alert-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
}
.alert-danger .alert-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.alert-danger .alert-title {
    color: #dc2626;
}

/* UI-UX Pro Max: Event Inbox Cards — matches .stat-tile from dashboard */
.event-inbox-card {
    padding: 18px;
    border: 1px solid var(--border-color);
    border-top: 3px solid transparent;
    border-radius: 12px;
    background: var(--bg-solid);
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease, border 0.2s ease;
    position: relative;
    overflow: visible;
}

.event-inbox-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.07);
    transform: translateY(-2px);
    border-top-color: #8b5cf6;
}

.event-inbox-card.active-order-card {
    box-shadow: 0 0 0 2px var(--primary-color), 0 4px 12px rgba(0,0,0,0.06);
    background: color-mix(in srgb, var(--primary-color) 4%, var(--bg-card));
}

.event-inbox-card.active-order-card::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 4px;
    background: var(--primary-color);
    border-radius: 0 12px 12px 0;
}

/* --- Dark Theme Overrides for Event Inbox Cards --- */
body.dark-theme .event-inbox-card {
    background: #1f2937; /* Lighter slate gray for high contrast against dark main background */
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-top: 3px solid transparent;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

body.dark-theme .event-inbox-card:hover {
    background: #374151;
    border-color: rgba(255, 255, 255, 0.25);
    border-top-color: #a855f7; /* Vibrant purple accent for dark mode */
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7);
}

body.dark-theme .event-inbox-card.active-order-card {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    border-top-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6, 0 8px 20px rgba(0, 0, 0, 0.6);
}

/* UI-UX Pro Max: Event Flame Animation */
.event-flame-icon {
    transition: color 0.3s ease, transform 0.3s ease;
    transform-origin: bottom center;
}

.event-inbox-card:hover .event-flame-icon,
.event-inbox-card.active-order-card .event-flame-icon {
    color: #ef4444; /* Fire Red */
    animation: flicker-flame 1.3s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.5));
}

@keyframes flicker-flame {
    0% { transform: scale(1) rotate(-2deg); color: #f97316; } /* Orange */
    50% { transform: scale(1.15) rotate(4deg); color: #ef4444; } /* Red */
    100% { transform: scale(0.95) rotate(-2deg); color: #f59e0b; } /* Amber */
}

.event-inbox-card .event-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    transition: color 0.2s;
}

.event-inbox-card.active-order-card .event-title {
    color: var(--primary-color);
}

/* ======================================================================
   UI-UX Pro Max: Categorized Shortage List in Order Analysis
   ====================================================================== */
.shortages-cat-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-solid);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.shortages-cat-card:last-child {
    margin-bottom: 0;
}

.shortages-cat-card:hover {
    border-color: color-mix(in srgb, var(--primary-color) 30%, var(--border-color));
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
}

.shortages-cat-header {
    background: color-mix(in srgb, var(--primary-color) 7%, var(--bg-surface));
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shortages-cat-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.shortages-cat-icon-chip {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.shortages-cat-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.shortages-cat-badge {
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.shortages-cat-badge.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.shortages-cat-badge.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.shortage-item-row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: background-color 0.15s ease;
}

.shortage-item-row:last-child {
    border-bottom: none;
}

.shortage-item-row:hover {
    background-color: color-mix(in srgb, var(--text-primary) 3%, transparent);
}

/* Dark theme refinements for Shortage Categories */
body.dark-theme .shortages-cat-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

body.dark-theme .shortages-cat-header {
    background: #0f172a;
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

body.dark-theme .shortage-item-row {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .shortage-item-row:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

/* ======================================================================
   UI-UX Pro Max: Procurement Price Radars (Savings & Discrepancies)
   ====================================================================== */
.proc-radars-container {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 900px) {
    .proc-radars-container {
        grid-template-columns: 1fr;
    }
}

.proc-radar-card {
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.proc-radar-card.savings-radar {
    background: linear-gradient(150deg, color-mix(in srgb, #10b981 8%, var(--bg-solid)), var(--bg-solid));
    border: 1px solid color-mix(in srgb, #10b981 35%, var(--border-color));
}

.proc-radar-card.discrepancy-radar {
    background: linear-gradient(150deg, color-mix(in srgb, #ef4444 8%, var(--bg-solid)), var(--bg-solid));
    border: 1px solid color-mix(in srgb, #ef4444 35%, var(--border-color));
}

body.dark-theme .proc-radar-card.savings-radar {
    background: linear-gradient(150deg, rgba(16, 185, 129, 0.1), #0f172a);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

body.dark-theme .proc-radar-card.discrepancy-radar {
    background: linear-gradient(150deg, rgba(239, 68, 68, 0.1), #0f172a);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.proc-radar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-surface) 60%, transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.proc-radar-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.proc-radar-icon-chip {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.proc-radar-icon-chip.chip-savings {
    background: color-mix(in srgb, #10b981 18%, transparent);
    color: #10b981;
}

.proc-radar-icon-chip.chip-discrepancy {
    background: color-mix(in srgb, #ef4444 18%, transparent);
    color: #ef4444;
}

.proc-radar-title-wrap {
    display: flex;
    flex-direction: column;
}

.proc-radar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.proc-radar-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

.proc-radar-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.proc-radar-badge.badge-savings {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.proc-radar-badge.badge-discrepancy {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.proc-radar-badge.badge-neutral {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.proc-radar-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 360px;
    overflow-y: auto;
}

.proc-radar-row {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    display: grid;
    /* Fixed tracks, not `1fr auto`. Content-sized columns meant every row laid
       itself out independently, so ₪8.00 and ₪190.60 produced different column
       positions and the dividers stopped lining up down the panel. */
    grid-template-columns: minmax(0, 1fr) 196px 132px;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.proc-radar-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border-color: color-mix(in srgb, var(--primary-color) 40%, var(--border-color));
}

@media (max-width: 600px) {
    .proc-radar-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.proc-radar-item-info {
    display: flex;
    flex-direction: column;
}

.proc-radar-item-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.proc-radar-item-supplier {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}

.proc-price-comp {
    background: color-mix(in srgb, var(--bg-surface) 80%, rgba(0,0,0,0.1));
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
}

.proc-price-comp .price-old {
    color: var(--text-muted);
}

.proc-price-comp .price-arrow {
    color: var(--text-muted);
    font-weight: 700;
}

.proc-price-comp.savings-comp .price-new {
    color: #10b981;
    font-weight: 700;
}

.proc-price-comp.discrepancy-comp .price-new {
    color: #ef4444;
    font-weight: 700;
}

.proc-delta-tag {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    text-align: left;
}

.proc-delta-tag span {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.1;
}

.proc-delta-tag small {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.proc-delta-tag.savings-delta span {
    color: #10b981;
}

.proc-delta-tag.discrepancy-delta span {
    color: #ef4444;
}

.proc-radar-empty {
    padding: 28px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.proc-radar-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--text-muted) 10%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

/* ======================================================================
   UI-UX Pro Max: Dashboard Procurement Widget & Smart Alerts
   ====================================================================== */
.dash-proc-widget {
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-panel, rgba(255, 255, 255, 0.9));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
body.dark-theme .dash-proc-widget {
    background: #0f172a; /* Slate 900 for high dark mode elegance */
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.dash-proc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.dash-proc-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.dash-proc-title svg {
    color: var(--primary-color);
}
.dash-proc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    cursor: pointer;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}
.dash-proc-btn:hover {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.dash-proc-btn:hover svg {
    color: #ffffff;
}

.dash-proc-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.dash-proc-kpi-box {
    background: var(--bg-input, #f8fafc);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
}
body.dark-theme .dash-proc-kpi-box {
    background: #1e293b; /* Slate 800 for high visual contrast in dark theme */
    border-color: rgba(255, 255, 255, 0.1);
}
.dash-proc-kpi-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.dash-proc-kpi-top {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}
.dash-proc-kpi-top span.icon-wrap {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}
.dash-proc-kpi-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.dash-proc-kpi-sub {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: auto;
}

.dash-proc-alerts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
}
.dash-proc-alert-pane {
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    padding: 18px;
    display: flex;
    flex-direction: column;
}
body.dark-theme .dash-proc-alert-pane {
    background: #111827;
    border-color: rgba(255, 255, 255, 0.12);
}
.dash-proc-pane-title {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.dash-proc-alert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
}
body.dark-theme .dash-proc-alert-row {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.08);
}
.dash-proc-alert-row:last-child {
    margin-bottom: 0;
}
.dash-proc-alert-row:hover {
    transform: translateX(-3px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.dash-proc-alert-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.badge-saving {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
body.dark-theme .badge-saving {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}
.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
body.dark-theme .badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* ======================================================================
   UI/UX Pro Max - Supplier Directory Bento Cards & Grid
   ====================================================================== */
.proc-directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    align-items: stretch;
    margin-top: 20px;
}
@media (max-width: 850px) {
    .proc-directory-grid {
        grid-template-columns: 1fr;
    }
}

.dir-supplier-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}
.dir-supplier-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    border-color: rgba(96, 165, 250, 0.5);
}
body.dark-theme .dir-supplier-card {
    background: #111827;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
body.dark-theme .dir-supplier-card:hover {
    background: #161e2e;
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.dir-card-stats-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border-color, rgba(255, 255, 255, 0.08));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    overflow: hidden;
    margin: 16px 0;
}
.dir-stat-cell {
    background: var(--bg-input, rgba(0, 0, 0, 0.02));
    padding: 10px 6px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
body.dark-theme .dir-stat-cell {
    background: rgba(17, 24, 39, 0.8);
}


/* Traffic sits in the notice strip and stays grey until asked. A number here
   before the first check would be a number nobody took. */
.day-notice.traffic { padding-left: 6px; }
.day-notice.traffic.idle { border-style: dashed; color: var(--text-muted); }
.day-notice.traffic.idle .day-notice-text { color: var(--text-muted); font-weight: 600; }
.day-notice.traffic.loading { opacity: .7; }
.day-notice.traffic.ok { border-color: rgba(16, 185, 129, .45); background: rgba(16, 185, 129, .06); }
.day-notice.traffic.ok svg { color: #059669; }

.day-notice-go {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; padding: 0; cursor: pointer;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 50%; color: var(--text-secondary);
}
.day-notice-go:hover { border-color: var(--primary-color); color: var(--primary-color); }

/* Which chains a scan will download. Each one is a separate file fetch, so the
   count is stated rather than left to be discovered. */
.retail-chain-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-top: 16px; padding: 13px 16px;
    background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 11px;
}
.retail-chain-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.retail-chain-label svg { color: var(--text-muted); }
.retail-chain-pills { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 auto; }
.retail-chain-pill {
    padding: 7px 15px; cursor: pointer; font-size: 13px; font-weight: 700; line-height: 1.7;
    background: var(--bg-card); border: 1.5px solid var(--border-color); border-radius: 20px;
    color: var(--text-secondary); transition: border-color .15s, color .15s, background .15s;
}
.retail-chain-pill:hover { border-color: var(--primary-color); color: var(--primary-color); }
.retail-chain-pill.active { border-color: var(--primary-color); color: #fff; background: var(--primary-color); }
/* Shown rather than hidden: an absent chain looks arbitrary, and a pill that
   fails at scan time is worse than one that says up front why it can't. */
.retail-chain-pill.locked { opacity: .4; cursor: not-allowed; border-style: dashed; }
.retail-chain-note { flex: 0 0 auto; font-size: 12px; color: var(--text-muted); }

/* --- Today, and what it means for you --------------------------------------
   Each card leads with the consequence and keeps the measurement as evidence.
   Tone is never carried by colour alone: every state has its own icon and a
   screen-reader word, because a red pill and a green pill are the same pill to
   anyone who cannot separate them.
   ------------------------------------------------------------------------ */
.impact-list { display: flex; flex-wrap: wrap; gap: 10px; }

.impact-card {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 15px; border-radius: 12px;
    border: 1px solid var(--border-color); background: var(--bg-card);
    font-size: 13.5px;
    /* Every card the same width on its row, whatever its text length.
       These sized themselves to their content, so the one-line traffic card
       stopped short of the edge while the two-line overcharge card next to it
       ran full width, and three cards meant to read as one strip looked like
       three unrelated things. A shared basis with grow makes a row of one fill
       it and a row of three split it evenly. */
    flex: 1 1 340px;
    min-width: 0;
}
.impact-icon { display: flex; flex: 0 0 auto; }
.impact-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.impact-title { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.4; }
.impact-detail { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Contrast is checked against both themes: these text colours sit on a tinted
   background, so the darker stop of each hue is used rather than the fill. */
.impact-card.good  { border-color: rgba(16, 185, 129, .5);  background: rgba(16, 185, 129, .07); }
.impact-card.good .impact-icon { color: #047857; }
.impact-card.watch { border-color: rgba(245, 158, 11, .55); background: rgba(245, 158, 11, .09); }
.impact-card.watch .impact-icon { color: #b45309; }
.impact-card.act {
    border-color: color-mix(in srgb, var(--danger-color, #ef4444) 55%, transparent);
    background: color-mix(in srgb, var(--danger-color, #ef4444) 8%, transparent);
}
.impact-card.act .impact-icon { color: var(--danger-color, #dc2626); }
.impact-card.info .impact-icon { color: var(--primary-color); }
.impact-card.note { border-style: dashed; }
.impact-card.note .impact-icon { color: var(--text-muted); }

/* A check in flight dims the card it belongs to rather than replacing it, so
   nothing jumps and the previous reading stays legible until replaced. */
.impact-card.checking { opacity: .55; }

.impact-action {
    flex: 0 0 auto; margin-right: 4px;
    padding: 6px 13px; cursor: pointer; line-height: 1.7;
    font-size: 12.5px; font-weight: 700; font-family: inherit;
    background: var(--bg-solid); border: 1px solid var(--border-color);
    border-radius: 8px; color: var(--text-secondary);
}
.impact-action:hover { border-color: var(--primary-color); color: var(--primary-color); }
.impact-card.act .impact-action { border-color: var(--danger-color, #ef4444); color: var(--danger-color, #dc2626); }

.impact-x {
    padding: 0 4px; cursor: pointer; font-size: 16px; line-height: 1;
    background: none; border: none; color: var(--text-muted);
}
.impact-x:hover { color: var(--danger-color, #dc2626); }

.impact-add {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 11px 15px; cursor: pointer; line-height: 1.7;
    font-size: 12.5px; font-weight: 700; color: var(--text-muted);
    background: none; border: 1px dashed var(--border-color); border-radius: 12px;
}
.impact-add:hover { border-color: var(--primary-color); color: var(--primary-color); }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}


/* ══════════════════════════════════════════════════════════════════════
   MOBILE PWA ADAPTATION — Bottom Nav, Drawer, Table Cards, Touch UX
   All rules scoped to @media (max-width: 768px) for ZERO desktop impact.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Mobile Bottom Navigation Bar ─────────────────────────────────── */
.mobile-bottom-nav {
    display: none; /* Hidden on desktop */
}

/* ── Mobile Full Drawer ───────────────────────────────────────────── */
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 400;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-drawer-overlay.visible {
    display: block;
    opacity: 1;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-solid);
    border-left: 1px solid var(--border-color);
    z-index: 500;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
}
.mobile-drawer.open {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}
.mobile-drawer-header .drawer-brand {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}
.mobile-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.mobile-drawer-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

.mobile-drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 12px;
    gap: 4px;
    flex: 1;
}
.mob-drawer-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
    text-align: right;
    width: 100%;
    min-height: 48px;
}
.mob-drawer-item:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}
.mob-drawer-item.active {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary-color);
    font-weight: 700;
}
.mob-drawer-item.active svg {
    stroke: var(--primary-color);
}
.mob-drawer-item svg {
    flex-shrink: 0;
    stroke: var(--text-muted);
    transition: stroke 0.2s ease;
}
.mob-drawer-item:hover svg {
    stroke: var(--text-primary);
}

.mobile-drawer-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    /* ── Show bottom nav, adjust layout ─────────────────────────── */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: var(--bg-solid);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        z-index: 300;
        align-items: stretch;
        justify-content: flex-start;
        padding: 0 4px;
        padding-bottom: env(safe-area-inset-bottom, 0);
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .mobile-bottom-nav::-webkit-scrollbar {
        display: none;
    }

    .mob-nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        flex: 1 0 56px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 600;
        cursor: pointer;
        transition: color 0.2s ease;
        padding: 6px 2px;
        font-family: var(--font-sans);
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
        position: relative;
    }
    .mob-nav-btn svg {
        width: 22px;
        height: 22px;
        stroke: var(--text-muted);
        transition: stroke 0.2s ease;
    }
    .mob-nav-btn.active {
        color: var(--primary-color);
    }
    .mob-nav-btn.active svg {
        stroke: var(--primary-color);
    }
    .mob-nav-btn.active::after {
        content: '';
        position: absolute;
        top: 4px;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: var(--primary-color);
    }
    .mob-nav-btn .nav-label {
        font-size: 10px;
        line-height: 1.2;
        white-space: nowrap;
    }

    /* Hide desktop top-nav tab row on mobile (keep brand/search row) */
    .top-nav-main {
        display: none !important;
    }
    .top-nav-brand {
        display: flex !important;
    }

    /* Unified Mobile Header (fixed at top, search bar on second row) */
    .top-nav-container {
        position: sticky;
        top: 0;
        margin: 0 -16px 16px -16px;
        padding: 12px 16px;
        background: var(--bg-solid);
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-sm);
        border-radius: 0;
        z-index: 200;
        width: auto;
    }

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

    .theme-switcher {
        flex-shrink: 0;
    }

    /* The sync wording stays on mobile. Hiding it here was the second of two
       rules doing the same thing, and a cloud with no word beside it is the
       one state this pill must never be in. */
    .top-nav-actions .cloud-status-label {
        display: inline;
        font-size: 11.5px;
    }

    /* Make search bar full width on mobile */
    .nav-search {
        flex: 1 1 100%;
        order: 3; /* Push to bottom row */
        margin: 0;
    }

    /* Add bottom padding so content doesn't hide behind fixed bottom nav */
    .main-content {
        padding-bottom: max(120px, calc(100px + env(safe-area-inset-bottom))) !important;
    }

    /* ── Data Table → Mobile Card Transformation ───────────────── */
    /* Dashboard table: 11 columns → vertical cards */
    .dashboard-detail-table .dashboard-table,
    .dashboard-detail-table .dashboard-table thead,
    .dashboard-detail-table .dashboard-table tbody,
    .dashboard-detail-table .dashboard-table tr,
    .dashboard-detail-table .dashboard-table td {
        display: block;
        width: 100%;
    }
    .dashboard-detail-table .dashboard-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }
    .dashboard-detail-table .dashboard-table tbody tr {
        background: var(--bg-solid);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin-bottom: 12px;
        padding: 16px;
        box-shadow: var(--shadow-sm);
    }
    .dashboard-detail-table .dashboard-table tbody tr.dashboard-category-header {
        background: var(--bg-input);
        border: none;
        padding: 10px 16px;
        border-radius: var(--radius-sm);
    }
    .dashboard-detail-table .dashboard-table tbody tr.dashboard-category-header td {
        padding: 0;
        border: none;
    }
    .dashboard-detail-table .dashboard-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-color);
        text-align: left;
        white-space: normal;
        font-size: 14px;
        gap: 16px;
    }
    .dashboard-detail-table .dashboard-table th:first-child,
    .dashboard-detail-table .dashboard-table td:first-child {
        width: 100% !important;
    }
    .dashboard-detail-table .dashboard-table tbody td > * {
        text-align: left;
    }
    .dashboard-detail-table .dashboard-table tbody td:last-child {
        border-bottom: none;
    }
    .dashboard-detail-table .dashboard-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-secondary);
        font-size: 12px;
        flex-shrink: 0;
        margin-left: 16px;
    }
    /* Names break between words, not inside them.
       The `width: 100% !important` above is what stopped the dish name being
       squeezed into an 89px column by `td:first-child { width: 28% }` from the
       900px breakpoint. This is the other half: `overflow-wrap: anywhere` is
       right for a narrow real column and wrong for a full-width card row,
       where it will still shred a long unbroken name one character per line. */
    .dashboard-detail-table .dashboard-table tbody td,
    .dashboard-detail-table .dashboard-table tbody td > * {
        overflow-wrap: break-word;
        word-break: normal;
    }

    /* Any table → vertical cards, by adding `mobile-cards` to it.
     *
     * The two blocks above and below do the same job for two specific tables
     * and predate this one; they are left alone rather than folded in, because
     * each carries per-column exceptions that only make sense for its own
     * table. Anything new should use this class.
     *
     * The one requirement is a data-label on every cell. Without it the header
     * row is hidden and the values lose their field names, which is worse than
     * the sideways scroll it replaces. */
    table.mobile-cards,
    table.mobile-cards tbody,
    table.mobile-cards tr,
    table.mobile-cards td {
        display: block;
        width: 100%;
    }
    table.mobile-cards thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }
    table.mobile-cards tbody tr {
        background: var(--bg-solid);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin-bottom: 12px;
        padding: 14px 16px;
        box-shadow: var(--shadow-sm);
    }
    table.mobile-cards tbody td {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 16px;
        padding: 7px 0;
        border-bottom: 1px solid var(--border-color);
        text-align: left;
        white-space: normal !important;
        font-size: 14px;
        overflow-wrap: break-word;
        word-break: normal;
    }
    table.mobile-cards tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        max-width: 45%;
        font-weight: 700;
        font-size: 12px;
        color: var(--text-secondary);
        text-align: right;
    }
    table.mobile-cards tbody td:last-child { border-bottom: none; }
    /* A cell holding nothing but a dash is noise once it is a labelled row of
       its own, so the row collapses instead of listing "תוספות: -". */
    table.mobile-cards tbody td:empty { display: none; }
    /* The empty-state row spans every column and has no label of its own. */
    table.mobile-cards tbody td[colspan] {
        display: block;
        text-align: center;
        border-bottom: none;
    }
    table.mobile-cards tbody td[colspan]::before { content: none; }

    /* Inventory table → vertical cards */
    .inventory-table,
    .inventory-table thead,
    .inventory-table tbody,
    .inventory-table tr,
    .inventory-table td {
        display: block;
        width: 100%;
    }
    .inventory-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }
    .inventory-table tbody tr {
        background: var(--bg-solid);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin-bottom: 12px;
        padding: 16px;
        box-shadow: var(--shadow-sm);
        position: relative;
    }
    .inventory-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-color);
        text-align: left;
        white-space: normal;
        font-size: 14px;
    }
    .inventory-table tbody td:first-child {
        position: absolute;
        top: 12px;
        left: 12px;
        border: none;
        padding: 0;
        width: auto;
    }
    .inventory-table tbody td:last-child {
        border-bottom: none;
    }
    .inventory-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-secondary);
        font-size: 12px;
        flex-shrink: 0;
        margin-left: 16px;
    }
    .inventory-table tbody td:first-child::before {
        content: none;
    }

    /* ── Touch Target Enforcement ──────────────────────────────── */
    button, .add-btn, .supplier-btn, [onclick], .filter-chip,
    .proc-contact-btn, .top-nav-item, select {
        min-height: 44px;
        min-width: 44px;
    }

    input[type="text"], input[type="number"], input[type="search"],
    input[type="date"], input[type="month"], input[type="tel"],
    input[type="url"], input[type="email"], input[type="password"],
    select, textarea {
        min-height: 44px;
        font-size: 16px !important; /* Prevent iOS zoom on focus */
        padding: 10px 12px;
    }

    /* Modals go full-width on mobile */
    .modal-content, .ezra-modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 10px auto;
        max-height: 90vh;
        border-radius: var(--radius-md);
    }

    /* Stat tiles compact spacing */
    .stats-two-tier {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    .stat-tile {
        padding: 14px !important;
    }
    /* A flat 24px here overrode the responsive size the tiles were built with,
       and ₪438,813 needs 130px that a 106px column does not have, so the
       figure spilled past the card edge with the ₪ half cut off.
       The value cannot simply span the tile: the icon is `grid-row: 1 / -1`,
       so column 1 is a full-height rail and a full-width value lands on top of
       it. It stays in column 2 and the type sizes to that column instead. */
    .st-value {
        font-size: clamp(15px, 10.4cqi, 24px) !important;
    }

    /* Upcoming strip cards */
    .upcoming-strip {
        gap: 10px;
    }
    .upcoming-card {
        min-width: 200px;
    }

    /* Page head compact */
    .page-head {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center !important;
        gap: 12px;
    }
    .page-head-actions {
        width: 100%;
    }
    .calc-controls {
        width: 100%;
        flex-wrap: wrap;
        gap: 12px;
    }
    .calc-control {
        flex: 1 1 calc(50% - 12px);
        min-width: 140px;
    }

    /* ── Pro Max Mobile UX Additions ─────────────────────────── */

    /* Force Analytics charts to stack instead of squishing side-by-side */
    .charts-standalone-grid {
        grid-template-columns: 1fr !important;
    }
    .events-split-view {
        grid-template-columns: 1fr !important;
    }

    /* History Tabs: Horizontally scrollable strip, no awkward wrapping */
    .tab-strip {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Hide scrollbar for clean look */
    }
    .tab-strip::-webkit-scrollbar {
        display: none;
    }
    .tab-strip .big-tab {
        flex-shrink: 0; /* Prevent tabs from shrinking */
    }
    .tab-strip-actions {
        flex-shrink: 0;
    }

    /* Event Shortages Layout */
    .shortage-item-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }
    .shortage-item-row > div:last-child {
        text-align: right !important;
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    /* Login gate: allow scroll when mobile keyboard covers the button */
    .login-gate {
        overflow-y: auto;
    }

    /* Eliminate stuck hover states on touch */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    .analysis-content-grid {
        grid-template-columns: 1fr !important;
        overflow: visible !important;
    }
}

