/* ═══════════════════════════════════════════════════════════
   Vision Engine v2 — Styles (Material Design 3 Dark Theme)
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */

:root {
    /* MD3 Dark — мягкие тона, не чёрный */
    --bg-base: #121212;
    --bg-card: #1e1e1e;
    --bg-elevated: #2c2c2c;
    --bg-surface: #252525;
    --bg-overlay: rgba(0,0,0,0.55);

    --text-primary: #e8e8e8;
    --text-secondary: #9e9e9e;
    --text-tertiary: #6b6b6b;

    /* Приглушённые семантические цвета */
    --accent: #5eb8d4;       /* мягкий голубой */
    --success: #4caf7a;      /* изумрудный */
    --warning: #e0a33a;      /* тёплый янтарный */
    --error: #cf6679;        /* мягкий коралловый */
    --info: #7ab8d4;         /* приглушённый голубой */
    --orange: #d4915e;       /* кирпичный оранж */
    --purple: #9c7cbf;       /* лаванда */

    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Roboto Mono', 'Fira Code', 'Cascadia Code', monospace;
    --safe-bottom: env(safe-area-inset-bottom, 0px);

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

/* ── Reset ─────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* ── Camera (fullscreen) ───────────────────────────────────── */

#camera {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* ── Camera vignette (затемнение по краям, фокус на центр) ── */

#camera-vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    /* Радиальная маска: прозрачный центр → тёмные края */
    background: radial-gradient(
        ellipse 55% 40% at center,
        transparent 0%,
        rgba(0,0,0,0.05) 60%,
        rgba(0,0,0,0.35) 85%,
        rgba(0,0,0,0.55) 100%
    );
}

/* ── Barcode overlay ────────────────────────────────────────── */

#barcode-overlay {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

/* ── Scan zone indicator (рамка фокуса) ────────────────────── */

.scan-zone {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 180px;
    z-index: 3;
    pointer-events: none;
}

/* Уголки — тонкие, аккуратные */
.scan-zone::before,
.scan-zone::after {
    content: '';
    position: absolute;
    border-color: rgba(255,255,255,0.5);
    border-style: solid;
}

.scan-zone::before {
    top: 0; left: 0;
    width: 28px; height: 28px;
    border-width: 2.5px 0 0 2.5px;
    border-radius: 6px 0 0 0;
}

.scan-zone::after {
    bottom: 0; right: 0;
    width: 28px; height: 28px;
    border-width: 0 2.5px 2.5px 0;
    border-radius: 0 0 6px 0;
}

.scan-zone .corner-tr,
.scan-zone .corner-bl {
    position: absolute;
    width: 28px; height: 28px;
    border-color: rgba(255,255,255,0.5);
    border-style: solid;
}
.scan-zone .corner-tr { top: 0; right: 0; border-width: 2.5px 2.5px 0 0; border-radius: 0 6px 0 0; }
.scan-zone .corner-bl { bottom: 0; left: 0; border-width: 0 0 2.5px 2.5px; border-radius: 0 0 0 6px; }

/* Пульсирующая линия сканирования */
.scan-zone::after {
    /* Reuse after for scan line — override bottom-right corner */
}

/* ── Info Panel (bottom) ───────────────────────────────────── */

#info-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 0 var(--sp-lg) calc(var(--safe-bottom) + 12px);
    padding-top: 24px;
    background: linear-gradient(to top,
        rgba(18,18,18,0.97) 60%,
        rgba(18,18,18,0.85) 78%,
        rgba(18,18,18,0.5) 90%,
        transparent);
    pointer-events: none;
    max-height: 45vh;
    overflow-y: auto;
}

#info-panel > * { pointer-events: auto; }

#info-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-xl);
    padding-bottom: 56px;
    color: var(--text-tertiary);
    font-size: 14px;
    letter-spacing: 0.3px;
}

#info-content {
    display: none;
    padding: var(--sp-md) 0;
    padding-bottom: 56px; /* space for mode switcher */
}

#info-content.visible { display: block; }

.info-header {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    margin-bottom: var(--sp-sm);
}

#info-title {
    font-size: 17px;
    font-weight: 700;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

#info-subtitle {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    margin-bottom: var(--sp-sm);
    letter-spacing: 0.5px;
}

