.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 32px 19px 18px;
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.sidebar .brand {
  padding: 0 13px;
  margin-bottom: 35px;
}
.company-picker {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 10px;
  background: var(--nav-surface);
  border-radius: 12px;
  margin: 0 4px 25px;
}
.company-picker select {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}
.company-icon {
  background: var(--nav-icon);
  border-radius: 7px;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  flex-shrink: 0;
}
.nav-label {
  font-size: 10px;
  letter-spacing: 1.3px;
  color: var(--muted);
  margin: 0 15px 11px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.nav-item.active {
  background: var(--interactive-highlight);
  color: var(--blue);
  font-weight: 400;
}
.nav-item:hover {
  background: var(--interactive-highlight);
}
.nav-bottom {
  margin-top: auto;
}
.plan-card {
  padding: 15px;
  background: var(--plan-bg);
  border: 1px solid var(--plan-border);
  border-radius: 13px;
  margin: 20px 4px 14px;
}
.plan-card p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 7px;
}
.plan-card .badge {
  margin-top: 10px;
}
.sidebar-user {
  border-top: 1px solid var(--line);
  padding: 18px 7px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user strong {
  display: block;
  font-size: 11px;
}
.sidebar-user span {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  color: var(--muted);
}
.main {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 38px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.breadcrumb {
  color: var(--muted);
}
.breadcrumb span {
  color: var(--text-strong);
  margin-left: 14px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 19px;
  margin-left: auto;
}
.topbar-date {
  color: var(--muted);
  font-size: 11px;
}
.workspace {
  padding: 34px 38px;
  max-width: 1700px;
  margin: auto;
}

.notifications-wrap {
  position: relative;
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 360px;
  max-height: 480px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(31, 45, 61, 0.14);
  z-index: 50;
}

.notifications-dropdown[hidden] {
  display: none;
}

.notifications-dropdown-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.notifications-clear {
  margin-left: auto;
  flex-shrink: 0;
}

.notifications-dropdown-head strong {
  font-size: 12px;
  font-weight: 600;
}

.notifications-dropdown-list {
  max-height: 410px;
  overflow-y: auto;
}

.notifications-dropdown-loading {
  padding: 32px 20px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
#notifications-toggle {
  position: relative;
}

.notifications-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--blue);
  border: 2px solid var(--surface);
  color: var(--color-on-accent);
  font-size: 9px;
  font-weight: 600;
  line-height: 14px;
  text-align: center;
  box-sizing: border-box;
}

.notifications-badge[hidden] {
  display: none;
}
.notifications-dropdown .note-item {
  gap: 10px;
  padding: 14px 16px;
  align-items: flex-start;
}

.notifications-dropdown .note-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.notifications-dropdown .note-icon .icon {
  width: 17px;
  height: 17px;
}

.notifications-dropdown .note-item h3 {
  margin: 0 0 4px;
  font-size: 11px;
}

.notifications-dropdown .note-item p {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
}

.notifications-dropdown .text-link {
  flex-shrink: 0;
  align-self: center;
  font-size: 10px;
}

.notifications-dropdown-list {
  max-height: 360px;
}

.notifications-dropdown {
  max-height: 430px;
}

/* Company switcher */

.company-picker {
  position: relative;
  display: block;
  padding: 0;
  background: transparent;
}

.company-picker-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.company-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  overflow: hidden;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(31, 45, 61, 0.14);
  z-index: 60;
}

.company-dropdown[hidden] {
  display: none;
}

.company-option {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.company-option:hover {
  background: var(--interactive-highlight);
}

.company-option.active {
  background: var(--interactive-highlight);
  color: var(--blue);
}

.company-option-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--nav-icon);
  color: var(--text-soft);
}

.company-option-icon .icon {
  width: 15px;
  height: 15px;
}

.company-option.active .company-option-icon {
  background: var(--shift-bg);
  color: var(--blue);
}

