/* ARS-X 3.7 — дизайн-пакет и навигация */

/* ширина меню перетаскиванием (только компьютер, не в режиме «рельс») */
@media (min-width: 901px) {
  html.arsx37-nav-sized .shell:not(.nav-rail) { grid-template-columns: var(--arsx37-nav-w, 252px) minmax(0, 1fr); }
  html.arsx37-nav-sized .shell:not(.nav-rail) .sidebar-brand,
  html.arsx37-nav-sized .shell:not(.nav-rail) .sidebar .arsx-logo-wrap { width: auto; max-width: calc(100% - 8px); }
  .shell .sidebar { position: sticky; }
  .arsx37-resize { position: absolute; top: 0; right: -4px; width: 9px; height: 100%; cursor: col-resize; z-index: 40; touch-action: none; }
  .arsx37-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: transparent; transition: background .15s, width .15s; }
  .arsx37-resize:hover::after, .arsx37-resize:focus-visible::after, html.arsx37-resizing .arsx37-resize::after { background: var(--brand); width: 2px; left: 3px; }
  .arsx37-resize:focus-visible { outline: none; }
  .shell.nav-rail .arsx37-resize { display: none; }
  html.arsx37-resizing, html.arsx37-resizing * { cursor: col-resize !important; user-select: none !important; }
}
@media (max-width: 900px) { .arsx37-resize { display: none; } }

/* закрытые по тарифу разделы: тариф подписан в меню */
.nav .nav-item.nav-locked { color: var(--nav-muted); width: 100%; min-width: 0; }
.nav button.nav-item.nav-locked > .ico:last-child { margin-left: 0; }
.nav .nav-item.nav-locked > span { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-lock-tier { flex: 0 0 auto; font-size: 10.5px; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.shell.nav-rail .nav-lock-tier { display: none; }

/* переход к содержимому */
.arsx37-skip { position: fixed; left: 12px; top: -60px; z-index: 1000; padding: 10px 16px; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 600; text-decoration: none; box-shadow: var(--shadow); transition: top .15s; }
.arsx37-skip:focus { top: 12px; outline: 2px solid #fff; outline-offset: 2px; }
#arsx-main:focus { outline: none; }

/* видимый фокус везде, в том числе в тёмной теме */
html[data-theme="dark"] :focus-visible { outline-color: color-mix(in srgb, var(--brand) 75%, white); }

/* касание пальцем: элементы не меньше 44 px */
@media (pointer: coarse), (max-width: 760px) {
  .btn, .icon-btn, .theme-toggle, .nav .nav-item, .nav-group-head, .tab, .chip-link, .create-menu button,
  .cmdk-trigger, select, input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]) { min-height: 44px; }
  .icon-btn { min-width: 44px; }
  .btn.small { min-height: 40px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
}

/* таблицы карточками на телефоне */
@media (max-width: 760px) {
  .content .table-wrap:has(table.arsx37-cards) { border: 0; background: transparent; overflow: visible; }
  table.arsx37-cards, table.arsx37-cards tbody, table.arsx37-cards tr, table.arsx37-cards td { display: block; width: 100%; }
  table.arsx37-cards { border: 0; min-width: 0 !important; }
  table.arsx37-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.arsx37-cards tfoot { display: block; }
  table.arsx37-cards tbody tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius, 12px);
    padding: 8px 12px; margin: 0 0 10px; box-shadow: var(--shadow-sm); }
  table.arsx37-cards tbody td { display: block; position: relative; border: 0; padding: 8px 0 8px 42%; text-align: right; min-height: 0;
    white-space: normal; overflow-wrap: anywhere; }
  table.arsx37-cards tbody td + td { border-top: 1px dashed var(--line); }
  table.arsx37-cards tbody td::before { content: attr(data-label); position: absolute; left: 0; top: 8px; width: 40%; text-align: left;
    color: var(--muted); font-size: 12.5px; font-weight: 500; line-height: 1.35; }
  table.arsx37-cards tbody td[data-label=""] { padding-left: 0; }
  table.arsx37-cards tbody td[data-label=""]::before { display: none; }
  /* первая колонка — заголовок карточки во всю ширину */
  table.arsx37-cards tbody td:first-child { padding-left: 0; text-align: left; font-weight: 600; font-size: 15px; }
  table.arsx37-cards tbody td:first-child::before { display: none; }
  table.arsx37-cards tbody td:first-child:has(> input[type=checkbox]:only-child) { position: absolute; right: 12px; width: auto; }
  table.arsx37-cards tbody tr { position: relative; }
  table.arsx37-cards tbody td .actions { justify-content: flex-end; flex-wrap: wrap; }
  table.arsx37-cards tbody td > .btn + .btn { margin-left: 6px; }
  table.arsx37-cards tbody td[colspan] { padding-left: 0; text-align: center; }
  table.arsx37-cards tbody td[colspan]::before { display: none; }
}

/* меньше движения, если так настроено в системе */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
