:root {
    /* ---- Tonal surfaces (Material elevation via lightening) ---- */
    --bg: #0b0f15;
    --surface-1: #121821;
    --surface-2: #18202b;
    --surface-3: #1f2937;
    --surface-4: #273241;

    /* ---- Lines ---- */
    --outline: rgba(255, 255, 255, 0.10);
    --outline-soft: rgba(255, 255, 255, 0.06);
    --outline-strong: rgba(120, 170, 255, 0.30);

    /* ---- Primary (blue) — structural + neutral primary actions ---- */
    --primary: #4d9fff;
    --primary-hover: #6fb2ff;
    --primary-press: #3d8ae6;
    --on-primary: #04243f;
    --primary-container: rgba(77, 159, 255, 0.16);
    --primary-fg: #a9cdff;

    /* ---- Success (green) — create / save / "Yes" ---- */
    --success: #2ecc8f;
    --success-hover: #44dba1;
    --on-success: #052016;
    --success-container: rgba(46, 204, 143, 0.15);
    --success-fg: #7fe7c0;

    /* ---- Danger (red) — delete / remove / "No" ---- */
    --danger: #ff5b5b;
    --danger-hover: #ff7676;
    --on-danger: #2a0606;
    --danger-container: rgba(255, 91, 91, 0.14);
    --danger-fg: #ffb0b0;

    --warning: #f5c451;

    /* ---- Text ---- */
    --text: #e8eef7;
    --text-muted: #94a3b8;
    --text-faint: #64748b;

    /* ---- Geometry ---- */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;
    --nav-h: 60px;

    /* ---- Elevation (Material-ish) ---- */
    --elev-1: 0 1px 2px rgba(0, 0, 0, 0.45), 0 1px 3px 1px rgba(0, 0, 0, 0.22);
    --elev-2: 0 1px 2px rgba(0, 0, 0, 0.45), 0 3px 8px 2px rgba(0, 0, 0, 0.24);
    --elev-3: 0 4px 10px 3px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    scrollbar-color: var(--surface-4) transparent;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Roboto, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

code,
.mono {
    font-family: "Roboto Mono", "Cascadia Code", Consolas, monospace;
}

code {
    padding: 0.08em 0.35em;
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--primary-fg);
    font-size: 0.88em;
}

::selection {
    background: var(--primary-container);
    color: var(--text);
}

/* Scrollbars */
*::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

*::-webkit-scrollbar-thumb {
    background: var(--surface-4);
    border-radius: 999px;
    border: 3px solid var(--bg);
}

*::-webkit-scrollbar-thumb:hover {
    background: #324155;
}

/* Material Symbols sizing/alignment */
.material-symbols-rounded {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    font-size: 1.2em;
    line-height: 1;
    vertical-align: -0.18em;
    flex: none;
}

/* =========================================================================
   Top navigation (Bootstrap navbar shell, Material styling)
   ========================================================================= */
.app-navbar {
    min-height: var(--nav-h);
    padding: 0.4rem clamp(1rem, 3vw, 2rem);
    background: rgba(13, 19, 28, 0.85) !important;
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--outline-soft);
    box-shadow: var(--elev-1);
}

.app-navbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    font-size: 1.08rem;
    color: var(--text);
    padding: 0;
}

.brand-icon {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    color: var(--primary);
    background: var(--primary-container);
    box-shadow: inset 0 0 0 1px var(--outline-strong);
}

.app-navbar .navbar-toggler {
    border: 1px solid var(--outline);
    border-radius: 10px;
    color: var(--text-muted);
    padding: 0.3rem 0.5rem;
}

.app-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 3px var(--primary-container);
}

.nav-pill {
    display: inline-flex !important;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem !important;
    border-radius: var(--radius-pill);
    color: var(--text-muted) !important;
    font-weight: 600;
    font-size: 0.95rem;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}

