.hk-app {
  min-height: 100vh;
  display: flex;
}

.hk-sidebar {
  width: var(--hk-sidebar-width);
  flex: 0 0 var(--hk-sidebar-width);
  background: var(--hk-surface);
  border-right: 1px solid var(--hk-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1025;
}

.hk-sidebar__top,
.hk-sidebar__footer {
  padding: 20px;
}

.hk-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.hk-nav__group-title {
  padding: 0 12px 8px;
  color: var(--hk-text-soft);
  font-size: var(--hk-font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hk-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hk-topbar {
  min-height: var(--hk-header-height);
  background: var(--hk-surface);
  border-bottom: 1px solid var(--hk-border);
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  gap: 16px;
}

.hk-topbar__left,
.hk-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hk-page {
  padding: 24px;
}

.hk-page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.hk-page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hk-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px 24px;
  color: var(--hk-text-muted);
  font-size: var(--hk-font-size-sm);
}

@media (max-width: 991.98px) {
  .hk-sidebar {
    position: fixed;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--hk-shadow-md);
  }

  .hk-sidebar.is-open {
    transform: translateX(0);
  }

  .hk-topbar,
  .hk-page,
  .hk-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hk-page-header,
  .hk-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .hk-topbar__left,
  .hk-topbar__right {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .hk-footer {
    flex-direction: column;
  }
}

/* NEKCO v0.3.19 — UX/UI выравнивание правого рабочего блока */
:root {
  --hk-content-max-width: 1760px;
  --hk-content-gutter: clamp(20px, 2.2vw, 36px);
  --hk-section-gap: 22px;
}

.hk-main {
  background: linear-gradient(180deg, #f8fafc 0%, #f3f6fa 100%);
}

.hk-content.container-fluid,
.hk-content {
  width: 100%;
  min-width: 0;
}

.hk-page-title {
  margin: 0;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.hk-page-subtitle {
  margin: 6px 0 0;
  color: #64748b;
  line-height: 1.45;
}

.hk-page-actions .btn,
.hk-card .btn {
  border-radius: 12px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.hk-card {
  border-radius: 18px;
}

.hk-card-body {
  padding: 22px;
}

.hk-card + .hk-card,
.hk-card.mb-4 {
  margin-bottom: var(--hk-section-gap) !important;
}

.hk-filter-panel,
.hk-card form.row {
  row-gap: 16px;
}

.hk-table-responsive-mobile,
.table-responsive {
  border-radius: 14px;
}

.hk-table {
  margin-bottom: 0;
}

.hk-table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  border-bottom: 1px solid #e5e7eb;
  padding: 14px 16px;
}

.hk-table tbody td {
  padding: 16px;
  border-top: 1px solid #edf2f7;
  vertical-align: middle;
}

.hk-table tbody tr:hover td {
  background: #f8fbff;
}

.hk-table td:first-child,
.hk-table th:first-child {
  padding-left: 18px;
}

.hk-table td:last-child,
.hk-table th:last-child {
  padding-right: 18px;
}

@media (min-width: 992px) {
  /* На ПК верхняя служебная полоса не нужна только внутри закрытого портала.
     На публичном сайте .hk-topbar содержит меню, кнопку «Войти» и модальное окно входа. */
  body:not(.hk-public) .hk-topbar {
    display: none !important;
  }

  .hk-content.container-fluid,
  .hk-content {
    max-width: min(var(--hk-content-max-width), calc(100vw - var(--hk-sidebar-width) - (var(--hk-content-gutter) * 2)));
    margin-left: auto;
    margin-right: auto;
    padding: 28px var(--hk-content-gutter) 40px !important;
  }

  .hk-page-header {
    width: 100%;
    margin: 0 0 var(--hk-section-gap);
    padding: 0 2px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
  }

  .hk-page-header > div:first-child {
    min-width: 0;
    max-width: 920px;
  }

  .hk-page-actions {
    margin-left: auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }

  .hk-page-content {
    width: 100%;
    display: block;
  }

  .hk-page-content > .alert,
  .hk-content > .alert {
    border-radius: 16px;
    margin-bottom: var(--hk-section-gap);
  }

  .hk-page-content > .hk-card,
  .hk-content > .hk-card {
    width: 100%;
  }
}

@media (min-width: 1440px) {
  .hk-content.container-fluid,
  .hk-content {
    padding-top: 32px !important;
    padding-bottom: 48px !important;
  }

  .hk-card-body {
    padding: 24px;
  }
}

@media (max-width: 991.98px) {
  .hk-content.container-fluid,
  .hk-content {
    padding: 16px 14px calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .hk-page-header {
    margin-bottom: 16px;
    gap: 12px;
  }

  .hk-page-actions {
    width: 100%;
  }

  .hk-page-actions .btn {
    flex: 1 1 auto;
  }

  .hk-card-body {
    padding: 16px;
  }
}
