:root {
    --primary: #4f46e5;
    --primary-dark: #312e81;
    --secondary: #06b6d4;
    --success-soft: #dcfce7;
    --warning-soft: #fef3c7;
    --danger-soft: #fee2e2;
    --text-main: #0f172a;
    --text-soft: #64748b;
    --card-bg: rgba(255, 255, 255, 0.92);
    --border-soft: rgba(148, 163, 184, 0.18);
    --shadow-soft: 0 12px 35px rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 18px 40px rgba(79, 70, 229, 0.14);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: #eef4ff;
    color: var(--text-main);
    min-height: 100vh;
}
.page-bg {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(6, 182, 212, 0.15), transparent 28%),
        linear-gradient(135deg, #eff6ff 0%, #f8fafc 45%, #eef2ff 100%);
    z-index: -1;
}
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
    padding: 34px;
}
.brand-wrap h1 { font-size: 2rem; font-weight: 800; margin: 14px 0 8px; }
.brand-wrap p { color: var(--text-soft); margin-bottom: 28px; }
.brand-logo {
    width: 92px; height: 92px; border-radius: 24px; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.15), rgba(6, 182, 212, 0.15));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}
.logo { width: 68px; height: 68px; object-fit: contain; }
.brand-badge, .hero-chip {
    display: inline-flex; align-items: center; gap: 8px; background: rgba(79,70,229,0.08); color: var(--primary);
    padding: 8px 14px; border-radius: 999px; font-size: .88rem; font-weight: 700;
}
.custom-input, .search-input {
    border-radius: 18px !important; border: 1px solid rgba(148,163,184,0.25); min-height: 58px; padding-left: 16px; box-shadow: none !important;
}
.custom-input:focus, .search-input:focus {
    border-color: rgba(79,70,229,0.35); box-shadow: 0 0 0 4px rgba(79,70,229,0.1) !important;
}
.btn-main {
    min-height: 54px; border: none; border-radius: 18px; font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    box-shadow: 0 10px 25px rgba(79,70,229,0.25); color: #fff;
}
.btn-main:hover { transform: translateY(-1px); color: #fff; }
.login-message { min-height: 24px; font-weight: 600; text-align: center; }
.app-shell { min-height: 100vh; }
.topbar {
    position: relative; z-index: 20; padding: 16px 24px; background: rgba(15,23,42,0.82);
    backdrop-filter: blur(12px); border-bottom: 1px solid rgba(255,255,255,0.08);
}
.topbar-logo {
    width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
}
.topbar-logo img { width: 34px; height: 34px; object-fit: contain; }
.topbar-title { color: #fff; font-size: 1.15rem; font-weight: 800; }
.topbar-subtitle { color: rgba(255,255,255,0.7); font-size: .92rem; }
.btn-ghost {
    min-height: 46px; border-radius: 14px; color: #fff; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.05);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: #fff; }
.hero-panel, .search-panel {
    background: var(--card-bg); backdrop-filter: blur(12px); border: 1px solid var(--border-soft); border-radius: 26px; box-shadow: var(--shadow-soft);
}
.hero-panel { padding: 28px; }
.hero-panel h2 { margin: 14px 0 10px; font-size: 2rem; font-weight: 800; }
.hero-panel p { color: var(--text-soft); margin-bottom: 0; }
.stats-card {
    height: 100%; display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 22px;
    background: linear-gradient(135deg, rgba(79,70,229,0.08), rgba(6,182,212,0.08));
}
.stats-icon {
    width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff; font-size: 1.3rem;
}
.stats-card small { display: block; color: var(--text-soft); margin-bottom: 4px; }
.stats-card strong { font-size: 1rem; }
.search-panel { padding: 18px; }
.search-box { position: relative; }
.search-icon {
    position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-soft); font-size: 1rem;
}
.search-input { padding-left: 48px; }
.main-content { position: relative; z-index: 2; }
.product-card {
    position: relative;
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(226,232,240,0.9);
    border-radius: 28px;
    box-shadow: 0 18px 40px rgba(15,23,42,0.06);
    padding: 18px;
    overflow: hidden;
    height: 100%;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.product-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, rgba(79,70,229,0.9), rgba(6,182,212,0.75));
    opacity: .9;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 45px rgba(79,70,229,0.12);
    border-color: rgba(129,140,248,0.35);
}
.product-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.code-badge, .cost-badge {
    display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; font-size: .78rem; font-weight: 800;
}
.code-badge { background: #eef2ff; color: #4f46e5; }
.cost-badge { background: #dcfce7; color: #047857; }
.product-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    margin-bottom: 14px;
}
.product-name {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.35;
    min-width: 0;
    display: flex;
    align-items: flex-start;
}
.toggle-icon-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    box-shadow: 0 10px 20px rgba(79,70,229,0.22);
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.toggle-icon-btn:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 14px 24px rgba(79,70,229,0.28);
}
.toggle-icon-btn.is-open { background: linear-gradient(135deg, #0f172a, #334155); }
.toggle-icon-btn i { font-size: .95rem; }
.pair-list { display: flex; flex-direction: column; gap: 10px; }
.pair-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.mini-badge {
    border-radius: 16px;
    padding: 8px 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid rgba(148,163,184,0.16);
    background: #f8fafc;
}
.mini-badge span {
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .3px;
    color: #64748b;
}
.mini-badge strong {
    font-size: .82rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}
.price-mini { background: linear-gradient(135deg, #f8fafc, #eef2ff); }
.stock-mini.stock-zero { background: #fef2f2; border-color: #fecaca; }
.stock-mini.stock-zero strong { color: #b91c1c; }
.stock-mini.stock-low { background: #fff7ed; border-color: #fdba74; }
.stock-mini.stock-low strong { color: #c2410c; }
.stock-mini.stock-mid { background: #fefce8; border-color: #fde68a; }
.stock-mini.stock-mid strong { color: #a16207; }
.stock-mini.stock-ok { background: #ecfdf5; border-color: #a7f3d0; }
.stock-mini.stock-ok strong { color: #047857; }
.extra-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(148,163,184,0.25);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.loading-state, .empty-state {
    background: var(--card-bg); border: 1px solid var(--border-soft); border-radius: 24px; box-shadow: var(--shadow-soft);
    padding: 36px 20px; text-align: center; color: var(--text-soft);
}
.loading-state i, .empty-state i { font-size: 2rem; margin-bottom: 12px; display: block; color: var(--primary); }
.scroll-top-btn {
    position: fixed; right: 22px; bottom: 22px; width: 54px; height: 54px; border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #fff;
    background: linear-gradient(135deg, var(--primary), #7c3aed); box-shadow: 0 10px 25px rgba(79,70,229,0.3);
    opacity: 0; visibility: hidden; transform: translateY(12px); transition: .2s ease; z-index: 1000;
}
.scroll-top-btn.show { opacity: 1; visibility: visible; transform: translateY(0); }

@media (max-width: 768px) {
    .login-card { padding: 26px; }
    .hero-panel { padding: 22px; }
    .hero-panel h2 { font-size: 1.45rem; }
    .product-card { padding: 16px; border-radius: 24px; }
    .product-name { font-size: .95rem; }
    .mini-badge { padding: 8px 10px; }
    .mini-badge span { font-size: .66rem; }
    .mini-badge strong { font-size: .78rem; }
}

@media (max-width: 460px) {
    .topbar { padding: 14px; }
    .product-title-row { gap: 8px; }
    .product-card { padding: 15px; border-radius: 22px; }
    .code-badge, .cost-badge { font-size: .72rem; padding: 7px 10px; }
    .product-name { font-size: .9rem; }
    .toggle-icon-btn { width: 32px; height: 32px; border-radius: 11px; }
    .mini-badge span { font-size: .64rem; }
    .mini-badge strong { font-size: .74rem; }
}
