:root {
  color-scheme: light;
  --page: #eef1f4;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --surface-blue: #edf7ff;
  --text: #14202b;
  --text-soft: #5d6b78;
  --text-faint: #87929d;
  --line: #dfe5ea;
  --line-strong: #cbd4dc;
  --accent: #248bcf;
  --accent-strong: #1476b8;
  --accent-soft: #e4f3fd;
  --success: #168252;
  --success-soft: #e8f7f0;
  --warning: #a76500;
  --warning-soft: #fff5df;
  --danger: #b42318;
  --danger-soft: #fff0ef;
  --shadow: 0 10px 30px rgba(34, 50, 65, .07), 0 2px 6px rgba(34, 50, 65, .04);
  --header-height: 78px;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(36, 139, 207, .28);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
}

.app-header {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(18px);
}

.brand-block {
  min-width: 0;
}

.eyebrow,
.dialog-kicker {
  display: block;
  margin-bottom: 1px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.brand-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-title {
  font-size: 21px;
  font-weight: 780;
  letter-spacing: -.025em;
  line-height: 1.15;
}

.channel-badge {
  overflow: hidden;
  max-width: min(36vw, 320px);
  padding: 3px 9px;
  border: 1px solid #cbe6f7;
  border-radius: 999px;
  background: var(--surface-blue);
  color: #176b9f;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-block p,
.panel-head p {
  margin: 2px 0 0;
  color: var(--text-soft);
}

.brand-block p {
  overflow: hidden;
  max-width: 720px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions,
.panel-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.save-status {
  margin-right: 4px;
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
}

.upload-progress {
  display: grid;
  grid-template-columns: 92px auto;
  align-items: center;
  gap: 7px;
  min-width: 190px;
  color: var(--warning);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.upload-progress progress {
  width: 92px;
  height: 6px;
  accent-color: var(--accent);
}

.save-status[data-tone="saved"],
#mobileSaveStatus[data-tone="saved"] {
  color: var(--success);
}

.save-status[data-tone="saving"],
.save-status[data-tone="pending"],
#mobileSaveStatus[data-tone="saving"],
#mobileSaveStatus[data-tone="pending"] {
  color: var(--warning);
}

.save-status[data-tone="error"],
#mobileSaveStatus[data-tone="error"] {
  color: var(--danger);
}

.button,
.text-button,
.notice button,
.mobile-tab {
  min-height: 40px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, transform .15s ease;
}

.button {
  border: 1px solid transparent;
  padding: 8px 14px;
  font-weight: 680;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(36, 139, 207, .2);
  color: white;
}

.button.primary:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.button.secondary:hover:not(:disabled) {
  border-color: #aebbc6;
  background: var(--surface-soft);
}

.button:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

.text-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 650;
}

.text-button:hover {
  background: var(--accent-soft);
}

.notice {
  display: flex;
  z-index: 30;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px;
  border-bottom: 1px solid #cfe3f2;
  background: var(--surface-blue);
  color: #185a84;
  font-size: 13px;
}

.notice[data-tone="success"] {
  border-color: #c5ead8;
  background: var(--success-soft);
  color: #126d46;
}

.notice[data-tone="error"] {
  border-color: #f2c9c5;
  background: var(--danger-soft);
  color: var(--danger);
}

.notice button {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: currentColor;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 700;
}

.mobile-tabs,
.mobile-publish-bar {
  display: none;
}

.workspace {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 16px;
  align-items: start;
  padding: 16px;
}

.workspace.preview-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.workspace.preview-collapsed .preview-panel {
  display: none;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.editor-panel {
  overflow: clip;
}

.panel-head {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h1,
.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -.01em;
  line-height: 1.25;
}

.panel-head p {
  font-size: 12px;
}

.editor-surface {
  min-width: 0;
  background: var(--surface);
}

#vditor {
  --toolbar-background-color: #fbfcfd;
  --toolbar-icon-color: #5e6c78;
  --toolbar-icon-hover-color: #167dbd;
  --border-color: var(--line);
  --second-color: #d8e0e6;
  --panel-background-color: #fff;
  --textarea-background-color: #fff;
  --textarea-text-color: var(--text);
  min-height: 540px;
  border: 0;
  border-radius: 0;
  font-family: inherit;
}

