/* ============================================================
   shell.css — the one consistent left rail (paired with shell.js).
   Theme-token styled (flips light / dark with the rest of the system).
   Eight surfaces in three groups, plus the Overview deck pinned above the
   rail and a small "More" disclosure for Setup. Same rail on every page.
   ============================================================ */

/* The rail occupies the existing 248px grid column on every page
   (.app and .app-shell are both grid-template-columns: 248px minmax(0,1fr)),
   so we don't re-layout — we only style the rail itself. */
.ti-shell-nav {
  align-self: stretch;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-sizing: border-box;
  min-width: 0;
}
.ti-rail {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 16px 20px;
  box-sizing: border-box;
}

.ti-rail-brand {
  font-family: var(--display, system-ui, sans-serif);
  font-size: 19px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  padding: 0 8px 6px;
}

.ti-rail-who {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.ti-rail-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #06101f;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.ti-rail-who-name { font-size: 14px; font-weight: 600; color: var(--text); }
.ti-rail-who-role { font-size: 11.5px; color: var(--text-dim); }

/* view-mode toggle (Guided / Visual / Detailed). Three segments share the rail
   width; each label stays on one line and never clips. */
.ti-viewtoggle {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  padding: 6px 4px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.ti-viewtoggle button {
  min-width: 0;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--text-dim); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 2px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .14s ease, border-color .14s ease, background .14s ease;
}
.ti-viewtoggle button.is-on {
  color: var(--accent-deep); background: var(--accent-pale);
  border-color: var(--border-accent);
}
.ti-viewtoggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* View-as department switcher: pick a department, every surface re-scopes */
.ti-rail-viewas { padding: 8px 4px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.ti-viewas { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ti-viewas-label {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-dim);
}
.ti-viewas-select {
  width: 100%; max-width: 100%; box-sizing: border-box; min-width: 0;
  font-family: var(--display, system-ui, sans-serif); font-size: 12.5px;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 7px 8px; cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.ti-viewas-select:hover { border-color: var(--border-accent); }
.ti-viewas-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ti-viewas-note { font-size: 11px; line-height: 1.4; color: var(--text-dim); }

/* Overview deck, pinned above the groups */
.ti-rail-deck { margin-bottom: 10px; }
.ti-rail-deck .ti-rail-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600; color: var(--text);
}
.ti-rail-deck .ti-rail-item:hover { border-color: var(--border-accent); }
.ti-rail-deck .ti-rail-item.is-active {
  background: var(--accent-pale); color: var(--accent-deep);
  border-color: var(--border-accent); box-shadow: inset 2px 0 0 var(--accent);
}

.ti-rail-group { display: flex; flex-direction: column; gap: 2px; }
.ti-rail-group + .ti-rail-group { margin-top: 13px; }
/* the pinned "Start here" group leads the rail: its label reads in the accent
   and its one item carries the deck-style lead treatment */
.ti-rail-start { margin-bottom: 10px; }
.ti-rail-start .ti-rail-group-label { color: var(--accent); }
.ti-rail-start .ti-rail-item {
  background: var(--surface-2); border: 1px solid var(--border);
  font-weight: 600; color: var(--text);
}
.ti-rail-start .ti-rail-item:hover { border-color: var(--border-accent); }
.ti-rail-start .ti-rail-item.is-active {
  background: var(--accent-pale); color: var(--accent-deep);
  border-color: var(--border-accent); box-shadow: inset 2px 0 0 var(--accent);
}
/* a quiet section header so the rail reads as clusters, not a flat list */
.ti-rail-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--text-dimmer, var(--text-dim));
  padding: 2px 12px 5px;
}

.ti-rail-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14.5px;
  color: var(--text-dim);
  text-decoration: none;
  transition: background .14s ease, color .14s ease;
}
.ti-rail-item:hover { background: var(--surface-2); color: var(--text); }
.ti-rail-item.is-active {
  background: var(--accent-pale);
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
/* the central builder + the result surface get a quiet accent on their glyph */
.ti-rail-item.is-core .ti-rail-ico { color: var(--accent); opacity: 1; }
.ti-rail-ico {
  width: 22px; text-align: center; flex-shrink: 0;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.2px;
  color: var(--text-dimmer);
}
.ti-rail-item.is-active .ti-rail-ico { color: var(--accent-deep); opacity: 1; }

/* "More" disclosure */
.ti-rail-more { margin-top: 8px; }
.ti-rail-more-toggle {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-dimmer, var(--text-dim));
  border-radius: 9px;
}
.ti-rail-more-toggle:hover { background: var(--surface-2); }
.ti-rail-chev { transition: transform .18s ease; font-family: var(--mono); font-size: 11px; }
.ti-rail-more.is-open .ti-rail-chev { transform: rotate(180deg); }
.ti-rail-more-list {
  display: none;
  flex-direction: column; gap: 2px;
  margin-top: 2px;
}
.ti-rail-more.is-open .ti-rail-more-list { display: flex; }

/* short, in-flow footer — never a clipped sticky card */
.ti-rail-foot {
  margin-top: auto;
  padding: 14px 12px 4px;
  font-size: 11.5px; line-height: 1.5;
  color: var(--text-dim);
}
.ti-rail-foot strong {
  display: block;
  font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--accent-deep); margin-bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .ti-rail-item, .ti-rail-chev, .ti-rail-more-toggle, .ti-viewtoggle button { transition: none; }
}

/* responsive: the .app / .app-shell media queries collapse the grid to one
   column under ~980px; the rail then sits as a top strip. */
@media (max-width: 980px) {
  .ti-shell-nav { border-right: none; border-bottom: 1px solid var(--border); }
  .ti-rail { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  .ti-rail-who, .ti-rail-foot, .ti-rail-group-label, .ti-viewtoggle { display: none; }
  .ti-rail-deck { margin-bottom: 0; }
  .ti-rail-group + .ti-rail-group { margin-top: 0; }
  .ti-rail-more { margin-top: 0; }
  .ti-rail-more-list { width: 100%; }
}
