/* Оболочка: нижняя панель на телефоне (до 768 px), левая колонка на компьютере; страница входа */
.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: var(--topbar-h);
  padding: var(--s-2) var(--s-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-size: var(--fs-18);
  font-weight: 700;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s-1);
}

.topbar-user {
  display: none;
  color: var(--text-2);
  font-size: var(--fs-14);
  margin-right: var(--s-2);
}

.page {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-4) calc(var(--nav-h) + var(--s-6));
}

.page > * + * {
  margin-top: var(--s-4);
}

.nav {
  position: fixed;
  z-index: 45;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  min-height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--nav-h);
  padding: var(--s-1);
  color: var(--text-2);
  font-size: var(--fs-12);
  font-weight: 600;
  text-decoration: none;
}

.nav-item[aria-current="page"] {
  color: var(--link);
}

.nav-item[aria-current="page"] .icon {
  stroke-width: 2.25;
}

button.nav-item {
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.nav-item:disabled,
.nav-item[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  background: transparent;
}

.nav-item:hover {
  background: var(--surface-2);
}

@media (min-width: 768px) {
  /* Колонка навигации на всю высоту страницы: фон тянется вместе с содержимым (::before),
     сами пункты закреплены sticky и всегда на экране. */
  .app {
    display: grid;
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
  }

  .app::before {
    content: "";
    grid-column: 1;
    grid-row: 1;
    background: var(--surface);
    border-right: 1px solid var(--border);
  }

  .nav {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    bottom: auto;
    align-self: start;
    height: 100vh;
    height: 100dvh;
    width: var(--nav-w);
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--s-1);
    padding: var(--s-3) var(--s-1);
    background: transparent;
    border-top: 0;
    overflow-y: auto;
  }

  .nav-item {
    flex: none;
    min-height: 68px;
    border-radius: var(--r-1);
  }

  .shell {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .page {
    padding: var(--s-5) var(--s-5) var(--s-6);
  }

  .topbar {
    padding: var(--s-2) var(--s-5);
  }

  .topbar-user {
    display: inline;
  }
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.grid-2 {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.stack > * + * {
  margin-top: var(--s-3);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

/* Страница входа */
.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: var(--s-5) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  box-shadow: var(--shadow-1);
}

.auth-card > * + * {
  margin-top: var(--s-4);
}

.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

/* Витрина /ui */
.demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.demo-block {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  align-items: flex-start;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--s-2);
}

.swatch {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 64px;
  padding: var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--r-1);
  font-size: var(--fs-12);
  font-weight: 600;
}

.sw-bg {
  background: var(--bg);
  color: var(--text);
}

.sw-surface {
  background: var(--surface);
  color: var(--text);
}

.sw-surface-2 {
  background: var(--surface-2);
  color: var(--text);
}

.sw-accent {
  background: var(--accent);
  color: var(--on-accent);
}

.sw-success {
  background: var(--success-bg);
  color: var(--success);
}

.sw-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.sw-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.sw-border {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.type-12 {
  font-size: var(--fs-12);
}

.type-14 {
  font-size: var(--fs-14);
}

.type-16 {
  font-size: var(--fs-16);
}

.type-18 {
  font-size: var(--fs-18);
}

.type-22 {
  font-size: var(--fs-22);
}

.type-28 {
  font-size: var(--fs-28);
}

.sample {
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
}

@media print {
  .nav,
  .topbar {
    display: none;
  }
}
