.a4-file-backstage-backdrop {
  position: fixed;
  z-index: 1998;
  inset: 0;
  background: rgb(15 23 42 / 42%);
}

.a4-file-backstage {
  position: fixed;
  z-index: 1999;
  inset: 0;
  display: grid;
  /* Узкая колонка разделов — как в стартовом окне Word: иконка, под ней
     короткая подпись. Широкий список ссылок занимал место, ради которого
     окно и открывают: шаблоны и недавние документы. */
  grid-template-columns: 108px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  max-width: 100vw;
  max-height: 100dvh;
  overflow: hidden;
  box-sizing: border-box;
  color: #172033;
  background: var(--a4bs-canvas);
  box-shadow: 0 24px 80px rgb(15 23 42 / 25%);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Surfaces */
  --a4bs-canvas: #f6f8fb;
  --a4bs-surface: #ffffff;
  --a4bs-surface-sunken: #f1f5f9;
  --a4bs-hover: #f3f7fd;
  --a4bs-accent-tint: #eaf2fb;

  /* Borders */
  --a4bs-border: #e3e9f2;
  --a4bs-border-strong: #d3dce8;

  /* Text */
  --a4bs-text: #1a2434;
  --a4bs-text-soft: #55637a;
  --a4bs-text-mute: #8a97ac;

  /* Accent (Word-blue) */
  --a4bs-accent: #0f6cbd;
  --a4bs-accent-hover: #115ea3;
  --a4bs-accent-active: #0c4d86;

  /* Semantic */
  --a4bs-success: #067647;
  --a4bs-success-bg: #ecfdf3;
  --a4bs-warn: #b54708;
  --a4bs-warn-bg: #fffaeb;
  --a4bs-danger: #b42318;
  --a4bs-danger-bg: #fef3f2;
  --a4bs-danger-border: #f0cfcb;

  /* Radius */
  --a4bs-r-sm: 6px;
  --a4bs-r-md: 8px;
  --a4bs-r-lg: 12px;
  --a4bs-r-pill: 999px;

  /* Spacing (4pt) */
  --a4bs-s-1: 4px;
  --a4bs-s-2: 8px;
  --a4bs-s-3: 12px;
  --a4bs-s-4: 16px;
  --a4bs-s-5: 20px;
  --a4bs-s-6: 24px;
  --a4bs-s-8: 32px;

  /* Elevation */
  --a4bs-shadow-card: 0 0 0 1px rgb(15 23 42 / 3%), 0 1px 2px rgb(15 23 42 / 6%), 0 4px 12px rgb(15 23 42 / 5%);
  --a4bs-shadow-hover: 0 0 0 1px rgb(15 23 42 / 5%), 0 2px 4px rgb(15 23 42 / 8%), 0 8px 20px rgb(15 23 42 / 8%);
  --a4bs-shadow-btn: 0 1px 1px rgb(15 23 42 / 5%);
}

/* Кликабельное обязано выглядеть кликабельным.
 *
 * Курсор ставился поштучно, и это разъехалось: на живой Главной из
 * семнадцати кликабельных элементов руку показывали два — карточка шаблона
 * и «Больше шаблонов». Разделы сайдбара, вкладки «Все / Избранное», строка
 * недавнего документа и его звезда оставались под стрелкой, то есть на вид
 * неотличимы от подписи. В стартовом окне Word рука появляется над каждым
 * из них.
 *
 * Поэтому правило общее, а не на класс: новая кнопка поверхности получает
 * курсор по факту того, что она кнопка, и забыть его нельзя. Недоступный
 * элемент руку не показывает — иначе он обещает действие, которого нет. */
.a4-file-backstage :is(button, a[href], [role="tab"], [role="button"]) {
  cursor: pointer;
}

.a4-file-backstage :is(button, a[href], [role="tab"], [role="button"]):disabled,
.a4-file-backstage :is(button, a[href], [role="tab"], [role="button"])[aria-disabled="true"] {
  cursor: default;
}

.a4-file-backstage__header {
  grid-column: 1 / -1;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 8px clamp(16px, 3vw, 36px);
  color: var(--a4bs-text);
  background: var(--a4bs-surface);
  border-bottom: 1px solid var(--a4bs-border);
}

.a4-file-backstage__header h1,
.a4-file-backstage__section h2,
.a4-file-backstage__section h3,
.a4-file-backstage__section p {
  margin: 0;
}

.a4-file-backstage__header h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.a4-file-backstage__close,
.a4-file-backstage__nav-item,
.a4-file-backstage__actions button,
.a4-file-backstage__close-actions button,
.a4-file-backstage__async button,
.a4-file-backstage__feedback button,
.a4-file-backstage__recent-item {
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: inherit;
  background: #fff;
  font: inherit;
}

.a4-file-backstage__close {
  flex: 0 0 auto;
  padding: 7px 14px;
  color: var(--a4bs-text-soft);
  border-color: var(--a4bs-border-strong);
  background: var(--a4bs-surface);
}

.a4-file-backstage__close:hover {
  background: var(--a4bs-hover);
}

.a4-file-backstage__nav {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 12px 8px;
  border-right: 1px solid var(--a4bs-border);
  background: var(--a4bs-surface-sunken);
}

/* Пункт раздела: иконка сверху, подпись под ней — как в Word. */
.a4-file-backstage__nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  margin: 0 0 4px;
  padding: 8px 4px;
  text-align: center;
  color: var(--a4bs-text-soft);
  border-color: transparent;
  border-radius: var(--a4bs-r-md);
  background: transparent;
  /* Подписи разделов не режем по слогам: «Сведени-я» и «Парамет-ры» читаются
     как брак вёрстки. Слово целиком либо ужимается, но не разрывается. */
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
}

.a4-file-backstage__nav-item:hover {
  background: var(--a4bs-hover);
}

.a4-file-backstage__nav-label {
  font-size: 11px;
  line-height: 1.2;
}

.a4-file-backstage__nav-item[aria-current="page"] {
  color: var(--a4bs-accent);
  border-color: transparent;
  background: var(--a4bs-accent-tint);
  font-weight: 600;
}

.a4-file-backstage__content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: clamp(20px, 4vw, 52px);
  background: var(--a4bs-canvas);
}

.a4-file-backstage__section h2 {
  font-size: 20px;
  font-weight: 640;
  color: var(--a4bs-text);
}

.a4-file-backstage__section {
  display: grid;
  min-width: 0;
  max-width: 960px;
  gap: 18px;
}

.a4-file-backstage__document,
.a4-file-backstage__feedback,
.a4-file-backstage__async,
.a4-file-backstage__close-prompt,
.a4-file-backstage__recent-item {
  min-width: 0;
  overflow-wrap: anywhere;
}

.a4-file-backstage__document,
.a4-file-backstage__feedback,
.a4-file-backstage__async {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid #d8e0eb;
  border-radius: 10px;
  background: #fff;
}

.a4-file-backstage__async--busy {
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-height: 260px;
  padding: 24px 16px;
  border: 0;
  background: transparent;
  text-align: center;
}

.a4-file-backstage__feedback.a4-file-backstage__async--busy,
.a4-file-backstage__compatibility-summary.a4-file-backstage__async--busy {
  border: 0;
  background: transparent;
}

