:root {
    --bg: #f3f7fb;
    --bg-2: #e9eef6;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-solid: #ffffff;
    --surface-soft: #f8fbff;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --accent: #22c55e;
    --line: #dbe5f1;
    --ok: #16a34a;
    --warn: #f59e0b;
    --bad: #dc2626;
    --shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] {
    --bg: #0b1220;
    --bg-2: #1c2740;
    --surface: rgba(15, 23, 42, 0.78);
    --surface-solid: #111c31;
    --surface-soft: #1b2a45;
    --text: #e5ecff;
    --muted: #a4b0c6;
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --accent: #34d399;
    --line: #2b3a59;
    --shadow: 0 16px 46px rgba(3, 8, 20, 0.55);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", "Nunito Sans", "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 0%, var(--bg-2) 0%, transparent 48%),
        radial-gradient(circle at 88% 100%, rgba(79, 70, 229, 0.16) 0%, transparent 38%),
        var(--bg);
    min-height: 100vh;
    transition: background .25s ease, color .25s ease;
}

.shell { width: min(1140px, 94%); margin: 0 auto; }
.hidden { display: none !important; }
.mt-sm { margin-top: 10px; }
.lead-gap-sm { margin-top: 8px !important; }
.whitespace-preline { white-space: pre-line; }

.nav-wrap {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--surface-solid) 86%, transparent);
    border-bottom: 1px solid var(--line);
}

.nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.brand {
    text-decoration: none;
    color: var(--text);
    font-weight: 900;
    letter-spacing: .3px;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 22%, transparent);
}

.menu { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.menu a {
    text-decoration: none;
    color: var(--muted);
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    font-weight: 800;
    border: 1px solid transparent;
    background: transparent;
    transition: .18s ease;
}

.menu a:hover,
.menu a.active {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 30%, transparent);
    transform: translateY(-1px);
}

.menu a i { margin-right: 7px; font-size: 14px; }

.theme-toggle {
    height: 40px;
    width: 40px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-solid);
    color: var(--text);
    cursor: pointer;
}

.menu-toggle {
    display: none;
    height: 40px;
    width: 40px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-solid);
    color: var(--text);
    cursor: pointer;
}

.menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(15, 23, 42, 0.45);
}

.menu-backdrop.is-open { display: block; }

.hero, .section-head, .auth-box {
    margin: 20px 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.hero {
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--primary) 20%, transparent) 0%, transparent 45%),
        var(--surface);
}

.hero h1, .section-head h1, .auth-box h1 {
    margin: 0 0 8px;
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.lead, .section-head p, .auth-box p { margin: 0; color: var(--muted); }

.pill {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 11%, transparent);
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 32%, transparent);
    font-size: 12px;
    font-weight: 800;
}

.flash {
    margin-top: 14px;
    border-radius: 12px;
    padding: 11px 14px;
    border: 1px solid;
    font-weight: 700;
}

.flash.success { background: #ecfdf3; color: #166534; border-color: #b7efcf; }
.flash.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.btn {
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 15px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 25%, transparent);
    transition: .18s ease;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
.btn.ghost { background: var(--surface-solid); color: var(--text); border-color: var(--line); box-shadow: none; }
.btn.danger { background: linear-gradient(180deg, #f87171 0%, #dc2626 100%); }

.category-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.category-row-lg { margin-bottom: 16px; }

.chip {
    border: 1px solid var(--line);
    background: var(--surface-solid);
    color: var(--muted);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
}

.chip.active,
.chip:hover {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 34%, transparent);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.cards, .plans {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.card, .plan, .cart-item, .order-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.card h3, .plan h3 { margin: 0 0 8px; font-size: 1.04rem; }

.product-image-placeholder {
    margin: 0 0 10px;
    width: 100%;
    min-height: 170px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--muted);
    display: grid;
    place-items: center;
    font-weight: 700;
}

.product-card-image {
    width: 100%;
    height: 170px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-solid);
}

.status {
    margin-top: 10px;
    display: inline-block;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 800;
}

.status.ready { color: #166534; background: #dcfce7; }
.status.po { color: #92400e; background: #fef3c7; }

.product-tile {
    padding: 0;
    overflow: hidden;
    cursor: pointer;
}

.product-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.16);
}

.product-tile-media {
    position: relative;
    height: 300px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 5%, transparent) 0%, transparent 100%);
    display: grid;
    place-items: center;
    padding: 12px;
}

