/* ==========================================================================
   WooCommerce Price Updater — shadcn/ui inspired design system
   Plain CSS port of shadcn's token system (no build step required).
   ========================================================================== */

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

/* --------------------------------------------------------------------------
   Design tokens (shadcn "default" theme, HSL channels)
   -------------------------------------------------------------------------- */
:root {
    --background: 0 0% 100%;
    --foreground: 240 10% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 240 10% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 240 10% 3.9%;
    --primary: 240 5.9% 10%;
    --primary-foreground: 0 0% 98%;
    --secondary: 240 4.8% 95.9%;
    --secondary-foreground: 240 5.9% 10%;
    --muted: 240 4.8% 95.9%;
    --muted-foreground: 240 3.8% 46.1%;
    --accent: 240 4.8% 95.9%;
    --accent-foreground: 240 5.9% 10%;
    --destructive: 0 72% 51%;
    --destructive-foreground: 0 0% 98%;
    --success: 142 71% 45%;
    --success-foreground: 0 0% 98%;
    --warning: 38 92% 50%;
    --border: 240 5.9% 90%;
    --input: 240 5.9% 90%;
    --ring: 240 5.9% 10%;
    --radius: 0.65rem;

    /* Brand surface — always dark so the white/rainbow logo stays legible */
    --brand: 240 10% 5%;
    --brand-foreground: 0 0% 98%;

    color-scheme: light;
}

:root.dark,
:root[data-theme="dark"] {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 5.5%;
    --card-foreground: 0 0% 98%;
    --popover: 240 10% 5.5%;
    --popover-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 240 5.9% 10%;
    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 45%;
    --destructive-foreground: 0 0% 98%;
    --success: 142 65% 47%;
    --warning: 38 92% 55%;
    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 18%;
    --ring: 240 4.9% 83.9%;

    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --background: 240 10% 3.9%;
        --foreground: 0 0% 98%;
        --card: 240 10% 5.5%;
        --card-foreground: 0 0% 98%;
        --popover: 240 10% 5.5%;
        --popover-foreground: 0 0% 98%;
        --primary: 0 0% 98%;
        --primary-foreground: 240 5.9% 10%;
        --secondary: 240 3.7% 15.9%;
        --secondary-foreground: 0 0% 98%;
        --muted: 240 3.7% 15.9%;
        --muted-foreground: 240 5% 64.9%;
        --accent: 240 3.7% 15.9%;
        --accent-foreground: 0 0% 98%;
        --destructive: 0 62.8% 45%;
        --destructive-foreground: 0 0% 98%;
        --success: 142 65% 47%;
        --warning: 38 92% 55%;
        --border: 240 3.7% 15.9%;
        --input: 240 3.7% 18%;
        --ring: 240 4.9% 83.9%;

        color-scheme: dark;
    }
}

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

body {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

a {
    color: inherit;
}

/* --------------------------------------------------------------------------
   Brand top bar (dark in both themes — carries the logo)
   -------------------------------------------------------------------------- */
.appbar {
    background: hsl(var(--brand));
    color: hsl(var(--brand-foreground));
    border-bottom: 1px solid hsl(0 0% 100% / 0.08);
    position: sticky;
    top: 0;
    z-index: 30;
}

.appbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 68px;
}

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

.brand-logo {
    height: 34px;
    width: auto;
    display: block;
}

.brand-divider {
    width: 1px;
    height: 26px;
    background: hsl(0 0% 100% / 0.15);
}

