/*
 * Powłoka panelu (R19-B, WEB_DESIGN_SYSTEM.md sekcja 6): PanelShell, menu, pasek górny, paleta poleceń,
 * menu konta i powiadomień, nagłówek strony, okruszki, karta odzyskiwania i baner demo.
 * Wyłącznie tokeny z tokens.css; bez literałów kolorów (strażnik WebPage.Tests/Design).
 * Szerokości według sekcji 3.11: szuflada < 900 px, szyna 72 px od 900 do 1199 px,
 * od 1200 px menu rozwinięte albo zwinięte wyborem użytkownika (ciasteczko tm-nav).
 * Wygląd szyny wynika z szerokości kontenera menu (@container), więc prerender i obwód dają ten sam układ.
 */

html:has(.tm-shell) {
  scroll-padding-top: calc(var(--tm-layout-topbar) + 1rem);
}

.tm-shell {
  --shell-nav-w: var(--tm-layout-nav);
  display: grid;
  grid-template-columns: var(--shell-nav-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--tm-canvas);
  color: var(--tm-text);
  transition: grid-template-columns var(--tm-dur-slow) var(--tm-ease);
}

.tm-shell .tm-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
 * Link pomijania
 * ------------------------------------------------------------------------ */
.tm-skip-link {
  position: fixed;
  left: 1rem;
  top: -6rem;
  z-index: var(--tm-z-tooltip);
  padding: .625rem 1rem;
  border-radius: var(--tm-radius-md);
  border: 1px solid var(--tm-border);
  background: var(--tm-paper);
  color: var(--tm-primary-text);
  font-size: var(--tm-text-body-sm);
  font-weight: 600;
  box-shadow: var(--tm-shadow-overlay);
  text-decoration: none;
}

.tm-skip-link:focus,
.tm-skip-link:focus-visible {
  top: .75rem;
}

/* --------------------------------------------------------------------------
 * Menu boczne
 * ------------------------------------------------------------------------ */
.tm-shell__nav {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: var(--tm-z-nav);
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--tm-paper);
  border-right: 1px solid var(--tm-border-subtle);
  container: tm-nav / inline-size;
  outline: none;
  transition: width var(--tm-dur-slow) var(--tm-ease), box-shadow var(--tm-dur) var(--tm-ease);
}

.tm-nav__head {
  flex-shrink: 0;
  padding: 1.25rem 1rem .75rem;
}

.tm-nav__brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.tm-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
  padding: .25rem;
  margin: -.25rem;
  border-radius: var(--tm-radius-md);
  color: var(--tm-text);
  text-decoration: none;
}

.tm-brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: var(--tm-radius-md);
  background: var(--tm-primary);
  color: var(--tm-on-primary);
}

.tm-brand__mark-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.tm-brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.tm-brand__name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.tm-brand__accent {
  color: var(--tm-primary-text);
}

.tm-brand__panel {
  font-size: var(--tm-text-caption);
  font-weight: 500;
  color: var(--tm-text-3);
}

.tm-icon-btn.tm-nav__close {
  display: none;
}

.tm-context-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .875rem 0 0;
  padding: .375rem .625rem;
  border: 1px solid var(--tm-border-subtle);
  border-radius: var(--tm-radius-md);
  background: var(--tm-paper-2);
  color: var(--tm-text-2);
  font-size: var(--tm-text-caption);
  font-weight: 600;
  line-height: 1.3;
  min-width: 0;
}

.tm-context-chip__icon {
  width: .875rem;
  height: .875rem;
  flex-shrink: 0;
  color: var(--tm-primary-text);
}

.tm-context-chip__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-context-chip__tag {
  flex-shrink: 0;
  padding: .0625rem .5rem;
  border-radius: var(--tm-radius-pill);
  background: var(--tm-warning-tonal);
  color: var(--tm-warning-text);
  font-size: .6875rem;
  font-weight: 700;
}

