/* App shell: rail, panel and top bar. */
html, body { background: var(--bg); color: var(--ink); }
main { background: var(--bg) !important; }
main.p-4 { padding: 8px 26px 32px; }

/* navigation */
.shell-nav { position: relative; display: flex; height: 100%; flex-shrink: 0; z-index: 30; user-select: none; }

.rail { width: var(--rail-w); height: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 0; background: var(--card); box-shadow: inset -1px 0 0 var(--line); }
.rail__brand { width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center; border-radius: var(--r-md); background: var(--ink); color: var(--bg); font-weight: 700; font-size: 14px; }
.rail__toggle { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--muted); background: var(--card-2); box-shadow: var(--ring); }
.rail__toggle:hover { color: var(--ink); }
.rail__toggle svg { width: 16px; height: 16px; }
.rail__items { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 10px; overflow-y: auto; scrollbar-width: none; }
.rail__items::-webkit-scrollbar { display: none; }
.rail__item { position: relative; width: 62px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border-radius: var(--r-md); color: var(--ink-2); font-size: 11px; font-weight: 500; line-height: 1.15; text-align: center; transition: background .18s, color .18s; }
.rail__item svg { width: 20px; height: 20px; flex-shrink: 0; }
.rail__item:hover, .rail__item.is-hover { background: var(--card-3); color: var(--ink); }
.rail__item.is-active { background: var(--accent); color: var(--accent-ink); box-shadow: var(--glow); }
.rail__count { position: absolute; top: 3px; right: 8px; min-width: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10px; line-height: 16px; }
.rail__avatar { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--tile-4); color: var(--tile-ink); font-size: 13px; font-weight: 700; text-transform: uppercase; }

.panel { width: var(--panel-w); height: 100%; display: flex; flex-direction: column; background: var(--bg); box-shadow: inset -1px 0 0 var(--line); }
/* hover opens the panel over the page, so the content does not move */
.panel--float { position: absolute; top: 0; bottom: 0; left: var(--rail-w); height: auto; z-index: 50; box-shadow: var(--shadow-lg); }
.panel__search { position: relative; display: flex; align-items: center; margin: 14px 14px 6px; }
.panel__search svg { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.panel__search input { width: 100%; height: 38px; padding: 0 30px 0 34px; border-radius: var(--r-btn); background: var(--card); color: var(--ink); font-size: 13.5px; box-shadow: var(--ring); outline: none; }
.panel__search input:focus { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.panel__search button { position: absolute; right: 10px; color: var(--muted); }
.panel__body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 14px 16px; }
.panel__title { margin: 12px 8px 6px; color: var(--ink); font-size: 17px; font-weight: 600; }
.nav-link { display: block; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 13.5px; font-weight: 500; transition: background .18s, color .18s; }
.nav-link:hover { background: var(--card-3); color: var(--ink); }
.nav-link.is-active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--ring), var(--shadow); }
.nav-group { margin-top: 6px; }
.nav-group__head { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
.nav-group__head:hover { color: var(--ink); }
.nav-group__head svg { width: 12px; height: 12px; transition: transform .18s; }
.nav-group__head svg.is-open { transform: rotate(90deg); }
.nav-group .nav-group, .nav-group .nav-link { margin-left: 6px; }

/* top bar */
.topbar { flex-shrink: 0; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 26px; background: var(--bg); z-index: 20; user-select: none; }
.topbar__left { min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar__right { display: flex; align-items: center; gap: 8px; }
.topbar__menu { display: none; }
.crumbs { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; }
.crumbs > :last-child { color: var(--ink); font-weight: 600; }
.crumbs__sep { color: var(--accent); }

@media (max-width: 767px) {
  .shell-nav { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; }
  .shell-nav--open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar, main.p-4 { padding-left: 16px; padding-right: 16px; }
  .topbar__menu { display: inline-flex; }
}
