/* PayFlow Books - Modern UI */

:root,
[data-theme="light"] {
    --bg: #f1f5f9;
    --bg-subtle: #e2e8f0;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --surface-muted: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --primary: #0f766e;
    --primary-hover: #0d9488;
    --primary-dark: #115e59;
    --primary-soft: rgba(15, 118, 110, 0.08);
    --primary-ring: rgba(15, 118, 110, 0.22);
    --accent: #0369a1;
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #b45309;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.12);
    --overlay: rgba(15, 23, 42, 0.5);
    --header-bg: rgba(255, 255, 255, 0.88);
    --hero-gradient: linear-gradient(135deg, #f0fdfa 0%, #f8fafc 48%, #f1f5f9 100%);
    --cover-1: linear-gradient(145deg, #0f766e, #134e4a);
    --cover-2: linear-gradient(145deg, #0369a1, #1e3a5f);
    --cover-3: linear-gradient(145deg, #b45309, #78350f);
    --cover-4: linear-gradient(145deg, #059669, #064e3b);
    --cover-5: linear-gradient(145deg, #be123c, #881337);
    --cover-6: linear-gradient(145deg, #475569, #1e293b);
}

[data-theme="dark"] {
    --bg: #0b1220;
    --bg-subtle: #111827;
    --surface: #111827;
    --surface-elevated: #1a2332;
    --surface-muted: #0f172a;
    --border: #1f2937;
    --border-strong: #334155;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --primary: #2dd4bf;
    --primary-hover: #5eead4;
    --primary-dark: #14b8a6;
    --primary-soft: rgba(45, 212, 191, 0.1);
    --primary-ring: rgba(45, 212, 191, 0.25);
    --accent: #38bdf8;
    --success: #34d399;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #fbbf24;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #f87171;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.45);
    --overlay: rgba(0, 0, 0, 0.65);
    --header-bg: rgba(17, 24, 39, 0.9);
    --hero-gradient: linear-gradient(135deg, #0f172a 0%, #111827 50%, #0b1220 100%);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    width: 100%;
    line-height: 1.6;
    font-size: 15px;
    overflow-x: hidden;
}

/* Header */
.header {
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: 1.5rem;
    width: 100%;
    padding: 0 clamp(1.25rem, 4vw, 3rem);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.logo-mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.logo-mark svg {
    width: 22px;
    height: 22px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-name {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-tagline {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.nav {
    display: flex;
    gap: 0.35rem;
    padding: 4px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1.15rem;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    color: var(--text);
}

.nav-btn.active {
    background: var(--surface);
    color: var(--primary-dark);
    box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .nav-btn.active {
    color: var(--primary);
    background: var(--surface-elevated);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 42px;
    height: 42px;
    border-radius: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    border-color: var(--border-strong);
    color: var(--text);
    background: var(--surface-muted);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface);
}

/* Main */
.main {
    width: 100%;
    padding-bottom: 5rem;
}

.tab-panel {
    display: none;
    width: 100%;
}

.tab-panel.active {
    display: block;
}

/* Hero */
.hero {
    width: 100%;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.hero--shop {
    background: var(--hero-gradient);
    padding: clamp(2rem, 4vw, 3.5rem) clamp(1.25rem, 4vw, 3rem);
}

.hero--simple {
    padding: clamp(2.5rem, 5vw, 4rem) clamp(1.25rem, 4vw, 3rem);
    background: var(--hero-gradient);
}

.hero-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 4vw, 4rem);
    align-items: center;
}

.hero-content {
    min-width: 0;
}

.hero-visual {
    min-width: 0;
}

.hero-image-wrap {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    aspect-ratio: 4 / 3;
    background: var(--surface-muted);
}

.hero-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-image-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.hero-image-badge {
    position: absolute;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 2;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.65rem 1rem;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .hero-image-badge {
    background: rgba(17, 24, 39, 0.92);
}

.hero-image-badge strong {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
}

[data-theme="dark"] .hero-image-badge strong {
    color: var(--primary);
}

.hero-image-badge span {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-inner {
    max-width: 1400px;
    margin: 0 auto;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary-dark);
    background: var(--primary-soft);
    border: 1px solid var(--primary-ring);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 1rem;
}

[data-theme="dark"] .hero-eyebrow {
    color: var(--primary);
}

.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
    max-width: 14ch;
}

.hero--simple h1 {
    max-width: 20ch;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 52ch;
    margin-bottom: 1.75rem;
}

.hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
}

.hero-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.hero-feature svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.page-body {
    padding: 2rem clamp(1.25rem, 4vw, 3rem) 0;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Section header */
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.section-head h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-head p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.book-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
}

/* Payment strip */
.payment-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.payment-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
}

.payment-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    flex-shrink: 0;
}

[data-theme="dark"] .payment-item-icon {
    color: var(--primary);
}

.payment-item-icon svg {
    width: 16px;
    height: 16px;
}

/* Products - compact grid (Shopee-style) */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 0.75rem;
    width: 100%;
}

@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
        gap: 0.85rem;
    }
}

@media (min-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    }
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: var(--shadow-xs);
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--border-strong);
}

.product-card:active {
    transform: scale(0.98);
}

.product-cover {
    position: relative;
    height: 150px;
    overflow: hidden;
    background: var(--surface-muted);
}

@media (min-width: 640px) {
    .product-cover {
        height: 165px;
    }
}

.product-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.product-card:hover .product-cover img {
    transform: scale(1.04);
}

.product-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.4) 0%, transparent 40%);
    pointer-events: none;
}

