/* RU: Единый редактор использует цвета и размеры дизайн-системы. EN: Unified editor uses design-system tokens. */
.adstudio { max-width:1560px; margin:0 auto; white-space:normal; font-weight:normal; }
.st-head,.st-editor-head,.st-dialog-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.st-head { margin-bottom:24px; }
.st-head-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:8px; flex-shrink:0; }
.adstudio h2,.adstudio h3,.st-dialog h3 { margin:0 0 12px; }
.st-head p { margin:0; max-width:680px; }
.st-layout { display:grid; grid-template-columns:240px minmax(0,1fr); gap:20px; align-items:start; }
.st-list { position:sticky; top:88px; padding:16px; max-height:calc(100dvh - 120px); overflow:auto; }
.adstudio input,.adstudio textarea,.adstudio select,.st-dialog input:not([type=radio]):not([type=checkbox]),.st-dialog textarea,.st-dialog select { width:100%; max-width:100%; box-sizing:border-box; padding:12px; border:1px solid var(--line-field); border-radius:var(--r); background:var(--surface); color:var(--ink); font:inherit; }
.adstudio textarea,.st-dialog textarea { resize:vertical; }
.st-list label { display:block; margin-bottom:12px; font-weight:600; }
.st-list input { margin-bottom:12px; }
.st-row { display:block; width:100%; text-align:left; padding:14px 12px; border:1px solid transparent; border-radius:var(--r); background:transparent; color:var(--ink); cursor:pointer; margin:4px 0; overflow-wrap:anywhere; }
.st-row strong,.st-row span { display:block; }
.st-row span { font-size:var(--fs-xs); color:var(--muted); margin-top:8px; }
.st-row:hover { background:var(--surface-2); }
.st-row.selected { background:var(--acc-soft); border-color:var(--acc); }
.st-editor { padding:24px; min-width:0; }
.st-editor-head h3 { margin-top:8px; overflow-wrap:anywhere; }
.st-editor-head #stSaved { flex:0 0 160px; text-align:right; }
.st-steps { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; padding:20px 0; border-bottom:1px solid var(--line); margin-bottom:24px; }
.st-steps button { display:flex; gap:8px; align-items:center; min-width:0; overflow-wrap:anywhere; white-space:normal; text-align:center; padding:12px 8px; background:var(--surface); border:1px solid var(--line); color:var(--muted); border-radius:var(--r); font:inherit; font-size:var(--fs-sm); cursor:pointer; }
.st-steps button[aria-current=step] { color:var(--acc-soft-ink); background:var(--acc-soft); border-color:var(--acc); font-weight:600; }
.st-steps button span { display:inline-grid; place-items:center; width:24px; height:24px; border:1px solid currentColor; border-radius:50%; flex-shrink:0; }
.st-work { display:grid; grid-template-columns:minmax(0,1fr) minmax(240px,.7fr); gap:28px; }
.st-form>section>label { display:block; margin:12px 0 8px; }
.st-form,.st-preview { min-width:0; }
.st-field { margin:0 0 20px; }
.st-field label,.st-dialog label:not(.st-choice label) { display:block; font-weight:600; margin:0 0 8px; }
.st-field small { display:block; margin-top:6px; font-size:var(--fs-xs); }
.st-required,.st-error,.st-form-error { color:var(--bad); }
.st-preview { align-self:start; position:sticky; top:92px; border:1px solid var(--line); border-radius:var(--r); overflow:hidden; background:var(--surface); }
.st-preview-label { font-size:var(--fs-xs); color:var(--muted); background:var(--surface-2); padding:12px 16px; }
#stPreview h3,#stPreview .st-price,#stPreview>.muted,#stPreview .st-preview-text,.st-preview-copy h3,.st-preview-copy .st-price,.st-preview-copy .st-preview-text { margin:16px; }
#stPreview img,.st-preview-copy img { width:100%; max-height:260px; object-fit:contain; display:block; }
.st-no-image { display:grid; place-items:center; min-height:180px; background:var(--surface-2); color:var(--muted); font-size:var(--fs-sm); }
.st-preview-text { white-space:pre-wrap; font-size:var(--fs-sm); line-height:1.65; overflow-wrap:anywhere; max-height:360px; overflow:auto; }
#stChecks { border-top:1px solid var(--line); padding:16px; font-size:var(--fs-sm); }
.st-check { display:block; width:100%; border:0; background:none; color:var(--ink-2); text-align:left; padding:8px 0; cursor:pointer; font:inherit; line-height:1.5; overflow-wrap:anywhere; }
.st-check:hover { color:var(--acc); text-decoration:underline; }
.st-ok { color:var(--ok); }
.st-review-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr)); gap:16px; margin:16px 0 24px; }
.st-review-grid>section,.st-review-grid>div { min-width:0; padding:14px; border:1px solid var(--line); border-radius:var(--r); overflow-wrap:anywhere; }
.st-review-grid h4 { margin:0 0 12px; }
.st-review-grid section+section { margin-top:18px; padding-top:14px; border-top:1px solid var(--line); }
.st-review-grid details+button { margin-top:10px; }
.st-review-facts { display:grid; gap:8px; margin:0; }
.st-review-facts>div { padding:8px; border-radius:var(--r); background:var(--surface-2); }
.st-review-facts dt,.st-review-facts small,.st-review-images small { display:block; font-size:var(--fs-xs); }
.st-review-facts dd { margin:3px 0 0; font-weight:600; }
.st-review-facts small { margin-top:2px; font-weight:400; }
.st-review-description { white-space:pre-wrap; }
.st-review-images { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,100px),1fr)); gap:10px; padding:0; list-style:none; }
.st-review-images button { display:block; width:100%; padding:0; border:1px solid var(--line); border-radius:var(--r); background:var(--surface); cursor:pointer; overflow:hidden; }
.st-review-images img { display:block; width:100%; aspect-ratio:4/3; object-fit:cover; }
.st-review-images strong { display:block; margin:4px 0; font-size:var(--fs-sm); }
.st-candidate { padding:16px; border:1px solid var(--line); border-radius:var(--r); margin:16px 0; }
.st-candidate-text { white-space:pre-wrap; line-height:1.65; overflow-wrap:anywhere; }
.st-text-actions { display:flex; flex-wrap:wrap; gap:12px; margin:16px 0; }
.st-text-actions .btn { white-space:normal; }
.st-edit-feedback { display:flex; flex-wrap:wrap; gap:8px; }
.st-edit-status { flex:0 0 100%; min-width:0; }
.st-edit-status.active { box-sizing:border-box; margin-top:12px; padding:12px; border:1px solid var(--acc); border-radius:var(--r); background:var(--acc-soft); color:var(--acc-soft-ink); }
.st-edit-status-line { display:flex; align-items:center; gap:10px; }
#stEditPercent { margin-inline-start:auto; white-space:nowrap; font-variant-numeric:tabular-nums; }
#stEditProgress { display:block; width:100%; height:8px; margin-top:10px; accent-color:var(--acc); }
.st-edit-elapsed { margin-top:6px; font-variant-numeric:tabular-nums; }
.st-edit-spinner { flex:0 0 auto; width:16px; height:16px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:spin .85s linear infinite; }
.st-edit-feedback:has(.st-edit-spinner:not([hidden])) + .st-text-actions .btn[aria-busy="true"]::after,
.st-edit-feedback:has(.st-edit-spinner:not([hidden])) .btn[aria-busy="true"]::after { display:none; }
@media(prefers-reduced-motion:reduce) { .st-edit-spinner { animation:none; } }
.st-actions { display:flex; gap:12px; flex-wrap:wrap; padding-top:24px; border-top:1px solid var(--line); margin-top:24px; }
.st-mobile-preview { display:none; }
.st-gallery { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.st-gallery figure { margin:0; border:1px solid var(--line); border-radius:var(--r); overflow:hidden; }
.st-gallery img { width:100%; aspect-ratio:4/3; object-fit:cover; display:block; }
.st-gallery figcaption { padding:8px; font-size:var(--fs-xs); }
.st-gallery figcaption>span { display:block; margin:8px 0; }
.st-photo-actions { display:flex; gap:8px; flex-wrap:wrap; }
.st-photo-confirm { display:flex!important; gap:10px; align-items:center; font-weight:normal!important; }
.adstudio .st-photo-confirm input { width:20px; height:20px; flex:0 0 20px; }
.st-image-full { display:block; max-width:100%; max-height:60dvh; margin:auto; object-fit:contain; }
.st-empty { padding:40px; }
.st-prepare { margin-top:28px; padding-top:24px; border-top:1px solid var(--line); }
.st-prepare>select { margin:8px 0 12px; max-width:360px; }
.st-prepare-list { display:grid; gap:12px; margin:16px 0; }
.st-prepare-row { padding:14px; border:1px solid var(--line); border-radius:var(--r); overflow-wrap:anywhere; }
.st-prepare-row p { margin:8px 0; }
.st-prepare-row .st-photo-confirm { margin-bottom:8px; }
.st-prepare .btn { white-space:normal; }
.st-prepare-skipped { margin:16px 0; }
.st-notice { background:var(--warn-soft); color:var(--ink); padding:16px; border-radius:var(--r); margin:16px 0; }
.st-notice .btn { margin:12px 0 0; display:flex; }
.st-dialog { width:min(620px,calc(100vw - 32px)); max-width:none; max-height:calc(100dvh - 40px); padding:0; color:var(--ink); background:var(--surface); border:0; border-radius:var(--r-l); box-shadow:var(--sh-3); box-sizing:border-box; flex-direction:column; overflow:hidden; }
.st-dialog[open] { display:flex; animation:pop3 var(--dur) var(--ease); }
.st-dialog::backdrop { background:var(--overlay); }
.st-dialog > .sh-h { align-items:center; }
.st-dialog > .sh-b { padding:16px; }
.st-dialog textarea,.st-dialog select { margin-bottom:16px; }
.st-dialog hr { border:0; border-top:1px solid var(--line); margin:24px 0; }
.st-handoff-choices { max-height:42dvh; overflow:auto; margin:12px 0; }
.st-dialog .st-handoff-choices label[hidden] { display:none; }
.st-handoff-card { border:1px solid var(--line); border-radius:var(--r); padding:12px; margin:12px 0; overflow-wrap:anywhere; }
.st-handoff-card summary { cursor:pointer; font-weight:600; }
.st-handoff-card .st-gallery img { object-fit:contain; }
.st-handoff-text { white-space:pre-wrap; }
.st-handoff-actions { margin-top:16px; }
@media(max-width:560px) {
  .adstudio .st-head { flex-direction:column; align-items:flex-start; gap:12px; }
  .st-head-actions { justify-content:flex-start; }
}
.st-choice { display:flex; gap:24px; border:0; padding:0; margin:0 0 20px; }
.st-choice legend { font-weight:600; margin-bottom:12px; }
.st-choice label { display:flex; align-items:center; gap:8px; min-height:44px; }
.st-choice input,.st-compare input { width:20px; height:20px; accent-color:var(--acc); }
.st-form-error { margin:12px 0; line-height:1.5; }
.st-compare { padding:16px 0; border-top:1px solid var(--line); }
.st-compare>div { display:grid; grid-template-columns:1fr 1fr; gap:16px; font-size:var(--fs-sm); }
.st-compare p { white-space:pre-wrap; overflow-wrap:anywhere; }
.st-import-dialog { width:min(1120px,calc(100vw - 32px)); }
.st-import-dialog input:not([type=checkbox]):not([type=radio]),.st-import-dialog select { margin-bottom:12px; }
.st-import-grid,.st-import-mapping { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:16px 0; }
.st-import-grid>div,.st-import-mapping>label { min-width:0; overflow-wrap:anywhere; }
.st-import-settings { padding:16px; border:1px solid var(--line); border-radius:var(--r); margin:16px 0; }
.st-import-dialog summary { cursor:pointer; font-weight:600; padding:8px 0; }
.st-import-counts { display:flex; flex-wrap:wrap; gap:12px; margin:20px 0; }
.st-import-counts>span { background:var(--surface-2); padding:8px 12px; border-radius:var(--r); }
.st-import-row-tools { display:grid; grid-template-columns:minmax(0,2fr) minmax(0,1fr); gap:12px; }
.st-import-row-tools label { min-width:0; }
.st-import-table tr[hidden] { display:none; }
.st-import-table tr:focus-visible { outline:2px solid var(--acc); outline-offset:-2px; }
.st-import-table { overflow:auto; max-width:100%; margin:16px 0; border:1px solid var(--line); border-radius:var(--r); }
.st-import-table table { width:100%; min-width:650px; border-collapse:collapse; font-size:var(--fs-sm); }
.st-import-table th,.st-import-table td { padding:12px; vertical-align:top; text-align:left; border-bottom:1px solid var(--line); overflow-wrap:anywhere; max-width:340px; white-space:normal; }
.st-import-table td small { display:block; margin:6px 0; color:var(--muted); }
.st-import-table input[type=checkbox] { width:20px; height:20px; accent-color:var(--acc); }
.st-import-table p { margin:0 0 8px; }
.st-import-table .btn { white-space:normal; }
.st-import-history { border-top:1px solid var(--line); margin-top:20px; padding-top:20px; }
.st-import-history h3 { font-size:var(--fs-sm); }
.st-import-raw { white-space:pre-wrap; overflow-wrap:anywhere; font-size:var(--fs-xs); }
.st-import-match { border-top:1px solid var(--line); padding:16px 0; overflow-wrap:anywhere; }
.st-match-field { margin:12px 0; }
.st-match-field>div { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.st-match-field p { margin:4px 0; padding:8px 10px; border-radius:var(--r); background:var(--surface-2); }
#stMatchError:empty { display:none; }
.st-cat-multi { display:flex; flex-wrap:wrap; gap:8px 20px; }
.st-cat-multi label { display:flex!important; align-items:center; gap:8px; font-weight:normal!important; }
.st-cat-multi input { width:20px!important; height:20px; flex:0 0 20px; }
#stCatBody fieldset { border:1px solid var(--line); border-radius:var(--r); margin:16px 0; padding:12px; }
#stCatBody details p { font-size:var(--fs-sm); white-space:pre-wrap; overflow-wrap:anywhere; }
#stCatBody input,#stCatBody select { margin-bottom:16px; }
@media(max-width:620px) { .st-import-grid,.st-import-mapping { grid-template-columns:minmax(0,1fr); } .st-import-settings { padding:12px; } .st-import-dialog { padding:16px; } }
@media(max-width:620px) {
  .st-import-row-tools { grid-template-columns:minmax(0,1fr); gap:0; }
  .st-import-table { overflow:visible; border:0; }
  .st-import-table table,.st-import-table tbody { display:block; min-width:0; }
  .st-import-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .st-import-table tr { display:block; border:1px solid var(--line); border-radius:var(--r); margin-bottom:16px; padding:8px; }
  .st-import-table td { display:block; max-width:none; padding:8px; border:0; }
  .st-import-table td::before { content:attr(data-label); display:block; font-size:var(--fs-xs); color:var(--muted); margin-bottom:6px; }
  .st-import-table td[data-label=Выбор],.st-import-table td[data-label=Строка] { display:inline-block; vertical-align:top; }
  .st-import-dialog>.st-dialog-head h2 { font-size:var(--fs-lg); }
  #stImportCreateGo { white-space:normal; width:100%; }
}
@media(max-width:1200px) { .st-layout { grid-template-columns:200px minmax(0,1fr); gap:16px; } .st-work { grid-template-columns:minmax(0,1fr); } .st-preview { display:none; } .st-mobile-preview { display:inline-flex; } }
/* RU: С4: на телефоне окно студии — шторка снизу, как лист пульта. EN: C4: a bottom sheet on phones. */
@media(max-width:820px) { .st-dialog { width:100%; max-width:100%; max-height:92dvh; margin:auto 0 0; border-radius:var(--r-l) var(--r-l) 0 0; } }
@media(prefers-reduced-motion:reduce) { .st-dialog[open] { animation:none; } }
@media(max-width:820px) { .st-layout { display:block; } .st-list { position:static; max-height:240px; margin-bottom:16px; } .st-editor { padding:16px; } .st-head { align-items:center; } .st-head h2 { font-size:var(--fs-xl); } .st-head p { font-size:var(--fs-sm); } .st-editor-head { display:block; } .st-editor-head #stSaved { display:block; text-align:left; margin:12px 0; } .st-steps { gap:4px; } .st-steps button { flex-direction:column; gap:8px; font-size:var(--fs-xs); padding:8px 2px; } .st-actions { position:sticky; bottom:calc(70px + max(8px, env(safe-area-inset-bottom))); z-index:2; background:var(--surface); padding-bottom:12px; } .st-actions .btn { flex:1; } }
@media(max-width:480px) { .st-gallery { grid-template-columns:minmax(0,1fr); } .st-steps { grid-template-columns:repeat(2,minmax(0,1fr)); } .st-steps button { flex-direction:row; gap:6px; padding:10px 6px; text-align:left; } }
.st-import-thumb{display:block;width:120px;border:1px solid var(--line);padding:0;border-radius:8px;overflow:hidden;background:transparent;cursor:pointer}
.st-import-thumb img{display:block;width:100%;height:90px;object-fit:contain}
@media(min-width:900px){.st-photo-import-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.st-photo-import-list .st-prepare-row{margin:0;min-width:0}}

/* RU: Встроенные стили блокируются CSP; длинные правки должны переноситься. EN: CSP blocks inline styles; wrap long edits in the approved stylesheet. */
.st-edit-prose { white-space:pre-wrap; overflow-wrap:anywhere; font-family:inherit; font-size:var(--fs-sm); }
#stTextEdit input[type=checkbox] { width:20px; height:20px; vertical-align:middle; margin-right:8px; accent-color:var(--acc); }

/* RU: Короткий поисковый список вместо тысяч option; ширина остаётся в форме. EN: Bounded search results stay within the form. */
.st-cat-results{max-height:260px;overflow:auto;border:1px solid var(--line);border-radius:8px;margin:6px 0;background:var(--surface)}
.st-cat-result.btn{display:block;width:100%;text-align:left;white-space:normal;overflow-wrap:anywhere;border:0;border-radius:0;height:auto;min-height:44px}
.st-cat-result[aria-selected="true"]{background:var(--acc-soft);color:var(--acc)}
.st-cat-search{min-width:0}
