:root {
    --bg: #09090b;
    --card: rgba(39, 39, 42, 0.46);
    --card-strong: rgba(24, 24, 27, 0.72);
    --border: rgba(63, 63, 70, 0.68);
    --muted: #a1a1aa;
    --muted-low: #71717a;
    --text: #fafafa;
    --emerald: #34d399;
    --amber: #fbbf24;
    --cyan: #22d3ee;
    --violet: #a78bfa;
    --rose: #fb7185;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    min-width: 320px;
    letter-spacing: 0;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:disabled {
    cursor: wait;
    opacity: .74;
}

::selection {
    background: rgba(52, 211, 153, .28);
    color: var(--text);
}

::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #09090b;
}

::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border: 2px solid #09090b;
    border-radius: 999px;
}

.glass-card,
.metric-card,
.asin-mobile-card {
    background:
        linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.012)),
        var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow:
        0 1px 0 rgba(255,255,255,.035) inset,
        0 22px 70px rgba(0,0,0,.24);
    backdrop-filter: blur(18px);
}

.glass-card {
    position: relative;
}

.glass-card::before,
.metric-card::before {
    background: linear-gradient(90deg, transparent, rgba(52, 211, 153, .26), transparent);
    content: "";
    height: 1px;
    left: 16px;
    opacity: .7;
    position: absolute;
    right: 16px;
    top: -1px;
}

