.app-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.18s ease;
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: var(--sidebar-padding-y) var(--sidebar-padding-x);
  overflow: hidden;
  border-right: 1px solid #263244;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  width: var(--sidebar-width);
  transition: width 0.18s ease, box-shadow 0.18s ease;
}

.app-sidebar__brand-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-bottom: 8px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  color: var(--sidebar-text);
  font-size: 16px;
  font-weight: 750;
  min-width: 0;
  flex: 1 1 auto;
}

.app-brand:hover {
  text-decoration: none;
}

.app-brand__mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--color-primary);
  font-size: 12px;
}

.app-brand__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar__pin {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: var(--sidebar-item-radius);
  background: transparent;
  color: #98a2b3;
  cursor: pointer;
}

.app-sidebar__pin:hover,
.app-sidebar__pin.is-active {
  border-color: #475467;
  background: #1d2939;
  color: #fff;
}

.app-sidebar__pin.is-active .app-icon {
  transform: rotate(-35deg);
}

.app-nav {
  display: grid;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.app-nav::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.app-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 6px 9px;
  border-radius: var(--sidebar-item-radius);
  color: var(--sidebar-text);
  font-weight: 650;
}

.app-nav a:hover,
.app-nav a.is-active {
  background: var(--sidebar-active-bg);
  color: #fff;
  text-decoration: none;
}

.app-nav a.is-active {
  box-shadow: inset 3px 0 #84adff;
}

.app-nav__label {
  margin-top: 5px;
  padding: 3px 9px 1px;
  color: #98a2b3;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-sidebar__footer {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 8px 6px 0;
  border-top: 1px solid #344054;
}

.app-user {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.app-user__row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.app-user__row > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-user__actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}

.app-user__action {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #98a2b3;
}

.app-user__action:hover,
.app-user__action.is-active {
  border-color: #475467;
  background: #1d2939;
  color: #fff;
  text-decoration: none;
}

.app-user__action .app-icon {
  width: 15px;
  height: 15px;
}

.app-user span {
  color: #98a2b3;
  font-size: 11px;
}

.app-sidebar .button--ghost {
  width: 100%;
  border-color: #475467;
  color: #fff;
}

.app-logout {
  gap: 8px;
  min-height: 30px;
  padding: 5px 8px;
}

.app-logout .app-icon {
  width: 16px;
  height: 16px;
}

.app-main {
  min-width: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--header-height);
  padding: var(--header-padding-y) var(--header-padding-x);
  border-bottom: 1px solid var(--header-border);
  background: var(--header-bg);
  backdrop-filter: blur(8px);
}

.app-header__title {
  min-width: 0;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.app-header h1 {
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header-links {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.app-header-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--header-link-radius);
  background: var(--color-surface-soft);
  color: var(--color-text);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.app-header-link:hover,
.app-header-link.is-active {
  border-color: #84adff;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  text-decoration: none;
}

.app-header-link .app-icon {
  width: 17px;
  height: 17px;
}

.app-header-link.is-icon-only {
  width: 38px;
  padding: 7px;
  justify-content: center;
}

.app-header-link.is-icon-only span {
  display: none;
}

.app-notifications {
  position: relative;
  flex: 0 0 auto;
}

.app-notifications__bell {
  position: relative;
  cursor: pointer;
}

.app-header-link.is-icon-only .app-notifications__count {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid var(--header-bg);
  border-radius: 999px;
  background: var(--color-danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.app-notifications__count[hidden] {
  display: none !important;
}

.app-notifications__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(370px, calc(100vw - 28px));
  max-height: min(520px, calc(100dvh - var(--header-height) - 28px));
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: 0 18px 46px rgba(16, 24, 40, 0.22);
}

.app-notifications__dropdown > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-soft);
}

.app-notifications__dropdown > header button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.app-notifications__list {
  max-height: min(460px, calc(100dvh - var(--header-height) - 82px));
  overflow-y: auto;
}

.app-notifications__item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}

