/* Deck Studio — UI generator deck (desain: admin tool netral + satu accent emas) */
:root {
  --paper: #f7f6f3;
  --panel: #ffffff;
  --panel-2: #fbfaf8;
  --ink: #23211d;
  --ink-2: #4a4741;
  --muted: #84807a;
  --line: #e7e4dd;
  --line-2: #ddd9d0;
  --gold: #c09f63;
  --gold-ink: #2a2312;
  --gold-deep: #8f6f3e;
  --gold-soft: #f4ecdc;
  --ok: #4f7a3f;
  --err: #a8433a;
  --shadow: 0 1px 2px rgba(40, 36, 26, .04), 0 8px 24px rgba(40, 36, 26, .06);
  --r-card: 12px;
  --r-inp: 10px;
  --dur: 140ms;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191817;
    --panel: #21201e;
    --panel-2: #262523;
    --ink: #ece9e3;
    --ink-2: #c8c4bd;
    --muted: #8f8b84;
    --line: #34322f;
    --line-2: #44413d;
    --gold: #c9a86d;
    --gold-ink: #241d10;
    --gold-deep: #e0c188;
    --gold-soft: #332b1b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
html { scrollbar-color: var(--line-2) transparent; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: 58px; padding: 0 20px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; }
.tick {
  width: 5px; height: 30px; border-radius: 3px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
}
.brand-t { display: flex; flex-direction: column; line-height: 1.15; }
.brand-t strong { font-size: 15.5px; letter-spacing: .2px; }
.brand-t span { font-size: 11px; color: var(--muted); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.savestate { font-size: 12px; color: var(--muted); }
.savestate.flash { color: var(--gold-deep); font-weight: 600; }
.lang {
  display: inline-flex; padding: 2px; gap: 2px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel);
}
.langbtn {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .4px;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.langbtn:hover { color: var(--ink); }
.langbtn[aria-pressed="true"] { background: var(--gold-soft); color: var(--gold-deep); }

/* ---------- layout ---------- */
.wrap {
  max-width: 1600px; margin: 0 auto; padding: 20px 20px 64px;
  display: grid; grid-template-columns: minmax(430px, 540px) minmax(0, 1fr); gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) { .wrap { grid-template-columns: 1fr; } }
.col-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.col-preview { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* ---------- cards ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 16px 18px 18px;
}
.card h2 {
  margin: 0 0 14px; font-size: 13px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase; color: var(--ink);
  display: flex; align-items: center; gap: 9px;
}
.card h2::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px; flex: none;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
}
.card.collapsible .chead {
  display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 0;
  user-select: none;
}
.card.collapsible .chev { margin-left: auto; color: var(--muted); transition: transform var(--dur); }
.card.collapsible[open] .chev, .card.collapsible.open .chev { transform: rotate(180deg); }
.card-body.off { display: none; }
.badge {
  font-size: 11px; font-weight: 700; letter-spacing: .4px; color: var(--gold-deep);
  background: var(--gold-soft); border: 1px solid var(--line);
  padding: 2px 10px; border-radius: 999px; max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- form ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 14px; }
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.f > span { color: var(--ink-2); }
.f input[type="text"], .f textarea, .f select, .filebtn {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-2);
  border-radius: var(--r-inp); background: var(--panel-2); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 400;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.f input[type="text"]:focus, .f textarea:focus, .f select:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent);
}
textarea { resize: vertical; min-height: 70px; line-height: 1.6; }
.f small.hint { font-weight: 400; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
input[type="color"] {
  width: 46px; height: 38px; padding: 2px; border: 1px solid var(--line-2);
  border-radius: var(--r-inp); background: var(--panel-2); cursor: pointer;
}
.colorwrap { display: flex; gap: 8px; }
.colorwrap input[type="text"] { flex: 1; }
.f-inline { flex: 1; }
.logo-row { display: flex; gap: 14px; align-items: flex-start; margin: 12px 0; }
.logo-prev {
  flex: 0 0 170px; height: 56px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line-2); border-radius: var(--r-inp); background: var(--panel-2);
  color: var(--muted); font-size: 11.5px; overflow: hidden; padding: 6px;
}
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-ctl { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.filebtn { position: relative; display: flex; align-items: center; cursor: pointer; color: var(--ink-2); }
.filebtn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chkline { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); margin: 10px 0 2px; }
.chkline input { accent-color: var(--gold-deep); width: 15px; height: 15px; }
.contacts { margin-top: 4px; }

