/* ============================================================================
   lptech-wd — gaya halaman publik (landing, masuk token, editor)
   iOS-like, hijau gelap, mobile-first.
   ========================================================================== */

:root {
  color-scheme: light dark;
  --bg: #f4f7f5;
  --card: #ffffff;
  --field: #ffffff;
  --text: #14201a;
  --muted: #66756d;
  --line: rgba(20, 60, 40, .14);
  --accent: #0b6b4f;
  --accent-2: #10b981;
  --tint: rgba(16, 185, 129, .12);
  --on-accent: #ffffff;
  --danger: #c02626;
  --warn: #a35a00;
  --bar: rgba(244, 247, 245, .86);
  --shadow: 0 1px 2px rgba(10, 30, 20, .05), 0 14px 34px rgba(10, 30, 20, .08);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07120d;
    --card: #10201a;
    --field: #16281f;
    --text: #eef7f1;
    --muted: #9fb3a7;
    --line: rgba(150, 200, 170, .2);
    --accent: #34d399;
    --accent-2: #34d399;
    --tint: rgba(52, 211, 153, .14);
    --on-accent: #04140d;
    --danger: #ff6b6b;
    --warn: #ffb547;
    --bar: rgba(7, 18, 13, .8);
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 18px 40px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.busy { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4, p { margin-top: 0; }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 18px 60px; }
.narrow { max-width: 620px; }
.mono { font-family: ui-monospace, Menlo, monospace; }
.center { text-align: center; }

/* ---------- Header ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px;
  background: var(--bar);
  border-bottom: .5px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); font-weight: 800; letter-spacing: -.2px; }
.brand img { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; }
.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .3px; }
.bar-link { padding: 8px 14px; border-radius: 999px; background: var(--tint); color: var(--accent); font-size: 13.5px; font-weight: 700; }

/* ---------- Hero ---------- */
.hero { padding: 54px 0 30px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.hero h1 { margin: 0 0 14px; max-width: 620px; font-size: clamp(34px, 8vw, 56px); line-height: 1.04; letter-spacing: -1.4px; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { max-width: 540px; margin: 0 0 24px; color: var(--muted); font-size: 16.5px; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-note { margin-top: 14px; color: var(--muted); font-size: 12.5px; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: 14px;
  background: var(--field);
  color: var(--text);
  font-size: 15.5px;
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--line) inset;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.985); opacity: .9; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.btn.ghost { background: transparent; box-shadow: 0 0 0 1px var(--line) inset; }
.btn.danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 9px 14px; font-size: 13.5px; border-radius: 11px; }

/* ---------- Kartu umum ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.2px; }
.card .sub { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 40px 0 16px; }
.section-head h2 { margin: 0; font-size: 24px; letter-spacing: -.5px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

/* ---------- Langkah ---------- */
.steps { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 12px 0 0; counter-reset: step; }
.step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.step-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: var(--tint);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}
.step b { display: block; font-size: 14.5px; }
.step span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- Katalog template ---------- */
.tpl-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.tpl-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.tpl-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: .9;
}
.tpl-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tpl-card h3 { margin: 4px 0 4px; font-size: 19px; letter-spacing: -.3px; }
.tpl-price { color: var(--accent); font-size: 15px; font-weight: 800; white-space: nowrap; }
.tpl-desc { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.tpl-feat { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.tpl-feat li { padding: 5px 9px; border-radius: 999px; background: var(--tint); color: var(--accent); font-size: 11.5px; font-weight: 600; }
.tpl-actions { display: flex; gap: 8px; }
.tpl-actions .btn { flex: 1; }
.tpl-badge { position: absolute; top: 14px; right: 14px; padding: 4px 9px; border-radius: 999px; background: var(--card); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }

/* ---------- Form ---------- */
.lbl { display: block; margin: 0 0 14px; color: var(--muted); font-size: 13px; font-weight: 600; }
.field {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font-size: 16px;
  outline: none;
  box-shadow: 0 0 0 1px var(--line) inset;
}
.field:focus { box-shadow: 0 0 0 2px var(--accent-2) inset; }
.field::placeholder { color: var(--muted); opacity: .7; }
textarea.field { min-height: 96px; resize: vertical; line-height: 1.55; }
select.field { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.msg { min-height: 1.3em; margin: 10px 0 0; color: var(--danger); font-size: 13.5px; }
.msg.ok { color: var(--accent); }

/* ---------- Kode token ---------- */
.token-input {
  letter-spacing: 1.6px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 18px;
  text-align: center;
  text-transform: uppercase;
}
.token-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--accent);
  font: 12.5px ui-monospace, Menlo, monospace;
  font-weight: 700;
}

/* ---------- Pilihan template ---------- */
.pick { display: grid; gap: 8px; margin: 0 0 16px; }
.pick label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--field);
  box-shadow: 0 0 0 1px var(--line) inset;
  cursor: pointer;
}
.pick input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.pick b { display: block; font-size: 14.5px; }
.pick small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.pick label:has(input:checked) { box-shadow: 0 0 0 2px var(--accent) inset; background: var(--tint); }
.pick .price { margin-left: auto; color: var(--accent); font-weight: 800; font-size: 13.5px; white-space: nowrap; }