.tm-nav__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .25rem .75rem 1.5rem;
  /* Keyboard scrolling stops a focused entry above the fade, not inside it (R19-I, WCAG 2.4.11). */
  scroll-padding-bottom: 1.5rem;
  scrollbar-width: thin;
  /* Fade at the lower edge: a clipped entry reads as "more below", never as cut off. */
  -webkit-mask-image: linear-gradient(to bottom, var(--tm-text) calc(100% - 1.5rem), transparent);
  mask-image: linear-gradient(to bottom, var(--tm-text) calc(100% - 1.5rem), transparent);
  scrollbar-color: var(--tm-border) transparent;
}

.tm-nav__heading {
  margin: 0;
  padding: .875rem .75rem .25rem;
  font-size: var(--tm-text-overline);
  font-weight: 700;
  line-height: var(--tm-leading-overline);
  letter-spacing: var(--tm-tracking-overline);
  text-transform: uppercase;
  color: var(--tm-text-3);
}

/* R19-G: short note under a section (the demo names entries available only in the client panel). */
.tm-nav__note {
  margin: .25rem 0 0;
  padding: 0 .75rem;
  font-size: var(--tm-text-caption);
  line-height: 1.4;
  color: var(--tm-text-3);
}

.tm-nav__list {
  display: grid;
  gap: .125rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tm-nav__list--nested {
  margin: .125rem 0 .25rem 1.75rem;
}

.tm-nav__item,
.tm-nav__collapse {
  position: relative;
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  min-height: 2.5rem;
  padding: .5rem .75rem;
  border: 0;
  border-radius: var(--tm-radius-md);
  background: transparent;
  color: var(--tm-text-2);
  font: inherit;
  font-size: var(--tm-text-body-sm);
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--tm-dur-fast) var(--tm-ease), color var(--tm-dur-fast) var(--tm-ease);
}

.tm-nav__item:hover,
.tm-nav__collapse:hover {
  background: rgb(var(--tm-text-ch) / .05);
  color: var(--tm-text);
}

.tm-nav__item[data-active="true"] {
  background: var(--tm-primary-tonal);
  color: var(--tm-primary-text);
  font-weight: 600;
}

.tm-nav__icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.tm-nav__label {
  flex: 1;
  min-width: 0;
}

.tm-nav__badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 .375rem;
  border-radius: var(--tm-radius-pill);
  background: var(--tm-warning-tonal);
  color: var(--tm-warning-text);
  font-size: var(--tm-text-caption);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tm-nav__foot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .75rem;
  border-top: 1px solid var(--tm-border-subtle);
}

.tm-nav__foot .tm-user {
  flex: 1;
}

.tm-nav__foot .tm-nav__collapse {
  width: 2.5rem;
  flex-shrink: 0;
  justify-content: center;
  padding: .5rem;
}

.tm-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
  padding: .375rem .5rem;
}

.tm-user__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.tm-user__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--tm-text-body-sm);
  font-weight: 600;
  color: var(--tm-text);
}

.tm-user__role {
  font-size: var(--tm-text-caption);
  color: var(--tm-text-3);
}

/* Szyna: menu węższe niż 8rem pokazuje same ikony; nazwy zostają dla czytników i w dymkach. */
@container tm-nav (max-width: 8rem) {
  .tm-nav__head {
    padding: 1rem .75rem .5rem;
  }

  .tm-brand {
    justify-content: center;
    margin: 0 auto;
  }

  .tm-brand__text,
  .tm-nav__label,
  .tm-nav__heading,
  .tm-nav__note,
  .tm-context-chip__label,
  .tm-context-chip__tag,
  .tm-user__text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .tm-context-chip {
    display: none;
  }

  .tm-nav__foot {
    flex-direction: column;
    gap: .5rem;
  }

  .tm-nav__section + .tm-nav__section {
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px solid var(--tm-border-subtle);
  }

  .tm-nav__item,
  .tm-nav__collapse {
    justify-content: center;
    padding: .5rem;
  }

  .tm-nav__badge {
    position: absolute;
    top: .125rem;
    right: .125rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 .25rem;
    font-size: .625rem;
  }

  .tm-nav__list--nested {
    margin-left: 0;
  }

  .tm-user {
    justify-content: center;
    padding: .25rem 0;
  }
}