.brand-title {
    font-size: 14px;
    font-weight: 500;
    color: hsl(0 0% 100% / 0.72);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.appbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.appbar-user {
    font-size: 13px;
    color: hsl(0 0% 100% / 0.62);
    white-space: nowrap;
}

.appbar-user strong {
    color: hsl(0 0% 100% / 0.95);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.16s ease, color 0.16s ease,
        border-color 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
    user-select: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: hsl(var(--primary) / 0.9);
}

.btn-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover:not(:disabled) {
    background: hsl(var(--secondary) / 0.7);
}

.btn-outline {
    background: transparent;
    border-color: hsl(var(--border));
    color: hsl(var(--foreground));
}

.btn-outline:hover:not(:disabled) {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-destructive {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

.btn-destructive:hover:not(:disabled) {
    background: hsl(var(--destructive) / 0.9);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
}

/* Ghost icon button (used in the dark appbar) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: calc(var(--radius) - 2px);
    background: hsl(0 0% 100% / 0.06);
    border: 1px solid hsl(0 0% 100% / 0.1);
    color: hsl(0 0% 100% / 0.9);
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease;
}

.btn-icon:hover {
    background: hsl(0 0% 100% / 0.12);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-icon .icon-sun {
    display: none;
}

:root.dark .btn-icon .icon-sun,
:root[data-theme="dark"] .btn-icon .icon-sun {
    display: block;
}

:root.dark .btn-icon .icon-moon,
:root[data-theme="dark"] .btn-icon .icon-moon {
    display: none;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 1px 2px 0 hsl(240 10% 3.9% / 0.04);
}

.card-header {
    padding: 22px 24px 0;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-desc {
    margin-top: 4px;
    font-size: 13px;
    color: hsl(var(--muted-foreground));
}

.card-body {
    padding: 22px 24px;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 16px;
}

.label {
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    color: hsl(var(--foreground));
}

.input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    font-family: inherit;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius) - 2px);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input::placeholder {
    color: hsl(var(--muted-foreground));
}

.input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}

.input-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: calc(var(--radius) - 2px);
    font-size: 14px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    margin-bottom: 16px;
}

.alert-error {
    border-color: hsl(var(--destructive) / 0.5);
    background: hsl(var(--destructive) / 0.08);
    color: hsl(var(--destructive));
}

.alert-success {
    border-color: hsl(var(--success) / 0.5);
    background: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
}

.alert-warning {
    border-color: hsl(var(--warning) / 0.5);
    background: hsl(var(--warning) / 0.1);
    color: hsl(var(--warning));
}

/* --------------------------------------------------------------------------
   Login screen
   -------------------------------------------------------------------------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(
            120% 120% at 50% 0%,
            hsl(var(--muted)) 0%,
            hsl(var(--background)) 60%
        );
}

.auth-card {
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.auth-brand {
    background: hsl(var(--brand));
    padding: 28px 24px;
    text-align: center;
}

.auth-brand img {
    height: 40px;
    width: auto;
}

.auth-brand p {
    margin-top: 12px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: hsl(0 0% 100% / 0.55);
}

.auth-body {
    padding: 28px 26px 26px;
}

.auth-body h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.auth-body .sub {
    margin: 4px 0 22px;
    font-size: 13px;
    color: hsl(var(--muted-foreground));
}

.auth-hint {
    margin-top: 22px;
    text-align: center;
    font-size: 12px;
    color: hsl(var(--muted-foreground));
}

/* --------------------------------------------------------------------------
   Page + search
   -------------------------------------------------------------------------- */
main {
    padding: 32px 0 64px;
}

.page-head {
    margin-bottom: 22px;
}

.page-head h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-head p {
    margin-top: 4px;
    font-size: 14px;
    color: hsl(var(--muted-foreground));
}

.search-card {
    margin-bottom: 24px;
}

.search-box {
    display: flex;
    gap: 10px;
}

.search-box .input {
    flex: 1;
}

/* Results meta row */
.results-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 2px;
}

.results-meta .count {
    font-size: 13px;
    color: hsl(var(--muted-foreground));
}

/* --------------------------------------------------------------------------
   Product list (shadcn table/card hybrid)
   -------------------------------------------------------------------------- */
.products {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 104px 320px auto;
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.product:hover {
    border-color: hsl(var(--ring) / 0.35);
    box-shadow: 0 2px 10px -4px hsl(240 10% 3.9% / 0.12);
}

.product-thumb {
    width: 56px;
    height: 56px;
    border-radius: calc(var(--radius) - 2px);
    overflow: hidden;
    background: hsl(var(--muted));
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--muted-foreground));
    flex-shrink: 0;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-thumb svg {
    width: 22px;
    height: 22px;
}

.product-meta {
    min-width: 0;
}

.product-meta h3 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 12px;
    color: hsl(var(--muted-foreground));
}

.product-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: hsl(var(--muted-foreground));
    transition: color 0.16s ease;
}

.product-link:hover {
    color: hsl(var(--foreground));
}

