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

:root {
  --sidebar-bg: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(8, 17, 31, 0.98));
  --sidebar-border: rgba(148, 163, 184, 0.18);
  --sidebar-panel: rgba(15, 23, 42, 0.88);
  --sidebar-link-hover: rgba(56, 189, 248, 0.12);
  --sidebar-link-active: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(139, 92, 246, 0.18));
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;
  --sidebar-brand-bg: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(139, 92, 246, 0.28));
  --sidebar-button-bg: rgba(15, 23, 42, 0.88);
  --sidebar-button-border: rgba(148, 163, 184, 0.18);
  --sidebar-button-text: #f8fafc;
  --sidebar-logout-bg: rgba(56, 189, 248, 0.18);
  --sidebar-logout-hover: rgba(56, 189, 248, 0.28);
}


.sidebar-shell {
  width: 100%;
  min-width: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 24px 18px;
  transition: width 0.22s ease, min-width 0.22s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  align-self: start;
}

.sidebar-shell.collapsed {
  width: 88px;
  min-width: 88px;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100%;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-brand-copy {
  min-width: 0;
}

.sidebar-brand-copy strong,
.sidebar-brand-copy span {
  color: var(--sidebar-text);
}

.sidebar-brand-copy span {
  color: var(--sidebar-muted);
}

.sidebar-toggle {
  border: 1px solid var(--sidebar-button-border);
  border-radius: 999px;
  background: var(--sidebar-button-bg);
  color: var(--sidebar-button-text);
  padding: 8px 10px;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.sidebar-toggle:hover {
  transform: translateY(-1px);
}

.sidebar-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(139, 92, 246, 0.28));
  color: #f8fafc;
  font-size: 1.1rem;
}

.sidebar-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-brand-copy strong {
  font-size: 0.98rem;
}

.sidebar-brand-copy span {
  color: #94a3b8;
  font-size: 0.82rem;
}

.sidebar-toggle {
  align-self: flex-start;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  padding: 8px 10px;
  cursor: pointer;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-link {
  border: 0;
  background: transparent;
  color: #e2e8f0;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-link:hover {
  background: rgba(56, 189, 248, 0.12);
  transform: translateX(1px);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(139, 92, 246, 0.18));
}

.sidebar-link-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.82);
  font-size: 1rem;
}

.sidebar-link-text {
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-shell.collapsed .sidebar-brand-copy,
.sidebar-shell.collapsed .sidebar-link-text,
.sidebar-shell.collapsed .sidebar-footer-copy {
  display: none;
}

.sidebar-shell.collapsed .sidebar-link {
  justify-content: center;
  padding-inline: 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-user-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-user-label {
  font-size: 0.78rem;
  color: #94a3b8;
}

.sidebar-user-email {
  font-size: 0.92rem;
  color: #f8fafc;
  word-break: break-all;
}

.sidebar-logout-btn {
  border: 0;
  border-radius: 14px;
  background: rgba(56, 189, 248, 0.18);
  color: #f8fafc;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-logout-btn:hover {
  background: rgba(56, 189, 248, 0.28);
  transform: translateY(-1px);
}

.sidebar-logout-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.sidebar-logout-text {
  margin-left: 10px;
}

.sidebar-shell.collapsed .sidebar-user-summary,
.sidebar-shell.collapsed .sidebar-logout-text,
.sidebar-shell.collapsed .sidebar-footer-copy {
  display: none;
}

.sidebar-shell.collapsed .sidebar-footer {
  padding: 12px 0;
  background: transparent;
  border: none;
  gap: 0;
  align-items: center;
  justify-content: center;
}

.sidebar-shell.collapsed .sidebar-logout-btn {
  justify-content: center;
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.18);
}

.sidebar-shell.collapsed .sidebar-logout-icon {
  width: 24px;
  height: 24px;
}

.sidebar-footer-copy {
  margin: 0;
  color: #94a3b8;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .sidebar-shell {
    width: 100%;
    min-width: 100%;
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  }

  .sidebar-shell.collapsed {
    width: 100%;
    min-width: 100%;
  }

  .sidebar-shell.collapsed .sidebar-link {
    justify-content: flex-start;
    padding-inline: 14px;
  }

  .sidebar-shell.collapsed .sidebar-brand-copy,
  .sidebar-shell.collapsed .sidebar-link-text,
  .sidebar-shell.collapsed .sidebar-footer-copy {
    display: block;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
