/* Bozino - Snipe's console, in daylight: white paper and a soft blue that
   carries every action. Left: the work. Right: Telegram, as readers see it. */
:root {
  --bg: #f4f8fd; --surface: #ffffff; --card: #ffffff; --inset: #f1f6fc;
  --line: #e0e8f2; --line-strong: #c9d6e6;
  --text: #13213a; --text-2: #4c5d75; --text-3: #8696ab;
  --blue: #4f8fe8; --blue-strong: #2f72d4; --blue-soft: #e8f1fd; --blue-row: rgba(79, 143, 232, .14);
  --green: #23a86b; --red: #d9534a; --red-soft: #fdecea; --green-soft: #e6f6ee;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 8px; --bar: 48px; --fast: .12s;
  --shadow: 0 1px 2px rgba(19, 33, 58, .04), 0 4px 16px rgba(47, 114, 212, .06);
  /* Telegram */
  --tg-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tg-link: #168acd; --tg-accent: #3390ec; --tg-meta: #8a9aa9; --tg-code: #c74f73;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 var(--sans); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--text-3); }
a { color: var(--blue-strong); }

/* ---- the bar ---------------------------------------------------------------- */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: var(--bar);
       padding: 0 16px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.launchpad { position: relative; }
.launchpad-trigger { display: flex; align-items: center; gap: 8px; max-width: 280px; height: 32px; padding: 0 10px 0 5px; background: none;
                     border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 600; }
.launchpad-trigger:hover { border-color: var(--line-strong); }
.launchpad-chevron { width: 12px; height: 12px; flex: none; color: var(--text-3); }
.lp-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.launchpad-menu { position: absolute; top: 40px; left: 0; width: 330px; padding: 6px; background: var(--card);
                  border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 32px rgba(19, 33, 58, .14); }
.lp-group { margin: 4px 6px 6px; color: var(--text-3); font: 600 10px var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.lp-empty { padding: 4px 8px 8px; }
.lp-chat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; }
.lp-chat:hover, .lp-chat.is-active { background: var(--inset); }
.lp-chat.is-active { box-shadow: inset 2px 0 0 var(--blue); }
.lp-chat-text { display: grid; min-width: 0; flex: 1; }
.lp-chat-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.lp-chat-text small { color: var(--text-3); font-size: 11.5px; }
.warn { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-weight: 700; font-size: 11px; }
.lp-add { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 4px; padding: 9px 8px; border: 1px dashed var(--line-strong); border-radius: 8px;
          background: none; color: var(--blue-strong); font-weight: 600; cursor: pointer; }
.lp-add:hover { background: var(--blue-soft); border-color: var(--blue); }
.lp-add span { font-size: 16px; line-height: 1; }
.lp-foot { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 6px; padding: 9px 8px 5px; border: 0; border-top: 1px solid var(--line);
           background: none; color: var(--text-3); font-size: 12px; text-align: left; cursor: pointer; }
.lp-foot b { color: var(--text-2); font-weight: 600; }
.lp-foot-act { margin-left: auto; color: var(--blue-strong); }
.tabs { display: flex; gap: 2px; }
.tab { padding: 7px 12px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; }
.tab.is-active { color: var(--blue-strong); background: var(--blue-soft); box-shadow: inset 0 0 0 1px rgba(79, 143, 232, .25); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.model-pick { display: flex; align-items: center; gap: 6px; min-width: 0; height: 30px; padding: 0 4px 0 9px; border: 1px solid var(--line);
              border-radius: 6px; background: var(--surface); }
.model-pick:hover { border-color: var(--line-strong); }
.model-pick svg { width: 12px; height: 12px; color: var(--blue); flex: none; }
.model-pick select { max-width: 210px; height: 28px; border: 0; background: transparent; font: 600 12px var(--mono); cursor: pointer; outline: none; }
.rate { color: var(--text-2); font-size: 12px; white-space: nowrap; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.icon-btn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; background: var(--surface);
            border: 1px solid var(--line); border-radius: 6px; color: var(--text-3); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn svg { width: 16px; height: 16px; }
.entry { position: relative; }
.pop { position: absolute; right: 0; top: 38px; z-index: 40; display: grid; gap: 10px;
       width: 300px; padding: 12px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 12px 32px rgba(19, 33, 58, .14); }
.pop-title { color: var(--text-2); font-size: 12px; }
.gp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-2); font-size: 12px; }
.gp-account { padding-top: 10px; border-top: 1px solid var(--line); }
.ava { display: grid; place-items: center; flex: none; width: 32px; height: 32px; overflow: hidden; border-radius: 50%;
       background: linear-gradient(135deg, #8dbaf6, #3f7fe0); color: #fff; font-weight: 700; font-size: 14px; }
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava-sm { width: 22px; height: 22px; font-size: 11px; }
.ava-empty { background: var(--blue-soft); color: var(--blue-strong); }

/* ---- the desk: work on the left, Telegram on the right ------------------------------- */
.desk { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(360px, 470px); gap: 18px; align-items: start;
        max-width: 1640px; margin: 0 auto; padding: 16px; }
.work { display: grid; gap: 14px; min-width: 0; }
.stack { display: grid; gap: 14px; }
.views { display: flex; gap: 4px; padding: 3px; width: max-content; max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.views button { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: none;
                color: var(--text-2); font-weight: 600; white-space: nowrap; cursor: pointer; }
.views button:hover { color: var(--text); }
.views button.is-active { background: var(--blue-soft); color: var(--blue-strong); }
.count { padding: 0 6px; border-radius: 9px; background: var(--blue-soft); color: var(--blue-strong); font: 600 11px var(--mono); }
.views button.is-active .count { background: #fff; }
.count:empty { display: none; }

.panel { display: grid; gap: 10px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 10px; }
.panel-title { font-weight: 700; font-size: 13px; }
.panel-head .link { margin-left: auto; }
.panel-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--text-2); font-size: 12px; }
.hint { margin: 0; color: var(--text-3); font-size: 11.5px; line-height: 1.45; }
.status { color: var(--text-3); font-size: 12px; }
.status.err { color: var(--red); }
.status.ok { color: var(--green); }
.status a { margin-left: 4px; }
.counter { color: var(--text-3); font-size: 11.5px; }
.counter.over { color: var(--red); font-weight: 700; }

/* ---- the post editor ---------------------------------------------------------------- */
.editor-card { gap: 0; padding: 0; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 6px 8px; border-bottom: 1px solid var(--line); background: #fbfdff; }
.toolbar button { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border: 0; border-radius: 6px; background: none;
                  color: var(--text-2); font: 15px var(--tg-font); cursor: pointer; }
.toolbar button:hover { background: var(--inset); color: var(--text); }
.toolbar button.on { background: var(--blue-soft); color: var(--blue-strong); }
.toolbar svg { width: 16px; height: 16px; }
.tb-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line); }
.tb-right { margin-left: auto; padding-right: 4px; }
.editor-wrap { padding: 4px 0; }
.post-editor { min-height: 260px; max-height: 60vh; overflow: auto; padding: 12px 16px; outline: none; font: 15px/1.5 var(--tg-font); white-space: pre-wrap; word-wrap: break-word; }
.post-editor:empty::before { content: attr(data-placeholder); color: var(--text-3); pointer-events: none; }
.post-editor a { color: var(--tg-link); }
.post-editor code { padding: 1px 4px; border-radius: 4px; background: rgba(0, 0, 0, .06); color: #1c2733; font: 13.5px var(--mono); }
.post-editor pre { padding: 8px 10px; border-radius: 6px; background: #f0f3f7; font: 13px var(--mono); }
.post-editor blockquote { margin: 4px 0; padding: 3px 10px; border-left: 3px solid var(--tg-accent); border-radius: 4px; background: rgba(51, 144, 236, .08); }
.post-editor blockquote[data-expandable] { border-left-style: dashed; }
.post-editor blockquote[data-expandable]::after { content: "сворачиваемая"; display: block; color: var(--text-3); font-size: 11px; }
.post-editor .tg-spoiler { border-radius: 3px; background: rgba(120, 135, 155, .25); text-decoration: underline dotted var(--text-3); }
.post-editor.flash { animation: flash .9s ease; }
@keyframes flash { from { background: #eef7ff; } to { background: transparent; } }

.ai { display: grid; gap: 10px; padding: 12px 14px 14px; border-top: 1px solid var(--line); background: linear-gradient(180deg, #fafcff, #f5f9ff); }
.ai-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ai-label { margin-right: 4px; color: var(--text-3); font: 700 10px var(--sans); letter-spacing: .12em; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 15px;
        background: var(--surface); color: var(--text-2); font-weight: 600; cursor: pointer; transition: all var(--fast); }
.chip::before { content: ""; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: 50%; background: #fff; transition: all var(--fast); }
.chip:hover { border-color: var(--blue); }
.chip[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-strong); }
.chip[aria-pressed="true"]::before { border-color: var(--blue);
  background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3.5 7.2 6 9.5l4.5-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat; }
.opts-btn { width: 30px; height: 30px; border: 1px solid transparent; border-radius: 15px; background: none; color: var(--text-3); font-weight: 700; cursor: pointer; }
.opts-btn:hover, .opts-btn[aria-expanded="true"] { border-color: var(--line); background: var(--surface); color: var(--text); }
.live-note { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--green); font-size: 12px; font-weight: 600; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.ai-opts { display: flex; gap: 18px; flex-wrap: wrap; padding: 2px 0; }
.ai-opts .opt { justify-content: flex-start; }

.editor { width: 100%; padding: 10px 12px; resize: vertical; background: var(--inset); border: 1px solid var(--line);
          border-radius: 8px; font: 13px/1.5 var(--sans); outline: none; transition: border-color var(--fast), box-shadow var(--fast); }
.editor:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-row); background: var(--surface); }
.editor-sm { min-height: 64px; }
.img-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line-strong);
       border-radius: 7px; color: var(--text); text-decoration: none; cursor: pointer; font-weight: 600; white-space: nowrap; transition: border-color var(--fast), background var(--fast); }
.btn:hover { border-color: var(--blue); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(79, 143, 232, .3); }
.btn-primary:hover { background: var(--blue-strong); border-color: var(--blue-strong); }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn kbd { padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .22); font: 600 10.5px var(--mono); }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border: 2px solid #fff;
                   border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn:not(.btn-primary).busy::after { border-color: var(--blue); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { padding: 0; border: 0; background: none; color: var(--blue-strong); font-size: 12px; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.danger { color: var(--red) !important; }
.btn.danger:hover { border-color: var(--red); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; vertical-align: middle; background: var(--surface); }
.seg button { height: 26px; padding: 0 9px; background: transparent; border: 0; color: var(--text-3); cursor: pointer; font-size: 11.5px; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue-strong); }
.mini-select { height: 28px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 12px; max-width: 240px; }
.mini-select.wide { flex: 1; max-width: 420px; min-width: 160px; }
.check { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12px; cursor: pointer; }
.checks, .when { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dt { font-family: var(--mono); }
.connect-cta { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: linear-gradient(135deg, #f3f8ff, #e6f0fd); border-color: rgba(79, 143, 232, .3); }
.connect-cta b { font-size: 14px; }
.connect-cta p { margin-top: 3px; }
.editing-bar { display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-radius: 10px; background: #fff7e6; border: 1px solid #f3dfb2; color: #7a5a14; font-size: 12.5px; }
.editing-bar .link { margin-left: auto; }

/* ---- the channel's posts --------------------------------------------------------------- */
.posts { display: grid; gap: 10px; }
.post { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.post-img { flex: none; width: 96px; height: 64px; object-fit: cover; border-radius: 6px; }
.post-body { display: grid; gap: 7px; min-width: 0; flex: 1; }
.post-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.post-text { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 13px; color: var(--text); }
.post-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; background: var(--inset); color: var(--text-2);
         font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--green-soft); color: #137a4b; }
.badge.bad { background: var(--red-soft); color: var(--red); }
.badge.plan { background: var(--blue-soft); color: var(--blue-strong); }
.empty-note { padding: 26px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--text-3); text-align: center; }

/* ---- Telegram, the real thing -------------------------------------------------------- */
.tgwin { position: sticky; top: calc(var(--bar) + 16px); display: flex; flex-direction: column; height: calc(100vh - var(--bar) - 32px); min-height: 520px;
         overflow: hidden; border-radius: 16px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 10px 40px rgba(31, 70, 40, .14); background: #fff; }
.tg-top { display: flex; align-items: center; gap: 11px; padding: 9px 14px; background: #fff; border-bottom: 1px solid #e7e7e7; z-index: 1; }
.tg-top .ava { width: 40px; height: 40px; font-size: 17px; background: linear-gradient(135deg, #72d5fd, #2a9ef1); }
.tg-top .ava-empty { background: linear-gradient(135deg, #b9c7d6, #8fa3b8); color: #fff; }
.tg-who { display: grid; flex: 1; min-width: 0; font-family: var(--tg-font); }
.tg-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; color: #000; }
.tg-who small { color: var(--tg-meta); font-size: 13px; }
.tg-icon { width: 22px; height: 22px; color: #8e9aa6; flex: none; margin-left: 10px; }
.tg-chat { position: relative; flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 14px 14px 12px;
           background-color: #a5c98b;
           background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' fill='none' stroke='%232e4a1f' stroke-opacity='.13' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E %3Cpath d='M40 22l5 11 12 2-9 8 2 12-10-6-10 6 2-12-9-8 12-2z'/%3E %3Cpath d='M150 70c-14-9-22-17-22-26 0-6 5-11 11-11 5 0 9 3 11 7 2-4 6-7 11-7 6 0 11 5 11 11 0 9-8 17-22 26z'/%3E %3Cpath d='M226 52l46-22-14 46-11-15zM247 61l25-31'/%3E %3Ccircle cx='60' cy='140' r='16'/%3E%3Cpath d='M60 156c-4 8 4 14 0 26'/%3E %3Cpath d='M170 132a20 20 0 1 0 14 32 16 16 0 1 1-14-32z'/%3E %3Cpath d='M244 172v-36l22-6v34'/%3E%3Ccircle cx='238' cy='172' r='6'/%3E%3Ccircle cx='260' cy='164' r='6'/%3E %3Ccircle cx='50' cy='250' r='5'/%3E%3Cpath d='M50 244c-5-13 5-13 0 0M56 250c13-5 13 5 0 0M50 256c5 13-5 13 0 0M44 250c-13 5-13-5 0 0'/%3E %3Cpath d='M128 264h42a10 10 0 0 0 0-20 14 14 0 0 0-27-4 10 10 0 0 0-15 24z'/%3E %3Crect x='232' y='238' width='38' height='27' rx='4'/%3E%3Cpath d='M232 242l19 13 19-13'/%3E %3Cpath d='M106 94v10M101 99h10M200 204v10M195 209h10M108 198l5 5M113 198l-5 5M204 94l5 5M209 94l-5 5M20 190l4 4M24 190l-4 4M280 110v8M276 114h8'/%3E %3Cpath d='M92 30c6-4 12 4 18 0s12 4 18 0'/%3E%3Cpath d='M180 288c6-4 12 4 18 0'/%3E %3C/svg%3E"), linear-gradient(150deg, #d1dd9a 0%, #a9cb8e 38%, #8fbd8c 70%, #a3c990 100%);
           background-size: 230px 230px, 100% 100%; }
.tg-day { align-self: center; padding: 3px 10px; border-radius: 12px; background: rgba(69, 105, 61, .38); color: #fff; font: 600 13px var(--tg-font); }
.tg-msg { position: relative; align-self: flex-start; max-width: min(100%, 480px); margin-left: 8px; }
.tg-bubble { position: relative; overflow: hidden; min-width: 120px; border-radius: 16px 16px 16px 6px; background: #fff;
             box-shadow: 0 1px 1.5px rgba(16, 35, 47, .15); font: 15px/1.375 var(--tg-font); color: #000; }
.tg-msg::before { content: ""; position: absolute; left: -8px; bottom: 0; width: 11px; height: 18px;
                  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 18'%3E%3Cpath d='M11 0v18H1.5C.3 18-.4 16.6.4 15.7 4.3 11.2 8 7 11 0z' fill='%23fff'/%3E%3C/svg%3E") no-repeat; }
.tg-photo { display: block; width: 100%; height: auto; max-height: 520px; object-fit: cover; }
.tg-body { padding: 6px 11px 6px 12px; white-space: pre-wrap; word-wrap: break-word; }
.tg-body::after { content: ""; display: block; clear: both; }
.tg-empty { color: var(--tg-meta); }
.tg-time { float: right; position: relative; top: 4px; margin: 0 -3px 0 14px; color: var(--tg-meta); font-size: 12.5px; line-height: 1; white-space: nowrap;
           user-select: none; display: inline-flex; align-items: center; gap: 4px; }
.tg-time svg { width: 15px; height: 15px; }
.tg-time.over-photo { position: absolute; right: 8px; bottom: 8px; top: auto; float: none; margin: 0; padding: 3px 7px; border-radius: 10px; background: rgba(0, 0, 0, .35); color: #fff; }
.tg-body a { color: var(--tg-link); text-decoration: none; }
.tg-body a:hover { text-decoration: underline; }
.tg-body code { padding: 1px 4px; border-radius: 4px; background: rgba(0, 0, 0, .06); color: #1c2733; font: 13.5px var(--mono); cursor: pointer; }
.tg-body pre { margin: 4px 0; padding: 7px 10px; border-left: 3px solid var(--tg-accent); border-radius: 6px; background: rgba(0, 0, 0, .05);
               font: 13.5px/1.4 var(--mono); white-space: pre-wrap; }
.tg-body pre code { color: #222; }
.tg-body blockquote { position: relative; margin: 3px 0; padding: 2px 24px 3px 9px; border-radius: 6px; background: rgba(51, 144, 236, .1);
                      box-shadow: inset 3px 0 0 var(--tg-accent); }
.tg-body blockquote::after { content: ""; position: absolute; top: 5px; right: 6px; width: 12px; height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 4h4v4c0 2-1 3.5-3 4l-.6-1C4.6 10.5 5 9.6 5 8.5H3zm6 0h4v4c0 2-1 3.5-3 4l-.6-1c1.2-.5 1.6-1.4 1.6-2.5H9z' fill='%233390ec'/%3E%3C/svg%3E") no-repeat center / contain; }
.tg-body blockquote.expandable { max-height: calc(3 * 1.375em + 5px); overflow: hidden; cursor: pointer; }
.tg-body blockquote.expandable::after { top: auto; bottom: 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%233390ec' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.tg-body blockquote.expandable.open { max-height: none; }
.tg-body blockquote.expandable.open::after { transform: rotate(180deg); }
.tg-body tg-spoiler { border-radius: 4px; color: transparent; cursor: pointer;
  background: radial-gradient(circle, rgba(0, 0, 0, .35) .9px, transparent 1.2px) 0 0 / 5px 5px, rgba(0, 0, 0, .06);
  animation: dust 1.2s linear infinite; }
.tg-body tg-spoiler.shown { color: inherit; background: none; animation: none; }
@keyframes dust { to { background-position: 5px 3px, 0 0; } }
.tg-lp { display: block; position: relative; margin: 6px 0 2px; padding: 5px 28px 6px 10px; border-radius: 6px; background: rgba(51, 144, 236, .1); box-shadow: inset 3px 0 0 var(--tg-accent);
         white-space: normal; font-size: 14px; line-height: 1.3; }
.pic-ico.tg-lp-x { position: absolute; right: 4px; top: 4px; z-index: 2; width: 18px; height: 18px; }
.tg-lp b { display: block; color: var(--tg-accent); font-weight: 600; }
.tg-lp strong { display: block; font-weight: 600; }
.tg-lp span { display: block; color: #222; }
.tg-lp img { display: block; width: 100%; margin-top: 6px; border-radius: 6px; }
.tg-lp.above { margin: 0 0 6px; }
.tg-bottom { display: grid; place-items: center; height: 48px; border-top: 1px solid #e7e7e7; background: #fff; color: var(--tg-accent); font: 600 14px var(--tg-font); }

/* ---- the Telegram dialog ------------------------------------------------------------------ */
.modal { width: min(540px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text);
         box-shadow: 0 30px 80px rgba(19, 33, 58, .22); }
.modal::backdrop { background: rgba(19, 33, 58, .28); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.modal-body { display: grid; gap: 18px; max-height: calc(100vh - 140px); overflow: auto; padding: 16px; }
.mod-sec { display: grid; gap: 10px; }
.mod-title { color: var(--text-3); font: 600 10.5px var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input { height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--inset); outline: none; font-size: 14px; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-row); background: var(--surface); }
.input-sm { height: 32px; flex: 1; min-width: 180px; font-size: 13px; }
.connected { display: grid; gap: 6px; }
.conn { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; transition: background .6s; }
.conn.fresh { background: var(--green-soft); border-color: rgba(35, 168, 107, .35); }
.conn-acts { display: flex; gap: 10px; flex: none; }
.bot-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; }
.bot-form { display: grid; gap: 8px; }

/* ---- sign-in ------------------------------------------------------------------------------- */
.session { display: grid; place-items: center; min-height: 100vh; padding: 16px;
           background: radial-gradient(1200px 600px at 50% -10%, #ddeafb, transparent), var(--bg); }
.session-card { width: min(380px, 100%); display: grid; gap: 14px; padding: 28px; border-radius: 16px; background: var(--card);
                border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(47, 114, 212, .12); }
.session-card h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 20px; }
.session-card h1 svg { width: 26px; height: 26px; color: var(--blue); }
.session-card p { margin: 0; color: var(--text-3); }
.session-card .btn { height: 40px; }
.error { min-height: 1.2em; margin: 0; color: var(--red) !important; font-size: 12.5px; }

@media (max-width: 1240px) {
  .desk { grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); }
  .drafts { grid-column: 1 / -1; position: static !important; max-height: none !important; }
  .drafts-list { display: flex !important; overflow-x: auto; }
  .draft-item { flex: 0 0 220px; }
}
@media (max-width: 980px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .tgwin { position: static; height: 640px; }
}
@media (max-width: 640px) {
  .desk { padding: 10px; }
  .bar { flex-wrap: wrap; gap: 8px; height: auto; padding: 8px 10px; }
  .tabs { display: flex; flex-wrap: wrap; }
  .rate { display: none; }
  .lp-title { max-width: 120px; }
  .launchpad-menu { width: calc(100vw - 20px); }
  .model-pick select { max-width: 150px; }
  .live-note { margin-left: 0; }
}
.mod-sec .status:empty { display: none; }

/* ---- portfolio --------------------------------------------------------------------- */
.pf { display: grid; gap: 14px; max-width: 1100px; margin: 0 auto; padding: 16px; }
.pf-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf-q { flex: 1; min-width: 200px; }
.pf-pending b { font-size: 14px; }
.pf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.tile small { display: block; color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.tile b { display: block; margin-top: 4px; font: 600 20px var(--mono); font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-top: 6px; }
.bars span { position: relative; flex: 1; min-width: 4px; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--blue); opacity: .85; }
.bars span:hover { opacity: 1; background: var(--blue-strong); }
.bars span.zero { background: var(--line); }
.pf-timeline { display: grid; gap: 8px; }
.pf-day { position: sticky; top: calc(var(--bar) + 4px); z-index: 2; align-self: start; width: max-content; margin: 10px 0 2px; padding: 3px 10px;
          border-radius: 12px; background: var(--blue-soft); color: var(--blue-strong); font-weight: 700; font-size: 12px; }
.turn { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.turn-time { color: var(--text-3); font: 12px var(--mono); padding-top: 2px; }
.turn-main { display: grid; gap: 8px; min-width: 0; }
.turn-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.term { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; color: #fff; font: 700 11px var(--mono); }
.turn-prompt { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.5; }
.turn-imgs { display: flex; gap: 6px; flex-wrap: wrap; }
.turn-imgs img { width: 120px; height: 80px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; cursor: zoom-in; }
.turn details { border-top: 1px dashed var(--line); padding-top: 6px; }
.turn summary { color: var(--blue-strong); font-size: 12px; cursor: pointer; }
.turn-resp { margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; color: var(--text-2); font-size: 13px; max-height: 420px; overflow: auto; }
.pf-foot { display: flex; align-items: center; gap: 10px; justify-content: center; }
.zoom { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(19, 33, 58, .7); cursor: zoom-out; }
.zoom img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }

.pub-actions .btn svg { width: 15px; height: 15px; color: var(--tg-accent); }
.pub-actions #publish { margin-left: auto; }
#test-hint:empty { display: none; }
.modal-sm { width: min(420px, calc(100vw - 32px)); }
.cp-what { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.cp-btns { justify-content: flex-end; }

/* ---- models for every job ------------------------------------------------------------ */
button.model-pick { padding: 0 8px 0 9px; cursor: pointer; font: 600 12px var(--mono); color: var(--text); }
button.model-pick span { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.model-pick.working { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-strong); }
button.model-pick.working svg:first-child { animation: spin 1.6s linear infinite; }
.models-pop { width: 380px; }
.models-pop .mini-select { width: 210px; max-width: 210px; }

/* ---- the picture library ---------------------------------------------------------------- */
#img-panel.drop { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-row); }
#img-panel .panel-head .hint { margin-left: 2px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scroll-snap-type: x proximity; }
.g-add, .g-item { position: relative; flex: none; width: 108px; height: 72px; border-radius: 8px; scroll-snap-align: start; }
.g-add { display: grid; place-content: center; justify-items: center; border: 1.5px dashed var(--line-strong); color: var(--blue-strong); cursor: pointer; }
.g-add:hover { border-color: var(--blue); background: var(--blue-soft); }
.g-add span { font-size: 20px; line-height: 1; }
.g-add small { font-size: 11px; font-weight: 600; }
.g-item { overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--inset); }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-item:hover { border-color: var(--line-strong); }
.g-item.on { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-row); }
.g-item.on::after { content: "✓"; position: absolute; left: 5px; top: 5px; display: grid; place-items: center; width: 18px; height: 18px;
                    border-radius: 50%; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; }
.g-item img { pointer-events: none; }

/* ---- replies -------------------------------------------------------------------------------- */
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 13px; border-radius: 10px; background: var(--blue-soft);
             border: 1px solid rgba(79, 143, 232, .3); color: var(--blue-strong); }
.reply-bar > svg { width: 18px; height: 18px; flex: none; }
.reply-text { display: grid; min-width: 0; flex: 1; font-size: 12.5px; }
.reply-text b { font-size: 12px; }
.reply-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.tg-reply { display: block; margin: 2px 0 5px; padding: 3px 8px 4px; border-radius: 6px; background: rgba(51, 144, 236, .1); box-shadow: inset 3px 0 0 var(--tg-accent);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; line-height: 1.3; }
.tg-reply b { display: block; color: var(--tg-accent); font-weight: 600; }
.tg-reply span { display: block; overflow: hidden; text-overflow: ellipsis; color: #222; }
.tg-chat > :first-child { margin-top: auto; }
.tg-msg { display: flex; align-items: flex-end; gap: 8px; }
.tg-msg .tg-bubble { flex: 0 1 auto; min-width: 120px; }
.tg-acts { flex: none; display: flex; flex-direction: column; gap: 6px; opacity: 0; transition: opacity .15s; }
.tg-act { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
          background: rgba(69, 105, 61, .38); color: #fff; cursor: pointer; }
.tg-act:hover { background: rgba(51, 144, 236, .9); }
.tg-act svg { width: 16px; height: 16px; }
.tg-msg:hover .tg-acts, .tg-msg.replying .tg-acts { opacity: 1; }
.tg-msg.replying .tg-bubble { box-shadow: 0 0 0 2px var(--tg-accent), 0 1px 1.5px rgba(16, 35, 47, .15); }
.tg-new { align-self: center; padding: 2px 10px; border-radius: 10px; background: rgba(255, 255, 255, .75); color: var(--tg-accent); font: 600 12px var(--tg-font); }
.tg-msg.draft .tg-bubble { box-shadow: 0 1px 1.5px rgba(16, 35, 47, .15), 0 0 0 1.5px rgba(51, 144, 236, .35); }

/* ---- drafts ---------------------------------------------------------------------------- */
.drafts { position: sticky; top: calc(var(--bar) + 16px); display: grid; gap: 8px; max-height: calc(100vh - var(--bar) - 32px); grid-template-rows: auto 1fr; }
.drafts-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px;
               color: var(--text-3); font: 600 10.5px var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.drafts-list { display: grid; gap: 6px; align-content: start; overflow-y: auto; padding: 2px; }
.draft-item { position: relative; display: flex; gap: 8px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
              background: var(--card); cursor: pointer; transition: border-color var(--fast), box-shadow var(--fast); outline: none; }
.draft-item:hover, .draft-item:focus-visible { border-color: var(--line-strong); }
.draft-item.on { border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue), var(--shadow); }
.draft-thumb { position: relative; flex: none; width: 38px; height: 38px; overflow: hidden; border-radius: 6px; background: var(--inset); }
.draft-thumb img { width: 100%; height: 100%; object-fit: cover; }
.draft-thumb i { position: absolute; right: 2px; bottom: 2px; padding: 0 3px; border-radius: 4px; background: rgba(19, 33, 58, .7); color: #fff; font: 600 9px var(--mono); font-style: normal; }
.draft-body { display: grid; gap: 3px; min-width: 0; flex: 1; }
.draft-body b { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; font-weight: 500; line-height: 1.35; word-break: break-word; }
.draft-item.on .draft-body b { font-weight: 600; }
.draft-body small { color: var(--text-3); font-size: 11px; }
.draft-body em { font-style: normal; color: var(--blue-strong); font-weight: 600; }
.draft-del { position: absolute; right: 5px; top: 5px; display: none; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
             background: var(--inset); color: var(--text-3); font-size: 10px; cursor: pointer; }
.draft-item:hover .draft-del { display: grid; place-items: center; }
.draft-del:hover { background: var(--red-soft); color: var(--red); }

/* ---- the post's pictures, the library, references ----------------------------------------- */
.panel.drop { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-row); background: #f7fbff; }
.editor-card.drop { box-shadow: 0 0 0 3px var(--blue-row); }
.img-pick { margin-left: auto; cursor: pointer; }
#img-panel .panel-head .counter { margin-left: 0; }
.post-imgs { display: flex; gap: 8px; flex-wrap: wrap; min-height: 84px; }
.img-empty { display: grid; place-items: center; flex: 1; min-height: 84px; padding: 10px 14px; border: 1.5px dashed var(--line-strong); border-radius: 10px;
             color: var(--text-3); font-size: 12px; text-align: center; }
.pi { position: relative; display: flex; flex-direction: column; width: 120px; height: auto; overflow: hidden; border-radius: 8px; border: 2px solid transparent; cursor: grab; background: var(--inset); }
.pi.on { border-color: var(--blue); }
.pi img { width: 100%; height: 80px; object-fit: cover; display: block; pointer-events: none; }
.pi.dragging { opacity: .4; }
.pi.over { border-color: var(--blue); }
.pi-n { position: absolute; left: 4px; top: 4px; padding: 1px 6px; border-radius: 8px; background: rgba(19, 33, 58, .72); color: #fff; font: 600 10.5px var(--mono); z-index: 1; }
.pi-del { position: absolute; right: 4px; top: 4px; display: none; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
          background: rgba(19, 33, 58, .72); color: #fff; font-size: 10px; cursor: pointer; place-items: center; }
.pi:hover .pi-del, .ref:hover .pi-del { display: grid; }
.pi-del:hover { background: var(--red); }
.lib { border-top: 1px solid var(--line); padding-top: 8px; }
.lib summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 12.5px; list-style: none; }
.lib summary::before { content: "▸"; color: var(--text-3); transition: transform .15s; }
.lib[open] summary::before { transform: rotate(90deg); }
.lib summary .hint { margin-left: auto; font-weight: 400; }
.lib .gallery { margin-top: 8px; }
.gallery { flex-wrap: nowrap; }
.g-item { width: 104px; height: 70px; }
.g-n { position: absolute; left: 4px; top: 4px; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
       background: var(--blue); color: #fff; font: 700 10.5px var(--mono); }
.g-item.on::after { content: none; }
.g-item.ref { border-color: #e08a2b; }
.pic-tools { position: absolute; right: 3px; top: 3px; z-index: 2; display: flex; gap: 2px; }
.pic-ico { display: grid; place-items: center; flex: none; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px;
           background: rgba(19, 33, 58, .78); color: #fff; line-height: 0; cursor: pointer; }
.pic-ico svg { width: 11px; height: 11px; display: block; pointer-events: none; }
.pic-ico:hover { background: #13213a; }
.pic-ico.on-ref, .pic-ico.on-ref:hover { background: #e08a2b; }
.pic-ico.on-edit, .pic-ico.on-edit:hover { background: var(--blue-strong); }
.pic-ico.x:hover { background: var(--red); }
.pic-ico:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.refs-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.refs-label { color: var(--text-2); font-size: 12px; }
.refs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.refs-empty { color: var(--text-3); font-size: 12px; }
.ref { position: relative; display: grid; width: 64px; height: 44px; overflow: hidden; border-radius: 6px; border: 2px solid #e08a2b; background: #fff; }
.ref img { width: 100%; height: 100%; object-fit: cover; display: block; }
.edit-base { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 8px; background: var(--blue-soft); font-size: 12.5px; }
.edit-base[hidden] { display: none; }
.eb-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.eb-head .link { margin-left: auto; font-weight: 400; }
.eb-trail { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.eb-v { position: relative; flex: none; width: 84px; height: 56px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 6px;
        background: #fff; cursor: pointer; opacity: .75; transition: opacity var(--fast), border-color var(--fast); }
.eb-v:hover { opacity: 1; border-color: var(--line-strong); }
.eb-v.on { opacity: 1; border-color: var(--blue-strong); cursor: default; }
.eb-v img { width: 100%; height: 100%; object-fit: cover; display: block; }
.eb-v span { position: absolute; left: 3px; bottom: 3px; padding: 0 4px; border-radius: 4px; background: rgba(19, 33, 58, .72); color: #fff; font: 600 10px var(--mono); }
.eb-v.pending { display: grid; place-items: center; border: 1.5px dashed var(--blue); opacity: 1; cursor: default; }
.eb-v.pending::after { content: ""; width: 14px; height: 14px; border: 2px solid var(--blue); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.eb-note { color: var(--text-2); overflow-wrap: anywhere; }
.tg-photo-wrap { position: relative; display: block; overflow: hidden; }
.tg-photo-wrap > .tg-photo { display: block; width: 100%; }
.pic-ico.tg-photo-x { position: absolute; right: 6px; top: 6px; z-index: 2; width: 22px; height: 22px; border-radius: 50%; }
.tg-album-row .tg-photo-wrap { flex: 1; min-width: 0; height: 100%; }
.tg-album-row .tg-photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref .pi-del { width: 18px; height: 18px; right: 2px; top: 2px; }
.ref-add { display: grid; place-items: center; width: 48px; height: 48px; border: 1.5px dashed var(--line-strong); border-radius: 6px; color: var(--blue-strong);
           font-size: 18px; cursor: pointer; }
.ref-add:hover { border-color: var(--blue); background: var(--blue-soft); }

/* ---- albums and the channel's history in the preview --------------------------------------- */
.tg-album { display: grid; gap: 2px; background: #fff; }
.tg-album-row { display: flex; gap: 2px; }
.tg-album-row img { flex: 1; min-width: 0; height: 100%; object-fit: cover; display: block; }
.tg-msg.draft .tg-album + .tg-body { padding-top: 6px; }
.tg-history { align-self: center; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 90%;
              padding: 5px 12px; border-radius: 14px; background: rgba(255, 255, 255, .82); color: var(--text-2); font: 12.5px var(--tg-font); text-align: center; }
.tg-history button { padding: 0; border: 0; background: none; color: var(--tg-accent); font: 600 12.5px var(--tg-font); cursor: pointer; }
.tg-history button:hover { text-decoration: underline; }
.tg-history .err { color: var(--red); }

/* ---- feed actions, pins, URL buttons -------------------------------------------------------- */
.feed-menu { position: fixed; z-index: 60; display: grid; min-width: 210px; padding: 5px; background: var(--card); border: 1px solid var(--line-strong);
             border-radius: 10px; box-shadow: 0 12px 32px rgba(19, 33, 58, .18); }
.feed-menu button { padding: 8px 10px; border: 0; border-radius: 7px; background: none; text-align: left; font-size: 13px; cursor: pointer; }
.feed-menu button:hover { background: var(--inset); }
.feed-menu button.danger:hover { background: var(--red-soft); }
.tg-acts .tg-act:last-child { font: 700 16px/1 var(--sans); }
.tg-time svg + svg { margin-left: 2px; }
.tg-pinned { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 14px; border: 0; border-bottom: 1px solid #e7e7e7; background: #fff;
             text-align: left; cursor: pointer; font-family: var(--tg-font); }
.tg-pinned:hover { background: #f7f9fb; }
.tg-pin-bar { width: 2px; align-self: stretch; border-radius: 1px; background: var(--tg-accent); }
.tg-pin-text { display: grid; min-width: 0; flex: 1; font-size: 13px; line-height: 1.3; }
.tg-pin-text b { color: var(--tg-accent); font-weight: 600; }
.tg-pin-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #222; }
.tg-pinned svg { width: 16px; height: 16px; color: #8e9aa6; flex: none; }
.tg-msg.flash-msg .tg-bubble { box-shadow: 0 0 0 3px rgba(51, 144, 236, .55); transition: box-shadow .3s; }
.tg-col { display: grid; gap: 3px; min-width: 0; }
.tg-kb { display: grid; gap: 3px; }
.tg-kb-row { display: flex; gap: 3px; }
.tg-kb-btn { position: relative; flex: 1; min-width: 0; padding: 8px 18px; border-radius: 9px; background: rgba(69, 105, 61, .38); color: #fff;
             font: 600 14px var(--tg-font); text-align: center; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-kb-btn::after { content: "↗"; position: absolute; right: 6px; top: 3px; font-size: 10px; opacity: .85; }
.tg-kb-btn:hover { background: rgba(69, 105, 61, .5); }
.btns-block { display: grid; gap: 6px; }
.btns-edit { display: grid; gap: 6px; }
.btns-edit:empty { display: none; }
.be-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 6px; border: 1px dashed var(--line-strong); border-radius: 8px; }
.be-btn { display: inline-flex; gap: 4px; align-items: center; }
.be-text { width: 130px; max-width: none; }
.be-url { width: 180px; max-width: none; font-family: var(--mono); }
.be-del { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: var(--inset); color: var(--text-3); font-size: 10px; cursor: pointer; }
.be-del:hover { background: var(--red-soft); color: var(--red); }
.tg-msg::before { content: none; }
.tg-bw { position: relative; }
.tg-bw::before { content: ""; position: absolute; left: -8px; bottom: 0; width: 11px; height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 18'%3E%3Cpath d='M11 0v18H1.5C.3 18-.4 16.6.4 15.7 4.3 11.2 8 7 11 0z' fill='%23fff'/%3E%3C/svg%3E") no-repeat; }
.draft-title { cursor: text; }
.draft-ex { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); font-size: 11.5px; line-height: 1.35; }
.draft-rename { width: 100%; height: 26px; padding: 0 6px; border: 1px solid var(--blue); border-radius: 6px; outline: none; font: 600 12.5px var(--sans);
                box-shadow: 0 0 0 3px var(--blue-row); }
.post-editor[contenteditable="false"] { opacity: .6; }

/* ---- long words never widen the page ---------------------------------------------------------
   A word or a link with no spaces must wrap inside its box, and no grid or flex item may grow
   past its track because of what it holds - the whole page, the editor and every bubble. */
.desk > *, .work, .stack, .stack > *, .panel, .panel > *, .editor-card > *, .ai-row, .tg-col, .tg-bw, .tg-bubble, .tg-body,
.drafts-list, .draft-item, .draft-body, .posts, .post, .post-body, .pf, .pf-timeline, .turn, .turn-main, .modal-body, .conn, .bot-row { min-width: 0; }
.tg-msg .tg-col { flex: 0 1 auto; }
.post-editor, .tg-body, .tg-lp, .draft-body b, .draft-ex, .post-text, .turn-prompt, .turn-resp, .cp-what, .hint, .status,
.editing-bar, .connect-cta, .pf-pending, .empty-note, .tg-empty, .img-empty { overflow-wrap: anywhere; }
.post-editor code, .tg-body code { word-break: break-all; }
.post-editor pre, .tg-body pre { white-space: pre-wrap; word-break: break-all; }
.post-editor blockquote, .tg-body blockquote { overflow-wrap: anywhere; }
.reply-text, .tg-reply, .tg-pin-text, .lp-chat-text, .launchpad-trigger, .tg-who { min-width: 0; }
.tg-kb-row { min-width: 0; }
.status { max-width: 100%; }
.work, .stack { grid-template-columns: minmax(0, 1fr); }
.views { justify-self: start; }
.tg-reply b, .tg-reply span, .tg-pin-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- toasts: an action and its «Отменить» ----------------------------------------------------- */
.toasts { position: fixed; left: 50%; bottom: 20px; z-index: 200; display: grid; gap: 8px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); }
.toast { position: relative; display: flex; align-items: center; gap: 14px; overflow: hidden; padding: 10px 14px; border-radius: 10px;
         background: #1c2a3f; color: #fff; font-size: 13px; box-shadow: 0 10px 30px rgba(19, 33, 58, .3); overflow-wrap: anywhere; }
.toast.ok { background: #17714a; }
.toast.err { background: #b3413a; }
.toast button { flex: none; padding: 0; border: 0; background: none; color: #8fc0ff; font-weight: 700; cursor: pointer; }
.toast button:hover { text-decoration: underline; }
.toast i { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #8fc0ff; transform-origin: left; animation: undo 5s linear forwards; }
@keyframes undo { to { transform: scaleX(0); } }

/* ---- audit: badges and popovers keep inside ------------------------------------------------- */
.badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pop { max-width: calc(100vw - 20px); }
@media (max-width: 640px) {
  .models-pop { position: fixed; top: calc(var(--bar) + 6px); left: 10px; right: 10px; width: auto; }
  .models-pop .gp-row { flex-wrap: wrap; }
  .models-pop .mini-select { width: 100%; max-width: none; }
}
.pf, .pf-timeline, .posts, .connected, .modal-body, .drafts-list { grid-template-columns: minmax(0, 1fr); }
.turn-main, .post-body, .panel, .mod-sec, .bot-form, .drafts, .tg-col, .img-grid, .opts, .wb-nav, .draft-body { grid-template-columns: minmax(0, 1fr); }
.post-editor.working { opacity: 1; background: linear-gradient(90deg, transparent, rgba(79, 143, 232, .07), transparent) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; cursor: progress; }
@keyframes shimmer { to { background-position: -200% 0; } }

.pub-note { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: #fff4e5;
            border: 1px solid #f2d3a4; color: #7a4a0c; font-size: 12.5px; line-height: 1.45; }
.pub-note span { flex: 1; min-width: 220px; }
.pub-note .btn { border-color: #e0a85a; }

/* ---- posts desk: the post is written in the Telegram bubble ------------------------------ */
/* One screen, no page scroll: drafts | Telegram (the editor) | pictures and publishing.
   Each column scrolls on its own; publishing stays pinned at the bottom of its column. */
#sec-posts { grid-template-columns: 196px minmax(0, 1fr) 300px; grid-template-areas: "drafts tg work"; grid-template-rows: minmax(0, 1fr);
             gap: 8px; max-width: 1760px; height: calc(100vh - var(--bar)); padding: 8px; align-items: stretch; }
#sec-posts .drafts { grid-area: drafts; position: static; max-height: none; min-height: 0; }
#sec-posts .tgwin { grid-area: tg; position: static; height: auto; min-height: 0; border-radius: 12px; }
#sec-posts .work { grid-area: work; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; padding: 0 2px 0 0;
                   scrollbar-width: thin; }
#sec-posts .stack { gap: 8px; }
#sec-posts #view-compose { flex: 1 0 auto; display: flex; flex-direction: column; }
#sec-posts .panel { gap: 8px; padding: 10px; border-radius: 10px; box-shadow: none; }
#sec-posts .panel-title { font-size: 12.5px; }

/* drafts: a quiet list, two lines each */
#sec-posts .draft-item { gap: 7px; padding: 7px 8px; border-radius: 8px; }
#sec-posts .draft-thumb { width: 30px; height: 30px; }
#sec-posts .draft-body b { -webkit-line-clamp: 2; font-size: 12px; }
#sec-posts .draft-body small { font-size: 10.5px; }

/* the editor / scheduled / published switch */
#sec-posts .views { flex: none; width: 100%; padding: 2px; border-radius: 8px; }
#sec-posts .views button { flex: 1; justify-content: center; height: 26px; padding: 0 4px; font-size: 11.5px; border-radius: 6px; }

/* Telegram */
#sec-posts .tg-top { gap: 9px; padding: 6px 12px; }
#sec-posts .tg-top .ava { width: 34px; height: 34px; font-size: 15px; }
#sec-posts .tg-who b { font-size: 14px; }
#sec-posts .tg-who small { font-size: 12px; }
#sec-posts .tg-msg { max-width: min(100% - 8px, 720px); }
#sec-posts .tg-bubble, #sec-posts .tg-compose .post-editor { font-size: 16.5px; line-height: 1.42; }
#sec-posts .tg-chat { padding-inline: max(6px, calc((100% - 760px) / 2)); padding-block: 10px 8px; overflow-anchor: none; }   /* a wide window: the channel stays a centred column */
.tg-feed { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.tg-chat > .tg-feed:first-child { margin-top: auto; }
.tg-compose { align-self: stretch; }
.tg-compose .tg-col, .tg-compose .tg-bw { width: 100%; }
.tg-compose .tg-bubble { min-width: 0; width: 100%; cursor: text; }
.tg-compose .post-editor { min-height: 1.4em; max-height: none; overflow: visible; padding: 0; color: #000;
                           font: 15px/1.375 var(--tg-font); white-space: pre-wrap; }
.tg-compose .post-editor:empty::before { color: #9aa6b2; }
.tg-compose .tg-body { padding-top: 7px; white-space: normal; }   /* the markup's line breaks are not text; the editor keeps pre-wrap */
.tg-compose .tc-media:empty { display: none; }
.tg-compose .tc-media .tg-photo { display: block; width: 100%; }
.tg-compose #tc-time { display: block; text-align: right; }
.tg-compose #tc-time .tg-time { float: none; }
.toolbar.tg-tools { flex: none; flex-wrap: nowrap; gap: 0; padding: 4px 6px; border-top: 1px solid #e7e7e7; border-bottom: 0; background: #fff; overflow: hidden; }
.toolbar.tg-tools button { min-width: 28px; height: 28px; padding: 0 4px; }
.tg-tools .tg-kind { margin-left: auto; padding-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tg-accent);
                     font: 600 12px var(--tg-font); }

/* pictures: small thumbs, the library as a dense grid, tools only on hover */
#sec-posts #img-panel { flex: 1 0 auto; align-content: start; }
#sec-posts .img-pick { height: 24px; padding: 0 8px; font-size: 11.5px; }
#sec-posts .post-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 5px; min-height: 0; }
#sec-posts .post-imgs .img-empty { grid-column: 1 / -1; min-height: 0; padding: 7px 8px; border-width: 1px; border-radius: 8px; font-size: 11.5px; }
#sec-posts .pi { width: auto; border-width: 1.5px; border-radius: 6px; }
#sec-posts .pi img { height: 44px; }
#sec-posts .lib { padding-top: 6px; }
#sec-posts .lib summary { font-size: 12px; }
#sec-posts .lib summary .hint { font-size: 10.5px; }
#sec-posts .lib .gallery { margin-top: 6px; }
#sec-posts .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 5px; overflow: visible; padding: 0; }
#sec-posts .g-item { width: auto; height: 54px; border-width: 1.5px; border-radius: 6px; }
#sec-posts .g-item .pic-tools, #sec-posts .pi .pic-tools { opacity: 0; transition: opacity var(--fast); }
#sec-posts .g-item:hover .pic-tools, #sec-posts .pi:hover .pic-tools { opacity: 1; }

/* publishing: pinned to the bottom of its column, one line per choice */
#sec-posts #publish-panel { position: sticky; bottom: 0; z-index: 2; flex: none; gap: 7px; box-shadow: 0 -6px 14px rgba(244, 248, 253, .9); }
#sec-posts #publish-panel .panel-head { display: none; }
#sec-posts #publish-panel .opt { flex-wrap: nowrap; gap: 8px; font-size: 11.5px; }
#sec-posts #publish-panel .opt > span:first-child { flex: none; color: var(--text-3); }
#sec-posts #publish-panel .mini-select.wide { min-width: 0; max-width: none; height: 26px; }
#sec-posts #publish-panel .checks { gap: 4px 10px; justify-content: flex-end; }
#sec-posts #publish-panel .check { font-size: 11.5px; white-space: nowrap; }
#sec-posts #flags-row { align-items: flex-start; }
#sec-posts #test-hint { display: none; }
#sec-posts .pub-actions { flex-wrap: nowrap; gap: 6px; }
#sec-posts .pub-actions .btn { height: 30px; padding: 0 10px; font-size: 12px; }
#sec-posts .pub-actions #send-me { flex: none; }
#sec-posts .pub-actions #publish { flex: 1; }
#sec-posts .pub-actions svg { width: 14px; height: 14px; }

/* narrower: drafts become a strip above the pictures, Telegram keeps the whole height */
@media (max-width: 1280px) {
  #sec-posts { grid-template-columns: minmax(0, 1fr) 272px; grid-template-areas: "tg drafts" "tg work"; grid-template-rows: auto minmax(0, 1fr); }
  #sec-posts .drafts { display: flex; flex-direction: column; gap: 5px; }
  #sec-posts .drafts-list { display: flex !important; gap: 5px; overflow-x: auto; overflow-y: hidden; padding: 1px 1px 4px; scrollbar-width: thin; }
  #sec-posts .draft-item { flex: 0 0 132px; padding: 5px 7px; }
  #sec-posts .draft-thumb { display: none; }
  #sec-posts .draft-body b { -webkit-line-clamp: 1; }
}
/* phone: one column, Telegram gets most of the screen, the rest flows below it */
@media (max-width: 760px) {
  #sec-posts { grid-template-columns: minmax(0, 1fr); grid-template-areas: "drafts" "tg" "work"; grid-template-rows: auto; height: auto; padding: 8px; }
  #sec-posts .tgwin { height: 74vh; }
  #sec-posts .work { overflow: visible; }
}

/* planned posts sit in the feed where they will land; one click opens them for editing */
.tg-msg.planned { cursor: pointer; }
.tg-msg.planned .tg-bubble { box-shadow: 0 1px 1.5px rgba(16, 35, 47, .15), 0 0 0 1.5px rgba(51, 144, 236, .25); transition: box-shadow var(--fast); }
.tg-msg.planned:hover .tg-bubble { box-shadow: 0 0 0 2px var(--tg-accent); }
.tg-msg.planned.failed .tg-bubble { box-shadow: 0 0 0 2px var(--red); }
.tg-time.plan-time { color: var(--tg-accent); font-weight: 600; }
.tg-msg.failed .plan-time { color: var(--red); }

/* the hover actions of a channel post float over its corner instead of taking a column beside it */
#sec-posts .tg-msg .tg-acts { position: absolute; top: 6px; right: 6px; z-index: 2; flex-direction: row; gap: 4px; }
#sec-posts .tg-msg .tg-act { width: 28px; height: 28px; }