/* Dymek nazwy w szynie (pozycjonowany przez panel-shell.js poza przewijaną listą). */
.tm-rail-tip {
  position: fixed;
  z-index: var(--tm-z-tooltip);
  transform: translateY(-50%);
  padding: .375rem .625rem;
  border-radius: var(--tm-radius-sm);
  background: var(--tm-inverse);
  color: var(--tm-on-inverse);
  font-family: var(--tm-font-sans);
  font-size: var(--tm-text-caption);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--tm-shadow-overlay);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
 * Treść i pasek górny
 * ------------------------------------------------------------------------ */
.tm-shell__body {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tm-topbar {
  position: sticky;
  top: 0;
  z-index: var(--tm-z-topbar);
  display: flex;
  align-items: center;
  gap: .75rem;
  height: var(--tm-layout-topbar);
  padding: 0 var(--tm-layout-gutter);
  border-bottom: 1px solid var(--tm-border-subtle);
  background: rgb(var(--tm-paper-ch) / .9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

@media (prefers-reduced-transparency: reduce) {
  .tm-topbar {
    background: var(--tm-paper);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.tm-icon-btn.tm-topbar__menu {
  display: none;
}

.tm-topbar__title {
  min-width: 0;
  flex: 1;
}

.tm-topbar__section {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--tm-text);
}

.tm-topbar__section {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.tm-topbar__parent {
  flex-shrink: 0;
  font-weight: 500;
  color: var(--tm-text-2);
}

.tm-topbar__sep {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: var(--tm-text-3);
}

.tm-topbar__current {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-topbar__context {
  margin: .125rem 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--tm-text-caption);
  line-height: var(--tm-leading-caption);
  color: var(--tm-text-2);
}

.tm-topbar__actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.tm-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 15rem;
  height: 2.5rem;
  padding: 0 .5rem 0 .75rem;
  border: 1px solid var(--tm-border-subtle);
  border-radius: var(--tm-radius-md);
  background: var(--tm-paper-2);
  color: var(--tm-text-3);
  font: inherit;
  font-size: var(--tm-text-body-sm);
  cursor: pointer;
  transition: border-color var(--tm-dur-fast) var(--tm-ease), background-color var(--tm-dur-fast) var(--tm-ease);
}

.tm-search-trigger:hover {
  border-color: var(--tm-border);
  background: var(--tm-paper);
  color: var(--tm-text-2);
}

.tm-search-trigger__label {
  flex: 1;
  text-align: left;
  white-space: nowrap;
}

.tm-kbd {
  display: inline-flex;
  align-items: center;
  padding: .0625rem .375rem;
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius-xs);
  background: var(--tm-paper);
  color: var(--tm-text-2);
  font-family: var(--tm-font-sans);
  font-size: .6875rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.tm-bell__badge {
  position: absolute;
  top: -.375rem;
  right: -.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 .3125rem;
  border: 2px solid var(--tm-paper);
  border-radius: var(--tm-radius-pill);
  background: var(--tm-danger);
  color: var(--tm-on-status-strong);
  font-size: .6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tm-account-btn {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  height: 2.5rem;
  padding: 0 .375rem 0 .25rem;
  border: 1px solid var(--tm-border-subtle);
  border-radius: var(--tm-radius-pill);
  background: var(--tm-paper-2);
  color: var(--tm-text-2);
  cursor: pointer;
}

.tm-account-btn:hover,
.tm-account-btn[aria-expanded="true"] {
  background: var(--tm-paper-3);
  color: var(--tm-text);
}

.tm-account-btn__chevron {
  width: 1rem;
  height: 1rem;
}

.tm-shell__main {
  flex: 1;
  min-width: 0;
  outline: none;
}

/* --------------------------------------------------------------------------
 * Menu rozwijane paska (konto, powiadomienia)
 * ------------------------------------------------------------------------ */
.tm-popover-anchor {
  position: relative;
}

.tm-popover {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  width: 20rem;
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100dvh - var(--tm-layout-topbar) - 1.5rem);
  overflow-y: auto;
  border: 1px solid var(--tm-border-subtle);
  border-radius: var(--tm-radius-lg);
  background: var(--tm-paper);
  color: var(--tm-text);
  box-shadow: var(--tm-shadow-overlay);
  outline: none;
}

.tm-popover--notifications {
  width: 24rem;
}

.tm-popover--account {
  width: 22rem;
}

.tm-popover__head {
  padding: 1rem;
  border-bottom: 1px solid var(--tm-border-subtle);
}

.tm-popover__head--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 1rem;
}

.tm-popover__title {
  margin: 0;
  font-size: var(--tm-text-body);
  font-weight: 600;
}

.tm-account-head {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.tm-account-head__text {
  min-width: 0;
}

.tm-account-head__name {
  margin: 0;
  font-size: var(--tm-text-body);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-account-head__meta {
  margin: .125rem 0 0;
  font-size: var(--tm-text-caption);
  color: var(--tm-text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-popover__section {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--tm-border-subtle);
}

.tm-popover__list {
  display: grid;
  gap: .125rem;
  margin: 0;
  padding: .5rem;
  list-style: none;
}

.tm-popover__item {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  min-height: 2.5rem;
  padding: .5rem .75rem;
  border: 0;
  border-radius: var(--tm-radius-sm);
  background: transparent;
  color: var(--tm-text);
  font: inherit;
  font-size: var(--tm-text-body-sm);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.tm-popover__item .tm-icon {
  color: var(--tm-text-2);
}

.tm-popover__item:hover {
  background: var(--tm-paper-3);
}

.tm-popover__item--danger,
.tm-popover__item--danger .tm-icon {
  color: var(--tm-danger-text);
}

.tm-popover__item--danger:hover {
  background: var(--tm-danger-tonal);
}

.tm-popover__item:disabled {
  cursor: progress;
  opacity: .7;
}

.tm-popover__foot {
  padding: .5rem;
  border-top: 1px solid var(--tm-border-subtle);
}

.tm-popover__empty {
  padding: 1.5rem 1rem;
  text-align: center;
}

.tm-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--tm-radius-pill);
  background: var(--tm-neutral-tonal);
  color: var(--tm-neutral-text);
}

.tm-popover__empty-title {
  margin: .75rem 0 0;
  font-size: var(--tm-text-body-sm);
  font-weight: 600;
}

.tm-popover__empty-text {
  margin: .25rem 0 0;
  font-size: var(--tm-text-caption);
  line-height: 1.5;
  color: var(--tm-text-2);
}

.tm-link-btn {
  padding: .25rem 0;
  border: 0;
  background: transparent;
  color: var(--tm-primary-text);
  font: inherit;
  font-size: var(--tm-text-caption);
  font-weight: 600;
  cursor: pointer;
}

.tm-link-btn:hover {
  text-decoration: underline;
}

.tm-notice-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tm-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: start;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--tm-border-subtle);
}

.tm-notice:last-child {
  border-bottom: 0;
}

.tm-notice__dot {
  width: .5rem;
  height: .5rem;
  margin-top: .375rem;
  border-radius: var(--tm-radius-pill);
  background: var(--tm-info);
}

.tm-notice[data-tone="success"] .tm-notice__dot { background: var(--tm-success); }
.tm-notice[data-tone="warning"] .tm-notice__dot { background: var(--tm-warning); }
.tm-notice[data-read="true"] .tm-notice__dot { background: var(--tm-border); }

.tm-notice__title {
  margin: 0;
  font-size: var(--tm-text-body-sm);
  font-weight: 600;
}

.tm-notice__message {
  margin: .125rem 0 0;
  font-size: var(--tm-text-caption);
  color: var(--tm-text-2);
}

.tm-notice__time {
  font-size: var(--tm-text-caption);
  color: var(--tm-text-3);
  font-variant-numeric: tabular-nums;
}

.tm-sample-pill {
  display: inline-flex;
  align-items: center;
  padding: .0625rem .5rem;
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius-pill);
  background: var(--tm-paper-3);
  color: var(--tm-text-2);
  font-size: var(--tm-text-caption);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}

.tm-code {
  overflow-wrap: anywhere;
  padding: .0625rem .375rem;
  border-radius: var(--tm-radius-xs);
  background: var(--tm-primary-tonal);
  color: var(--tm-primary-text);
  font-family: var(--tm-font-mono);
  font-size: .8125em;
}

/* --------------------------------------------------------------------------
 * Baner panelu demonstracyjnego
 * ------------------------------------------------------------------------ */
.tm-demo-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  width: calc(100% - 2rem);
  max-width: 76rem;
  margin: 1.25rem auto 0;
  padding: .75rem 1rem;
  border: 1px solid rgb(var(--tm-warning-ch) / .35);
  border-radius: var(--tm-radius-lg);
  background: rgb(var(--tm-warning-ch) / .08);
  color: var(--tm-text);
}

.tm-demo-banner__icon {
  color: var(--tm-warning-text);
  display: inline-flex;
  align-self: start;
  margin-top: .125rem;
}

.tm-demo-banner__text {
  min-width: 0;
}

@media (max-width: 1199.98px) {
  .tm-demo-banner {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .tm-demo-banner__actions {
    grid-column: 2;
  }
}

.tm-demo-banner__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 0;
  font-size: var(--tm-text-body-sm);
  font-weight: 700;
}

.tm-demo-banner__body {
  color: var(--tm-text-2);
  margin: .125rem 0 0;
  font-size: var(--tm-text-caption);
  line-height: 1.5;
}

.tm-demo-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

@media (min-width: 640px) {
  .tm-demo-banner {
    width: calc(100% - 3rem);
  }
}

@media (min-width: 1024px) {
  .tm-demo-banner {
    width: calc(100% - 4rem);
  }
}

/* --------------------------------------------------------------------------
 * Karta odzyskiwania (granica błędów)
 * ------------------------------------------------------------------------ */
.tm-recovery {
  padding: 2rem 1rem;
}

.tm-recovery__card {
  max-width: 38rem;
  margin: 2rem auto;
  padding: 2.5rem 2rem;
  border: 1px solid var(--tm-border-subtle);
  border-radius: var(--tm-radius-lg);
  background: var(--tm-paper);
  box-shadow: var(--tm-shadow-card);
  text-align: center;
}

.tm-recovery__overline {
  margin: 0 0 1rem;
  font-size: var(--tm-text-overline);
  font-weight: 700;
  letter-spacing: var(--tm-tracking-overline);
  text-transform: uppercase;
  color: var(--tm-text-3);
}

.tm-recovery__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: var(--tm-radius-pill);
  background: var(--tm-danger-tonal);
  color: var(--tm-danger-text);
}