.company-option-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
}

.company-option-check {
  flex-shrink: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
}

/* Floating application shell */
@media (min-width: 801px) {
  .layout {
  }

  .sidebar {
  }

  .main {
    grid-column: 2;
  }
}

.topbar {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 30;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.account-island {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 14px 38px rgba(31, 45, 61, 0.1);
}

.account-island .notifications-wrap {
  padding-right: 7px;
  border-right: 1px solid var(--line);
}

.account-island-profile {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 7px 3px 2px;
  border-radius: 11px;
  color: var(--text);
  text-decoration: none;
}

.account-island-profile:hover {
  background: var(--surface-hover);
}

.account-island-name {
  max-width: 150px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-island-chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.account-island-chevron .icon {
  width: 16px;
  height: 16px;
}

.workspace {
  padding-top: 92px;
}

/* Mobile workspace spacing */
@media (max-width: 800px) {
  .workspace {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* MyWork logo */
.brand {
  display: flex;
  align-items: center;
}

.brand-logo {
  display: block;
  width: 168px;
  height: auto;
  max-width: 100%;
}

.sidebar-copyright {
  margin: 14px 0 0;
  padding: 14px 13px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.company-icon img,
.company-option-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

/* Add company */

.company-dropdown-divider {
  height: 1px;
  margin: 6px 8px;
  background: var(--line);
}

.company-option-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.company-option-row .company-option {
  flex: 1;
  min-width: 0;
}

/* Sidebar account and notifications */
.sidebar-user {
  gap: 6px;
  padding: 14px 4px 0;
}

.sidebar-user-profile {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
  padding: 5px 2px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}

.sidebar-user-profile:hover {
  background: var(--surface-hover);
}

.sidebar-user-profile .avatar {
  flex: 0 0 auto;
}

.sidebar-user-info {
  display: block;
  min-width: 0;
}

.sidebar-user-info strong {
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.sidebar-user-info > span {
  display: block;
  margin-top: 4px;
}

.sidebar-user-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 2px;
}

.sidebar-user-actions .icon-button,
.sidebar-user-actions #logout {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 34px;
  padding: 5px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sidebar-user-actions .icon-button:hover,
.sidebar-user-actions #logout:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-user-actions .notifications-badge {
  top: -4px;
  right: -5px;
}

/* Desktop: no floating account card */
@media (min-width: 801px) {
  .topbar:empty {
    display: none;
  }
}

/* Счётчик уведомлений в нижней части сайдбара */
.sidebar-user-actions .notifications-wrap {
  position: relative;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
}

.sidebar-user-actions #notifications-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  overflow: visible;
}

.sidebar-user-actions #notifications-toggle .icon {
  width: 19px;
  height: 19px;
}

.sidebar-user-actions .notifications-badge {
  position: absolute;
  top: -3px;
  right: -5px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--blue);
  color: var(--color-on-accent);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}

.sidebar-user-actions .notifications-badge[hidden] {
  display: none;
}

/* Уведомления рядом с аккаунтом */
.sidebar-user-profile {
  align-self: stretch;
}

.sidebar-user-actions {
  display: flex;
  align-items: stretch;
  align-self: stretch;
}

.sidebar-user-actions .notifications-wrap {
  display: flex;
  align-items: stretch;
  width: 36px;
  height: auto;
  flex: 0 0 36px;
}

.sidebar-user-actions #notifications-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: 36px;
  height: 100%;
  min-height: 42px;
  padding: 0;
  position: relative;
  border-radius: 10px;
  line-height: 1;
}

.sidebar-user-actions #notifications-toggle .icon {
  display: block;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  margin: 0;
}

.sidebar-user-actions #notifications-toggle .notifications-badge {
  top: -4px;
  right: -5px;
}

/* My Work: аккаунт и компания в верхней части сайдбара */

.sidebar > .brand {
  margin-bottom: 20px;
}

