/* Общая адаптация поверх рабочего и редакционного оформления. */
.mobile-nav-toggle, .mobile-cell-label, .mobile-registry-sort,
.table-scroll-note { display: none; }
.mobile-cell-value { display: contents; }
.registry-filters-disclosure > summary { display: none; }

@media (max-width: 1023px) {
  html[data-style] body { font-size: 16px; }
  html[data-style] .app-layout { display: block; }
  html[data-style] .content { min-width: 0; padding: 16px max(12px, env(safe-area-inset-right)) 24px max(12px, env(safe-area-inset-left)); }
  html[data-style] .content h1 { font-size: clamp(23px, 4vw, 30px); line-height: 1.25; overflow-wrap: anywhere; }
  html[data-style] .content h2 { overflow-wrap: anywhere; }
  html[data-style] .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  html[data-style] .topbar-title { grid-column: 1; grid-row: 1; font-size: 15px; overflow-wrap: anywhere; }
  html[data-style] .mobile-nav-toggle { grid-column: 2; grid-row: 1; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 10px; border: 1px solid currentColor; background: transparent; color: var(--topbar-text, #eee); }
  .js .mobile-nav-toggle { display: inline-flex; }
  html[data-style] .topbar-search { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; min-width: 0; margin: 0; gap: 6px; }
  html[data-style] .topbar-search input { flex: 1; width: 0; min-width: 0; }
  html[data-style] .topbar-user { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; justify-self: stretch; justify-content: space-between; gap: 8px; min-width: 0; font-size: 14px; white-space: normal; }
  html[data-style] .topbar-user > span { min-width: 0; overflow-wrap: anywhere; }
  html[data-style] .topbar-user .inline-form { flex-shrink: 0; margin: 0; }
  html[data-style] .topbar-user .inline-form > button { min-height: 44px; padding: 8px 4px; }
  html[data-style] .appearance-menu > summary { min-height: 44px; padding: 8px 4px; }
  html[data-style] .appearance-popover { right: auto; left: 0; width: min(280px, calc(100vw - 32px)); z-index: 30; }
  html[data-style] .appearance-options button { min-height: 44px; padding: 8px; font-size: 14px; }
  html[data-style] .sidebar { border-bottom: 1px solid var(--line); }
  .js .sidebar { display: none; }
  .js .sidebar.is-open { display: block; max-height: 60vh; max-height: 60dvh; overflow-y: auto; overscroll-behavior: contain; }
  html[data-style] .nav-tree { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding: 8px; }
  html[data-style] .nav-link, html[data-style] .nav-more > summary { display: flex; align-items: center; min-height: 44px; padding: 9px 12px; font-size: 15px; overflow-wrap: anywhere; }
  html[data-style] .nav-more { grid-column: 1 / -1; margin-top: 4px; }
  html[data-style] .nav-more a { padding-left: 20px; }

  html[data-style] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  html[data-style] select, html[data-style] textarea { min-height: 44px; max-width: 100%; font-size: 16px; }
  html[data-style] button, html[data-style] .button { min-height: 44px; font-size: 15px; }
  html[data-style] .button { display: inline-flex; align-items: center; justify-content: center; }
  html[data-style] button, html[data-style] a, html[data-style] summary { touch-action: manipulation; -webkit-tap-highlight-color: rgb(128 128 128 / 18%); }
  html[data-style] input[type="checkbox"], html[data-style] input[type="radio"] { width: 22px; height: 22px; vertical-align: middle; }
  html[data-style] summary { min-height: 44px; padding: 10px 8px; cursor: pointer; }
  html[data-style] .grid-2, html[data-style] .grid-3, html[data-style] .detail-grid,
  html[data-style] .analytics-grid, html[data-style] .topology-map-workspace { grid-template-columns: minmax(0, 1fr); }
  html[data-style] .analytics-card-wide { grid-column: auto; }
  html[data-style] .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-style] .form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  html[data-style] .form-actions .button { margin: 0; }
  html[data-style] .card-header { flex-wrap: wrap; }
  html[data-style] .card > details > summary { padding: 12px var(--card-inset); }
  html[data-style] .card-header h2 { min-width: 0; }
  html[data-style] .card-header > a { display: inline-flex; align-items: center; min-height: 44px; }
  html[data-style] .object-key, html[data-style] .topology-summary { display: flex; flex-wrap: wrap; gap: 8px; }
  html[data-style] .object-title, html[data-style] .object-key { overflow-wrap: anywhere; }
  html[data-style] .page-actions { gap: 8px; }
  html[data-style] .tabs, html[data-style] .registry-tabs { flex-wrap: nowrap; gap: 0; max-width: 100%; overflow-x: auto; }
  html[data-style] .tabs a, html[data-style] .registry-tabs a { display: inline-flex; align-items: center; flex-shrink: 0; min-height: 44px; padding: 10px 12px; white-space: nowrap; }
  html[data-style] .registry-filters-disclosure > summary { display: list-item; margin-left: 18px; }
  html[data-style] .registry-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  html[data-style] .registry-toolbar .search-field { grid-column: 1 / -1; width: 100%; min-width: 0; }
  html[data-style] .registry-toolbar > label { display: grid; gap: 4px; min-width: 0; }
  html[data-style] .registry-toolbar select { min-width: 0; width: 100%; }
  html[data-style] .registry-toolbar > .advanced-filters { grid-column: 1 / -1; }
  html[data-style] .registry-advanced-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-style] .registry-advanced-controls label { display: grid; gap: 4px; min-width: 0; }
  html[data-style] .registry-group-select { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; padding: 8px; }
  html[data-style] .registry-group-select label { display: grid; flex: 1 1 140px; min-width: 0; gap: 4px; margin: 0; }
  html[data-style] .registry-group-select select { width: 100%; min-width: 0; }
  html[data-style] .registry-context, html[data-style] .search-context { gap: 8px; font-size: 14px; }
  html[data-style] .registry-filter-chip, html[data-style] .search-filter-chip { min-height: 44px; align-items: center; max-width: 100%; padding: 8px; overflow-wrap: anywhere; }
  html[data-style] .registry-sort-context, html[data-style] .search-order-context { white-space: normal; }
  html[data-style] .search-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-style] .search-query-row { grid-template-columns: minmax(0, 1fr) auto; }
  html[data-style] .search-query-row > label { grid-column: 1 / -1; }
  html[data-style] .search-query-row .search-page-query { min-width: 0; }
  html[data-style] .saved-search-body, html[data-style] .saved-search-form { grid-template-columns: minmax(0, 1fr); }
  html[data-style] .saved-search-list li { flex-wrap: wrap; gap: 8px; padding: 8px 0; }
  html[data-style] .saved-search-list a { overflow-wrap: anywhere; }
  html[data-style] .search-result { grid-template-columns: minmax(0, 1fr) 20px; gap: 8px; }
  html[data-style] .search-result-meta { grid-column: 1 / -1; grid-row: 2; }
  html[data-style] .search-result-arrow { grid-column: 2; grid-row: 1; }
  html[data-style] .search-result-title { font-size: 16px; overflow-wrap: anywhere; }
  html[data-style] .search-result-subtitle, html[data-style] .search-result-meta { font-size: 14px; }
  html[data-style] .pagination { justify-content: center; flex-wrap: wrap; gap: 8px; }
  html[data-style] .pagination .button { flex: 1 1 auto; }
  html[data-style] .topology-filter-panel, html[data-style] .analytics-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-style] .topology-filter-panel label, html[data-style] .analytics-toolbar label { min-width: 0; }
  html[data-style] .topology-filter-panel input, html[data-style] .topology-filter-panel select { width: 100%; min-width: 0; }
  html[data-style] .topology { height: 400px; min-height: 280px; }
  html[data-style] .topology-compact { height: 280px; }
  html[data-style] .topology-map-controls { flex-wrap: wrap; margin-left: 0; }
  html[data-style] .table-scroll-note:not([hidden]) { display: block; margin: 8px 0; color: var(--muted); font-size: 14px; }
  html[data-style] .table-wrap { max-width: 100%; overscroll-behavior-x: contain; }
  html[data-style] .row-actions-menu a { min-height: 44px; padding: 10px; }
  html[data-style] .helptext, html[data-style] .muted, html[data-style] .activity-meta { font-size: 14px; }
  html[data-style] .login-shell { min-height: 100vh; min-height: 100svh; padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  html[data-style] .login-card input { width: 100%; }
  html[data-style] .login-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) { min-height: 48px; }
  html[data-style] .password-control button { width: 44px; min-height: 0; }
  html[data-style] .password-control input[type] { padding-right: 48px; }
}

