/*
 * INVENTORY HEATMAP — WORLD-CLASS VISUAL LAYER
 * Design Philosophy: Apple-caliber structural glass, maximum signal, zero noise
 * Glass is used to CREATE HIERARCHY, not decorate.
 *
 * Hierarchy Model:
 *   - Base layer: Deep ambient void (the stage)
 *   - Resting rows: Solid, quiet surfaces (content at rest)
 *   - Expanded row: GLASS — elevated, authoritative, commands focus
 *   - Summary cards: Solid panels (static content, no glass needed)
 */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
    /* — AMBIENT VOID — */
    /* Not flat black. A deep, dimensional space that recedes. */
    --void: #09090b;
    --void-elevated: #111113;
    --void-gradient: radial-gradient(ellipse 120% 100% at 50% -20%, #18181b 0%, #09090b 70%);

    /* — SURFACES — */
    /* Solid materials for content at rest. Confident, not decorative. */
    --surface-resting: rgba(24, 24, 27, 0.95);
    --surface-hover: rgba(32, 32, 36, 0.95);
    --surface-active: rgba(20, 20, 22, 0.98);

    /* — GLASS MATERIAL — */
    /* Reserved for ELEVATED states only. Structural, not stylistic. */
    --glass-bg: rgba(28, 28, 32, 0.72);
    --glass-blur: 24px;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-glow: 0 0 0 1px rgba(255, 255, 255, 0.06),
                  0 24px 48px -12px rgba(0, 0, 0, 0.5),
                  0 12px 24px -8px rgba(0, 0, 0, 0.3);

    /* — BORDERS — */
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-default: rgba(255, 255, 255, 0.06);
    --border-emphasis: rgba(255, 255, 255, 0.1);

    /* — TYPOGRAPHY — */
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

    --text-primary: rgba(255, 255, 255, 0.92);
    --text-secondary: rgba(255, 255, 255, 0.56);
    --text-tertiary: rgba(255, 255, 255, 0.32);

    /* — SIGNAL COLORS — */
    /* Refined, not garish. Communicate state without screaming. */
    --signal-healthy: #34d399;
    --signal-caution: #fbbf24;
    --signal-critical: #f87171;
    --signal-neutral: rgba(255, 255, 255, 0.4);

    /* — ACCENT — */
    --accent: #60a5fa;
    --accent-muted: rgba(96, 165, 250, 0.15);

    /* — DIMENSIONS — */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* — MOTION — */
    /* Subtle, supportive. Never calls attention to itself. */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
}


/* ============================================================
   FOUNDATION
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--void);
    background-image: var(--void-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}


/* ============================================================
   LAYOUT
   ============================================================ */
header {
    max-width: 1120px;
    margin: 0 auto;
    padding: 48px 32px 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.header-left {
    flex: 1;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.subtitle {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

/* — GLOBAL SEARCH — */
.global-search {
    position: relative;
    width: 260px;
    flex-shrink: 0;
}

.global-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
    z-index: 1;
}

.global-search-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--duration-fast) var(--ease-out);
}

.global-search-input::placeholder {
    color: var(--text-tertiary);
}

.global-search-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-emphasis);
}

.global-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface-resting);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.global-search-results.active {
    display: block;
}

.global-search-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--duration-fast);
    border-bottom: 1px solid var(--border-subtle);
}

.global-search-result:last-child {
    border-bottom: none;
}

.global-search-result:hover {
    background: rgba(255, 255, 255, 0.04);
}

.global-search-result-info {
    flex: 1;
    min-width: 0;
}

.global-search-result-sku {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.global-search-result-model {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.global-search-result-bucket {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
    margin-left: 12px;
}

.global-search-no-results {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
}

main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 32px 64px;
}


/* ============================================================
   LOADING STATE
   ============================================================ */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 32px;
    gap: 16px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-default);
    border-top-color: var(--text-secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 13px;
    color: var(--text-tertiary);
}


/* ============================================================
   HEATMAP — ACCORDION ROWS
   The core interface. Rows are SOLID at rest, GLASS when expanded.
   ============================================================ */
.heatmap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* — ACCORDION ROW (Resting State) — */
.accordion-row {
    position: relative;
    background: var(--surface-resting);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition:
        background var(--duration-normal) var(--ease-out),
        border-color var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out),
        transform var(--duration-normal) var(--ease-out);

    /* Entrance animation initial state */
    opacity: 0;
    transform: translateY(8px);
}

.accordion-row.visible {
    opacity: 1;
    transform: translateY(0);
}