/* Верхний блок аккаунта */
.sidebar > .sidebar-user {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 0 4px 12px;
  margin-bottom: 12px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
}

.sidebar > .sidebar-user .sidebar-user-profile {
  min-width: 0;
  min-height: 44px;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px;
  border-radius: 11px;
}

.sidebar > .sidebar-user .sidebar-user-info {
  min-width: 0;
  flex: 1 1 0;
}

.sidebar > .sidebar-user .sidebar-user-info strong {
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

/* Колокольчик: полноценная область наведения */
.sidebar > .sidebar-user .sidebar-user-actions {
  display: flex;
  flex: 0 0 44px;
  align-items: stretch;
  align-self: stretch;
}

.sidebar > .sidebar-user .notifications-wrap {
  position: relative;
  display: flex;
  flex: 0 0 44px;
  width: 44px;
  height: auto;
}

.sidebar > .sidebar-user #notifications-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sidebar > .sidebar-user #notifications-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar > .sidebar-user #notifications-toggle .icon {
  display: block;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  margin: 0;
}

.sidebar > .sidebar-user .notifications-badge {
  top: 1px;
  right: 1px;
}

/* Компания сразу под аккаунтом */
.sidebar > .company-picker {
  display: block;
  margin: 0 4px 24px;
  padding: 0;
  background: transparent;
}

.sidebar > .company-picker .company-picker-name {
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
}

/* Нижняя часть сайдбара */
.sidebar .nav-bottom {
  margin-top: auto;
}

/* My Work v4 — плоский сайдбар на компьютере */
@media (min-width: 801px) {
  .layout {
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;

    height: 100dvh;
    padding: 28px 19px 18px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    background: var(--surface);
    overflow-y: auto;
  }

  .main {
    grid-column: 2;
    min-width: 0;
  }

  .sidebar > .brand {
    margin-bottom: 24px;
  }
}

/* Широкий плоский сайдбар */

/* My Work v4 — просторный сайдбар 300px */
@media (min-width: 801px) {
  .sidebar {
  }

  /* Аккаунт и уведомления */
  .sidebar > .sidebar-user {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin: 0 0 16px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--line);
  }

  .sidebar > .sidebar-user .sidebar-user-profile {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    min-width: 0;
    min-height: 48px;
    gap: 12px;
    padding: 6px 8px;
    border-radius: 12px;
  }

  .sidebar > .sidebar-user .sidebar-user-info {
    min-width: 0;
    flex: 1 1 0;
  }

  .sidebar > .sidebar-user .sidebar-user-info strong {
    font-size: 12px;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .sidebar > .sidebar-user .sidebar-user-actions,
  .sidebar > .sidebar-user .notifications-wrap {
    flex: 0 0 48px;
    width: 48px;
  }

  .sidebar > .sidebar-user #notifications-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-height: 48px;
    height: 100%;
    border-radius: 12px;
  }

  .sidebar > .sidebar-user .notifications-badge {
    top: 1px;
    right: 1px;
  }

  /* Компания */
  .sidebar > .company-picker {
    margin: 0 0 28px;
  }

  /* Заголовки групп */
  .sidebar .nav-label {
    margin-left: 12px;
    margin-right: 12px;
    margin-bottom: 13px;
    letter-spacing: 1.1px;
  }

  /* Пункты навигации */
  .sidebar .nav-item {
    display: flex;
    align-items: center;
    min-height: 44px;
    gap: 14px;
    padding: 12px 14px;
    margin-bottom: 5px;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 11px;
  }

  /* Нижние элементы */
  .sidebar .plan-card {
    margin-left: 0;
    margin-right: 0;
  }

  .sidebar .sidebar-copyright {
    margin-top: 14px;
  }
}

/* Единые размеры текста в сайдбаре */
.sidebar .nav-item {
  font-size: var(--font-body);
}

.sidebar .company-picker-name,
.sidebar .sidebar-user-info strong {
  font-size: var(--font-body);
}