@media (max-width: 640px) {
  html[data-style] .form-grid, html[data-style] .registry-advanced-controls,
  html[data-style] .search-filter-grid, html[data-style] .topology-filter-panel,
  html[data-style] .analytics-toolbar { grid-template-columns: minmax(0, 1fr); }
  html[data-style] .definition-list { grid-template-columns: minmax(0, 1fr); }
  html[data-style] .definition-list dt { padding: 10px 0 2px; border-bottom: 0; font-size: 14px; }
  html[data-style] .definition-list dd { padding: 0 0 10px; }
  html[data-style] .mobile-registry-sort { display: flex; align-items: end; gap: 8px; padding: 8px; }
  html[data-style] .mobile-registry-sort label { display: grid; flex: 1; gap: 4px; min-width: 0; font-size: 14px; }
  html[data-style] .mobile-registry-sort select { width: 100%; min-width: 0; }
  html[data-style] .mobile-registry-sort .button { flex-shrink: 0; }
  html[data-style] .mobile-records[data-registry] { max-height: none; overflow: visible; background: transparent; box-shadow: none; }
  html[data-style] .mobile-records[data-registry] table,
  html[data-style] .mobile-records[data-registry] tbody { display: block; width: 100%; min-width: 0; }
  html[data-style] .mobile-records[data-registry] thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  html[data-style] .mobile-records[data-registry] tbody tr { display: block; margin-bottom: 12px; padding: 4px 12px; border: 1px solid var(--line); background: var(--surface, #fff); }
  html[data-style] .mobile-records[data-registry] tbody td { display: grid; grid-template-columns: minmax(80px, 34%) minmax(0, 1fr); align-items: start; gap: 10px; width: auto; min-width: 0; max-width: none; position: static; padding: 8px 0; border-bottom: 1px solid var(--line); background: transparent; box-shadow: none; white-space: normal; font-size: 15px; }
  html[data-style] .mobile-records[data-registry] tbody td:last-child { border-bottom: 0; }
  html[data-style] .mobile-records[data-registry] tbody td[data-col="0"],
  html[data-style] .mobile-records[data-registry] tbody td[colspan] { display: block; font-size: 16px; }
  html[data-style] .mobile-records[data-registry] td[data-col="0"] .mobile-cell-label { display: none; }
  html[data-style] .mobile-records[data-registry] td[data-col="0"] .table-link { display: flex; align-items: center; min-height: 44px; font-weight: 700; }
  html[data-style] .mobile-records[data-registry] td.bulk-only { display: none; }
  html[data-style] .mobile-cell-label { display: block; color: var(--muted); font-size: 14px; line-height: 1.45; }
  html[data-style] .mobile-cell-value { display: block; min-width: 0; overflow-wrap: anywhere; }
  html[data-style] .mobile-cell-value .inline-admin-form { display: flex; flex-wrap: wrap; gap: 8px; }
  html[data-style] .mobile-cell-value .inline-admin-form label { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
  html[data-style] .mobile-records[data-registry] .table-actions { align-items: center; }
  html[data-style] .mobile-records[data-registry] .registry-date-cell { white-space: normal; }
  html[data-style] .card-body, html[data-style] .issue-list li, html[data-style] .activity-list li { overflow-wrap: anywhere; }
  html[data-style] .issue-list li { flex-wrap: wrap; }
  html[data-style] .search-result-group > header { flex-wrap: wrap; gap: 4px; }
  html[data-style] .content pre { max-width: 100%; overflow-x: auto; }
}

@media print {
  .mobile-nav-toggle, .mobile-cell-label, .mobile-registry-sort,
  .registry-filters-disclosure > summary, .table-scroll-note { display: none; }
}
