/* ============================================================================
   DevTrack Hub · shell-v2.css — sidebar reskin (Block shell port)
   ----------------------------------------------------------------------------
   Port of design/exports/shared/_shell.css SIDEBAR rules onto the live app.
   Scoped to `.sidebar.sb-v2` so it coexists with Bootstrap: the wrapper keeps
   the Bootstrap col/collapse classes (mobile toggle + overlay behavior), the
   interior adopts the design's sb__* system verbatim. Tokens are declared on
   the scope, not :root, to avoid leaking into legacy pages.
   Width note: the design specifies a fixed 232px rail (.app grid); the live
   shell still uses Bootstrap cols (col-md-3/col-lg-2) because main-content
   depends on them — the rail narrows to the design width at col-lg via
   flex-basis below; the full .app-grid migration lands with the v2 pages.
   ============================================================================ */
.sidebar.sb-v2 {
  --sb-accent: oklch(0.58 0.18 268);
  --sb-accent-2: oklch(0.72 0.14 268);
  --sb-coral: oklch(0.65 0.17 30); /* design --c-coral, scoped */
  --sb-ink: #0b0d1b;
  --sb-line: #1a1d2e;
  --sb-text: #e6e4de;

  background: var(--sb-ink) !important;
  color: var(--sb-text);
  border-right: 1px solid var(--sb-line);
  padding: 0;
}
@media (min-width: 992px) {
  /* approximate the design's 232px rail without breaking the Bootstrap grid */
  .sidebar.sb-v2 { flex: 0 0 232px; max-width: 232px; }
  .sidebar.sb-v2 ~ .main-content,
  .main-content.sb-v2-main { flex: 1 1 auto; width: auto; max-width: calc(100% - 232px); }
}
.sidebar.sb-v2 .sb {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

/* brand */
.sb-v2 .sb__brand { padding: 18px 18px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--sb-line); }
.sb-v2 .sb__logo { width: 28px; height: 28px; border-radius: 7px; background: var(--sb-accent); display: flex; align-items: center; justify-content: center; color: #fff; font-family: "Inter Tight", "Inter", sans-serif; font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.sb-v2 .sb__brand-name { font-family: "Inter Tight", "Inter", sans-serif; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: #fff; }
.sb-v2 .sb__brand-meta { font-family: "JetBrains Mono", monospace; font-size: 9px; color: rgba(230, 228, 222, 0.5); letter-spacing: 0.08em; margin-top: 2px; text-transform: uppercase; }

/* org switcher */
.sb-v2 .sb__org { padding: 14px 18px; border-bottom: 1px solid var(--sb-line); display: flex; align-items: center; gap: 10px; cursor: pointer; color: inherit; text-decoration: none; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.sb-v2 .sb__org:hover { background: var(--sb-line); }
.sb-v2 .sb__org-icon { width: 28px; height: 28px; border-radius: 6px; background: var(--sb-line); display: flex; align-items: center; justify-content: center; font-family: "Inter Tight", sans-serif; font-weight: 600; font-size: 12px; color: var(--sb-text); flex-shrink: 0; }
.sb-v2 .sb__org-main { flex: 1; min-width: 0; }
.sb-v2 .sb__org-name { font-size: 12.5px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.sb-v2 .sb__org-plan { font-family: "JetBrains Mono", monospace; font-size: 9px; color: rgba(230, 228, 222, 0.5); letter-spacing: 0.06em; margin-top: 2px; text-transform: uppercase; }
.sb-v2 .sb__org-caret { margin-left: auto; color: rgba(230, 228, 222, 0.4); font-size: 10px; }

/* nav */
.sb-v2 .sb__nav { flex: 1; overflow-y: auto; padding: 14px 10px; }
.sb-v2 .sb__nav::-webkit-scrollbar { width: 6px; }
.sb-v2 .sb__nav::-webkit-scrollbar-thumb { background: var(--sb-line); border-radius: 3px; }
.sb-v2 .sb__group { margin-bottom: 18px; }
.sb-v2 .sb__group-lbl { font-family: "JetBrains Mono", monospace; font-size: 9px; color: rgba(230, 228, 222, 0.4); letter-spacing: 0.1em; padding: 0 10px 8px; text-transform: uppercase; }
.sb-v2 .sb__item { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 6px; color: rgba(230, 228, 222, 0.75); font-size: 13px; cursor: pointer; text-decoration: none; font-weight: 500; line-height: 1.2; margin-bottom: 1px; }
.sb-v2 .sb__item:hover { background: var(--sb-line); color: #fff; }
.sb-v2 .sb__item.active { background: rgba(124, 92, 255, 0.16); color: #fff; font-weight: 600; }
.sb-v2 .sb__item.active .sb__ico svg { color: var(--sb-accent-2); }
.sb-v2 .sb__ico { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: rgba(230, 228, 222, 0.55); }
.sb-v2 .sb__ico svg { width: 16px; height: 16px; stroke-width: 1.7; }
.sb-v2 .sb__item:hover .sb__ico, .sb-v2 .sb__item.active .sb__ico { color: #fff; }
.sb-v2 .sb__item .sb__count { margin-left: auto; font-family: "JetBrains Mono", monospace; font-size: 9.5px; color: rgba(230, 228, 222, 0.5); background: rgba(255, 255, 255, 0.06); padding: 2px 6px; border-radius: 99px; font-weight: 500; }
.sb-v2 .sb__item.active .sb__count { background: rgba(124, 92, 255, 0.3); color: #fff; }

/* user footer */
.sb-v2 .sb__user { padding: 14px 18px; border-top: 1px solid var(--sb-line); display: flex; align-items: center; gap: 10px; }
.sb-v2 .sb__avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--sb-accent), var(--sb-coral)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 12px; flex-shrink: 0; }
.sb-v2 .sb__user-name { font-size: 12.5px; font-weight: 600; color: #fff; }
.sb-v2 .sb__user-role { font-family: "JetBrains Mono", monospace; font-size: 9px; color: rgba(230, 228, 222, 0.5); letter-spacing: 0.06em; margin-top: 2px; text-transform: uppercase; }
.sb-v2 .sb__user-ico { margin-left: auto; color: rgba(230, 228, 222, 0.4); }
.sb-v2 .sb__user-ico:hover { color: #fff; }
/* sb__logout is an addition over the design (the mockup has no logout row;
   destination parity requires one — every legacy sidebar link must survive) */
.sb-v2 .sb__logout { display: flex; align-items: center; gap: 8px; padding: 9px 18px; color: rgba(230, 228, 222, 0.55); font-size: 12px; text-decoration: none; border-top: 1px solid var(--sb-line); }
.sb-v2 .sb__logout:hover { color: #fff; background: var(--sb-line); }

/* generic svg sizing used by the sprite icons */
.ico-svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico-svg--sm { width: 14px; height: 14px; }

/* ============================================================================
   Topbar (.rd-tb) — canonical white bar (handoff 02 §2). Replaces the legacy
   Bootstrap .navbar when SIDEBAR_V2_ENABLED. White + 1px hairline + mono
   breadcrumb (left) · actions/timer/notifications/user chip (right). Lives
   inside <main> and bleeds past its Bootstrap padding so the hairline spans
   the full content width. z-index var(--z-topbar). #19.
   ============================================================================ */
/* NOTE: the canonical .rd-tb topbar CSS is now ALSO inlined in base.html (loads
   last in <head> so it always wins + can't be served stale). Kept here in sync
   for the sidebar-paired shell; do not let the two drift. */
.rd-tb {
  position: sticky; top: 0; z-index: var(--z-topbar);
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--line);
  margin: 0;
  padding: 0 24px;
}
@media (max-width: 767.98px) { .rd-tb { padding: 0 14px; } }

.rd-tb__burger {
  display: none; width: 34px; height: 34px; flex-shrink: 0; padding: 0;
  align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink-2);
}
.rd-tb__burger:hover { background: var(--bg); color: var(--ink); }
/* sidebar collapses below Bootstrap's md (767.98) — show the burger only then */
@media (max-width: 767.98px) { .rd-tb__burger { display: inline-flex; } }

.rd-tb__crumb { display: flex; align-items: center; gap: 7px; min-width: 0;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em;
  color: var(--muted); text-transform: uppercase; }
.rd-tb__crumb a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.rd-tb__crumb a:hover { color: var(--ink); }
.rd-tb__crumb .sep { color: var(--line); }
.rd-tb__crumb b, .rd-tb__crumb .cur {
  color: var(--ink); font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) {
  .rd-tb__crumb { max-width: 42vw; }
  .rd-tb__crumb .hide-sm { display: none; }
}

.rd-tb__spacer { flex: 1; }

.rd-tb__icon { position: relative; width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink-2); }
.rd-tb__icon:hover { background: var(--bg); color: var(--ink); }
.rd-tb__icon::after { display: none; }   /* kill Bootstrap dropdown caret */
.rd-tb__dot { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff;
  font: 600 9px/16px var(--font-mono); text-align: center; }

.rd-tb__user { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 4px 10px 4px 4px; color: var(--ink); text-decoration: none; }
.rd-tb__user:hover { background: var(--bg); color: var(--ink); }
.rd-tb__user-av { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--c-coral));
  font: 600 10px var(--font-display); }
.rd-tb__user-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
@media (max-width: 720px) { .rd-tb__user-name { display: none; } }

.rd-tb__logout { display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); }
.rd-tb__logout:hover { background: var(--bg); color: var(--ink); }

.rd-tb__timer { display: inline-flex; align-items: center; }

/* focus-visible rings on every topbar control (handoff §global a11y) */
.rd-tb__burger:focus-visible, .rd-tb__icon:focus-visible,
.rd-tb__user:focus-visible, .rd-tb__logout:focus-visible {
  outline: none; box-shadow: var(--focus-ring);
}
