/* v1.0.21 «Публикации» (publications.js) and the size of the text of the whole Teacher (textsize.js).
   The page is a part of the cabinet: Teacher's own colours, cards, buttons and badges (style.css), no theme of its own
   (the owner, 2026-11-16: «если встраивать — то полностью»). The order is the owner's program: channels → post → when →
   queue. On a computer the page fits the window (body[data-pub-fit], set by publications.js when there is room): no
   scroll of the page, the long lists scroll inside their cards. Otherwise - a phone, or a large «А+» - the steps go one
   under another and the page scrolls as every page of the cabinet. */

/* the size of the text: the whole page scaled as one (a height in vh is scaled with it: divide by the zoom). Messages
   grow less (--toast-zoom, at most 125 %): at 200 % they no longer cover the page (the sandbox's finding 5). */
main,#modal{zoom:var(--text-zoom,1)}
#toasts{zoom:var(--toast-zoom,1)}
/* larger text on a narrow screen: a label that never wrapped may wrap now rather than stick out (tests/textsize.cjs) */
html[data-text-size]:not([data-text-size="100"]) :is(.chip,.badge,.pill,.pub-status){white-space:normal;max-width:100%}
.text-size-place{display:flex;align-items:center}
.text-size{display:inline-flex;align-items:center;gap:4px;padding:3px;border:1px solid var(--line-soft);border-radius:12px;background:var(--surface)}
.text-size button{min-height:36px!important;min-width:40px;padding:4px 8px!important;font-weight:650;border-radius:9px!important}
.text-size [data-text-size-value]{min-width:46px;text-align:center;font-size:13px;color:var(--text-2);font-variant-numeric:tabular-nums}

.pub{container-type:inline-size;container-name:pub;margin-top:12px;min-width:0}
.pub *{box-sizing:border-box}
.pub p{margin:0}

/* the grid: steps one under another (a phone), two columns (a tablet, a large «А+»), four (a computer) */
.pub-grid{display:grid;gap:12px;grid-template-columns:minmax(0,1fr);grid-template-areas:"channels" "post" "when" "actions" "queue"}
.pub-channels{grid-area:channels}.pub-post{grid-area:post}.pub-when{grid-area:when}.pub-actions{grid-area:actions}.pub-queue{grid-area:queue}
@container pub (min-width:700px){
  .pub-grid{grid-template-columns:minmax(0,1fr) minmax(0,1.3fr);grid-template-areas:"channels post" "when post" "actions actions" "queue queue"}
}
@container pub (min-width:1000px){
  .pub-grid{grid-template-columns:minmax(190px,.85fr) minmax(300px,1.35fr) minmax(250px,1fr) minmax(250px,1.05fr);
    grid-template-areas:"channels post when queue" "channels actions actions queue";align-items:start}
}

/* the page in the window (a computer): main is as high as the window, the grid takes what the cabinet's header leaves */
body[data-view="publications"][data-pub-fit]{min-height:0}
body[data-view="publications"][data-pub-fit] main{display:flex;flex-direction:column;height:calc((100vh - var(--pub-pad,28px)) / var(--text-zoom,1));
  height:calc((100dvh - var(--pub-pad,28px)) / var(--text-zoom,1))}
