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

:root {
    --bg: #0c1929;
    --bg-gradient-mid: #122a45;
    --surface: #152238;
    --surface2: #1e3a5f;
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent-red: #dc2626;
    --gold: #d4a012;
    --gold-light: #fbbf24;
    --danger: #f87171;
    --success: #34d399;
    --highlight: #fbbf24;
    --natural-green: #059669;
    --natural-green-light: #34d399;
    --radius: 16px;
    --radius-sm: 10px;
    --touch-min: 48px;
    color-scheme: dark;
}

html {
    -webkit-text-size-adjust: 100%;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(37, 99, 235, 0.18), transparent 50%),
        radial-gradient(ellipse 80% 50% at 100% 50%, rgba(212, 160, 18, 0.06), transparent 45%);
    color: var(--text);
    min-height: 100%;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
}

body {
    padding-top: env(safe-area-inset-top, 0);
}

/* Views */
.view { display: none; min-height: 100vh; min-height: 100dvh; }
.view.active { display: block; }

.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 12px 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
}

.safe-bottom {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    text-align: center;
}

/* Brand — landing */
.app-brand-hero {
    position: relative;
    margin-bottom: 8px;
}

.brand-glow {
    position: absolute;
    inset: 10% 5% auto;
    height: 120px;
    background: radial-gradient(ellipse, rgba(37, 99, 235, 0.35), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.app-brand .brand-mascot {
    position: relative;
    z-index: 1;
    width: min(160px, 42vw);
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
}

.brand-text {
    position: relative;
    z-index: 1;
    margin-top: 4px;
}

.brand-name {
    font-size: clamp(1.35rem, 5vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    background: linear-gradient(135deg, var(--text) 0%, var(--gold-light) 55%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tagline {
    margin-top: 6px;
    font-size: 0.95rem;
    color: var(--text-dim);
    font-weight: 500;
}

.subtitle { color: var(--text-dim); margin-bottom: 24px; font-size: 1rem; }

.login-hint {
    color: var(--text-dim);
    font-size: 0.875rem;
    margin: -8px 0 12px;
    line-height: 1.4;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
.login-hint.error { color: var(--danger); }

.view-heading {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
}

/* Login form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 360px;
}

/* Top bar */
.top-bar {
    display: grid;
    grid-template-columns: var(--touch-min) 1fr auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-top: 4px;
    min-height: var(--touch-min);
}

.top-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.top-bar-mascot {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.top-bar-title {
    font-weight: 700;
    font-size: clamp(0.72rem, 2.8vw, 0.88rem);
    line-height: 1.2;
    color: var(--gold-light);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.store-badge, .pog-badge {
    background: var(--surface2);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gold-light);
    border: 1px solid rgba(251, 191, 36, 0.2);
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pog-badge {
    font-size: 0.78rem;
    color: var(--text-dim);
    border-color: rgba(148, 163, 184, 0.25);
    max-width: none;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pog-badge-sm {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Inputs & Buttons */
.input-group {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

.input-group-wide {
    max-width: 100%;
}

input[type="text"] {
    flex: 1;
    min-width: 0;
    min-height: var(--touch-min);
    padding: 12px 16px;
    border: 2px solid var(--surface2);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.btn {
    min-height: var(--touch-min);
    padding: 12px 22px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s, filter 0.15s;
    white-space: nowrap;
    touch-action: manipulation;
}

.btn-touch { min-height: var(--touch-min); }

.btn:active { transform: scale(0.98); }
.btn-primary {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, 0.2);
}
.btn-full { width: 100%; margin-top: 14px; }

.btn-sm {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-pdf {
    background: var(--accent-red);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 10px 14px;
    min-height: 44px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    letter-spacing: 0.03em;
    touch-action: manipulation;
}

.btn-icon {
    background: var(--surface2);
    border: none;
    color: var(--text);
    width: var(--touch-min);
    height: var(--touch-min);
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(148, 163, 184, 0.15);
    touch-action: manipulation;
}

.btn-icon-sm {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
}

.btn-icon-xs {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
}

.btn-icon-lg {
    width: 52px;
    height: 52px;
}

/* Error */
.error { color: var(--danger); font-size: 0.9rem; margin-top: 10px; }
.hidden { display: none !important; }

/* Spinner */
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--surface2);
    border-top-color: var(--gold-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 16px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scanner */
.scanner-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
    text-align: center;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

#scanner-region {
    width: 100%;
    max-width: min(300px, 100%);
    margin: 0 auto 12px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

/* ============================================
   TYPE SELECTION VIEW
   ============================================ */

.type-select-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

.type-heading {
    font-size: 1.4rem;
    text-align: center;
}

.type-subtitle {
    color: var(--text-dim);
    margin-bottom: 28px;
    text-align: center;
    font-size: 0.95rem;
}

.type-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 400px;
}

.type-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 2px solid var(--surface2);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s, box-shadow 0.2s;
    text-align: left;
    width: 100%;
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    touch-action: manipulation;
}

.type-card:hover, .type-card:focus {
    border-color: var(--gold);
    box-shadow: 0 4px 20px rgba(212, 160, 18, 0.15);
    transform: translateY(-2px);
}

.type-card:active {
    transform: scale(0.98);
}

.type-card[data-category="C678"]:hover,
.type-card[data-category="C678"]:focus {
    border-color: var(--natural-green);
    box-shadow: 0 4px 20px rgba(5, 150, 105, 0.15);
}

.type-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.type-icon-regular {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(37, 99, 235, 0.08));
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.type-icon-natural {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.2), rgba(5, 150, 105, 0.08));
    border: 1px solid rgba(5, 150, 105, 0.3);
}

.type-card-text {
    flex: 1;
    min-width: 0;
}

.type-label {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.type-desc {
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.4;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.type-meta {
    font-size: 0.75rem;
    color: var(--gold-light);
    font-weight: 600;
}

.type-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 0;
}

/* ============================================
   BAY VIEW
   ============================================ */

.bay-view-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
    padding: 0 env(safe-area-inset-right, 0) 0 env(safe-area-inset-left, 0);
}

.bay-top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    min-height: 50px;
    flex-shrink: 0;
    background: var(--bg);
    z-index: 10;
}

.bay-top-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bay-indicator {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold-light);
}

.bay-top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Bay bottom navigation bar */
.bay-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: var(--bg);
    flex-shrink: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.bay-nav-arrow {
    width: 48px;
    height: 44px;
    background: var(--surface2);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text);
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
    touch-action: manipulation;
    transition: background 0.15s, opacity 0.15s;
}

.bay-nav-arrow:active {
    background: rgba(37, 99, 235, 0.4);
}

.bay-nav-arrow[style*="hidden"] {
    opacity: 0.3;
    pointer-events: none;
}

/* Bay shelf container */
.bay-shelf-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    padding: 4px 8px;
    -webkit-overflow-scrolling: touch;
}

.shelf-unit {
    display: flex;
    flex-direction: column-reverse;
    gap: 3px;
    width: 100%;
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.shelf-row {
    display: flex;
    align-items: stretch;
    background: linear-gradient(180deg, var(--surface2) 0%, rgba(30, 58, 95, 0.7) 100%);
    border-radius: 4px;
    padding: 2px;
    position: relative;
    width: 100%;
    border-bottom: 3px solid rgba(100, 116, 139, 0.3);
}

.shelf-label {
    position: absolute;
    left: 4px;
    top: 2px;
    font-size: 0.55rem;
    color: var(--text-dim);
    opacity: 0.6;
    z-index: 2;
    font-weight: 700;
}

.shelf-products {
    display: flex;
    align-items: flex-end;
    width: 100%;
    flex-wrap: nowrap;
}

/* Product slots with thumbnails */
.product-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    overflow: hidden;
    position: relative;
    min-width: 12px;
    height: 100%;
    border: 1px solid rgba(255,255,255,0.06);
}

.product-slot:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.product-slot:active {
    transform: scale(0.97);
}

.slot-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    padding: 1px;
}

.product-slot .slot-text {
    font-size: 0.45rem;
    color: rgba(255,255,255,0.8);
    text-align: center;
    padding: 1px;
    line-height: 1.1;
    overflow: hidden;
    word-break: break-all;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Slot badges */
.slot-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 0.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.slot-badge-new {
    background: var(--success);
    color: var(--bg);
}

.slot-badge-changed {
    background: var(--accent-red);
    color: #fff;
}

/* Product highlight */
.product-slot.highlight {
    animation: pulse-highlight 1.5s ease-in-out 4;
    z-index: 20;
}

@keyframes pulse-highlight {
    0%, 100% { box-shadow: 0 0 4px var(--highlight); border-color: var(--highlight); }
    50% { box-shadow: 0 0 20px var(--highlight), 0 0 40px rgba(251, 191, 36, 0.25); border-color: var(--highlight); }
}

/* Product colors by first letter of description */
.product-slot { background: #2d3748; }
.product-slot[data-color="0"] { background: #4a5568; }
.product-slot[data-color="1"] { background: #553c9a; }
.product-slot[data-color="2"] { background: #2b6cb0; }
.product-slot[data-color="3"] { background: #276749; }
.product-slot[data-color="4"] { background: #9c4221; }
.product-slot[data-color="5"] { background: #744210; }
.product-slot[data-color="6"] { background: #702459; }
.product-slot[data-color="7"] { background: #1a365d; }

/* Bay numbers */
.bay-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: calc(100vw - 140px);
    padding: 2px 0;
}

.bay-numbers::-webkit-scrollbar { display: none; }

.bay-num {
    min-width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--surface2);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    touch-action: manipulation;
    padding: 0 6px;
}

.bay-num.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* ============================================
   SEARCH RESULTS LIST
   ============================================ */

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.search-result-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s;
    text-align: left;
    width: 100%;
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    touch-action: manipulation;
}

.search-result-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.search-result-card:active {
    transform: scale(0.99);
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-result-detail {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 2px;
}

.search-result-location {
    font-size: 0.82rem;
    color: var(--gold-light);
    font-weight: 600;
}

.search-result-arrow {
    font-size: 1.5rem;
    color: var(--text-dim);
    flex-shrink: 0;
}

/* ============================================
   PRODUCT OVERLAY
   ============================================ */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 15, 28, 0.88);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

.overlay.hidden { display: none; }

.overlay-content {
    background: var(--surface);
    width: 100%;
    max-width: 520px;
    max-height: min(90vh, 90dvh);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 20px max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    position: relative;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-bottom: none;
}

.close-btn {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    font-size: 1.5rem;
    z-index: 2;
}

.overlay-product-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding-right: 40px;
}

.overlay-title-group {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.overlay-image {
    text-align: center;
    flex-shrink: 0;
}

.overlay-image img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.overlay-image .placeholder-img {
    width: 72px;
    height: 72px;
    background: var(--surface2);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 1.6rem;
}

.overlay-content h3 {
    font-size: 1rem;
    margin: 0;
    line-height: 1.3;
}

.overlay-details .detail-row {
    padding: 6px 0;
}

.overlay-actions {
    margin-top: 10px;
}

.overlay-nav-footer {
    margin-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    padding-top: 10px;
}

.overlay-nav-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.overlay-pos-label {
    font-size: 0.82rem;
    color: var(--text-dim);
    font-weight: 600;
    text-align: center;
}

.overlay-nav-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    justify-content: center;
}

/* Badge */
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    display: inline-flex;
}

.badge-new { background: var(--success); color: var(--bg); }
.badge-changed { background: var(--accent-red); color: #fff; }

/* Detail rows */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-dim); font-size: 0.85rem; flex-shrink: 0; }
.detail-row .value { font-weight: 600; font-size: 0.88rem; text-align: right; word-break: break-word; }

/* ============================================
   IMAGE LIGHTBOX
   ============================================ */

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}

.image-lightbox.hidden { display: none; }

.image-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-close {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    touch-action: manipulation;
}

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

.overlay-image img {
    cursor: zoom-in;
}

/* ============================================
   DELETED ITEM OVERLAY
   ============================================ */

.deleted-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(180, 20, 20, 0.92);
}

.deleted-overlay.hidden { display: none; }

.deleted-overlay.flash {
    animation: flash-red 0.4s ease-in-out 3;
}

@keyframes flash-red {
    0%, 100% { background: rgba(180, 20, 20, 0.92); }
    50% { background: rgba(255, 0, 0, 0.98); }
}

.deleted-overlay-content {
    text-align: center;
    max-width: 380px;
}

.deleted-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: pulse-warn 1s ease-in-out infinite;
}

@keyframes pulse-warn {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.deleted-title {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.deleted-product-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.deleted-product-upc {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 20px;
}

.deleted-instructions {
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.deleted-instructions p {
    font-size: 1rem;
    line-height: 1.6;
    color: #fff;
}

/* ============================================
   PDF VIEWER
   ============================================ */

.pdf-viewer-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: #1a1a2e;
}

.pdf-top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    min-height: 50px;
    flex-shrink: 0;
}

.pdf-title-area {
    flex: 1;
    min-width: 0;
}

.pdf-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.pdf-search-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    flex-shrink: 0;
}

.pdf-search-bar input {
    flex: 1;
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid var(--surface2);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    outline: none;
}

.pdf-search-bar input:focus {
    border-color: var(--primary);
}

.pdf-search-count {
    font-size: 0.75rem;
    color: var(--text-dim);
    white-space: nowrap;
}

.pdf-canvas-container {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.pdf-canvas-container canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.pdf-text-layer {
    position: absolute;
    pointer-events: none;
    color: transparent;
    overflow: hidden;
    line-height: 1;
}

.pdf-text-layer > span {
    position: absolute;
    white-space: pre;
    transform-origin: 0% 0%;
    color: transparent;
}

.search-text-hit {
    position: static;
    display: inline;
    white-space: inherit;
    transform: none;
    background: rgba(250, 204, 21, 0.35);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.7);
    border-radius: 2px;
    color: transparent;
}

.search-text-hit-active {
    background: rgba(250, 150, 21, 0.55);
    box-shadow: 0 0 0 2px rgba(250, 150, 21, 0.9);
}

.pdf-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg);
    flex-shrink: 0;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.pdf-page-info {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    min-width: 60px;
    text-align: center;
}

/* ============================================
   RESPONSIVE & MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .spinner { animation: none; }
    .product-slot.highlight { animation: none; }
    .deleted-icon { animation: none; }
    .deleted-overlay.flash { animation: none; }
}

/* Wider screens: allow more room */
@media (min-width: 520px) {
    .container {
        max-width: 600px;
    }

    .type-cards {
        flex-direction: row;
    }

    .type-card {
        flex-direction: column;
        text-align: center;
    }
}

/* Landscape phone: compact top areas and use horizontal space */
@media (max-height: 500px) and (orientation: landscape) {
    .brand-mascot {
        width: min(80px, 20vw);
    }

    .center-content {
        justify-content: flex-start;
        padding-top: 16px;
    }

    .type-select-content {
        padding: 8px 0;
    }

    .type-heading {
        font-size: 1.1rem;
    }

    .type-subtitle {
        margin-bottom: 12px;
    }

    .type-cards {
        flex-direction: row;
        max-width: 100%;
        gap: 12px;
    }

    .type-card {
        flex-direction: column;
        text-align: center;
        padding: 14px;
    }

    .type-icon {
        width: 44px;
        height: 44px;
        font-size: 1.4rem;
    }

    .bay-top-bar {
        padding: 4px 12px;
        min-height: 44px;
    }

    .pdf-top-bar {
        padding: 4px 12px;
        min-height: 44px;
    }

    .pdf-bottom-bar {
        padding: 6px 16px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }
}
