:root {
    --bg: #0e1116;
    --panel: #12171d;
    --panel-2: #151b23;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(47, 214, 201, 0.34);
    --muted: #8b97a3;
    --soft: #aeb8c2;
    --text: #eef2f6;
    --cyan: #2fd6c9;
    --cyan-2: #7fe9df;
    --green: #43c98a;
    --danger: #ff6b7a;
    --warn: #ffd166;
}

* {
    box-sizing: border-box;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html {
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body.qq-app {
    min-height: 100vh;
    overscroll-behavior-y: contain;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 75% -220px, rgba(47, 214, 201, 0.075), transparent 60%),
        radial-gradient(900px 500px at 0 0, rgba(80, 120, 255, 0.055), transparent 55%),
        var(--bg) !important;
    background-attachment: fixed;
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
}

body.qq-app::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.018) 0 1px, transparent 1px 42px);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 58%);
}

::selection {
    background: rgba(47, 214, 201, 0.3);
    color: #fff;
}

button,
a,
input {
    touch-action: manipulation;
}

button,
a {
    transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

button:active,
a:active {
    transform: scale(0.985);
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.font-mono,
#export-preview,
.status-pill,
.section-eyebrow,
.results-bar,
.product-card .font-mono,
#bom-items .font-mono,
#ai-results .font-mono {
    font-family: 'IBM Plex Mono', ui-monospace, monospace !important;
}

.app-topbar {
    background: rgba(14, 17, 22, 0.86) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: none !important;
    backdrop-filter: blur(16px);
}

.app-topbar h1,
.view-title {
    font-family: 'Space Grotesk', 'IBM Plex Sans', system-ui, sans-serif;
    color: var(--text) !important;
    letter-spacing: -0.01em;
}

.brand-logo-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 9px;
    background: linear-gradient(150deg, var(--cyan), #1f9fc4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(47, 214, 201, 0.3);
}

.brand-logo-tile img {
    width: 20px;
    height: 20px;
    filter: brightness(0) saturate(100%) invert(5%) sepia(18%) saturate(702%) hue-rotate(169deg) brightness(92%) contrast(96%);
}

.brand-subtitle {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 9.5px !important;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6e7a88 !important;
}

.status-pill,
#nav-badge {
    border: 1px solid rgba(67, 201, 138, 0.2) !important;
    background: rgba(67, 201, 138, 0.08) !important;
    color: #7fdcae !important;
    letter-spacing: 0.08em;
}

.view {
    position: relative;
}

.catalog-controls {
    top: 61px !important;
    margin: 0 -1rem 14px;
    padding: 12px 1rem 14px !important;
    background: linear-gradient(180deg, rgba(14, 17, 22, 0.96), rgba(14, 17, 22, 0.82) 82%, rgba(14, 17, 22, 0)) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

#search-input {
    background: rgba(255, 255, 255, 0.045) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    color: var(--text) !important;
    border-radius: 14px !important;
    box-shadow: none !important;
    outline: none !important;
}

#search-input::placeholder {
    color: #5d6976;
}

#search-input:focus {
    border-color: rgba(47, 214, 201, 0.55) !important;
    background: rgba(47, 214, 201, 0.06) !important;
    box-shadow: 0 0 0 3px rgba(47, 214, 201, 0.09) !important;
}

.results-bar,
#loading-catalog,
#no-results,
#bom-empty {
    color: var(--muted) !important;
}

#btn-clear-search,
#btn-clear-bom {
    color: var(--cyan-2) !important;
}

#category-tabs {
    margin-bottom: 0.25rem;
}

#category-tabs .cat-tab {
    background: rgba(255, 255, 255, 0.045) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    color: #cfd7e0 !important;
    box-shadow: none !important;
}

#category-tabs .cat-tab:hover {
    border-color: rgba(47, 214, 201, 0.4) !important;
    background: rgba(47, 214, 201, 0.08) !important;
    color: #fff !important;
}