/* scope meta */
.scope-meta { display: flex; align-items: center; gap: 18px; margin-top: 10px; flex-wrap: wrap; }
.count { font-size: 12.5px; color: var(--muted); }
.count b { color: var(--ink); font-size: 14px; }
.mini { display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; font-size: 12px; color: var(--ink-2); }
.mini input { padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel-2); color: var(--ink); font: inherit; font-size: 13px; }
.mini input:focus { outline: none; border-color: var(--gold); }

/* ---------- slide toggles ---------- */
.toggles { display: flex; flex-direction: column; }
.tog-sec { margin-bottom: 14px; }
.tog-sec:last-child { margin-bottom: 0; }
.tog-sec h3 {
  margin: 0 0 8px; font-size: 11px; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.tog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
@media (max-width: 820px) { .tog-grid { grid-template-columns: 1fr; } }
.tog {
  display: flex; align-items: center; gap: 9px; padding: 6px 4px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  border-radius: 8px; cursor: pointer; transition: color var(--dur), background var(--dur);
}
.tog:hover { color: var(--ink); background: color-mix(in srgb, var(--gold) 7%, transparent); }
.tog input { accent-color: var(--gold-deep); width: 16px; height: 16px; flex: 0 0 auto; }
.tog .tg-meta { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 400; }

/* ---------- buttons ---------- */
.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.bar.self-end { align-self: end; }
.btn {
  border: 1px solid var(--line-2); border-radius: var(--r-inp);
  padding: 9px 16px; font: inherit; font-size: 13.5px; font-weight: 650;
  color: var(--ink); background: var(--panel); cursor: pointer;
  transition: transform var(--dur), box-shadow var(--dur), border-color var(--dur), background var(--dur);
}
.btn:hover { border-color: var(--gold); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, .iconbtn:focus-visible, .segbtn:focus-visible, .langbtn:focus-visible,
.addbtn:focus-visible, .row-x:focus-visible, .dl:focus-visible, .grip:focus-visible {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 28%, transparent);
}
.btn.primary {
  padding: 10px 18px;
  background: var(--gold); border-color: var(--gold-deep); color: var(--gold-ink);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--gold) 35%, transparent);
}
.btn.primary:hover { background: var(--gold-deep); color: #fff; }
.btn.ghost { background: var(--panel-2); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }
.iconbtn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--ink-2); font-size: 17px; line-height: 1;
  cursor: pointer; transition: color var(--dur), border-color var(--dur);
}
.iconbtn:hover { color: var(--ink); border-color: var(--gold); }
.segbtn {
  border: 1px solid var(--line-2); background: var(--panel); color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 650; padding: 5px 12px; cursor: pointer;
  transition: color var(--dur), background var(--dur);
}
.segbtn:first-child { border-radius: 8px 0 0 8px; }
.segbtn:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.segbtn.on { background: var(--gold-soft); color: var(--gold-deep); }

/* ---------- preview ---------- */
.pv-head { display: flex; align-items: center; justify-content: space-between; }
.pv-nav { display: flex; align-items: center; gap: 8px; }
.pv-count { font-size: 13px; color: var(--muted); min-width: 56px; text-align: center; }
.pv-count b { color: var(--ink); font-size: 14px; }
.pv-sep { margin: 0 3px; }
.pv-mode { display: flex; }
.pv-stage {
  position: relative; width: 100%; min-width: 0; aspect-ratio: 16 / 9;
  border-radius: var(--r-card); border: 1px solid var(--line-2);
  background: #efece5; overflow: hidden; box-shadow: var(--shadow);
}
.pv-stage.scrolled { overflow-y: auto; aspect-ratio: auto; height: 60vh; }
#pvFrame { border: 0; display: block; transform-origin: 0 0; }
.pv-loading { position: absolute; inset: 0; background: var(--panel-2); z-index: 2; }
.pv-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; margin-top: 12px; }
.pv-actions .btn.primary { min-width: 215px; padding: 10px 18px; font-size: 14px; }
.pdflite { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); margin: 8px 2px 0; }
.pdflite input { accent-color: var(--gold-deep); margin-top: 2px; }