body[data-view="publications"][data-pub-fit] #content{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
body[data-view="publications"][data-pub-fit] #message:empty{display:none}
body[data-view="publications"][data-pub-fit] .pub{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
body[data-view="publications"][data-pub-fit] .pub-grid{flex:1 1 auto;min-height:0;grid-template-rows:minmax(0,1fr) auto;align-items:stretch}
body[data-view="publications"][data-pub-fit] .pub-card{min-height:0;overflow:auto}
body[data-view="publications"][data-pub-fit] .pub-scroll{flex:1 1 auto;min-height:0;overflow:auto}
body[data-view="publications"][data-pub-fit] .pub-editor{flex:1 1 auto;max-height:none;min-height:80px}
body[data-view="publications"][data-pub-fit] .pub-file-list{max-height:30%}
/* not in the window: the long lists keep a height of their own */
body:not([data-pub-fit]) .pub-channel-list{max-height:min(420px,calc(60vh / var(--text-zoom,1)));overflow:auto}
body:not([data-pub-fit]) .pub-queue-list{max-height:calc(80vh / var(--text-zoom,1));overflow:auto}

/* cards: the cabinet's */
.pub-card{display:flex;flex-direction:column;gap:10px;padding:12px 14px;background:var(--surface);border:1px solid var(--line-soft);border-radius:12px;min-width:0}
.pub-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 8px;min-height:36px;flex:0 0 auto}
.pub .pub-head h2{margin:0;font-size:13.5px;letter-spacing:.4px;text-transform:uppercase;color:var(--text-2);font-weight:650}
.pub-head h2{flex:0 0 auto}
.pub-head-tools{display:flex;align-items:center;gap:6px;min-width:0}
.pub-muted{color:var(--text-2)}
.pub-small{font-size:12.5px;color:var(--text-3)}
.pub-empty{display:flex;flex-direction:column;align-items:flex-start;gap:10px;color:var(--text-2);font-size:14px;padding:4px 0}
.pub-line{color:var(--text-3);font-size:14px;padding:6px 0}
.pub-off{max-width:760px}
.pub-off h2{margin:0 0 4px}