.product-category {
    position: absolute;
    left: 0.5rem;
    top: 0.5rem;
    z-index: 1;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
}

.product-body {
    padding: 0.55rem 0.6rem 0.65rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.35rem;
}

.product-name {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.2em;
    color: var(--text);
}

.product-desc {
    display: none;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0;
    border-top: none;
}

.product-price-block {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.product-price {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--primary-dark);
}

[data-theme="dark"] .product-price {
    color: var(--primary);
}

.product-stock {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
}

.product-stock.low {
    color: var(--warning);
}

.product-card .btn-add-mini {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    flex-shrink: 0;
}

.product-card .btn-add-mini svg {
    width: 14px;
    height: 14px;
}

/* Category filter */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.category-chip {
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-chip:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

[data-theme="dark"] .category-chip:hover {
    color: var(--primary);
}

.category-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

[data-theme="dark"] .category-chip.active {
    color: #0f172a;
}

/* Product full page */
.product-page-body {
    background: var(--bg);
    padding-bottom: 88px;
}

.product-page-header .header-inner {
    justify-content: space-between;
}

.detail-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.35rem 0.5rem 0.35rem 0;
    border-radius: 8px;
}

.detail-back-link svg {
    width: 20px;
    height: 20px;
}

.detail-back-link:hover {
    color: var(--primary-dark);
}

[data-theme="dark"] .detail-back-link:hover {
    color: var(--primary);
}

.product-page {
    width: 100%;
    min-height: calc(100vh - 72px - 88px);
}

.product-page-loading {
    padding: 4rem 2rem;
}

.product-page-gallery {
    width: 100%;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border);
}

.product-page-gallery img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}

@media (min-width: 900px) {
    .product-page {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
        max-width: 1200px;
        margin: 0 auto;
        gap: 0;
        min-height: auto;
    }

    .product-page-gallery {
        position: sticky;
        top: 72px;
        height: calc(100vh - 72px - 88px);
        border-bottom: none;
        border-right: 1px solid var(--border);
    }

    .product-page-gallery img {
        max-height: none;
        height: 100%;
    }

    .product-page-content {
        overflow-y: auto;
        max-height: calc(100vh - 72px - 88px);
    }
}

.product-page-inner {
    padding: 1.5rem clamp(1.25rem, 4vw, 2rem) 2rem;
    max-width: 560px;
}

.product-page-title {
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.product-page-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
}

.product-page-bar-inner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem clamp(1rem, 4vw, 2rem);
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom));
    max-width: 1200px;
    margin: 0 auto;
}

.product-page-bar .btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
}

.product-page-bar .btn-cart {
    flex: 0.9;
    background: var(--surface-muted);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.product-page-bar .btn-cart:hover {
    background: var(--border);
    transform: none;
}

/* Detail shared */
.detail-category {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-dark);
    background: var(--primary-soft);
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

[data-theme="dark"] .detail-category {
    color: var(--primary);
}

.detail-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.35;
    margin-bottom: 0.75rem;
}

.detail-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .detail-price {
    color: var(--primary);
}

.detail-stock {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.detail-stock.low {
    color: var(--warning);
    font-weight: 600;
}

.detail-section {
    margin-bottom: 1.25rem;
}

.detail-section h4 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.detail-section p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.detail-specs {
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.detail-specs li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.detail-specs li:last-child {
    border-bottom: none;
}

.detail-specs li span:first-child {
    color: var(--text-muted);
    flex-shrink: 0;
}

.detail-specs li span:last-child {
    font-weight: 600;
    text-align: right;
}

.detail-qty-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.detail-qty-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.25rem;
    display: none;
}

@media (min-width: 480px) {
    .detail-qty-label {
        display: inline;
    }
}

.detail-qty-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.detail-qty-value {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.25rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(15, 118, 110, 0.3);
}

[data-theme="dark"] .btn-primary {
    color: #0f172a;
    box-shadow: none;
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-muted);
    border-color: var(--border-strong);
}

.btn-sm {
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    border-radius: 9px;
}

.btn-block {
    width: 100%;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: var(--surface-muted);
    color: var(--text);
}

/* Forms */
.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--surface-muted);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    background: var(--surface-muted);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.form-hint strong {
    color: var(--text);
    font-weight: 700;
}