.nav-pill:hover,
.nav-pill:focus-visible {
    color: var(--text) !important;
    background: var(--surface-3);
    outline: none;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* =========================================================================
   Page shell + hero
   ========================================================================= */
.page-shell {
    width: min(1720px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.75rem 0 4rem;
}

.hero {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.hero.compact {
    max-width: 720px;
}

.hero h1+.muted,
.hero .eyebrow+h1 {
    margin-top: 0.35rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.5rem;
    padding: 0.25rem 0.6rem 0.25rem 0.45rem;
    border-radius: var(--radius-pill);
    color: var(--primary-fg);
    background: var(--primary-container);
    text-transform: uppercase;
    letter-spacing: 0.10em;
    font-weight: 700;
    font-size: 0.72rem;
}

.eyebrow .material-symbols-rounded {
    font-size: 1rem;
}

h1,
h2 {
    margin: 0;
    line-height: 1.1;
    font-weight: 800;
}

h1 {
    font-size: clamp(1.9rem, 4.5vw, 3.1rem);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(1.15rem, 2vw, 1.4rem);
    letter-spacing: -0.01em;
}

.muted {
    color: var(--text-muted);
}

.small {
    font-size: 0.9rem;
}

.stats-card {
    min-width: 180px;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--outline-strong);
    background:
        linear-gradient(160deg, rgba(77, 159, 255, 0.14), rgba(77, 159, 255, 0.02));
    border-radius: var(--radius-lg);
    box-shadow: var(--elev-2);
}

.stats-card span {
    display: block;
    font-size: 2.6rem;
    font-weight: 900;
    line-height: 1;
    color: var(--text);
}

.stats-card small {
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* =========================================================================
   Flash messages (snackbar-style inline alerts)
   ========================================================================= */
.flash-stack {
    display: grid;
    gap: 0.7rem;
    margin-bottom: 1.25rem;
}

.flash {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid var(--outline);
    border-left-width: 3px;
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    background: var(--surface-2);
    box-shadow: var(--elev-1);
    font-size: 0.95rem;
}

.flash::before {
    font-family: "Material Symbols Rounded";
    font-size: 1.3rem;
    line-height: 1;
}

.flash-success {
    border-color: var(--success);
    background: var(--success-container);
    color: var(--success-fg);
}

.flash-success::before {
    content: "check_circle";
}

.flash-error {
    border-color: var(--danger);
    background: var(--danger-container);
    color: var(--danger-fg);
}

.flash-error::before {
    content: "error";
}

/* =========================================================================
   Panels / cards
   ========================================================================= */
.panel,
.filters-panel,
.table-wrap {
    border: 1px solid var(--outline-soft);
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    box-shadow: var(--elev-2);
}

.panel {
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.panel.narrow {
    max-width: 460px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.panel-heading h2+.muted {
    margin-top: 0.25rem;
}

/* =========================================================================
   Forms
   ========================================================================= */
.filters-panel,
.form-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 0.9rem;
}

.filters-panel {
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-grid {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.form-grid.one-column {
    grid-template-columns: 1fr;
}

label {
    display: grid;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.wide {
    grid-column: span 2;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--outline);
    border-radius: var(--radius);
    padding: 0.7rem 0.85rem;
    color: var(--text);
    background: var(--surface-2);
    outline: none;
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-faint);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--outline-strong);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: var(--surface-1);
    box-shadow: 0 0 0 3px var(--primary-container);
}

input:disabled,
input[readonly] {
    color: var(--text-faint);
    background: var(--surface-1);
    cursor: not-allowed;
}

textarea {
    resize: vertical;
    min-height: 3rem;
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(1.15rem),
        calc(100% - 13px) calc(1.15rem);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.2rem;
}

.filter-actions,
.form-actions {
    display: flex;
    align-items: end;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.hint {
    color: var(--text-faint);
    font-size: 0.78rem;
    line-height: 1.4;
}

/* =========================================================================
   Buttons — Material filled / tonal / text
   green = positive · red = negative · blue = neutral primary
   ========================================================================= */
button,
.small-button,
.primary-button,
.success-button,
.ghost-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: 0;
    border-radius: var(--radius);
    padding: 0.7rem 1.1rem;
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: background 130ms ease, box-shadow 130ms ease,
        transform 90ms ease, border-color 130ms ease;
}

button:active,
.small-button:active,
.primary-button:active,
.success-button:active,
.ghost-button:active,
.danger-button:active {
    transform: translateY(1px);
}

button:focus-visible,
.small-button:focus-visible,
.primary-button:focus-visible,
.success-button:focus-visible,
.ghost-button:focus-visible,
.danger-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-container);
}

.material-symbols-rounded {
    user-select: none;
}

/* filled blue — primary/neutral CTA (Login, Apply filters) */
.primary-button {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: var(--elev-1);
}

.primary-button:hover {
    background: var(--primary-hover);
    box-shadow: var(--elev-2);
}

.primary-button:focus-visible {
    box-shadow: var(--elev-1), 0 0 0 3px var(--primary-container);
}

/* filled green — positive: create / save */
.success-button {
    background: var(--success);
    color: var(--on-success);
    box-shadow: var(--elev-1);
}

.success-button:hover {
    background: var(--success-hover);
    box-shadow: var(--elev-2);
}

.success-button:focus-visible {
    box-shadow: var(--elev-1), 0 0 0 3px var(--success-container);
}

/* tonal red — negative: delete / remove */
.danger-button {
    background: var(--danger-container);
    color: var(--danger-fg);
    border: 1px solid rgba(255, 91, 91, 0.35);
    padding: 0.55rem 0.8rem;
}

.danger-button:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.danger-button:focus-visible {
    box-shadow: 0 0 0 3px var(--danger-container);
}

/* outlined/tonal neutral — Edit, Rescan, Cancel */
.ghost-button,
.small-button {
    background: var(--surface-3);
    color: var(--text);
    border: 1px solid var(--outline);
}

.ghost-button:hover,
.small-button:hover {
    background: var(--surface-4);
    border-color: var(--outline-strong);
}

.small-button {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
}

/* a small positive button (Save dropdown choice) */
.success-button.small,
.save-button {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    background: var(--success-container);
    color: var(--success-fg);
    border: 1px solid rgba(46, 204, 143, 0.35);
}

.save-button:hover {
    background: var(--success);
    color: var(--on-success);
    border-color: var(--success);
}

.save-button:focus-visible {
    box-shadow: 0 0 0 3px var(--success-container);
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
}

/* =========================================================================
   Products table
   ========================================================================= */
.table-wrap {
    overflow: auto;
}

.products-table {
    width: 100%;
    min-width: 1250px;
    border-collapse: collapse;
}

.products-table th,
.products-table td {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--outline-soft);
    vertical-align: top;
}

.products-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    background: var(--surface-3);
    white-space: nowrap;
}

