:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e0da;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7974;
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --accent-soft: #cde2fb;
  --series-1: #2a78d6;
  --grid: #e8e6e1;
  --good: #0a7d33; --good-bg: #dff3e6;
  --warn: #8a5a00; --warn-bg: #fdf0d2;
  --info: #1c5cab; --info-bg: #dde9f8;
  --bad: #b42323;  --bad-bg: #fbe1e1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #242422; --border: #33332f;
    --text: #ffffff; --text-2: #c3c2b7; --muted: #94938a;
    --accent: #5598e7; --accent-ink: #0b0b0b; --accent-soft: #184f95;
    --series-1: #3987e5; --grid: #2c2c29;
    --good: #6fd394; --good-bg: #173523; --warn: #f0c060; --warn-bg: #3a2d10;
    --info: #86b6ef; --info-bg: #16304f; --bad: #f08a8a; --bad-bg: #3d1a1a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #242422; --border: #33332f;
  --text: #ffffff; --text-2: #c3c2b7; --muted: #94938a;
  --accent: #5598e7; --accent-ink: #0b0b0b; --accent-soft: #184f95;
  --series-1: #3987e5; --grid: #2c2c29;
  --good: #6fd394; --good-bg: #173523; --warn: #f0c060; --warn-bg: #3a2d10;
  --info: #86b6ef; --info-bg: #16304f; --bad: #f08a8a; --bad-bg: #3d1a1a;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-weight: 800; letter-spacing: -0.02em; }
a { color: var(--accent); }
.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; gap: 8px; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.demo-banner { background: var(--warn-bg); color: var(--warn); padding: 8px 16px; font-size: 13px; text-align: center; }

/* ---------- Halaman order ---------- */
.hero { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: center; padding: 32px 0 8px; }
.cover {
  aspect-ratio: 3/4; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.18);
  background: linear-gradient(160deg, #104281 0%, #1c5cab 55%, #2a78d6 100%); color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; padding: 18px;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.has-img { padding: 0; }
.cover .c-title { font-size: 17px; font-weight: 700; line-height: 1.25; }
.cover .c-author { font-size: 12px; opacity: .85; letter-spacing: .04em; text-transform: uppercase; }
.cover .c-tag { font-size: 11px; opacity: .8; }
.hero h1 { font-size: clamp(22px, 3.2vw, 32px); }
.price { font-size: 26px; font-weight: 700; color: var(--accent); }
.specs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.specs li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 13px; color: var(--text-2); }

