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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #f0f2f5;
    color: #1a1a1a;
}

.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ── Top bar ─────────────────────────────── */
.page-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}
.page-bar h1 {
    font-size: 22px;
    font-weight: 700;
}
.product-count {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #16a34a;
    padding: 3px 12px;
    border-radius: 999px;
}
.product-count:empty { display: none; }

/* ── Grid ─────────────────────────────────── */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* ── Product card ─────────────────────────── */
.product-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s;
}
.product-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

.product-card-img-wrap {
    width: 100%;
    aspect-ratio: 1;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.product-card-img-wrap img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}
.product-card-img-wrap .no-img {
    font-size: 48px;
    color: #ccc;
}

.product-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.product-card-pills {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.product-card-pill {
    width: 100%;
    border: 0;
    background: #f8fafc;
    border-radius: 999px;
    padding: 9px 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
    font: inherit;
}

.product-card-pill-icon {
    flex: 0 0 auto;
    font-size: 13px;
    line-height: 1.3;
}

.product-card-pill-text {
    min-width: 0;
    flex: 1;
    word-break: break-word;
}

.product-card-desc {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: #0f172a;
}

.product-card-barcode {
    font-size: 12px;
    color: #6b7280;
    font-family: 'Menlo', 'Consolas', monospace;
    margin-top: auto;
}

.product-card-deposit {
    font-size: 12px;
    font-weight: 700;
    color: #166534;
    background: #dcfce7;
}

.product-card-copyable {
    cursor: copy;
    transition: background-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.product-card-copyable:hover,
.product-card-copyable:focus-visible {
    background: #ecfdf5;
    box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .24);
    outline: none;
}

.product-card-copyable:active {
    transform: translateY(1px);
}

.copy-toast {
    position: fixed;
    right: 18px;
    top: 18px;
    z-index: 9500;
    background: #111827;
    color: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .22);
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: none;
}

.copy-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.copy-toast.is-error {
    background: #b91c1c;
}

/* ── Loading ─────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 9000;
}
.loading-overlay[hidden] { display: none; }

.spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #e5e7eb;
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    font-size: 14px;
    color: #6b7280;
}