.products-table thead th:first-child {
    border-top-left-radius: var(--radius-lg);
}

.products-table thead th:last-child {
    border-top-right-radius: var(--radius-lg);
}

.products-table tbody tr {
    transition: background 110ms ease;
}

.products-table tbody tr:hover {
    background: rgba(77, 159, 255, 0.06);
}

.products-table tbody tr:last-child td {
    border-bottom: 0;
}

.numeric {
    text-align: right;
    white-space: nowrap;
}

.strong {
    font-weight: 700;
}

/* Chips */
.pill,
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 1.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
}

.pill {
    color: var(--primary-fg);
    background: var(--primary-container);
    box-shadow: inset 0 0 0 1px var(--outline-strong);
}

.status::before {
    font-family: "Material Symbols Rounded";
    font-size: 1.05rem;
}

.status-yes {
    color: var(--success-fg);
    background: var(--success-container);
    box-shadow: inset 0 0 0 1px rgba(46, 204, 143, 0.35);
}

.status-yes::before {
    content: "check_circle";
}

.status-no {
    color: var(--danger-fg);
    background: var(--danger-container);
    box-shadow: inset 0 0 0 1px rgba(255, 91, 91, 0.35);
}

.status-no::before {
    content: "cancel";
}

.comment-cell {
    min-width: 260px;
    color: var(--text-muted);
}

.actions-cell {
    min-width: 150px;
}

.actions-cell,
.actions-cell form {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2.5rem 1rem !important;
}

/* Copy-to-clipboard cells */
.copy-cell {
    position: relative;
    cursor: copy;
    border-radius: 8px;
    transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.copy-cell:hover,
.copy-cell:focus-visible {
    color: var(--text);
    background: var(--primary-container);
    box-shadow: inset 0 0 0 1px var(--outline-strong);
    outline: none;
}

/* Snackbar toast (copy confirmation) */
.copy-toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translate(-50%, 0.6rem);
    z-index: 100;
    max-width: min(420px, calc(100vw - 2rem));
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.85rem 1.2rem;
    border: 1px solid var(--outline);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--surface-4);
    box-shadow: var(--elev-3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
    font-size: 0.95rem;
}

.copy-toast::before {
    content: "content_copy";
    font-family: "Material Symbols Rounded";
    font-size: 1.2rem;
    color: var(--primary);
}

.copy-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* =========================================================================
   Dropdown-choices manager
   ========================================================================= */
.option-add-form {
    display: grid;
    grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 2fr) auto;
    gap: 0.9rem;
    align-items: end;
    margin-bottom: 1.25rem;
}

.choice-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 1rem;
}

.choice-card {
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius);
    background: var(--surface-2);
    padding: 1rem;
}

.choice-card h3 {
    margin: 0 0 0.85rem;
    font-size: 0.95rem;
    color: var(--primary-fg);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.choice-list {
    display: grid;
    gap: 0.6rem;
}

.choice-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    align-items: center;
}

.choice-edit-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
}

/* =========================================================================
   Material ripple (added by app.js)
   ========================================================================= */
