/* ============================================================================
 * PIX Scanner Pro - iOS Design System
 * ============================================================================
 * Matching Flutter app: Apple HIG inspired, #0A84FF primary
 * ============================================================================ */

/* === DESIGN TOKENS === */
:root {
    /* Primary */
    --primary: #0A84FF;
    --primary-hover: #0070E0;
    --primary-light: #E8F0FE;
    --primary-bg: rgba(10,132,255,0.08);

    /* Semantic */
    --success: #34C759;
    --success-bg: rgba(52,199,89,0.1);
    --warning: #FF9500;
    --warning-bg: rgba(255,149,0,0.1);
    --danger: #FF3B30;
    --danger-bg: rgba(255,59,48,0.1);
    --purple: #7C3AED;
    --purple-bg: rgba(124,58,237,0.08);

    /* Backgrounds */
    --bg: #F5F5F7;
    --bg-white: #FFFFFF;
    --surface: #F2F2F7;

    /* Text */
    --text: #000000;
    --text-secondary: #1C1C1E;
    --text-tertiary: #3C3C43;
    --text-hint: #8E8E93;

    /* Borders & Dividers */
    --border: #E5E5EA;
    --divider: #F1F5F9;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 100px;

    /* Spacing */
    --sp-xs: 4px;
    --sp-sm: 8px;
    --sp-md: 16px;
    --sp-lg: 24px;
    --sp-xl: 32px;
}

/* === RESET === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* === BASE === */
html, body {
    width: 100%;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
    font-size: 16px;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === APP CONTAINER === */
.app {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* === HEADER === */
.header-banner {
    background: var(--primary);
    height: 6px;
    border-radius: 0;
}
.header-banner img { display: none; }

.header {
    background: var(--bg-white);
    padding: 14px var(--sp-md);
    border-bottom: 0.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}
.header h1 {
    font-size: 17px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}
.header h1 .icon {
    display: flex;
    align-items: center;
    color: var(--primary);
}
.header h1 .icon svg { stroke: var(--primary); }
.header-user {
    font-size: 12px;
    color: var(--text-hint);
    text-align: right;
}
.header-user strong {
    color: var(--text-secondary);
    display: block;
    font-size: 13px;
    font-weight: 600;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logout-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-bg);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--danger);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}
.logout-icon svg { width: 18px; height: 18px; pointer-events: none; }
.logout-icon:active {
    background: rgba(255,59,48,0.2);
    transform: scale(0.92);
}

/* === CONTENT === */
.content {
    flex: 1;
    padding: 0;
}
.main-container {
    background: var(--bg-white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--sp-lg) var(--sp-md);
    min-height: calc(100vh - 100px);
    margin-top: var(--sp-sm);
    box-shadow: var(--shadow-sm);
}

/* === BACK BUTTON === */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--sp-md);
    padding: 4px 0;
}
.back-btn:active { opacity: 0.6; }

/* === ALERTS === */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-md);
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.alert-icon { flex-shrink: 0; display: flex; }
.alert-content { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 2px; font-size: 14px; }
.alert-text { font-size: 13px; opacity: 0.85; line-height: 1.4; }
.alert-success {
    background: var(--success-bg);
    border: 1px solid rgba(52,199,89,0.2);
}
.alert-warning {
    background: var(--warning-bg);
    border: 1px solid rgba(255,149,0,0.2);
}
.alert-error {
    background: var(--danger-bg);
    border: 1px solid rgba(255,59,48,0.2);
}
.alert-success .alert-icon { color: var(--success); }
.alert-warning .alert-icon { color: var(--warning); }
.alert-error .alert-icon { color: var(--danger); }

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    width: auto;
    -webkit-appearance: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-icon { font-size: 16px; display: flex; }
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:active { background: var(--primary-hover); }
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-warning {
    background: var(--warning);
    color: #fff;
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 24px; font-size: 16px; width: 100%; }