.tm-recovery__icon .tm-icon {
  width: 1.75rem;
  height: 1.75rem;
}

.tm-recovery__title {
  margin: 1rem 0 .5rem;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: var(--tm-tracking-h1);
  color: var(--tm-text);
}

.tm-recovery__text {
  margin: 0;
  font-size: var(--tm-text-body);
  line-height: var(--tm-leading-body);
  color: var(--tm-text-2);
}

.tm-recovery__hint {
  margin: .75rem 0 0;
  font-size: var(--tm-text-body-sm);
  color: var(--tm-text-3);
}

.tm-recovery__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem;
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
 * Nagłówek strony i okruszki
 * ------------------------------------------------------------------------ */
.tm-page-header {
  margin-bottom: 1.5rem;
}

.tm-page-header__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.tm-page-header__main {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  min-width: 0;
  flex: 1 1 20rem;
}

.tm-page-header__identity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  border-radius: var(--tm-radius-md);
  background: var(--tm-primary-tonal);
  color: var(--tm-primary-text);
}

.tm-page-header__titles {
  min-width: 0;
}

.tm-page-header__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
}

.tm-page-header__title {
  margin: 0;
  font-size: var(--tm-text-h1);
  font-weight: 700;
  line-height: var(--tm-leading-h1);
  letter-spacing: var(--tm-tracking-h1);
  color: var(--tm-text);
}

