/* Storesmith: the site and the app. */
:root { --bg: #f7f6fb; --card: #fff; --text: #1d1b26; --muted: #6b6880; --line: #e6e3ef; --accent: #6d4fd8;
  --accent-2: #5a3fc0; --soft: #efebfd; --ok: #1f8a5b; --bad: #c0392b; --warn: #b7791f; --r: 12px;
  --shadow: 0 1px 2px rgba(20, 16, 40, .06), 0 8px 24px rgba(20, 16, 40, .06); color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--muted); font-size: .85em; } .small { font-size: .88em; }
.ok-text { color: var(--ok); } .bad-text { color: var(--bad); }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font: inherit;
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #cfc9e3; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: .88em; border-radius: 8px; }
.btn.big { min-height: 50px; padding: 0 26px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.icon { width: 30px; padding: 0; }
input, select, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; width: 100%; min-height: 38px; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(109, 79, 216, .35); border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
input[type=color] { padding: 2px; width: 44px; height: 34px; min-height: 0; }
input[type=range] { padding: 0; border: 0; accent-color: var(--accent); }
label { display: grid; gap: 4px; font-size: .88em; font-weight: 600; color: #3b3850; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.notice { background: #fff8e6; border: 1px solid #f3dfa6; color: #6b4e0f; border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.notice.info { background: var(--soft); border-color: #dcd3fb; color: #3e2d8a; }
.error-box { background: #fdecea; border: 1px solid #f5c2bc; color: #8a2318; border-radius: 10px; padding: 10px 14px; }
.spin { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 30px auto; }
.spin.inline { display: inline-block; width: 15px; height: 15px; border-width: 2px; margin: 0 6px -2px 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .6s; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78em; font-weight: 700; background: var(--soft); color: var(--accent-2); }
.pill.ok { background: #e3f5ec; color: var(--ok); } .pill.bad { background: #fdecea; color: var(--bad); }
.pill.warn { background: #fff3db; color: var(--warn); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty .big { font-size: 2.2rem; }
.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 90; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: #2a2536; color: #fff; padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow); }
.toast.ok { background: var(--ok); }
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(20, 16, 40, .45); }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; }
.modal .mh h2 { margin: 0; }
.modal .mb { padding: 14px 20px; display: grid; gap: 12px; max-height: 70vh; overflow: auto; }
.modal .mf { padding: 0 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.x { border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--muted); }

/* brand */
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, #6d4fd8, #c056d8); position: relative; }
.logo::after { content: ''; position: absolute; inset: 7px 6px 6px; border: 2.5px solid #fff; border-top-width: 5px; border-radius: 2px 2px 4px 4px; }

/* app shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; }
.side .brand { margin: 0 8px 18px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 500; }
.nav:hover { background: var(--bg); } .nav.on { background: var(--soft); color: var(--accent-2); font-weight: 700; }
.nav .i { width: 20px; text-align: center; }
.side .grow { flex: 1; }
.credits { padding: 12px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 6px; font-size: .9em; }
.credits b { font-size: 1.4rem; }
.main { min-width: 0; padding: 22px clamp(16px, 3vw, 34px) 60px; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { margin: 0; }
.top .sp { flex: 1; }
.burger { display: none; }
.wrap { max-width: 1000px; }

/* home */
.start { padding: 26px; }
.start h2 { font-size: 1.35rem; }
.linkrow { display: flex; gap: 10px; flex-wrap: wrap; }
.linkrow input { flex: 1 1 320px; min-height: 50px; font-size: 1.02rem; }
.more-toggle { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 10px 0 0; }
.brief { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.brief .full { grid-column: 1 / -1; }
.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 16px; }
.way { border: 1px dashed #d6d0ea; border-radius: 12px; padding: 14px; font-size: .92em; }
.bm { display: inline-block; padding: 7px 14px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; cursor: grab; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.pcard .th { aspect-ratio: 4 / 3; background: var(--soft) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 2rem; }
.pcard .b { padding: 12px 14px; display: grid; gap: 4px; }
.pcard .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 12px; }

/* building / draft */
.building { max-width: 560px; margin: 40px auto; text-align: center; }
.building .stage { font-size: 1.15rem; font-weight: 700; margin: 10px 0; }
.steps-list { text-align: left; display: grid; gap: 6px; margin: 18px auto 0; max-width: 360px; color: var(--muted); }
.steps-list .done { color: var(--ok); } .steps-list .now { color: var(--text); font-weight: 700; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs .tb { position: relative; width: 84px; height: 84px; border-radius: 10px; background: var(--soft) center / cover; border: 2px solid transparent; }
.thumbs .tb.on { border-color: var(--accent); }
.thumbs .tb .n { position: absolute; left: 4px; top: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: .7em; padding: 0 5px; border-radius: 5px; }
.thumbs .tb .acts { position: absolute; inset: auto 2px 2px 2px; display: flex; gap: 2px; justify-content: center; }
.thumbs .tb .acts button { border: 0; background: rgba(255,255,255,.92); border-radius: 5px; font-size: .75em; cursor: pointer; padding: 1px 5px; }
.thumbs button.tb { cursor: pointer; padding: 0; }
.drop { border: 2px dashed #d6d0ea; border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--soft); }

/* editor */
.editor { display: grid; grid-template-columns: minmax(330px, 400px) 1fr; gap: 16px; height: calc(100vh - 110px); min-height: 520px; }
.editor > div { min-width: 0; min-height: 0; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.tabs button { border: 0; background: none; padding: 7px 8px; border-radius: 8px; font: inherit; font-size: .93em; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--soft); color: var(--accent-2); }
.tab { flex: 1; overflow: auto; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; gap: 12px; align-content: start; }
.tab > .seg { justify-self: start; }
.stack { grid-template-columns: minmax(0, 1fr); }
.preview-col { display: flex; flex-direction: column; gap: 10px; }
.pbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pbar select { width: auto; max-width: 100%; min-height: 34px; padding: 4px 10px; }
.pbar #ver { flex: 0 1 260px; min-width: 0; text-overflow: ellipsis; }
.pbar .sp { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 11px; font: inherit; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--soft); color: var(--accent-2); font-weight: 700; }
.frame-wrap { flex: 1; background: #e9e6f2; border-radius: 14px; overflow: hidden; display: flex; justify-content: center; position: relative; min-height: 300px; }
.frame-wrap iframe { border: 0; background: #fff; position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.frame-wrap.mobile iframe { position: static; width: 390px; max-width: 100%; height: 100%; transform: none;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.frame-wrap .busy { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: #2a2536; color: #fff; padding: 7px 14px; border-radius: 99px; font-size: .88em; z-index: 2; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msgs { display: grid; gap: 8px; }
.msg { padding: 9px 12px; border-radius: 12px; max-width: 92%; white-space: pre-wrap; word-wrap: break-word; font-size: .94em; }
.msg.user { background: var(--accent); color: #fff; justify-self: end; border-bottom-right-radius: 4px; }
.msg.assistant { background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.error { background: #fdecea; color: #8a2318; }
.msg .v { display: block; font-size: .78em; opacity: .7; margin-top: 3px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 11px; font: inherit; font-size: .85em; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.composer { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: -14px; background: #fff; padding: 8px 0 2px; }
.composer textarea { min-height: 44px; max-height: 160px; }

/* section editor */
.sec { border: 1px solid var(--line); border-radius: 11px; }
.sec.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(109,79,216,.15); }
.sec.off .sh .t { opacity: .5; text-decoration: line-through; }
.sh { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; cursor: pointer; }
.sh .t { flex: 1; min-width: 0; font-weight: 700; font-size: .92em; }
.sh .t span { display: block; font-weight: 400; color: var(--muted); font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb { padding: 4px 12px 12px; display: grid; gap: 10px; border-top: 1px solid var(--line); }
.items { display: grid; gap: 8px; }
.item { background: var(--bg); border-radius: 9px; padding: 8px; display: grid; gap: 6px; }
.item .row { justify-content: space-between; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.swatch { border: 2px solid var(--line); border-radius: 10px; padding: 6px; cursor: pointer; background: #fff; font: inherit; font-size: .78em; text-align: left; }
.swatch.on { border-color: var(--accent); }
.swatch .c { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin-bottom: 4px; }
.swatch .c i { flex: 1; }
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.colors label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.vtable { width: 100%; border-collapse: collapse; font-size: .88em; }
.vtable th, .vtable td { padding: 4px; text-align: left; border-bottom: 1px solid var(--line); }
.vtable input { min-height: 30px; padding: 3px 6px; }
.pubsteps { display: grid; gap: 4px; font-size: .9em; }
.linklist { display: grid; gap: 6px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(420px, 100%); display: grid; gap: 14px; }
.auth .brand { justify-self: center; margin-bottom: 6px; }

/* admin / tables */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .9em; background: #fff; }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-size: 1.5rem; }

/* plans */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 10px; align-content: start; }
.plan.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(109,79,216,.15); }
.plan .price { font-size: 2rem; font-weight: 800; }
.plan ul { margin: 0; padding-left: 1.1em; color: var(--muted); }

/* plain pages + landing */
body.plain main.narrow { max-width: 620px; margin: 40px auto; padding: 0 16px; display: grid; gap: 18px; }
.site-head { display: flex; align-items: center; gap: 14px; max-width: 1100px; margin: 0 auto; padding: 18px 20px; }
.site-head .sp { flex: 1; }
.site-head nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.site-head nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.hero-site { max-width: 1100px; margin: 0 auto; padding: 40px 20px 30px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.hero-site h1 { font-size: clamp(2rem, 4.5vw, 3.3rem); letter-spacing: -.02em; }
.hero-site p.lead { font-size: 1.15rem; color: var(--muted); max-width: 46ch; }
.mock { background: #fff; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.mock .bar { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.mock .bar i { width: 10px; height: 10px; border-radius: 50%; background: #e3dff0; }
.mock .in { padding: 18px; display: grid; gap: 10px; }
.mock .ln { height: 12px; border-radius: 6px; background: #eeebf6; }
.mock .hero-b { height: 120px; border-radius: 10px; background: linear-gradient(135deg, #f1ebe1, #e7ece3); display: grid; place-items: center; font-weight: 800; color: #3e6b4f; }
.blocks { max-width: 1100px; margin: 0 auto; padding: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.block { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.block .n { width: 30px; height: 30px; border-radius: 50%; background: var(--soft); color: var(--accent-2); display: grid; place-items: center; font-weight: 800; margin-bottom: 10px; }
.site-section { max-width: 1100px; margin: 0 auto; padding: 30px 20px; }
.site-foot { max-width: 1100px; margin: 30px auto 0; padding: 24px 20px 40px; border-top: 1px solid var(--line); display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .9em; }
.site-foot a { color: var(--muted); }

@media (max-width: 980px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .editor .preview-col { order: -1; height: 72vh; }
  .panel { max-height: none; }
  .tab { overflow: visible; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .burger { display: inline-flex; }
  .hero-site { grid-template-columns: 1fr; }
  .grid2, .colors { grid-template-columns: 1fr; }
  .main { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
}