.order-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; padding: 24px 0 48px; align-items: start; }
.summary { position: sticky; top: 16px; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 600; margin-bottom: 10px; font-size: 16px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
.req::after { content: " *"; color: var(--bad); }
.field { margin-bottom: 12px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 72px; resize: vertical; }
.qty { display: flex; align-items: center; gap: 0; max-width: 160px; }
.qty button { width: 40px; height: 40px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 18px; cursor: pointer; }
.qty button:first-child { border-radius: 8px 0 0 8px; }
.qty button:last-child { border-radius: 0 8px 8px 0; }
.qty input { text-align: center; border-radius: 0; height: 40px; border-left: 0; border-right: 0; }

.sum-line { display: flex; justify-content: space-between; padding: 6px 0; color: var(--text-2); }
.sum-line b { color: var(--text); font-variant-numeric: tabular-nums; }
.sum-total { border-top: 1px dashed var(--border); margin-top: 8px; padding-top: 12px; font-size: 18px; }
.sum-total b { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; border-radius: 8px; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-wa { background: #1f9e55; color: #fff; border-color: #1f9e55; }

.alert { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-top: 10px; }
.alert-err { background: var(--bad-bg); color: var(--bad); }
.success { text-align: center; max-width: 640px; margin: 40px auto; }
.success .oid { font-family: ui-monospace, Menlo, monospace; font-size: 20px; font-weight: 700; background: var(--surface-2); padding: 6px 12px; border-radius: 8px; display: inline-block; }
.pay { text-align: left; background: var(--surface-2); border-radius: 10px; padding: 14px 16px; margin: 16px 0; }
.hidden { display: none !important; }

/* ---------- Dashboard ---------- */
.login { max-width: 380px; margin: 80px auto; }
.dash-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 24px 0 16px; }
.dash-head h1 { font-size: 26px; margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input, .filters select { width: auto; min-width: 150px; }
.filters input[type=search] { min-width: 220px; flex: 1; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 16px; }
.kpi .k-label { font-size: 13px; color: var(--text-2); }
.kpi .k-value { font-size: clamp(18px, 2.1vw, 24px); white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }

.statuses { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 0;
}
button.chip { cursor: pointer; font: inherit; font-size: 13px; padding: 6px 12px; }
button.chip[aria-pressed=true] { outline: 2px solid currentColor; }
.s-wait { background: var(--warn-bg); color: var(--warn); }
.s-paid, .s-proc { background: var(--info-bg); color: var(--info); }
.s-ship { background: var(--accent-soft); color: var(--text); }
.s-done { background: var(--good-bg); color: var(--good); }
.s-cancel { background: var(--bad-bg); color: var(--bad); }

.charts { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-bottom: 16px; }
.chart-card h3 { font-size: 15px; margin-bottom: 2px; }
.chart-box { position: relative; height: 260px; margin-top: 10px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; cursor: pointer; user-select: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 700; border-top: 2px solid var(--border); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; width: min(640px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.4); }
.dlg-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.dlg-body { padding: 16px 20px; max-height: 70vh; overflow: auto; }
.dlg-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: 14px; margin-bottom: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

@media (max-width: 860px) {
  .order-grid, .charts { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 560px) {
  .hero { grid-template-columns: 1fr; text-align: left; }
  .cover { width: 160px; }
  .row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .filters input, .filters select { min-width: 0; width: 100%; }
}

/* ---------- Label pengiriman ---------- */
.table-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.label-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
th.chk, td.chk { width: 28px; padding-right: 0; cursor: default; }
td.chk input, th.chk input { width: 16px; height: 16px; }
tr.selected { background: var(--accent-soft); }
.dlg-foot > span { flex-wrap: wrap; }

/* ---------- Pembayaran & bukti transfer ---------- */
.bank { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin-bottom: 8px; text-align: left; }
.bank .acc { font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.proof-form { text-align: left; }
.proof-preview { display: block; max-width: 100%; max-height: 220px; margin-top: 8px; border-radius: 8px; border: 1px solid var(--border); }
.alert-ok { background: var(--good-bg); color: var(--good); text-align: left; }
.s-verify { background: var(--bad-bg); color: var(--bad); }
.proof-badge { display: inline-block; margin-top: 4px; font-size: 11px; color: var(--text-2); }
.proof-box { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; background: var(--surface-2); }
.proof-box img { display: block; max-width: 100%; max-height: 420px; margin: 10px auto 0; border-radius: 8px; }

/* ---------- Sinopsis ---------- */
.synopsis { margin-top: 24px; }
.synopsis h2 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.prose { font-size: 15px; line-height: 1.55; color: var(--text); max-width: 80ch; }
.prose p { margin: 0 0 1em; }
.prose h3 { font-size: 15px; font-weight: 600; margin: 1.2em 0 .4em; }
.prose ol, .prose ul { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .5em; }
.prose code { font-family: ui-monospace, Menlo, monospace; font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.prose .parts { list-style: none; padding: 0; }
.prose .parts li { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; }
.prose .signature { font-weight: 700; font-style: italic; margin-top: 1.4em; }
/* Teks tebal di sinopsis memakai warna biru tombol "Pesan Sekarang" */
.prose strong, .prose b, .prose .signature, .synopsis h2, .prose h3 { color: var(--accent); }
.more { margin: 4px 0 18px; }
.more summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; display: inline-block; padding: 4px 0; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: " ▾"; }
.more[open] summary::after { content: " ▴"; }
.more .hide, .more[open] .show { display: none; }
.more[open] .hide { display: inline; }
.more[open] summary { margin-bottom: 8px; }
.more[open] { margin-bottom: 18px; }
#orderForm { scroll-margin-top: 16px; }
@media (max-width: 560px) {
  .synopsis { padding: 18px 16px; }
}

/* ---------- Pre-order ---------- */
.kicker { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.po-badge { background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; }
.promo { margin-top: 24px; display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: center; border-color: var(--accent); }
.promo-eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .02em; }
.promo h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 8px; }
.promo .hl { color: var(--accent); }
.promo-main > p:not(.promo-eyebrow) { margin: 0 0 14px; color: var(--text-2); }
.promo-main b { color: var(--text); }
.quota-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.quota-head b { color: var(--accent); }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .6s ease; }
.waves { display: grid; gap: 10px; }
.wave { position: relative; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; display: grid; gap: 1px; background: var(--surface); }
.wave small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.wave b { font-size: 16px; }
.wave > span { font-size: 13px; color: var(--text-2); }
.wave.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.wave.closed { opacity: .55; }
.wave.closed b { text-decoration: line-through; }
.wave-tag { position: absolute; top: 10px; right: 12px; font-style: normal; font-size: 11px; font-weight: 700; color: var(--accent); }
.wave-tag:empty { display: none; }
.ship-when { margin-top: 12px; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--text); font-size: 13px; }
.ok-batch { margin: 14px auto 0; max-width: 460px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--text); }
@media (max-width: 860px) {
  .promo { grid-template-columns: 1fr; }
}
.po-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.po-box { padding: 14px 16px; display: grid; gap: 6px; }
.po-box .k-label { font-size: 13px; color: var(--text-2); }
.po-box .k-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.po-box .k-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.ok-batch .muted { color: var(--text); opacity: .85; margin-top: 2px; }
/* Stok pre-order live */
.stock { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.stock-num { font-size: 40px; font-weight: 800; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 1.4ch; }
.stock-label { font-size: 14px; font-weight: 600; line-height: 1.3; }
.stock-label small { font-weight: 400; color: var(--muted); font-size: 12px; }
.live-dot { margin-left: auto; align-self: flex-start; font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--bad); display: inline-flex; align-items: center; gap: 5px; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); animation: livepulse 1.6s ease-in-out infinite; }
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .live-dot::before { animation: none; } }

