/* Dashboard: sidebar shell, home, builder, design studio, settings, share, results, account.
   Layout: a fixed sidebar beside a scrolling workspace; the builder canvas sits on a dotted artboard. */

/* ---------- Shell ---------- */
html, body { height: 100%; }
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100%; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 14px; padding: max(18px, env(safe-area-inset-top, 0px)) 14px max(16px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; z-index: 40; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px; }
.side-close { display: none; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.avatar { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(135deg, #ff2e7e, #ff8a3d); flex: none; }
.me .who { min-width: 0; flex: 1; }
.me b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who > span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .planpill { flex: none; }
.planpill { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: var(--ink); color: var(--bg); }
.planpill.free { background: var(--sunk); color: var(--muted); }
.new-btn { width: 100%; padding: 11px 16px; font-size: 14.5px; gap: 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 11px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14.5px; transition: background .12s, color .12s; }
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav a.on { background: var(--sunk); color: var(--ink); font-weight: 600; }
.nav a.on svg { color: var(--brand); }
.nav .count { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.nav-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 11px 4px; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.usage { padding: 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.usage .row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.usage .row b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunk); border: 1px solid var(--line); border-radius: 999px; }
.seg button { font: inherit; font-size: 12.5px; font-weight: 550; border: 0; background: transparent; color: var(--muted); padding: 5px 11px; cursor: pointer; border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.theme-seg button { padding: 5px 9px; }
.iconbtn { font: inherit; width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.iconbtn:hover { background: var(--sunk); color: var(--ink); }
.iconbtn.bordered { border-color: var(--line); background: var(--surface); }
.ico { width: 18px; height: 18px; flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
#view { padding: 28px max(16px, env(safe-area-inset-right, 0px)) 80px max(16px, 32px); max-width: 1320px; width: 100%; margin: 0 auto; }
#view.wide { max-width: none; padding-left: 20px; padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.scrim { position: fixed; inset: 0; background: rgba(8, 8, 12, .4); z-index: 35; backdrop-filter: blur(3px); }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .side-close { display: inline-grid; }
  .mobilebar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; height: 56px; padding: 0 max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 31; background: var(--bg); }
  #view { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 80px max(16px, env(safe-area-inset-left, 0px)); }
}

/* ---------- Page headings ---------- */
.hello { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.hello h1 { font-size: clamp(30px, 4vw, 42px); margin: 0; letter-spacing: -0.045em; line-height: 1.05; }
.hello h1 em, .pagehead h1 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--brand); letter-spacing: -0.02em; }
.hello p { margin: 6px 0 0; color: var(--muted); }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.pagehead h1 { font-size: clamp(28px, 3.4vw, 36px); margin: 0; letter-spacing: -0.04em; }
.pagehead p { margin: 4px 0 0; color: var(--muted); }

/* ---------- AI composer ---------- */
.composer { position: relative; border-radius: 22px; padding: 1.5px; background: linear-gradient(120deg, #ff2e7e, #ff8a3d 35%, #8b7cff 70%, #3ddcd0); margin-bottom: 22px; }
.composer-in { border-radius: 21px; background: var(--surface); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.composer-top { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.composer-top .ico { color: var(--brand); }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
@media (max-width: 640px) { .composer-row { flex-direction: column; align-items: stretch; } .composer-row .btn { justify-content: center; } }
.composer textarea { flex: 1; min-width: 0; font: inherit; font-size: 16px; border: 0; background: transparent; color: var(--ink); resize: none; outline: none; min-height: 52px; line-height: 1.5; padding: 4px 2px; field-sizing: content; max-height: 200px; }
.composer textarea::placeholder { color: var(--muted); }
.ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.ideas button { font: inherit; font-size: 12.5px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); cursor: pointer; }
.ideas button:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.thinking { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.thinking i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); animation: pulse 1s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: none; } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat span { font-size: 13px; color: var(--muted); }
.stat b { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat small { font-size: 12.5px; color: var(--muted); }
.bar { height: 6px; border-radius: 6px; background: var(--sunk); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.bar.full span { background: var(--danger); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input { padding-left: 36px; border-radius: 999px; }
.toolbar .spacer { flex: 1; }

/* ---------- Form cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.fcard { display: flex; flex-direction: column; overflow: hidden; border-radius: 20px; transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s, border-color .18s; min-width: 0; position: relative; }
.fcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--ink) 18%, var(--line)); }
.thumb { position: relative; height: 150px; padding: 18px 18px 0; display: flex; align-items: flex-end; overflow: hidden; text-decoration: none; border-bottom: 1px solid var(--line); }
.thumb .mini { width: 100%; border-radius: 12px 12px 0 0; padding: 14px 14px 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 -6px 24px -12px rgba(0,0,0,.25); transform: translateY(6px); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.fcard:hover .thumb .mini { transform: translateY(0); }
.mini b { font-size: 14px; line-height: 1.2; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini i { display: block; height: 9px; border-radius: 5px; opacity: .35; }
.mini i.short { width: 55%; }
.mini u { display: block; width: 64px; height: 16px; border-radius: 99px; text-decoration: none; }
.thumb .pill { position: absolute; top: 12px; left: 12px; backdrop-filter: blur(8px); }
.thumb .mode { position: absolute; top: 12px; right: 12px; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.75); color: #222; }
.fbody { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.fbody h3 { margin: 0; font-size: 16px; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbody h3 a { color: var(--ink); text-decoration: none; }
.fmeta { display: flex; gap: 12px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.fmeta b { color: var(--ink); font-weight: 600; }
.factions { display: flex; gap: 4px; margin-top: 6px; }
.factions .btn { flex: 1; }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; bottom: calc(100% + 6px); min-width: 160px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); z-index: 20; display: flex; flex-direction: column; }
.menu-list button { font: inherit; font-size: 14px; text-align: left; border: 0; background: none; color: var(--ink); padding: 8px 10px; border-radius: 9px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.menu-list button:hover { background: var(--sunk); }
.menu-list button.danger { color: var(--danger); }
.newcard { min-height: 260px; border: 1.5px dashed var(--line); border-radius: 20px; display: grid; place-items: center; text-align: center; color: var(--muted); cursor: pointer; background: transparent; font: inherit; padding: 20px; transition: border-color .15s, color .15s, background .15s; }
.newcard:hover { border-color: var(--brand); color: var(--ink); background: var(--brand-soft); }
.newcard .plus { width: 44px; height: 44px; border-radius: 14px; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 22px; margin: 0 auto 10px; }
.empty { text-align: center; padding: 56px 16px; border: 1.5px dashed var(--line); border-radius: 20px; color: var(--muted); }
.empty h2 { color: var(--ink); margin: 0 0 6px; letter-spacing: -0.03em; }

/* ---------- Templates ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; transition: all .12s; }
.chip:hover { color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tcard { cursor: pointer; text-align: left; font: inherit; color: var(--ink); padding: 0; background: var(--surface); }
.tcard .fbody p { margin: 0; color: var(--muted); font-size: 13.5px; }
.tcard .cat { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- Modals ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8, 8, 12, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .18s ease; }
.modal { width: 100%; max-width: 980px; max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; border-radius: 24px; box-shadow: var(--shadow); animation: rise .25s cubic-bezier(.2, .8, .2, 1); }
.modal.small { max-width: 520px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 24px; letter-spacing: -0.035em; }
.modal-head p { margin: 4px 0 0; color: var(--muted); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* Full-screen form preview */
.preview { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: var(--bg); animation: fade .15s ease; }
.preview-bar { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); background: var(--surface); }
.preview-bar .url { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.preview-stage { flex: 1; overflow: auto; display: flex; justify-content: center; padding: 24px 16px; }
.device { width: 100%; max-width: 980px; border-radius: 22px; overflow: auto; border: 1px solid var(--line); box-shadow: var(--shadow); transition: max-width .3s cubic-bezier(.2, .8, .2, 1); }
.device.phone { max-width: 390px; border-radius: 36px; border: 8px solid #111; }

/* Themed form "page" used by the canvas, Design preview and full preview */
.formpage { background: var(--fc-bg); padding: clamp(18px, 4vw, 44px) clamp(12px, 3vw, 28px); min-height: 100%; container-type: inline-size; }
.formpage .sheet { --fc-pad: clamp(20px, 4.5vw, 44px); max-width: 760px; margin: 0 auto; background: var(--fc-field); border: var(--fc-border) solid var(--fc-line); border-radius: calc(var(--fc-radius) + 8px); padding: var(--fc-pad); box-shadow: var(--fc-shadow); overflow: hidden; }
.formpage.fc-glass .sheet { backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); }
.formpage.steps .sheet { background: transparent; border: 0; box-shadow: none; padding: 0; max-width: 640px; overflow: visible; backdrop-filter: none; }
.formpage.steps .fc-cover { border-radius: var(--fc-radius); margin: 0 0 24px; }

/* ---------- Form workspace header ---------- */
.fhead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.crumb { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.crumb a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; white-space: nowrap; }
.crumb a:hover { color: var(--ink); }
.crumb .sep { color: var(--line); }
.crumb h1 { font-size: 20px; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.03em; }
.savestate { font-size: 12.5px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.savestate::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.savestate.busy::before { background: var(--marigold); }
.savestate.err { color: var(--danger); }
.savestate.err::before { background: var(--danger); }
.savestate:empty { display: none; }
.fhead .acts { display: flex; gap: 8px; }
.tabs { display: inline-flex; gap: 2px; padding: 4px; background: var(--sunk); border: 1px solid var(--line); border-radius: 999px; margin-bottom: 18px; overflow-x: auto; max-width: 100%; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: 14px; border-radius: 999px; white-space: nowrap; transition: background .15s, color .15s; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.tabs a .count { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.tabs .ico { width: 16px; height: 16px; }

/* ---------- Builder ---------- */
.builder { display: grid; grid-template-columns: 236px minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
@media (max-width: 1180px) { .builder { grid-template-columns: 210px minmax(0, 1fr) 290px; } }
@media (max-width: 1000px) { .builder { grid-template-columns: minmax(0, 1fr) 300px; } .palette { grid-column: 1 / -1; position: static !important; max-height: none !important; } .types { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important; } }
@media (max-width: 760px) { .builder { grid-template-columns: minmax(0, 1fr); } .inspector { position: static !important; max-height: none !important; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.palette, .inspector { position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow: auto; }
.palette { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.palette .search { max-width: none; min-width: 0; }
.palette .search input { padding-top: 7px; padding-bottom: 7px; font-size: 14px; }
.ai-mini { font: inherit; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 0; cursor: pointer; text-align: left; color: #fff; background: linear-gradient(120deg, #ff2e7e, #8b5cf6); font-size: 13.5px; font-weight: 600; }
.ai-mini small { display: block; font-weight: 400; opacity: .85; font-size: 12px; }
.ai-mini:hover { filter: brightness(1.06); }
.group h4 { margin: 4px 4px 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.types { display: grid; grid-template-columns: 1fr; gap: 2px; }
.types button { font: inherit; text-align: left; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; font-size: 13.5px; }
.types button:hover { background: var(--brand-soft); }
.tglyph { width: 28px; height: 28px; border-radius: 9px; background: var(--sunk); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); flex: none; font-family: var(--mono); transition: background .12s, color .12s; }
.types button:hover .tglyph { background: var(--brand); color: #fff; }

.artboard { border-radius: 22px; border: 1px solid var(--line); background-color: var(--sunk); background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1px); background-size: 20px 20px; padding: 18px; min-width: 0; }
.artboard .formpage { border-radius: 18px; overflow: hidden; }
.canvas .fc-grid { background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--fc-accent) 5%, transparent) 0 calc((100% - 198px) / 12), transparent calc((100% - 198px) / 12) calc((100% - 198px) / 12 + 18px)); }
.canvas .fc-field { position: relative; padding: 12px; margin: -12px; border-radius: calc(var(--fc-radius) + 2px); border: 1.5px solid transparent; cursor: pointer; transition: border-color .12s, background .12s; }
.canvas .fc-field > *:not(.ftools):not(.tag) { pointer-events: none; }
.canvas .fc-field:hover { border-color: color-mix(in srgb, var(--fc-accent) 35%, transparent); }
.canvas .fc-field.sel { border-color: var(--fc-accent); background: color-mix(in srgb, var(--fc-accent) 6%, transparent); }
.canvas .fc-actions { pointer-events: none; opacity: .6; }
.canvas .fc-foot { display: none; }
.tag { position: absolute; top: -11px; left: 12px; display: flex; gap: 4px; }
.tag span { font-family: var(--mono); font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--fc-accent); color: var(--fc-accent-ink); }
.tag span.logic { background: #ffc93c; color: #2a1d00; }
.tag span.score { background: #8b7cff; color: #fff; }
.canvas .fc-field:not(.sel) .tag span.size { display: none; }
.ftools { position: absolute; top: -15px; right: 10px; display: none; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); z-index: 2; }
.canvas .fc-field.sel .ftools { display: flex; }
.ftools button { font: inherit; width: 28px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); cursor: pointer; font-size: 13px; display: grid; place-items: center; }
.ftools button:hover { background: var(--sunk); }
.ftools button.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.addq { display: flex; justify-content: center; margin-top: 20px; }
.addq .btn { border-style: dashed; }
.t-in { font-family: var(--fc-head); font-size: clamp(26px, 3.6vw, 38px); font-weight: 700; letter-spacing: -0.035em; border: 0; background: transparent; color: var(--fc-ink); width: 100%; padding: 4px 8px; margin: 0 0 0 -8px; border-radius: 10px; }
.d-in { font: inherit; color: var(--fc-muted); border: 0; background: transparent; width: 100%; padding: 4px 8px; margin: 2px 0 24px -8px; border-radius: 10px; resize: none; field-sizing: content; min-height: 1.6em; }
.formpage .t-in, .formpage .d-in { background: transparent !important; } /* beats glass-theme input fills */
.formpage .t-in:hover, .formpage .d-in:hover, .formpage .t-in:focus, .formpage .d-in:focus { background: color-mix(in srgb, var(--fc-ink) 6%, transparent) !important; outline: none; }
.canvas-empty { text-align: center; padding: 36px 12px; border: 1.5px dashed var(--fc-line); border-radius: var(--fc-radius); color: var(--fc-muted); }

.inspector { padding: 0; }
.insp-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.insp-head h3 { margin: 0; font-size: 15px; letter-spacing: -0.02em; flex: 1; }
.insp-tabs { display: flex; gap: 2px; padding: 12px 12px 0; border-bottom: 1px solid var(--line); }
.insp-tabs button { font: inherit; font-size: 13.5px; font-weight: 550; padding: 8px 10px; border: 0; background: none; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.insp-tabs button.on { color: var(--ink); border-color: var(--brand); }
.insp-tabs .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.insp-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.insp-empty { padding: 20px 16px; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 10px; }
.insp-empty h3 { color: var(--ink); margin: 0; font-size: 16px; }
.opts { display: flex; flex-direction: column; gap: 6px; }
.optrow { display: flex; align-items: center; gap: 6px; }
.optrow .input { padding: 7px 10px; font-size: 14px; }
.optrow .pts { width: 64px; flex: none; text-align: center; }
.optrow .iconbtn { width: 28px; height: 28px; }
.opt-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pick { display: flex; flex-wrap: wrap; gap: 4px; }
.pick button { font: inherit; font-size: 12.5px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.pick button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.rng { display: flex; align-items: center; gap: 10px; }
.rng input { flex: 1; accent-color: var(--brand); }
.rng output { font-size: 12.5px; color: var(--muted); min-width: 70px; text-align: right; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); flex: none; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-size: 14px; font-weight: 500; }
.switch small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; margin-top: 2px; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s cubic-bezier(.2, .8, .2, 1); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:disabled { opacity: .45; cursor: not-allowed; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.box { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.rule { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 32px 10px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); position: relative; }
.rule::before { content: "Condition"; position: absolute; top: 9px; left: 12px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rule .iconbtn { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; }
.rule .input { padding: 6px 9px; font-size: 13.5px; }
.lockline { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pro { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 2px 6px; border-radius: 5px; background: var(--marigold); color: #2a1d00; }

/* ---------- Design studio ---------- */
.studio { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .studio { grid-template-columns: minmax(0, 1fr); } .studio .panel.controls { position: static !important; max-height: none !important; } }
.studio .controls { position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.studio h3 { margin: 0; font-size: 14px; letter-spacing: -0.01em; }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.theme { font: inherit; cursor: pointer; border: 1.5px solid var(--line); border-radius: 14px; padding: 0; overflow: hidden; background: none; color: var(--ink); text-align: left; transition: border-color .12s, transform .12s; }
.theme:hover { transform: translateY(-1px); }
.theme.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.theme .sw { height: 62px; padding: 10px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
.theme .sw b { font-size: 13px; line-height: 1; }
.theme .sw i { display: block; height: 6px; width: 70%; border-radius: 3px; }
.theme .sw u { display: block; width: 28px; height: 10px; border-radius: 99px; }
.theme span { display: block; padding: 6px 9px; font-size: 12px; font-weight: 550; border-top: 1px solid var(--line); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }
.swatches .reset { width: auto; height: 28px; border-radius: 99px; padding: 0 10px; font: inherit; font-size: 12px; background: var(--surface); color: var(--muted); }
.swatches input[type=color] { width: 34px; height: 30px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 2px; cursor: pointer; }
.uploadbox { display: flex; align-items: center; gap: 10px; }
.uploadbox .pv { width: 64px; height: 44px; border-radius: 10px; border: 1px dashed var(--line); background: var(--sunk) center / cover no-repeat; flex: none; }
.uploadbox .pv.logo { background-size: contain; background-origin: content-box; padding: 6px; }
.stage { border-radius: 22px; border: 1px solid var(--line); overflow: hidden; background: var(--sunk); }
.stage-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.stage-bar .dots { display: flex; gap: 6px; }
.stage-bar .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.stage-bar .url { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-view { display: flex; justify-content: center; padding: 0; }
.stage-view .device { box-shadow: none; border: 0; border-radius: 0; max-width: none; }
.stage-view.phone { padding: 22px 12px; }
.stage-view.phone .device { max-width: 390px; border: 8px solid #111; border-radius: 36px; max-height: 760px; }

/* ---------- Settings ---------- */
.settings-wrap { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .settings-wrap { grid-template-columns: minmax(0, 1fr); } .snav { display: none !important; } }
.snav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.snav a { color: var(--muted); text-decoration: none; padding: 7px 10px; border-radius: 9px; font-size: 14px; font-weight: 500; }
.snav a:hover { color: var(--ink); background: var(--sunk); }
.sections { display: flex; flex-direction: column; gap: 14px; max-width: 760px; min-width: 0; }
.section { padding: 20px; display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 16px; border-radius: 20px; }
.section h2 { font-size: 17px; margin: 0; letter-spacing: -0.025em; display: flex; align-items: center; gap: 8px; }
.section > p.hint { margin: -8px 0 0; }
.section.danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.choice { font: inherit; text-align: left; color: var(--ink); border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: border-color .12s; }
.choice:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.choice.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice span { font-size: 12.5px; color: var(--muted); }
.choice:disabled { opacity: .5; cursor: not-allowed; }
.copyrow { display: flex; gap: 8px; }
.copyrow .input { font-family: var(--mono); font-size: 13px; min-width: 0; }
.prefix { display: flex; align-items: stretch; }
.prefix span { display: flex; align-items: center; padding: 0 10px; background: var(--sunk); border: 1px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px; color: var(--muted); font-size: 13px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.prefix .input { border-radius: 0 12px 12px 0; }
.locked { font-size: 13px; color: var(--warn); display: flex; align-items: center; gap: 6px; }
.tokens { font-size: 12.5px; color: var(--muted); }
.tokens code { background: var(--sunk); padding: 1px 6px; border-radius: 5px; cursor: pointer; }

/* ---------- Share ---------- */
.share-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 22px; border-radius: 22px; margin-bottom: 14px; }
@media (max-width: 720px) { .share-hero { grid-template-columns: minmax(0, 1fr); } }
.biglink { font-family: var(--mono); font-size: clamp(14px, 2vw, 17px); padding: 14px 16px; border-radius: 14px; background: var(--sunk); border: 1px solid var(--line); overflow-x: auto; white-space: nowrap; }
.qrbox { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qrbox canvas { border-radius: 14px; background: #fff; border: 1px solid var(--line); width: 150px; height: 150px; }
.codetabs { padding: 20px; border-radius: 22px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- Results ---------- */
.funnel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 900px) { .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.funnel .stat { position: relative; }
.funnel .conv { font-size: 12.5px; font-weight: 600; color: var(--ok); }
.chart { padding: 18px; margin-bottom: 14px; border-radius: 20px; }
.chart h3 { margin: 0 0 14px; font-size: 15px; letter-spacing: -0.02em; display: flex; justify-content: space-between; gap: 10px; }
.chart h3 small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.cols { display: grid; grid-template-columns: repeat(30, 1fr); gap: 4px; align-items: end; height: 130px; border-bottom: 1px solid var(--line); }
.cols div { background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; transition: opacity .12s; }
.cols div:hover { opacity: .75; }
.cols div.zero { background: var(--line); }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "lab n" "track track"; gap: 5px 10px; align-items: center; font-size: 14px; }
.hbar .lab { grid-area: lab; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .n { grid-area: n; }
.hbar .track { grid-area: track; height: 10px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #8b5cf6)); border-radius: 99px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.hbar .n { white-space: nowrap; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.tablewrap { overflow-x: auto; border-radius: 18px; }
table.resp { width: 100%; border-collapse: collapse; font-size: 14px; }
table.resp th { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--sunk); font-weight: 600; }
table.resp td { padding: 11px 12px; border-bottom: 1px solid var(--line); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }
table.resp tr.r { cursor: pointer; }
table.resp tr.r:hover td { background: var(--brand-soft); }
table.resp td.when { color: var(--muted); font-variant-numeric: tabular-nums; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: var(--surface); border-left: 1px solid var(--line); z-index: 60; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.15); padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px); animation: slidein .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.drawer header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer .body { padding: 20px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.drawer dl { margin: 0; display: flex; flex-direction: column; gap: 16px; }
.drawer dt { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.drawer dd { margin: 3px 0 0; white-space: pre-wrap; word-break: break-word; }
.drawer footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; }
.filelink { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--sunk); border: 1px solid var(--line); font-size: 13px; text-decoration: none; color: var(--ink); margin: 2px 4px 2px 0; }
.signimg { max-width: 260px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.qpill { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.qpill.good { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.qpill.ok { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.qpill.weak { color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); }
.qpill.score { color: #6d5cf5; background: color-mix(in srgb, #8b7cff 16%, transparent); }
.words { display: flex; flex-wrap: wrap; gap: 6px; }
.words span { font-size: 14px; padding: 4px 11px; border-radius: 99px; background: color-mix(in srgb, var(--brand) calc(var(--w) * 22%), transparent); color: var(--ink); }
.words b { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 2px; }

/* ---------- Account, billing, developers ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.plan { padding: 20px; border: 1px solid var(--line); border-radius: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
.plan.current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan .price { font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: -0.05em; }
.plan .price small { font-family: var(--body); font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.plan ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.plan li { display: flex; gap: 8px; }
.plan li::before { content: "✓"; color: var(--brand); font-weight: 700; }
.plan li.no { color: var(--muted); opacity: .6; }
.plan li.no::before { content: "–"; color: var(--muted); }
.keyrow { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.keyrow:last-child { border-bottom: 0; }
.keyrow code { background: var(--sunk); padding: 2px 6px; border-radius: 5px; }
.keyrow .grow { flex: 1; min-width: 160px; }
.newkey { background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid var(--ok); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.confirm { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.dev-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.devcard { padding: 18px; border-radius: 18px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.devcard:hover { border-color: var(--brand); }
.devcard b { font-size: 15px; }
.devcard span { color: var(--muted); font-size: 13.5px; }

/* ---------- v3 screens: billing, endpoints, onboarding, admin, partner ---------- */
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.linkbtn { font: inherit; color: var(--brand); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 12px; background: var(--surface); margin-bottom: 16px; font-size: 14.5px; }
.notice .ico { flex: none; margin-top: 2px; color: var(--warn); }
.onboard { margin-bottom: 18px; }
.onboard .steps { list-style: none; counter-reset: s; padding: 0; margin: 4px 0 0; display: grid; gap: 12px; }
.onboard .steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; column-gap: 10px; align-items: start; }
.onboard .steps li::before { content: counter(s); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--sunk); color: var(--muted); }
.onboard .steps li.done::before { content: "✓"; background: var(--ok); color: #fff; }
.onboard .steps li.done b { color: var(--muted); }
.ob-otp { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; max-width: 420px; flex-wrap: wrap; }
.ob-otp .input { width: 130px; letter-spacing: .2em; font-variant-numeric: tabular-nums; }
.prodseg { margin-top: 22px; }
.trial-card { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand-soft), var(--shadow); margin-bottom: 4px; }
.trial-card .feat, .reasons { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 4px; }
.reasons { color: var(--danger); }
.plan .hint { font-size: 12.5px; }
table.bd { width: 100%; max-width: 420px; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 10px 0 0; }
table.bd td { padding: 6px 0; border-bottom: 1px solid var(--line); }
table.bd td:last-child { text-align: right; }
table.bd tr.tot td { font-weight: 700; border-bottom: 0; padding-top: 10px; }
.confirmbox { margin-top: 18px; border-color: var(--ink); }
.confirmbox:focus { outline: 2px solid var(--brand); outline-offset: 2px; }
.ep-cards { margin-top: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.epcard .copyrow { margin: 10px 0; }
.input.mono, .mono { font-family: var(--mono); font-size: 13px; }
.input.tiny { padding: 5px 8px; font-size: 13px; max-width: 160px; }
.spark { display: inline-flex; gap: 2px; align-items: flex-end; height: 26px; }
.spark i { width: 4px; border-radius: 2px; background: var(--line); }
.spark i.on { background: var(--brand); }
.admin-panel .sections { max-width: none; }
.admin-panel h3 { margin: 18px 0 6px; font-size: 15px; }
.admin-panel .section + .section { margin-top: 16px; }
td.neg, .neg { color: var(--danger); }
