/* ---------------------------------------------------------------------------
   App shell: sidebar + main
   --------------------------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100%;
}

.main {
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.mobile-topbar {
  display: none;
}

/* ---------------------------------------------------------------------------
   Sidebar
   --------------------------------------------------------------------------- */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 10px 8px 8px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px 14px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 700;
  flex: none;
}

.brand-name {
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 14px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 14.5px;
  text-align: left;
  transition: background-color 100ms var(--ease), color 100ms var(--ease);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--bg-active);
  color: var(--text);
  font-weight: 500;
}

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

.nav-item.is-active .nav-icon,
.nav-item:hover .nav-icon {
  color: var(--text-2);
}

.nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.sidebar-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 6px 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
}

.sidebar-projects {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.project-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 5px;
  background: var(--bg-active);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 600;
}

.project-dot-lg {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 13px;
}

.sidebar-empty {
  padding: 6px 8px;
  font-size: 13px;
  color: var(--text-4);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 2px 0 6px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.sidebar-user-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.sidebar-user-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-handle {
  font-size: 12.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-scrim {
  display: none;
}

/* ---------------------------------------------------------------------------
   Pages
   --------------------------------------------------------------------------- */
.view {
  min-height: 100%;
}

.page {
  /* Use the full width of the window, with side padding that grows on big screens. */
  padding: 40px clamp(24px, 3.5vw, 72px) 96px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.page-eyebrow {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.page-title {
  font-size: 34px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 84vw);
    z-index: 300;
    transform: translateX(-102%);
    transition: transform 200ms var(--ease);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.35);
  }

  .app.sidebar-open .sidebar {
    transform: none;
  }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 290;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms var(--ease);
  }

  .app.sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 8px;
    background: rgba(25, 25, 25, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
  }

  .mobile-topbar-title {
    font-weight: 600;
  }

  .page {
    padding: 24px 16px 80px;
  }

  .page-title {
    font-size: 26px;
  }

  .hide-sm {
    display: none !important;
  }
}

/* The panel host only holds fixed-position children; keep it out of the grid. */
.panel-host {
  display: contents;
}