.accordion-row:hover:not(.expanded) {
    background: var(--surface-hover);
    border-color: var(--border-default);
}

/* — EXPANDED STATE —
   THIS is where glass creates hierarchy.
   The expanded row lifts above the rest, commanding focus. */
.accordion-row.expanded {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
    border-color: var(--glass-border);
    box-shadow: var(--glass-glow);
    z-index: 10;
    transform: scale(1.008);
}


/* — ROW HEADER — */
.row-header {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.row-header:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: var(--radius-lg);
}

/* — HEALTH INDICATOR (LED Glow Effect) — */
.row-health {
    width: 4px;
    height: 24px;
    border-radius: 2px;
    flex-shrink: 0;
    /* LED glow: layered shadows create the luminous effect */
    box-shadow:
        0 0 4px currentColor,
        0 0 8px currentColor,
        0 0 16px currentColor,
        0 0 24px currentColor;
    /* Bright core with inner highlight */
    filter: brightness(1.1);
}

/* — BUCKET LABEL — */
.row-label {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    min-width: 72px;
}

/* — STATS GROUP — */
.row-stats {
    display: flex;
    gap: 24px;
    margin-left: auto;
    margin-right: 8px;
}

.row-stat {
    text-align: right;
    min-width: 56px;
}

.row-stat-value {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.row-stat-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* — VOLTAGE PILLS — */
.row-voltage {
    display: flex;
    gap: 6px;
    margin-right: 8px;
}

.voltage-pill {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.voltage-pill span {
    color: var(--text-primary);
}

.voltage-pill.low {
    background: rgba(251, 191, 36, 0.08);
    color: var(--signal-caution);
}

.voltage-pill.low span {
    color: var(--signal-caution);
}

.voltage-pill.high {
    background: rgba(96, 165, 250, 0.08);
    color: var(--accent);
}

.voltage-pill.high span {
    color: var(--accent);
}

/* — CHEVRON — */
.row-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    transition: transform var(--duration-normal) var(--ease-out);
}

.accordion-row.expanded .row-chevron {
    transform: rotate(180deg);
    color: var(--text-secondary);
}


/* ============================================================
   ROW CONTENT (Expanded Drawer)
   ============================================================ */
.row-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--duration-slow) var(--ease-out);
}

.accordion-row.expanded .row-content {
    max-height: 600px;
}

.row-content-inner {
    padding: 0 20px 20px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 0;
    padding-top: 16px;
}

/* — FILTER TOOLBAR — */
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 16px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.chip-group {
    display: flex;
    gap: 4px;
}

.chip {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    display: flex;
    align-items: center;
    gap: 5px;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.chip.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-emphasis);
    color: var(--text-primary);
}

.chip-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
}

.chip.active .chip-count {
    color: var(--text-secondary);
}

/* — SEARCH — */
.search-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 9px 36px 9px 36px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--duration-fast) var(--ease-out);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-emphasis);
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-tertiary);
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.search-clear.visible {
    opacity: 1;
}

.search-clear:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
}

.search-stats {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
}


/* ============================================================
   ITEM LIST
   ============================================================ */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 360px;
    overflow-y: auto;
    margin: 0 -8px;
    padding: 0 8px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast);
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.item-main {
    flex: 1;
    min-width: 0;
}

.item-primary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
}