/* buttons: the cabinet's (style.css), smaller where a card needs room */
.pub .pub-icon-btn{min-height:36px;min-width:36px;padding:0 10px;font-size:18px;line-height:1}
.pub .pub-small-btn{min-height:36px;padding:5px 11px;font-size:13.5px}
.pub .pub-link,.pub-modal .pub-link{background:none;border:none;color:var(--accent);padding:4px 2px;min-height:32px;text-decoration:none;font-size:13.5px}
.pub .pub-link:hover,.pub-modal .pub-link:hover{background:none;text-decoration:underline}
.pub .pub-danger-text,.pub-modal .pub-danger-text{color:#f2b3b6}
.pub .pub-done{font-size:13.5px;color:var(--accent)}

/* channels */
.pub-count{font-size:13px;color:var(--text-3);font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.pub-channel-list{display:flex;flex-direction:column;gap:2px;margin:0 -6px}
.pub-channel{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;padding:6px;border-radius:10px;cursor:pointer}
.pub-channel:hover{background:var(--surface-2)}
.pub-channel input{width:20px;height:20px;accent-color:#3f6cb5;margin:0}
.pub-channel-info{display:flex;flex-direction:column;min-width:0;gap:1px}
.pub-channel-info strong{font-size:14.5px;font-weight:600;overflow-wrap:anywhere}
.pub-channel-info .pub-small{font-size:12.5px}
.pub .pub-problem{font-size:12.5px;color:#f2cd93;background:none;border:none;padding:2px 0;min-height:28px;text-align:left;justify-content:flex-start}
.pub .pub-problem:hover{background:none;text-decoration:underline}
.pub-channel-menu{display:flex;flex-wrap:wrap;gap:4px;margin-top:2px}
.pub-avatar{flex:0 0 auto;width:34px;height:34px;border-radius:999px;overflow:hidden;display:grid;place-items:center;font-weight:700;font-size:13px;
  background:#22304c;border:1px solid #3a4c72;color:#c8daf7}
.pub-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.pub-avatar-s{width:28px;height:28px;font-size:12px}

/* the post: the type, the files, the text */
.pub-kind{display:flex;align-items:center;gap:8px;min-width:0;max-width:100%}
.pub-select,.pub-input{width:100%;min-height:40px;padding:7px 10px;border:1px solid var(--line);border-radius:10px;background:var(--surface-2);color:var(--text);font:inherit;font-size:14.5px}
.pub-kind .pub-select{width:auto;min-width:0;max-width:min(170px,100%)}
.pub-select:focus,.pub-input:focus,.pub-editor:focus{outline:2px solid var(--accent);outline-offset:1px}
.pub-input[aria-invalid="true"]{border-color:#96484d}
.pub-drop{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;padding:8px 10px;border:1px dashed var(--line);border-radius:10px;background:var(--bg);flex:0 0 auto}
.pub-drop.is-over{border-color:var(--accent);background:#18294a}
.pub-drop.is-collapsed{border-color:transparent;background:none;padding:0}
.pub-drop-text{flex:1 1 160px;min-width:0;font-size:13px;color:var(--text-3)}
.pub-file-input{display:none}
.pub-file-list{display:flex;flex-direction:column;gap:6px;overflow:auto;flex:0 0 auto}
.pub-file{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:center;padding:5px 6px;border:1px solid var(--line-soft);border-radius:10px;background:var(--surface-2)}
.pub-file.is-error{border-color:#96484d}
.pub-thumb{width:36px;height:36px;border-radius:8px;overflow:hidden;display:grid;place-items:center;background:var(--bg);color:var(--text-3);font-size:16px}
.pub-thumb img{width:100%;height:100%;object-fit:cover}
.pub-file-info{display:flex;flex-direction:column;min-width:0;font-size:13.5px}
.pub-file-info strong{overflow-wrap:anywhere;font-weight:600}
.pub-progress{display:block;height:4px;border-radius:4px;background:var(--line);overflow:hidden;margin-top:3px}
.pub-progress span{display:block;height:100%;background:var(--accent)}
.pub-text{display:flex;flex-direction:column;min-height:0;flex:1 1 auto;position:relative}
.pub-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:2px;padding:3px;border:1px solid var(--line);border-bottom:none;border-radius:10px 10px 0 0;background:var(--surface-2)}
.pub .pub-tool{min-height:34px;min-width:32px;padding:0 6px;border:none;background:transparent;font-size:15px;border-radius:8px}
.pub .pub-tool:hover{background:#26334f}
.pub .pub-tool.is-bold{font-weight:800}.pub .pub-tool.is-italic{font-style:italic}.pub .pub-tool.is-under{text-decoration:underline}
.pub .pub-tool.is-strike{text-decoration:line-through}
.pub-sep{width:1px;height:20px;background:var(--line);margin:0 3px}
/* v1.0.21.1 (К-1 А): a button whose style is on the text under the caret or in the selection «горит»; the grey line under
   the buttons says how they work (the panel goes on down to the editor) */
.pub .pub-tool[aria-pressed="true"]{background:#2d4f86;color:#fff;box-shadow:inset 0 0 0 1px var(--accent)}
.pub .pub-tool[aria-pressed="true"]:hover{background:#355c9a}
.pub-text-hint{margin:0;padding:1px 9px 5px;border:1px solid var(--line);border-top:none;border-bottom:none;background:var(--surface-2);line-height:1.35}
.pub .pub-clear{color:var(--text-3)}
.pub-editor{min-height:110px;max-height:320px;overflow:auto;padding:10px 12px;border:1px solid var(--line);border-radius:0 0 10px 10px;
  background:var(--bg);color:var(--text);font-size:15px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
.pub-editor:empty::before{content:attr(data-placeholder);color:var(--text-3)}
.pub-editor blockquote,.pub-bubble-text blockquote{margin:6px 0;padding:4px 10px;border-left:3px solid var(--accent);background:#18294a;border-radius:4px}
.pub-editor a{color:var(--accent)}
.tg-spoiler{background:repeating-linear-gradient(45deg,rgba(150,165,190,.35) 0 4px,rgba(150,165,190,.18) 4px 8px);border-radius:4px}
.pub-text-foot{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap;flex:0 0 auto}
.pub-text-foot .pub-link{min-height:30px}
.pub-counter{font-size:13px;color:var(--text-3);font-variant-numeric:tabular-nums;margin-left:auto}
.pub-counter.is-over{color:#f2b3b6;font-weight:700}
.pub-emoji{position:absolute;z-index:5;right:6px;top:40px;display:grid;grid-template-columns:repeat(8,36px);gap:2px;padding:6px;background:var(--surface-2);
  border:1px solid var(--line);border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.4);max-width:calc(100% - 12px)}
@container pub (max-width:480px){.pub-emoji{grid-template-columns:repeat(6,36px)}}
.pub .pub-emoji-btn{min-height:36px;min-width:36px;padding:0;border:none;background:transparent;font-size:19px}

/* when */
.pub-calendar{flex:0 0 auto}
.pub-cal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:2px}
.pub-cal-head strong{font-size:14.5px;font-weight:600}
.pub-cal-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;text-align:center}
.pub-cal-wd{font-size:11.5px;color:var(--text-3);padding:2px 0}
.pub .pub-mini{min-height:32px;min-width:32px;padding:0 6px;border-color:transparent;background:transparent;color:var(--text-2)}
.pub .pub-day{min-height:28px;min-width:0;padding:0;border:none;background:transparent;border-radius:8px;font-size:13.5px;font-variant-numeric:tabular-nums}
.pub .pub-day:hover{background:var(--surface-2)}
.pub .pub-day.is-today{color:var(--accent);font-weight:700}
.pub .pub-day.is-chosen{background:#27508f;color:#eaf2ff;font-weight:700}
.pub-times{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.pub-time{display:flex;align-items:center;gap:6px;min-width:0}
.pub-time .pub-select{min-height:36px;padding:5px 8px}
.pub-time .pub-label{flex:0 0 auto}
.pub-label{display:block;font-size:12.5px;color:var(--text-3)}
.pub-info{font-size:12.5px;line-height:1.45;color:var(--text-3)}
.pub-info.is-warn{color:#f2cd93}
.pub-info .pub-link{font-size:12.5px;min-height:0;padding:0}

/* the buttons */
.pub-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.pub-actions .primary{flex:1 1 220px;width:auto;margin:0;min-height:44px}
.pub-actions>button:not(.primary){flex:0 1 auto}
.pub-editing{flex:1 1 100%;font-size:13.5px;color:#f2cd93}

/* the queue */
.pub-tabs{display:flex;gap:2px;padding:3px;border-radius:10px;background:var(--bg);border:1px solid var(--line-soft);flex:0 0 auto}
.pub-tabs{flex-wrap:wrap}
.pub .pub-tab{flex:1 1 auto;min-width:0;min-height:34px;border:none;background:transparent;font-size:13px;padding:4px 3px;border-radius:8px;color:var(--text-2);white-space:nowrap}
.pub-tab-count{font-size:11.5px;color:var(--text-3);white-space:pre;font-variant-numeric:tabular-nums}
.pub .pub-tab[aria-selected="true"] .pub-tab-count{color:#b1cdf8}
.pub .pub-tab[aria-selected="true"]{background:#22355a;color:#dce9ff;font-weight:600}
.pub-queue-list{display:flex;flex-direction:column;gap:8px}
.pub .pub-day-title{margin:6px 0 0;font-size:12.5px;letter-spacing:.3px;text-transform:uppercase;color:var(--text-3);font-weight:650}
.pub .pub-day-warn{color:#f2cd93}
.pub-item{border:1px solid var(--line-soft);border-radius:10px;padding:9px 10px;background:var(--surface-2);display:flex;flex-direction:column;gap:6px}
.pub-item-attention{border-color:#8a6a24}
.pub-item-head{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:12.5px;color:var(--text-3)}
.pub-excerpt{font-size:14px;line-height:1.4;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.pub-targets{display:flex;flex-direction:column;gap:4px}
.pub-target{padding:6px 8px;border-radius:8px;background:var(--surface)}
.pub-target-top{display:flex;flex-wrap:wrap;gap:4px 8px;align-items:center}
.pub-target-time{font-weight:700;font-variant-numeric:tabular-nums;font-size:14px}
.pub-target-channel{flex:1 1 100px;min-width:0;font-size:13.5px;overflow-wrap:anywhere}
.pub .badge{font-size:12px;padding:2px 8px}
.pub-reason{font-size:12.5px;color:var(--text-2);margin:4px 0 0!important;line-height:1.4}
.pub-target-actions,.pub-item-actions{display:flex;flex-wrap:wrap;gap:5px;align-items:center}
.pub-target-actions{margin-top:5px}
.pub-journal{width:100%;font-size:12.5px;color:var(--text-3)}
.pub-journal summary{cursor:pointer;min-height:28px;display:flex;align-items:center}
.pub-journal p{margin:2px 0}

/* dialogs and messages: the cabinet's colours */
.pub-shade{position:fixed;inset:0;background:rgba(3,6,14,.62);display:grid;place-items:center;padding:16px;z-index:50}
.pub-modal{width:min(520px,100%);max-height:calc(100vh / var(--text-zoom,1) - 32px);overflow:auto;background:var(--surface);color:var(--text);border-radius:14px;padding:16px 18px;
  border:1px solid var(--line);box-shadow:0 20px 60px rgba(0,0,0,.5);display:flex;flex-direction:column;gap:10px}
.pub-modal h2{margin:0;font-size:17px;text-transform:none;letter-spacing:0;color:var(--text)}
.pub-modal p{margin:0;line-height:1.5}
.pub-modal-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;margin-top:4px}
.pub-modal-actions .primary{width:auto;margin:0}
.pub-modal .pub-danger{background:#5a2a2e;border-color:#96484d;color:#ffd9da;font-weight:600}
.pub-said{min-height:0;font-size:13.5px;color:var(--text-2)}
.pub-said.is-warn{color:#f2b3b6;white-space:pre-line}
.pub-plan{display:flex;flex-direction:column;gap:6px}
.pub-plan-row{display:grid;grid-template-columns:auto minmax(0,1fr) 96px;gap:10px;align-items:center;padding:6px 8px;border:1px solid var(--line-soft);border-radius:10px;background:var(--surface-2)}
.pub-plan-what{display:flex;flex-direction:column;min-width:0}
.pub-clock{text-align:center;font-variant-numeric:tabular-nums;letter-spacing:.5px}
.pub-problems{margin:0;padding-left:20px;line-height:1.5}
.pub-preview-modal{background:#0e1621}
.pub-bubble{max-width:420px;margin:2px auto;background:#182533;color:#f5f5f5;border-radius:14px 14px 14px 4px;padding:10px 12px}
.pub-bubble-head{display:flex;align-items:center;gap:8px;margin-bottom:8px;color:#7fb0ff}
.pub-bubble-media{display:grid;gap:2px;margin:0 -12px 8px;overflow:hidden}
.pub-media-2,.pub-media-4{grid-template-columns:1fr 1fr}.pub-media-3{grid-template-columns:2fr 1fr}
.pub-bubble-cell{min-height:120px;background:#22304c;display:grid;place-items:center;font-size:13px;color:#c8daf7;overflow:hidden}
.pub-bubble-cell img{width:100%;height:100%;object-fit:cover;display:block}
.pub-bubble-text{white-space:pre-wrap;overflow-wrap:anywhere;font-size:15px;line-height:1.45}
.pub-bubble-text a{color:#7fb0ff}
.pub-bubble-time{display:block;text-align:right;font-size:12px;color:#8fa0bb;margin-top:4px}
.pub-toast{margin:0;padding:9px 12px;border-radius:10px;font-size:14px;line-height:1.4;background:var(--surface-2);color:var(--text);
  border:1px solid var(--line);border-left:4px solid #2f7a4f;box-shadow:0 8px 24px rgba(0,0,0,.45);max-width:360px;margin-left:auto}
.pub-toast-warn{border-left-color:#8a6a24}
.pub-target-actions .primary,.pub-item-actions .primary{width:auto;margin:0;min-height:36px;padding:5px 11px;font-size:13.5px}
/* v1.0.23, task 4: a phone at 200 % - «сегодня, ср, 18 ноября» on its own lines, never cut off by an ellipsis */
@media (max-width:330px){.pub-count{white-space:normal;overflow:visible;text-overflow:clip}}
