/* Dosh Word — веб / мобильная вёрстка */

@font-face {
  font-family: "ABAT";
  src: url("../fonts/ABAT.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  padding-bottom: env(safe-area-inset-bottom, 0);
  overflow-x: hidden;
  max-width: 100%;
}

.app-header {
  flex-wrap: wrap;
  padding: 6px 10px;
  gap: 8px;
}

.app-header-left {
  flex: 1 1 auto;
  min-width: 0;
}

.header-info {
  flex: 1 1 100%;
  justify-content: flex-start;
  font-size: 11px;
  overflow: hidden;
}

.btn-menu-toggle {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

.install-panel {
  margin-bottom: 16px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}

.install-panel-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.install-card {
  position: relative;
  padding: 12px 12px 12px 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
}

.install-card.hidden {
  display: none;
}

.install-card-pwa {
  border-color: #a7f3d0;
  background: linear-gradient(160deg, #ecfdf5 0%, #fff 60%);
}

.install-card-win {
  border-color: #bfdbfe;
  background: linear-gradient(160deg, #eff6ff 0%, #fff 60%);
}

.install-card-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.install-card-badge-pwa {
  background: #047857;
  color: #fff;
}

.install-card-badge-win {
  background: #2563eb;
  color: #fff;
}

.install-card-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.install-card-text {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #4b5563;
}

.install-card-note {
  margin: 8px 0 0;
  font-size: 11px;
  color: #9ca3af;
}

.install-card-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: #047857;
}

.install-card-meta {
  margin: 8px 0 0;
  font-size: 11px;
  color: #64748b;
}

.install-card-dot {
  margin: 0 4px;
}

.install-card-btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  text-align: center;
}

.install-card-btn.hidden {
  display: none;
}

.install-card-btn-pwa {
  background: #059669;
  color: #fff;
}

.install-card-btn-pwa:hover {
  background: #047857;
}

.install-card-btn-win {
  background: #2563eb;
  color: #fff;
}

.install-card-btn-win:hover {
  background: #1d4ed8;
}

.menubar {
  display: none;
  flex-wrap: wrap;
  width: 100%;
  gap: 4px;
  padding-top: 6px;
}

.menubar.menubar-open {
  display: flex;
}

.menubar .menu-root {
  flex: 1 1 auto;
}

.menubar .menu-dropdown {
  position: static;
  box-shadow: none;
  border: 1px solid #e5e7eb;
  margin-top: 4px;
}

.menubar .menu-dropdown:not(.hidden) {
  display: grid;
}

.workspace {
  flex-direction: column;
  display: flex;
  max-width: 100%;
  min-width: 0;
}

.page {
  min-width: 0;
  max-width: 100%;
}

.doc-surface {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.doc-zoom-viewport {
  width: 100%;
  overflow: visible;
}

.doc-surface.a4-mode .pages-root,
.doc-surface.free-mode .pages-root {
  width: 210mm;
  min-width: 210mm;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  flex-shrink: 0;
}

.page-sheet {
  width: 100%;
  flex-shrink: 0;
}

.page-body,
.editor,
.editor-free {
  max-width: none;
  overflow-wrap: break-word;
  word-break: normal;
}

body.vk-mobile-input {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
  max-width: 100%;
}

.doc-zoom-stage {
  margin: 0 auto;
  width: fit-content;
  max-width: none;
  flex-shrink: 0;
}

.doc-zoom-group {
  display: none;
}

.doc-zoom-label {
  min-width: 40px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  align-self: center;
}

.doc-zoom-group button {
  min-width: 36px;
  min-height: 36px;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
}

body.vk-mobile-input {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.status {
  width: 100%;
  margin-top: 12px;
}

.formatbar {
  gap: 6px;
  padding: 6px 8px;
}

.format-group {
  padding: 4px 6px;
}

.format-group button,
.format-group select {
  min-height: 36px;
  touch-action: manipulation;
}

.format-group-tools .doc-zoom-label {
  align-self: center;
}

#btn-install-abat {
  min-width: 36px;
}

.vk-key-btn {
  min-height: 44px;
  touch-action: manipulation;
}

.vk-panel.vk-floating .vk-key-btn {
  min-height: 0;
}

@media (min-width: 900px) {
  .btn-menu-toggle {
    display: none;
  }

  .menubar {
    display: flex;
    flex-wrap: nowrap;
    width: auto;
    padding-top: 0;
  }

  .menubar .menu-dropdown {
    position: absolute;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr 300px;
    flex-direction: unset;
  }

  .status {
    width: auto;
    max-width: 240px;
    margin-top: 0;
  }

  .header-info {
    flex: 1;
    justify-content: flex-end;
    font-size: 12px;
  }

  .doc-surface.a4-mode .pages-root,
  .doc-surface.free-mode .pages-root {
    width: 210mm;
    max-width: 210mm;
  }
}

@media (max-width: 899px) {
  .header-doc {
    max-width: 70vw;
  }

  .doc-zoom-group {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .workspace {
    padding: 8px;
    gap: 8px;
  }

  .page {
    padding: 8px;
  }

  .doc-surface {
    padding: 6px 4px;
    min-height: 28vh;
    max-height: min(58vh, calc(100vh - 220px));
    overflow: auto;
  }

  .page-sheet {
    width: 100%;
    height: 297mm;
    max-height: 297mm;
    min-height: 0;
    margin-bottom: 8px;
  }

  .page-body {
    margin: 25mm 20mm 12mm;
    height: calc(297mm - 37mm);
    max-height: calc(297mm - 37mm);
    min-height: 48px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .page-sheet-label {
    font-size: 10px;
    right: 6mm;
    bottom: 4mm;
  }

  .vk-panel:not(.vk-floating) .vk-rows {
    gap: 4px;
  }

  .vk-panel:not(.vk-floating) .vk-row {
    display: grid;
    gap: 3px;
    overflow: visible;
  }

  .vk-panel:not(.vk-floating) .vk-key-btn {
    min-width: 0;
    max-width: none;
    width: 100%;
    min-height: 34px;
    max-height: 38px;
    padding: 2px 1px;
  }

  .vk-panel:not(.vk-floating) .vk-key-btn .vk-key-label {
    font-size: 8px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .vk-panel:not(.vk-floating) .vk-key-btn .vk-key-glyph {
    font-size: 14px;
    line-height: 1.1;
  }

  .vk-panel {
    padding: 6px 6px 8px;
    overflow: hidden;
  }

  .vk-controls {
    flex-wrap: nowrap;
    gap: 4px;
    flex-shrink: 0;
  }

  .vk-util {
    padding: 6px 8px;
    min-height: 34px;
    font-size: 13px;
  }

  .vk-util.wide {
    min-width: 0;
    flex: 1 1 auto;
  }

  body.vk-mobile-input .vk-panel:not(.hidden) {
    max-height: min(36vh, 280px);
  }

  body.vk-mobile-input .doc-surface {
    margin-bottom: 0;
  }
}

@media (max-width: 899px) and (orientation: portrait) {
  .status {
    display: none;
  }

  .doc-surface {
    max-height: min(62vh, calc(100vh - 180px));
  }

  body.vk-mobile-input .vk-panel:not(.hidden) {
    max-height: min(45vh, 360px);
  }
}

@media (max-width: 899px) and (orientation: landscape) {
  .doc-surface {
    max-height: min(65vh, calc(100vh - 120px));
  }
}