.ripple-host {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    background: currentColor;
    opacity: 0.28;
    pointer-events: none;
    animation: ripple 520ms ease-out forwards;
}

@keyframes ripple {
    to {
        transform: scale(2.4);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1100px) {

    .filters-panel,
    .form-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {

    .hero,
    .panel-heading {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-panel,
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .option-add-form,
    .choice-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {

    .filters-panel,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .wide {
        grid-column: span 1;
    }

    .choice-row,
    .choice-edit-form {
        grid-template-columns: 1fr;
    }
}
/* =========================================================================
   Admin accounts + audit log
   ========================================================================= */
.nav-user {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-pill);
    color: var(--success-fg);
    background: var(--success-container);
    font-size: 0.9rem;
    font-weight: 700;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--outline-soft);
    vertical-align: top;
}

.admin-table th {
    color: var(--text-muted);
    background: var(--surface-3);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

.admin-table tr:last-child td {
    border-bottom: 0;
}

.audit-details {
    max-width: 520px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-muted);
}

.check-row input[type="checkbox"] {
    width: auto;
}

.account-card {
    display: grid;
    gap: 0.75rem;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* =========================================================================
   v2 admin/audit refinements
   ========================================================================= */
.meta-cell {
    min-width: 170px;
    color: var(--text-muted);
}

.role-help {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}

.role-card {
    display: grid;
    gap: 0.25rem;
    padding: 0.8rem;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.role-card strong {
    color: var(--primary-fg);
}

.role-card span {
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.35;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    grid-auto-flow: column;
    justify-content: start;
    gap: 0.45rem;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
}

.audit-filters {
    display: block;
}

.audit-filter-grid {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) repeat(6, minmax(140px, 1fr)) auto;
    gap: 0.9rem;
    align-items: end;
}

.audit-table .audit-details {
    min-width: 420px;
}

.audit-details details {
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 0.45rem 0.6rem;
}

.audit-details summary {
    cursor: pointer;
    color: var(--primary-fg);
    font-weight: 700;
}

.change-list {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.55rem;
}

.change-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(100px, 1fr) auto minmax(100px, 1fr);
    gap: 0.55rem;
    align-items: center;
    padding: 0.45rem;
    border-radius: var(--radius-sm);
    background: var(--surface-1);
}

.change-row strong {
    color: var(--text);
}

.change-before {
    color: var(--danger-fg);
    overflow-wrap: anywhere;
}

.change-after {
    color: var(--success-fg);
    overflow-wrap: anywhere;
}

.change-row .material-symbols-rounded {
    color: var(--text-faint);
    font-size: 1rem;
}

@media (max-width: 1300px) {
    .audit-filter-grid,
    .role-help {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .audit-filter-grid,
    .role-help,
    .change-row {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   Product table readability upgrade — ribbons, zebra rows, visual chips
   ========================================================================= */
.products-table tbody tr.product-row {
    --type-color: var(--primary);
    --subtype-color: #a78bfa;
    --manufacturer-color: var(--text-muted);
}

.products-table tbody tr.product-row > td {
    transition: background 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.products-table tbody tr.product-row:nth-child(even) > td {
    background-color: rgba(255, 255, 255, 0.025);
}

.products-table tbody tr.product-row > td:first-child {
    padding-left: 1.15rem;
    box-shadow: inset 0.38rem 0 0 var(--type-color);
}

.products-table tbody tr.product-row > td:nth-child(2) {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

@supports (color: color-mix(in srgb, white, black)) {
    .products-table tbody tr.product-row > td:first-child,
    .products-table tbody tr.product-row > td:nth-child(2),
    .products-table tbody tr.product-row > td:nth-child(3),
    .products-table tbody tr.product-row > td:nth-child(4),
    .products-table tbody tr.product-row > td:nth-child(5) {
        background-image: linear-gradient(
            90deg,
            color-mix(in srgb, var(--type-color) 12%, transparent),
            transparent 18rem
        );
    }
}

.products-table tbody tr.product-row:hover > td {
    background-color: rgba(77, 159, 255, 0.075);
}

.products-table tbody tr.product-row:hover > td:first-child {
    box-shadow: inset 0.55rem 0 0 var(--type-color);
}

.products-table tbody tr.product-row.is-inactive > td {
    opacity: 0.72;
}

.products-table tbody tr.product-row.is-inactive:hover > td {
    opacity: 1;
}

.visual-pill,
.maker-pill {
    --chip-color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.75rem;
    padding: 0.22rem 0.62rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(77, 159, 255, 0.14);
    color: var(--text);
}

@supports (color: color-mix(in srgb, white, black)) {
    .visual-pill,
    .maker-pill {
        color: color-mix(in srgb, var(--chip-color) 36%, white);
        background: color-mix(in srgb, var(--chip-color) 18%, transparent);
        border-color: color-mix(in srgb, var(--chip-color) 42%, transparent);
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chip-color) 18%, transparent);
    }
}

.visual-pill .material-symbols-rounded,
.maker-pill .material-symbols-rounded {
    font-size: 1rem;
    color: currentColor;
}

.type-pill {
    font-size: 0.82rem;
}

.subtype-pill {
    opacity: 0.92;
}

.maker-pill {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.10);
    font-weight: 700;
}

/* A little more breathing room makes dense inventory lists easier to scan. */
.products-table tbody td {
    line-height: 1.45;
}

/* Dropdown option visual editor */
.option-add-form {
    grid-template-columns: minmax(160px, 0.65fr) minmax(240px, 1.4fr) minmax(90px, 0.35fr) minmax(190px, 0.75fr) auto;
}

.choice-edit-form {
    grid-template-columns: minmax(160px, 1fr) 3.4rem minmax(120px, 0.6fr) auto;
}

.choice-edit-form input[type="color"],
.option-add-form input[type="color"] {
    min-height: 2.75rem;
    padding: 0.3rem;
    cursor: pointer;
}

@media (max-width: 1100px) {
    .option-add-form,
    .choice-edit-form {
        grid-template-columns: 1fr;
    }
}

.table-legend {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin: -0.25rem 0 1.25rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-lg);
    background: rgba(18, 24, 33, 0.72);
}

.legend-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.legend-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

/* =========================================================================
   v3 technical inventory upgrade — smart form sections + spec chips
   ========================================================================= */
.form-section {
    grid-column: 1 / -1;
    margin: 0;
    padding: 1rem;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.018);
}

.form-section legend {
    float: none;
    width: auto;
    margin: 0 0 0.85rem;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-pill);
    color: var(--primary-fg);
    background: var(--primary-container);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 0.9rem;
}

.smart-spec-note {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(77, 159, 255, 0.25);
    border-radius: var(--radius-lg);
    color: var(--primary-fg);
    background: linear-gradient(135deg, rgba(77, 159, 255, 0.16), rgba(167, 139, 250, 0.08));
}

.smart-spec-note .material-symbols-rounded {
    color: var(--primary);
    font-size: 1.35rem;
}

.smart-spec-note span:not(.material-symbols-rounded) {
    display: block;
    color: var(--text-muted);
    margin-top: 0.15rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.product-form label[data-spec-profiles] {
    transition: opacity 150ms ease, filter 150ms ease;
}

.product-form label.is-spec-muted {
    opacity: 0.52;
    filter: grayscale(0.35);
}

.product-form label.is-spec-muted:focus-within,
.product-form label.is-spec-muted:hover {
    opacity: 1;
    filter: none;
}

.spec-cell {
    min-width: 250px;
}

.spec-chip-wrap,
.inventory-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.inventory-stack {
    min-width: 150px;
    flex-direction: column;
    align-items: flex-start;
}

.spec-chip,
.stock-badge {
    --chip-color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    min-height: 1.55rem;
    padding: 0.18rem 0.52rem;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.18);
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

@supports (color: color-mix(in srgb, white, black)) {
    .spec-chip {
        color: color-mix(in srgb, var(--chip-color) 34%, white);
        background: color-mix(in srgb, var(--chip-color) 14%, transparent);
        border-color: color-mix(in srgb, var(--chip-color) 34%, transparent);
    }
}

.spec-chip .material-symbols-rounded,
.stock-badge .material-symbols-rounded {
    font-size: 0.96rem;
}

.stock-badge small {
    opacity: 0.82;
    font-size: 0.72rem;
    font-weight: 700;
}

.stock-ok {
    color: var(--success-fg);
    background: var(--success-container);
    border-color: rgba(46, 204, 143, 0.35);
}

.stock-low {
    color: #ffe7a3;
    background: rgba(245, 196, 81, 0.14);
    border-color: rgba(245, 196, 81, 0.38);
}

.stock-out {
    color: var(--danger-fg);
    background: var(--danger-container);
    border-color: rgba(255, 91, 91, 0.38);
}

.products-table tbody tr.product-row.is-low-stock > td:first-child {
    box-shadow: inset 0.38rem 0 0 var(--warning);
}

.products-table tbody tr.product-row.is-out-of-stock > td:first-child {
    box-shadow: inset 0.38rem 0 0 var(--danger);
}

@media (max-width: 1100px) {
    .section-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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