/* ---------- Intip isi buku ---------- */
.peek { border-top: 1px solid var(--border); margin: 6px 0 18px; padding-top: 16px; }
.peek h3 { font-size: 15px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.peek > p { margin: 0 0 10px; }
.peek-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; }
.peek-page { flex: 0 0 auto; position: relative; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: zoom-in; overflow: hidden; scroll-snap-align: start; box-shadow: 0 2px 8px rgba(0,0,0,.12); transition: transform .15s ease; }
.peek-page:hover, .peek-page:focus-visible { transform: translateY(-3px); outline: 2px solid var(--accent); outline-offset: 1px; }
.peek-page img { display: block; width: 110px; height: auto; }
.peek-page span { position: absolute; right: 4px; bottom: 4px; font-size: 11px; font-weight: 700; background: rgba(0,0,0,.6); color: #fff; padding: 1px 6px; border-radius: 999px; }
.peek-pdf { display: inline-block; margin-top: 4px; font-size: 14px; font-weight: 600; }
.viewer { width: min(760px, calc(100vw - 16px)); max-height: calc(100vh - 16px); padding: 0; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); }
.viewer-body { position: relative; background: #e9e8e4; display: flex; justify-content: center; }
.viewer-body img { display: block; max-width: 100%; max-height: calc(100vh - 80px); width: auto; height: auto; background: #fff; touch-action: pan-y pinch-zoom; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; border: 0; border-radius: 8px; background: rgba(0,0,0,.45); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.viewer-nav:hover { background: rgba(0,0,0,.65); }
#viewerPrev { left: 8px; }
#viewerNext { right: 8px; }
@media (max-width: 560px) {
  .viewer-nav { top: auto; bottom: 8px; transform: none; width: 44px; height: 40px; font-size: 26px; }
}
.btn.is-disabled { opacity: .55; pointer-events: none; }