/* === LOGIN === */
.login-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--sp-lg);
    background: var(--bg);
}
.login-box {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.login-header-img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    display: block;
    background: linear-gradient(135deg, #0A1520 0%, #1a2a3a 100%);
}
.login-content {
    padding: var(--sp-lg);
}
.login-logo {
    text-align: center;
    margin-bottom: var(--sp-lg);
}
.login-logo .icon { font-size: 48px; margin-bottom: 12px; }
.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}
.login-logo p {
    color: var(--text-hint);
    margin-top: 6px;
    font-size: 14px;
}

/* === FORMS === */
.form-group {
    margin-bottom: 14px;
}
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
    outline: none;
    transition: all 0.2s ease;
}
.form-input:focus {
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px rgba(10,132,255,0.12);
}
.form-input::placeholder { color: var(--text-hint); }

/* === MENU === */
.menu-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: var(--sp-md);
}
.menu-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-xs);
}
.menu-card:active {
    transform: scale(0.98);
    background: var(--surface);
}
.menu-card .icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.menu-card .icon svg { width: 24px; height: 24px; stroke: var(--primary); }
.menu-card .card-text { flex: 1; }
.menu-card .title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.menu-card .desc { font-size: 12px; color: var(--text-hint); line-height: 1.3; }
.menu-card .arrow { color: var(--text-hint); font-size: 18px; font-weight: 300; }

/* === TOP BAR (scanner page) === */
.top-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--sp-md);
    padding: 12px 14px;
    background: var(--surface);
    border-radius: var(--radius-md);
}
.top-stats {
    display: flex;
    align-items: baseline;
    gap: 4px;
}
.top-stats-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}
.top-stats-label {
    font-size: 11px;
    color: var(--text-hint);
    font-weight: 500;
}
.top-modes {
    flex: 1;
    display: flex;
    gap: 4px;
    justify-content: center;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border);
}
.top-mode {
    padding: 7px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-hint);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.top-mode.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(10,132,255,0.3);
}
.top-mode#modeEAN.active {
    background: var(--success);
    box-shadow: 0 2px 8px rgba(52,199,89,0.3);
}
.top-mode#mode30to90.active {
    background: var(--warning);
    box-shadow: 0 2px 8px rgba(255,149,0,0.3);
}
.top-mode#modePL.active {
    background: var(--purple);
    box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}
.top-sync {
    display: flex;
    align-items: center;
}
.sync-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: blink 2s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* === PL MODEL SELECTOR === */
.pl-model-selector {
    background: var(--purple-bg);
    border: 1px solid rgba(124,58,237,0.2);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: var(--sp-md);
}
.pl-model-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--purple);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.pl-model-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pl-model-btn {
    padding: 7px 12px;
    border: 1px solid rgba(124,58,237,0.25);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--purple);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.pl-model-btn.active {
    background: var(--purple);
    color: #fff;
    border-color: var(--purple);
    box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}
.scan-convert-badge {
    display: inline-block;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--warning-bg);
    color: #B86E00;
    font-weight: 600;
    word-break: break-all;
}

/* === SCAN CARD === */
.scan-card {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px var(--sp-md);
    margin-bottom: var(--sp-md);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s;
}
.scan-field {
    margin-bottom: 12px;
}
.scan-field:last-of-type {
    margin-bottom: 14px;
}
.scan-field-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.scan-num {
    background: var(--primary);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}
.scan-field-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
}
.scan-field-input:focus {
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(10,132,255,0.1);
}
.scan-qty-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--divider);
}
.scan-qty-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
}
.scan-qty-input {
    width: 52px;
    padding: 8px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: all 0.2s;
}
.scan-qty-input:focus { border-color: var(--primary); }
.scan-qty-input.locked {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
}
.scan-lock-btn {
    width: 38px;
    height: 38px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-hint);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.scan-lock-btn:active { transform: scale(0.92); }
.scan-lock-btn.locked {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
}
.scan-submit-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.scan-submit-btn:active { transform: scale(0.97); background: var(--primary-hover); }

/* === PARTIAL ALERT === */
.partial-alert {
    display: none;
    background: var(--warning-bg);
    border: 1.5px solid rgba(255,149,0,0.3);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: var(--sp-md);
    animation: pulse 1.5s infinite;
}
.partial-alert.show { display: block; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}
.partial-alert .title {
    font-weight: 600;
    color: #B86E00;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}
.scanner-input-group {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
}
.scanner-input-group.active { border-color: var(--primary); }
.scanner-input-group.partial {
    border-color: var(--warning);
    background: rgba(255,149,0,0.04);
}
.scanner-input-group .label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}
.scanner-input-group .label .num {
    background: var(--primary);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}