.tm-page-header__subtitle {
  margin: .25rem 0 0;
  font-size: var(--tm-text-body-sm);
  line-height: var(--tm-leading-body-sm);
  color: var(--tm-text-2);
}

.tm-page-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.tm-crumbs {
  margin-bottom: .5rem;
  font-size: var(--tm-text-body-sm);
}

.tm-crumbs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--tm-text-3);
}

.tm-crumbs__item {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}

.tm-crumbs__item a,
.tm-crumbs__back {
  color: var(--tm-text-2);
  text-decoration: none;
}

.tm-crumbs__item a:hover,
.tm-crumbs__back:hover {
  color: var(--tm-primary-text);
  text-decoration: underline;
}

.tm-crumbs__item [aria-current="page"] {
  color: var(--tm-text);
  font-weight: 500;
}

.tm-crumbs__sep {
  width: .875rem;
  height: .875rem;
  flex-shrink: 0;
}

.tm-crumbs__back {
  display: none;
  align-items: center;
  gap: .25rem;
}

@media (max-width: 599.98px) {
  .tm-crumbs__list {
    display: none;
  }

  .tm-crumbs__back {
    display: inline-flex;
  }

  .tm-page-header__actions {
    width: 100%;
  }

  .tm-page-header__actions > * {
    flex: 1 1 auto;
  }
}

