:root {
    --ivory: #0b1626;
    --paper: #12223a;
    --ink: #e3eefc;
    --forest: #2f8ff0;
    --forest-soft: #1976d2;
    --gold: #64b5f6;
    --gold-soft: #2a4a72;
    --muted: #8ea6c4;
    --line: #22385a;
    --danger: #ff6b6b;
    --serif: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    --sans: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--ivory); }
body {
    min-height: 100vh;
    max-width: 820px;
    margin: 0 auto;
    padding: 64px 24px 80px;
    background:
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(66, 165, 245, .18), transparent 70%),
        radial-gradient(ellipse 50% 40% at 0% 100%, rgba(144, 202, 249, .22), transparent 70%);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
body::before {
    display: none;
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .35;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Kepala halaman */
.masthead { margin-bottom: 44px; text-align: center; animation: muncul .7s ease both; }
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .32em;
    text-transform: uppercase;
}
.eyebrow::before, .eyebrow::after { content: ""; width: 36px; height: 1px; background: var(--gold-soft); }
h1 {
    margin: 14px 0 10px;
    color: var(--forest);
    font-family: var(--serif);
    font-size: clamp(34px, 7vw, 48px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.02em;
}
h1 em { color: var(--gold); font-style: normal; }
.tagline { margin: 0; color: var(--muted); font-size: 15px; }
.stats {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-top: 28px;
}
.stat { padding: 0 28px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-value { display: block; color: var(--forest); font-family: var(--serif); font-size: 24px; font-weight: 800; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }

/* Kartu formulir */
.card {
    position: relative;
    margin-bottom: 36px;
    padding: 30px 32px 32px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 16px 40px -20px rgba(0, 0, 0, .6);
    animation: muncul .7s .1s ease both;
}
.card::before {
    display: none;
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(176, 141, 87, .22);
    border-radius: 2px;
    pointer-events: none;
}
.card.editing { border-color: var(--gold-soft); }
#formTitle {
    margin: 0 0 20px;
    color: var(--forest);
    font-family: var(--serif);
    font-size: 19px;
    font-weight: 700;
}
.form-group, .controls { display: flex; gap: 12px; }
.form-group { margin: 0; position: relative; }
input, select {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0f1d31;
    color: var(--ink);
    font: inherit;
    outline: none;
    transition: border-color .25s, box-shadow .25s;
}
input::placeholder { color: #6f86a5; }
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(66, 165, 245, .18); }
input[type="text"], input[type="number"] { flex: 1; }
select {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231e88e5' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}
button {
    padding: 13px 26px;
    border: 1px solid var(--forest);
    border-radius: 10px;
    background: var(--forest);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .25s, color .25s, border-color .25s, transform .15s;
}
button:hover { background: var(--forest-soft); border-color: var(--forest-soft); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.card.editing #submitBtn { background: var(--gold); border-color: var(--gold); color: #fff; }
.card.editing #submitBtn:hover { background: #1e88e5; border-color: #1e88e5; }

/* Kontrol pencarian */
.controls { margin-bottom: 22px; animation: muncul .7s .2s ease both; }
.search-box { flex: 2; padding-left: 44px; background: #0f1d31 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231e88e5' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px center; }
.sort-box { flex: 1; }

/* Daftar barang */
.list-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--forest);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
}
.product-list { margin: 0; padding: 0; list-style: none; counter-reset: item; }
.product-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    padding: 20px 4px;
    border-bottom: 1px solid var(--line);
    counter-increment: item;
    animation: muncul .45s ease both;
    transition: background .25s, padding .25s;
}
.product-item::before {
    content: counter(item, decimal-leading-zero);
    color: var(--gold);
    font-size: 14px;
    font-weight: 700;
    min-width: 24px;
}
.product-item:hover { background: linear-gradient(90deg, rgba(66, 165, 245, .08), transparent); padding-left: 12px; }
.product-info { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.product-name { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.product-price {
    color: var(--forest);
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}
.action-buttons { display: flex; gap: 6px; }
.btn-edit, .btn-delete {
    padding: 8px 14px;
    background: transparent;
    font-size: 13px;
}
.btn-edit { border-color: var(--line); color: var(--forest); }
.btn-edit:hover { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn-delete { border-color: transparent; color: var(--danger); }
.btn-delete:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.no-result {
    padding: 48px 20px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 17px;
    font-weight: 600;
    text-align: center;
}
.no-result small { display: block; margin-top: 6px; font-size: 13px; font-weight: 400; }
footer { margin-top: 48px; color: var(--muted); font-size: 12px; letter-spacing: .1em; text-align: center; }
footer::before { content: ""; display: block; margin-bottom: 10px; color: var(--gold); }

@media (max-width: 640px) {
    body { padding: 40px 16px 60px; }
    .card { padding: 24px 20px; }
    .form-group, .controls { flex-direction: column; }
    .form-group button { width: 100%; }
    .stat { padding: 0 18px; }
    .product-item { grid-template-columns: auto 1fr; gap: 10px 14px; }
    .product-info { flex-direction: column; gap: 2px; }
    .action-buttons { grid-column: 2; }
}
@keyframes muncul {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Navigasi antar halaman */
.nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 auto 36px;
    padding: 6px;
    width: fit-content;
    max-width: 100%;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 8px 24px -16px rgba(30, 136, 229, .35);
}
.nav a {
    padding: 9px 18px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s, color .2s;
}
.nav a:hover { color: var(--forest); background: var(--ivory); }
.nav a[aria-current="page"] { background: var(--forest); color: #fff; }
.nav a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 640px) {
    .nav { border-radius: 16px; }
    .nav a { padding: 8px 12px; font-size: 13px; }
}

.admin-badge {
    position: absolute;
    top: 18px;
    left: 24px;
    color: var(--gold);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
}
@media (max-width: 640px) { .admin-badge { top: 12px; left: 16px; font-size: 12px; } }