.product-tile-media img {
    width: 100%;
    height: calc(100% - 54px);
    object-fit: contain;
}

.product-tile-badge {
    position: absolute;
    top: 12px;
    z-index: 1;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-solid) 90%, transparent);
}

.product-tile-badge-left { left: 12px; }
.product-tile-badge-right { right: 12px; }
.product-tile-badge.is-ready { color: #047857; }
.product-tile-badge.is-po { color: #be123c; }

.product-tile-name {
    margin: 0;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 54px;
    padding: 8px 10px;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .78);
    text-align: center;
    font-size: 1.05rem;
    font-weight: 900;
    display: grid;
    place-items: center;
}

.product-tile-foot {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--line);
    background: var(--surface-solid);
}

.product-tile-variant {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.product-tile-price {
    margin: 6px 0 0;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 900;
}

.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.product-detail-breadcrumb {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.product-detail-media,
.product-detail-main {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-solid);
}

.product-detail-media {
    min-height: 260px;
    overflow: hidden;
}

.product-detail-media img {
    width: 100%;
    height: 100%;
    min-height: 260px;
    object-fit: contain;
}

.product-detail-main { padding: 12px; }

.product-detail-pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.product-detail-pill {
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid var(--line);
    background: var(--surface-soft);
}

.product-detail-pill.is-ready {
    color: #047857;
    border-color: #8ee0c0;
    background: #ecfdf5;
}

.product-detail-pill.is-po {
    color: #be123c;
    border-color: #f7b2c1;
    background: #fff1f2;
}

.product-detail-meta { margin: 6px 0 0; color: var(--muted); font-weight: 700; }
.product-detail-price { margin: 10px 0 0; color: var(--primary); font-size: 1.12rem; font-weight: 900; }
.product-detail-promo {
    display: inline-block;
    margin: 10px 0 0;
    border-radius: 8px;
    padding: 4px 9px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 800;
}

.product-detail-section { margin-top: 12px; }
.product-detail-desc {
    margin-top: 0;
    padding: 12px;
    border-radius: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.qty-control {
    display: grid;
    grid-template-columns: 46px 1fr 46px;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    height: 46px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
    font-size: 24px;
    font-weight: 900;
    cursor: pointer;
    line-height: 1;
}

.qty-input { text-align: center; font-weight: 800; }

.inline-form { display: grid; gap: 8px; margin-top: 12px; }
.inline-form input[type="number"] { width: 100%; }

.cart-list, .order-list { display: grid; gap: 12px; }
.cart-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: center;
}

.cart-item-main {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.cart-item-image-wrap { margin: 0; }

.cart-item-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-solid);
    display: block;
}

.cart-actions {
    display: grid;
    gap: 10px;
    align-items: start;
    margin-top: 10px;
}

.cart-update-form,
.cart-remove-form {
    display: none;
}

.cart-qty-control {
    display: grid;
    grid-template-columns: 46px minmax(54px, auto) 46px;
    align-items: center;
    gap: 8px;
    justify-content: start;
}

.cart-qty-btn {
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.cart-qty-number {
    min-width: 54px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-solid);
    display: grid;
    place-items: center;
    font-weight: 900;
    color: var(--text);
    padding: 0 8px;
}

.cart-total { font-size: 1.08rem; font-weight: 900; margin-top: 14px; }

.preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 90;
}

.preview-modal-card {
    width: min(920px, 100%);
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.preview-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.order-item-image {
    width: 100%;
    max-width: 220px;
    max-height: 130px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
}

.auth-box,
.card,
.order-item,
.plan {
    animation: fadeUp .35s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.member-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.member-info p { margin: 0; }

.member-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.06rem;
}

.member-role {
    font-size: 11px;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--primary);
    font-weight: 800;
}