.item-sku {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.item-sku.sku-red {
    color: var(--signal-critical);
}

.qty-pill {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    min-width: 24px;
    text-align: center;
}

.qty-pill.qp-ok {
    background: rgba(52, 211, 153, 0.12);
    color: var(--signal-healthy);
}

.qty-pill.qp-amb {
    background: rgba(251, 191, 36, 0.12);
    color: var(--signal-caution);
}

.qty-pill.qp-red {
    background: rgba(248, 113, 113, 0.12);
    color: var(--signal-critical);
}

.item-secondary {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-tags {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.item-tag {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 3px 6px;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-tertiary);
}

.item-tag.tag-low {
    background: rgba(251, 191, 36, 0.1);
    color: var(--signal-caution);
}

.item-tag.tag-high {
    background: rgba(96, 165, 250, 0.1);
    color: var(--accent);
}

.item-tag.tag-topo {
    background: rgba(168, 85, 247, 0.1);
    color: #c084fc;
}

.item-tag.tag-new {
    background: rgba(52, 211, 153, 0.1);
    color: var(--signal-healthy);
}

.item-tag.tag-refurb {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.item-tag.tag-combo {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

/* Search highlight */
.highlight {
    background: rgba(251, 191, 36, 0.25);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.empty-state {
    padding: 32px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}


/* ============================================================
   SUMMARY GRID
   Solid panels. Static content does not need glass.
   ============================================================ */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 48px;
}

.summary-card {
    background: var(--surface-resting);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;

    /* Entrance animation */
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity var(--duration-normal) var(--ease-out),
        transform var(--duration-normal) var(--ease-out);
}

.summary-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.summary-card h3 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 14px;
}

.mini-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.mini-list li span {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.mini-list li b {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}


/* ============================================================
   SCROLLBAR
   Minimal, unobtrusive.
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.16);
}


/* ============================================================
   SKU HUD — Data Card Overlay
   ============================================================ */

.sku-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 120ms ease;
}

.sku-overlay.active {
    display: flex;
    opacity: 1;
}

/* Card — physical glass slab */
.sku-hud-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 16px;
    background: #09090b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
    transform: scale(0.96) translateY(10px);
    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.sku-overlay.active .sku-hud-card {
    transform: scale(1) translateY(0);
}

/* Header */
.sku-hud-header {
    padding: 24px 24px 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sku-hud-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sku-hud-label {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.32);
    text-transform: uppercase;
}

.sku-hud-controls {
    display: flex;
    gap: 8px;
}

.sku-hud-icon-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.32);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 120ms;
    display: flex;
}

.sku-hud-icon-btn:hover {
    color: rgba(255, 255, 255, 0.56);
    border-color: rgba(255, 255, 255, 0.12);
}

#sku-popup-report:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* Identity typography */
.sku-hud-identity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.sku-hud-identity-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sku-hud-price {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    white-space: nowrap;
    flex-shrink: 0;
}

.sku-hud-price:empty {
    display: none;
}

.sku-hud-code {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    margin: 0;
    letter-spacing: -0.5px;
}

.sku-hud-status-pill {
    font-family: system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.sku-hud-status-pill:empty {
    display: none;
}

.sku-hud-status-pill.pill-red {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.2);
}

.sku-hud-status-pill.pill-amber {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.2);
}

.sku-hud-model-name {
    font-family: system-ui, sans-serif;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.56);
    line-height: 1.4;
}

/* Body & specs */
/* ── Product Image Gallery (horizontal scroll carousel) ── */
.sku-hud-gallery {
    padding: 0 20px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sku-gallery-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 16px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.sku-gallery-track::-webkit-scrollbar { height: 4px; }
.sku-gallery-track::-webkit-scrollbar-track { background: transparent; }
.sku-gallery-track::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
.sku-gallery-img {
    flex: 0 0 auto;
    height: 120px;
    width: auto;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    padding: 8px;
    scroll-snap-align: start;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}
.sku-gallery-img:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.08);
}

.sku-hud-body {
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
    flex: 1;
    overflow: hidden;
}

.sku-hud-scroller {
    max-height: 240px;
    overflow-y: auto;
    padding: 24px;
    overscroll-behavior: contain;
}

.sku-hud-scroller::-webkit-scrollbar { width: 4px; }
.sku-hud-scroller::-webkit-scrollbar-track { background: transparent; }
.sku-hud-scroller::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.07);
    border-radius: 2px;
}

/* Specs grid — 2-column */
.sku-hud-specs-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 14px;
    align-items: baseline;
}

.spec-label {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.32);
    white-space: nowrap;
}

.spec-value {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.56);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spec-components-label {
    grid-column: 1 / -1;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.32);
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.spec-component {
    grid-column: 1 / -1;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.56);
    padding-left: 8px;
    border-left: 2px solid rgba(255, 255, 255, 0.06);
}

/* Empty state */
.sku-hud-empty {
    text-align: center;
    padding: 32px 0;
}

.sku-hud-empty svg {
    margin-bottom: 8px;
}

.sku-hud-empty-text {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.32);
}

/* Action dock */
.sku-hud-actions {
    padding: 20px 24px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    background: #09090b;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sku-hud-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 12px;
    border-radius: 6px;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 120ms cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
}

.sku-hud-btn .btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Secondary — Quote (unlockable) */
.sku-hud-btn.secondary {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.56);
}

.sku-hud-btn.secondary:hover:not(:disabled) {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.03));
    border-color: rgba(245, 158, 11, 0.35);
    color: rgba(245, 158, 11, 0.92);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.08);
}

.sku-hud-btn.secondary:active:not(:disabled) {
    transform: scale(0.99);
}

.sku-hud-btn.secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
}

.btn-badge {
    font-size: 10px;
    font-weight: 700;
    font-family: system-ui, -apple-system, sans-serif;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.05em;
}