/* ── Badges ────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.badge--success { background: rgba(76,175,122,0.15); color: var(--success); }
.badge--warning { background: rgba(224,163,58,0.15); color: var(--warning); }
.badge--error   { background: rgba(207,102,121,0.15); color: var(--error); }
.badge--info    { background: rgba(122,184,212,0.15); color: var(--info); }
.badge--neutral { background: var(--bg-elevated); color: var(--text-secondary); }

/* ── Inline Details ────────────────────────────────────────── */

#inline-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 2px 0;
}

.detail-label {
    color: var(--text-tertiary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* Моноширинный для кодов */
.detail-value--mono {
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    font-size: 12px;
}

/* Разделитель блоков */
.detail-divider {
    grid-column: 1 / -1;
    height: 1px;
    background: var(--bg-elevated);
    margin: var(--sp-xs) 0;
}

/* Статусная строка (бейджи в ряд) */
.detail-badges {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-xs);
    margin: var(--sp-xs) 0;
}

.inline-codes {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-xs);
    margin-top: var(--sp-sm);
}

.inline-code {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-xs);
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    background: var(--bg-base);
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0.3px;
    cursor: pointer;
}

.inline-code::after {
    content: '⎘';
    font-size: 9px;
    opacity: 0.5;
}

.inline-code:active {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

/* ── Match Banner ──────────────────────────────────────────── */

.match-banner {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    padding: var(--sp-sm) var(--sp-md);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    margin: var(--sp-sm) 0;
}

.match-banner--ok {
    background: rgba(76,175,122,0.12);
    color: var(--success);
    border: 1px solid rgba(76,175,122,0.25);
}

.match-banner--mismatch {
    background: rgba(207,102,121,0.12);
    color: var(--error);
    border: 1px solid rgba(207,102,121,0.25);
}

/* ── Chips (compact code summary) ──────────────────────────── */

.scan-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-xs);
    margin: var(--sp-sm) 0;
}

.scan-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.scan-chip--ok { background: rgba(76,175,122,0.12); color: var(--success); }
.scan-chip--ok::before { content: '✓'; font-size: 10px; }
.scan-chip--pending { background: rgba(224,163,58,0.12); color: var(--warning); }
.scan-chip--pending::before { content: '…'; }

/* ── Action Tags ───────────────────────────────────────────── */

#action-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-sm);
    margin-top: var(--sp-md);
}

.action-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.08);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.action-tag:active {
    transform: scale(0.96);
    background: var(--bg-elevated);
}

.action-tag--primary {
    background: var(--accent);
    color: #121212;
    border-color: var(--accent);
    font-weight: 600;
}

.action-tag--primary:active {
    background: #4da0b8;
}

/* ── Flash animation ───────────────────────────────────────── */

@keyframes flash-accent {
    0% { box-shadow: inset 0 2px 0 var(--accent); }
    100% { box-shadow: inset 0 2px 0 transparent; }
}

#info-content.flash {
    animation: flash-accent 0.5s ease-out forwards;
}

/* ── Reset Button ──────────────────────────────────────────── */

#reset-btn {
    position: fixed;
    top: var(--sp-lg);
    right: var(--sp-lg);
    z-index: 15;
    display: none;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: 22px;
    border: none;
    background: rgba(30,30,30,0.8);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    transition: transform 0.1s;
}

#reset-btn.visible { display: inline-flex; }
#reset-btn:active { transform: scale(0.95); }

/* ── Drawer ────────────────────────────────────────────────── */

#drawer-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 30;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

#drawer-backdrop.visible { opacity: 1; visibility: visible; }

#drawer {
    position: fixed;
    top: 0;
    right: -85vw;
    width: 85vw;
    max-width: 380px;
    height: 100%;
    z-index: 31;
    background: var(--bg-base);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid rgba(255,255,255,0.04);
}

#drawer.open { right: 0; }

.drawer-header {
    padding: var(--sp-lg) var(--sp-lg) var(--sp-md);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

#drawer-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: var(--sp-xs);
    letter-spacing: -0.2px;
}

#drawer-subtitle {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    margin-bottom: var(--sp-sm);
    letter-spacing: 0.5px;
}

#drawer-badges { display: flex; gap: var(--sp-sm); }

#drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-md) var(--sp-lg);
    -webkit-overflow-scrolling: touch;
}

