/* ==========================================================================
   Listing Studio — interface (not part of the exported images)
   ========================================================================== */
#listing { height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
#listing[hidden] { display: none; }
body[data-view="listing"] #builder, body[data-view="listing"] #viewer { display: none; }
body[data-view="listing"] { overflow: hidden; }

.lsbar { display: flex; align-items: center; gap: 12px; padding: calc(8px + var(--sat)) calc(14px + var(--sar)) 8px calc(14px + var(--sal)); background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.lstitle { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lstitle b { font-size: 15px; }
.lstitle span { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.lstitle i { font-style: normal; font-size: 11px; color: var(--mut); background: var(--hover); padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.lsactions { display: flex; gap: 8px; align-items: center; }
.lsactions .vb-btn.on { background: var(--acc2); border-color: var(--acc); color: var(--acc); }

.lsbody { flex: 1; min-height: 0; display: grid; grid-template-columns: 268px minmax(0, 1fr) 372px; }

/* ---------- gallery ---------- */
.ls-gallery { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding-left: var(--sal); }
.lg-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.lg-head b { flex: none; } .lg-head .muted { flex: 1; font-size: 11.5px; }
.lg-list { overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.lg-item { position: relative; display: grid; grid-template-columns: 16px 74px minmax(0, 1fr) 40px; gap: 8px; align-items: center; padding: 8px 8px 8px 6px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--field); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.lg-item:hover { border-color: var(--mut); }
.lg-item.sel { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc2); }
.lg-item.off { opacity: .5; }
.lg-item.drag { opacity: .35; } .lg-item.over { border-style: dashed; border-color: var(--acc); }
.lg-no { font-size: 11px; color: var(--mut); text-align: center; font-variant-numeric: tabular-nums; }
.lg-th { width: 74px; height: 74px; border-radius: 8px; overflow: hidden; background: var(--hover); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.lg-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lg-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lg-meta b { font-size: 12.5px; line-height: 1.25; } .lg-meta small { font-size: 11px; color: var(--mut); }
.lg-on { position: relative; width: 34px; height: 20px; justify-self: end; }
.lg-on input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.lg-on span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: .15s; }
.lg-on span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: .15s; }
.lg-on input:checked + span { background: var(--acc); } .lg-on input:checked + span::after { transform: translateX(14px); }
.lg-ctl { position: absolute; right: 6px; bottom: 6px; display: none; gap: 2px; }
.lg-item.sel .lg-meta, .lg-item:hover .lg-meta { padding-bottom: 26px; }
.lg-item:hover .lg-ctl, .lg-item.sel .lg-ctl { display: flex; }
.lg-ctl button { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; width: 22px; height: 22px; font-size: 11px; line-height: 1; padding: 0; color: var(--mut); }
.lg-ctl button:hover { color: var(--ink); border-color: var(--mut); }
.lg-warn { margin: 10px 10px 0; padding: 8px 10px; border-radius: 9px; background: rgba(220, 80, 60, .13); color: #c0392b; font-size: 12px; line-height: 1.35; }
.lg-ghost { flex: none; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; padding: 12px; border: 1.5px dashed var(--mut); border-radius: 12px; background: none; text-align: left; color: var(--ink); cursor: pointer; }
.lg-ghost:hover { border-color: var(--acc); background: var(--acc2); }
.lg-ghost b { font-size: 12.5px; } .lg-ghost small { font-size: 11px; color: var(--mut); line-height: 1.35; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--acc); animation: lsSpin .8s linear infinite; }
@keyframes lsSpin { to { transform: rotate(360deg); } }

/* ---------- canvas ---------- */
.ls-center { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ls-canvas { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 14px; overflow: hidden; }
.ls-wrap { position: relative; flex: none; box-shadow: var(--sh); background: #fff; border-radius: 4px; overflow: hidden; }
.ls-wrap > .ls-stage { transform-origin: 0 0; position: absolute; left: 0; top: 0; }
.ls-nav { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 6px 0 12px; font-size: 13px; color: var(--mut); }
.ls-preview [data-f] { cursor: pointer; }
.ls-preview [data-f]:hover { outline: 2px dashed rgba(70, 110, 255, .55); outline-offset: 4px; border-radius: 4px; }
.ls-preview .ls-sel { outline: 2px solid rgba(70, 110, 255, .95); outline-offset: 4px; border-radius: 4px; }
.ls-guide { position: absolute; left: 0; top: 0; width: 1140px; height: 1140px; pointer-events: none; z-index: 50; }
.ls-guide i { position: absolute; left: 0; right: 0; background: rgba(20, 22, 30, .38); }
.ls-guide i:first-child { border-bottom: 2px dashed #fff; } .ls-guide i:nth-child(2) { border-top: 2px dashed #fff; }
.ls-guide span { position: absolute; left: 0; right: 0; top: 150px; text-align: center; font: 600 14px/1 'Inter', sans-serif; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }

/* ---------- inspector ---------- */
.ls-insp { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding-right: var(--sar); }
.ls-tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.ls-tabs button { flex: 1; padding: 13px 6px; border: 0; background: none; font-weight: 600; font-size: 13px; color: var(--mut); border-bottom: 2.5px solid transparent; }
.ls-tabs button:hover { color: var(--ink); } .ls-tabs button.on { color: var(--ink); border-color: var(--acc); }
.ls-panel { flex: 1; overflow: auto; padding: 14px 16px 28px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.ep-head { display: flex; flex-direction: column; gap: 2px; } .ep-head b { font-size: 15px; } .ep-head small { color: var(--mut); font-size: 12px; }
.ep-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--mut); margin-top: 6px; } .ep-sec.first { margin-top: 0; }
.ep-sec small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.ep-f label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink); }
.ep-f label span { flex: 1; }
.ep-f em { font-style: normal; font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--hover); color: var(--mut); }
.ep-f em.ed { background: var(--acc2); color: var(--acc); } .ep-f em.bad { background: #fde6e6; color: #b42318; }
.ep-f .rs { border: 0; background: none; color: var(--acc); cursor: pointer; font-size: 15px; padding: 0 2px; line-height: 1; }
.ep-f.hot textarea, .ep-f.hot input { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc2); }
.ep-f textarea, .ep-f input[type=text], .ls-panel select, .ls-panel .f input[type=text] { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--field); outline: none; font: inherit; font-size: 13px; line-height: 1.45; resize: vertical; min-width: 0; }
.ep-f textarea:focus, .ep-f input:focus, .ls-panel select:focus, .ls-panel .f input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc2); }
.hint { color: var(--mut); font-size: 11.5px; }
.gchips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gchip { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px; background: var(--field); display: flex; flex-direction: column; gap: 7px; text-align: left; font-size: 12px; font-weight: 500; }
.gchip i { display: block; height: 10px; border-radius: 99px; }
.gchip.on { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc2); }
.bchips { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bchip { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); padding: 0; }
.bchip.on { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc2); }
.bchips input[type=color] { width: 34px; height: 34px; padding: 0; border: 2px solid var(--line); border-radius: 50%; background: none; cursor: pointer; }
.tips { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--mut); display: flex; flex-direction: column; gap: 6px; }
.tips b { color: var(--ink); }
.ls-res { margin-top: 10px; font-size: 12.5px; padding: 10px 12px; border-radius: 10px; background: var(--hover); }
.ls-res ul { margin: 8px 0 0; padding-left: 16px; color: var(--mut); } .ls-res li em { font-style: normal; color: var(--ink); }
.ls-res .bad { color: #b42318; font-weight: 600; } .ls-res .ok { color: var(--good); font-weight: 600; }
.ls-menu { position: fixed; z-index: 60; width: 330px; max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh); padding: 8px; }
.ls-menu .mn-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--mut); padding: 6px 10px; }
.ls-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 9px; text-align: left; }
.ls-menu .mn-full { background: var(--acc2); border: 1px solid var(--acc); margin-bottom: 6px; } .ls-menu .mn-full b { color: var(--acc); }
.ls-menu button:hover { background: var(--hover); } .ls-menu b { font-size: 13px; } .ls-menu small { color: var(--mut); font-size: 11.5px; line-height: 1.35; }
.ls-busy { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh); padding: 12px 16px; display: flex; align-items: center; gap: 14px; z-index: 70; min-width: min(420px, 92vw); }
.ls-busy[hidden] { display: none; }
.ls-busy .bar { flex: 1; height: 8px; border-radius: 99px; background: var(--hover); overflow: hidden; } .ls-busy .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #0a8ffa, #9b63b0, #e44f78, #f4601a); transition: width .15s; }
.ls-busy span { font-size: 12.5px; max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- smaller screens: preview on top, gallery as a strip, inspector below ---------- */
@media (max-width: 1100px) {
  .lsbody { display: flex; flex-direction: column; overflow: auto; }
  .ls-center { order: 1; flex: none; height: min(100vw, 64vh); position: sticky; top: 0; z-index: 4; background: var(--bg); }
  .ls-gallery { order: 2; flex: none; border-right: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .lg-list { flex-direction: row; overflow-x: auto; padding: 10px 12px; }
  .lg-item, .lg-ghost { flex: none; width: 230px; }
  .ls-insp { order: 3; flex: none; border-left: 0; }
  .ls-panel { overflow: visible; }
  .lsbar .lbl { display: none; }
  .lstitle span { display: none; }
}
@media (max-width: 560px) {
  .lsbar { gap: 8px; }
  .lsactions { gap: 6px; }
  .lsactions .btn.primary { padding: 8px 12px; font-size: 12.5px; }
  .xs-hide, .zip { display: none; }
  .lstitle b { white-space: nowrap; }
}
@media (pointer: coarse) { .lg-ctl button { width: 30px; height: 30px; font-size: 13px; } .lg-on { width: 42px; height: 24px; } .lg-on span::after { width: 20px; height: 20px; } .lg-on input:checked + span::after { transform: translateX(18px); } }

/* ---------- Figma designs ---------- */
.chip-fig { display: inline-block; padding: 0 7px; border-radius: 99px; background: var(--acc2); color: var(--acc); font-size: 10.5px; font-weight: 600; line-height: 16px; vertical-align: 1px; }
.chip-fig.warn { background: rgba(230, 160, 20, .18); color: #a86a00; }
.figline { margin: 8px 0 4px; font-size: 13px; line-height: 1.4; }
.figok { margin: 6px 0; font-size: 12px; color: var(--good); }
.figwarn { margin: 8px 0; padding: 9px 12px 9px 28px; border-radius: 10px; background: rgba(230, 160, 20, .13); font-size: 12px; line-height: 1.45; }
.figwarn li { margin: 3px 0; }
.mp-h { font-size: 11.5px; font-weight: 600; color: var(--mut); margin: 12px 0 4px; }
.mp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; align-items: center; margin: 4px 0; font-size: 12.5px; }
.mp-row select { width: 100%; }
details.lib { margin-top: 12px; }
details.lib summary { cursor: pointer; font-size: 12.5px; font-weight: 600; padding: 6px 0; }
.lib-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lib-list li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; align-items: start; }
.lib-list img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.lib-list b { display: block; font-size: 12.5px; line-height: 1.3; }
.lib-list small { display: block; margin-top: 2px; font-size: 11px; line-height: 1.35; color: var(--mut); }
.lib-list small.warn { color: #a86a00; } .lib-list small.ok { color: var(--good); }
.ls-panel code { font-size: 11.5px; background: var(--hover); padding: 1px 5px; border-radius: 5px; }