/* Primary — Ship */
.sku-hud-btn.primary {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
    border-color: rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.92);
}

.sku-hud-btn.primary:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.06);
}

.sku-hud-btn.primary:active {
    transform: scale(0.99);
}

.sku-hud-btn.primary .arrow-icon {
    transition: transform 120ms;
}

.sku-hud-btn.primary:hover .arrow-icon {
    transform: translateX(3px);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    header {
        padding: 32px 20px 24px;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    header h1 {
        font-size: 24px;
    }

    .global-search {
        width: 100%;
    }

    main {
        padding: 0 16px 48px;
    }

    .row-header {
        padding: 14px 16px;
        gap: 12px;
    }

    .row-stats {
        gap: 16px;
    }

    .row-stat {
        min-width: 48px;
    }

    .row-voltage {
        display: none;
    }

    .filter-toolbar {
        flex-direction: column;
        gap: 12px;
    }

    .search-wrapper {
        max-width: 100%;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .sku-hud-card {
        max-width: none;
        margin: 0 12px;
        max-height: 90vh;
    }

    .sku-hud-actions {
        grid-template-columns: 1fr 1fr 1fr;
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 480px) {
    .row-stats {
        gap: 12px;
    }

    .row-stat:last-child {
        display: none;
    }
}

/* ============================================================
   FEEDBACK WIDGET
   ============================================================ */

.feedback-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.8);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999;
}

.feedback-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.feedback-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.feedback-card {
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    font-family: system-ui, -apple-system, sans-serif;
}

.feedback-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.feedback-card-title {
    margin: 0;
    font-size: 16px;
    color: #fff;
    font-weight: 600;
}

.feedback-card-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: color 0.15s;
}

.feedback-card-close:hover {
    color: rgba(255, 255, 255, 0.7);
}

.feedback-textarea {
    width: 100%;
    height: 120px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    margin-bottom: 16px;
    transition: border-color 0.15s;
}

.feedback-textarea:focus {
    outline: none;
    border-color: rgba(248, 113, 113, 0.4);
}

.feedback-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.feedback-submit:hover {
    opacity: 0.9;
}

.feedback-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ============================================================
   COMBO GAPS MODAL
   Accent: amber (#f59e0b) — signals "attention needed"
   Mirrors compare-modal quality tier
   ============================================================ */
:root {
    --gaps-accent: #f59e0b;
    --gaps-accent-dim: rgba(245, 158, 11, 0.10);
    --gaps-accent-glow: rgba(245, 158, 11, 0.35);
    --gaps-accent-medium: rgba(245, 158, 11, 0.22);
    --gaps-accent-strong: rgba(245, 158, 11, 0.5);
}

/* Overlay */
.gaps-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
.gaps-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal card */
.gaps-modal {
    width: 94%;
    max-width: 720px;
    max-height: 85vh;
    background: rgba(14, 14, 18, 0.95);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: scale(0.95) translateY(10px);
    transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
.gaps-overlay.active .gaps-modal {
    transform: scale(1) translateY(0);
}

/* Header */
.gaps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.gaps-title {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gaps-accent);
    display: flex;
    align-items: center;
    gap: 10px;
}

.gaps-title .led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gaps-accent);
    box-shadow: 0 0 8px var(--gaps-accent-glow);
    animation: gaps-led-pulse 2s ease-in-out infinite;
}

@keyframes gaps-led-pulse {
    0%, 100% { box-shadow: 0 0 6px var(--gaps-accent-glow); }
    50% { box-shadow: 0 0 14px var(--gaps-accent-glow), 0 0 24px rgba(245, 158, 11, 0.12); }
}

.gaps-close {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 120ms;
}
.gaps-close:hover {
    color: var(--text-secondary);
    border-color: var(--border-emphasis);
}
.gaps-close svg {
    width: 16px;
    height: 16px;
}

/* Summary bar */
.gaps-summary {
    padding: 14px 24px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    letter-spacing: 0.01em;
}

.gaps-summary .stat-value {
    color: rgba(255, 255, 255, 0.88);
    font-weight: 600;
}

.gaps-summary .stat-critical {
    color: var(--signal-critical);
    font-weight: 700;
}

/* Search bar */
.gaps-search {
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
    position: relative;
}

.gaps-search-icon {
    position: absolute;
    left: 38px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
    width: 14px;
    height: 14px;
}

.gaps-search-input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all var(--duration-fast) var(--ease-out);
}

.gaps-search-input::placeholder {
    color: var(--text-tertiary);
}

.gaps-search-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--gaps-accent-medium);
}