/* --------------------------------------------------------------------------
 * Paleta poleceń
 * ------------------------------------------------------------------------ */
.tm-palette-layer {
  position: fixed;
  inset: 0;
  z-index: var(--tm-z-overlay);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 1rem 1rem;
}

.tm-palette__scrim {
  position: absolute;
  inset: 0;
  background: var(--tm-scrim);
}

.tm-palette {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(40rem, 100%);
  max-height: min(34rem, 76vh);
  overflow: hidden;
  border: 1px solid var(--tm-border-subtle);
  border-radius: var(--tm-radius-xl);
  background: var(--tm-paper);
  color: var(--tm-text);
  box-shadow: var(--tm-shadow-dialog);
}

.tm-palette__search {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 3.5rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--tm-border-subtle);
}

.tm-palette__search:focus-within {
  box-shadow: inset 0 -2px 0 var(--tm-focus);
}

.tm-palette__search-icon {
  color: var(--tm-text-3);
}

.tm-palette__input {
  flex: 1;
  min-width: 0;
  height: 3rem;
  border: 0;
  background: transparent;
  color: var(--tm-text);
  font: inherit;
  font-size: var(--tm-text-body);
}

.tm-palette__input:focus,
.tm-palette__input:focus-visible {
  outline: none;
}

.tm-palette__esc {
  cursor: pointer;
}

.tm-palette__results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: .5rem;
  list-style: none;
}

.tm-palette__results ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tm-palette__group-title {
  margin: 0;
  padding: .75rem .75rem .25rem;
  font-size: var(--tm-text-overline);
  font-weight: 700;
  letter-spacing: var(--tm-tracking-overline);
  text-transform: uppercase;
  color: var(--tm-text-3);
}

.tm-palette__option {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 2.75rem;
  padding: .5rem .75rem;
  border-radius: var(--tm-radius-md);
  font-size: var(--tm-text-body-sm);
  cursor: pointer;
}

.tm-palette__option:hover {
  background: var(--tm-paper-3);
}

.tm-palette__option[aria-selected="true"] {
  background: var(--tm-primary-tonal);
  color: var(--tm-primary-text);
  font-weight: 600;
}

.tm-palette__option-icon {
  color: inherit;
}

.tm-palette__option-label {
  flex: 1;
  min-width: 0;
}

.tm-palette__option-group {
  font-size: var(--tm-text-caption);
  font-weight: 500;
  color: var(--tm-text-3);
}

.tm-palette__empty {
  padding: 2rem 1rem;
  text-align: center;
}

.tm-palette__empty-title {
  margin: 0;
  font-weight: 600;
}

.tm-palette__empty-text {
  margin: .25rem 0 0;
  font-size: var(--tm-text-body-sm);
  color: var(--tm-text-2);
}

.tm-palette__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: .625rem 1rem;
  border-top: 1px solid var(--tm-border-subtle);
  background: var(--tm-paper-2);
  font-size: var(--tm-text-caption);
  color: var(--tm-text-3);
}

