/* App shell: sidebar, topbar, page frame. */

.shell { display: grid; grid-template-columns: 258px 1fr; height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: var(--s3) var(--s3) var(--s2);
  gap: var(--s3);
  overflow-y: auto;
  z-index: var(--z-nav);
}

.workspace {
  display: flex; gap: 10px; align-items: center;
  padding: var(--s1) var(--s2) 0;
}
.ws-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(145deg, var(--brand-hover), var(--brand));
  color: #fff; display: grid; place-items: center;
  font-family: var(--display); font-size: 15px;
  box-shadow: var(--e2), var(--hairline);
}
.ws-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.ws-meta strong { font-size: var(--t-md); letter-spacing: -.012em; }
.ws-meta span {
  font-size: var(--t-xs); color: var(--fg-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ⌘K launcher doubles as the sidebar search affordance */
.cmd-trigger {
  display: flex; align-items: center; gap: var(--s2);
  width: 100%; min-height: 36px; padding: 0 10px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--fg-3);
  font-size: var(--t-sm); cursor: pointer; text-align: left;
  transition: border-color var(--d-base) var(--ease), box-shadow var(--d-base) var(--ease), color var(--d-base) var(--ease);
}
.cmd-trigger:hover { border-color: var(--border-strong); color: var(--fg-2); box-shadow: var(--e1); }
.cmd-trigger kbd {
  margin-left: auto; font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px; color: var(--fg-3);
}

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  margin: var(--s4) 0 var(--s1); padding: 0 10px;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg-3); font-weight: 650;
}
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 36px; padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--fg-2); font-size: var(--t-md);
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .78; transition: opacity var(--d-fast) var(--ease); }
.nav a:hover { background: var(--surface-3); color: var(--fg); }
.nav a:hover svg { opacity: 1; }
.nav a.active {
  background: var(--surface-1); color: var(--brand-text); font-weight: 600;
  box-shadow: var(--e1);
}
.nav a.active svg { opacity: 1; }
/* Sliding accent marker on the active row */
.nav a.active::before {
  content: ''; position: absolute; left: -13px; top: 50%;
  width: 3px; height: 18px; margin-top: -9px;
  background: var(--brand); border-radius: 0 3px 3px 0;
  animation: markerIn var(--d-slow) var(--ease);
}
@keyframes markerIn { from { height: 0; margin-top: 0; opacity: 0 } }

.nav a .badge {
  margin-left: auto; font-size: 10.5px; font-weight: 650;
  background: var(--clay); color: #fff; border-radius: 99px;
  padding: 1px 6px; min-width: 19px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.nav a .badge:empty { display: none; }

.sidebar-foot {
  margin-top: auto; display: flex; align-items: center; gap: var(--s2);
  font-size: var(--t-xs); color: var(--fg-3);
  padding: 10px var(--s2) var(--s1); border-top: 1px solid var(--border);
}

/* ── Topbar ────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  height: 58px; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: 0 var(--s6);
  background: var(--surface-glass);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-sticky);
}
.crumbs {
  font-size: var(--t-md); color: var(--fg-3);
  display: flex; align-items: center; gap: var(--s2); min-width: 0;
}
.crumbs b { color: var(--fg); font-weight: 600; }
.crumbs a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.crumbs .sep { opacity: .45; }

.topbar-right { display: flex; align-items: center; gap: var(--s3); }

.who { display: flex; align-items: center; gap: var(--s2); padding-left: var(--s3); border-left: 1px solid var(--border); }
.who div { display: flex; flex-direction: column; line-height: 1.25; }
.who strong { font-size: var(--t-sm); }
.who span { font-size: var(--t-xs); color: var(--fg-3); }

/* ── Page frame ────────────────────────────────────────────── */
.view {
  overflow-y: auto; scroll-behavior: smooth;
  padding: var(--s6) var(--s6) var(--s12);
}
.view > * { animation: viewIn var(--d-slow) var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px) } }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s5); margin-bottom: var(--s5); flex-wrap: wrap;
}
.page-head h1 {
  font-family: var(--display); font-size: var(--t-3xl); font-weight: 400;
  letter-spacing: -.018em; line-height: 1.12; margin-bottom: 6px;
}
.page-head p { color: var(--fg-3); font-size: var(--t-md); max-width: 64ch; }
.head-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

h2.sect {
  font-family: var(--display); font-size: var(--t-xl); font-weight: 400;
  letter-spacing: -.012em; margin: var(--s8) 0 var(--s3);
  display: flex; align-items: center; gap: var(--s2);
}
h2.sect:first-child { margin-top: 0; }
h2.sect > svg { width: 18px; height: 18px; color: var(--fg-3); }
.sect-note { color: var(--fg-3); font-size: var(--t-sm); margin: calc(var(--s2) * -1) 0 var(--s4); max-width: 76ch; }

.grid { display: grid; gap: var(--s3); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-sidebar { grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); align-items: start; }

@media (max-width: 1240px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-3, .g-sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .view { padding: var(--s4) var(--s4) var(--s12); }
  .g-4, .g-2 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: var(--t-2xl); }
  .who div { display: none; }
}
