/* Mobile store-restocking module — full-screen shell, camera scanning, and the grouped picking
   list. Large touch targets and safe-area padding throughout since this is used one-thumb, phone
   in hand, walking around a store. */

.restock-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    background: var(--bg-canvas);
    color: var(--text-primary);
    font-size: 1rem;
}

.restock-topbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-4) var(--space-3);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

/* Thin brand accent stripe along the top edge — the same "this is part of Freshyto OneWorld,
   not a bare utility screen" touch used on the login pages. */
.restock-topbar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--lime));
}

.restock-topbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-weight: 650;
    font-size: var(--text-lg);
}

.restock-topbar-logo {
    height: 34px;
    width: 34px;
}

.restock-exit {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface-2);
}

.restock-body {
    position: relative;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* Bottom tab bar — shared between the scan and list pages. */
.restock-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3) calc(var(--space-2) + env(safe-area-inset-bottom));
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 20;
}

.restock-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-2);
    min-height: 52px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-xs);
    font-weight: 600;
}

.restock-tab.active {
    color: var(--accent);
    background: var(--accent-soft-bg);
}

.restock-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--text-on-accent);
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
}

/* Always-on camera stage: the video never unmounts while scanning is active — detected products
   and search results float on top of it instead of replacing it, so scanning the next item never
   feels like leaving the page. */
.restock-scan-stage {
    position: absolute;
    inset: 0;
    background: #000;
    overflow: hidden;
}

/* Inventory Count's scan-entry page reuses this scanner stage but lives inside the normal admin
   layout (sidebar/topbar/PageHeader) rather than Restock's dedicated full-viewport RestockLayout —
   `position: absolute; inset: 0` there covers the whole content area (hiding the page header and
   anything below), since its nearest positioned ancestor is the page content wrapper, not a
   purpose-built full-height shell. This override keeps the same look (still establishes a
   positioned box for the video/overlay children) but sizes it in normal flow instead. */
.count-scan-stage {
    position: relative;
    inset: auto;
    height: 60vh;
    min-height: 420px;
    border-radius: var(--radius-lg);
}

.restock-scan-stage video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Branded corner-bracket viewfinder (à la modern camera-scan UIs) instead of a plain dashed
   rectangle — the lime accent corners tie the scan stage back to the rest of the app's identity
   without a heavy border that fights the live camera feed underneath. */
.restock-scan-guide {
    position: absolute;
    inset: 16% 14% 42%;
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, .28);
    pointer-events: none;
}

.restock-scan-corner {
    position: absolute;
    width: 28px;
    height: 28px;
    border: 3px solid var(--lime);
}

.restock-scan-corner.tl { top: -3px; left: -3px; border-right: none; border-bottom: none; border-top-left-radius: var(--radius-lg); }
.restock-scan-corner.tr { top: -3px; right: -3px; border-left: none; border-bottom: none; border-top-right-radius: var(--radius-lg); }
.restock-scan-corner.bl { bottom: -3px; left: -3px; border-right: none; border-top: none; border-bottom-left-radius: var(--radius-lg); }
.restock-scan-corner.br { bottom: -3px; right: -3px; border-left: none; border-top: none; border-bottom-right-radius: var(--radius-lg); }

.restock-scan-hint {
    position: absolute;
    top: 60%;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
    pointer-events: none;
}

/* Flashlight toggle — shown only when the active camera track actually supports a torch
   (see restockScanner.js), positioned clear of the search overlay above and the guide below. */
.restock-torch-btn {
    position: absolute;
    top: calc(var(--space-3) + env(safe-area-inset-top) + 64px);
    right: var(--space-3);
    z-index: 9;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(10, 14, 12, .55);
    backdrop-filter: blur(8px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.restock-torch-btn.active {
    background: var(--lime);
    border-color: var(--lime);
    color: #0a1f10;
}

.restock-scan-fallback-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-items: center;
    justify-content: center;
    text-align: center;
    background: var(--bg-canvas);
}

/* Floating detected-product card — overlays the bottom of the live camera feed rather than
   replacing the whole scan view, so the camera is always visibly "still on". */
.restock-detect-card {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    max-height: 72%;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    background: var(--bg-elevated);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, .35);
    animation: restock-card-up .22s var(--ease);
}