.sidebar .nav-label,
.sidebar .sidebar-copyright {
  font-size: var(--font-small);
}

.sidebar .notifications-badge {
  font-size: var(--font-compact);
}

/* My Work v4 — сайдбар 250px */
@media (min-width: 801px) {
  .layout {
  }

  .sidebar {
    padding: 28px 18px 20px;
  }
}

/* Unified sidebar navigation */
.sidebar .nav-item,
.sidebar .nav-bottom .sidebar-feedback {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-decoration: none;
  box-sizing: border-box;
}

.sidebar .nav-item:hover,
.sidebar .nav-bottom .sidebar-feedback:hover {
  background: var(--interactive-highlight);
  color: var(--muted);
}

.sidebar .nav-item.active,
.sidebar .nav-bottom .sidebar-feedback.active {
  background: var(--interactive-highlight);
  color: var(--blue);
  font-weight: 400;
}

.sidebar .nav-item .icon,
.sidebar .nav-bottom .sidebar-feedback .icon {
  color: currentColor;
  flex-shrink: 0;
}

.nav-item-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nav-item-disabled small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  margin-top: 3px;
}

.nav-item .icon:last-child:not(:first-child) {
  margin-left: auto;
}

.nav-item:has(.icon:last-child:nth-child(2)) {
  gap: 10px;
}

.sidebar-license {
  margin: 18px 8px 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.sidebar-license-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.sidebar-license strong {
  display: block;
  font-size: 13px;
}

.sidebar-license-days {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
}

.sidebar-license-date {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* Compact subscription navigation */
.sidebar-bottom-navigation > .sidebar-license {
  display: block;
  margin: 0 4px 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.sidebar-license-heading,
.sidebar-license-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-license-heading strong {
  font-size: 12px;
}

.sidebar-license-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.sidebar-license-warning {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #b7791f;
}

.sidebar-license:hover {
  border-color: #aabbd0;
  background: #f7f9fc;
}

@media (max-width: 760px) {
  .sidebar-bottom-navigation > .sidebar-license {
    margin-bottom: 10px;
  }
}

/* Compact tariff locks in sidebar */
.tariff-lock-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  color: #94a3b8;
  flex-shrink: 0;
}

.tariff-lock-icon .icon {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}

/* Subscription card — dark appearance */
:root[data-theme='dark'] .sidebar .sidebar-license {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  color: var(--text);
}

:root[data-theme='dark'] .sidebar .sidebar-license:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

:root[data-theme='dark'] .sidebar .sidebar-license-heading strong {
  color: var(--text);
}

:root[data-theme='dark'] .sidebar .sidebar-license-meta {
  color: var(--text-secondary);
}

:root[data-theme='dark'] .sidebar .sidebar-license-warning {
  color: #f2b65d;
}

/* Mobile application navigation */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 800px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    align-items: stretch;
    justify-content: space-around;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 22px rgba(0, 0, 0, 0.05);
  }

  .mobile-bottom-item {
    min-width: 0;
    flex: 1;
    min-height: 48px;
    padding: 5px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    font: inherit;
    cursor: pointer;
  }

  .mobile-bottom-item .icon {
    width: 21px;
    height: 21px;
  }

  .mobile-bottom-item span:not(.icon) {
    font-size: 10px;
    font-weight: 500;
  }

  .mobile-bottom-item.active {
    color: var(--blue);
  }

  .main {
    padding-bottom: calc(85px + env(safe-area-inset-bottom));
  }

  .topbar .mobile-menu {
    display: none;
  }

  .sidebar.open {
    z-index: 40;
  }

  :root[data-theme='dark'] .mobile-bottom-nav {
    background: var(--surface);
    border-color: var(--line);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.22);
  }
}

@media (min-width: 801px) {
  .mobile-bottom-nav {
    display: none;
  }
}