#vditor .vditor-toolbar {
  display: flex;
  overflow: visible;
  min-height: 47px;
  flex-wrap: wrap;
  align-items: center;
  gap: 1px;
  padding: 4px 12px;
  border-bottom-color: var(--line);
  background: #fbfcfd;
}

#vditor .vditor-toolbar--pin {
  top: var(--header-height);
  z-index: 20;
}

#vditor .vditor-toolbar__item {
  float: none;
  padding: 0;
}

#vditor .vditor-toolbar__item .vditor-tooltipped {
  width: 36px;
  height: 36px;
  padding: 9px;
  border-radius: 8px;
}

#vditor .vditor-toolbar__item .vditor-tooltipped:hover,
#vditor .vditor-toolbar__item .vditor-tooltipped:focus-visible {
  outline: 0;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

#vditor .vditor-toolbar__item .vditor-tooltipped:focus-visible {
  box-shadow: 0 0 0 3px rgba(36, 139, 207, .24);
}

#vditor .vditor-toolbar__item svg {
  width: 17px;
  height: 17px;
}

#vditor .vditor-toolbar__item [data-name^="telegram-"] svg {
  fill: currentColor;
}

#vditor .vditor-toolbar__divider {
  height: 24px;
  margin: 6px 6px;
}

#vditor .vditor-content {
  min-height: 540px;
  background: #fff;
}

#vditor .vditor-ir,
#vditor .vditor-wysiwyg,
#vditor .vditor-sv {
  background: #fff;
}

#vditor .vditor-ir pre.vditor-reset,
#vditor .vditor-wysiwyg pre.vditor-reset,
#vditor .vditor-sv .vditor-reset {
  max-width: 800px;
  min-height: 500px;
  margin: 0 auto;
  padding: 44px 58px 110px !important;
  color: var(--text);
  font: 17px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}

#vditor .vditor-sv .vditor-reset {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  line-height: 1.65;
}

#vditor .vditor-reset h1,
#vditor .vditor-reset h2,
#vditor .vditor-reset h3 {
  color: #111c26;
  letter-spacing: -.025em;
}

#vditor .vditor-reset h1 {
  margin-top: 0;
  font-size: 34px;
}

#vditor .vditor-reset h2 {
  margin-top: 1.6em;
  font-size: 25px;
}

#vditor .vditor-reset blockquote {
  border-left: 4px solid #7c65d6;
  border-radius: 0 10px 10px 0;
  background: #f2efff;
  color: #423c60;
}

#vditor .vditor-reset table {
  overflow: hidden;
  border-radius: 10px;
}

#vditor .vditor-reset mark {
  border-radius: 3px;
  background: #fff0a8;
  color: inherit;
  padding: 0 2px;
}

#vditor .vditor-hint {
  overflow: hidden;
  width: min(360px, calc(100vw - 32px));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: 0 18px 45px rgba(30, 50, 68, .18);
}

#vditor .vditor-hint button {
  display: grid;
  width: 100%;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 8px;
  text-align: left;
}

#vditor .vditor-hint button strong {
  color: var(--text);
  font-size: 13px;
}

#vditor .vditor-hint button small {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#vditor .vditor-hint--current {
  background: var(--accent-soft) !important;
}

#vditor .vditor-panel {
  border-color: var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(30, 50, 68, .16);
}

#vditor .vditor-tip {
  border-radius: 10px;
}

#vditor .vditor-resize {
  display: none;
}

.editor-footer {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--text-soft);
  font-size: 12px;
}

.limit-group {
  display: flex;
  min-width: 210px;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
}

.limit-group #counter {
  min-width: 88px;
  font-variant-numeric: tabular-nums;
}

.limit-group progress {
  overflow: hidden;
  width: 105px;
  height: 5px;
  border: 0;
  border-radius: 999px;
  background: #dfe6eb;
  appearance: none;
}

.limit-group progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #dfe6eb;
}

.limit-group progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

.limit-group progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.limit-group.near-limit,
.limit-group.near-limit progress::-webkit-progress-value {
  color: var(--warning);
}

.limit-group.near-limit progress::-webkit-progress-value,
.limit-group.near-limit progress::-moz-progress-bar {
  background: var(--warning);
}

