.public-shell {
  min-height: 100vh;
}

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

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-5);
  background: rgba(248, 251, 255, 0.88);
  border-right: 1px solid var(--border-subtle);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  z-index: var(--z-fixed);
}

.sidebar-brand {
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-primary);
}

.sidebar-brand__link:hover {
  color: var(--text-primary);
}

.sidebar-brand__mark {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.95rem;
  background: var(--gradient-primary);
  color: var(--text-inverse);
  font-family: var(--font-display);
  font-weight: var(--font-extrabold);
  box-shadow: var(--shadow-primary);
}

.sidebar-brand__copy {
  display: grid;
  gap: 0.1rem;
}

.sidebar-brand__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-tight);
}

.sidebar-brand__caption {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding-right: var(--space-1);
}

.nav-group + .nav-group {
  margin-top: var(--space-6);
}

.nav-group__label {
  margin-bottom: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
}

.nav-list {
  list-style: none;
  padding: 0;
}

.nav-item + .nav-item {
  margin-top: var(--space-1);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  color: var(--text-secondary);
}

.nav-link:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-brand-primary);
}

.nav-link.is-active {
  background: var(--color-primary-100);
  color: var(--text-brand-primary);
  font-weight: var(--font-semibold);
}

.nav-link__icon {
  display: inline-flex;
  width: 1.15rem;
  height: 1.15rem;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-link__label {
  line-height: 1;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.sidebar-user__info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
}

.sidebar-user__info:hover {
  background: rgba(59, 130, 246, 0.06);
}

.sidebar-user__avatar,
.header-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  color: var(--text-inverse);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  flex-shrink: 0;
}

.sidebar-user__details {
  display: grid;
  min-width: 0;
}

.sidebar-user__name,
.header-user-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.sidebar-user__role,
.header-user-role {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.sidebar-logout-btn {
  display: inline-flex;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-muted);
}

.sidebar-logout-btn:hover {
  color: var(--text-danger-strong);
  border-color: color-mix(in srgb, var(--color-danger-200) 80%, white);
  background: var(--color-danger-50);
}

.role-avatar--admin { background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.role-avatar--landlord { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.role-avatar--agent { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.role-avatar--tenant { background: linear-gradient(135deg, #047857, #10b981); }
.role-avatar--assistant { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.role-avatar--vendor { background: linear-gradient(135deg, #b45309, #f59e0b); }
.role-avatar--caretaker { background: linear-gradient(135deg, #475569, #64748b); }

.app-main {
  grid-column: 2;
  min-width: 0;
  padding: var(--content-padding);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-height);
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border: 1px solid rgba(232, 238, 246, 0.92);
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-right {
  margin-left: auto;
}

.header-meta {
  display: grid;
  gap: 0.15rem;
}

.header-meta__eyebrow {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
}

.header-meta__title {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: var(--font-bold);
}

.nav-toggle,
.header-icon-btn {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-secondary);
}

.nav-toggle:hover,
.header-icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.app-content {
  width: min(100%, var(--content-max-width));
}

.header-notifications-dropdown,
.header-user-menu {
  position: relative;
}

.header-notifications-dropdown > summary,
.header-user-menu > summary {
  list-style: none;
  cursor: pointer;
}

.header-notifications-dropdown > summary::-webkit-details-marker,
.header-user-menu > summary::-webkit-details-marker {
  display: none;
}

.notification-badge {
  position: absolute;
  top: 0.3rem;
  right: 0.2rem;
  display: none;
  min-width: 1.2rem;
  height: 1.2rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  border-radius: var(--radius-full);
  background: var(--color-danger-600);
  color: var(--text-inverse);
  font-size: 0.7rem;
  font-weight: var(--font-bold);
}

.header-notifications-panel,
.header-user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.75rem);
  width: min(23rem, 88vw);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.header-user-summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.9);
}

.header-user-info {
  display: grid;
}

.notifications-panel__header,
.header-user-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.header-user-dropdown__header {
  display: grid;
}

.notifications-panel__title,
.header-user-dropdown__name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
}

.header-user-dropdown__email {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.notifications-panel__view-all {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.notifications-panel__content {
  max-height: 24rem;
  overflow-y: auto;
  padding: var(--space-2);
}

.notifications-loading,
.notifications-empty {
  padding: var(--space-5);
  color: var(--text-muted);
  text-align: center;
}

.notification-item-dropdown {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  cursor: pointer;
}

.notification-item-dropdown:hover,
.notification-item-dropdown--unread {
  background: var(--color-primary-50);
}

.notification-item-dropdown__header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.notification-item-dropdown__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.notification-item-dropdown__content,
.notification-item-dropdown__channel,
.notification-item-dropdown__time {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.header-user-dropdown__item {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
}

.header-user-dropdown__item:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.header-user-dropdown__item--danger:hover {
  background: var(--color-danger-50);
  color: var(--text-danger-strong);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 32, 51, 0.44);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
  z-index: calc(var(--z-fixed) - 1);
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(18rem, 34rem) minmax(0, 1fr);
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(191, 215, 255, 0.55), transparent 24%),
    linear-gradient(135deg, #eef4ff 0%, #f7f9fc 45%, #e9f0fb 100%);
}

.auth-shell__aside {
  display: grid;
  align-content: space-between;
  gap: var(--space-10);
  padding: clamp(1.5rem, 3vw, 3rem);
  background: rgba(17, 24, 39, 0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.45);
}

.auth-shell__brand-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-primary);
}

.auth-shell__brand-mark {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  background: var(--gradient-primary);
  color: var(--text-inverse);
  font-family: var(--font-display);
  font-weight: var(--font-extrabold);
}

.auth-shell__brand-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
}

.auth-shell__eyebrow {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
}

.auth-shell__title {
  font-size: clamp(2.1rem, 4vw, 3.5rem);
  line-height: 1;
}

.auth-shell__summary {
  max-width: 42ch;
  margin-top: var(--space-4);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

.auth-shell__aside-notes {
  display: grid;
  gap: var(--space-3);
}

.auth-shell__note {
  padding: var(--space-4);
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.4);
  color: var(--text-secondary);
}

.auth-shell__main {
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 4vw, 4rem);
}

.auth-shell__content {
  width: min(100%, 36rem);
}

@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

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

  .app-main {
    grid-column: 1;
  }

  .header-user-info {
    display: none;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-shell__aside {
    display: none;
  }
}

@media (max-width: 720px) {
  .app-main {
    padding: 0.85rem;
  }

  .app-header {
    padding: var(--space-4);
  }

  .header-meta__title {
    font-size: var(--text-xl);
  }

  .header-user-summary {
    padding-right: 0;
  }
}