@keyframes restock-card-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.restock-detect-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }

.restock-detect-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.restock-product-name {
    font-size: var(--text-xl);
    font-weight: 700;
}

.restock-product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    color: var(--text-secondary);
    font-size: var(--text-base);
}

.restock-qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.restock-qty-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.restock-qty-label .hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.restock-stepper {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.restock-stepper button {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    background: var(--bg-surface-2);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.restock-stepper input {
    width: 64px;
    text-align: center;
    font-size: var(--text-lg);
    font-weight: 700;
    min-height: 44px;
}

.restock-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.restock-sheet-actions .btn {
    min-height: 52px;
    font-size: var(--text-md);
}

/* Grouped restock list */
.restock-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-4) var(--space-2);
}

.restock-list-actions {
    display: flex;
    gap: var(--space-2);
}

.restock-rack-group {
    padding: 0 var(--space-4);
}

.restock-rack-header {
    position: sticky;
    top: 0;
    background: var(--bg-canvas);
    padding: var(--space-2) 0;
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.restock-item-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}

.restock-item-info {
    flex: 1;
    min-width: 0;
}

.restock-item-name {
    font-weight: 600;
    font-size: var(--text-base);
}

.restock-item-qty {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--accent);
    min-width: 44px;
    text-align: right;
}

.restock-item-actions {
    display: flex;
    gap: var(--space-1);
}

.restock-item-actions button {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
}

.restock-empty {
    padding: var(--space-8) var(--space-4);
    text-align: center;
    color: var(--text-muted);
}

/* Share picker (rendered inside the shared <Modal>, so uses the app's normal desktop-scale spacing) */
.restock-user-picker {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    max-height: 320px;
    overflow-y: auto;
}

.restock-user-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.restock-user-option:hover {
    background: var(--bg-hover);
}

.restock-user-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* Persistent search — floats over the top of the live camera feed so typing works without ever
   leaving scan mode or stopping the camera. */
.restock-search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 8;
    padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-3) var(--space-3);
    /* A gradient fade-to-transparent alone isn't reliable contrast — a bright patch of the live
       camera feed (a window, an overhead light) behind it can still wash out light text. The solid
       stop up front guarantees a dark backing regardless of what the camera sees. */
    background: linear-gradient(rgba(0, 0, 0, .75) 0%, rgba(0, 0, 0, .55) 70%, transparent 100%);
}

/* Was ~12%-opacity white glass with white text over a live camera feed — unreadable whenever the
   feed itself was bright (a window, overhead lighting). A reliably-dark, near-opaque backing keeps
   white text legible no matter what the camera sees behind it. */
.search-input.glass {
    display: flex;
    align-items: center;
    min-height: 48px;
    font-size: var(--text-md);
    background: rgba(8, 14, 11, .82);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--radius-lg);
}

.search-input.glass input {
    flex: 1;
    min-width: 0;
    font-size: var(--text-md);
    color: #fff;
    background: transparent;
    border: none;
    box-shadow: none;
}

.search-input.glass input::placeholder { color: rgba(255, 255, 255, .68); }
.search-input.glass svg { color: var(--lime); }

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: rgba(255, 255, 255, .85);
    background: rgba(255, 255, 255, .15);
}

.restock-search-hint {
    padding: var(--space-2) var(--space-1) 0;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

.restock-search-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-2);
    max-height: 60vh;
    overflow-y: auto;
}

.restock-search-result {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-md);
    text-align: left;
}

.restock-search-result.added { border-color: var(--success); }

.restock-search-result-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    font-weight: 600;
    font-size: var(--text-base);
}

.restock-search-added-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--success-soft-bg);
    color: var(--success-soft-text);
    font-size: var(--text-xs);
    font-weight: 700;
    flex-shrink: 0;
}