.app-notifications__item:hover,
.app-notifications__item:focus-visible {
  background: var(--color-primary-soft);
  outline: none;
}

.app-notifications__item strong {
  font-size: 12px;
}

.app-notifications__item p,
.app-notifications__item small,
.app-notifications__empty {
  margin: 0;
  color: var(--color-muted);
  font-size: 10px;
}

.app-notifications__item p {
  font-size: 11px;
}

.app-notifications__empty {
  padding: 18px 12px;
  text-align: center;
}

.app-notifications__empty.is-error {
  color: var(--color-danger);
}

.app-content {
  min-width: 0;
  padding: var(--content-padding-y) var(--content-padding-x) calc(var(--content-padding-y) + 10px);
}

.public-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(100%, 420px);
  padding: 28px;
}

.login-card__brand {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 20px;
  border-radius: 11px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 800;
}

.login-card h1 {
  margin-bottom: 8px;
  font-size: 24px;
}

.login-card__intro {
  margin-bottom: 22px;
  color: var(--color-muted);
}

.login-card__notice {
  margin: -8px 0 18px;
  padding: 10px 12px;
  border: 1px solid #fdb022;
  border-radius: var(--radius-sm);
  background: #fffaeb;
  color: #93370d;
  font-size: 12px;
}

@media (min-width: 821px) {
  .app-shell.is-sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
  }

  .app-shell.is-sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .app-shell.is-sidebar-collapsed .app-sidebar:hover,
  .app-shell.is-sidebar-collapsed .app-sidebar:focus-within {
    width: var(--sidebar-width);
    box-shadow: 12px 0 30px rgba(16, 24, 40, 0.22);
  }

  .app-shell.is-sidebar-collapsed .app-sidebar:not(:hover):not(:focus-within) .app-brand__name,
  .app-shell.is-sidebar-collapsed .app-sidebar:not(:hover):not(:focus-within) .app-nav a span,
  .app-shell.is-sidebar-collapsed .app-sidebar:not(:hover):not(:focus-within) .app-nav__label,
  .app-shell.is-sidebar-collapsed .app-sidebar:not(:hover):not(:focus-within) .app-user,
  .app-shell.is-sidebar-collapsed .app-sidebar:not(:hover):not(:focus-within) .app-logout span {
    display: none;
  }

  .app-shell.is-sidebar-collapsed .app-sidebar:not(:hover):not(:focus-within) .app-brand,
  .app-shell.is-sidebar-collapsed .app-sidebar:not(:hover):not(:focus-within) .app-nav a,
  .app-shell.is-sidebar-collapsed .app-sidebar:not(:hover):not(:focus-within) .app-logout {
    justify-content: center;
  }

  .app-shell.is-sidebar-collapsed .app-sidebar:not(:hover):not(:focus-within) .app-sidebar__brand-row {
    flex-direction: column;
  }

  .app-shell.is-sidebar-collapsed .app-sidebar:not(:hover):not(:focus-within) .app-sidebar__footer {
    padding-right: 0;
    padding-left: 0;
  }
}

@media (max-width: 1100px) {
  .app-header-link span {
    display: none;
  }

  .app-header-link {
    width: 38px;
    padding: 7px;
    justify-content: center;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    overflow: visible;
    box-sizing: border-box;
    border-right: 0;
    border-bottom: 1px solid #263244;
  }

  .app-main {
    width: 100%;
    min-width: 0;
  }

  .app-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .app-nav__label {
    grid-column: 1 / -1;
  }

  .app-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }

  .app-header-links {
    overflow-x: auto;
  }

  .app-header-actions {
    width: 100%;
  }

  .app-header-links {
    flex: 1 1 auto;
  }

  .app-notifications__dropdown {
    position: fixed;
    top: 68px;
    right: 14px;
    left: 14px;
    width: auto;
  }

  .app-header-link {
    width: auto;
    flex: 0 0 auto;
  }

  .app-header-link span {
    display: inline;
  }

  .app-content {
    padding: 14px;
  }
}
