/* PlantTools – Mobile-first styles */

:root {
    --primary: #2e7d32;
    --primary-dark: #1b5e20;
    --bg: #fafafa;
    --surface: #ffffff;
    --text: #212121;
    --text-secondary: #757575;
    --border: #e0e0e0;
    --error: #c62828;
    --success: #2e7d32;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Navbar */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    text-decoration: none;
}

.nav-logo {
    height: 40px;
    width: auto;
}

.nav-version {
    font-size: 0.7rem;
    opacity: 0.6;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.nav-link.active,
.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 600px) {
    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        gap: 0;
        margin-top: 0.5rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-link {
        padding: 0.6rem 0.8rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Layout */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

h1 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.5rem;
}

/* Top row: title + custom text */
.top-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.top-row h1 {
    margin-bottom: 0;
}

.custom-text-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.custom-text-field input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-bar input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.search-bar select,
.location-bar select {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--surface);
}

/* Location bar */
.location-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Tables */
table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

th, td {
    padding: 0.5rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    word-break: break-word;
    overflow-wrap: break-word;
}

th {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

td img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
}

td input[type="number"] {
    width: 60px;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
}

td input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    touch-action: manipulation;
    min-height: 44px;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.btn-loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

.btn-secondary.btn-loading::after {
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: var(--text);
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    min-height: auto;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin: 1rem 0;
}

#preview-section {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--surface, #f9f9f9);
    border-radius: var(--radius, 8px);
}

#preview-container img {
    border-radius: 4px;
}

#pdf-section {
    margin: 1rem 0;
}

#pdf-frame {
    width: 100%;
    height: 400px;
    border: 1px solid #ccc;
    border-radius: var(--radius, 8px);
}

/* === Inventering toolbar & modes === */

.inv-toolbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem;
    margin-bottom: 1rem;
}

.inv-toolbar-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.inv-toolbar-row + .inv-toolbar-row {
    margin-top: 0.6rem;
}

.inv-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 140px;
}

