/* ============ App shell ============ */
.shell {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  height: 100vh;
}

/* ---- Sidebar ---- */
.nav {
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--nav-line);
  overflow-y: auto;
}

.nav-brand {
  padding: 22px 20px 20px;
  border-bottom: 1px solid var(--nav-line);
}

.nav-brand .mark {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  display: block;
}

.nav-brand .mark em {
  font-style: normal;
  color: var(--accent);
}

.nav-brand .sub {
  font-size: 11px;
  color: var(--nav-text-dim);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.nav-group { padding: 16px 0 4px; }

.nav-group-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nav-text-dim);
  padding: 0 20px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 20px;
  font-size: 13.5px;
  color: var(--nav-text);
  text-align: left;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover { background: var(--nav-surface); }

.nav-item.is-active {
  background: var(--nav-surface);
  border-left-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.nav-item.is-sub { padding-left: 34px; font-size: 13px; }

.nav-item .ico { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.85; }
.nav-item.is-active .ico { opacity: 1; }

.nav-foot {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--nav-line);
  font-size: 11px;
  color: var(--nav-text-dim);
  line-height: 1.5;
}

.nav-tagline {
  color: var(--nav-text);
  font-size: 12.5px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--nav-line);
}

.nav-office { color: var(--nav-text-dim); }

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

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar .office {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.topbar .office-name { font-size: 15px; font-weight: 600; }
.topbar .office-meta { font-size: 11.5px; color: var(--text-3); }

.topbar .user {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text-2);
}

.topbar .avatar {
  width: 26px;
  height: 26px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
}

/* ---- Context bar: the selected space persists across pages ---- */
.contextbar {
  height: var(--contextbar-h);
  flex-shrink: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.contextbar .cb-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.contextbar .cb-space {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
}

.contextbar .cb-swatch {
  width: 3px;
  height: 17px;
  background: var(--accent);
}

.contextbar .cb-facts {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--text-3);
  margin-left: 2px;
}

.contextbar .cb-facts b {
  color: var(--text-2);
  font-weight: 500;
}

.contextbar .cb-actions { margin-left: auto; display: flex; gap: 8px; }

.contextbar .cb-empty { font-size: 13px; color: var(--text-3); }

/* ---- Page body ---- */
.page {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  min-height: 0;
}

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 19px; margin-bottom: 4px; }
.page-head .desc { font-size: 13px; color: var(--text-3); }

/* Split: stage (map) + side panel */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  gap: 16px;
  align-items: start;
}

.stack { display: flex; flex-direction: column; gap: 16px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

@media (max-width: 1240px) {
  .split { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 64px 1fr; }
  .nav-brand .sub, .nav-group-label, .nav-item span, .nav-foot { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