.a4-file-backstage__async--busy p,
.a4-file-backstage__async--busy > strong {
  margin: 0;
  color: var(--a4bs-text-mute, #8a97ac);
  font-size: 13px;
  font-weight: 400;
}

.a4-file-backstage__spinner {
  display: block;
  justify-self: center;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  border: 2px solid var(--a4bs-border, #e3e9f2);
  border-top-color: var(--a4bs-accent, #0f6cbd);
  border-radius: 50%;
  animation: a4-file-backstage-spin 0.7s linear infinite;
}

@keyframes a4-file-backstage-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .a4-file-backstage__spinner {
    animation-duration: 2.4s;
  }
}

.a4-file-backstage__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.a4-file-backstage__actions button,
.a4-file-backstage__close-actions button,
.a4-file-backstage__async button,
.a4-file-backstage__feedback button {
  padding: 9px 14px;
  overflow-wrap: anywhere;
}

.a4-file-backstage__autosave-settings button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: inherit;
  background: #fff;
  font: inherit;
}

.a4-file-backstage__close-prompt {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(560px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  gap: 14px;
  overflow: auto;
  padding: clamp(18px, 4vw, 30px);
  border: 1px solid #b9c5d6;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 0 0 100vmax rgb(15 23 42 / 42%), 0 20px 70px rgb(15 23 42 / 35%);
  transform: translate(-50%, -50%);
  overflow-wrap: anywhere;
}

.a4-file-backstage__close-prompt h2,
.a4-file-backstage__close-prompt p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.a4-file-backstage__close-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.a4-file-backstage__close-actions button {
  flex: 1 1 132px;
  padding: 9px 14px;
}

.a4-file-backstage__recent-list {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.a4-file-backstage__history-toolbar,
.a4-file-backstage__history-list,
.a4-file-backstage__history-item {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.a4-file-backstage__compatibility-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.a4-file-backstage__compatibility-actions button {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid #3154a5;
  border-radius: 8px;
  color: #172033;
  background: #fff;
  font: inherit;
  font-weight: 650;
}

.a4-file-backstage__compatibility-summary,
.a4-file-backstage__compatibility-clean,
.a4-file-backstage__issue {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 15px;
  border: 1px solid #d8e0eb;
  border-radius: 10px;
  overflow-wrap: anywhere;
  background: #fff;
}

.a4-file-backstage__compatibility-summary[data-status="error"] {
  border-color: #b91c1c;
  background: #fff7f7;
}

.a4-file-backstage__compatibility-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.a4-file-backstage__issue-list {
  display: grid;
  gap: 10px;
}

.a4-file-backstage__issue[data-severity="blocker"] {
  border-left: 5px solid #991b1b;
  background: #fff7f7;
}

.a4-file-backstage__issue[data-severity="error"] {
  border-left: 5px solid #c2410c;
  background: #fffaf0;
}

.a4-file-backstage__issue[data-severity="warning"] {
  border-left: 5px solid #a16207;
}

.a4-file-backstage__issue-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
}

.a4-autocorrect-options {
  gap: 18px;
}

.a4-autocorrect-options__heading,
.a4-autocorrect-options__tabs,
.a4-autocorrect-options__row,
.a4-autocorrect-options__exception {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.a4-autocorrect-options__heading {
  justify-content: space-between;
}

.a4-autocorrect-options__path {
  margin: 0 0 5px;
  color: #526174;
  font-size: 13px;
}

.a4-autocorrect-options__tabs {
  padding-bottom: 10px;
  border-bottom: 1px solid #d8e0eb;
}

.a4-autocorrect-options__tabs [data-options-section] {
  padding: 7px 12px;
  border: 1px solid #c8d2df;
  border-radius: 6px;
  background: #fff;
}

.a4-autocorrect-options__tabs [data-options-section="parent"]::after {
  content: "›";
  margin-left: 10px;
  color: #64748b;
}

.a4-autocorrect-options__tabs [data-options-section="current"] {
  border-color: #3154a5;
  color: #183c89;
  background: #edf3ff;
}

.a4-autocorrect-options__toggles,
.a4-autocorrect-options__panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #d8e0eb;
  border-radius: 10px;
  background: #fff;
}

.a4-autocorrect-options__toggles label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.a4-autocorrect-options__form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
}

.a4-autocorrect-options__form-grid label {
  display: grid;
  gap: 5px;
}

.a4-autocorrect-options input[type="text"],
.a4-autocorrect-options select,
.a4-autocorrect-options__row input:not([type="checkbox"]) {
  min-height: 38px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #b9c4d3;
  border-radius: 6px;
  font: inherit;
}

.a4-autocorrect-options button {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #8796aa;
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

.a4-autocorrect-options__list {
  display: grid;
  gap: 8px;
}

.a4-autocorrect-options__row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(140px, 1.5fr) 110px repeat(3, auto) auto auto;
  padding: 9px;
  border: 1px solid #e1e6ee;
  border-radius: 8px;
}

.a4-autocorrect-options__exception {
  justify-content: space-between;
  padding: 9px;
  border-bottom: 1px solid #e1e6ee;
}

.a4-autocorrect-options__storage {
  color: #526174;
  font-size: 13px;
}

@media (max-width: 900px) {
  .a4-autocorrect-options__row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .a4-file-backstage__compatibility-actions {
    grid-template-columns: 1fr;
  }
}

.a4-file-backstage__history-toolbar {
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: end;
}

.a4-file-backstage__history-toolbar label {
  display: grid;
  gap: 6px;
}

.a4-file-backstage__history-toolbar input,
.a4-file-backstage__history-toolbar button {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
}

.a4-file-backstage__history-item {
  padding: 15px;
  border: 1px solid #d8e0eb;
  border-radius: 10px;
  background: #fff;
}

.a4-file-backstage__history-item[data-health="missing"],
.a4-file-backstage__history-item[data-health="corrupt"] {
  border-color: #dc2626;
  background: #fff7f7;
}

.a4-file-backstage__history-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
}

@media (max-width: 760px) {
  .a4-file-backstage__history-toolbar {
    grid-template-columns: 1fr;
  }
}

.a4-external-change-prompt {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--a4bs-border, #e3e9f2);
  border-radius: var(--a4bs-r-lg, 12px);
  color: var(--a4bs-text, #1a2434);
  background: var(--a4bs-surface, #ffffff);
  box-shadow: 0 24px 80px rgb(15 23 42 / 22%);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.a4-external-change-prompt__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--a4bs-r-sm, 6px);
  background: transparent;
  color: var(--a4bs-text-mute, #8a97ac);
  font: 20px/28px Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
}

.a4-external-change-prompt__close:hover,
.a4-external-change-prompt__close:focus-visible {
  background: var(--a4bs-hover, #f3f7fd);
  color: var(--a4bs-text, #1a2434);
}

.a4-external-change-prompt::backdrop {
  background: rgb(15 23 42 / 52%);
}

.a4-external-change-prompt h2 {
  margin: 0 0 8px;
  padding-right: 32px;
  color: var(--a4bs-text, #1a2434);
  font-size: 20px;
  font-weight: 640;
  line-height: 1.25;
}

.a4-external-change-prompt p {
  margin: 0 0 10px;
  color: var(--a4bs-text-soft, #55637a);
  font-size: 13px;
  line-height: 1.45;
}

.a4-external-change-prompt small {
  display: block;
  margin-bottom: 20px;
  padding: 8px 10px;
  border-radius: var(--a4bs-r-sm, 6px);
  background: var(--a4bs-surface-sunken, #f1f5f9);
  color: var(--a4bs-text-mute, #8a97ac);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.a4-external-change-prompt__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.a4-external-change-prompt__actions button {
  min-height: 36px;
  padding: 6px 18px;
  border: 1px solid var(--a4bs-border-strong, #d3dce8);
  border-radius: var(--a4bs-r-md, 8px);
  background: var(--a4bs-surface, #ffffff);
  color: var(--a4bs-text, #1a2434);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 14px;
}

.a4-external-change-prompt__actions button:hover:not(:disabled) {
  background: var(--a4bs-hover, #f3f7fd);
}

.a4-external-change-prompt__actions button:first-child {
  border-color: transparent;
  background: var(--a4bs-accent, #0f6cbd);
  color: #ffffff;
}

.a4-external-change-prompt__actions button:first-child:hover:not(:disabled) {
  background: var(--a4bs-accent-hover, #115ea3);
}

.a4-file-backstage__recent-item {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 13px 16px;
  text-align: left;
}

.a4-file-backstage__recent-item[data-availability="missing"] {
  border-color: #d97706;
  background: #fff7ed;
}

.a4-file-backstage__recent-open {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
}

.a4-file-backstage__item-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.a4-file-backstage__item-actions button,
.a4-file-backstage__template-card button,
.a4-file-backstage__template-save button {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: inherit;
  font: inherit;
}

.a4-file-backstage__template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.a4-file-backstage__template-card,
.a4-file-backstage__template-save {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 16px;
  border: 1px solid #d8e0eb;
  border-radius: 10px;
  background: #fff;
}

.a4-file-backstage__template-card pre,
.a4-file-backstage__template-preview {
  min-height: 88px;
  margin: 0;
  overflow: auto;
  padding: 10px;
  border-radius: 7px;
  background: #f8fafc;
  color: #334155;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

.a4-file-backstage__template-save label {
  display: grid;
  gap: 6px;
}

.a4-file-backstage__template-save input {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #94a3b8;
  border-radius: 7px;
  font: inherit;
}

.a4-file-backstage__recent-item span,
.a4-file-backstage__recent-item small,
.a4-file-backstage__document span,
.a4-file-backstage__document small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.a4-file-backstage button:focus-visible {
  outline: 3px solid #f4b942;
  outline-offset: 2px;
}

.a4-file-backstage button:disabled,
.a4-file-backstage button[aria-disabled="true"] {
  opacity: 0.55;
}

@media (max-width: 720px), (max-height: 560px) {
  .a4-file-backstage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .a4-file-backstage__nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid #d8e0eb;
  }

  .a4-file-backstage__nav-item {
    width: auto;
    min-width: max-content;
    margin: 0;
  }

  .a4-file-backstage__content {
    padding: 18px 14px 28px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Figma start surface — source nodes 22913:181391, 22922:262710,
   22922:263753 and 22922:264355.  This block intentionally wins over the
   historical Word-like modifier above: Figma is the approved visual source
   of truth for Home, New and Recent, while secondary product workspaces keep
   their existing compositions.
   ───────────────────────────────────────────────────────────────────────── */

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] {
  grid-template-columns: 94px minmax(0, 1fr);
  grid-template-rows: 34px minmax(0, 1fr) 60px;
  color: #2e2e2e;
  background: #ffffff;
  box-shadow: none;

  --a4bs-canvas: #ffffff;
  --a4bs-surface: #ffffff;
  --a4bs-surface-sunken: rgb(134 142 150 / 10%);
  --a4bs-system-material: #ffffff;
  --a4bs-hover: rgb(76 110 245 / 7%);
  --a4bs-accent-tint: rgb(76 110 245 / 10%);
  --a4bs-border: #dee2e6;
  --a4bs-border-strong: #ced4da;
  --a4bs-text: #2e2e2e;
  --a4bs-text-soft: #2e2e2e;
  --a4bs-text-mute: #868e96;
  --a4bs-accent: #4c6ef5;
  --a4bs-accent-hover: #4263eb;
  --a4bs-accent-active: #3b5bdb;
  --a4bs-shadow-card: none;
  --a4bs-shadow-hover: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__header {
  grid-column: 1 / -1;
  grid-row: 1;
  min-height: 34px;
  height: 34px;
  justify-content: center;
  padding: 4px 10px;
  color: #ffffff;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: #4c6ef5;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__header::before,
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__header::after {
  display: none;
  content: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__header h1 {
  position: static;
  z-index: auto;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__nav {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-width: 94px;
  padding: 20px 10px;
  overflow: hidden;
  border-right: 1px solid #dee2e6;
  border-bottom: 0;
  background: #ffffff;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  scrollbar-gutter: auto;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__nav-item {
  flex: 0 0 56px;
  width: 74px;
  min-height: 56px;
  margin: 0 0 4px;
  gap: 2px;
  padding: 4px;
  color: #2e2e2e;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-weight: 400;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__nav-item:hover {
  background: rgb(76 110 245 / 6%);
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__nav-item[aria-current="page"] {
  color: #4c6ef5;
  background: rgb(76 110 245 / 10%);
  font-weight: 500;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__nav-label {
  max-width: 56px;
  font-size: 12px;
  font-weight: inherit;
  line-height: 1.4;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__nav-icon--asset {
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  background-color: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] [data-a4-backstage-icon="home"] {
  -webkit-mask-image: url("../assets/a4-v2/backstage/home.svg");
  mask-image: url("../assets/a4-v2/backstage/home.svg");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] [data-a4-backstage-icon="new"] {
  -webkit-mask-image: url("../assets/a4-v2/backstage/new.svg");
  mask-image: url("../assets/a4-v2/backstage/new.svg");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] [data-a4-backstage-icon="recent"] {
  -webkit-mask-image: url("../assets/a4-v2/backstage/recent.svg");
  mask-image: url("../assets/a4-v2/backstage/recent.svg");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__content {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding: 20px 20px 16px;
  overflow: auto;
  background: #ffffff;
  scrollbar-gutter: auto;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__footer {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  min-width: 0;
  height: 60px;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  box-sizing: border-box;
  border-top: 1px solid #dee2e6;
  background: #ffffff;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__footer-button {
  width: 109px;
  height: 36px;
  min-height: 36px;
  padding: 6px 18px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 14px;
  text-align: center;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__footer-button--quiet {
  color: #868e96;
  background: rgb(134 142 150 / 10%);
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__footer-button--primary {
  color: #ffffff;
  background: #4c6ef5;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__footer-button--primary:hover:not(:disabled) {
  background: #4263eb;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__footer-button:disabled {
  opacity: 0.45;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__section--home,
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__section--new,
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__section--recent {
  width: 100%;
  max-width: none;
  color: #2e2e2e;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__section--home {
  gap: 16px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__home-block {
  gap: 14px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__home-heading {
  min-height: 29px;
  align-items: center;
  padding: 0;
  border: 0;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__home-heading h3,
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__template-shelf > h3 {
  margin: 0;
  color: #000000;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__home-more {
  min-height: 30px;
  padding: 4px 14px;
  color: #4c6ef5;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  line-height: 14px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__home-more:hover {
  background: rgb(76 110 245 / 7%);
  text-decoration: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery {
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: 112px;
  justify-content: start;
  gap: 16px;
  max-width: 100%;
  padding: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-card {
  width: 112px;
  min-width: 112px;
  gap: 4px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-card:hover {
  background: transparent;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-card:hover .a4-file-backstage__gallery-page {
  border-color: #4c6ef5;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page {
  width: 112px;
  height: 141px;
  aspect-ratio: auto;
  padding: 8px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}


/* Лицо карточки — экспорт слота из Figma. Правило живёт в контексте
   Figma-поверхности: её собственные объявления фона иначе перебивают
   картинку по специфичности. */
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot] {
  /* Экспорт несёт собственную рамку макета, поэтому своей рамки у карточки
     нет: иначе картинка сжимается внутрь и перестаёт совпадать с макетом. */
  padding: 0;
  border: 0;
  border-radius: 8px;
  background-position: 0 0;
  background-size: 112px 141px;
  background-repeat: no-repeat;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot="blank"] {
  background-image: url("../assets/a4-v2/backstage/templates/blank.png");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot="notes"] {
  background-image: url("../assets/a4-v2/backstage/templates/notes.png");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot="resume"] {
  background-image: url("../assets/a4-v2/backstage/templates/resume-classic.png");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot="cover-letter"] {
  background-image: url("../assets/a4-v2/backstage/templates/resume-modern.png");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot="letter"] {
  background-image: url("../assets/a4-v2/backstage/templates/project-color.png");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot="project-plan"] {
  background-image: url("../assets/a4-v2/backstage/templates/project-photo.png");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot="report"] {
  background-image: url("../assets/a4-v2/backstage/templates/report.png");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot="proposal"] {
  background-image: url("../assets/a4-v2/backstage/templates/resume-compact.png");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot="recipe"] {
  background-image: url("../assets/a4-v2/backstage/templates/recipe.png");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-page[data-figma-slot="lesson-plan"] {
  background-image: url("../assets/a4-v2/backstage/templates/project-education.png");
}

/* В макете первая карточка ничем не выделена: акцентная рамка "пустого
   документа" — наследие Word-подобной поверхности. */
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__gallery-card[data-primary="true"]
  .a4-file-backstage__gallery-page {
  border-color: #dee2e6;
  box-shadow: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__gallery-title,
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__gallery-card[data-primary="true"]
  .a4-file-backstage__gallery-title {
  width: 112px;
  min-height: 17px;
  padding: 0;
  overflow: hidden;
  color: #000000;
  background: transparent;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__section--new {
  display: grid;
  gap: 20px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__template-shelf {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--new
  .a4-file-backstage__new-gallery {
  grid-template-columns: repeat(auto-fill, 112px);
  grid-auto-flow: row;
  grid-auto-columns: auto;
  gap: 16px;
  margin: 0;
  overflow: visible;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-heading {
  display: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__section--recent,
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-workspace {
  min-height: 100%;
  gap: 2px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-toolbar {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  box-sizing: border-box;
  border: 0;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-tabs {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-tab {
  min-width: 104px;
  height: 30px;
  min-height: 30px;
  padding: 4px 14px;
  color: #2e2e2e;
  border: 0;
  border-radius: 0 8px 8px 0;
  background: rgb(134 142 150 / 10%);
  font-size: 14px;
  font-weight: 500;
  line-height: 14px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-tab:first-child {
  border-radius: 8px 0 0 8px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-tab[aria-selected="true"] {
  color: #ffffff;
  background: #4c6ef5;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-search {
  position: relative;
  display: block;
  width: min(348px, 34vw);
  height: 30px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-search input {
  width: 100%;
  height: 30px;
  padding: 4px 12px 4px 36px;
  box-sizing: border-box;
  color: #2e2e2e;
  border: 1px solid #ced4da;
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-search input::placeholder {
  color: #adb5bd;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-search input:focus {
  border-color: #4c6ef5;
  box-shadow: 0 0 0 2px rgb(76 110 245 / 15%);
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-search-icon {
  position: absolute;
  z-index: 1;
  top: 7px;
  left: 12px;
  display: block;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-search-icon i {
  position: absolute;
  display: block;
  background: #868e96;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-search-icon i:first-child {
  inset: 1px 3px 3px 1px;
  -webkit-mask-image: url("../assets/a4-v2/backstage/search-circle.svg");
  mask-image: url("../assets/a4-v2/backstage/search-circle.svg");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-search-icon i:last-child {
  inset: 10px 1px 1px 10px;
  -webkit-mask-image: url("../assets/a4-v2/backstage/search-handle.svg");
  mask-image: url("../assets/a4-v2/backstage/search-handle.svg");
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-table {
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px 84px;
  min-height: 40px;
  align-items: center;
  gap: 0;
  padding: 0;
  color: #000000;
  border: 0;
  border-radius: 8px;
  background: rgb(134 142 150 / 10%);
  font-size: 14px;
  font-weight: 600;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-head > span {
  display: flex;
  min-width: 0;
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  box-sizing: border-box;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-head img {
  width: 10px;
  height: 10px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-head-date {
  margin: 0;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  min-height: 48px;
  overflow: visible;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-item:nth-of-type(even) {
  background: rgb(134 142 150 / 10%);
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-item:hover {
  background: rgb(76 110 245 / 7%);
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-open {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 264px;
  min-width: 0;
  min-height: 48px;
  gap: 10px;
  padding: 8px 0 8px 14px;
  color: #2e2e2e;
  border: 0;
  background: transparent;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-icon {
  display: block;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 4px;
  background: transparent;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-icon img {
  display: block;
  width: 20px;
  height: 20px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-main {
  align-content: center;
  gap: 0;
  padding: 0;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-main strong {
  color: #000000;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-main .a4-file-backstage__crumbs,
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-missing {
  display: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-date {
  align-self: center;
  color: #000000;
  font-size: 14px;
  line-height: 1.45;
  white-space: nowrap;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-item .a4-file-backstage__item-actions {
  position: static;
  display: flex;
  height: 48px;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 12px;
  transform: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-item
  .a4-file-backstage__recent-icon-btn {
  display: grid;
  width: 28px;
  height: 28px;
  min-height: 28px;
  place-items: center;
  padding: 0;
  color: #2e2e2e;
  border: 0;
  border-radius: 8px;
  opacity: 1;
  background: transparent;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__figma-star {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__figma-star img {
  position: absolute;
  inset: 0;
  width: 20px;
  height: 20px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__figma-more {
  display: flex;
  width: 20px;
  height: 20px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__figma-more img {
  width: 3px;
  height: 3px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-empty {
  display: flex;
  min-height: 100%;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 0;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-empty-icon {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  opacity: 0.7;
  background: transparent;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-empty-icon img {
  position: absolute;
  inset: 0;
  width: 64px;
  height: 64px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-empty h3 {
  color: #868e96;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-empty > div {
  display: contents;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__section--home > .a4-file-backstage__document,
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__section--home > .a4-file-backstage__actions,
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__section--home > .a4-file-backstage__template-save {
  display: none;
}

@media (max-width: 760px) {
  .a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__nav {
    grid-column: 1;
    grid-row: 2;
    min-width: 78px;
    padding-inline: 6px;
    border-right: 1px solid #dee2e6;
    border-bottom: 0;
  }

  .a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__nav-item {
    width: 66px;
  }

  .a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__content {
    grid-column: 2;
    grid-row: 2;
    padding-inline: 14px;
  }

  .a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-search {
    width: min(260px, 42vw);
  }

  .a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-head,
  .a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-item {
    grid-template-columns: minmax(0, 1fr) 64px;
  }

  .a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-head-date,
  .a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-date {
    display: none;
  }

  .a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__recent-open {
    grid-template-columns: 20px minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .a4-file-backstage__header {
    padding: 10px 12px;
  }

  .a4-file-backstage__action-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .a4-file-backstage * {
    scroll-behavior: auto !important;
  }
}

/* --- Word-style pass: navigation, actions, document card (Файл tab) --- */

.a4-file-backstage__nav {
  background: #f3f5f9;
  border-right-color: #e2e8f0;
}

.a4-file-backstage__nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 2px;
  padding: 9px 12px;
  border-color: transparent;
  background: transparent;
  color: #33415a;
  font-weight: 500;
}

.a4-file-backstage__nav-item:hover {
  background: #e5eaf2;
}

.a4-file-backstage__nav-icon {
  flex: 0 0 auto;
  color: #6b7a90;
}

.a4-file-backstage__nav-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.a4-file-backstage__nav-item[aria-current="page"] {
  border-color: transparent;
  background: #e6f0fb;
  color: #0f6cbd;
  font-weight: 650;
}

.a4-file-backstage__nav-item[aria-current="page"] .a4-file-backstage__nav-icon {
  color: #0f6cbd;
}

/* Document card — icon tile + body, hairline border + soft shadow */

.a4-file-backstage__document {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: var(--a4bs-s-4);
  padding: var(--a4bs-s-4) var(--a4bs-s-5);
  position: relative;
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-lg);
  background: var(--a4bs-surface);
  box-shadow: var(--a4bs-shadow-card);
}

.a4-file-backstage__document::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 999px;
  background: var(--a4bs-accent);
}

.a4-file-backstage__doc-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--a4bs-r-md);
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage__doc-body {
  display: grid;
  min-width: 0;
  gap: var(--a4bs-s-2);
}

.a4-file-backstage__document strong {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--a4bs-text);
}

.a4-file-backstage__crumbs {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a4bs-s-1);
  color: var(--a4bs-text-soft);
  font-size: 12.5px;
}

.a4-file-backstage__crumb-sep {
  color: var(--a4bs-text-mute);
}

.a4-file-backstage__saved {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: var(--a4bs-s-2);
  padding: 3px 11px;
  border-radius: var(--a4bs-r-pill);
  color: var(--a4bs-success);
  background: var(--a4bs-success-bg);
  font-size: 12px;
  font-weight: 600;
}

.a4-file-backstage__saved::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.a4-file-backstage__saved[data-dirty="true"] {
  color: var(--a4bs-warn);
  background: var(--a4bs-warn-bg);
}

/* Empty state — inviting well */

.a4-file-backstage__empty-doc {
  display: grid;
  justify-items: center;
  gap: var(--a4bs-s-2);
  padding: var(--a4bs-s-8) var(--a4bs-s-5);
  text-align: center;
  border: 1px dashed var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-lg);
  background: var(--a4bs-surface-sunken);
}

.a4-file-backstage__empty-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: var(--a4bs-s-1);
  border-radius: 50%;
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage__empty-title {
  font-size: 15px;
  font-weight: 640;
  color: var(--a4bs-text);
}

.a4-file-backstage__empty-text {
  max-width: 42ch;
  color: var(--a4bs-text-soft);
  font-size: 13px;
  line-height: 1.5;
}

/* Actions — grouped, labeled, iconified */

.a4-file-backstage__actions {
  display: grid;
  gap: var(--a4bs-s-5);
  grid-template-columns: none;
}

.a4-file-backstage__action-group {
  display: grid;
  gap: var(--a4bs-s-2);
}

.a4-file-backstage__group-label {
  color: var(--a4bs-text-mute);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.a4-file-backstage__action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--a4bs-s-3);
}

.a4-file-backstage__action {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--a4bs-s-2);
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
  color: var(--a4bs-text);
  font-size: 13.5px;
  font-weight: 560;
  box-shadow: var(--a4bs-shadow-btn);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.a4-file-backstage__action-icon {
  flex: 0 0 auto;
  color: var(--a4bs-text-soft);
}

.a4-file-backstage__actions .a4-file-backstage__action:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--a4bs-hover);
  border-color: #b9cbe6;
}

.a4-file-backstage__actions .a4-file-backstage__action:active:not(:disabled) {
  box-shadow: none;
  transform: translateY(0.5px);
}

.a4-file-backstage__actions .a4-file-backstage__action--primary {
  border-color: transparent;
  background: var(--a4bs-accent);
  color: #fff;
  box-shadow: 0 1px 2px rgb(15 108 189 / 35%);
}

.a4-file-backstage__actions .a4-file-backstage__action--primary .a4-file-backstage__action-icon {
  color: rgb(255 255 255 / 85%);
}

.a4-file-backstage__actions .a4-file-backstage__action--primary:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--a4bs-accent-hover);
  border-color: transparent;
  box-shadow: 0 2px 6px rgb(15 108 189 / 40%);
}

.a4-file-backstage__actions .a4-file-backstage__action--primary:active:not(:disabled) {
  background: var(--a4bs-accent-active);
}

.a4-file-backstage__actions .a4-file-backstage__action--danger {
  border-color: var(--a4bs-danger-border);
  background: var(--a4bs-surface);
  color: var(--a4bs-danger);
}

.a4-file-backstage__actions .a4-file-backstage__action--danger .a4-file-backstage__action-icon {
  color: currentColor;
}

.a4-file-backstage__actions .a4-file-backstage__action--danger:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: #e0a49d;
  background: var(--a4bs-danger-bg);
}

.a4-file-backstage__action--wide {
  grid-column: 1 / -1;
}

/* Switch / toggle — settings-grade row */

.a4-file-backstage__actions .a4-file-backstage__action--switch {
  justify-content: space-between;
  border-color: var(--a4bs-border-strong);
  background: var(--a4bs-surface);
  color: var(--a4bs-text);
  font-weight: 500;
}

.a4-file-backstage__switch-label {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: left;
}

.a4-file-backstage__switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: var(--a4bs-r-pill);
  background: #cbd5e1;
  box-shadow: inset 0 0 0 1px rgb(15 23 42 / 6%);
  transition: background 0.18s ease;
}

.a4-file-backstage__switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 30%);
  transition: transform 0.18s ease;
}

.a4-file-backstage__action--switch[aria-pressed="true"] {
  border-color: #bcd4ee;
}

.a4-file-backstage__action--switch[aria-pressed="true"] .a4-file-backstage__switch-track {
  background: var(--a4bs-accent);
}

.a4-file-backstage__action--switch[aria-pressed="true"] .a4-file-backstage__switch-thumb {
  transform: translateX(18px);
}

/* Status/feedback strip — clearly a status, not a button */

.a4-file-backstage__feedback {
  gap: 8px;
  padding: 11px 14px;
  border: 0;
  border-left: 3px solid #94a3b8;
  border-radius: 0 8px 8px 0;
  background: #eef2f8;
  color: #33415a;
}

.a4-file-backstage__feedback[data-tone="error"] {
  border-left-color: #dc2626;
  background: #fef3f2;
  color: #b42318;
}

.a4-file-backstage__feedback[data-tone="success"] {
  border-left-color: #12b76a;
  background: #ecfdf3;
  color: #067647;
}

.a4-file-backstage__close {
  min-height: 34px;
  padding: 6px 14px;
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .a4-file-backstage__switch-track,
  .a4-file-backstage__switch-thumb {
    transition: none;
  }
}

/* --- "Создать" tab: template gallery (Word-style thumbnails) --- */

.a4-file-backstage__section-lead {
  max-width: 62ch;
  color: var(--a4bs-text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.a4-file-backstage__template-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--a4bs-s-4);
}

.a4-file-backstage__template-card {
  gap: var(--a4bs-s-3);
  padding: var(--a4bs-s-3);
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-lg);
  background: var(--a4bs-surface);
  box-shadow: var(--a4bs-shadow-card);
  transition: box-shadow 0.15s ease;
}

.a4-file-backstage__template-card:hover {
  box-shadow: var(--a4bs-shadow-hover);
}

.a4-file-backstage__template-page {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  padding: 13px 14px;
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-sm);
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 8%);
}

.a4-file-backstage__template-page-inner {
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 82%, transparent);
  mask-image: linear-gradient(#000 82%, transparent);
}

.a4-file-backstage__template-heading {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 2px;
  color: var(--a4bs-text);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.3;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.a4-file-backstage__template-text {
  overflow: hidden;
  color: #4a5568;
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.a4-file-backstage__template-gap {
  flex: 0 0 auto;
  height: 6px;
}

.a4-file-backstage__template-meta {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.a4-file-backstage__template-meta h3 {
  color: var(--a4bs-text);
  font-size: 14px;
  font-weight: 620;
}

.a4-file-backstage__template-meta p {
  color: var(--a4bs-text-soft);
  font-size: 12px;
  line-height: 1.4;
}

.a4-file-backstage__template-card .a4-file-backstage__template-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--a4bs-s-2);
  min-height: 36px;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
  color: var(--a4bs-accent);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.a4-file-backstage__template-create .a4-file-backstage__action-icon {
  color: currentColor;
}

.a4-file-backstage__template-card:hover .a4-file-backstage__template-create:not(:disabled):not([aria-disabled="true"]) {
  border-color: transparent;
  background: var(--a4bs-accent);
  color: #fff;
}

/* --- "Недавние" tab: Word-style file rows --- */

.a4-file-backstage__recent-table {
  overflow: hidden;
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-lg);
  background: var(--a4bs-surface);
  box-shadow: var(--a4bs-shadow-card);
}

.a4-file-backstage__recent-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--a4bs-border);
  background: var(--a4bs-surface-sunken);
  color: var(--a4bs-text-mute);
  font-size: 12px;
  font-weight: 600;
}

.a4-file-backstage__recent-head-icon {
  display: grid;
  place-items: center;
  color: var(--a4bs-text-mute);
}

.a4-file-backstage__recent-list {
  display: block;
  gap: 0;
}

.a4-file-backstage__recent-item {
  position: relative;
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.a4-file-backstage__recent-item:nth-of-type(even) {
  background: #fafbfd;
}

.a4-file-backstage__recent-item:hover {
  background: var(--a4bs-hover);
}

.a4-file-backstage__recent-open {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 0;
  padding: 11px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.a4-file-backstage__recent-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--a4bs-r-md);
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage__recent-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.a4-file-backstage__recent-main strong {
  overflow: hidden;
  color: var(--a4bs-text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.a4-file-backstage__recent-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.a4-file-backstage__recent-missing {
  padding: 2px 8px;
  border-radius: var(--a4bs-r-pill);
  color: var(--a4bs-warn);
  background: var(--a4bs-warn-bg);
  font-size: 11px;
  font-weight: 600;
}

.a4-file-backstage__recent-item .a4-file-backstage__item-actions {
  position: absolute;
  top: 50%;
  right: 12px;
  display: flex;
  gap: 2px;
  transform: translateY(-50%);
}

.a4-file-backstage__recent-item .a4-file-backstage__recent-icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--a4bs-r-sm);
  background: transparent;
  color: var(--a4bs-text-mute);
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.a4-file-backstage__recent-item:hover .a4-file-backstage__recent-icon-btn,
.a4-file-backstage__recent-item:focus-within .a4-file-backstage__recent-icon-btn {
  opacity: 1;
}

.a4-file-backstage__recent-icon-btn:focus {
  opacity: 1;
}

.a4-file-backstage__recent-item .a4-file-backstage__recent-icon-btn:hover {
  background: rgb(15 23 42 / 7%);
  color: var(--a4bs-text);
}

.a4-file-backstage__recent-item .a4-file-backstage__recent-star[aria-pressed="true"] {
  opacity: 1;
  color: var(--a4bs-accent);
}

.a4-file-backstage__recent-item .a4-file-backstage__recent-remove:hover {
  color: var(--a4bs-danger);
  background: var(--a4bs-danger-bg);
}

/* Recent: All / Favorites tabs */

.a4-file-backstage__recent-toolbar {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
}

.a4-file-backstage__recent-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.a4-file-backstage__recent-tab {
  min-height: 32px;
  padding: 6px 15px;
  border: 0;
  border-radius: var(--a4bs-r-md);
  background: transparent;
  color: var(--a4bs-text-soft);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.12s ease, color 0.12s ease;
}

.a4-file-backstage__recent-tab:hover {
  background: var(--a4bs-hover);
  color: var(--a4bs-text);
}

.a4-file-backstage__recent-tab[aria-selected="true"] {
  background: var(--a4bs-accent);
  color: #fff;
}

/* --- "Шаблоны" tab --- */

.a4-file-backstage__subheading {
  margin-top: var(--a4bs-s-2);
  color: var(--a4bs-text);
  font-size: 15px;
  font-weight: 640;
}

.a4-file-backstage__template-save {
  gap: var(--a4bs-s-3);
  padding: var(--a4bs-s-4) var(--a4bs-s-5);
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-lg);
  background: var(--a4bs-surface);
  box-shadow: var(--a4bs-shadow-card);
}

.a4-file-backstage__template-save h3 {
  color: var(--a4bs-text);
  font-size: 14px;
  font-weight: 620;
}

.a4-file-backstage__template-save-hint {
  color: var(--a4bs-text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.a4-file-backstage__template-save-hint:empty {
  display: none;
}

.a4-file-backstage__template-save-preview {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface-sunken);
}

.a4-file-backstage__template-save-preview-label {
  color: var(--a4bs-text-mute);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.a4-file-backstage__template-save-preview-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--a4bs-text-soft);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.a4-file-backstage__template-save-row {
  display: flex;
  align-items: end;
  gap: var(--a4bs-s-3);
}

.a4-file-backstage__template-save-field {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 5px;
}

.a4-file-backstage__template-save-field > span {
  color: var(--a4bs-text-soft);
  font-size: 12.5px;
}

.a4-file-backstage__template-save .a4-file-backstage__template-save-field input {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
  font: inherit;
}

.a4-file-backstage__template-save .a4-file-backstage__template-save-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--a4bs-s-2);
  min-height: 40px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 560;
  box-shadow: 0 1px 2px rgb(15 108 189 / 35%);
  transition: background 0.15s ease;
}

.a4-file-backstage__template-save-btn .a4-file-backstage__action-icon {
  color: rgb(255 255 255 / 85%);
}

.a4-file-backstage__template-save .a4-file-backstage__template-save-btn:hover:not(:disabled) {
  background: var(--a4bs-accent-hover);
}

.a4-file-backstage__template-actions {
  display: flex;
  align-items: stretch;
  gap: var(--a4bs-s-2);
}

.a4-file-backstage__template-actions .a4-file-backstage__template-create {
  flex: 1;
}

.a4-file-backstage__template-card .a4-file-backstage__template-delete {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
  color: var(--a4bs-text-mute);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.a4-file-backstage__template-card .a4-file-backstage__template-delete:hover {
  border-color: var(--a4bs-danger-border);
  background: var(--a4bs-danger-bg);
  color: var(--a4bs-danger);
}


/* --- "Сведения" tab --- */

.a4-file-backstage__info-props {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--a4bs-s-2);
}

.a4-file-backstage__info-prop {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 11px 14px;
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
}

.a4-file-backstage__info-prop--wide {
  grid-column: 1 / -1;
}

.a4-file-backstage__info-prop > span {
  color: var(--a4bs-text-mute);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.a4-file-backstage__info-prop > strong {
  color: var(--a4bs-text);
  font-size: 13.5px;
  font-weight: 600;
}

.a4-file-backstage__info-lead,
.a4-file-backstage__info-muted {
  color: var(--a4bs-text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.a4-file-backstage__fact {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--a4bs-r-pill);
  background: var(--a4bs-surface-sunken);
  color: var(--a4bs-text-soft);
  font-size: 12px;
  font-weight: 600;
}

.a4-file-backstage__compatibility-actions button {
  min-height: 40px;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
  color: var(--a4bs-text);
  font-weight: 560;
  box-shadow: var(--a4bs-shadow-btn);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.a4-file-backstage__compatibility-actions button:hover:not(:disabled) {
  border-color: #b9cbe6;
  background: var(--a4bs-hover);
}

.a4-file-backstage__compatibility-summary {
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
}

.a4-file-backstage__compatibility-summary[data-verdict="clean"] {
  border-color: #bbf7d0;
  background: var(--a4bs-success-bg);
}

.a4-file-backstage__compatibility-summary[data-verdict="clean"] > strong {
  color: var(--a4bs-success);
}

.a4-file-backstage__compatibility-summary[data-verdict="issues"] {
  border-color: #fed7aa;
  background: var(--a4bs-warn-bg);
}

.a4-file-backstage__compatibility-summary[data-verdict="issues"] > strong {
  color: var(--a4bs-warn);
}

.a4-file-backstage__compatibility-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.a4-file-backstage__issue {
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
}

.a4-file-backstage__history-toolbar label {
  display: grid;
  gap: 5px;
}

.a4-file-backstage__history-toolbar label > span {
  color: var(--a4bs-text-soft);
  font-size: 12.5px;
}

.a4-file-backstage__history-toolbar input,
.a4-file-backstage__history-toolbar button {
  border: 1px solid var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
}

.a4-file-backstage__history-item {
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-md);
  box-shadow: var(--a4bs-shadow-btn);
}

.a4-file-backstage__history-item .a4-file-backstage__item-actions button {
  min-height: 32px;
  padding: 5px 11px;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-sm);
  background: var(--a4bs-surface);
  color: var(--a4bs-text);
  font-size: 12.5px;
}

.a4-file-backstage__history-item .a4-file-backstage__item-actions button:hover:not(:disabled) {
  border-color: #b9cbe6;
  background: var(--a4bs-hover);
}

.a4-file-backstage__history-item .a4-file-backstage__history-delete {
  border-color: var(--a4bs-danger-border);
  color: var(--a4bs-danger);
}

.a4-file-backstage__history-item .a4-file-backstage__history-delete:hover:not(:disabled) {
  background: var(--a4bs-danger-bg);
}

/* --- "Вывод" tab --- */

.a4-file-backstage__action-row--formats {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
}

.a4-file-backstage__action-row--formats .a4-file-backstage__action {
  justify-content: center;
}

/* --- "Восстановление" tab --- */

.a4-file-backstage__autosave-settings {
  display: grid;
  gap: var(--a4bs-s-3);
  margin: 0;
  padding: var(--a4bs-s-4) var(--a4bs-s-5);
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-lg);
  background: var(--a4bs-surface);
  box-shadow: var(--a4bs-shadow-card);
}

.a4-file-backstage__autosave-settings legend {
  padding: 0;
  color: var(--a4bs-text);
  font-size: 14px;
  font-weight: 620;
}

.a4-file-backstage__autosave-settings label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--a4bs-text);
  font-size: 13.5px;
}

.a4-file-backstage__autosave-settings input[type="number"] {
  width: 92px;
  min-height: 34px;
  margin-left: auto;
  padding: 6px 9px;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-sm);
  font: inherit;
}

.a4-file-backstage__autosave-settings input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.a4-file-backstage__autosave-settings button {
  justify-self: start;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-accent);
  color: #fff;
  font: inherit;
  font-weight: 560;
}

.a4-file-backstage__autosave-settings button:hover {
  background: var(--a4bs-accent-hover);
}

.a4-file-backstage__autosave-settings p {
  color: var(--a4bs-text-soft);
  font-size: 12.5px;
}

/* Open tab — compact recent list + link to the full Recents tab. */

.a4-file-backstage__open-recent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.a4-file-backstage__open-recent-head .a4-file-backstage__subheading {
  margin: 0;
}

.a4-file-backstage__link-button {
  min-height: 0;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  color: var(--a4bs-accent);
  background: transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.a4-file-backstage__link-button:hover {
  background: var(--a4bs-hover);
}

/* Recovery drafts — own card layout (do NOT reuse the Recent-table row,
   whose .item-actions is absolutely positioned and overlaps text). */

.a4-file-backstage__recovery-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.a4-file-backstage__recovery-item {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--a4bs-border, #d8e0eb);
  border-radius: 10px;
  background: var(--a4bs-surface, #fff);
  text-align: left;
}

.a4-file-backstage__recovery-item > strong {
  color: var(--a4bs-text);
  font-size: 14px;
  font-weight: 600;
}

.a4-file-backstage__recovery-item > span {
  color: var(--a4bs-text-soft);
  font-size: 13px;
}

.a4-file-backstage__recovery-item > small {
  color: var(--a4bs-text-mute);
  font-size: 12px;
}

.a4-file-backstage__recovery-item .a4-file-backstage__item-actions {
  margin-top: 8px;
}

/* --- "Параметры" (автозамена) polish --- */

.a4-autocorrect-options__path {
  color: var(--a4bs-text-mute);
}

.a4-autocorrect-options__toggles,
.a4-autocorrect-options__panel {
  padding: var(--a4bs-s-4) var(--a4bs-s-5);
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-lg);
  background: var(--a4bs-surface);
  box-shadow: var(--a4bs-shadow-card);
}

.a4-autocorrect-options__toggles legend,
.a4-autocorrect-options__panel h3 {
  color: var(--a4bs-text);
  font-size: 14px;
  font-weight: 620;
}

.a4-autocorrect-options__toggles label,
.a4-autocorrect-options__check {
  color: var(--a4bs-text);
  font-size: 13.5px;
}

.a4-autocorrect-options__form-grid > label {
  color: var(--a4bs-text-soft);
  font-size: 12.5px;
}

.a4-autocorrect-options input[type="text"],
.a4-autocorrect-options select,
.a4-autocorrect-options__row input:not([type="checkbox"]) {
  border: 1px solid var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-md);
}

.a4-autocorrect-options__format-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}

.a4-autocorrect-options__check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.a4-autocorrect-options__check input,
.a4-autocorrect-options__toggles label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.a4-autocorrect-options button {
  border: 1px solid var(--a4bs-border-strong);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
}

.a4-autocorrect-options__format-row button {
  margin-left: auto;
}

.a4-autocorrect-options__exception {
  padding: 9px 12px;
  border: 1px solid var(--a4bs-border);
  border-radius: var(--a4bs-r-md);
  background: var(--a4bs-surface);
}

.a4-autocorrect-options__storage {
  color: var(--a4bs-text-mute);
  font-size: 12.5px;
}

/* ─────────────────────────────────────────────────────────────────────────
   «Главная»: галерея шаблонов и недавние — раскладка стартового окна Word.

   Прежде здесь была заглушка «Документ не открыт» и шесть серых кнопок,
   половина из которых без открытого документа недоступна: панель настроек
   вместо выбора работы. Теперь первым идёт то, ради чего окно открывают.
   ───────────────────────────────────────────────────────────────────────── */

.a4-file-backstage__visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.a4-file-backstage__section--home {
  display: flex;
  flex-direction: column;
  gap: var(--a4bs-s-8);
}

.a4-file-backstage__home-block {
  display: flex;
  flex-direction: column;
  gap: var(--a4bs-s-4);
}

.a4-file-backstage__home-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--a4bs-s-4);
}

.a4-file-backstage__home-heading h3 {
  font-size: 17px;
  font-weight: 640;
  color: var(--a4bs-text);
}

/* «Ещё шаблоны» — ссылка, а не кнопка: в Word это тихий переход в раздел. */
.a4-file-backstage__home-more {
  padding: 0;
  color: var(--a4bs-accent);
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.a4-file-backstage__home-more:hover {
  text-decoration: underline;
}

.a4-file-backstage__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: var(--a4bs-s-5);
}

/* Карточка шаблона: страница в пропорции A4 и подпись под ней. */
.a4-file-backstage__gallery-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--a4bs-s-2);
  padding: var(--a4bs-s-2);
  color: var(--a4bs-text);
  border: 0;
  border-radius: var(--a4bs-r-md);
  background: none;
  font: inherit;
  cursor: pointer;
}

.a4-file-backstage__gallery-card:hover {
  background: var(--a4bs-hover);
}

.a4-file-backstage__gallery-card:disabled {
  opacity: 0.5;
  cursor: default;
}

.a4-file-backstage__gallery-page {
  display: block;
  width: 100%;
  aspect-ratio: 210 / 297;
  overflow: hidden;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: 3px;
  background: var(--a4bs-surface);
  box-shadow: var(--a4bs-shadow-card);
}

/* Первая карточка — пустой документ; в Word она выделена акцентной рамкой. */
.a4-file-backstage__gallery-card[data-primary="true"] .a4-file-backstage__gallery-page {
  border-color: var(--a4bs-accent);
  box-shadow: 0 0 0 1px var(--a4bs-accent), var(--a4bs-shadow-card);
}

.a4-file-backstage__gallery-page-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
}

.a4-file-backstage__gallery-title {
  font-size: 13px;
  line-height: 1.25;
  text-align: center;
  color: var(--a4bs-text-soft);
}

.a4-file-backstage__gallery-card[data-primary="true"] .a4-file-backstage__gallery-title {
  color: var(--a4bs-accent);
  font-weight: 600;
}

/* Действия над открытым документом на «Главной» — вспомогательный ряд.
   В Word стартовое окно ими не занято вовсе; у нас они нужны, но не первыми:
   раньше шесть крупных плашек забирали весь экран, и половина из них без
   открытого документа всё равно недоступна. */
.a4-file-backstage__section--home .a4-file-backstage__actions {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--a4bs-s-2);
  padding-top: var(--a4bs-s-4);
  border-top: 1px solid var(--a4bs-border);
}

.a4-file-backstage__section--home .a4-file-backstage__actions button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
}

.a4-file-backstage__section--home .a4-file-backstage__action-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--a4bs-s-2);
}

/* Колонка даты — как «Last opened by you» в Word: правый край строки. */
.a4-file-backstage__recent-head {
  display: flex;
  align-items: center;
  gap: var(--a4bs-s-2);
}

.a4-file-backstage__recent-head-date {
  margin-left: auto;
}

.a4-file-backstage__recent-date {
  color: var(--a4bs-text-mute);
  font-size: 13px;
  white-space: nowrap;
}

/* Подписи действий не режем пополам: «Экспортировать копию / DOCX» в две
   строки читается как брак. Кнопка ужимается шрифтом, а не переносом. */
.a4-file-backstage__section--home .a4-file-backstage__actions button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────────────
   Колонка разделов во всю высоту — как в стартовом окне Word.

   Прежде она начиналась под шапкой: получалась не колонка, а прямоугольник
   в углу, и окно читалось как две несвязанные плоскости. В Word сайдбар
   идёт от самого верха до низа и держит всю раскладку.
   ───────────────────────────────────────────────────────────────────────── */

.a4-file-backstage__nav {
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  padding-top: 56px;
}

.a4-file-backstage__header {
  grid-column: 2 / -1;
}

/* Пункт активного раздела — сплошная плашка, как выделение в сайдбаре Word:
   она читается с расстояния, а бледная подсветка терялась. */
.a4-file-backstage__nav-item[aria-current="page"] {
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
  box-shadow: inset 2px 0 0 var(--a4bs-accent);
}

.a4-file-backstage__nav-icon {
  flex: 0 0 auto;
}

/* Сверка с эталоном вплотную (наш сайдбар против сайдбара Word) показала три
   расхождения; правим каждое.

   1. Шаг пунктов. В Word пункт выше и просторнее — список читается как
      колонка крупных целей, а не как плотное меню.
   2. Выделение. В Word активный раздел — сплошная плашка целиком; полоса
      слева, добавленная нами, в оригинале отсутствует и выглядит чужеродно.
   3. Иконка активного раздела заметно плотнее соседних. */

.a4-file-backstage__nav-item {
  min-height: 76px;
  margin-bottom: 2px;
  gap: 6px;
}

.a4-file-backstage__nav-item[aria-current="page"] {
  box-shadow: none;
}

.a4-file-backstage__nav-item[aria-current="page"] .a4-file-backstage__nav-icon {
  stroke-width: 2.1;
}

/* Word-like start workspace.

   The reference is the live Microsoft Word start window: a full-height
   navigation rail, compact template strip and a document list that owns the
   main working plane. These rules are intentionally scoped to the product
   backstage marker so editor and document-canvas surfaces keep their theme. */

html:has(#a4-file-backstage-product-host:not([hidden])),
html:has(#a4-file-backstage-product-host:not([hidden])) body {
  background: transparent;
}

body:has(#a4-file-backstage-product-host:not([hidden])) > #app-root {
  visibility: hidden;
}

body:has(#a4-file-backstage-product-host:not([hidden]))
  > #a4-file-backstage-product-backdrop {
  background: transparent;
}

.a4-file-backstage[data-a4-word-start-surface] {
  grid-template-rows: 54px minmax(0, 1fr);
  color: #1a2434;
  background: transparent;

  --a4bs-canvas: #f5f6f8;
  --a4bs-surface: #ffffff;
  --a4bs-surface-sunken: #eef3f8;
  --a4bs-system-material: rgb(238 243 248 / 68%);
  --a4bs-hover: #e7eef6;
  --a4bs-accent-tint: #dcecf9;
  --a4bs-border: #dbe2ea;
  --a4bs-border-strong: #c7d1dd;
  --a4bs-text: #1a2434;
  --a4bs-text-soft: #526174;
  --a4bs-text-mute: #7d8999;
  --a4bs-accent: #0f6cbd;
  --a4bs-accent-hover: #115ea3;
  --a4bs-accent-active: #0c4d86;
  --a4bs-success: #067647;
  --a4bs-success-bg: #ecfdf3;
  --a4bs-warn: #b54708;
  --a4bs-warn-bg: #fffaeb;
  --a4bs-danger: #b42318;
  --a4bs-danger-bg: #fef3f2;
  --a4bs-danger-border: #f0cfcb;
  --a4bs-shadow-card: 0 1px 2px rgb(15 23 42 / 8%);
  --a4bs-shadow-hover: 0 4px 14px rgb(15 23 42 / 12%);
  --a4bs-shadow-btn: 0 1px 1px rgb(15 23 42 / 6%);
}

@media (prefers-color-scheme: dark) {
  .a4-file-backstage[data-a4-word-start-surface] {
    --a4bs-system-material: rgb(238 243 248 / 96%);
  }
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__header {
  position: relative;
  min-height: 54px;
  justify-content: center;
  padding: 0 28px;
  background: transparent;
  border-bottom: 0;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__header::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  background: var(--a4bs-system-material);
  -webkit-backdrop-filter: saturate(1.2) blur(22px);
  backdrop-filter: saturate(1.2) blur(22px);
  pointer-events: none;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__header::after {
  content: "";
  position: fixed;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 108px;
  height: 52px;
  background: #f7f8fa;
  border-top: 1px solid var(--a4bs-border);
  pointer-events: none;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__header h1 {
  position: relative;
  z-index: 1;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  color: var(--a4bs-text);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__close {
  position: fixed;
  z-index: 3;
  right: 20px;
  bottom: 10px;
  min-width: 92px;
  min-height: 32px;
  padding: 5px 18px;
  color: var(--a4bs-text);
  border-color: var(--a4bs-border-strong);
  border-radius: 8px;
  background: #ffffff;
  font-weight: 600;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__close:hover {
  background: var(--a4bs-hover);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__nav {
  padding: 58px 8px 12px;
  border-right: 0;
  background: var(--a4bs-system-material);
  -webkit-backdrop-filter: saturate(1.2) blur(22px);
  backdrop-filter: saturate(1.2) blur(22px);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__nav-item {
  min-height: 74px;
  color: var(--a4bs-text-soft);
  border-radius: 9px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__nav-item:hover {
  background: rgb(255 255 255 / 42%);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__nav-item[aria-current="page"] {
  color: var(--a4bs-accent);
  background: rgb(212 233 249 / 76%);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__nav-icon {
  color: currentColor;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__nav-label {
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  white-space: nowrap;
}

.a4-file-backstage[data-a4-word-start-surface] #file-session-info {
  margin-top: auto;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__content {
  padding: 22px clamp(24px, 3vw, 44px) 76px;
  background: var(--a4bs-canvas);
}

@media (prefers-reduced-transparency: reduce) {
  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__header::before {
    --a4bs-system-material: #eef2f6;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__nav {
    background: #eef2f6;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.a4-file-backstage__section--home,
.a4-file-backstage__section--new {
  width: 100%;
  max-width: none;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--home,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--new {
  gap: 20px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-heading {
  display: flex;
  min-height: 32px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--a4bs-border);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-heading h2,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-heading h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--a4bs-text);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.25;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-heading-chevron {
  flex: 0 0 auto;
  color: var(--a4bs-text-mute);
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--new
  .a4-file-backstage__new-gallery {
  grid-template-columns: repeat(auto-fill, 144px);
  grid-auto-flow: row;
  grid-auto-columns: auto;
  overflow-x: visible;
  margin-top: -10px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-status {
  margin: -8px 0 0;
  color: var(--a4bs-text-soft);
  font-size: 12.5px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-personal {
  display: grid;
  gap: 20px;
  margin-top: 4px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-heading--personal {
  min-height: 30px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-template-shell {
  position: relative;
  width: 144px;
  min-width: 0;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-template-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: 6px;
  opacity: 0;
  color: var(--a4bs-text-mute);
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 1px 3px rgb(15 23 42 / 14%);
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-template-shell:hover .a4-file-backstage__new-template-delete,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-template-shell:focus-within .a4-file-backstage__new-template-delete {
  opacity: 1;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__new-template-delete:hover {
  color: var(--a4bs-danger);
  background: var(--a4bs-danger-bg);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__home-block {
  gap: 10px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__home-heading {
  min-height: 26px;
  align-items: center;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__home-heading h2,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__home-heading h3 {
  color: var(--a4bs-text);
  font-size: 16px;
  font-weight: 650;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__home-more {
  color: var(--a4bs-accent);
  font-size: 13px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__gallery {
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: 144px;
  justify-content: start;
  gap: 18px;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px 2px 8px;
  overscroll-behavior-inline: contain;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__gallery-card {
  width: 144px;
  min-width: 0;
  gap: 8px;
  padding: 4px;
  border-radius: 7px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__gallery-page {
  width: 132px;
  border-color: #d6d6d6;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__gallery-card[data-primary="true"]
  .a4-file-backstage__gallery-page {
  border-color: #2d89ef;
  box-shadow: 0 0 0 2px #2d89ef;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__gallery-page-inner {
  color: #28313e;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__gallery-page-inner .a4-file-backstage__template-heading {
  color: #222b38;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__gallery-page-inner .a4-file-backstage__template-text {
  color: #566170;
}

/* Professional template preview system: the sheet remains white like Word,
   while palette and composition communicate the document's purpose. */
.a4-file-backstage__gallery-page[data-template-theme] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-color: var(--a4-template-border, #d6d6d6);
  background: #ffffff;

  --a4-template-accent: #667085;
  --a4-template-soft: #f2f4f7;
  --a4-template-ink: #253044;
  --a4-template-border: #d4d9e1;
}

.a4-file-backstage__gallery-page[data-template-theme] .a4-file-backstage__gallery-page-inner {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  transition: padding 0.15s ease;
}

.a4-file-backstage__gallery-page[data-template-theme]
  .a4-file-backstage__gallery-page-inner
  .a4-file-backstage__template-heading {
  box-sizing: border-box;
  width: 100%;
  color: var(--a4-template-ink);
  letter-spacing: 0.01em;
}

.a4-file-backstage__gallery-page[data-template-theme]
  .a4-file-backstage__gallery-page-inner
  .a4-file-backstage__template-text {
  color: color-mix(in srgb, var(--a4-template-ink) 72%, #64748b);
}

.a4-file-backstage__gallery-page[data-template-layout="band"]
  .a4-file-backstage__gallery-page-inner
  .a4-file-backstage__template-heading {
  margin: -2px -2px 4px;
  padding: 6px;
  border-radius: 2px;
  background: var(--a4-template-accent);
  color: #ffffff;
}

.a4-file-backstage__gallery-page[data-template-layout="panel"] .a4-file-backstage__template-heading {
  margin-bottom: 4px;
  padding: 6px;
  border-radius: 2px;
  background: var(--a4-template-soft);
}

.a4-file-backstage__gallery-page[data-template-layout="sidebar"] .a4-file-backstage__template-heading {
  margin-bottom: 4px;
  padding: 5px;
  border: 1px solid var(--a4-template-accent);
  border-radius: 2px;
}

.a4-file-backstage__gallery-page[data-template-layout="corner"] .a4-file-backstage__template-heading {
  margin-bottom: 4px;
  padding: 6px;
  border-radius: 2px;
  background: var(--a4-template-soft);
  text-align: right;
}

.a4-file-backstage__gallery-page[data-template-layout="frame"] .a4-file-backstage__template-heading {
  margin-bottom: 4px;
  padding: 5px;
  border: 1px solid var(--a4-template-accent);
  border-radius: 2px;
  text-align: center;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__gallery-title {
  width: 100%;
  min-height: 32px;
  color: var(--a4bs-text-soft);
  line-height: 1.25;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__gallery-card[data-primary="true"]
  .a4-file-backstage__gallery-title {
  width: fit-content;
  min-height: 0;
  padding: 2px 5px;
  border-radius: 4px;
  color: #ffffff;
  background: #256dd7;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-tabs {
  margin: 0;
  padding-top: 4px;
  border-top: 1px solid var(--a4bs-border);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-tab[aria-selected="true"] {
  color: #ffffff;
  background: var(--a4bs-accent);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-table {
  border-color: var(--a4bs-border);
  border-radius: 0;
  background: var(--a4bs-surface);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-head {
  background: #f1f4f8;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-item:nth-of-type(even) {
  background: #f8fafc;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-item:hover {
  background: var(--a4bs-hover);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-open {
  padding-block: 9px;
  color: var(--a4bs-text);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-icon {
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__empty-doc {
  border-color: var(--a4bs-border-strong);
  background: var(--a4bs-surface);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--new .a4-file-backstage__empty-doc {
  grid-template-columns: auto minmax(0, 1fr);
  justify-items: start;
  align-items: center;
  padding: 16px 18px;
  text-align: left;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--new .a4-file-backstage__empty-icon {
  grid-row: 1 / 3;
  width: 44px;
  height: 44px;
  margin: 0;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--home > .a4-file-backstage__document,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--home > .a4-file-backstage__actions,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--home > .a4-file-backstage__template-save {
  display: none;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__document,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__feedback,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__async,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__close-prompt,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__actions button,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__close-actions button,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__item-actions button {
  color: var(--a4bs-text);
  border-color: var(--a4bs-border-strong);
  background: var(--a4bs-surface);
}

/* Word-like task workspaces: every navigation destination owns a distinct
   composition while sharing the same restrained light material system. */

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section-hero {
  display: grid;
  max-width: 760px;
  gap: 7px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section-hero h2,
.a4-file-backstage[data-a4-word-start-surface] .a4-autocorrect-options__heading h2 {
  color: var(--a4bs-text);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 680;
  letter-spacing: -0.02em;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--recent,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--open,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--info,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--output,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--options {
  width: min(100%, 1240px);
  max-width: 1240px;
  gap: 24px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--recent {
  gap: 12px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-heading {
  display: flex;
  min-height: 34px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--a4bs-border);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-heading h2 {
  margin: 0;
  color: var(--a4bs-text);
  font-size: 17px;
  font-weight: 660;
  letter-spacing: -0.01em;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-workspace {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-toolbar {
  min-height: 35px;
  border-bottom: 1px solid var(--a4bs-border);
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-tabs {
  gap: 2px;
  padding-top: 0;
  border-top: 0;
  border-bottom: 0;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-tab {
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 6px 6px 0 0;
  color: var(--a4bs-text-soft);
  font-size: 13px;
  font-weight: 620;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-tab[aria-selected="true"] {
  color: var(--a4bs-text);
  background: #e2e7ed;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-table {
  border-radius: 0;
  box-shadow: none;
}

.a4-file-backstage__section--recent .a4-file-backstage__recent-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) minmax(120px, 160px) 76px;
  gap: 0;
  min-height: 34px;
  padding: 7px 12px;
  color: var(--a4bs-text-soft);
  background: #f1f3f5;
  font-size: 12px;
  font-weight: 620;
}

.a4-file-backstage__section--recent .a4-file-backstage__recent-head-date {
  margin-left: 0;
}

.a4-file-backstage__section--recent .a4-file-backstage__recent-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  align-items: stretch;
}

.a4-file-backstage__section--recent .a4-file-backstage__recent-open {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) minmax(120px, 160px);
  gap: 0;
  min-width: 0;
  padding: 8px 12px;
}

.a4-file-backstage__section--recent .a4-file-backstage__recent-icon {
  width: 30px;
  height: 34px;
  border: 1px solid #cdd8e6;
  border-radius: 3px;
  color: #185abd;
  background: #ffffff;
}

.a4-file-backstage__section--recent .a4-file-backstage__recent-main {
  align-content: center;
  padding-right: 16px;
}

.a4-file-backstage__section--recent .a4-file-backstage__recent-main strong {
  font-size: 13.5px;
  font-weight: 610;
}

.a4-file-backstage__section--recent .a4-file-backstage__recent-date {
  align-self: center;
  color: var(--a4bs-text-soft);
  font-size: 12.5px;
  white-space: nowrap;
}

.a4-file-backstage__section--recent .a4-file-backstage__recent-missing {
  width: fit-content;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 3px;
}

.a4-file-backstage__section--recent .a4-file-backstage__item-actions {
  position: static;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding-right: 10px;
  transform: none;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-icon-btn {
  width: 28px;
  height: 28px;
  min-height: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
}

.a4-file-backstage__section--recent .a4-file-backstage__recent-item[data-availability="missing"] {
  border-color: var(--a4bs-border);
  background: #fffaf1;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 112px;
  padding: 18px 20px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-empty h3,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-empty p {
  margin: 0;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-empty p {
  margin-top: 4px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__recent-empty button {
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--a4bs-accent);
  border-radius: 7px;
  color: #ffffff;
  background: var(--a4bs-accent);
  font-weight: 620;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-empty {
  min-height: 88px;
  padding: 14px 16px;
  border-radius: 0;
  box-shadow: none;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-empty-icon {
  width: 40px;
  height: 40px;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-empty button {
  min-height: 32px;
  padding: 5px 11px;
  border-color: var(--a4bs-border-strong);
  color: var(--a4bs-accent);
  background: var(--a4bs-surface);
  font-size: 12.5px;
}

@media (max-width: 760px) {
  .a4-file-backstage__section--recent .a4-file-backstage__recent-head {
    grid-template-columns: 40px minmax(0, 1fr) 68px;
  }

  .a4-file-backstage__section--recent .a4-file-backstage__recent-head-date {
    display: none;
  }

  .a4-file-backstage__section--recent .a4-file-backstage__recent-item {
    grid-template-columns: minmax(0, 1fr) 68px;
  }

  .a4-file-backstage__section--recent .a4-file-backstage__recent-open {
    grid-template-columns: 40px minmax(0, 1fr);
    row-gap: 2px;
  }

  .a4-file-backstage__section--recent .a4-file-backstage__recent-date {
    grid-column: 2;
    font-size: 11.5px;
  }
}

/* Home is a scan-first start surface, so its empty recent state uses the same
   compact density as Word's file rows instead of reading as a hero card. */
.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--home
  .a4-file-backstage__recent-workspace {
  gap: 8px;
}

/* Переключатель «Недавние / Избранное» на «Главной» больше не переопределяем.
   Собственные зазор и скругление превращали его в две отдельные кнопки, тогда
   как во вкладке «Недавние» тот же выбор — единая пилюля из двух половин.
   Один и тот же переключатель в двух местах продукта выглядел по-разному, и
   связь между половинами на «Главной» терялась. Отступ сверху оставляем: он
   отделяет переключатель от галереи шаблонов, а на вид самой пилюли не влияет. */
.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--home
  .a4-file-backstage__recent-tabs {
  padding-top: 8px;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--home
  .a4-file-backstage__recent-empty {
  min-height: 72px;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 7px;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--home
  .a4-file-backstage__recent-empty-icon {
  width: 36px;
  height: 36px;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--home
  .a4-file-backstage__recent-empty-icon svg {
  width: 20px;
  height: 20px;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--home
  .a4-file-backstage__recent-empty h3 {
  font-size: 14px;
  line-height: 1.3;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--home
  .a4-file-backstage__recent-empty p {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.35;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--home
  .a4-file-backstage__recent-empty button {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12.5px;
  border-color: var(--a4bs-border-strong);
  color: var(--a4bs-accent);
  background: var(--a4bs-surface);
  font-weight: 600;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__section--home
  .a4-file-backstage__recent-empty button:hover:not(:disabled) {
  border-color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-icon,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-icon .a4-file-backstage__action-icon,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command-icon .a4-file-backstage__action-icon {
  width: 24px;
  height: 24px;
  color: currentColor;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-card > .a4-file-backstage__action {
  justify-content: center;
  min-height: 38px;
  padding: 8px 18px;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: 7px;
  color: var(--a4bs-text);
  background: var(--a4bs-surface);
  font-weight: 620;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-card > .a4-file-backstage__action--primary {
  border-color: var(--a4bs-accent);
  color: #ffffff;
  background: var(--a4bs-accent);
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__content:has(.a4-file-backstage__section--open) {
  grid-row: 2;
  grid-column: 2 / -1;
  overflow: hidden;
  padding: 0 0 52px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__section--open {
  width: 100%;
  max-width: none;
  height: 100%;
  gap: 0;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-browser {
  display: grid;
  grid-template-columns: 260px 300px minmax(0, 1fr);
  min-height: calc(100dvh - 106px);
  color: var(--a4bs-text);
  background: var(--a4bs-surface);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-locations {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 12px;
  border-right: 1px solid var(--a4bs-border);
  background: #eef2f6;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-location-list {
  display: grid;
  gap: 4px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-location {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--a4bs-text);
  background: transparent;
  font-size: 14px;
  font-weight: 620;
  text-align: left;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-location:hover:not(:disabled) {
  background: var(--a4bs-hover);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-location[aria-current="page"] {
  border-color: #c6daef;
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-location-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: currentColor;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-location-heading {
  margin: 17px 12px 4px;
  color: var(--a4bs-text-mute);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-browse {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: 7px;
  color: var(--a4bs-text);
  background: var(--a4bs-surface);
  font-weight: 620;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-browse:hover:not(:disabled) {
  border-color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-browse .a4-file-backstage__action-icon {
  color: var(--a4bs-accent);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-folders-pane,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-files-pane {
  display: grid;
  min-width: 0;
  grid-template-rows: auto minmax(0, 1fr);
  background: #f8f9fb;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-folders-pane {
  border-right: 1px solid var(--a4bs-border);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-files-pane {
  background: var(--a4bs-surface);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-pane-heading {
  min-height: 58px;
  padding: 19px 20px 14px;
  border-bottom: 1px solid var(--a4bs-border);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-pane-heading h3 {
  margin: 0;
  color: var(--a4bs-text);
  font-size: 14px;
  font-weight: 650;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-recent-list {
  display: grid;
  align-content: start;
  gap: 1px;
  overflow-y: auto;
  padding: 8px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-recent-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  color: var(--a4bs-text);
  background: transparent;
  text-align: left;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-recent-row:hover {
  background: var(--a4bs-hover);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-recent-row strong,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-recent-row .a4-file-backstage__crumbs {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-recent-row strong {
  font-size: 13px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-recent-row .a4-file-backstage__crumbs {
  margin-top: 3px;
  color: var(--a4bs-text-mute);
  font-size: 11px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-recent-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 42px;
  border-radius: 4px;
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-pane-empty,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-file-empty {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 28px;
  color: var(--a4bs-text-mute);
  text-align: center;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-file-empty {
  gap: 7px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-file-empty > span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 5px;
  border-radius: 50%;
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-file-empty strong {
  color: var(--a4bs-text-soft);
  font-size: 14px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-file-empty p,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-pane-empty p {
  max-width: 38ch;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-overview {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  align-items: start;
  gap: 28px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command-stack {
  display: grid;
  gap: 9px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command-stack > h3 {
  margin-bottom: 3px;
  color: var(--a4bs-text);
  font-size: 15px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--a4bs-text);
  background: transparent;
  text-align: left;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command:hover:not(:disabled) {
  border-color: var(--a4bs-border);
  background: var(--a4bs-surface);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command-icon {
  width: 42px;
  height: 42px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command strong,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command small {
  display: block;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command strong {
  font-size: 13.5px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-command small {
  margin-top: 3px;
  color: var(--a4bs-text-soft);
  font-size: 11.5px;
  line-height: 1.4;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-document-card {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--a4bs-border);
  border-radius: 10px;
  background: var(--a4bs-surface);
  box-shadow: var(--a4bs-shadow-card);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-document-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--a4bs-border);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-document-heading > span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 56px;
  border-radius: 5px;
  color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-document-heading span,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-document-heading h3 {
  margin: 0;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-document-heading div > span {
  color: var(--a4bs-text-mute);
  font-size: 11px;
  text-transform: uppercase;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-document-heading h3 {
  margin-top: 3px;
  color: var(--a4bs-text);
  font-size: 18px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 18px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  gap: 16px;
  min-height: 230px;
  padding: 22px;
  border: 1px solid var(--a4bs-border);
  border-radius: 10px;
  background: var(--a4bs-surface);
  box-shadow: var(--a4bs-shadow-card);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-card h3,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-card p {
  margin: 0;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-card h3 {
  color: var(--a4bs-text);
  font-size: 18px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-card p {
  margin-top: 5px;
  color: var(--a4bs-text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-card > .a4-file-backstage__action,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-formats {
  grid-column: 1 / -1;
  align-self: end;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-card--wide {
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.a4-file-backstage[data-a4-word-start-surface]
  .a4-file-backstage__output-card--wide
  > .a4-file-backstage__action {
  grid-column: auto;
  align-self: center;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-formats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-format-button {
  display: grid;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid var(--a4bs-border-strong);
  border-radius: 7px;
  color: var(--a4bs-text);
  background: var(--a4bs-surface);
  text-align: left;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-format-button:hover:not(:disabled) {
  border-color: var(--a4bs-accent);
  background: var(--a4bs-accent-tint);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-format-button span {
  color: var(--a4bs-text-soft);
  font-size: 11px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-intro {
  max-width: 720px;
  margin: -12px 0 0;
  color: var(--a4bs-text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-card {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--a4bs-border);
  border-radius: 10px;
  background: var(--a4bs-surface);
  box-shadow: var(--a4bs-shadow-card);
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-card--wide {
  grid-column: 1 / -1;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-card > .a4-autocorrect-options__group-title,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-card > .a4-autocorrect-options__path {
  margin: 0;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-card > .a4-autocorrect-options__group-title {
  color: var(--a4bs-text);
  font-size: 17px;
}

.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-card .a4-autocorrect-options__toggles,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-card .a4-autocorrect-options__panel,
.a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-card .a4-file-backstage__autosave-settings {
  border-radius: 8px;
  box-shadow: none;
}

@media (max-width: 980px) {
  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__info-overview,
  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-grid,
  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__output-card--wide,
  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__options-card--wide {
    grid-column: auto;
  }

  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__open-browser {
    grid-template-columns: 220px minmax(240px, 0.75fr) minmax(300px, 1fr);
  }
}

@media (max-width: 720px), (max-height: 560px) {
  .a4-file-backstage[data-a4-word-start-surface] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 48px auto minmax(0, 1fr);
  }

  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__header {
    grid-column: 1;
  }

  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__header::after {
    left: 0;
  }

  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__nav {
    grid-row: 2;
    grid-column: 1;
    flex-direction: row;
    padding: 7px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--a4bs-border);
  }

  .a4-file-backstage[data-a4-word-start-surface] .a4-file-backstage__nav-item {
    min-height: 54px;
  }

  .a4-file-backstage[data-a4-word-start-surface] #file-session-info {
    margin-top: 0;
  }

  .a4-file-backstage[data-a4-word-start-surface]
    .a4-file-backstage__content:has(.a4-file-backstage__section--open) {
    grid-row: 3;
    grid-column: 1;
  }
}

/* Figma backstage parity guard.
   Keep this last: the legacy Word-like surface remains available for secondary
   sections, while the four approved Figma frames own the primary start flow. */
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface] .a4-file-backstage__nav-label {
  max-width: 72px;
  white-space: nowrap;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  [data-a4-backstage-icon="home"] {
  -webkit-mask-size: 15px 17px;
  mask-size: 15px 17px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  [data-a4-backstage-icon="new"] {
  -webkit-mask-size: 13px 13px;
  mask-size: 13px 13px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  [data-a4-backstage-icon="recent"] {
  -webkit-mask-size: 19px 19px;
  mask-size: 19px 19px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  max-width: none;
  min-height: 100%;
  gap: 0;
  align-content: stretch;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-heading {
  display: none;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-workspace {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  gap: 2px;
  padding: 0;
  align-content: stretch;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-toolbar {
  min-height: 58px;
  padding: 14px 0;
  border: 0;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-tabs {
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-tab {
  min-width: 104px;
  height: 30px;
  min-height: 30px;
  padding: 4px 14px;
  border: 0;
  border-radius: 0 8px 8px 0;
  color: #2e2e2e;
  background: rgb(134 142 150 / 10%);
  font-size: 14px;
  font-weight: 500;
  line-height: 14px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-tab:first-child {
  border-radius: 8px 0 0 8px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-tab[aria-selected="true"] {
  color: #ffffff;
  background: #4c6ef5;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-empty {
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 0;
  border: 0;
  background: #ffffff;
  text-align: center;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-empty {
  height: 100%;
  min-height: 0;
  padding: 32px 0;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-empty > div {
  display: block;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-empty-icon {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  margin: 0;
  border-radius: 0;
  background: transparent;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-empty-icon img:first-child {
  position: absolute;
  top: 6px;
  left: 3.333px;
  width: 57.333px;
  height: 52px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-empty-icon img:last-child {
  position: absolute;
  top: 32.667px;
  left: 35.333px;
  width: 25.333px;
  height: 25.333px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-empty h3 {
  margin: 0;
  color: #868e96;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

/* Exact 1400×874 geometry from Figma nodes 22913:181391, 22922:262710,
   22922:263753 and 22922:264355. Keep this after all legacy cascades. */

/* Лицо карточки — правдивая мини-страница шаблона (previewText + тема из
   presentation-модуля), а не статический PNG: картинка, не порождённая
   шаблоном, уже приводила к превью, не совпадающему с создаваемым документом
   (разбор интеграции PR #437, пункт 3). Кегль ужат под фигма-карточку
   112×141: заголовок и строки читаются как миниатюра страницы. */
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__gallery-page-inner {
  gap: 2px;
  overflow: hidden;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__gallery-page-inner
  .a4-file-backstage__template-heading {
  margin-bottom: 1px;
  font-size: 7px;
  line-height: 1.25;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__gallery-page-inner
  .a4-file-backstage__template-text {
  font-size: 5.5px;
  line-height: 1.35;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__gallery-page-inner
  .a4-file-backstage__template-gap {
  height: 3px;
}

/* Вторичный кластер сайдбара: Открыть, Сведения, Вывод, Параметры. Разделов
   нет в четырёх Figma-фреймах, но их функции существовали до переноса, и
   убрать их значило отнять у пользователя возможности без решения (разбор
   интеграции PR #437, пункт 1). Кластер прижат к низу и отделён чертой; в
   overlay-чекере эта зона — явный decision-region. */
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__nav-secondary {
  display: flex;
  flex-direction: column;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #e9ecef;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__home-block {
  gap: 14px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__home-heading-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__home-heading-title img {
  width: 10px;
  height: 10px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__home-block + .a4-file-backstage__home-block {
  gap: 2px;
  padding-top: 16px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__template-shelf {
  gap: 15px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__template-shelf + .a4-file-backstage__template-shelf {
  margin-top: 12px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__content:has(.a4-file-backstage__section--recent) {
  padding-top: 16px;
  padding-bottom: 20px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-table {
  display: grid;
  gap: 2px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-toolbar,
.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-tab {
  box-sizing: border-box;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__home-block
  .a4-file-backstage__recent-toolbar {
  height: 58px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__recent-list {
  display: grid;
  gap: 2px;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-table {
  align-self: start;
  height: auto;
}

.a4-file-backstage[data-a4-word-start-surface][data-a4-figma-start-surface]
  .a4-file-backstage__section--recent
  .a4-file-backstage__recent-empty {
  align-self: stretch;
  height: 100%;
}


/* Звезда и «удалить» — кнопки, и курсор обязан это показывать. Без указателя
   человек не понимает, что по ним можно щёлкнуть: строка ведёт себя как
   кнопка открытия, а мелкие значки справа выглядят декорацией. */
.a4-file-backstage__recent-icon-btn,
.a4-file-backstage__recent-star,
.a4-file-backstage__recent-remove {
  cursor: pointer;
}

.a4-file-backstage__recent-icon-btn:disabled {
  cursor: default;
}