#category-tabs .cat-tab.active {
    background: var(--cyan) !important;
    border-color: var(--cyan) !important;
    color: #06201e !important;
    box-shadow: 0 6px 22px rgba(47, 214, 201, 0.23) !important;
}

.section-eyebrow {
    color: var(--cyan-2) !important;
    font-size: 10.5px !important;
    letter-spacing: 0.2em !important;
}

.hub-panel,
.product-card,
#bundles-grid > div,
#bom-items > div,
.bom-total-panel,
#export-preview,
#ai-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)) !important;
    border: 1px solid var(--line) !important;
    box-shadow: none !important;
}

.hub-panel {
    padding: 16px;
    border-radius: 18px;
}

.product-card,
#bundles-grid > div,
#bom-items > div {
    border-radius: 16px !important;
}

.product-card {
    min-height: 178px;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.product-card:hover,
#bundles-grid > div:hover,
#bom-items > div:hover {
    transform: translateY(-2px);
    border-color: rgba(47, 214, 201, 0.5) !important;
    background: linear-gradient(180deg, rgba(47, 214, 201, 0.1), rgba(47, 214, 201, 0.02)) !important;
}

.product-card h3,
#bundles-grid p:first-child,
#bom-items p:first-child {
    font-family: 'Space Grotesk', 'IBM Plex Sans', system-ui, sans-serif;
    color: var(--text) !important;
    font-weight: 600 !important;
}

.product-card p,
#bundles-grid p,
#bom-items p,
#bom-totals p,
#bom-totals span:first-child,
#ai-results p {
    color: var(--muted) !important;
}

.product-card .font-mono,
#bom-items .font-mono {
    color: #6e7a88 !important;
    letter-spacing: 0.02em;
}

.product-card .rounded-full,
#bundles-grid .rounded-full {
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #aeb8c2 !important;
}

.product-card .bg-yellow-100 {
    border-color: rgba(255, 209, 102, 0.24) !important;
    background: rgba(255, 209, 102, 0.1) !important;
    color: #ffe19a !important;
}

.product-card .bg-green-100 {
    border-color: rgba(67, 201, 138, 0.24) !important;
    background: rgba(67, 201, 138, 0.1) !important;
    color: #7fdcae !important;
}

.product-card > div:first-child > span,
#bundles-grid > div > div:first-child > span,
#bom-grand-total,
#bom-items p.text-lg {
    color: var(--cyan-2) !important;
}

#bom-items > div > div:first-child button {
    color: #ff9aa6 !important;
}

#bom-items > div > div:first-child button:hover {
    border-color: rgba(255, 107, 122, 0.45) !important;
    background: rgba(255, 107, 122, 0.08) !important;
    color: #ffd4d9 !important;
}

.product-card a,
.product-card button,
#bundles-grid button,
#bom-items button,
.ai-action,
.secondary-action {
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.045) !important;
    color: #d9e1e8 !important;
    box-shadow: none !important;
}

.product-card a:hover,
.product-card button:hover,
#bundles-grid button:hover,
#bom-items button:hover,
.ai-action:hover,
.secondary-action:hover {
    border-color: rgba(47, 214, 201, 0.4) !important;
    background: rgba(47, 214, 201, 0.08) !important;
    color: #fff !important;
}

.product-card button:last-child,
#bundles-grid button,
.primary-action {
    background: var(--cyan) !important;
    border-color: var(--cyan) !important;
    color: #06201e !important;
    box-shadow: 0 6px 22px rgba(47, 214, 201, 0.25) !important;
}

#bundles-grid > div {
    min-height: 132px;
}

#bundles-grid > div > div:last-child {
    border-top-color: rgba(255, 255, 255, 0.06) !important;
}

#btn-load-more {
    margin-top: 0.75rem;
}

.view-title {
    font-size: 1.45rem !important;
}

#bom-empty {
    border: 1px dashed rgba(47, 214, 201, 0.26);
    border-radius: 18px;
    background: rgba(47, 214, 201, 0.035);
}

#bom-empty p:first-child {
    color: var(--text) !important;
    font-family: 'Space Grotesk', 'IBM Plex Sans', system-ui, sans-serif;
}

