/* Host editor */
:root {
  --bg: #f4f3ef; --card: #fff; --ink: #1d2327; --muted: #66717a; --line: #e3e0d8; --field: #fbfaf8;
  --accent: #1f6f78; --accent-2: #2c9a8f; --soft: #e6f2f2; --danger: #b3261e; --r: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
.i { width: 18px; height: 18px; flex: none; }
code { background: var(--soft); color: var(--accent); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
button { font: inherit; }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; background: rgba(244, 243, 239, .97); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 750; font-size: 17px; letter-spacing: -.01em; }
.guide-pick { flex: 1; min-width: 0; display: flex; }
.pick-btn {
  display: flex; align-items: center; gap: 8px; max-width: 100%; border: 1px solid var(--line); background: var(--card);
  padding: 7px 12px; border-radius: 12px; cursor: pointer; color: var(--ink); font-weight: 600;
}
.pick-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-btn .i { color: var(--muted); }
.top-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 16px;
  border-radius: 12px; border: 1px solid transparent; background: var(--ink); color: #fff; cursor: pointer;
  font-weight: 650; text-decoration: none; font-size: 14.5px; white-space: nowrap;
}
.btn.primary { background: var(--accent); }
.btn.primary:hover { background: #185c64; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: #c9c5bb; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 13.5px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--danger); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .45; pointer-events: none; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; max-width: 1180px; margin: 0 auto; padding: 22px 18px 60px; }
.form { min-width: 0; }
.pane { position: sticky; top: 76px; align-self: start; }
.phone {
  width: 390px; height: min(800px, calc(100vh - 140px)); margin: 0 auto; border-radius: 44px; padding: 12px;
  background: #1d2327; box-shadow: 0 30px 60px -20px rgba(20, 30, 40, .35), inset 0 0 0 2px #3a434b;
}
.phone iframe { width: 100%; height: 100%; border: 0; border-radius: 33px; background: #f4f3ef; display: block; }
.pane-note { text-align: center; color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.only-mobile { display: none; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 20px 22px; margin-bottom: 16px; }
.panel h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 17px; letter-spacing: -.01em; }
.panel h2 .i { color: var(--accent); width: 20px; height: 20px; }
.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.fld:last-child { margin-bottom: 0; }
.lbl { font-weight: 650; font-size: 13.5px; }
.opt { font-style: normal; font-weight: 500; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.hint.lead { margin: -6px 0 14px; display: block; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 12px; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.5; min-height: 76px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 111, 120, .15); background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid2 .fld:last-child { margin-bottom: 14px; }
.panel .grid2:last-child .fld { margin-bottom: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 2px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.sw.on { box-shadow: 0 0 0 2px var(--ink); }
.cover-thumb { width: 96px; height: 60px; object-fit: cover; border-radius: 10px; }

.sec { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 12px; margin-bottom: 10px; background: var(--card); }
.sec-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sec-ic { width: 32px; height: 32px; border-radius: 10px; background: var(--soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.sec-title { border: 0; background: transparent; font-weight: 700; font-size: 15.5px; padding: 6px 4px; }
.sec-title::placeholder { color: var(--ink); opacity: 1; }
.sec-title:focus { background: var(--field); box-shadow: none; }
.sec-tools { display: flex; gap: 2px; }
.ib { width: 32px; height: 32px; border: 0; background: none; border-radius: 9px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.ib:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.ib:disabled { opacity: .3; }
.sec textarea { min-height: 84px; }

.meter-row { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.meter-row > .i { color: var(--accent); margin-top: 2px; }
.bar { height: 6px; border-radius: 6px; background: var(--bg); overflow: hidden; margin: 4px 0 10px; }
.bar i { display: block; height: 100%; border-radius: 6px; background: #2e7d4f; transition: width .3s; }
.bar i.lv-large { background: #b7861f; }
.bar i.lv-tight, .bar i.lv-too-big { background: var(--danger); }
.foot-note { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; justify-content: center; }
.foot-note .i { width: 14px; height: 14px; }

/* onboarding */
body.empty .pane { display: none; }
body.empty .layout { grid-template-columns: 1fr; }
.onb { max-width: 620px; margin: 6vh auto 0; text-align: center; }
.onb-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 18px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.onb-ic .i { width: 30px; height: 30px; }
.onb h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.08; letter-spacing: -.025em; margin: 0 0 14px; }
.onb > p { color: var(--muted); font-size: 17px; margin: 0 auto 26px; max-width: 34em; }
.onb-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.card-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 18px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); transition: .15s;
}
.card-btn:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 8px 24px -12px rgba(31, 111, 120, .4); }
.card-btn .i { color: var(--accent); width: 24px; height: 24px; margin-bottom: 6px; }
.card-btn strong { font-size: 16px; }
.card-btn span { color: var(--muted); font-size: 13.5px; }
.note { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.note .i { width: 15px; height: 15px; }
.note.warn { background: #fff6e0; color: #6b5310; padding: 8px 12px; border-radius: 10px; justify-content: flex-start; }

/* dialog */
dialog { border: 0; padding: 0; border-radius: 22px; width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); }
dialog::backdrop { background: rgba(20, 25, 30, .45); backdrop-filter: blur(2px); }
.dlg-in { padding: 24px; position: relative; }
.dlg-in h2 { margin: 0 0 14px; font-size: 21px; letter-spacing: -.015em; display: flex; align-items: center; gap: 10px; padding-right: 30px; }
.dlg-in h2 .i { color: var(--accent); width: 22px; height: 22px; }
.dlg-x { position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg); cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.dlg-in .onb { margin: 0 auto; }
.glist { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.glist button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: left; color: var(--ink); }
.glist button.on { border-color: var(--accent); background: var(--soft); }
.glist span { flex: 1; font-weight: 600; }
.pro-badge { font-style: normal; font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 99px; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kind { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: left; color: var(--ink); font-weight: 600; font-size: 14px; }
.kind .i { color: var(--accent); }
.kind:hover { border-color: var(--accent); }
.kind.used { opacity: .5; }

.share { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.share-qr { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.share-qr svg { display: block; width: 100%; height: auto; }
.share-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.share-side .hint { display: flex; gap: 6px; align-items: flex-start; margin: 0; }
.share-side .hint .i { width: 15px; height: 15px; margin-top: 2px; }
.share-side input { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.toobig { aspect-ratio: 1; display: grid; place-content: center; text-align: center; color: var(--danger); padding: 10px; }
.toobig .i { width: 40px; height: 40px; margin: 0 auto; }
.share-pro { margin-top: 20px; }
.upsell { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 14px; background: linear-gradient(135deg, #fff7e8, #fdf0e3); border: 1px solid #f1dfc4; }
.upsell > .i { color: #b0602c; width: 24px; height: 24px; }
.upsell div { flex: 1; display: flex; flex-direction: column; font-size: 13.5px; color: var(--muted); }
.upsell strong { color: var(--ink); font-size: 14.5px; }
.upsell.pro { background: var(--soft); border-color: #cfe5e5; }
.upsell.pro > .i { color: var(--accent); }
.ok-line { display: flex; gap: 8px; align-items: center; color: #2e7d4f; font-weight: 600; margin: -4px 0 14px; }
.price { font-size: 16px; }
.price strong { font-size: 22px; color: var(--accent); }
.ticks { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.ticks li { display: flex; gap: 10px; align-items: flex-start; }
.ticks .i { color: #2e7d4f; margin-top: 2px; }
.center { text-align: center; padding: 30px; color: var(--muted); }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  transition: .25s; z-index: 100; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px -10px rgba(0,0,0,.4);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 14px 12px 80px; }
  .pane { display: none; }
  .only-mobile { display: inline-flex; }
  body.show-preview .pane { display: block; position: fixed; inset: 0; z-index: 50; background: var(--bg); padding: 12px; overflow: auto; }
  body.show-preview .phone { width: 100%; max-width: 420px; height: calc(100vh - 90px); border-radius: 28px; padding: 6px; }
  body.show-preview .phone iframe { border-radius: 23px; }
  .close-preview { display: flex; margin: 0 auto 10px; }
  body.show-preview .pane-note { display: none; }
}
@media (max-width: 620px) {
  .top { padding: 8px 10px; gap: 8px; }
  .logo span, .lbl-wide { display: none; }
  .grid2, .onb-btns, .share { grid-template-columns: 1fr; }
  .grid2 .fld { margin-bottom: 14px !important; }
  .share-qr { max-width: 260px; margin: 0 auto; width: 100%; }
  .kinds { grid-template-columns: 1fr 1fr; }
  .panel { padding: 16px; }
  .btn { padding: 8px 12px; }
  .upsell { flex-wrap: wrap; }
}
.langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin-bottom: 14px; }
.lang { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 14px; }
.lang input { width: auto; accent-color: var(--accent); }
.panel h2 .pro-badge { margin-left: 4px; }
.warn-t { color: #9a5b00; }
#shareBtn.dirty { position: relative; }
#shareBtn.dirty::after { content: ""; position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: #e8a33d; border: 2px solid var(--bg); }