/* --- Restock Alerts (/restock/alerts): phone-first cards, the table only on wide screens ------------------------------ */

.ra-bar-top { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.ra-chips { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ra-chips::-webkit-scrollbar { display: none; }
.ra-chip {
    display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
    min-height: 40px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-secondary);
    font-weight: 600; font-size: var(--text-sm); cursor: pointer;
}
.ra-chip.active { background: var(--accent-soft-bg); color: var(--accent-soft-text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.ra-chip.danger.active { background: var(--danger-soft-bg); color: var(--danger-soft-text); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.ra-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ra-chip-count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: 999px; background: var(--bg-surface-2); color: var(--text-primary); font-size: 12px; font-variant-numeric: tabular-nums;
}
.ra-filters { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.ra-filter { flex: 1 1 180px; max-width: 240px; min-width: 0; }
.ra-toggle {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface);
    font-size: var(--text-sm); cursor: pointer; user-select: none;
}
.ra-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

.ra-group { margin-bottom: var(--space-5); }
.ra-group-title {
    display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-2);
    font-size: var(--text-sm); font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em;
}

.ra-list { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.ra-card {
    display: flex; flex-direction: column; gap: var(--space-3);
    padding: var(--space-4); border-radius: var(--radius-lg);
    background: var(--bg-surface); border: 1px solid var(--border);
}
.ra-card.nostock { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.ra-card-top { display: flex; gap: var(--space-3); align-items: flex-start; }
.ra-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ra-name { font-weight: 700; font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }
.ra-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: var(--text-sm); color: var(--text-secondary); }
.ra-rack {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin-top: 2px;
    padding: 2px 8px; border-radius: 999px; background: var(--bg-surface-2); font-size: 12px; font-weight: 600; color: var(--text-secondary);
}

.ra-bring {
    flex-shrink: 0; min-width: 72px; padding: 6px 10px; border-radius: var(--radius-md); text-align: center;
    display: flex; flex-direction: column; align-items: center; background: var(--accent-soft-bg); color: var(--accent-soft-text);
}
.ra-bring-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .85; }
.ra-bring-qty { font-size: 1.7rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ra-bring.none { background: var(--danger-soft-bg); color: var(--danger-soft-text); }
.ra-bring.wait { background: var(--warning-soft-bg); color: var(--warning-soft-text); }
.ra-bring-none { font-size: var(--text-sm); font-weight: 800; line-height: 1.6; white-space: nowrap; }

.ra-shelf { display: flex; flex-direction: column; gap: 6px; }
.ra-shelf-bar { height: 8px; border-radius: 999px; background: var(--bg-surface-2); overflow: hidden; }
.ra-shelf-bar span { display: block; height: 100%; border-radius: inherit; background: var(--warning); }
.ra-shelf-bar.low span { background: var(--danger); }
.ra-shelf-text { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ra-shelf.compact { flex-direction: row; align-items: center; gap: 8px; min-width: 120px; }
.ra-shelf.compact .ra-shelf-bar { flex: 1; min-width: 50px; height: 6px; }
.ra-shelf.compact span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }

.ra-done { width: 100%; min-height: 44px; justify-content: center; font-size: 1rem; }

/* Flat view: cards on phones and small tablets, the sortable table from 900px. */
.ra-desktop { display: none; }
@media (min-width: 900px) {
    .ra-mobile { display: none; }
    .ra-desktop { display: block; }
}

@media (max-width: 640px) {
    .ra-list { grid-template-columns: 1fr; }
    .ra-filter { flex: 1 1 calc(50% - var(--space-2)); max-width: none; }
    .ra-toggle { flex: 1 1 100%; justify-content: center; }
    .ra-card { padding: var(--space-3) var(--space-4) var(--space-4); }
}

/* Restock Alerts search + scan */
.ra-search { display: flex; gap: var(--space-2); align-items: stretch; }
.ra-search .search-input { flex: 1; min-width: 0; max-width: 520px; }
.ra-search .search-input input { min-height: 44px; font-size: 16px; }
.ra-search > .btn, .ra-search > button { min-height: 44px; flex-shrink: 0; }
.ra-search-info { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }
.ra-search-info strong { color: var(--text-primary); }
.ra-notlisted {
    display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg);
    background: var(--bg-surface); border: 1px solid color-mix(in srgb, var(--info) 45%, var(--border));
}
.ra-notlisted-text { display: flex; flex-direction: column; gap: 4px; line-height: 1.45; overflow-wrap: anywhere; }
.ra-notlisted-text span { font-size: var(--text-sm); color: var(--text-secondary); }
@media (min-width: 641px) { .ra-notlisted .ra-done { width: auto; align-self: flex-start; padding: 0 var(--space-5); } }

/* --- Damage reports (/damage for staff, /inventory/damage-reports for managers) ------------------------------------- */

.dmg-wrap { display: flex; flex-direction: column; gap: var(--space-4); max-width: 640px; }
.dmg-card {
    display: flex; flex-direction: column; gap: var(--space-3);
    padding: var(--space-4); border-radius: var(--radius-lg); background: var(--bg-surface); border: 1px solid var(--border);
}
.dmg-step { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-size: 1.05rem; font-weight: 700; }
.dmg-step > span:first-child {
    display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
    background: var(--accent-soft-bg); color: var(--accent-soft-text); font-size: 13px; font-weight: 800;
}
.dmg-optional { font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); }
.dmg-name { font-weight: 700; font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }
.dmg-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: var(--text-sm); color: var(--text-secondary); }