/* --------------------------------------------------------------------------
 * Punkty przerwania powłoki
 * ------------------------------------------------------------------------ */

/* md: szyna 72 px; rozwinięcie przyciskiem nakłada się na treść. */
@media (min-width: 900px) and (max-width: 1199.98px) {
  .tm-shell {
    --shell-nav-w: var(--tm-layout-nav-rail);
  }

  .tm-shell[data-flyout-open="true"] .tm-shell__nav {
    width: var(--tm-layout-nav);
    box-shadow: var(--tm-shadow-overlay);
  }
}

/* lg+: szerokość według wyboru użytkownika. */
@media (min-width: 1200px) {
  .tm-shell[data-nav-collapsed="true"] {
    --shell-nav-w: var(--tm-layout-nav-rail);
  }
}

/* xs-sm: szuflada modalna z przyciskiem menu w pasku. */
@media (max-width: 899.98px) {
  .tm-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .tm-shell__body {
    grid-column: 1;
  }

  .tm-shell__nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: var(--tm-z-overlay);
    width: min(18rem, calc(100vw - 3rem));
    transform: translateX(-100%);
    visibility: hidden;
    box-shadow: none;
    transition: transform var(--tm-dur-slow) var(--tm-ease-out), visibility 0s linear var(--tm-dur-slow);
  }

  .tm-shell[data-drawer-open="true"] .tm-shell__nav {
    transform: none;
    visibility: visible;
    box-shadow: var(--tm-shadow-dialog);
    transition: transform var(--tm-dur-slow) var(--tm-ease-out), visibility 0s;
  }

  .tm-shell__scrim {
    position: fixed;
    inset: 0;
    z-index: calc(var(--tm-z-overlay) - 1);
    background: var(--tm-scrim);
  }

  .tm-icon-btn.tm-nav__close,
  .tm-icon-btn.tm-topbar__menu {
    display: inline-flex;
  }

  .tm-topbar {
    padding: 0 var(--tm-layout-gutter-sm);
  }

  .tm-nav__collapse {
    display: none;
  }

  .tm-search-trigger {
    min-width: 0;
  }

  .tm-nav__item,
  .tm-popover__item,
  .tm-palette__option {
    min-height: var(--tm-target-touch);
  }

  .tm-search-trigger,
  .tm-account-btn {
    height: var(--tm-target-touch);
  }

  /* components.css sizes .tm-icon-btn from --ib; the shell only raises it to the touch target. */
  .tm-topbar .tm-icon-btn,
  .tm-nav__head .tm-icon-btn {
    --ib: var(--tm-target-touch);
  }
}

@media (max-width: 1199.98px) {
  .tm-search-trigger__kbd {
    display: none;
  }

  .tm-search-trigger {
    min-width: 11rem;
  }
}

@media (max-width: 599.98px) {
  .tm-search-trigger {
    width: var(--tm-target-touch);
    min-width: 0;
    padding: 0;
    justify-content: center;
  }

  .tm-search-trigger__label,
  .tm-icon-btn.tm-topbar__hide-xs,
  .tm-topbar__parent,
  .tm-topbar__sep {
    display: none;
  }

  .tm-demo-banner__actions {
    grid-column: 1 / -1;
  }

  .tm-topbar__actions {
    gap: .375rem;
  }

  .tm-palette-layer {
    padding: .5rem;
  }

  .tm-palette {
    max-height: calc(100dvh - 1rem);
  }

  .tm-popover {
    position: fixed;
    top: calc(var(--tm-layout-topbar) + .25rem);
    right: .75rem;
    left: .75rem;
    width: auto;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tm-shell,
  .tm-shell__nav,
  .tm-nav__item,
  .tm-nav__collapse,
  .tm-icon-btn,
  .tm-btn,
  .tm-search-trigger {
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .tm-nav__item[data-active="true"] {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }

  .tm-palette__option[aria-selected="true"] {
    outline: 2px solid Highlight;
  }

  .tm-shell__nav,
  .tm-popover,
  .tm-palette {
    border: 1px solid CanvasText;
  }
}

.tm-recovery__icon--info {
  background: var(--tm-info-tonal);
  color: var(--tm-info-text);
}