.limit-group.over-limit,
.limit-group.over-limit progress::-webkit-progress-value {
  color: var(--danger);
}

.limit-group.over-limit progress::-webkit-progress-value,
.limit-group.over-limit progress::-moz-progress-bar {
  background: var(--danger);
}

.publish-settings {
  border-top: 1px solid var(--line);
  padding: 12px 18px 16px;
  background: var(--surface-soft);
}

.publish-settings summary {
  cursor: pointer;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.settings-grid {
  display: flex;
  align-items: end;
  gap: 18px;
  padding-top: 12px;
}

.settings-grid label {
  display: grid;
  gap: 4px;
  color: var(--text-soft);
  font-size: 12px;
}

.settings-grid input[type="text"] {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 9px;
  background: white;
  color: var(--text);
}

.settings-grid .check-label {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
}

.preview-panel {
  position: sticky;
  top: calc(var(--header-height) + 16px);
  overflow: hidden;
  max-height: calc(100dvh - var(--header-height) - 32px);
}

.preview-head {
  min-height: 68px;
}

.preview-status {
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.telegram-stage {
  overflow: auto;
  max-height: calc(100dvh - var(--header-height) - 101px);
  min-height: 520px;
  padding: 22px 16px 44px;
  background:
    linear-gradient(rgba(229, 241, 248, .82), rgba(229, 241, 248, .82)),
    radial-gradient(circle at 15% 20%, #d4e7f2 0 1px, transparent 1.5px);
  background-size: auto, 18px 18px;
}

.telegram-message {
  overflow: hidden;
  max-width: 410px;
  margin: 0 auto;
  border: 1px solid rgba(118, 148, 168, .2);
  border-radius: 18px 18px 6px 18px;
  background: white;
  box-shadow: 0 7px 24px rgba(61, 93, 113, .12);
}

.telegram-message-head,
.telegram-message-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-faint);
  font-size: 11px;
}

.telegram-message-head {
  padding: 13px 16px 0;
}

.telegram-message-head span:first-child {
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telegram-message-footer {
  padding: 2px 16px 12px;
}

.preview {
  min-height: 160px;
  padding: 14px 16px 12px;
  color: #16212b;
  font-size: 15px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.preview-empty {
  display: grid;
  min-height: 230px;
  place-content: center;
  gap: 5px;
  color: var(--text-faint);
  text-align: center;
}

.preview-empty strong {
  color: var(--text-soft);
  font-size: 14px;
}

.preview h1,
.preview h2,
.preview h3,
.preview h4,
.preview h5,
.preview h6 {
  margin: 1.25em 0 .45em;
  color: #101922;
  font-weight: 780;
  letter-spacing: -.022em;
  line-height: 1.16;
}

.preview h1:first-child,
.preview h2:first-child,
.preview h3:first-child {
  margin-top: 0;
}

.preview h1 {
  font-size: 25px;
}

.preview h2 {
  font-size: 20px;
}

.preview h3 {
  font-size: 17px;
}

.preview p,
.preview ul,
.preview ol,
.preview blockquote,
.preview table,
.preview details,
.preview pre {
  margin: 10px 0;
}

.preview ul,
.preview ol {
  padding-left: 22px;
}

.preview blockquote {
  border-left: 4px solid #7c65d6;
  border-radius: 0 9px 9px 0;
  background: #f1edff;
  color: #463f62;
  padding: 9px 11px;
}

.preview blockquote > :first-child {
  margin-top: 0;
}

.preview blockquote > :last-child {
  margin-bottom: 0;
}

.preview img,
.preview video,
.preview .preview-media {
  display: block;
  width: 100%;
  max-height: 420px;
  border-radius: 11px;
  object-fit: contain;
  background: #edf1f4;
}

.preview audio,
.preview .preview-media:is(audio) {
  width: 100%;
}

.preview table {
  display: block;
  overflow-x: auto;
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.preview th,
.preview td {
  min-width: 100px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
}

.preview tr:last-child td {
  border-bottom: 0;
}

.preview th:last-child,
.preview td:last-child {
  border-right: 0;
}

.preview th {
  background: var(--surface-soft);
  font-weight: 700;
}

.preview table[bordered] {
  border: 2px solid #aebbc5;
}

.preview table[striped] tbody tr:nth-child(even) {
  background: #f4f8fa;
}

.preview caption {
  padding: 7px 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
  caption-side: bottom;
}

.preview aside {
  margin: 12px 0;
  border-radius: 12px;
  background: #f6f2ff;
  color: #493c73;
  padding: 13px 15px;
  font-size: 17px;
  font-weight: 650;
}

.preview aside cite,
.preview figcaption cite {
  display: block;
  margin-top: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.preview figure {
  margin: 12px 0;
}

.preview figcaption {
  padding: 7px 3px 0;
  color: var(--text-soft);
  font-size: 12px;
}

.preview tg-map {
  display: grid;
  min-height: 126px;
  place-items: center;
  border: 1px dashed #93aebb;
  border-radius: 12px;
  background: linear-gradient(135deg, #e7f4ee, #e8f1fb);
  color: #386876;
  font-size: 12px;
}

.preview tg-map::before {
  content: 'Карта Telegram · ' attr(lat) ', ' attr(long);
}

.preview tg-math,
.preview tg-math-block {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.preview tg-math-block {
  display: block;
  overflow-x: auto;
  margin: 10px 0;
  border-radius: 9px;
  background: #f3f6f8;
  padding: 12px;
}

.preview tg-spoiler {
  border-radius: 4px;
  background: #b5bdc5;
  color: transparent;
  cursor: pointer;
  padding: 0 3px;
}

.preview tg-spoiler:hover { color: var(--text); background: #e3e7ea; }

.table-tools {
  position: fixed;
  z-index: 60;
  width: min(360px, calc(100vw - 24px));
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(30, 50, 68, .2);
}

.table-tools strong { display: block; margin: 0 0 7px; }
.table-tools-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.table-tools button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 7px;
  background: #fbfcfd;
  color: var(--text);
  font: 600 11px/1.2 inherit;
}
.table-tools button:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.table-tools p { margin: 8px 0 0; color: var(--text-faint); font-size: 10px; line-height: 1.35; }
.table-align-tools span { align-self: center; color: var(--text-soft); font-size: 11px; }
.table-size-tools label { display: flex; align-items: center; gap: 4px; color: var(--text-soft); font-size: 11px; }
.table-size-tools input { width: 42px; border: 1px solid var(--line); border-radius: 6px; padding: 4px; color: var(--text); font: inherit; }

.rich-dialog label { display: grid; gap: 6px; margin-top: 12px; color: var(--text-soft); font-size: 12px; }
.rich-dialog input { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px; color: var(--text); font: inherit; }

.preview mark {
  border-radius: 3px;
  background: #fff0a8;
  color: inherit;
  padding: 0 2px;
}

.preview .spoiler {
  border-radius: 4px;
  background: #b5bdc5;
  color: transparent;
  cursor: pointer;
  padding: 0 3px;
  transition: color .15s ease, background-color .15s ease;
}

.preview .spoiler:hover,
.preview .spoiler:focus {
  background: #e3e7ea;
  color: var(--text);
}

.preview code {
  border-radius: 4px;
  background: #edf1f4;
  padding: 2px 4px;
  font: .9em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.preview pre {
  overflow-x: auto;
  border-radius: 9px;
  background: #17212b;
  color: #eef5f9;
  padding: 12px;
}

.preview pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.preview details {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.preview summary {
  cursor: pointer;
  font-weight: 650;
}

.preview-slideshow {
  display: block;
  overflow: hidden;
  margin: 12px 0;
  border-radius: 12px;
  background: #edf1f4;
}

.preview-collage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  overflow: hidden;
  margin: 12px 0;
  border-radius: 12px;
  background: #edf1f4;
}

.preview-collage img,
.preview-collage video {
  min-height: 140px;
  border-radius: 0;
  object-fit: cover;
}

.preview-collage figcaption { grid-column: 1 / -1; padding: 7px 9px 9px; }

.preview-slideshow-stage {
  position: relative;
}

.preview-slideshow .preview-slide {
  margin: 0;
}

.preview-slideshow .preview-slide img,
.preview-slideshow .preview-slide video {
  min-height: 220px;
  border-radius: 0;
  object-fit: contain;
}

.preview-slideshow-controls {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  padding: 12px;
}

.preview-slideshow-controls button,
.preview-slideshow-controls span {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 2px 10px rgba(20, 32, 43, .14);
  color: #65727d;
}

.preview-slideshow-controls button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  pointer-events: auto;
  cursor: pointer;
  font-size: 21px;
}

.preview-slideshow-controls span {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.preview-slideshow figcaption {
  display: block;
  background: white;
  padding: 9px 11px;
  color: var(--text-soft);
  font-size: 13px;
}

.carousel-dialog {
  width: min(620px, calc(100vw - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  overflow: auto;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(20, 32, 43, .3);
  padding: 0;
}

.carousel-dialog::backdrop {
  background: rgba(20, 32, 43, .52);
  backdrop-filter: blur(3px);
}

.carousel-dialog form {
  padding: 22px;
}

.carousel-dialog h2 {
  margin: 0;
  font-size: 22px;
}

.carousel-help {
  margin: 5px 0 16px;
  color: var(--text-soft);
}

.carousel-picker {
  display: grid;
  gap: 2px;
  border: 1px dashed #9bc9e5;
  border-radius: 12px;
  background: var(--surface-blue);
  padding: 14px;
  color: var(--accent-strong);
  cursor: pointer;
  text-align: center;
}

.carousel-picker span,
.carousel-caption span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 400;
}

.carousel-files {
  display: grid;
  max-height: 300px;
  overflow-y: auto;
  gap: 7px;
  margin: 12px 0;
}

.carousel-files-empty {
  margin: 8px 0;
  color: var(--text-faint);
  text-align: center;
}

.carousel-file {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px;
}

.carousel-file > img,
.carousel-file > video {
  width: 52px;
  height: 52px;
  border-radius: 7px;
  background: var(--surface-soft);
  object-fit: cover;
}

.carousel-file > div:nth-child(2) {
  display: grid;
  min-width: 0;
}

.carousel-file strong,
.carousel-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.carousel-file span {
  color: var(--text-soft);
  font-size: 12px;
}

.carousel-file > div:last-child {
  display: flex;
  gap: 3px;
}

.carousel-file button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--text-soft);
  cursor: pointer;
}

.carousel-file button:disabled {
  cursor: default;
  opacity: .35;
}

.carousel-caption {
  display: grid;
  gap: 5px;
  font-weight: 650;
}

.carousel-caption textarea {
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 10px;
}

.carousel-error {
  margin: 10px 0 0;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 8px 10px;
  font-size: 13px;
}

.carousel-dialog .dialog-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.command-menu {
  position: fixed;
  z-index: 110;
  overflow: hidden;
  width: min(360px, calc(100vw - 24px));
  max-height: min(430px, calc(100dvh - 24px));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  box-shadow: 0 20px 55px rgba(24, 42, 57, .22);
  padding: 6px;
}

.command-menu button {
  display: grid;
  width: 100%;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
}

.command-menu button:hover,
.command-menu button.active {
  background: var(--accent-soft);
}

.command-menu button strong {
  font-size: 13px;
}

.command-menu button span {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confirm-dialog {
  width: min(440px, calc(100vw - 32px));
  border: 0;
  border-radius: 18px;
  background: white;
  box-shadow: 0 28px 80px rgba(18, 35, 49, .28);
  color: var(--text);
  padding: 0;
}

.confirm-dialog::backdrop {
  background: rgba(18, 31, 42, .42);
  backdrop-filter: blur(3px);
}

.confirm-dialog form {
  padding: 24px;
}

.confirm-dialog h2 {
  margin: 3px 0 7px;
  font-size: 21px;
  letter-spacing: -.02em;
}

.confirm-dialog p {
  margin: 0;
  color: var(--text-soft);
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 22px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  }

  #vditor .vditor-ir pre.vditor-reset,
  #vditor .vditor-wysiwyg pre.vditor-reset,
  #vditor .vditor-sv .vditor-reset {
    padding-right: 40px !important;
    padding-left: 40px !important;
  }
}

@media (max-width: 980px) {
  :root {
    --header-height: auto;
  }

  body {
    background: white;
  }

  .app-header {
    position: static;
    min-height: 70px;
    padding: 11px 16px;
  }

  .brand-block p {
    max-width: 72vw;
  }

  .header-actions .button.primary,
  .desktop-only {
    display: none;
  }

  .save-status {
    margin: 0;
  }

  .upload-progress {
    display: none;
  }

  .notice {
    padding: 9px 16px;
  }

  .mobile-tabs {
    position: sticky;
    z-index: 32;
    top: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    padding: 6px 12px;
    backdrop-filter: blur(16px);
  }

  .mobile-tab {
    min-height: 38px;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 680;
  }

  .mobile-tab.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
  }

  .workspace,
  .workspace.preview-collapsed {
    display: block;
    padding: 0;
  }

  .workspace.preview-collapsed .preview-panel {
    display: block;
  }

  .workspace[data-mobile-view="editor"] .preview-panel,
  .workspace[data-mobile-view="preview"] .editor-panel {
    display: none;
  }

  .panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .panel-head {
    min-height: 60px;
    padding: 10px 16px;
  }

  .panel-head p {
    display: none;
  }

  #vditor .vditor-toolbar {
    position: sticky;
    z-index: 28;
    top: 51px;
    overflow-x: auto;
    min-height: 50px;
    flex-wrap: nowrap;
    padding: 5px 10px;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  #vditor .vditor-toolbar::-webkit-scrollbar {
    display: none;
  }

  #vditor .vditor-toolbar__item {
    flex: 0 0 auto;
    padding: 0;
  }

  #vditor .vditor-toolbar__item .vditor-tooltipped {
    width: 42px;
    height: 40px;
    padding: 11px;
  }

  #vditor .vditor-content,
  #vditor {
    min-height: calc(100dvh - 250px);
  }

  #vditor .vditor-ir pre.vditor-reset,
  #vditor .vditor-wysiwyg pre.vditor-reset,
  #vditor .vditor-sv .vditor-reset {
    min-height: calc(100dvh - 270px);
    padding: 30px 28px 120px !important;
    font-size: 17px;
  }

  .editor-footer {
    padding: 9px 16px;
  }

  #modeHint {
    display: none;
  }

  .preview-panel {
    position: static;
    max-height: none;
  }

  .preview-status {
    font-size: 11px;
  }

  .telegram-stage {
    max-height: none;
    min-height: calc(100dvh - 210px);
    padding: 18px 14px 110px;
  }

  .mobile-publish-bar {
    position: sticky;
    z-index: 45;
    bottom: 0;
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -8px 24px rgba(34, 50, 65, .08);
    backdrop-filter: blur(18px);
  }

  #mobileSaveStatus {
    overflow: hidden;
    color: var(--text-soft);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 600px) {
  .app-header {
    align-items: flex-start;
  }

  .eyebrow {
    display: none;
  }

  .brand-title {
    font-size: 19px;
  }

  .channel-badge {
    max-width: 48vw;
  }

  .brand-block p {
    max-width: 72vw;
    font-size: 12px;
  }

  .save-status {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .panel-actions {
    width: 100%;
    gap: 2px;
  }

  .text-button {
    min-height: 32px;
    padding: 4px 7px;
  }

  #vditor .vditor-ir pre.vditor-reset,
  #vditor .vditor-wysiwyg pre.vditor-reset,
  #vditor .vditor-sv .vditor-reset {
    padding: 24px 20px 120px !important;
    font-size: 16px;
  }

  #vditor .vditor-reset h1 {
    font-size: 29px;
  }

  #vditor .vditor-reset h2 {
    font-size: 23px;
  }

  .editor-footer {
    min-height: 44px;
  }

  .limit-group {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
  }

  .limit-group progress {
    flex: 1;
    max-width: 150px;
  }

  .telegram-stage {
    padding-right: 10px;
    padding-left: 10px;
  }

  .telegram-message {
    border-radius: 16px 16px 5px 16px;
  }

  .mobile-publish-bar .button {
    flex: 0 0 auto;
    padding-right: 12px;
    padding-left: 12px;
    font-size: 13px;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .command-menu button {
    grid-template-columns: 105px minmax(0, 1fr);
    min-height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
