:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #e4e7ec;
  --text: #101828;
  --muted: #667085;
  --brand: #c2410c;
  --brand-ink: #ffffff;
  --ok: #067647;
  --warn: #b54708;
  --err: #b42318;
  --radius: 10px;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar .grow { flex: 1; }
.logo { font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.logo span { color: var(--brand); }

.wrap { max-width: 960px; margin: 0 auto; padding: 24px 20px 80px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f2f4f7; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--err); }
.btn.sm { padding: 4px 9px; font-size: 13px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
textarea { resize: vertical; min-height: 64px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hint.err { color: var(--err); }
.hint.ok { color: var(--ok); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f2f4f7; color: var(--muted); }
.badge.published { background: #ecfdf3; color: var(--ok); }
.badge.dirty { background: #fffaeb; color: var(--warn); }

/* Login */
.auth { max-width: 380px; margin: 10vh auto; padding: 0 20px; }
.auth .card { padding: 24px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tabs button { flex: 1; }
.tabs button[aria-pressed=true] { background: var(--text); color: #fff; border-color: var(--text); }

/* Senarai page */
.page-list { display: grid; gap: 10px; }
.page-item { display: flex; align-items: center; gap: 12px; }
.page-item .info { flex: 1; min-width: 0; }
.page-item .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

/* Editor kasar Fasa 1 */
.editor { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .editor { grid-template-columns: 1fr; } }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px;
  text-align: center; background: #fff; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, #fff); }
.drop strong { display: block; font-size: 16px; }

.blocks { display: grid; gap: 8px; }
.block { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: start; }
.block .thumb { width: 72px; border-radius: 6px; background: #f2f4f7; overflow: hidden; display: grid; place-items: center; font-size: 11px; color: var(--muted); min-height: 48px; }
.block .thumb img { display: block; width: 100%; height: auto; }
.block .fields > * + * { margin-top: 8px; }
.block .tools { display: flex; flex-direction: column; gap: 4px; }
.block .type { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.progress { font-size: 13px; }
.progress li { margin: 2px 0; }

.errors { background: #fef3f2; border: 1px solid #fecdca; color: var(--err); border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.errors ul { margin: 4px 0 0; padding-left: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 14px; box-shadow: 0 8px 24px rgb(0 0 0/.2); z-index: 100; max-width: calc(100vw - 32px);
}
.toast.err { background: var(--err); }

/* Suis bahasa BM / EN (i18n.js) */
.lang-sw { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font: 600 11.5px/1 system-ui, sans-serif; flex: none; }
.lang-sw span { padding: 5px 7px; border-radius: 6px; color: var(--muted); }
.lang-sw span.on { background: var(--text); color: #fff; }
.lang-sw-auth { position: absolute; top: 16px; right: 16px; }
.ad-foot .lang-sw { align-self: flex-start; margin-bottom: 8px; }

/* Tetapan → Kedai */
.prefix-input { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.prefix-input span { display: flex; align-items: center; padding: 0 10px; background: #f2f4f7; color: var(--muted); font-size: 13px; white-space: nowrap; border-right: 1px solid var(--line); }
.prefix-input input { border: 0 !important; border-radius: 0 !important; flex: 1; min-width: 0; }
.shop-pages { display: grid; gap: 6px; max-height: 240px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }

/* Dialog QR code page (qr.js) */
.qr-dlg { width: min(420px, calc(100vw - 32px)); }
.qr-dlg form { display: grid; gap: 10px; }
.qr-title { margin: -4px 0 0; color: var(--muted); font-size: 14px; }
.qr-box { width: min(260px, 70vw); margin: 4px auto 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-url { margin: 0; text-align: center; font: 12px ui-monospace, monospace; color: var(--muted); word-break: break-all; }
.qr-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qr-row input[type=color] { width: 36px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; vertical-align: middle; margin-left: 6px; }
.qr-dlg .cdlg-act { flex-wrap: wrap; margin-top: 6px; }
.qr-dlg .cdlg-act .btn { min-width: 0; }

/* Dialog pengesahan (confirmDialog dalam api.js) */
.cdlg { border: 0; padding: 0; border-radius: 16px; width: min(400px, calc(100vw - 32px)); background: #fff; color: var(--text); box-shadow: 0 0 0 1px rgb(16 24 40/.06), 0 24px 64px -16px rgb(16 24 40/.35); }
.cdlg::backdrop { background: rgb(16 24 40/.45); backdrop-filter: blur(2px); }
.cdlg[open] { animation: cdlg-in .22s cubic-bezier(.16,1,.3,1); }
.cdlg[open]::backdrop { animation: cdlg-fade .2s ease; }
@keyframes cdlg-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes cdlg-fade { from { opacity: 0; } }
.cdlg form { padding: 22px 22px 18px; }
.cdlg-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #eff8ff; color: #175cd3; margin-bottom: 14px; }
.cdlg.danger .cdlg-ic { background: #fef3f2; color: var(--err); }
.cdlg-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cdlg h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.cdlg p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.cdlg-act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.cdlg-act .btn { min-width: 96px; }
.btn.danger-fill { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger-fill:hover { filter: brightness(.94); }
@media (max-width: 480px) { .cdlg-act { flex-direction: column-reverse; } .cdlg-act .btn { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .cdlg[open], .cdlg[open]::backdrop { animation: none; } }

/* ===== Editor Fasa 2 ===== */
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.center { text-align: center; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fld + .fld { margin-top: 10px; }
.progress .err { color: var(--err); }

.save-state { color: var(--muted); white-space: nowrap; }
.save-state[data-state=saving], .save-state[data-state=dirty] { color: var(--warn); }
.save-state[data-state=error], .save-state[data-state=conflict] { color: var(--err); font-weight: 600; }

.banner { background: #fffaeb; border-bottom: 1px solid #fedf89; color: var(--warn); padding: 10px 20px; display: flex; gap: 12px; align-items: center; font-size: 14px; }
.ed-errors { margin: 12px 20px 0; }

.ed { display: grid; grid-template-columns: minmax(340px, 460px) 1fr; gap: 24px; padding: 16px 20px 40px; max-width: 1200px; margin: 0 auto; align-items: start; }
.ed-tabs { position: sticky; top: 57px; z-index: 5; background: var(--bg); padding: 4px 0 8px; margin: 0; }
.ed-tabs [aria-selected=true] { background: var(--text); color: #fff; border-color: var(--text); }
.drop.compact { padding: 16px; }
.add-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.ed-preview { position: sticky; top: 72px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pv-bar { display: flex; gap: 14px; align-items: center; width: 391px; justify-content: space-between; }
.phone { width: 391px; height: min(780px, calc(100vh - 150px)); border: 8px solid #101828; border-radius: 32px; overflow: hidden; background: #fff; box-shadow: 0 20px 40px rgb(16 24 40/.18); }
.phone iframe { width: 375px; height: 100%; border: 0; display: block; }

@media (max-width: 900px) {
  .ed { grid-template-columns: 1fr; }
  .ed-preview { position: static; }
}

/* Kad block */
.blocks2 { display: grid; gap: 6px; }
.blk { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.blk.open { border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb; }
.blk-ghost { opacity: .4; }
.blk-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
.handle { cursor: grab; color: #98a2b3; padding: 6px 2px; user-select: none; letter-spacing: -2px; font-weight: 700; touch-action: none; }
.handle:active { cursor: grabbing; }
.blk-thumb { width: 40px; height: 40px; border-radius: 6px; background: #f2f4f7; overflow: hidden; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.blk-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.blk-title { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 4px; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; }
.blk-title .type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.blk-title .sum { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.icon { border: 0; background: none; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 14px; flex: none; }
.icon:hover { background: #f2f4f7; color: var(--text); }
.icon.danger:hover { color: var(--err); }
.blk-body { padding: 4px 14px 14px; border-top: 1px solid var(--line); padding-top: 12px; }

.ti-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.ti { position: relative; aspect-ratio: 3/4; border-radius: 6px; overflow: hidden; background: #f2f4f7; }
.ti img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.ti .icon { position: absolute; top: 2px; right: 2px; background: rgb(255 255 255/.9); width: 24px; height: 24px; font-size: 12px; }
.ti.add { display: grid; place-items: center; border: 2px dashed var(--line); background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0; }
.ti.add:hover { border-color: var(--brand); color: var(--brand); }
.faq-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 10px 0; display: grid; gap: 6px; }

/* Contoh Google */
.serp { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; font-family: Arial, sans-serif; }
.serp-url { font-size: 12px; color: #4d5156; }
.serp-title { font-size: 18px; color: #1a0dab; line-height: 1.3; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-desc { font-size: 13px; color: #4d5156; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Topbar editor pada skrin sempit */
.badge { white-space: nowrap; }
.ed-body .topbar { flex-wrap: wrap; row-gap: 8px; }
.ed-body .topbar .grow { min-width: 120px; }
@media (max-width: 700px) {
  .ed-body .topbar { padding: 10px 12px; }
  .ed { padding: 12px; }
  .pv-bar, .phone { width: 100%; max-width: 391px; }
  .phone iframe { width: 100%; }
  .ed-tabs { top: 0; position: static; }
}

/* ===== Fasa 3: nav, order, tetapan ===== */
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a { text-decoration: none; padding: 6px 10px; border-radius: 6px; font-weight: 600; color: var(--muted); font-size: 14px; }
.nav a:hover { background: #f2f4f7; color: var(--text); }
.nav a[aria-current=page] { color: var(--text); background: #f2f4f7; }

.badge.ok { background: #ecfdf3; color: var(--ok); }
.badge.warn { background: #fffaeb; color: var(--warn); }
.badge.err { background: #fef3f2; color: var(--err); }
.badge.info { background: #eff8ff; color: #175cd3; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.chip b { color: var(--muted); margin-left: 2px; }
.chip[aria-pressed=true] { background: var(--text); color: #fff; border-color: var(--text); }
.chip[aria-pressed=true] b { color: #d0d5dd; }

.orders { display: grid; gap: 8px; }
.order { padding: 0; }
.order summary { list-style: none; display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; align-items: center; }
.order summary::-webkit-details-marker { display: none; }
.order[open] summary { border-bottom: 1px solid var(--line); }
.o-main { flex: 1; min-width: 0; }
.o-main > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.o-body { padding: 12px 16px 16px; display: grid; gap: 12px; }
.o-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: 14px; }
.o-grid .span2 { grid-column: span 2; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }

/* Editor: borang order */
.pkg { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 8px 0; display: grid; gap: 6px; }
.money { position: relative; }
.money::before { content: "RM"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }
.money input { padding-left: 34px !important; }
.sub-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }

/* Log CAPI */
table.log { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text); }
table.log th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.log td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.log td.ok { color: var(--ok); }
table.log td.err { color: var(--err); cursor: help; }

/* ===== Fasa 5: lead ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 22px; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--muted); }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.lead { display: flex; gap: 12px; align-items: center; padding: 12px 16px; }
.lead .o-side { gap: 6px; }
#tpl-card summary { cursor: pointer; }
.preview-msg { white-space: pre-wrap; background: #dcf8c6; border-radius: 10px 10px 10px 2px; padding: 10px 12px; font-size: 14px; max-width: 420px; }
code { background: #f2f4f7; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
@media (max-width: 600px) { .lead { flex-direction: column; align-items: stretch; } .lead .o-side { align-items: flex-start; } }

/* ===== Fasa 6: statistik ===== */
:root { --viz: #2563eb; --viz-hover: #1d4ed8; --grid: #eaecf0; }
.stats5 { grid-template-columns: 1.3fr repeat(4, 1fr); }
@media (max-width: 760px) { .stats5 { grid-template-columns: repeat(2, 1fr); } .stats5 .hero { grid-column: span 2; } }
.stat.hero b { font-size: 34px; }
.stat > span:first-child { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--text); color: #fff; }

.chart { margin-top: 10px; }
.chart svg { display: block; overflow: visible; max-width: 100%; }
.chart .bar { fill: var(--viz); }
.chart .col.on .bar { fill: var(--viz-hover); }
.chart .hit { fill: transparent; }
.chart .grid { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .base { stroke: #d0d5dd; stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; }

.funnel { display: grid; gap: 2px; }
.f-row { display: grid; grid-template-columns: 44px 1fr 64px; gap: 12px; align-items: center; padding: 8px 6px; border-radius: 8px; }
.f-row:hover { background: #f9fafb; }
.f-thumb { width: 44px; height: 44px; border-radius: 6px; overflow: hidden; background: #f2f4f7; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.f-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.f-label { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-n { color: var(--muted); }
.f-track { height: 14px; margin-top: 6px; }
.f-bar { height: 100%; background: var(--viz); border-radius: 0 4px 4px 0; min-width: 2px; }
.f-val { text-align: right; line-height: 1.2; }
.f-val b { display: block; font-size: 16px; }
.f-val span { font-size: 12px; color: var(--muted); }
.f-drop { font-size: 12px; color: var(--muted); margin-top: 4px; }
.f-flag { font-size: 12px; font-weight: 600; color: var(--warn); margin-top: 4px; }
.f-row.worst { background: #fffaeb; }

.tip { position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none; background: var(--text); color: #fff; font-size: 13px; line-height: 1.4; padding: 6px 10px; border-radius: 6px; max-width: 280px; box-shadow: 0 6px 16px rgb(0 0 0/.2); }

/* Seksyen & template */
.blk-hint { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 0 0 10px; }
.blk-title .sum.todo { color: var(--warn); font-style: italic; }
.sec-img-edit { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; margin-top: 10px; }
.sec-img-edit img { width: 96px; border-radius: 6px; display: block; }
.sec-add { aspect-ratio: auto; padding: 22px; margin-top: 10px; }
.cmp-row { display: grid; grid-template-columns: 1fr 1fr 1fr 30px; gap: 6px; margin-top: 6px; align-items: center; }

/* Pelan & bil */
.banner.err { background: #fef3f2; border-bottom-color: #fecdca; color: var(--err); }
.plan-banner a { color: inherit; font-weight: 700; }
.usage { display: grid; gap: 10px; }
.u-track { height: 8px; border-radius: 999px; background: #f2f4f7; overflow: hidden; margin-top: 4px; }
.u-bar { height: 100%; background: var(--ok); border-radius: inherit; }
.u-row.over .u-bar { background: var(--warn); }
.u-row.over b { color: var(--warn); }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: start; }
@media (max-width: 760px) { .plans { grid-template-columns: 1fr; } }
.plan { display: flex; flex-direction: column; gap: 8px; }
.plan.featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan .badge { align-self: flex-start; }
.plan .price b { font-size: 28px; }
.plan .price span { color: var(--muted); }
.plan ul { list-style: none; margin: 0; padding: 0; font-size: 14px; display: grid; gap: 4px; }
.plan li.no { color: var(--muted); text-decoration: line-through; }
.locked-note { background: #fffaeb; border: 1px solid #fedf89; color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.locked-note a { color: inherit; font-weight: 700; }
.plan-head { flex-wrap: wrap; }
/* Nav 5 pautan: skrol mendatar di skrin kecil, jangan tolak butang log keluar keluar skrin */
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 10px 12px; }
  .nav { margin-left: 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav a { padding: 6px 8px; white-space: nowrap; }
  .topbar .grow { display: none; }
  .topbar #who { display: none; }
}

/* ===== Panel admin platform (/app/admin/): susun atur sendiri, berasingan dari dashboard seller ===== */
.table-wrap { overflow-x: auto; }
.admin-table td { vertical-align: top; }
.admin-table td, .admin-table th { white-space: nowrap; }
body.admin { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.ad-side { background: #101828; color: #d0d5dd; display: flex; flex-direction: column; gap: 20px; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.ad-brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 17px; padding: 0 8px; display: flex; align-items: center; gap: 8px; }
.ad-brand span { color: #fb923c; }
.ad-brand em { font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: #344054; color: #fff; padding: 2px 7px; border-radius: 999px; }
.ad-nav { display: grid; gap: 2px; }
.ad-nav a { color: #d0d5dd; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.ad-nav a:hover { background: #1d2939; color: #fff; }
.ad-nav a[aria-current=page] { background: #344054; color: #fff; }
.ad-foot { margin-top: auto; display: grid; gap: 8px; font-size: 13px; padding: 0 8px; }
.ad-foot a { color: #d0d5dd; }
.ad-foot .who { color: #98a2b3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-foot button { justify-self: start; background: none; border: 1px solid #475467; color: #d0d5dd; border-radius: 8px; padding: 5px 10px; font: inherit; cursor: pointer; }
.ad-main { padding: 28px 32px 80px; max-width: 1180px; width: 100%; min-width: 0; }
.ad-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.ad-sub { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.ad-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ad-list { list-style: none; margin: 8px 0 0; padding: 0; }
.ad-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ad-list li:first-child { border-top: 0; }
.ad-list .muted { font-size: 13px; }
.ad-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.ad-tools input[type=search] { width: auto; min-width: 240px; }
@media (max-width: 860px) {
  body.admin { grid-template-columns: 1fr; }
  .ad-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 10px; }
  .ad-nav { display: flex; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .ad-nav a { white-space: nowrap; }
  .ad-foot { margin: 0 0 0 auto; display: flex; align-items: center; }
  .ad-foot .who { display: none; }
  .ad-main { padding: 20px 16px 60px; }
  .ad-grid2 { grid-template-columns: 1fr; }
  .ad-tools input[type=search] { min-width: 0; flex: 1; }
}
.plan-mix { display: grid; gap: 8px; }
.mix-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #f2f4f7; gap: 2px; }
.mix-bar span { display: block; height: 100%; }
.mix-legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); }
.mix-legend b { color: var(--text); }
.mix-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.mix-asas { background: #98a2b3; }
.mix-pro { background: var(--brand); }
.mix-agensi { background: #175cd3; }
.admin-link { font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 4px 9px; border: 1px dashed var(--line); border-radius: 6px; white-space: nowrap; }
.admin-link:hover { color: var(--text); border-color: var(--muted); }
.ad-main a b { color: var(--text); }
.admin-table a { text-decoration: none; }
.admin-table a:hover b { text-decoration: underline; }

/* Rupa & dekorasi */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.theme-card { border: 2px solid var(--line); border-radius: 10px; padding: 10px; text-align: left; cursor: pointer; display: grid; gap: 4px; font: inherit; }
.theme-card[aria-pressed=true] { border-color: #2563eb; box-shadow: 0 0 0 2px #bfdbfe; }
.theme-card b { font-size: 13px; }
.theme-card small { font-size: 11px; opacity: .75; }
.theme-card .sw { display: flex; gap: 4px; }
.theme-card .sw i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgb(0 0 0/.12); }
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.clr { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; margin: 0; cursor: pointer; }
.clr input[type=color] { width: 36px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.blk-style { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 4px; }

/* Grid & kotak pilihan boleh mengecil (elak skrol mendatar di skrin sempit) */
.row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ed > * { min-width: 0; }
select { max-width: 100%; }
.blocks2 { grid-template-columns: minmax(0, 1fr); }
.blk, .blk-head, .blk-title { min-width: 0; }

/* Medan sebelah-menyebelah: jangan tolak kolum kanan ke bawah */
.row2 > .fld + .fld, .row2 > * + * { margin-top: 0; }
.row2 { align-items: start; }
/* Panel reseller: susun atur sama dengan panel admin, warna sidebar berbeza supaya jelas panel mana */
body.reseller .ad-side { background: #0c2a24; }
body.reseller .ad-nav a:hover { background: #12392f; }
body.reseller .ad-brand em { background: #1d5c4b; }
.price-calc { background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 6px; max-width: 420px; }