/* result */
.result {
  border: 1px solid var(--line); background: var(--panel);
  border-radius: var(--r-card); padding: 12px 14px; box-shadow: var(--shadow);
}
.res-head { display: flex; align-items: center; gap: 10px; }
.pill {
  font-size: 10.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
}
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, var(--panel)); color: var(--ok); }
.pill.err { background: color-mix(in srgb, var(--err) 14%, var(--panel)); color: var(--err); }
.mut { color: var(--muted); font-size: 12.5px; }
.res-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.res-list .dl {
  font-size: 12px; font-weight: 650; text-decoration: none;
  color: var(--ink); background: var(--panel-2); border: 1px solid var(--line-2);
  padding: 6px 11px; border-radius: 999px; transition: border-color var(--dur), color var(--dur);
}
.res-list .dl:hover { border-color: var(--gold); color: var(--gold-deep); }

/* ---------- misc states ---------- */
.loaderr {
  border: 1px solid color-mix(in srgb, var(--err) 35%, transparent);
  background: color-mix(in srgb, var(--err) 7%, var(--panel));
  color: var(--ink); border-radius: var(--r-card); padding: 12px 14px; font-size: 13px;
}
.loaderr .hint { margin: 6px 0 0; }
.skel { position: relative; background: var(--panel-2); border-radius: 8px; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--line) 55%, transparent), transparent);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-line { height: 34px; margin: 6px 0; }
.skel-line.w70 { width: 70%; }
.skel-page { position: absolute; inset: 10%; border-radius: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinwrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(20, 18, 14, .18); }
.spinbox { display: flex; flex-direction: column; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 26px 34px; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line-2); border-top-color: var(--gold);
  animation: spin .7s linear infinite;
}
.spinlabel { font-size: 12.5px; color: var(--ink-2); max-width: 260px; text-align: center; }
.pdfq { margin-top: 10px; max-width: 260px; display: flex; flex-direction: column; gap: 8px; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; z-index: 60; box-shadow: var(--shadow);
}
.toast.err { background: var(--err); color: #fff; }
.mini-status { font-size: 12.5px; font-weight: 600; }
.hidden, [hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------------- scope list editor (drag & drop) ---------------- */
.scopelist { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.srow { position: relative; display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 5px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); transition: border-color var(--dur) ease, box-shadow var(--dur) ease; }
.srow:hover { border-color: var(--gold); }
.srow:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent); }
.scopelist input[type="text"] { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 400; padding: 5px 2px; }
.scopelist input[type="text"]:focus { outline: none; border: 0; box-shadow: none; }
.grip { display: inline-flex; color: var(--muted); cursor: grab; padding: 3px; border-radius: 6px; transition: color var(--dur) ease, background-color var(--dur) ease; }
.grip:hover { color: var(--ink-2); background-color: color-mix(in srgb, var(--ink) 7%, transparent); }
.grip:active { cursor: grabbing; }
.row-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; opacity: .7; transition: color var(--dur) ease, background-color var(--dur) ease, opacity var(--dur) ease; }
.row-x:hover { color: var(--err); background-color: color-mix(in srgb, var(--err) 9%, transparent); opacity: 1; }
.srow.dragging { opacity: .4; }
.srow.drop-before::before, .srow.drop-after::after { content: ""; position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 30%, transparent); }
.srow.drop-before::before { top: -5px; }
.srow.drop-after::after { bottom: -5px; }
.srow.pop { animation: rowin .2s cubic-bezier(.16, 1, .3, 1); }
@keyframes rowin { from { opacity: 0; transform: translateY(-4px); } }
.scope-empty { font-size: 12.5px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 10px; padding: 16px 12px; text-align: center; }
.addbtn { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: border-color var(--dur) ease, color var(--dur) ease, transform var(--dur) ease; }
.addbtn:hover { border-color: var(--gold); color: var(--gold-deep); }
.addbtn:active { transform: scale(.97); }

/* hierarki: field paling penting sedikit lebih besar */
#deck_title { font-size: 15px; font-weight: 600; }

.row-dup { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; opacity: .7; transition: color var(--dur) ease, background-color var(--dur) ease, opacity var(--dur) ease; }
.row-dup:hover { color: var(--gold-deep); background-color: color-mix(in srgb, var(--gold) 10%, transparent); opacity: 1; }