.member-meta {
    margin-top: 8px !important;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.dot-sep { opacity: .45; }

.meta-active,
.meta-inactive {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 800;
}

.meta-active { color: #166534; background: #dcfce7; }
.meta-inactive { color: #991b1b; background: #fee2e2; }

.member-actions {
    margin-top: 0 !important;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px !important;
    flex-wrap: wrap;
}

.member-item .inline-form { margin-top: 0; }

.member-btn {
    min-width: 90px;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 10px !important;
    padding: 0 12px !important;
    font-size: 13px;
}

.member-reset-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.member-reset-mode {
    min-width: 172px;
    height: 38px;
    margin: 0;
}

.member-btn-danger {
    background: #fff0ee !important;
    color: #b42318 !important;
    border: 1px solid #f4b4ad !important;
    box-shadow: none !important;
}

.member-btn-danger:hover {
    background: #dc2626 !important;
    color: #fff !important;
    border-color: #dc2626 !important;
}

.variant-block {
    margin-top: 14px;
    margin-left: 12px;
    padding-left: 14px;
    border-left: 3px solid color-mix(in srgb, var(--primary) 40%, transparent);
}

.variant-list .variant-item {
    background: color-mix(in srgb, var(--surface-soft) 88%, transparent);
}

#log-content {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 70vh;
    overflow: auto;
    background: #111827;
    color: #e5e7eb;
    padding: 14px;
    border-radius: 10px;
}

.form-grid { display: grid; gap: 12px; }
.form-hint { display: block; opacity: .8; margin-top: 4px; }
.code-area { font-family: Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; }
.admin-thumb { max-width: 140px; border-radius: 10px; border: 1px solid var(--line); }
.preview-image { max-width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

label { display: grid; gap: 7px; font-weight: 700; color: var(--text); }

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text);
    background: var(--surface-solid);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--primary) 60%, white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.footer {
    margin-top: 18px;
    padding: 24px 0 36px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}
.footer-copy { text-align: center; width: 100%; margin: 0; }

.auth-shell {
    min-height: calc(100vh - 220px);
    display: grid;
    align-items: center;
    padding: 20px 0;
}

.auth-panel {
    width: min(560px, 100%);
    margin-inline: auto;
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--primary) 18%, transparent) 0%, transparent 45%),
        var(--surface);
}

.auth-form .btn {
    width: 100%;
    margin-top: 6px;
}

.auth-alt {
    margin-top: 14px;
    border: 1px dashed color-mix(in srgb, var(--primary) 28%, var(--line));
    border-radius: 12px;
    background: var(--surface-soft);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.auth-alt p { margin: 0; color: var(--muted); font-weight: 700; }

.auth-email-hint {
    margin-top: 10px !important;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
}

.qris-payment-box {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    align-items: start;
}

.qris-payment-img-wrap {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 10px;
}

.qris-payment-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.qris-payment-meta p {
    margin: 0 0 8px;
}

@media (max-width: 980px) {
    .cards, .plans { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
    .nav { flex-wrap: wrap; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; order: 2; margin-left: auto; }
    .theme-toggle { order: 3; }
    .menu {
        position: fixed;
        z-index: 40;
        top: 0;
        right: -280px;
        width: 260px;
        height: 100vh;
        padding: 76px 14px 14px;
        margin: 0;
        background: var(--surface-solid);
        border-left: 1px solid var(--line);
        box-shadow: var(--shadow);
        display: grid;
        align-content: start;
        transition: right .22s ease;
    }
    .menu.is-open { right: 0; }
    .menu a {
        justify-content: flex-start;
        width: 100%;
    }
    .member-head {
        flex-direction: column;
        align-items: flex-start;
    }
    .member-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .member-reset-form {
        width: 100%;
        flex-wrap: wrap;
    }
    .member-reset-mode {
        flex: 1 1 100%;
        min-width: 0;
    }
    .variant-block {
        margin-left: 0;
        padding-left: 10px;
    }
    .cart-item { grid-template-columns: 1fr; }
    .cart-item-main { grid-template-columns: 1fr; }
    .cart-item-image { height: 170px; }
    .product-detail-layout { grid-template-columns: 1fr; }
    .product-detail-media,
    .product-detail-media img { min-height: 220px; }
}

@media (max-width: 640px) {
    .cards, .plans { grid-template-columns: 1fr; }
    .hero, .section-head, .auth-box { padding: 16px; border-radius: 14px; }
    .auth-alt { flex-direction: column; align-items: flex-start; }
    .qris-payment-box { grid-template-columns: 1fr; }
}