.dmg-results { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.dmg-result {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; min-height: 56px; text-align: left;
    border: 0; border-bottom: 1px solid var(--border); background: transparent; color: inherit; cursor: pointer;
}
.dmg-result:last-child { border-bottom: 0; }
.dmg-result:hover, .dmg-result:focus-visible { background: var(--bg-hover); outline: none; }
.dmg-result-name { font-weight: 600; overflow-wrap: anywhere; }

.dmg-picked { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3); border-radius: var(--radius-md); background: var(--bg-surface-2); }
.dmg-picked-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.dmg-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.dmg-kind {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px;
    border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-secondary);
    font-weight: 700; cursor: pointer;
}
.dmg-kind.active { background: var(--danger-soft-bg); color: var(--danger-soft-text); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.dmg-kind:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dmg-label { font-weight: 600; font-size: var(--text-sm); margin-top: var(--space-2); }
.dmg-qty { display: flex; align-items: stretch; max-width: 260px; }
.dmg-qty button {
    width: 56px; min-height: 52px; border: 1px solid var(--border); background: var(--bg-surface-2); color: var(--text-primary);
    font-size: 1.5rem; font-weight: 700; cursor: pointer;
}
.dmg-qty button:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.dmg-qty button:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.dmg-qty input { flex: 1; min-width: 0; text-align: center; font-size: 1.3rem; font-weight: 700; border-radius: 0; border-left: 0; border-right: 0; }
.dmg-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.dmg-card input[type="text"] { min-height: 44px; font-size: 16px; }

.dmg-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: var(--space-2); }
.dmg-thumb { position: relative; display: block; aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); background: var(--bg-surface-2); }
.dmg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dmg-thumb button {
    position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0;
    background: rgb(0 0 0 / .6); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.dmg-photo-btn { position: relative; min-height: 48px; justify-content: center; align-self: flex-start; padding: 0 var(--space-5); cursor: pointer; }
.dmg-photo-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dmg-send { min-height: 52px; font-size: 1.05rem; justify-content: center; }

.dmg-mine-title { margin: var(--space-4) 0 0; font-size: 1rem; font-weight: 700; display: flex; gap: var(--space-2); align-items: baseline; }
.dmg-mine { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); overflow: hidden; }
.dmg-mine-row { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.dmg-mine-row:last-child { border-bottom: 0; }
.dmg-mine-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dmg-mine-side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-2); flex-shrink: 0; }
.dmg-note { font-size: var(--text-sm); padding: 6px 10px; border-radius: var(--radius-md); background: var(--bg-surface-2); overflow-wrap: anywhere; }