.scanner-input-group.partial .label .num { background: var(--warning); color: #fff; }
.scanner-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-family: "SF Mono", monospace;
    outline: none;
    transition: border-color 0.2s;
}
.scanner-input:focus { border-color: var(--primary); }

/* === SCAN LIST === */
.scan-list {
    margin-top: var(--sp-md);
}
.scan-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
}
.scan-list-header h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-hint);
    letter-spacing: 0.5px;
}
.scan-item {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 8px;
    animation: slideIn 0.25s ease;
    transition: all 0.15s;
}
.scan-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.scan-item-num {
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
}
.scan-item-alert {
    border: 1.5px solid var(--danger) !important;
    background: rgba(255,59,48,0.04) !important;
}
.scan-item-alert .scan-item-num {
    background: var(--danger) !important;
}
.scan-alert-badge {
    display: inline-block;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 6px;
    animation: pulse-alert 1s infinite;
}
@keyframes pulse-alert {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.scan-item-delete {
    background: var(--danger-bg);
    color: var(--danger);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.scan-item-delete:active {
    background: rgba(255,59,48,0.2);
    transform: scale(0.9);
}
.scan-item-data {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.scan-tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: "SF Mono", monospace;
    font-weight: 600;
}
.scan-tag-ean { background: var(--primary-bg); color: var(--primary); }
.scan-tag-lot { background: rgba(255,214,10,0.12); color: #B86E00; }
.scan-tag-dlc { background: var(--warning-bg); color: #B86E00; }
.scan-tag-dlc-alert { background: var(--danger-bg); color: var(--danger); font-weight: 700; }
.scan-tag-fab { background: var(--success-bg); color: #1E7E34; }
.scan-tag-emp { background: rgba(10,132,255,0.06); color: var(--primary); }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: var(--sp-xl) var(--sp-lg);
    color: var(--text-hint);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}
.empty-state .icon {
    font-size: 36px;
    margin-bottom: 8px;
    opacity: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === BOTTOM ACTIONS === */
.bottom-actions {
    display: flex;
    gap: 10px;
    margin-top: var(--sp-md);
    padding-top: var(--sp-md);
    border-top: 1px solid var(--divider);
}
.bottom-actions .btn { flex: 1; }

/* === FILES === */
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 8px;
    transition: all 0.15s;
}
.file-item:active { background: var(--surface); }
.file-info { flex: 1; min-width: 0; }
.file-info .name {
    font-weight: 600;
    font-size: 13px;
    word-break: break-all;
    color: var(--text-secondary);
}
.file-info .meta {
    font-size: 12px;
    color: var(--text-hint);
    margin-top: 4px;
}
.file-actions { display: flex; gap: 8px; }
.file-btn {
    background: var(--surface);
    color: var(--text-secondary);
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.file-btn:active { background: var(--border); transform: scale(0.95); }

/* === QUANTITY SELECTOR === */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.quantity-selector .label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
}
.qty-input {
    width: 60px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    outline: none;
    margin-left: auto;
    transition: border-color 0.2s;
}
.qty-input:focus { border-color: var(--primary); }
.qty-input.locked {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
}
.lock-btn {
    width: 38px;
    height: 38px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-hint);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lock-btn:active { transform: scale(0.92); }
.lock-btn.locked {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
}

/* === MODE SELECTOR === */
.mode-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.mode-btn {
    flex: 1;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-hint);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.mode-btn:active { transform: scale(0.97); }
.mode-btn.active {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
}
.mode-btn#modeEAN.active {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
}

/* === STATS BAR === */
.stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    margin-bottom: var(--sp-md);
}
.stats-count {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}
.stats-label { font-size: 12px; color: var(--text-hint); }

/* === FLASH OVERLAY === */
.flash-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.05s;
}
.flash-overlay.show { opacity: 1; }
.flash-overlay.success { background: rgba(52,199,89,0.25); }
.flash-overlay.warning { background: rgba(255,149,0,0.25); }
.flash-overlay.error { background: rgba(255,59,48,0.25); }

/* === DLC FULLSCREEN ALERT === */
.dlc-fullscreen-alert {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    cursor: pointer;
    animation: alert-strobe 0.5s infinite;
}
.dlc-fullscreen-alert.show { display: flex; }
@keyframes alert-strobe {
    0%, 100% { background: rgba(255,59,48,0.95); }
    50% { background: rgba(200,0,0,0.97); }
}
.dlc-alert-icon {
    font-size: 80px;
    animation: alert-shake 0.3s infinite;
}
@keyframes alert-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-4deg); }
    75% { transform: translateX(10px) rotate(4deg); }
}
.dlc-alert-title {
    color: #fff;
    font-size: 32px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 12px 0 8px;
}
.dlc-alert-subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}
.dlc-alert-dlc {
    color: #fff;
    font-size: 42px;
    font-weight: 800;
    font-family: "SF Mono", monospace;
    background: rgba(0,0,0,0.35);
    padding: 10px 28px;
    border-radius: var(--radius-md);
    margin: 12px 0;
    border: 2px solid rgba(255,255,255,0.4);
}
.dlc-alert-product {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    font-family: "SF Mono", monospace;
    margin-bottom: 20px;
}
.dlc-alert-dismiss {
    background: #fff;
    color: var(--danger);
    border: none;
    padding: 14px 44px;
    font-size: 16px;
    font-weight: 800;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: transform 0.15s;
}
.dlc-alert-dismiss:active { transform: scale(0.95); }