.product-link svg {
    width: 12px;
    height: 12px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 999px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.badge-mono {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
}

.badge-sale {
    border-color: hsl(var(--success) / 0.4);
    background: hsl(var(--success) / 0.12);
    color: hsl(var(--success));
}

.badge-stock {
    border-color: hsl(var(--success) / 0.4);
    background: hsl(var(--success) / 0.12);
    color: hsl(var(--success));
}

.badge-out {
    border-color: hsl(var(--destructive) / 0.45);
    background: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
}

/* Current price column */
.price-current {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.price-current .cap {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: hsl(var(--muted-foreground));
    margin-bottom: 3px;
}

.price-current .mrp {
    font-size: 13px;
    color: hsl(var(--muted-foreground));
    text-decoration: line-through;
}

.price-current .sell {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Editable price fields */
.price-edit {
    display: grid;
    grid-template-columns: 0.8fr 1fr 1fr;
    gap: 10px;
}

/* Stock field gets a subtle separator from the price fields */
.field-stock {
    position: relative;
    padding-right: 10px;
}

.field-stock::after {
    content: "";
    position: absolute;
    right: 0;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: hsl(var(--border));
}

.price-edit .field {
    margin-bottom: 0;
    gap: 5px;
}

.price-edit .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: hsl(var(--muted-foreground));
}

.price-edit .input {
    height: 38px;
}

.input-affix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-affix .prefix {
    position: absolute;
    left: 11px;
    font-size: 13px;
    color: hsl(var(--muted-foreground));
    pointer-events: none;
}

.input-affix .input {
    padding-left: 24px;
}

/* Update action */
.product-action {
    display: flex;
    justify-content: flex-end;
}

.update-btn.is-success {
    background: hsl(var(--success));
    color: hsl(var(--success-foreground));
}

.update-btn.is-error {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

/* --------------------------------------------------------------------------
   Empty / loading states
   -------------------------------------------------------------------------- */
.state {
    text-align: center;
    padding: 56px 20px;
    color: hsl(var(--muted-foreground));
}

.state svg {
    width: 40px;
    height: 40px;
    margin-bottom: 14px;
    opacity: 0.5;
}

.state h3 {
    font-size: 15px;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 4px;
}

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

/* Spinner */
.spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: -2px;
}

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

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast-wrap {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 60;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 380px;
    padding: 13px 15px;
    font-size: 14px;
    background: hsl(var(--popover));
    color: hsl(var(--popover-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
    box-shadow: 0 10px 30px -10px hsl(240 10% 3.9% / 0.35);
    animation: toast-in 0.2s ease;
}

.toast.leaving {
    animation: toast-out 0.2s ease forwards;
}

.toast svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-success svg {
    color: hsl(var(--success));
}

.toast-error svg {
    color: hsl(var(--destructive));
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .product {
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 14px;
    }

    .product-thumb {
        width: 48px;
        height: 48px;
        grid-row: 1 / 2;
    }

    .product-meta {
        grid-column: 2;
    }

    .price-current {
        grid-column: 1 / -1;
        display: flex;
        align-items: baseline;
        justify-content: flex-start;
        gap: 10px;
        text-align: left;
        padding-top: 4px;
        border-top: 1px dashed hsl(var(--border));
    }

    .price-current .cap {
        margin: 0;
    }

    .price-edit {
        grid-column: 1 / -1;
    }

    .product-action {
        grid-column: 1 / -1;
    }

    .product-action .btn {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .container {
        padding: 0 16px;
    }

    .brand-title,
    .appbar-user {
        display: none;
    }

    .search-box {
        flex-direction: column;
    }

    .toast-wrap {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .toast {
        min-width: 0;
        max-width: none;
    }
}

/* ==========================================================================
   VARIABLE PRODUCTS & VARIATIONS
   ========================================================================== */

.badge-variable {
    border-color: hsl(262 83% 58% / 0.4);
    background: hsl(262 83% 58% / 0.12);
    color: hsl(262 83% 62%);
}

/* Variable parent: the "Show variations" button spans the edit + action area */
.product--variable .variations-toggle {
    grid-column: 4 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Variations panel sits directly under its parent product */
.variations-panel {
    margin: -6px 0 4px;
    padding: 4px 0 6px 40px;
    border-left: 2px solid hsl(var(--border));
    margin-left: 26px;
}

.variations {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.variation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 104px 320px auto;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    background: hsl(var(--muted) / 0.4);
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
}

.variation-meta {
    min-width: 0;
}

.variation-name {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.variation-empty {
    padding: 16px;
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-size: 14px;
}

@media (max-width: 860px) {
    .product--variable .variations-toggle {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .product--variable .variations-btn {
        width: 100%;
    }

    .variations-panel {
        padding-left: 12px;
        margin-left: 12px;
    }

    .variation {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .variation .price-current {
        grid-column: 1 / -1;
        display: flex;
        align-items: baseline;
        gap: 10px;
        text-align: left;
        padding-top: 4px;
        border-top: 1px dashed hsl(var(--border));
    }

    .variation .price-current .cap {
        margin: 0;
    }

    .variation .price-edit {
        grid-column: 1 / -1;
    }

    .variation .product-action {
        grid-column: 1 / -1;
    }

    .variation .product-action .btn {
        width: 100%;
    }
}

/* ==========================================================================
   VIEW TABS + BULK SHEET
   ========================================================================== */

.view-tabs {
    display: inline-flex;
    gap: 4px;
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 1px);
    padding: 4px;
    margin-bottom: 20px;
}

.view-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: hsl(var(--muted-foreground));
    background: transparent;
    border: none;
    border-radius: calc(var(--radius) - 4px);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.view-tab:hover {
    color: hsl(var(--foreground));
}

.view-tab.is-active {
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    box-shadow: 0 1px 2px hsl(240 10% 3.9% / 0.1);
}

/* Sticky toolbar with the Save button */
.sheet-toolbar {
    position: sticky;
    top: 68px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius) var(--radius) 0 0;
}

.sheet-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.sheet-status {
    font-size: 13px;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
}

/* Scrollable grid with a sticky header row */
.sheet-wrap {
    max-height: calc(100vh - 250px);
    overflow: auto;
    border: 1px solid hsl(var(--border));
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    background: hsl(var(--card));
}

table.sheet {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.sheet thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: hsl(var(--muted));
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: hsl(var(--muted-foreground));
    padding: 10px 10px;
    border-bottom: 1px solid hsl(var(--border));
    white-space: nowrap;
}

.sh-col-num { text-align: right; }
.sh-col-img { width: 44px; }
.sh-col-sku { width: 160px; }
.sh-col-st { width: 34px; }

table.sheet td {
    padding: 6px 10px;
    border-bottom: 1px solid hsl(var(--border) / 0.6);
    vertical-align: middle;
}

table.sheet tbody tr:hover td {
    background: hsl(var(--muted) / 0.4);
}

.sh-img {
    width: 44px;
}

.sh-img img {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    object-fit: cover;
    background: hsl(var(--muted));
    display: block;
}

.sh-name {
    font-weight: 500;
    min-width: 220px;
    max-width: 420px;
}

.sh-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 999px;
    background: hsl(262 83% 58% / 0.12);
    color: hsl(262 83% 62%);
    border: 1px solid hsl(262 83% 58% / 0.35);
    vertical-align: middle;
}

.sh-sku {
    color: hsl(var(--muted-foreground));
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.sh-input {
    width: 100%;
    max-width: 120px;
    height: 32px;
    padding: 0 8px;
    text-align: right;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    font-family: inherit;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    border: 1px solid hsl(var(--input));
    border-radius: 6px;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.sh-input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}

/* Row edit + save states */
tr.is-dirty td {
    background: hsl(var(--warning) / 0.08);
}

tr.is-dirty .sh-input {
    border-color: hsl(var(--warning) / 0.6);
}

tr.is-saved td {
    background: hsl(var(--success) / 0.08);
}

tr.is-failed td {
    background: hsl(var(--destructive) / 0.08);
}

.sh-status {
    text-align: center;
    width: 34px;
}

.sh-ok { color: hsl(var(--success)); font-weight: 700; }
.sh-err { color: hsl(var(--destructive)); font-weight: 700; cursor: help; }

@media (max-width: 720px) {
    .sheet-toolbar {
        top: 60px;
    }
    .sheet-toolbar-left {
        flex: 1;
    }
    #sheet-filter {
        width: 100% !important;
    }
    .sh-col-sku, .sh-sku { display: none; }
    .sh-input { max-width: none; }
    .sheet-wrap {
        max-height: calc(100vh - 220px);
    }
}

/* ==========================================================================
   TITLE EDIT (rename) + DELETE BUTTON
   ========================================================================== */

.product-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.product-title h3 {
    min-width: 0;
}

.product-title.editing {
    gap: 6px;
}

.title-edit-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: hsl(var(--muted-foreground));
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.title-edit-btn:hover {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.title-input {
    flex: 1;
    height: 34px;
    min-width: 0;
    font-size: 14px;
}

/* Delete button (icon, destructive) */
.product-action {
    display: flex;
    gap: 8px;
    align-items: center;
}

.delete-btn {
    padding: 0;
    width: 42px;
    flex-shrink: 0;
}

.delete-btn svg {
    width: 15px;
    height: 15px;
}

/* Row removal animation on delete */
.product {
    transition: border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.3s ease, transform 0.3s ease;
}

.product.is-leaving {
    opacity: 0;
    transform: translateX(14px);
}

/* Desktop: variations toggle sits in its own column so the delete button gets column 5 */
@media (min-width: 861px) {
    .product--variable .variations-toggle {
        grid-column: 4;
        justify-content: flex-start;
    }
}
