/* ─────────────────────────────────────────────────────────────────────────────
 * shell.css — Scout v2 app shell (Phase A).
 * Left sidebar + topbar (breadcrumb/search) + #page region, matching the Hemut
 * command-interface design language: white surfaces, 1px --line borders, gold
 * accent, grouped sidebar with descriptions.
 * ADDITIVE: loads after styles.css/scout.css and re-seats the v58 overlays
 * inside #page. Every v58 DOM id survives; the legacy #topbar stays in the DOM
 * (app.js + scout.js bind into it) but is hidden — the sidebar forwards to it.
 * ──────────────────────────────────────────────────────────────────────────── */

body { display: flex; }

/* Legacy command bar: kept for JS bindings, never shown. */
#topbar { display: none !important; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
#sidebar {
  width: 236px; flex: none; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line);
  z-index: 1300; overflow: hidden;
  transition: width var(--dur-2) var(--ease-out);
}
body.rail #sidebar { width: 62px; }

.sb-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  height: 56px; padding: 0 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.sb-head .brandlogo { height: 22px; width: auto; flex: none; cursor: pointer; }
.sb-wordwrap { display: flex; flex-direction: column; min-width: 0; }
.sb-wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  letter-spacing: .3px; color: var(--text); line-height: 1.1;
}
.sb-wordmark .gold { color: var(--gold-text); }
.sb-tag {
  font-family: var(--font-mono); font-size: 9px; color: var(--text-dim);
  letter-spacing: .3px; overflow: hidden; text-overflow: ellipsis;
}
body.rail .sb-wordwrap { display: none; }

.sb-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 10px 10px 12px; }
.sb-nav::-webkit-scrollbar { width: 8px; }
.sb-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

.sb-group {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: 1.6px; text-transform: uppercase; color: var(--text-dim);
  padding: 16px 8px 6px; white-space: nowrap;
}
body.rail .sb-group { visibility: hidden; padding: 10px 0 0; height: 0; }

.sb-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  color: var(--text); font-family: var(--font-body); font-size: 13px; font-weight: 500;
  padding: 8px 10px; border-radius: 8px; white-space: nowrap;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.sb-item:hover { background: var(--surface-hover); }
.sb-item.on { background: var(--gold-dim); color: var(--gold-text); }
.sb-item svg { width: 16px; height: 16px; flex: none; color: var(--text-dim); }
.sb-item.on svg { color: var(--gold-text); }
.sb-lbl { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.sb-badge {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--text-dim);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 7px; flex: none;
}
.sb-badge.nonzero { background: var(--gold-dim); color: var(--gold-text); border-color: var(--gold-deep); }
body.rail .sb-lbl, body.rail .sb-badge { display: none; }
body.rail .sb-item { justify-content: center; padding: 9px 0; }

/* theme segment (lives in the profile menu since v60) */
.sb-theme { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.sb-theme button {
  border: none; background: var(--panel); color: var(--text-dim); cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .6px; text-transform: uppercase; padding: 4px 10px;
}
.sb-theme button.on { background: var(--gold); color: var(--gold-ink); }

/* ── Workspace: shellbar + page ─────────────────────────────────────────── */
#workspace { flex: 1 1 auto; min-width: 0; height: 100vh; display: flex; flex-direction: column; }

#shellbar {
  flex: none; height: 56px; display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-4); background: var(--panel); border-bottom: 1px solid var(--line);
  position: relative; z-index: 1100;
}
.shellbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: none; cursor: pointer;
  background: none; border: none; border-radius: 8px; color: var(--text-dim);
}
.shellbtn:hover { background: var(--surface-hover); color: var(--text); }
.shellbtn svg { width: 17px; height: 17px; }

#crumb { font-size: 13px; color: var(--text-dim); white-space: nowrap; flex: none; }
#crumb .crumb-sep { margin: 0 7px; opacity: .55; }
#crumbHere { color: var(--text); font-weight: 600; }

/* item 9: Hemut bar pattern — breadcrumb hugs the left, everything else is a
   right-aligned cluster (search → help → region → count → avatar), no dead middle. */
#shellbar #search { margin-left: auto; flex: 0 1 340px; max-width: 340px; background: var(--ink); }
#shellbar #search:hover, #shellbar #search:focus-visible { background: var(--panel); }

/* profile avatar + account menu (item 13) */
.profile-wrap { position: relative; flex: none; }
.avatar-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--gold); color: #1c2433; display: grid; place-items: center;
  font-family: var(--font-body); font-size: 12px; font-weight: 700; letter-spacing: .3px;
}
.avatar-btn:hover { background: var(--gold-deep); }
.profile-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 1400; min-width: 230px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px;
}
.pm-head { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px 9px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.pm-name { font-size: 13px; font-weight: 600; color: var(--text); }
.pm-email { font-size: 11px; color: var(--text-dim); }
.pm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; }
.pm-lbl { font-size: 12.5px; color: var(--text); }
.pm-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; text-decoration: none;
  color: var(--text); font-family: var(--font-body); font-size: 12.5px; font-weight: 500;
  padding: 7px 10px; border-radius: 8px;
}
.pm-item:hover { background: var(--surface-hover); }
.pm-item svg { width: 15px; height: 15px; flex: none; color: var(--text-dim); }
.pm-set-note { font-size: 11px; color: var(--text-dim); line-height: 1.5; padding: 2px 10px 7px 34px; }
.pm-signout { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 9px; }

#page { position: relative; flex: 1 1 auto; min-height: 0; }

/* ── Re-seat the v58 overlays inside #page ──────────────────────────────── */
/* (they were positioned against the old 58px floating command bar)          */
#panel { top: var(--s-3); max-height: calc(100% - 190px); }  /* keep clear of the bottom-right zoom/recenter stack (item 8) */
#directory { padding-top: 0; }
/* drawer is position:fixed — clear the shellbar AND the sidebar (rail/expanded) */
.scout-drawer { top: 56px; left: 236px; }
body.rail .scout-drawer { left: 62px; }
@media (max-width: 640px) { .scout-drawer { left: 0; } }   /* bottom-sheet mode is full-width */
.scout-drawer.full { left: 0; }
#areaPill { position: absolute; }                      /* pin inside #page */

/* directory header breathing room now that the floating bar is gone */
#directory .dir-head { padding-top: 12px; }

/* ── Narrow screens: auto-collapse to the icon rail (real mobile nav = Phase B/E) ── */
@media (max-width: 820px) {
  #sidebar { width: 62px; }
  .sb-wordwrap, .sb-lbl, .sb-badge, .sb-set-panel { display: none; }
  .sb-group { visibility: hidden; padding: 10px 0 0; height: 0; }
  .sb-item { justify-content: center; padding: 9px 0; }
  #shellbar #search { min-width: 120px; }
  #crumb { display: none; }
}