/* === SAVED NOTIFICATION === */
.saved-notif {
    position: fixed;
    top: 80px;
    right: 16px;
    background: var(--success);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transform: translateX(80px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(52,199,89,0.35);
    pointer-events: none;
}
.saved-notif.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* === SERVER INDICATOR === */
.server-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--success);
    background: var(--success-bg);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-weight: 600;
}
.server-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: blink 2s infinite;
}

/* === HIDDEN === */
.hidden { display: none !important; }

/* === SCROLLBAR (webkit) === */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-hint); }

/* ============================================================================
 * SCAN ERROR ALERT - Premium Full-Screen Modal
 * ============================================================================ */
.scan-error-alert {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 100000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    transition: opacity 0.15s ease;
}
.scan-error-alert.show {
    display: flex;
    opacity: 1;
    animation: scanErrorIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes scanErrorIn {
    0% { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

/* Card interieur */
.scan-error-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.08);
    animation: scanErrorCardIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s both;
}
@keyframes scanErrorCardIn {
    0% { opacity: 0; transform: translateY(30px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header rouge avec icone */
.scan-error-header {
    background: linear-gradient(135deg, #FF3B30 0%, #FF2D55 100%);
    padding: 28px 24px 24px;
    position: relative;
    overflow: hidden;
}
.scan-error-header::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.scan-error-header::after {
    content: '';
    position: absolute;
    bottom: -30px; left: -20px;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}

.scan-error-icon {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scanErrorIconPulse 0.6s ease 0.3s both;
    position: relative;
    z-index: 1;
}
@keyframes scanErrorIconPulse {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}
.scan-error-icon svg {
    width: 36px; height: 36px;
    stroke: #fff;
    stroke-width: 2.5;
    fill: none;
}

.scan-error-title {
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}
.scan-error-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

/* Body */
.scan-error-body {
    padding: 24px;
}

/* Code scanne affiche */
.scan-error-code {
    background: #FFF5F5;
    border: 1.5px solid rgba(255,59,48,0.2);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.scan-error-code-icon {
    width: 36px; height: 36px;
    min-width: 36px;
    background: var(--danger-bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scan-error-code-icon svg {
    width: 18px; height: 18px;
    stroke: var(--danger);
    stroke-width: 2.5;
    fill: none;
}
.scan-error-code-text {
    flex: 1;
    min-width: 0;
}
.scan-error-code-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--danger);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.scan-error-code-value {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    word-break: break-all;
}

/* Instruction - ce qu'il faut faire */
.scan-error-instruction {
    background: #F0FFF4;
    border: 1.5px solid rgba(52,199,89,0.2);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.scan-error-instruction-icon {
    width: 36px; height: 36px;
    min-width: 36px;
    background: var(--success-bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scan-error-instruction-icon svg {
    width: 18px; height: 18px;
    stroke: var(--success);
    stroke-width: 2.5;
    fill: none;
}
.scan-error-instruction-text {
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    line-height: 1.4;
}

/* Dismiss button */
.scan-error-dismiss {
    width: 100%;
    padding: 16px;
    background: none;
    border: none;
    border-top: 1px solid var(--border);
    color: var(--primary);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: rgba(10,132,255,0.1);
}
.scan-error-dismiss:active {
    background: var(--primary-bg);
}

/* Input field en erreur - highlight rouge */
.scan-field-input.scan-input-error {
    border-color: var(--danger) !important;
    background: #FFF5F5 !important;
    box-shadow: 0 0 0 3px rgba(255,59,48,0.15) !important;
    animation: scanInputErrorShake 0.4s ease;
}
@keyframes scanInputErrorShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Indicateur visuel sur le champ : quel type de code attendu */
.scan-field-expected {
    display: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: 6px;
    animation: fadeInUp 0.2s ease;
}
.scan-field-expected.show { display: inline-block; }
.scan-field-expected.error {
    background: var(--danger-bg);
    color: var(--danger);
}
.scan-field-expected.hint {
    background: var(--primary-bg);
    color: var(--primary);
}
@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(4px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
 * PENDING FILES ALERT - Modal au login
 * ============================================================================ */
.pending-files-alert {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 100000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.pending-files-alert.show {
    display: flex;
    opacity: 1;
    animation: pendingAlertIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pendingAlertIn {
    0% { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

.pending-files-card {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.08);
    animation: pendingCardIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s both;
}
@keyframes pendingCardIn {
    0% { opacity: 0; transform: translateY(30px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.pending-files-header {
    background: linear-gradient(135deg, #FF9500 0%, #FF6B00 100%);
    padding: 32px 24px 28px;
    position: relative;
    overflow: hidden;
}
.pending-files-header::before {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}
.pending-files-header::after {
    content: '';
    position: absolute;
    bottom: -20px; left: -15px;
    width: 70px; height: 70px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}

.pending-files-icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    background: rgba(255,255,255,0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    animation: pendingIconBounce 0.5s ease 0.4s both;
}
@keyframes pendingIconBounce {
    0% { transform: scale(0) rotate(-10deg); }
    60% { transform: scale(1.15) rotate(3deg); }
    100% { transform: scale(1) rotate(0); }
}
.pending-files-icon svg {
    width: 30px; height: 30px;
}

.pending-files-count {
    font-size: 56px;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.15);
    animation: pendingCountIn 0.4s ease 0.5s both;
}
@keyframes pendingCountIn {
    0% { opacity: 0; transform: scale(0.5) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.pending-files-title {
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}
.pending-files-subtitle {
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.pending-files-body {
    padding: 20px 24px;
}

.pending-files-message {
    background: #FFF8F0;
    border: 1.5px solid rgba(255,149,0,0.2);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.pending-files-message-icon {
    width: 36px; height: 36px;
    min-width: 36px;
    background: var(--warning-bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--warning);
}
.pending-files-message-icon svg {
    width: 18px; height: 18px;
}
.pending-files-message-text {
    font-size: 13px;
    font-weight: 600;
    color: #92400E;
    line-height: 1.4;
    text-align: left;
}

.pending-files-actions {
    padding: 0;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
}
.pending-files-btn-primary {
    display: block;
    width: 100%;
    padding: 15px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--primary);
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.pending-files-btn-primary:active {
    background: var(--primary-bg);
}
.pending-files-btn-secondary {
    display: block;
    width: 100%;
    padding: 15px;
    background: none;
    border: none;
    color: var(--text-hint);
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s;
}
.pending-files-btn-secondary:active {
    background: var(--surface);
}

/* === PRINT === */
@media print {
    .header, .header-banner, .back-btn, .bottom-actions, .logout-icon { display: none !important; }
    .main-container { box-shadow: none; padding: 0; margin: 0; }
    .app { max-width: 100%; }
}