/* Cart */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.cart-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.cart-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.close-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.cart-item {
    display: flex;
    gap: 0.85rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-thumb {
    width: 52px;
    height: 68px;
    border-radius: 6px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    object-fit: cover;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.35;
    margin-bottom: 0.2rem;
}

.cart-item-price {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.qty-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.qty-btn:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

[data-theme="dark"] .qty-btn:hover {
    color: var(--primary);
}

.qty-value {
    min-width: 24px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.cart-footer {
    padding: 1.25rem 1.5rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface-muted);
}

.cart-payment-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.cart-total-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.cart-total-value {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.cart-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1.5rem;
}

.cart-empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 14px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.cart-empty-icon svg {
    width: 28px;
    height: 28px;
}

.cart-empty strong {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.modal-header .close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
}

.overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Track orders */
.track-panel {
    max-width: 720px;
}

.track-login-hint {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.track-login-hint a {
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
}

.track-form {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    margin-bottom: 1.5rem;
}

.track-form input {
    flex: 1;
    min-width: 0;
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    background: transparent;
    color: var(--text);
}

.track-form input:focus {
    outline: none;
}

.track-form .btn {
    flex-shrink: 0;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.order-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.35rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-xs);
    transition: all 0.2s ease;
}

.order-card-clickable {
    cursor: pointer;
}

.order-card-clickable:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.order-code {
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
}

.order-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.status-badge.paid { background: var(--success-bg); color: var(--success); }
.status-badge.pending { background: var(--warning-bg); color: var(--warning); }
.status-badge.expired,
.status-badge.failed,
.status-badge.cancelled { background: var(--danger-bg); color: var(--danger); }

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: var(--text);
    color: #fff;
    padding: 0.85rem 1.35rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    max-width: calc(100vw - 2rem);
    text-align: center;
}

[data-theme="dark"] .toast {
    background: var(--surface-elevated);
    color: var(--text);
    border: 1px solid var(--border);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 4rem 2rem;
    grid-column: 1 / -1;
    font-size: 0.9rem;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem clamp(1.25rem, 4vw, 3rem);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--surface);
}

/* Finish page */
.finish-page {
    min-height: 100vh;
    background: var(--bg);
}

.finish-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem clamp(1.25rem, 4vw, 3rem);
    border-bottom: 1px solid var(--border);
    background: var(--header-bg);
    backdrop-filter: blur(16px);
}

.finish-container {
    padding: 2.5rem clamp(1.25rem, 4vw, 3rem) 3rem;
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
}

.finish-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-md);
}

.status-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 2rem;
}

.status-icon.success { background: var(--success-bg); }
.status-icon.warning { background: var(--warning-bg); }
.status-icon.danger { background: var(--danger-bg); }

.finish-card h2 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.finish-card .order-code,
.finish-card .total {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.35rem 0;
}

.finish-card .total strong {
    color: var(--text);
    font-size: 1.1rem;
}

.order-items-list {
    text-align: left;
    list-style: none;
    margin: 1.5rem 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.order-items-list li {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-muted);
}

.order-items-list li:last-child {
    border-bottom: none;
}

.payment-info {
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.payment-info p + p {
    margin-top: 0.35rem;
}

.note {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin-top: 1.25rem;
    line-height: 1.55;
}

/* Mobile nav */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom));
    z-index: 90;
    gap: 0.5rem;
}

.mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
}

.mobile-nav-btn svg {
    width: 22px;
    height: 22px;
}

.mobile-nav-btn.active {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

[data-theme="dark"] .mobile-nav-btn.active {
    color: var(--primary);
}

@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-visual {
        order: -1;
    }

    .hero h1 {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .nav { display: none; }
    .mobile-nav { display: flex; }
    .main { padding-bottom: 5.5rem; }
    .hero h1 { max-width: none; }
    .payment-strip {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* Auth */
.auth-slot {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
}

.auth-back {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
}

.auth-brand h1 {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

.auth-brand p,
.auth-switch,
.auth-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-form {
    margin-top: 1.25rem;
}

.auth-switch {
    margin-top: 1rem;
    text-align: center;
}

.auth-hint {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    text-align: center;
}

/* Account */
.account-page {
    max-width: 1100px;
    margin: 0 auto;
}

.account-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.25rem;
    align-items: start;
}

.account-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
}

.account-card h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .account-grid {
        grid-template-columns: 1fr;
    }

    .auth-slot {
        display: none;
    }
}

/* Admin */
.admin-body {
    background: var(--bg);
}

.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-brand {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem;
}

.admin-brand strong {
    font-size: 1.1rem;
}

.admin-brand span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-nav-btn {
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}

.admin-nav-btn.active,
.admin-nav-btn:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.admin-sidebar-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-main {
    padding: 1.25rem 1.5rem 2rem;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.admin-topbar h1 {
    font-size: 1.35rem;
}

.admin-user {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.admin-panel {
    display: none;
}

.admin-panel.active {
    display: block;
}

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-toolbar h2 {
    font-size: 1.05rem;
}

.admin-table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--surface-muted);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.admin-select,
.admin-form textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
}

.admin-select {
    width: auto;
    min-width: 160px;
}

.admin-modal-content {
    max-width: 520px;
}

.admin-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.admin-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.85rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stat-card span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-card strong {
    font-size: 1.35rem;
}

.stat-card-wide {
    grid-column: span 2;
}

.danger-text {
    color: var(--danger);
}

.order-detail-body {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@media (max-width: 900px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .stat-card-wide {
        grid-column: span 1;
    }
}