/* Mobile application navigation */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 800px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    align-items: stretch;
    justify-content: space-around;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 22px rgba(0, 0, 0, 0.05);
  }

  .mobile-bottom-item {
    min-width: 0;
    flex: 1;
    min-height: 48px;
    padding: 5px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    font: inherit;
    cursor: pointer;
  }

  .mobile-bottom-item .icon {
    width: 21px;
    height: 21px;
  }

  .mobile-bottom-item span:not(.icon) {
    font-size: 10px;
    font-weight: 500;
  }

  .mobile-bottom-item.active {
    color: var(--blue);
  }

  .main {
    padding-bottom: calc(85px + env(safe-area-inset-bottom));
  }

  .topbar .mobile-menu {
    display: none;
  }

  .sidebar.open {
    z-index: 40;
  }

  :root[data-theme='dark'] .mobile-bottom-nav {
    background: var(--surface);
    border-color: var(--line);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.22);
  }
}

@media (min-width: 801px) {
  .mobile-bottom-nav {
    display: none;
  }
}

/* Account logout button — dark theme */
:root[data-theme='dark'] .sidebar-account-logout {
  background: #30242b;
  border: 1px solid #55333e;
  color: #ff8797;
}

:root[data-theme='dark'] .sidebar-account-logout:hover {
  background: #432a35;
  border-color: #87505d;
  color: #ffabb5;
}

:root[data-theme='dark'] .sidebar-account-logout:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Minimal logout icon — all themes */
.sidebar-account-logout,
:root[data-theme='dark'] .sidebar-account-logout {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  padding: 6px;
  color: var(--muted);
}

.sidebar-account-logout:hover,
:root[data-theme='dark'] .sidebar-account-logout:hover {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #f16b79;
}

.sidebar-account-logout:active {
  opacity: 0.7;
}

.sidebar-account-logout:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Full-width account selection */
.sidebar-account-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0;
  border-radius: 12px;
  background: var(--nav-active);
}

.sidebar-account-row > a.nav-item {
  flex: 1;
  min-width: 0;
  margin: 0;
  background: transparent !important;
  border-radius: 12px 0 0 12px;
}

.sidebar-account-row .sidebar-account-logout {
  flex: 0 0 auto;
  margin: 0 8px 0 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

:root[data-theme='dark'] .sidebar-account-row {
  background: var(--surface-hover);
}

/* Mobile More page */
.mobile-more-page {
  max-width: 620px;
  margin: 0 auto;
  padding: 8px 0 24px;
}

.mobile-more-page h1 {
  font-size: 25px;
  margin: 0 0 22px;
}

.mobile-more-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}

.mobile-more-link {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 14px;
  padding: 17px;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mobile-more-group .mobile-more-link + .mobile-more-link {
  border-top: 1px solid var(--line);
}

.mobile-more-link > .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.mobile-more-lock {
  margin-left: auto;
  color: var(--muted);
}

.mobile-more-lock .icon {
  width: 13px;
  height: 13px;
}

.mobile-more-logout {
  color: var(--danger);
}

.mobile-more-page .sidebar-license {
  display: block;
  margin: 0 0 16px;
  background: var(--surface);
  color: var(--text);
}

@media (min-width: 801px) {
  .mobile-more-page {
    display: none;
  }
}

@media (max-width: 800px) {
  .sidebar,
  .sidebar.open {
    display: none !important;
  }

  .layout {
    display: block;
  }

  .main {
    margin-left: 0;
    width: 100%;
  }
}

/* Quick theme switch */
.topbar {
  position: relative;
}

.quick-theme-toggle {
  position: absolute;
  right: 18px;
  top: 12px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.quick-theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--blue);
}

.quick-theme-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.quick-theme-symbol {
  font-size: 23px;
  line-height: 1;
}

@media (max-width: 800px) {
  .quick-theme-toggle {
    top: 8px;
    right: 12px;
  }
}