#bom-items input {
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(0, 0, 0, 0.18) !important;
    color: var(--text) !important;
}

#bom-items input:focus {
    border-color: rgba(47, 214, 201, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(47, 214, 201, 0.09) !important;
}

#bom-totals {
    backdrop-filter: blur(16px);
    background: linear-gradient(110deg, rgba(47, 214, 201, 0.13), rgba(31, 159, 196, 0.06) 55%, rgba(255, 255, 255, 0.01)) !important;
    border-color: rgba(47, 214, 201, 0.28) !important;
}

#export-preview {
    color: #d9e1e8 !important;
    min-height: 12rem;
}

#ai-backdrop {
    background: rgba(0, 0, 0, 0.62) !important;
    backdrop-filter: blur(3px);
}

#ai-panel {
    border-radius: 22px 22px 0 0 !important;
    border-color: rgba(255, 255, 255, 0.11) !important;
    box-shadow: 0 -26px 80px rgba(0, 0, 0, 0.48) !important;
    backdrop-filter: blur(20px);
}

#ai-panel .sticky {
    background: rgba(16, 21, 28, 0.96) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#ai-title {
    color: var(--text) !important;
    font-family: 'Space Grotesk', 'IBM Plex Sans', system-ui, sans-serif;
}

#ai-close {
    color: var(--soft) !important;
}

#ai-close:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    color: #fff !important;
}

#ai-results > div,
#ai-results .bg-gray-50,
#ai-results .bg-white,
#ai-results .bg-blue-50,
#ai-results .bg-yellow-50,
#ai-results .bg-red-50 {
    background: rgba(255, 255, 255, 0.045) !important;
    border-color: rgba(255, 255, 255, 0.09) !important;
    color: var(--soft) !important;
}

#ai-results .text-gray-800,
#ai-results .font-medium {
    color: var(--text) !important;
}

#ai-results button,
#createSuggestedFix button {
    background: var(--cyan) !important;
    color: #06201e !important;
}

#ai-loading span {
    color: var(--muted) !important;
}

#toast {
    top: 72px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(47, 214, 201, 0.34);
    background: rgba(14, 17, 22, 0.95) !important;
    color: #d9fff9 !important;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35) !important;
}

nav {
    background: rgba(14, 17, 22, 0.9) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.09) !important;
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.35) !important;
    backdrop-filter: blur(16px);
}

nav .nav-tab {
    color: #6e7a88 !important;
}

nav .nav-tab:hover,
nav .nav-tab.text-alta-teal {
    color: var(--cyan-2) !important;
    background: rgba(47, 214, 201, 0.055) !important;
}

nav svg {
    width: 1.35rem;
    height: 1.35rem;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 767px) {
    .view {
        padding-bottom: 5.5rem;
    }

    .brand-lockup h1 {
        font-size: 1rem;
    }
}

@media (min-width: 768px) {
    body.qq-app {
        padding-bottom: 7rem;
    }

    .catalog-controls {
        border-radius: 0 0 18px 18px;
    }

    nav {
        left: 50% !important;
        right: auto !important;
        bottom: 1rem !important;
        width: min(42rem, calc(100vw - 2rem));
        transform: translateX(-50%);
        border: 1px solid rgba(255, 255, 255, 0.09) !important;
        border-radius: 9999px;
        overflow: hidden;
        box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35) !important;
    }

    nav .nav-tab {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}

@media (min-width: 1024px) {
    body.qq-app {
        padding-bottom: 2rem;
    }

    .app-topbar {
        padding-block: 0.875rem !important;
    }

    .catalog-controls {
        top: 68px !important;
    }

    nav {
        top: 0.75rem !important;
        bottom: auto !important;
        left: auto !important;
        right: max(1rem, calc((100vw - 72rem) / 2)) !important;
        width: 24rem;
        transform: none;
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32) !important;
    }

    nav .nav-tab {
        padding-top: 0.45rem;
        padding-bottom: 0.45rem;
    }
}