/* ---------- Editor ---------- */
.editor-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  background: var(--bar);
  border-bottom: .5px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
}
.editor-bar .brand { font-size: 14px; }
.editor-bar .brand img { width: 30px; height: 30px; border-radius: 9px; }
.token-chip.small { font-size: 11px; padding: 6px 10px; }
.editor-head { padding: 22px 0 6px; }
.editor-head h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.6px; }
.editor-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.tier-badge { display: inline-flex; margin-left: 6px; padding: 3px 9px; border-radius: 999px; background: var(--tint); color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .3px; }
.form-card { padding: 18px; }
.form-card h3 { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.form-card h3 .num { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 8px; border-radius: 8px; background: var(--tint); color: var(--accent); font-size: 12px; }
.form-card h3 span.title { flex: 1; }
.rep { display: grid; gap: 10px; margin: 0 0 12px; }
.rep-item { position: relative; padding: 14px; border-radius: 14px; background: var(--field); box-shadow: 0 0 0 1px var(--line) inset; }
.rep-item .del { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 9px; color: var(--danger); font-size: 18px; line-height: 1; }
.rep-item .del:active { background: var(--tint); }
.rep-item .lbl:last-child { margin-bottom: 0; }
.rep-add { width: 100%; }
.subhead { margin: 18px 0 10px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.note { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--tint); color: var(--accent); font-size: 12.5px; line-height: 1.5; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; margin-bottom: 10px; border-radius: 12px; background: var(--field); box-shadow: 0 0 0 1px var(--line) inset; font-size: 14px; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.gallery-limit { margin-left: 6px; color: var(--muted); font-weight: 500; font-size: 13px; }
.photo-preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; margin-top: 8px; }

.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  margin-top: 20px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.action-bar .status { flex: 1; min-width: 0; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.action-bar .btn { flex: none; }
@media (max-width: 420px) {
  .action-bar .btn { padding: 12px 14px; font-size: 14px; }
}

/* ---------- Sukses ---------- */
.success { text-align: center; padding: 28px 4px 6px; }
.success .mark {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent);
  font-size: 34px;
}
.success h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.5px; }
.success p { margin: 0 auto 18px; max-width: 420px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.link-box { display: flex; gap: 8px; margin: 0 0 12px; }
.link-box input { flex: 1; min-width: 0; font: 13px ui-monospace, Menlo, monospace; text-align: left; }
.success-actions { display: grid; gap: 8px; max-width: 380px; margin: 0 auto; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 0; background: rgba(0, 0, 0, .45); }
.modal-card { width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; padding: 22px 18px calc(20px + env(safe-area-inset-bottom)); background: var(--card); border-radius: 22px 22px 0 0; }
.modal-card h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.2px; }
.modal-card p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions .btn { flex: 1; }
@media (min-width: 640px) {
  .modal { align-items: center; padding: 20px; }
  .modal-card { border-radius: 20px; padding-bottom: 20px; }
}

/* ---------- Toast + spinner ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 70;
  max-width: 90vw;
  padding: 11px 18px;
  border-radius: 999px;
  background: #14201a;
  color: #fff;
  font-size: 13px;
  text-align: center;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}
#spin {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: none;
  place-items: center;
  background: rgba(127, 127, 127, .14);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  touch-action: none;
  overscroll-behavior: contain;
}
#spin.on { display: grid; }
#spin::after {
  content: "";
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */
.foot { margin-top: 44px; padding-top: 20px; border-top: .5px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Desktop ---------- */
@media (min-width: 700px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .tpl-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
  .hero { padding-top: 76px; }
  .grid2 { gap: 14px; }
}