/* ── Cards (in drawer) ─────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--sp-md) var(--sp-lg);
    margin-bottom: var(--sp-md);
    border: 1px solid rgba(255,255,255,0.04);
}

.card__title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    margin-bottom: var(--sp-sm);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.card__row {
    font-size: 13px;
    color: var(--text-primary);
    padding: 3px 0;
    line-height: 1.5;
}

.card__row b { font-weight: 600; }

/* Карточка товара — структурированная */
.item-card-identity {
    margin-bottom: var(--sp-sm);
    padding-bottom: var(--sp-sm);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.item-card-identity__name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: var(--sp-xs);
}

.item-card-identity__sku {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.item-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-xs);
    margin-bottom: var(--sp-sm);
}

.item-card-codes {
    padding: var(--sp-sm) 0;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.code-line {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    padding: 4px 0;
    font-size: 12px;
}

.code-line__label {
    color: var(--text-tertiary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 36px;
}

.code-line__value {
    flex: 1;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: 0.5px;
    font-size: 12px;
}

.code-line__copy {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.code-line__copy:active { background: var(--bg-surface); color: var(--success); }

.item-card-finance {
    padding-top: var(--sp-sm);
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: var(--sp-sm);
}

.item-card-finance summary {
    font-size: 11px;
    color: var(--text-tertiary);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--sp-xs) 0;
}

/* ── Event rows ────────────────────────────────────────────── */

.event-row {
    display: flex;
    gap: var(--sp-sm);
    font-size: 11px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.event-type {
    color: var(--accent);
    font-weight: 600;
    min-width: 80px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.event-detail { color: var(--text-secondary); flex: 1; }
.event-time { color: var(--text-tertiary); font-family: var(--font-mono); font-size: 10px; }

/* ── Stock rows ────────────────────────────────────────────── */

.stock-row {
    display: flex;
    gap: var(--sp-sm);
    font-size: 12px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.stock-row:last-child { border-bottom: none; }
.stock-id { color: var(--accent); font-weight: 600; font-family: var(--font-mono); }
.stock-serial { flex: 1; font-family: var(--font-mono); color: var(--text-primary); }
.stock-condition { color: var(--text-secondary); }

/* ── Code rows (scanned codes in drawer) ───────────────────── */

.code-row {
    display: flex;
    gap: var(--sp-sm);
    align-items: center;
    font-size: 12px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.code-row:last-child { border-bottom: none; }
.code-icon { font-size: 14px; }
.code-label { color: var(--text-tertiary); min-width: 50px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; }
.code-value { flex: 1; font-family: var(--font-mono); color: var(--text-primary); cursor: pointer; letter-spacing: 0.5px; }
.code-found { color: var(--success); }

/* Copy toast */
.code-value:active::after { content: '✓'; margin-left: 4px; color: var(--success); }

/* ── Mode Switcher ─────────────────────────────────────────── */

#mode-switcher {
    position: fixed;
    bottom: calc(var(--safe-bottom) + 10px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    gap: 4px;
    background: rgba(30,30,30,0.88);
    border-radius: 25px;
    padding: 4px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.06);
}

[data-mode] {
    padding: 9px 18px;
    border-radius: 21px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

[data-mode].active {
    background: var(--accent);
    color: #121212;
    font-weight: 600;
}

[data-mode]:active { transform: scale(0.96); }

/* ── Shipment Strip ────────────────────────────────────────── */

.ship-strip {
    position: fixed;
    bottom: calc(var(--safe-bottom) + 140px);
    left: var(--sp-lg);
    right: var(--sp-lg);
    z-index: 11;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px var(--sp-lg);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.06);
}

.ship-strip.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.ship-strip--success { background: rgba(76,175,122,0.15); color: var(--success); border-color: rgba(76,175,122,0.2); }
.ship-strip--error { background: rgba(207,102,121,0.15); color: var(--error); border-color: rgba(207,102,121,0.2); }
.ship-strip--warn { background: rgba(224,163,58,0.15); color: var(--warning); border-color: rgba(224,163,58,0.2); }
.ship-strip--item { border-left: 3px solid var(--orange); }
.ship-strip--order { border-left: 3px solid var(--info); }
.ship-strip--loading { color: var(--text-secondary); }
.ship-strip--dim { color: var(--text-tertiary); }

#ship-counter {
    position: fixed;
    top: var(--sp-lg);
    left: var(--sp-lg);
    z-index: 15;
    display: none;
    padding: 7px 14px;
    border-radius: 22px;
    background: rgba(30,30,30,0.8);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.06);
    letter-spacing: 0.5px;
}

/* ── Buttons ───────────────────────────────────────────────── */

.btn {
    padding: 12px 20px;
    border-radius: var(--radius);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: var(--sp-sm);
    transition: transform 0.1s;
}

.btn--primary { background: var(--accent); color: #121212; }
.btn--small { padding: 7px 14px; font-size: 12px; width: auto; margin: 0; border-radius: 20px; }
.btn:active { transform: scale(0.97); }

/* ── Quick-bind rows ───────────────────────────────────────── */

.quick-bind-row {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    padding: 10px var(--sp-md);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    margin-bottom: var(--sp-sm);
    font-size: 12px;
    border: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}

.quick-bind-row:active { background: var(--bg-surface); }
.quick-bind-row span:first-child {
    color: var(--accent);
    font-weight: 600;
    font-family: var(--font-mono);
}
.quick-bind-row span:nth-child(2) { flex: 1; color: var(--text-primary); }

/* ── Utility ───────────────────────────────────────────────── */

.empty {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px 20px;
    font-size: 14px;
}

/* ── Inline Photos (in info panel) ──────────────────────────── */

.inline-photos {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    margin: var(--sp-sm) 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0;
}

.photos-label {
    font-size: 11px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.inline-photo-thumb {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-xs);
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.08);
    transition: transform 0.1s;
}

.inline-photo-thumb:active { transform: scale(0.92); }

.photos-more {
    font-size: 11px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    padding: 0 4px;
}

/* ── Photos Grid (in drawer) ───────────────────────────────── */

.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-sm);
}

.photo-card {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid rgba(255,255,255,0.04);
}

.photo-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: transform 0.1s;
}

