:root {
    --bg: #0f1419;
    --bg-card: #1a222d;
    --bg-elevated: #232d3b;
    --border: #2e3a4a;
    --text: #e8edf4;
    --text-muted: #8b9cb3;
    --accent: #ff6b4a;
    --accent-dim: rgba(255, 107, 74, 0.15);
    --accent-hover: #ff8266;
    --success: #3dd68c;
    --danger: #ff5c7a;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: 88px;
    min-height: 100vh;
    min-height: 100dvh;
}

#app-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.banned-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.banned-content {
    text-align: center;
    max-width: 300px;
}

.banned-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.banned-title {
    font-size: 1.35rem;
    color: var(--danger);
    margin-bottom: 10px;
}

.banned-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 8px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, var(--bg) 85%, transparent);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    font-size: 1.6rem;
    line-height: 1;
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.balance-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.bal-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 9px 5px 7px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid var(--border);
    background: var(--bg-card);
    line-height: 1;
}

.bal-pill-icon {
    font-size: 0.95rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.bal-pill-val {
    font-variant-numeric: tabular-nums;
    min-width: 1ch;
}

.bal-bear {
    border-color: rgba(255, 180, 100, 0.35);
    background: linear-gradient(135deg, rgba(255, 140, 60, 0.12), rgba(30, 34, 45, 0.9));
}

.bal-hedge {
    border-color: rgba(120, 200, 140, 0.35);
    background: linear-gradient(135deg, rgba(80, 180, 110, 0.12), rgba(30, 34, 45, 0.9));
}

.search-row {
    padding: 0 16px 10px;
}

.search-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--bg-card);
    color: var(--text);
}

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

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.toolbar {
    position: relative;
    padding: 0 16px 8px;
}

.tool-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.sort-panel {
    position: absolute;
    top: 100%;
    left: 16px;
    margin-top: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 90;
    min-width: 200px;
}

.sort-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 11px 14px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.sort-item:last-child {
    border-bottom: none;
}

.sort-item:hover,
.sort-item.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.category-scroll {
    display: flex;
    gap: 8px;
    padding: 4px 16px 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.cat-chip {
    flex-shrink: 0;
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.cat-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.products {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 16px 16px;
    flex: 1 1 auto;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: grid;
    grid-template-columns: 108px 1fr;
    box-shadow: var(--shadow);
}

.product-img-wrap {
    position: relative;
    min-height: 108px;
}

.product-img {
    width: 100%;
    height: 100%;
    min-height: 108px;
    object-fit: cover;
    display: block;
}

.product-badges {
    position: absolute;
    top: 6px;
    left: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-popular {
    background: var(--accent);
    color: #fff;
}

.badge-new {
    background: var(--success);
    color: #0f1419;
}

.product-info {
    padding: 12px 12px 12px 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-type {
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 600;
    margin-top: 2px;
}

.product-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text);
}

.old-price {
    text-decoration: line-through;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.82rem;
    margin-right: 6px;
}

.discount-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 800;
}

.pay-pick {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.pay-pick-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.pay-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.pay-chip {
    flex: 1;
    min-width: 0;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.pay-chip.active {
    border-color: var(--accent);
    background: rgba(255, 107, 74, 0.15);
    color: #fff;
    box-shadow: 0 0 0 1px rgba(255, 107, 74, 0.35);
}
.pay-pick .pay-add-btn {
    width: 100%;
    margin-top: 2px;
}
.add-btn {
    width: 100%;
    padding: 9px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}

.add-btn:active {
    opacity: 0.85;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.quantity-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.quantity-value {
    flex: 1;
    text-align: center;
    font-weight: 800;
}

.shop-footer {
    text-align: center;
    margin-top: auto;
    padding: 16px 16px 24px;
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.4;
    flex-shrink: 0;
}

.bottom-cart {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius);
    box-shadow: 0 6px 28px rgba(255, 107, 74, 0.45);
    cursor: pointer;
    font-weight: 700;
}

.bottom-cart-label {
    flex: 1;
}

.bottom-cart-sum {
    opacity: 0.95;
}

.bottom-cart-badge {
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
}

.modal-sheet {
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    background: var(--bg-elevated);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-bottom: none;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.modal-head h2 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

.cart-items {
    padding: 12px 16px;
    overflow-y: auto;
    max-height: 200px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item-desc {
    font-weight: 600;
    font-size: 0.9rem;
}

.cart-item-price {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 2px;
}

.remove-btn {
    background: rgba(255, 92, 122, 0.15);
    color: var(--danger);
    border: none;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.checkout-fields {
    padding: 0 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
}

.field-input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.95rem;
}

.field-input:focus {
    outline: none;
    border-color: var(--accent);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-weight: 800;
    font-size: 1.05rem;
}

.cart-actions {
    padding: 0 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}

.btn-ghost {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
}

.btn-outline {
    padding: 12px 20px;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 28px 20px 16px;
    font-size: 0.95rem;
}

.skeleton-card {
    pointer-events: none;
}

.skeleton-card .product-img-wrap {
    align-self: stretch;
    min-height: 100%;
    background: var(--bg-elevated);
}

.skeleton-card .product-info {
    padding: 12px 12px 12px 10px;
    gap: 8px;
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-elevated) 0%,
        rgba(255, 255, 255, 0.07) 45%,
        var(--bg-elevated) 90%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.2s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 148px;
    border-radius: 0;
}

.skeleton-line {
    height: 14px;
    width: 72%;
}

.skeleton-line.title {
    height: 15px;
    width: 58%;
    margin-bottom: 8px;
}

.skeleton-line.type {
    height: 11px;
    width: 28%;
    margin-bottom: 6px;
}

.skeleton-line.desc {
    height: 11px;
    width: 42%;
}

.skeleton-line.price {
    width: 36%;
    height: 16px;
    margin-top: 2px;
}

.skeleton-btn {
    width: 100%;
    height: 36px;
    border-radius: var(--radius-sm);
    margin-top: 2px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.sales-paused {
    margin: 0 16px 12px;
    padding: 12px;
    background: rgba(255, 92, 122, 0.15);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
}
