/* Polbyte App panel – visual language of polbyte.com / polbyte.app (no external fonts or scripts). */
:root {
  --bg: #f8f7fb; --bg-alt: #f1eef7; --surface: #fff; --fg: #1a1424; --muted: #625a70; --line: #e4dfee;
  --accent: #a0179f; --accent-soft: #f7e5f6; --ok: #138a52; --ok-soft: #e3f5ec; --warn: #a15c00; --warn-soft: #fff1d9; --err: #c0262d;
  --grad: linear-gradient(120deg, #e83a8c 0%, #c4179f 45%, #8a22c4 100%);
  --radius: 16px; --shadow: 0 1px 2px rgba(30,16,48,.06), 0 12px 32px -12px rgba(60,20,90,.22);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1 { font-size: 1.8rem; letter-spacing: -.02em; margin: 0 0 6px; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: .88rem; }
[hidden] { display: none !important; }

/* top bar */
.top { display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.logo { display: flex; align-items: center; gap: 6px; text-decoration: none; }
.wordmark { display: inline-block; height: 21px; aspect-ratio: 844 / 133; background: linear-gradient(120deg, #f0368a 0%, #e0258f 55%, #c81aa0 100%); -webkit-mask: url(/polbyte-wordmark.png) center / contain no-repeat; mask: url(/polbyte-wordmark.png) center / contain no-repeat; }
.tld { font-weight: 800; color: var(--accent); }
.acc { margin-left: auto; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top form { margin: 0; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--fg); }
.link.danger, .danger { color: var(--err); }
@media (max-width: 520px) { .acc { display: none; } .top form { margin-left: auto; } }

.flash { max-width: 1100px; margin: 16px auto 0; padding: 12px 16px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 600; width: calc(100% - 40px); }
.editor-page .flash { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); width: auto; z-index: 30; box-shadow: var(--shadow); animation: fade 4s forwards; }
@keyframes fade { 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 999px; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; border: 1.5px solid transparent; white-space: nowrap; transition: transform .15s, border-color .15s, opacity .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -10px rgba(144,33,189,.6); }
.btn-ghost { background: var(--surface); color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost.danger { color: var(--err); }
.btn.small { padding: 7px 14px; font-size: .88rem; }
.btn.wide { width: 100%; margin-top: 8px; }

/* forms */
.form { display: flex; flex-direction: column; gap: 6px; }
.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; margin-bottom: 10px; }
.f-label { font-weight: 600; font-size: .9rem; }
.f input[type=text], .f input[type=email], .f input[type=password], .f textarea, .f select {
  font: inherit; font-weight: 400; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
.f textarea { resize: vertical; min-height: 70px; }
.f input:focus, .f textarea:focus, .f select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .f-row { grid-template-columns: 1fr; } }
.hint { display: block; margin: -4px 0 10px; color: var(--muted); font-size: .84rem; font-weight: 400; }
.hint.ok { color: var(--ok); } .hint.bad { color: var(--err); }
.err { color: var(--err); font-size: .86rem; font-weight: 600; margin: -4px 0 10px; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--muted); margin: 2px 0 6px; }
.domain { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.domain:focus-within { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.f .domain input { border: 0; border-radius: 0; min-width: 0; flex: 1; outline: none; }
.domain span { display: flex; align-items: center; padding: 0 12px; background: var(--bg-alt); color: var(--muted); font-weight: 500; white-space: nowrap; font-size: .88rem; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }

/* auth */
.auth-box { max-width: 440px; margin: 48px auto; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); width: calc(100% - 32px); }
.auth-box h1 { margin-bottom: 20px; }
.alt { text-align: center; color: var(--muted); margin: 18px 0 0; }
@media (max-width: 520px) { .auth-box { padding: 24px 18px; margin: 20px auto; } }

/* pages */
.page { max-width: 1100px; margin: 0 auto; padding: 32px 20px 64px; }
.page.narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.crumbs { margin: 0 0 12px; } .crumbs a { color: var(--muted); text-decoration: none; }
.empty { text-align: center; padding: 56px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: 22px; }
.empty .btn { margin-top: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.site-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: inherit; transition: border-color .15s, transform .15s, box-shadow .15s; }
.site-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.site-card b { font-size: 1.08rem; }
.site-card .host { color: var(--muted); font-size: .88rem; word-break: break-all; }
.site-card .badge { align-self: flex-start; margin-top: 8px; }
.kind { align-self: flex-start; font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.kind-quiz { color: #4f46e5; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--bg-alt); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* create */
.step-title { margin: 22px 0 12px; }
.tpl-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 6px; }
@media (max-width: 560px) { .tpl-pick { grid-template-columns: 1fr; } }
.tpl-option { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 18px; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; cursor: pointer; font-weight: 400; }
.tpl-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tpl-option input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-option b { font-size: 1.05rem; }
.tpl-thumb { aspect-ratio: 16 / 9; border-radius: 12px; margin-bottom: 6px; }
.thumb-business { background: linear-gradient(#fff 0 0) 10% 14% / 22% 6% no-repeat, linear-gradient(#ffffffaa 0 0) 10% 46% / 40% 7% no-repeat, linear-gradient(#ffffff77 0 0) 10% 60% / 30% 5% no-repeat, linear-gradient(#fff 0 0) 10% 78% / 20% 10% no-repeat, radial-gradient(circle at 76% 48%, #ffffff55 0 18%, transparent 19%), linear-gradient(140deg, #f0609a, #c2185b); }
.thumb-quiz { background: linear-gradient(#4f46e5 0 0) 50% 16% / 60% 7% no-repeat, linear-gradient(#fff 0 0) 50% 36% / 70% 12% no-repeat, linear-gradient(#4f46e5 0 0) 50% 56% / 70% 12% no-repeat, linear-gradient(#fff 0 0) 50% 76% / 70% 12% no-repeat, #e8e5ff; }

/* editor */
.editor-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ed-bar { display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.back { text-decoration: none; font-size: 1.3rem; color: var(--muted); padding: 0 4px; }
.ed-title { display: flex; flex-direction: column; min-width: 0; flex: 0 1 320px; }
.ed-title input { font: inherit; font-weight: 700; font-size: 1.05rem; border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; margin-left: -7px; background: transparent; color: var(--fg); }
.ed-title input:hover, .ed-title input:focus { border-color: var(--line); outline: none; background: var(--bg); }
.ed-title .host { font-size: .82rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-title .host[data-off] { color: var(--muted); pointer-events: none; }
.save-state { color: var(--muted); font-size: .85rem; }
.ed-actions { margin-left: auto; display: flex; gap: 10px; }
.ed-body { flex: 1; display: grid; grid-template-columns: minmax(340px, 420px) 1fr; min-height: 0; }
.ed-form { overflow-y: auto; padding: 8px 20px 60px; border-right: 1px solid var(--line); background: var(--surface); }
.ed-section { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin: 26px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.ed-form > .ed-section:first-child { border-top: 0; padding-top: 0; margin-top: 16px; }
.color-field { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.color-field input[type=color] { width: 42px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); background: var(--c); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--fg); }
.image-row { display: flex; align-items: center; gap: 10px; }
.thumb { width: 64px; height: 48px; border-radius: 9px; background: var(--bg-alt) repeating-linear-gradient(45deg, transparent 0 6px, #0000000a 6px 12px); overflow: hidden; flex: none; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-field.loading .thumb { opacity: .5; }
.list-field { margin-bottom: 8px; }
.list-item { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 4px; margin: 0 0 12px; background: var(--bg); }
.list-item legend { font-weight: 700; font-size: .85rem; padding: 0 6px; color: var(--muted); }
.item-tools { position: absolute; top: -12px; right: 10px; display: flex; gap: 4px; }
.icon { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .8rem; color: var(--muted); padding: 0; }
.icon:hover { color: var(--fg); border-color: var(--accent); }
.icon.danger:hover { color: var(--err); border-color: var(--err); }
.danger-zone { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.danger-zone .ed-section, .danger-zone p { width: 100%; }
.ed-preview { display: flex; flex-direction: column; min-height: 0; background: var(--bg-alt); }
.pv-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; font-weight: 700; color: var(--muted); font-size: .85rem; }
.pv-size { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.pv-size button { border: 0; background: none; font: inherit; font-weight: 600; font-size: .8rem; padding: 4px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.pv-size button.on { background: var(--grad); color: #fff; }
.pv-frame { flex: 1; min-height: 0; padding: 0 18px 18px; display: flex; justify-content: center; }
.pv-frame iframe { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); transition: width .25s; }
.pv-frame.phone iframe { width: 390px; max-width: 100%; }
@media (max-width: 900px) {
  .editor-page { height: auto; overflow: visible; }
  .ed-body { grid-template-columns: 1fr; }
  .ed-form { border-right: 0; overflow: visible; }
  .ed-preview { height: 80vh; position: relative; }
  .ed-bar { position: sticky; top: 60px; z-index: 15; }
  .ed-actions { width: 100%; margin-left: 0; } .ed-actions .btn { flex: 1; }
}