.dmg-review .ra-card.dmg-done { opacity: .92; }
.dmg-edit { display: grid; grid-template-columns: 110px 1fr; gap: var(--space-2) var(--space-3); }
.dmg-edit .field { margin: 0; }
.dmg-edit-wide { grid-column: 1 / -1; }
.dmg-edit input, .dmg-edit select { min-height: 44px; font-size: 16px; }
.dmg-facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--text-sm); color: var(--text-secondary); }
.dmg-warn { color: var(--danger-soft-text); font-weight: 600; }
.dmg-actions { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2); }
.dmg-actions .btn { min-height: 44px; justify-content: center; }
.dmg-outcome { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); overflow-wrap: anywhere; }

@media (max-width: 640px) {
    .dmg-mine-row { flex-direction: column; }
    .dmg-mine-side { flex-direction: row; align-items: center; justify-content: space-between; }
    .dmg-qty { max-width: none; }
}

.dmg-focus-title { margin: 0 0 var(--space-2); font-size: var(--text-sm); font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.dmg-focus { margin-bottom: var(--space-5); }
.dmg-focus .ra-card { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.dmg-focus-alert { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.dmg-focus-alert span { flex: 1; overflow-wrap: anywhere; }
.dmg-mine-row.dmg-highlight { background: color-mix(in srgb, var(--accent-soft-bg) 55%, var(--bg-surface)); }

/* Expiry offer running: "I put only packs with best-before ... on the shelf" must be ticked before Restock done (2026-11-29). */
.ra-offer-check {
    display: flex; gap: var(--space-2); align-items: flex-start; margin: var(--space-2) 0; padding: 10px 12px; border-radius: var(--radius-md);
    border: 2px dashed color-mix(in srgb, var(--danger) 60%, var(--border)); background: var(--bg-surface-2);
    font-size: var(--text-sm); line-height: 1.35; cursor: pointer; text-align: left; color: var(--text-primary);
}
.ra-offer-check input { width: 22px !important; height: 22px; flex-shrink: 0; margin: 0; accent-color: #004E38; }
.ra-offer-check.ticked { border-style: solid; border-color: color-mix(in srgb, var(--success) 60%, var(--border)); }
td .ra-offer-check { max-width: 220px; font-size: var(--text-xs); padding: 6px 8px; }

/* Restock Report (/restock/report) */
.rr-filters { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; padding: var(--space-4); margin-bottom: var(--space-4); }
.rr-filters .field { margin: 0; min-width: 150px; }
.rr-quick { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.rr-search { flex: 1 1 260px; }
.rr-summary { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-bottom: var(--space-4); }
.rr-stat { display: flex; flex-direction: column; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--bg-surface);
    border: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-secondary); min-width: 110px; }
.rr-stat-num { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.rr-people { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.rr-day { margin-bottom: var(--space-5); }
.rr-day-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-3); font-size: var(--text-lg); margin: 0 0 var(--space-2); }
.rr-day-sub { font-size: var(--text-sm); font-weight: 400; color: var(--text-secondary); }
.rr-table td { vertical-align: top; }
@media (max-width: 640px) {
    .rr-filters .field { flex: 1 1 calc(50% - var(--space-3)); min-width: 0; }
    .rr-search { flex-basis: 100%; }
}
.rr-cards { display: none; flex-direction: column; gap: var(--space-2); }
.rr-card { padding: var(--space-3); border-radius: var(--radius-lg); background: var(--bg-surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.rr-card-top { display: flex; justify-content: space-between; gap: var(--space-2); overflow-wrap: anywhere; }
.rr-card-meta { display: flex; flex-wrap: wrap; gap: 4px var(--space-2); align-items: center; font-size: var(--text-sm); }
@media (max-width: 700px) {
    .rr-cards { display: flex; }
    .rr-table-wrap { display: none; }
}