.photo-thumb:active { transform: scale(0.95); }

.photo-meta {
    display: flex;
    justify-content: space-between;
    padding: 4px 6px;
    font-size: 10px;
}

.photo-type-badge { color: var(--text-secondary); font-weight: 500; }
.photo-codes { color: var(--text-tertiary); }

/* ── Lightbox ──────────────────────────────────────────────── */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12,12,12,0.95);
}

.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-img {
    max-width: 95vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.lightbox-info {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.lightbox-counter { color: var(--text-primary); font-weight: 600; font-family: var(--font-mono); }
.lightbox-type { color: var(--text-tertiary); }

.lightbox-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    transform: translateY(-50%);
    padding: 0 8px;
}

.lb-prev, .lb-next {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(30,30,30,0.7);
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.lb-prev:active, .lb-next:active { background: rgba(60,60,60,0.7); }

.lightbox-close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    font-size: 17px;
    cursor: pointer;
    transition: background 0.15s;
}

.lightbox-close:active { background: rgba(255,255,255,0.15); }

/* ═══════════════════════════════════════════════════════════
   Tab Bar (Bottom Navigation)
   ═══════════════════════════════════════════════════════════ */

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    gap: 0;
    background: rgba(18,18,18,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-bottom: var(--safe-bottom);
}

.tab {
    flex: 1;
    max-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 0 6px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.tab.active {
    color: var(--accent);
}

.tab__icon {
    width: 22px;
    height: 22px;
}

.tab__label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.tab:active { transform: scale(0.92); }

/* Info panel needs space for tab bar */
#info-panel { padding-bottom: calc(var(--safe-bottom) + 60px); }
#info-content { padding-bottom: 10px; }
#info-empty { padding-bottom: 10px; }

/* ═══════════════════════════════════════════════════════════
   Toast (center, for errors/actions)
   ═══════════════════════════════════════════════════════════ */

.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 50;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    padding: var(--sp-xl);
    min-width: 260px;
    max-width: 90vw;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.toast.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.toast--error { border-color: rgba(207,102,121,0.3); }
.toast--success { border-color: rgba(76,175,122,0.3); }

.toast__icon {
    font-size: 32px;
    margin-bottom: var(--sp-sm);
}

.toast__title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: var(--sp-xs);
}

.toast__message {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--sp-md);
    line-height: 1.4;
}

.toast__actions {
    display: flex;
    gap: var(--sp-sm);
    justify-content: center;
}

