/* «Меню и тексты» → «Тексты» (web/menu-texts.js): the screens of the bot on the left, the texts of one screen in the
   middle, the bot's whole message in the Telegram preview on the right — the part being edited lit up. On a phone
   everything stacks: the screen picker, the texts, the preview. Tokens come from style.css. */

.mb-layout.tx-layout { align-items: start; }
.tx-nav-col, .tx-editor { min-width: 0; }
.tx-nav { display: grid; gap: 10px; }
.tx-nav input[type="search"] { width: 100%; }
.tx-only.check-row { margin: 0; padding: 9px 12px; font-size: 14px; }
.tx-nav .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tx-select { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.tx-select select { width: 100%; max-width: none; }
.tx-nav-list { display: none; gap: 14px; }
.tx-group h3 { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.tx-group ul, .tx-nav-found, .tx-parts, .tx-popups { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.tx-nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--text-2); font-size: 14px; font-weight: 500; text-align: left; justify-content: flex-start;
}
.tx-nav-item > span:first-child { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.tx-nav-item:hover { background: var(--panel-2); color: var(--text); }
.tx-nav-item[aria-current="true"] { border-color: var(--line-2); background: var(--panel-2); color: var(--text); }
.tx-nav-found .tx-nav-item { display: grid; gap: 2px; }
.tx-nav-found small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.tx-count { flex: none; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: rgb(26 123 190 / .28); color: var(--text); font-size: 12px; text-align: center; }

/* The texts of a screen: one row per text, the open one becomes its editor. */
.tx-intro .tx-actions { margin-top: 10px; }
.tx-container { margin: -6px 0 6px; color: var(--text-2); font-size: 13px; }
.tx-item { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-deep); }
.tx-item.is-open { border-color: var(--tg); }
.tx-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 10px; width: 100%; min-height: 48px; padding: 8px 12px;
  border: 0; border-radius: 12px; background: transparent; color: var(--text); font-size: 14px; font-weight: 500; text-align: left; justify-content: flex-start;
}
.tx-row:hover { background: rgb(255 255 255 / .03); }
.tx-kind { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--panel-3); color: var(--text-2); font-size: 11px; font-weight: 600; white-space: nowrap; }
.tx-excerpt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-flags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.tx-flags:empty { display: none; }
.tx-flag { padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tx-flag.is-changed { background: rgb(26 123 190 / .22); color: #9cc9ec; }
.tx-flag.is-unsaved { background: rgb(228 174 79 / .16); color: var(--warn); }
.tx-flag.is-error { background: rgb(242 122 111 / .16); color: var(--danger); }
.tx-flag.is-owned, .tx-flag.is-fixed { background: var(--panel-3); color: var(--muted); }
.tx-key { display: grid; gap: 10px; padding: 4px 12px 14px; }
.tx-meta { margin: 0; overflow-wrap: anywhere; }
.tx-meta code { color: var(--text-2); }
.tx-toolbar { gap: 6px; }
.tx-toolbar button { min-width: 40px; min-height: 36px; }
.tx-chips .chip.is-required { border-color: var(--line-2); color: var(--text); }
.tx-fields { gap: 12px; }
.tx-field textarea, .tx-field input { width: 100%; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; }
.tx-field label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.tx-builtin { color: var(--muted); font-size: 12px; font-weight: 400; }
.tx-issue { margin: 4px 0 0; color: var(--danger); font-size: 13px; line-height: 1.45; }
.tx-key-actions:empty { display: none; }

/* The preview: every text of the message can be picked; the one being edited is lit up, changed ones underlined. */
.tx-part { border-radius: 4px; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background-color .12s var(--ease); }
.tx-part:hover { background: rgb(255 255 255 / .06); }
.tx-part.is-changed { text-decoration: underline dotted rgb(26 123 190 / .9); text-underline-offset: 3px; }
.tx-part.is-selected { background: rgb(26 123 190 / .26); box-shadow: 0 0 0 2px var(--tg); }
.tx-part.is-fixed { cursor: help; }
.tx-part:focus-visible, .tx-button:focus-visible, .tx-popup-pick:focus-visible, .tx-row:focus-visible, .tx-nav-item:focus-visible { outline: 2px solid var(--tg); outline-offset: 2px; }
.tgx-msg .tgp-button.tx-button { border: 0; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.tgx-msg .tgp-button.tx-button.is-changed { text-decoration: underline dotted rgb(26 123 190 / .9); text-underline-offset: 3px; }
.tgx-msg .tgp-button.tx-button.is-selected { box-shadow: inset 0 0 0 2px var(--tg); background: rgb(26 123 190 / .3); }
.tx-popup {
  position: sticky; top: 0; z-index: 2; justify-self: center; max-width: 92%; margin-bottom: 6px; padding: 9px 14px; border-radius: 12px;
  background: rgb(10 10 12 / .92); color: #fff; font-size: 13px; line-height: 1.4; text-align: center; white-space: pre-wrap; box-shadow: var(--shadow-pop);
}
.tx-popup.is-alert { display: grid; gap: 8px; padding: 14px 16px 10px; background: var(--panel); border: 1px solid var(--line-2); }
.tx-popup-ok { justify-self: end; color: var(--tg-hover); font-weight: 650; }
.tx-popups { margin-top: 4px; }
.tx-popup-pick {
  display: flex; align-items: baseline; gap: 8px; width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-deep); color: var(--text); font-size: 13px; font-weight: 450; text-align: left; justify-content: flex-start;
}
.tx-popup-pick.is-selected { border-color: var(--tg); box-shadow: 0 0 0 1px var(--tg); }
/* A video result: the frame with Telegram's play mark and length. */
.tx-video { position: relative; }
.tx-video-badge { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgb(0 0 0 / .62); color: #fff; font-size: 12px; font-weight: 600; }
.tx-budget.is-warn { color: var(--warn); }
.tx-budget.is-error { color: var(--danger); }

/* A phone: the screen picker, the preview of that screen, then its texts. From 960px the preview stands beside the
   texts (the picker above them); from 1600px the screens are a list of their own on the left. */
.mb-layout.tx-layout { grid-template-areas: "nav" "preview" "editor"; }
.tx-nav-col { grid-area: nav; }
.tx-editor { grid-area: editor; }
.mb-layout.tx-layout > .mb-preview-card { grid-area: preview; }
@media (min-width: 960px) {
  .mb-layout.tx-layout { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "nav preview" "editor preview"; grid-template-rows: auto 1fr; }
  .tx-nav { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
  .tx-nav input[type="search"], .tx-nav .tx-only { grid-column: 1; }
  .tx-nav .tx-select { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
}
@media (min-width: 1600px) {
  .mb-layout.tx-layout { grid-template-columns: 240px minmax(0, 1fr) 400px; grid-template-areas: "nav editor preview"; grid-template-rows: auto; }
  .tx-nav { grid-template-columns: minmax(0, 1fr); }
  .tx-nav input[type="search"], .tx-nav .tx-only, .tx-nav .tx-select { grid-column: auto; grid-row: auto; }
  .tx-select { display: none; }
  .tx-nav-list { display: grid; }
  .tx-nav-col { position: sticky; top: 16px; max-height: calc(100svh - 32px); overflow-y: auto; overscroll-behavior: contain; }
}
@media (max-width: 719px) {
  .tx-fields { grid-template-columns: minmax(0, 1fr); }
  .tx-row { grid-template-columns: minmax(0, 1fr); }
  .tx-excerpt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
