/* ===== BAZAR CENTRAL PWA ===== */
:root {
    --bg: #0c1222;
    --bg-card: #151d30;
    --bg-input: #1a2540;
    --bg-hover: #1e2d4a;
    --border: #263354;
    --text: #e4e9f2;
    --text-dim: #8896b3;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59,130,246,0.12);
    --green: #22c55e;
    --green-soft: rgba(34,197,94,0.12);
    --red: #ef4444;
    --red-soft: rgba(239,68,68,0.12);
    --yellow: #f59e0b;
    --yellow-soft: rgba(245,158,11,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

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

html, body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* ===== LOGIN ===== */
.login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
    padding-top: calc(24px + var(--safe-top));
    padding-bottom: calc(24px + var(--safe-bottom));
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 32px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-box .logo {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
    color: var(--accent);
}

.login-box .subtitle {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 32px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    font-family: var(--font);
    transition: border-color 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
}

.form-control::placeholder {
    color: var(--text-dim);
    opacity: 0.6;
}

#prod-nome, #lista-nome {
    text-transform: uppercase;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238896b3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-full {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    border-radius: var(--radius);
    margin-top: 8px;
}

.btn-success {
    background: var(--green);
    color: #fff;
}
.btn-success:hover { opacity: 0.9; }

.btn-danger {
    background: var(--red);
    color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover {
    background: var(--bg-hover);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ===== APP SHELL ===== */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* iOS PWA status bar background */
@supports (padding-top: env(safe-area-inset-top)) {
    .app::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: var(--safe-top);
        background: var(--bg-card);
        z-index: 101;
    }
}

/* Fallback: force padding in standalone PWA mode (iPhone) */
@media (display-mode: standalone) {
    .header {
        padding-top: max(var(--safe-top), 0px) !important;
        height: calc(56px + max(var(--safe-top), 0px)) !important;
    }
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    padding-top: var(--safe-top);
    height: calc(56px + var(--safe-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(12px);
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.user-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--accent-soft);
    color: var(--accent);
}

/* Main Content */
.main {
    flex: 1;
    padding: 16px;
    padding-bottom: calc(80px + var(--safe-bottom));
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    padding-bottom: var(--safe-bottom);
    height: calc(64px + var(--safe-bottom));
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 2px;
    color: var(--text-dim);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    border: none;
    background: none;
    font-family: var(--font);
    -webkit-tap-highlight-color: transparent;
}

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

.nav-item svg {
    width: 22px;
    height: 22px;
}

.nav-item span {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ===== PAGE SECTIONS ===== */
.page { display: none; }
.page.active { display: block; }

.page-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 180px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-dim);
}

.filter-select {
    padding: 10px 34px 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238896b3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ===== CARDS / CATALOG ===== */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.catalog-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}

.catalog-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.catalog-card-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-input);
    display: block;
}

.catalog-card-img.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 32px;
}

.catalog-card-body {
    padding: 10px 12px;
}

.catalog-card-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.catalog-card-meta {
    font-size: 11px;
    color: var(--text-dim);
}

.catalog-card-qty {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
}

.qty-ok { background: var(--green-soft); color: var(--green); }
.qty-low { background: var(--yellow-soft); color: var(--yellow); }
.qty-zero { background: var(--red-soft); color: var(--red); }

/* Category group header */
.category-header {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    padding: 12px 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    margin-top: 8px;
}

.category-header:first-child { margin-top: 0; }

/* ===== LIST ITEMS (for lista/pedidos) ===== */
.list-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color 0.2s;
}

.list-item:hover {
    border-color: var(--accent);
}

.list-item-img {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-input);
    flex-shrink: 0;
}

.list-item-body {
    flex: 1;
    min-width: 0;
}

.list-item-name {
    font-size: 14px;
    font-weight: 600;
}

.list-item-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

.list-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ===== CATEGORY ITEMS ===== */
.cat-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cat-item-name {
    font-size: 15px;
    font-weight: 600;
}

/* ===== PEDIDOS ===== */
.pedido-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
}

.pedido-empresa {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.pedido-info {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pedido-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-pagar { background: var(--red-soft); color: var(--red); }
.badge-gratis { background: var(--green-soft); color: var(--green); }

.pedido-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    padding: 10px 14px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent);
    color: #fff;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px 20px;
    padding-bottom: calc(24px + var(--safe-bottom));
    transform: translateY(100%);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-input);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Photo upload */
.photo-upload {
    width: 100%;
    aspect-ratio: 16/10;
    background: var(--bg-input);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
    overflow: hidden;
    position: relative;
    margin-bottom: 16px;
}

.photo-upload:hover {
    border-color: var(--accent);
}

.photo-upload img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.photo-upload svg {
    width: 32px;
    height: 32px;
    color: var(--text-dim);
}

.photo-upload span {
    font-size: 13px;
    color: var(--text-dim);
}

