:root {
  --bg: #f5f6f8; --panel: #fff; --side: #1f2430; --side-fg: #d6dae3; --fg: #1d2128; --muted: #6b7280;
  --line: #e3e6eb; --accent: #3b5bdb; --accent-fg: #fff; --ok: #2b8a3e; --err: #c92a2a; --warn: #e67700;
  --verdict: #f3f6ff; --verdict-line: #c5d0fa; --q: #e9ecf3; --code: #f1f3f5;
  --r: 12px; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15181e; --panel: #1d2128; --fg: #e4e7ec; --muted: #949aa6; --line: #2c313b; --side: #101318;
    --verdict: #1b2236; --verdict-line: #34427a; --q: #252a33; --code: #252a33; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
#app { height: 100%; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
textarea { resize: vertical; line-height: 1.45; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: 13px; } .pad { padding: 12px; }
.warn { color: var(--warn); }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.danger { color: var(--err); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.x { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 18px; padding: 0 6px; }

/* вход */
.login { display: grid; place-items: center; height: 100%; padding: 16px; }
.login-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; padding: 28px; }
.logo { width: 56px; height: 56px; margin: 0 auto; } .logo.big { width: 72px; height: 72px; }
.login h1 { margin: 0 0 8px; font-size: 22px; }

/* каркас */
.layout { display: flex; height: 100%; }
.side { width: 270px; flex: none; background: var(--side); color: var(--side-fg); display: flex; flex-direction: column; padding: 12px; gap: 10px; }
.side .btn.ghost { color: var(--side-fg); text-align: left; }
.threads { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.thr { display: flex; align-items: center; border-radius: 8px; }
.thr:hover, .thr.on { background: rgba(255,255,255,.08); }
.thr-t { flex: 1; padding: 8px 10px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.side-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 8px; display: flex; flex-direction: column; }
.me { font-weight: 600; padding: 4px 14px 6px; }
.bal { font-size: 13px; padding: 2px 14px 6px; opacity: .85; } .bal.low { color: #ff8787; opacity: 1; font-weight: 600; }
.cost { font-size: 12px; color: var(--muted); margin-left: 6px; }
main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
header .title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header .preset { width: auto; max-width: 46%; }
.burger { display: none; font-size: 20px; padding: 4px 8px; }
.scrim { display: none; }

.feed { flex: 1; overflow: auto; padding: 20px 16px 8px; }
.feed > * { max-width: 920px; margin-left: auto; margin-right: auto; }
.empty { text-align: center; margin-top: 10vh; } .empty p { max-width: 560px; margin: 8px auto; }
.composer { border-top: 1px solid var(--line); background: var(--panel); padding: 12px 16px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.composer > * { max-width: none; }
.composer .hint { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

/* ход беседы */
.turn { margin-bottom: 28px; display: flex; flex-direction: column; gap: 10px; }
.q { background: var(--q); border-radius: var(--r); padding: 12px 14px; white-space: pre-wrap; align-self: flex-end; max-width: 85%; }
.q-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.card-h { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; }
.card-h::-webkit-details-marker { display: none; }
.card-h .badge { margin-left: auto; }
.verdict { background: var(--verdict); border-color: var(--verdict-line); }
.verdict .card-h { cursor: default; }
.sub { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.answers { display: flex; flex-direction: column; gap: 8px; }
.gem { border-style: dashed; } .gem .acts a { text-decoration: none; color: inherit; }
.ans:not([open]) .card-h::before { content: "▸"; color: var(--muted); }
.ans[open] .card-h::before { content: "▾"; color: var(--muted); }
.ans.error { border-color: #f1b0b0; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; }
.badge.ok { background: #e6f4ea; color: var(--ok); } .badge.err { background: #fde8e8; color: var(--err); } .badge.wait { background: #fff4e0; color: var(--warn); }
@media (prefers-color-scheme: dark) { .badge.ok { background: #183222; } .badge.err { background: #3a1b1b; } .badge.wait { background: #3a2c12; } }
.spin { width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.error { color: var(--err); padding-top: 8px; white-space: pre-wrap; }
.acts { display: flex; gap: 6px; margin-top: 10px; }
.src { margin-top: 8px; font-size: 13px; } .src summary { cursor: pointer; color: var(--muted); } .src ol { margin: 6px 0; padding-left: 22px; } .src a { word-break: break-all; }

/* markdown */
.md { line-height: 1.55; overflow-wrap: anywhere; }
.md h2, .md h3, .md h4 { margin: 14px 0 6px; line-height: 1.3; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; }
.md p { margin: 8px 0; } .md ul, .md ol { margin: 6px 0; padding-left: 22px; } .md li { margin: 3px 0; }
.md code { background: var(--code); border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.md pre { background: var(--code); border-radius: 8px; padding: 10px 12px; overflow: auto; } .md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--line); margin: 8px 0; padding: 2px 12px; color: var(--muted); }
.tbl { overflow: auto; } .md table { border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--code); }

/* настройки */
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--bg); border-radius: 14px; width: 100%; max-width: 860px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel); gap: 8px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tab { background: none; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tab.on { background: var(--accent); color: var(--accent-fg); }
.modal-body { overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-body > div { display: flex; flex-direction: column; gap: 12px; }
.ed { display: flex; flex-direction: column; gap: 10px; }
.ed > summary { cursor: pointer; display: flex; gap: 6px; align-items: center; }
.ed > summary .badge { margin-left: auto; }
.field { display: flex; flex-direction: column; gap: 4px; } .field > span { font-size: 13px; color: var(--muted); }
.lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }
.slots { display: flex; flex-direction: column; gap: 6px; }
.slot { display: grid; grid-template-columns: 1.2fr 1fr auto auto; gap: 6px; align-items: center; }
.chk { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 14px; color: var(--fg); }
.chk input { width: auto; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .inl input { flex: 1; min-width: 120px; }
.users-chk { display: flex; gap: 14px; flex-wrap: wrap; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 99; max-width: 90vw; }
.toast.bad { background: var(--err); }

/* телефон */
@media (max-width: 760px) {
  .side { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; width: 82%; max-width: 300px; }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
  .burger { display: block; }
  header { padding: 8px 10px; } header .title { font-size: 14px; }
  .feed { padding: 14px 10px 8px; }
  .q { max-width: 95%; }
  .grid2 { grid-template-columns: 1fr; }
  .slot { grid-template-columns: 1fr 1fr; } .slot .chk, .slot .x { justify-self: start; }
  .composer { padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
.md.writing { opacity: .85; }

/* выбор нейросетей под полем вопроса */
.composer { position: relative; }
.mpick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.mpick:empty { display: none; }
.mpick .lbl { color: var(--muted); margin-right: 2px; }
.mpick label { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; user-select: none; }
.mpick label.on { border-color: #4f5bd5; background: #eef0ff; color: #1f2a8a; }
.mpick label.off { color: var(--muted); text-decoration: line-through; opacity: .8; }
.mpick input { margin: 0; accent-color: #4f5bd5; }
.mpick .judge { color: var(--muted); margin-left: 4px; }
.druz { display: none; position: absolute; left: 24px; bottom: 100%; margin-bottom: 8px; background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.18); white-space: nowrap; z-index: 5; }
.druz.show { display: block; }
.druz:after { content: ""; position: absolute; left: 28px; top: 100%; border: 8px solid transparent; border-top-color: #1f2937; }
#send:disabled { opacity: .45; cursor: not-allowed; }
.mpick input { width: auto; padding: 0; }
@media (prefers-color-scheme: dark) {
  .mpick label.on { background: #262c4a; color: #c7ccff; border-color: #5b66e0; }
}

/* выбор навыка Gemini */
.skl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 10px; font-size: 13px; }
.skl .lbl { color: var(--muted); }
.skl .chip { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: inherit; cursor: pointer; font: inherit; }
.skl .chip.on { border-color: #4f5bd5; background: #eef0ff; color: #1f2a8a; font-weight: 600; }
.skl .chip.add { color: #4f5bd5; border-style: dashed; }
@media (prefers-color-scheme: dark) { .skl .chip.on { background: #262c4a; color: #c7ccff; border-color: #5b66e0; } }

/* остановка, кнопки под вопросом */
.badge.stop { background: #eceef2; color: var(--muted); }
@media (prefers-color-scheme: dark) { .badge.stop { background: #2a2f38; } }
#send.danger { background: var(--err); color: #fff; border-color: var(--err); }
.q-acts { display: flex; gap: 12px; margin-top: 6px; white-space: normal; }
.lnk { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
.lnk:hover { color: var(--fg); text-decoration: underline; }

/* окошко «+ добавить» навык */
.addsk { max-width: 520px; padding: 18px 20px; }
.addsk h3 { margin: 0 0 2px; font-size: 17px; }
.addsk .sec { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 12px; display: grid; gap: 6px; }
.addsk .rl { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.addsk .chip { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: inherit; cursor: pointer; font: inherit; }
.addsk .chip:hover { border-color: #4f5bd5; }
.addsk .row { display: flex; gap: 8px; margin-top: 4px; }
.addsk .ft { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

/* поле вопроса: растёт под текст, кнопка «развернуть», большой редактор */
.qbox { position: relative; min-width: 0; }
.qbox textarea { display: block; resize: none; padding-right: 38px; max-height: 50vh; overflow-y: auto; }
.qexp { position: absolute; right: 8px; top: 7px; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.qexp:hover { color: var(--fg); border-color: var(--accent); }
.qcnt { grid-column: 1 / -1; font-size: 12px; color: var(--muted); text-align: right; margin-top: -6px; }
.qcnt:empty { display: none; }
.biged { max-width: 1000px; height: 88vh; max-height: 88vh; background: var(--panel); }
.biged .bh { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.bigq { flex: 1; border: 0; border-radius: 0; resize: none; padding: 16px 18px; font-size: 15px; line-height: 1.55; outline: none; }
.biged .bf { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.biged .bf .mpick { grid-column: auto; flex: 1; }
.biged .bbtn { display: flex; gap: 8px; }

/* настройки → нейросети */
.prov { display: grid; gap: 14px; }
.pblock { display: grid; gap: 8px; }
.pblock .ct, .catalog .ct { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.krow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.krow input[type=password] { max-width: 320px; }
.krow code { background: var(--bg); padding: 1px 6px; border-radius: 4px; }
.plist { display: grid; }
.prow { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.prow:first-child { border-top: 0; }
.prow .n { flex: 1; min-width: 0; }
.prow.off { opacity: .55; }
.tag { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: #eef0ff; color: #1f2a8a; white-space: nowrap; }
.tag.free { background: #e6f4ea; color: var(--ok); }
.price { font-size: 12.5px; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .tag { background: #262c4a; color: #c7ccff; } .tag.free { background: #183222; } }
/* каталог OpenRouter */
.catalog { max-width: 980px; height: 90vh; max-height: 90vh; padding: 14px 18px; gap: 10px; background: var(--bg); }
.cat-body { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.cat-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cat-top input { flex: 1; }
.cat-top select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chips .chip { padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.chips .chip.on { border-color: #4f5bd5; background: #eef0ff; color: #1f2a8a; font-weight: 600; }
.cat-list { flex: 1; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.crow { display: grid; grid-template-columns: 1fr 90px 90px 110px 110px; gap: 8px; align-items: center; padding: 7px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.crow > span:not(:first-child) { text-align: right; }
.crow.head { position: sticky; top: 0; background: var(--panel); border-top: 0; color: var(--muted); font-size: 12px; font-weight: 600; z-index: 1; }
.added { color: var(--ok); font-size: 12.5px; }
@media (max-width: 700px) { .crow { grid-template-columns: 1fr 80px 90px; } .crow > span:nth-child(2), .crow > span:nth-child(3) { display: none; } }
.skl .selff { margin-left: 8px; font-size: 13px; }

/* главная модель в чате */
.jrow { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 10px; }
.jrow.hidden { display: none; }
.jrow select { width: auto; padding: 4px 8px; }
.jrow.need { border-color: #f59f00; background: #fff8e6; }
.jrow .warn { color: #b35c00; font-weight: 600; }
@media (prefers-color-scheme: dark) { .jrow.need { background: #3a2c12; } .jrow .warn { color: #ffb347; } }
/* окошко «В какой роли отправить?» */
.sendx { max-width: 560px; }
.sendx .rl { display: grid; gap: 8px; margin: 12px 0; max-height: 55vh; overflow-y: auto; }
.rcard { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.rcard input { width: auto; margin: 3px 0 0; }
.rcard.on { border-color: #4f5bd5; background: #eef0ff; }
.rcard .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (prefers-color-scheme: dark) { .rcard.on { background: #262c4a; } }
.sendx label.chk input, .addsk label.chk input { width: auto; }
/* сценарии: поиск и роль главной */
.srchw { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.lnk.tip { font-size: 13px; padding: 0 4px; }
.rolenote { align-self: center; }
.howto summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.howto ol { margin: 8px 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13px; }
.thr-t.arch { color: #9aa3b5; }

/* ===== редизайн: карточка сценария, строка над полем, поле со стрелкой ===== */
header .hplus { margin-left: auto; font-size: 20px; padding: 2px 10px; line-height: 1; }
.empty { margin-top: 6vh; }
.empty .logo.big { width: 56px; height: 56px; }
.empty h2 { margin: 12px 0 16px; }
.pcard { max-width: 560px; margin: 0 auto; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.pcard .pl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pcard .pn { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 16px; font-weight: 600; margin: 3px 0 10px; }
.pcard .chg { font-size: 13px; color: var(--accent); white-space: nowrap; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--q); border: 1px solid var(--line); }
.pill i { font-style: normal; color: var(--ok); }
.pill.off { opacity: .45; text-decoration: line-through; }
.pnote { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.4; }
.pcard .jrow { margin-top: 10px; padding: 10px 0 0; border: 0; border-top: 1px dashed var(--line); border-radius: 0; background: none; }

.composer { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.composer > .jrow { margin: 0; }
.cline { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); padding: 0 4px; min-height: 18px; }
.cline .lnk { font-size: 13px; color: var(--muted); }
.cline .lnk b { color: var(--fg); font-weight: 500; }
.cline .cl-p { max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.cline .cl-c { margin-left: auto; white-space: nowrap; }
.composer .mpick { padding: 0 2px; }
.qbox { display: flex; align-items: flex-end; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 22px; padding: 6px 6px 6px 14px; }
.qbox:focus-within { border-color: var(--accent); }
.qbox textarea { flex: 1; border: 0; background: none; padding: 8px 0; outline: none; font-size: 15px; line-height: 1.4; min-height: 22px; }
.qbox .qexp { position: static; flex: none; width: 30px; height: 30px; margin-bottom: 4px; border-radius: 50%; }
.sendb { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0 0 0 2px; }
.sendb.stop { background: var(--err); font-size: 14px; padding: 0; }
.sendb:disabled { background: var(--line); color: var(--muted); opacity: 1; }
.jneed { font-size: 12.5px; color: var(--warn); padding: 0 6px; }
.jneed:empty, .qcnt:empty { display: none; }
.composer .qcnt { margin-top: -4px; }

.sheet-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--panel); width: 100%; max-width: 560px; max-height: 85vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 10px 16px max(18px, env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,.35); }
.sheet .grab { width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: 0 auto 10px; }
.sh-h { display: flex; justify-content: space-between; align-items: center; font-size: 16px; margin-bottom: 10px; }
.sh-l { display: grid; gap: 8px; }
.sh-o { text-align: left; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.sh-o.on { border-color: var(--accent); background: var(--verdict); }
.sh-o .a { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.sh-o .shtag { font-size: 12px; font-weight: 500; color: var(--ok); white-space: nowrap; }
.sh-o .b { font-size: 13px; color: var(--muted); margin-top: 3px; }
.sh-set { display: block; margin: 12px auto 0; font-size: 13px; }
@media (min-width: 761px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 16px; } .sheet .grab { display: none; } }
.pcard .jrow.need select { border-color: #f59f00; }
.composer .mpick .lbl { display: none; }
.cline .cl-r { white-space: nowrap; }
.bal.spend { padding-top: 0; } .bal.warnl { color: #ffd43b; opacity: 1; }

/* каталог: выданное админом, чужие сценарии и роли */
.tag.adm { background: #fff4e0; color: #b35c00; }
@media (prefers-color-scheme: dark) { .tag.adm { background: #3a2c12; color: #ffb347; } }
.sec { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 2px 6px; }
.give { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 8px 0; }
.ro { background: var(--code); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.ro.pre { white-space: pre-wrap; max-height: 260px; overflow: auto; }
.pitem > summary { cursor: pointer; } .pitem .psub { margin: 2px 0 0 18px; }
details.card > summary .tag { margin-left: 8px; }
summary .give { margin: 6px 0 0 18px; }
details.card > summary { flex-wrap: wrap; } details.card > summary .psub, details.card > summary .give { flex-basis: 100%; margin-left: 18px; }
.ed > summary::-webkit-details-marker { display: none; } .ed > summary::before { content: "▸"; color: var(--muted); } .ed[open] > summary::before { content: "▾"; }
.note { font-size: 13px; background: #fff8e6; border: 1px solid #f5d48a; border-radius: 8px; padding: 8px 10px; margin: 8px 0; color: #6b4e00; }
@media (prefers-color-scheme: dark) { .note { background: #3a2c12; border-color: #6b5520; color: #ffd8a0; } }
.crep { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 4px; font-size: 14px; } .crep .ok { color: var(--ok); } .crep .add { color: var(--accent); }
.sh-o .b.warn { color: var(--warn); }

/* ---- вложения ---- */
.qbox { padding-left: 6px; }
.qclip { flex: none; width: 34px; height: 34px; margin-bottom: 3px; border: 0; border-radius: 50%; background: none; font-size: 18px; cursor: pointer; padding: 0; opacity: .75; }
.qclip:hover { opacity: 1; background: var(--q); }
.composer.drag .qbox { border-color: var(--accent); border-style: dashed; }
.atts { display: flex; gap: 6px; flex-wrap: wrap; }
.atts:empty { display: none; }
.att { display: flex; align-items: center; gap: 7px; max-width: 220px; padding: 4px 6px 4px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 13px; }
.att img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; flex: none; }
.att .ai { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: var(--q); border-radius: 6px; flex: none; }
.att .an { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.att .an span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att .an i { font-style: normal; color: var(--muted); font-size: 12px; }
.att.err { border-color: var(--err); }
.att.err .an i { color: var(--err); }
.att .x { flex: none; border: 0; background: none; color: var(--muted); font-size: 17px; cursor: pointer; padding: 0 2px; }
.qfiles { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; margin-top: 8px; }
.qimg { position: relative; display: block; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.qimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qimg .spin { position: absolute; right: 4px; bottom: 4px; }
.qfile { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; color: var(--fg); text-decoration: none; max-width: 260px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ocrw { margin-top: 6px; display: flex; align-items: center; gap: 6px; }
details.ocr { margin-top: 8px; font-size: 14px; }
details.ocr summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.ocr-f { margin-top: 8px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; max-height: 50vh; overflow: auto; }
.saw { margin-left: 6px; font-size: 13px; cursor: help; }
.q .error.small { font-size: 13px; margin-top: 6px; }
.att-o { display: flex; align-items: center; gap: 12px; }
.att-o .ao-i { font-size: 24px; width: 32px; text-align: center; flex: none; }