.nav-link,
.sh-btn,
.mobile-tab,
.filter-chip {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    display: inline-flex;
    font-size: 0.875rem;
    font-weight: 500;
    gap: .5rem;
    line-height: 1;
    min-height: 2.4rem;
    padding: .65rem .9rem;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.nav-link {
    color: #a1a1aa;
}

.nav-link:hover,
.nav-link-active {
    background: rgba(39, 39, 42, .72);
    border-color: rgba(82, 82, 91, .72);
    color: #fafafa;
}

.sh-btn {
    background: rgba(39, 39, 42, .78);
    border-color: rgba(82, 82, 91, .75);
    color: #f4f4f5;
}

.sh-btn:hover {
    background: rgba(63, 63, 70, .8);
    border-color: rgba(113, 113, 122, .72);
}

.sh-btn:active,
.filter-chip:active,
.mobile-tab:active {
    transform: translateY(1px);
}

.mobile-tab {
    background: rgba(39, 39, 42, .56);
    border-color: rgba(63, 63, 70, .62);
    color: #d4d4d8;
    justify-content: center;
    width: 100%;
}

.mobile-tab-active {
    background: rgba(52, 211, 153, .12);
    border-color: rgba(52, 211, 153, .34);
    color: #a7f3d0;
}

.metric-card {
    align-items: center;
    display: flex;
    gap: 1rem;
    min-height: 8rem;
    overflow: hidden;
    padding: 1.1rem;
    position: relative;
}

.metric-card.compact {
    min-height: 6.5rem;
}

.metric-icon {
    align-items: center;
    background: rgba(39, 39, 42, .78);
    border: 1px solid rgba(82, 82, 91, .72);
    border-radius: 12px;
    color: var(--emerald);
    display: flex;
    flex: 0 0 auto;
    height: 2.7rem;
    justify-content: center;
    width: 2.7rem;
}

.metric-label {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.metric-value {
    color: var(--text);
    font-size: clamp(1.65rem, 5vw, 2.35rem);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.05;
    margin-top: .35rem;
}

.metric-value span {
    color: var(--muted-low);
    font-size: 1.05rem;
    font-weight: 700;
}

.accent-emerald .metric-icon { color: var(--emerald); }
.accent-amber .metric-icon { color: var(--amber); }
.accent-cyan .metric-icon { color: var(--cyan); }
.accent-violet .metric-icon { color: var(--violet); }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.filter-chip {
    background: rgba(24, 24, 27, .66);
    border-color: rgba(63, 63, 70, .58);
    color: #a1a1aa;
    min-height: 2rem;
    padding: .5rem .7rem;
}

.filter-chip:hover,
.filter-chip.is-active {
    background: rgba(52, 211, 153, .12);
    border-color: rgba(52, 211, 153, .34);
    color: #a7f3d0;
}

.asin-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.asin-table thead th {
    background: rgba(24, 24, 27, .72);
    border-bottom: 1px solid rgba(63, 63, 70, .72);
    color: #a1a1aa;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: .85rem 1rem;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.asin-table tbody td {
    border-bottom: 1px solid rgba(63, 63, 70, .42);
    color: #d4d4d8;
    font-size: .875rem;
    padding: 1rem;
    vertical-align: middle;
}

.asin-table tbody tr {
    cursor: pointer;
    transition: background .18s ease;
}

.asin-table tbody tr:hover {
    background: rgba(63, 63, 70, .26);
}

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

.asin-code {
    background: rgba(24, 24, 27, .88);
    border: 1px solid rgba(82, 82, 91, .65);
    border-radius: 8px;
    color: #67e8f9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .78rem;
    font-weight: 700;
    padding: .28rem .45rem;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
    white-space: nowrap;
}

.asin-code:hover {
    background: rgba(8, 145, 178, .16);
    border-color: rgba(34, 211, 238, .42);
    color: #a5f3fc;
}

.status-pill,
.aplus-dot {
    align-items: center;
    border: 1px solid;
    border-radius: 999px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 700;
    gap: .35rem;
    justify-content: center;
    line-height: 1;
    padding: .35rem .55rem;
    white-space: nowrap;
}

.status-owned,
.aplus-yes {
    background: rgba(52, 211, 153, .10);
    border-color: rgba(52, 211, 153, .30);
    color: #86efac;
}

.status-comp {
    background: rgba(251, 191, 36, .10);
    border-color: rgba(251, 191, 36, .30);
    color: #fde68a;
}

.aplus-no {
    background: rgba(251, 113, 133, .10);
    border-color: rgba(251, 113, 133, .30);
    color: #fda4af;
}

.asin-mobile-card {
    padding: 1rem;
    transition: border-color .18s ease, transform .18s ease, background .18s ease;
}

.asin-mobile-card:hover {
    border-color: rgba(113, 113, 122, .76);
    transform: translateY(-1px);
}

.mini-stat {
    background: rgba(24, 24, 27, .62);
    border: 1px solid rgba(63, 63, 70, .52);
    border-radius: 10px;
    min-width: 0;
    padding: .65rem;
}

.mini-stat span {
    color: var(--muted-low);
    display: block;
    font-size: .72rem;
    font-weight: 600;
    margin-bottom: .28rem;
}

.mini-stat strong {
    color: var(--text);
    display: block;
    font-size: .95rem;
    overflow-wrap: anywhere;
}

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

.chart-frame {
    height: 20rem;
    max-height: 52vh;
    min-height: 16rem;
    position: relative;
}

.empty-state {
    align-items: center;
    background: rgba(24, 24, 27, .54);
    border: 1px dashed rgba(82, 82, 91, .72);
    border-radius: 12px;
    color: var(--muted);
    display: flex;
    gap: .6rem;
    justify-content: center;
    min-height: 10rem;
    padding: 1.5rem;
    text-align: center;
}

.collapsible-trigger {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem;
    text-align: left;
    width: 100%;
}

.collapsible-icon {
    color: var(--muted-low);
    flex: 0 0 auto;
    transition: transform .18s ease;
}

.collapsible-trigger.is-collapsed .collapsible-icon {
    transform: rotate(-90deg);
}

.collapsible-panel {
    border-top: 1px solid rgba(63, 63, 70, .7);
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .22s ease;
}

.collapsible-panel > * {
    overflow: hidden;
}

.collapsible-panel.is-open {
    grid-template-rows: 1fr;
}

.variant-row {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: .9rem 1rem;
}

.page-loader {
    align-items: center;
    background: rgba(9, 9, 11, .55);
    display: flex;
    inset: 0;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity .18s ease;
    z-index: 80;
}

.page-loader.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.loader-panel {
    align-items: center;
    background: rgba(24, 24, 27, .9);
    border: 1px solid rgba(82, 82, 91, .72);
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
    color: #f4f4f5;
    display: flex;
    font-size: .9rem;
    font-weight: 600;
    gap: .75rem;
    padding: .85rem 1rem;
}

.loader-spinner {
    animation: spin .8s linear infinite;
    border: 2px solid rgba(161, 161, 170, .35);
    border-radius: 999px;
    border-top-color: var(--emerald);
    display: inline-block;
    height: 1rem;
    width: 1rem;
}

.loader-spinner.small {
    height: .9rem;
    width: .9rem;
}

.page-enter {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .24s ease, transform .24s ease;
}

.page-enter.is-ready {
    opacity: 1;
    transform: translateY(0);
}

.page-exit {
    opacity: 0;
    transform: translateY(6px);
}

.toast-card {
    background: rgba(24, 24, 27, .94);
    border: 1px solid rgba(82, 82, 91, .76);
    border-radius: 14px;
    bottom: 5.75rem;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .45);
    color: #f4f4f5;
    display: grid;
    gap: .3rem;
    max-width: min(26rem, calc(100vw - 2rem));
    opacity: 0;
    padding: .9rem 1rem;
    position: fixed;
    right: 1rem;
    transform: translateY(10px);
    transition: opacity .18s ease, transform .18s ease;
    z-index: 90;
}

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

.toast-card strong {
    font-size: .9rem;
}

.toast-card span {
    color: var(--muted);
    display: -webkit-box;
    font-size: .8rem;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.is-hidden {
    display: none !important;
}

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

@media (min-width: 768px) {
    .toast-card {
        bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .metric-card {
        min-height: 6.8rem;
    }

    .filter-bar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .filter-chip {
        justify-content: center;
    }

    .chart-frame {
        height: 16rem;
    }
}