.camera-float-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}

/* Scanner */
.scanner-container {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: #000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.scanner-container.active {
    display: flex;
}

#scanner-reader {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh;
    border: none !important;
    overflow: hidden;
}

#scanner-reader video {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    object-fit: cover !important;
    border: none !important;
    position: absolute;
    top: 0;
    left: 0;
}

#scanner-reader #qr-shaded-region {
    border-color: rgba(59, 130, 246, 0.7) !important;
}

/* Style the scan region border */
#scanner-reader canvas {
    position: absolute !important;
}

/* Hide html5-qrcode built-in UI elements we don't need */
#scanner-reader img,
#scanner-reader__dashboard,
#scanner-reader__dashboard_section,
#scanner-reader__dashboard_section_csr,
#scanner-reader__dashboard_section_swaplink,
#scanner-reader__status_span,
#scanner-reader__header_message,
#scanner-reader br {
    display: none !important;
}

.scanner-close {
    position: fixed;
    top: max(16px, env(safe-area-inset-top, 16px));
    right: 16px;
    z-index: 310;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    border: 2px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    z-index: 500;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    box-shadow: var(--shadow);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
}

/* ===== FAB ===== */
.fab {
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(59,130,246,0.4);
    z-index: 50;
    transition: transform 0.2s, background 0.2s;
}

.fab:hover {
    transform: scale(1.05);
    background: var(--accent-hover);
}

.fab svg {
    width: 24px;
    height: 24px;
}

/* ===== LOADING ===== */
.loading {
    text-align: center;
    padding: 30px;
    color: var(--text-dim);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ===== */
@media (min-width: 500px) {
    .catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .modal {
        border-radius: 20px;
        margin: auto;
    }

    .modal-overlay {
        align-items: center;
        padding: 20px;
    }

    .modal-overlay.active .modal {
        transform: translateY(0);
    }
}

/* ===== QUANTITY CONTROLS ===== */
.qty-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.qty-controls .catalog-card-qty {
    min-width: 44px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.qty-inline-input {
    width: 52px;
    min-width: 44px;
    padding: 2px 4px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font);
    background: var(--bg-input);
    border: 2px solid var(--accent);
    border-radius: 8px;
    color: var(--text);
    outline: none;
    -moz-appearance: textfield;
}

.qty-inline-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}

.qty-btn:active {
    background: var(--accent);
    color: #fff;
}

/* ===== ESTOQUE LIST (compact) ===== */
.estoque-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.estoque-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.estoque-item:hover {
    border-color: var(--accent);
}

.estoque-item-img {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 6px;
    object-fit: cover;
}

.estoque-item-body {
    flex: 1;
    min-width: 0;
}

.estoque-item-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.estoque-item-meta {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 1px;
}

/* ===== LISTA GRID (2 columns) ===== */
.lista-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}

.lista-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    min-height: 40px;
}

.lista-check {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 5px;
    border: 2px solid var(--border);
    background: var(--bg-input);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.lista-card-img {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 4px;
    object-fit: cover;
    cursor: pointer;
}

.lista-card-name {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    cursor: pointer;
}

.lista-card-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

@media (max-width: 380px) {
    .lista-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== IMAGE SEARCH ===== */
.img-search-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.img-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.img-result-item {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.img-result-item:hover {
    border-color: var(--accent);
}

/* ===== AJUDA CHAT ===== */
.ajuda-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px 0;
}

.ajuda-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.ajuda-msg.user {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ajuda-msg.ia {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.ajuda-msg.loading {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-style: italic;
}

.ajuda-imgs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.ajuda-imgs img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
}

.ajuda-imgs img:hover {
    border-color: var(--accent);
}

.ajuda-input-area {
    display: flex;
    gap: 8px;
}

.ajuda-input-area .form-control {
    flex: 1;
}

.ajuda-input-area .btn {
    width: 48px;
    padding: 0;
    flex-shrink: 0;
}

.ajuda-opcoes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.ajuda-opt-btn {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 20px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.ajuda-opt-btn:hover, .ajuda-opt-btn:active {
    background: var(--accent);
    color: #fff;
}

/* ===== CROPPER OVERRIDES ===== */
.cropper-container {
    border-radius: 8px;
}

.cropper-view-box {
    outline: 2px solid var(--accent) !important;
    outline-color: rgba(59,130,246,0.8) !important;
}

.cropper-line, .cropper-point {
    background-color: var(--accent) !important;
}

.cropper-modal {
    background-color: rgba(0,0,0,0.7) !important;
}

.cropper-dashed {
    border-color: rgba(255,255,255,0.3) !important;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }

.barcode-input-row {
    display: flex;
    gap: 8px;
}

.barcode-input-row .form-control {
    flex: 1;
}

.btn-scan {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    padding: 0;
    border-radius: var(--radius-sm);
    background: var(--accent);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