/* Quick theme SVG icons */
.quick-theme-toggle img {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Telegram-style circular theme reveal */
@supports (view-transition-name: root) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
  }

  ::view-transition-old(root) {
    z-index: 1;
  }

  ::view-transition-new(root) {
    z-index: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

/* Sidebar account — subtle appearance */
.sidebar-account-row {
  background: transparent !important;
  transition: background 0.18s ease;
}

.sidebar-account-row:hover {
  background: var(--surface-hover) !important;
}

.sidebar-account-row > a.nav-item,
.sidebar-account-row > a.nav-item.active {
  background: transparent !important;
}

.sidebar-account-row .avatar,
.sidebar-account-row .user-avatar,
.sidebar-account-row .nav-avatar,
.sidebar-account-row img {
  width: 40px;
  height: 40px;
  min-width: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
}

:root[data-theme='dark'] .sidebar-account-row {
  background: transparent !important;
}

:root[data-theme='dark'] .sidebar-account-row:hover {
  background: var(--surface-hover) !important;
}

/* Sidebar profile avatar */
.sidebar-account-row .sidebar-profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
}

.sidebar-account-row .sidebar-profile-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Theme toggle in sidebar footer */
.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
}

.sidebar-footer-row .sidebar-copyright {
  padding: 0;
  margin: 0;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.sidebar-footer-row .quick-theme-toggle {
  position: static;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
}

/* Sidebar copyright alignment */
.sidebar-footer-row .sidebar-copyright {
  text-align: left !important;
  align-items: flex-start;
}

.sidebar-footer-row .sidebar-copyright span {
  display: block;
  text-align: left;
}

/* Тариф не влияет на цвет навигации */
.sidebar .nav-item.nav-tariff-muted {
  opacity: 1;
}

.sidebar .nav-item.nav-tariff-muted .icon {
  opacity: 1;
  filter: none;
}

/* Управление: компоновка */
.management-hub-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.management-hub-header h1 {
  margin: 0;
}

.management-hub-tabs {
  max-width: 100%;
}

.management-hub-active .company-settings-page .settings-stack {
  gap: 12px;
}

.management-hub-active .company-settings-page .settings-stack > .card {
  padding: 18px 20px;
  border-radius: 14px;
}

.management-hub-active .company-settings-page .card-head {
  margin-bottom: 14px;
}

.management-hub-active .company-settings-page .company-profile-row {
  gap: 14px;
}

.management-hub-placeholder {
  padding: 24px;
}

@media (max-width: 800px) {
  .management-hub-header {
    gap: 12px;
    margin-bottom: 14px;
  }

  .management-hub-tabs {
    overflow-x: auto;
  }

  .management-hub-active .company-settings-page .settings-stack > .card {
    padding: 14px;
  }
}

/* Управление — без повторного заголовка сотрудников */
.management-hub-active:has(.management-hub-header) > .page-head {
  display: none;
}

/* Скрываем внутренние заголовки страниц внутри Управления */
.management-hub-active .company-settings-page > .page-head,
.management-hub-active > .page-head,
.management-hub-active > :not(.management-hub-header) > .page-head {
  display: none;
}

/* Управление — скрываем заголовок встроенной страницы сотрудников */
.management-hub-active > h1,
.management-hub-active > .page-title,
.management-hub-active > .page-head,
.management-hub-active > .section-head:has(h1) {
  display: none;
}

/* Единая вертикальная компоновка разделов */
.management-hub-header {
  gap: 0;
  margin-bottom: 20px;
}

.management-hub-header h1 {
  margin: 0 0 24px;
}

.management-hub-tabs {
  margin: 0;
}

#view > .page-heading:has(+ [data-payroll-live-root]) {
  margin-bottom: 24px;
}

[data-payroll-live-root] .payroll-top-row {
  margin-bottom: 0;
}

@media (max-width: 800px) {
  .management-hub-header h1 {
    margin-bottom: 16px;
  }
}