.toast__btn {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.toast__btn--primary {
    background: var(--accent);
    color: #121212;
    border-color: var(--accent);
    font-weight: 600;
}

.toast__btn:active { transform: scale(0.95); }

/* ═══════════════════════════════════════════════════════════
   Shipment Mode — Full Redesign
   ═══════════════════════════════════════════════════════════ */

/* ── Top bar (20% — заказ/товар) ───────────────────────────── */

.ship-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 14px var(--sp-lg) var(--sp-md);
    padding-top: max(14px, env(safe-area-inset-top, 14px));
    background: linear-gradient(to bottom,
        rgba(18,18,18,0.95) 60%,
        rgba(18,18,18,0.7) 85%,
        transparent);
    display: none; /* shown in shipment mode */
}

.ship-top__title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
    margin-bottom: 2px;
}

.ship-top__subtitle {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.ship-top__badges {
    display: flex;
    gap: var(--sp-xs);
    margin-top: var(--sp-xs);
}

/* ── Bottom sheet (30% — карточка + прогресс + CTA) ────────── */

.ship-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: var(--sp-lg);
    padding-bottom: calc(var(--safe-bottom) + 64px); /* space for tab bar */
    background: linear-gradient(to top,
        rgba(18,18,18,0.98) 70%,
        rgba(18,18,18,0.85) 88%,
        transparent);
    display: none; /* shown in shipment mode */
    max-height: 40vh;
    overflow-y: auto;
}

/* ── Ship card (товар) ─────────────────────────────────────── */

.ship-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--sp-md) var(--sp-lg);
    margin-bottom: var(--sp-md);
    border: 1px solid rgba(255,255,255,0.06);
    min-height: 0;
}

.ship-card:empty { display: none; }

.ship-card__name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: var(--sp-xs);
}

.ship-card__sku {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.ship-card__details {
    display: flex;
    gap: var(--sp-sm);
    margin-top: var(--sp-sm);
    flex-wrap: wrap;
}

.ship-card__chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.ship-card__chip--ok { background: rgba(76,175,122,0.12); color: var(--success); }
.ship-card__chip--ok::before { content: '✓'; }
.ship-card__chip--warn { background: rgba(224,163,58,0.12); color: var(--warning); }
.ship-card__chip--miss { background: rgba(207,102,121,0.12); color: var(--error); }
.ship-card__chip--miss::before { content: '?'; }

/* ── Ship photos (inline thumbs) ──────────────────────────── */

.ship-photos {
    display: flex;
    gap: var(--sp-sm);
    margin-bottom: var(--sp-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ship-photos:empty { display: none; }

.ship-photos img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xs);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.08);
}

/* ── Progress bar ──────────────────────────────────────────── */

.ship-progress {
    margin-bottom: var(--sp-md);
}

.ship-progress__bar {
    height: 4px;
    border-radius: 2px;
    background: var(--bg-elevated);
    overflow: hidden;
    margin-bottom: var(--sp-xs);
}

.ship-progress__fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
}

.ship-progress__fill--complete {
    background: var(--success);
}

.ship-progress__text {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
    letter-spacing: 0.3px;
}

/* ── CTA button ────────────────────────────────────────────── */

.ship-cta {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius);
    border: none;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-elevated);
    color: var(--text-tertiary);
}

.ship-cta:disabled {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    cursor: default;
}

.ship-cta:not(:disabled) {
    background: var(--success);
    color: #121212;
    box-shadow: 0 4px 20px rgba(76,175,122,0.3);
}

.ship-cta:not(:disabled):active {
    transform: scale(0.97);
    box-shadow: 0 2px 10px rgba(76,175,122,0.2);
}

/* ── Ship counter (today progress) ─────────────────────────── */

.ship-counter {
    display: none;
    text-align: center;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: var(--sp-sm);
}

.ship-counter.visible { display: block; }

.ship-counter__bold {
    color: var(--accent);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════════════════════
   Mode visibility
   ═══════════════════════════════════════════════════════════ */

/* Scan mode: show info panel, hide ship UI */
body.mode-scan .ship-top,
body.mode-scan .ship-sheet { display: none; }
body.mode-scan #info-panel { display: block; }

/* Shipment mode: show ship UI, hide info panel */
body.mode-shipment .ship-top { display: block; }
body.mode-shipment .ship-sheet { display: block; }
body.mode-shipment #info-panel { display: none; }

/* Hide old mode switcher (replaced by tab bar) */
#mode-switcher { display: none !important; }