.gaps-search-clear {
    position: absolute;
    right: 38px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    display: none;
}
.gaps-search-clear:hover {
    color: var(--text-secondary);
}

/* Table body area */
.gaps-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    overscroll-behavior: contain;
    min-height: 0;
}
.gaps-body::-webkit-scrollbar { width: 4px; }
.gaps-body::-webkit-scrollbar-track { background: transparent; }
.gaps-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.07); border-radius: 2px; }

/* Table */
.gaps-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-family: var(--font-mono);
    font-size: 12px;
}

.gaps-table thead th {
    position: sticky;
    top: 0;
    background: rgba(14, 14, 18, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2;
    padding: 10px 16px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.50);
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gaps-table thead th.col-right {
    text-align: right;
}

.gaps-table thead th.col-chevron {
    width: 28px;
    padding: 10px 8px;
}

.gaps-table thead th.gaps-sortable,
.gaps-table .gap-detail-header .gaps-kid-sortable {
    cursor: pointer;
    user-select: none;
    transition: color 120ms;
}

.gaps-table thead th.gaps-sortable:hover,
.gaps-table .gap-detail-header .gaps-kid-sortable:hover {
    color: rgba(255, 255, 255, 0.78);
}

.gaps-table thead th.gaps-sort-active,
.gaps-table .gap-detail-header .gaps-sort-active {
    color: var(--gaps-accent);
}

/* Data rows */
.gaps-table .gap-row {
    cursor: pointer;
    transition: background 120ms;
}

.gaps-table .gap-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

.gaps-table .gap-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.gaps-table .gap-row td {
    padding: 9px 16px;
    color: rgba(255, 255, 255, 0.78);
    white-space: nowrap;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.gaps-table .gap-row td.col-right,
.gaps-table .gap-detail td.col-right {
    text-align: right;
}

.gaps-table .gap-row .cell-chevron {
    color: rgba(255, 255, 255, 0.45);
    font-size: 10px;
    text-align: center;
    padding: 9px 8px;
    transition: color 120ms;
}

.gaps-table .gap-row:hover .cell-chevron {
    color: var(--gaps-accent);
}

.gaps-table .gap-row .cell-combo {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
}

.gaps-table .gap-row .cell-model {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.50);
    font-weight: 400;
}

/* Qty pill */
.gaps-qty-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 600;
}

.gaps-qty-pill.critical {
    color: var(--signal-critical);
    background: rgba(248, 113, 113, 0.1);
}

.gaps-qty-pill.caution {
    color: var(--signal-caution);
    background: rgba(251, 191, 36, 0.1);
}

.gaps-qty-pill.healthy {
    color: var(--signal-healthy);
    background: rgba(52, 211, 153, 0.08);
}

/* Gap value */
.gaps-table .cell-gap {
    font-weight: 700;
}

.gaps-table .cell-gap.has-gap {
    color: var(--signal-critical);
}

.gaps-table .cell-gap.no-gap {
    color: rgba(255, 255, 255, 0.45);
    font-weight: 400;
}

/* Detail sub-header */
.gaps-table .gap-detail-header td {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.50);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(245, 158, 11, 0.04);
}

/* Detail rows (kid components) */
.gaps-table .gap-detail {
    background: rgba(245, 158, 11, 0.02);
}

.gaps-table .gap-detail td {
    padding: 7px 16px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.gaps-table .gap-detail .cell-tree {
    color: rgba(255, 255, 255, 0.28);
    text-align: center;
    padding: 7px 8px;
}

.gaps-table .gap-detail .cell-kid-sku {
    color: rgba(255, 255, 255, 0.82);
}

.gaps-table .gap-detail .cell-kid-mult {
    color: rgba(255, 255, 255, 0.50);
}

.gaps-table .gap-detail .cell-kid-gap.has-gap {
    color: var(--signal-critical);
    font-weight: 600;
}

/* No results */
.gaps-no-results {
    padding: 40px 24px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
}

/* Empty state */
.gaps-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.gaps-empty-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px dashed var(--border-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--signal-healthy);
    font-size: 20px;
}

.gaps-empty-text {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    line-height: 1.8;
}

/* Mobile */
@media (max-width: 768px) {
    .gaps-modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .gaps-table thead th,
    .gaps-table .gap-row td,
    .gaps-table .gap-detail td {
        padding-left: 10px;
        padding-right: 10px;
    }

    .gaps-table .gap-row .cell-combo {
        font-size: 12px;
    }

    .gaps-table .gap-row .cell-model {
        display: none;
    }
}
