/* Layout-level rules: page shells, sidebars, grids. */

.page-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-8) var(--space-4);
  background:
    radial-gradient(ellipse at top, var(--color-accent-soft), transparent 60%),
    var(--color-bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}

/* Phase 52 — passwordless magic-link block on the auth pages. */
.magic-block {
  margin-top: var(--space-5);
}
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin: var(--space-4) 0;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.auth-divider span {
  padding: 0 var(--space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-serif);
  font-size: var(--font-size-xl);
  color: var(--color-text);
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
}

.page-app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--color-bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 5;
}

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

.main-content {
  padding: var(--space-6) var(--space-8);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.page-workspace {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--color-bg);
  /* Guard rail: nothing inside the workspace shell should ever
     introduce horizontal page scroll. Pages that genuinely need
     wide content (the coding three-pane view) opt out by overriding
     overflow on the inner .workspace-main. Without this, a stray
     wide element (or scrollIntoView on a deeply nested target)
     could leave the whole shell scrolled right, hiding the sidebar
     and cutting off cards. */
  overflow-x: hidden;
}

.workspace-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 56px);
  min-width: 0;
}

@media (max-width: 960px) {
  .workspace-body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  overflow-y: auto;
}

.sidebar h2 {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.sidebar-section { display: flex; flex-direction: column; gap: var(--space-1); }

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--font-size-body);
  transition: background 120ms ease;
}
.sidebar-link:hover { background: var(--color-surface-alt); }
.sidebar-link.is-active { background: var(--color-accent-soft); color: var(--color-accent-hover); font-weight: 600; }
.sidebar-link.is-disabled { color: var(--color-text-muted); cursor: not-allowed; }

.workspace-main {
  padding: var(--space-6) var(--space-8);
  overflow-x: auto;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-5);
}