.inv-field label {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.inv-field select {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.inv-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.inv-toggle input {
    width: 18px;
    height: 18px;
}

.inv-toggle-help {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

@media (max-width: 600px) {
    .inv-toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }

    .inv-field {
        flex-direction: column;
        align-items: stretch;
        gap: 0.2rem;
    }

    .inv-toggle-help {
        display: block;
        margin-top: 0.2rem;
    }
}

/* Guided inventory items */
.guided-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    transition: border-color 0.2s;
}

.guided-item-done {
    border-color: var(--success);
    background: rgba(46, 125, 50, 0.04);
}

.guided-item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.guided-item-code {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.guided-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.guided-item-expected {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.guided-item-location {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 4px;
    align-self: flex-start;
    margin-top: 2px;
}

.guided-item-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.guided-qty-input {
    width: 70px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.1rem;
    text-align: center;
    font-weight: bold;
}

.guided-qty-input:focus {
    border-color: var(--primary);
    outline: none;
}

.guided-diff {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    white-space: nowrap;
}

.guided-diff.positive {
    color: var(--success);
    background: #e8f5e9;
}

.guided-diff.negative {
    color: var(--error);
    background: #ffebee;
}

/* Info button on guided items */
.guided-info-btn {
    width: 44px;
    height: 44px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    background: none;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    font-style: italic;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.guided-info-btn:hover,
.guided-info-btn.active {
    background: var(--primary);
    color: #fff;
}

/* Expandable detail panel */
.guided-detail {
    background: #f9f9f9;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 0.8rem;
    margin-top: -0.4rem;
    margin-bottom: 0.4rem;
}

.guided-detail-img {
    max-width: 120px;
    max-height: 120px;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.guided-detail-section {
    margin-bottom: 0.6rem;
}

.guided-detail-section strong {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.2rem;
}

.guided-detail-row {
    font-size: 0.85rem;
    padding: 0.15rem 0;
    color: var(--text);
}

/* Quick queue — reuse queue-item styles for consistency */
#quick-queue-section,
#transfer-queue-section {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
}

.quick-queue-item { /* alias → queue-item */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

.quick-queue-item:last-child { border-bottom: none; }
.quick-queue-filled { background: rgba(46, 125, 50, 0.04); }

.quick-queue-info,
.queue-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.quick-queue-code,
.queue-item-code {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.quick-queue-name,
.queue-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-queue-stock {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.quick-queue-controls,
.queue-item-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

/* Product card (inventering) */
.product-card {
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
}

.product-card h3 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.stock-locations {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.3rem;
}

.quantity-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quantity-input input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.1rem;
    text-align: center;
}

/* Manual code input */
.manual-code-input {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem auto 0;
    max-width: 400px;
}

.manual-code-input input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

/* Quantity diff indicator */
.qty-diff {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
}

.qty-diff.positive {
    color: var(--success);
    background: #e8f5e9;
}

.qty-diff.negative {
    color: var(--error);
    background: #ffebee;
}

.qty-diff.zero {
    color: var(--text-secondary);
    background: #f5f5f5;
}

/* Online/offline status */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

.connection-status.online {
    color: var(--success);
    background: #e8f5e9;
}

.connection-status.offline {
    color: var(--error);
    background: #ffebee;
}

.connection-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.connection-status.online .dot { background: var(--success); }
.connection-status.offline .dot { background: var(--error); }

/* QR Scanner */
#qr-reader {
    max-width: 400px;
    margin: 0 auto 1rem;
    border-radius: var(--radius);
    overflow: hidden;
}

/* Status messages */
.loading, .error-msg, #scan-status, #send-status {
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.loading {
    background: #e3f2fd;
    color: #1565c0;
}

.error-msg {
    background: #ffebee;
    color: var(--error);
}

.success-msg {
    background: #e8f5e9;
    color: var(--success);
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    .search-bar {
        flex-direction: column;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.4rem;
    }

    td img {
        width: 32px;
        height: 32px;
    }

    /* Search results table column sizing for mobile */
    .results-table .col-img   { width: 44px; }
    .results-table .col-code  { width: 28%; }
    .results-table .col-name  { width: auto; }
    .results-table .col-price { width: 16%; }
    .results-table .col-add   { width: 38px; }
}

/* Desktop column sizing */
.results-table .col-img   { width: 56px; }
.results-table .col-code  { width: 22%; }
.results-table .col-name  { width: auto; }
.results-table .col-price { width: 90px; }
.results-table .col-add   { width: 44px; }

/* Lagerflytt */
.location-pair {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.location-pair > div {
    flex: 1;
}

.location-pair select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.btn-back {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.4rem 0;
    margin-bottom: 0.5rem;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.btn-back:hover {
    text-decoration: underline;
}

.btn-swap {
    background: none;
    border: 2px solid var(--primary);
    border-radius: 50%;
    color: var(--primary);
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 2px;
    transition: background 0.2s, color 0.2s;
}

.btn-swap:hover {
    background: var(--primary);
    color: white;
}

/* Produktinfo */
.product-detail-card {
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
}

.detail-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-image img {
    max-width: 150px;
    max-height: 150px;
    border-radius: var(--radius);
}

.detail-info h2 {
    margin: 0 0 0.3rem;
    font-size: 1.2rem;
}

.detail-code {
    font-family: monospace;
    color: #666;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.detail-table th,
.detail-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.detail-table th {
    width: 40%;
    color: #666;
    font-weight: normal;
}

/* Produktinfo action buttons */
.detail-actions {
    display: flex;
    gap: 0.5rem;
    margin: 0.8rem 0;
    flex-wrap: wrap;
}

#recent-section {
    margin-bottom: 1rem;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}

/* Dashboard */
.dashboard-toolbar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.dashboard-auto-refresh {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.dashboard-auto-refresh label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dashboard-toolbar select {
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

@media (max-width: 600px) {
    .dashboard-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-toolbar .btn {
        width: 100%;
    }

    .dashboard-auto-refresh {
        justify-content: space-between;
    }
}

.text-muted {
    color: #999;
    font-size: 0.85rem;
}

.dashboard-cards {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.dashboard-card {
    flex: 1;
    min-width: 120px;
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.card-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.card-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.3rem;
}

/* Stock location cards */
.stock-location-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.stock-location-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.12);
}

.stock-location-card:active {
    background: #f5f5f5;
}

.stock-location-active {
    border-color: var(--primary);
    border-width: 2px;
    background: rgba(46, 125, 50, 0.04);
}

.stock-loc-name {
    font-weight: 700;
    font-size: 1rem;
}

.stock-loc-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Location detail */
#location-detail {
    margin: 0.5rem 0 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
}

.location-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.location-detail-header h3 {
    margin: 0;
    font-size: 1rem;
}

.loc-detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

.loc-detail-item:last-child {
    border-bottom: none;
}

.loc-detail-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.loc-detail-code {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.loc-detail-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loc-detail-qty {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}

/* Movement cards */
.movement-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.4rem;
}

.movement-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.movement-product {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.movement-qty {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
    flex-shrink: 0;
}

.movement-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 2px;
}

.movement-route {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.movement-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Zero stock list */
.zero-stock-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}

.zero-stock-item:last-child {
    border-bottom: none;
}

.zero-stock-code {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.zero-stock-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-text-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.custom-text-row input {
    flex: 1;
}

.btn-icon {
    background: none;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    color: var(--primary);
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.btn-icon:hover,
.btn-icon.active {
    background: var(--primary);
    color: white;
}

/* Masskanning */
.scan-feedback {
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    padding: 0.8rem;
    margin: 0.5rem 0;
    border-radius: var(--radius);
    transition: opacity 0.3s;
}

.tally-count-input {
    width: 60px;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
}

/* --- Test DB badge --- */
.test-db-badge {
    background: #c62828;
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    letter-spacing: 0.5px;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* --- Plocklista progress bar --- */
.progress-track {
    width: 100%;
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* === Produktinfo: scan mode tabs === */

.scan-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--primary);
}

.scan-mode-tab {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    background: var(--surface);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.scan-mode-tab.active {
    background: var(--primary);
    color: #fff;
}

/* === OCR capture === */

.ocr-capture-area {
    text-align: center;
    padding: 1rem 0;
}

.ocr-instructions {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.ocr-capture-btn {
    display: inline-block;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.8rem 2rem;
}

#ocr-preview {
    margin: 1rem auto;
    max-width: 400px;
}

#ocr-preview-img {
    width: 100%;
    border-radius: var(--radius);
    border: 2px solid var(--border);
}

#ocr-progress {
    margin: 1rem auto;
    max-width: 300px;
}

.ocr-progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.ocr-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

#ocr-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#ocr-extracted {
    text-align: left;
    margin: 1rem 0;
    padding: 0.8rem;
    background: #f5f5f5;
    border-radius: var(--radius);
}

#ocr-extracted h4 {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#ocr-text-content {
    white-space: pre-wrap;
    font-size: 0.8rem;
    max-height: 120px;
    overflow-y: auto;
    color: var(--text);
}

/* === OCR search results === */

#ocr-results {
    margin-top: 1rem;
}

.ocr-result-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s;
}

.ocr-result-card:hover {
    border-color: var(--primary);
}

.ocr-result-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.ocr-result-no-img {
    width: 50px;
    height: 50px;
    background: #eee;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 0.7rem;
    flex-shrink: 0;
}

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

.ocr-result-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ocr-result-code {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* === Print Queue (Utskriftskö) === */

#print-queue-section {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
}

.queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.queue-header h3 {
    font-size: 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.queue-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.queue-empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem 0;
}

.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

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

.btn-qty-minus,
.btn-qty-plus {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--text);
}

.btn-qty-minus:hover,
.btn-qty-plus:hover {
    background: var(--border);
}

.queue-qty {
    width: 50px;
    height: 44px;
    padding: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
}

.btn-queue-remove {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 4px;
    background: none;
    color: var(--error);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.3rem;
}

.btn-queue-remove:hover {
    background: #ffebee;
}

/* Add to queue button in search results */
.btn-add-queue {
    width: 44px;
    height: 44px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    background: none;
    color: var(--primary);
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

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

/* Search results: location split */
.search-divider-row td {
    background: #f0f0f0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    text-align: center;
    padding: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.search-other-location {
    opacity: 0.6;
}

.search-other-location:hover {
    opacity: 1;
}

.btn-add-queue.in-queue {
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
}

/* Flash animation when item added to queue */
.queue-item-flash {
    animation: queue-flash 0.6s ease;
}

@keyframes queue-flash {
    0% { background: #e8f5e9; }
    100% { background: transparent; }
}

/* Toast notification for direct print */
.print-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: toast-in 0.3s ease;
    max-width: 90vw;
    text-align: center;
    cursor: pointer;
}

.toast-success {
    background: var(--primary);
    color: #fff;
}

.toast-error {
    background: var(--error);
    color: #fff;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.ocr-result-match {
    font-size: 0.75rem;
    color: var(--primary);
    margin-top: 2px;
}

/* === Plocklista: Order cards === */

.picking-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.picking-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.12);
}

.picking-card:active {
    background: #f5f5f5;
}

.picking-overdue {
    border-left: 4px solid var(--error);
}

.picking-due-soon {
    border-left: 4px solid #f9a825;
}

.picking-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.picking-card-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.picking-origin {
    font-weight: 700;
    font-size: 1rem;
}

.picking-partner {
    font-size: 0.9rem;
    color: var(--text);
}

.picking-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-ready {
    background: #e8f5e9;
    color: var(--success);
}

.badge-waiting {
    background: #fff8e1;
    color: #f57f17;
}

.picking-card-bottom {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.picking-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.picking-lines-badge {
    font-size: 0.75rem;
    font-weight: 600;
    background: #f0f0f0;
    color: var(--text-secondary);
    padding: 1px 8px;
    border-radius: 10px;
}

.picking-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.picking-empty-state svg {
    margin-bottom: 0.8rem;
}

.picking-empty-state p {
    font-size: 1rem;
}

/* Printer status indicator */
.printer-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.printer-online {
    background: var(--success);
    box-shadow: 0 0 4px var(--success);
}
