/* ---------- app frame ---------- */
.app { display: grid; grid-template-columns: 244px minmax(0, 1fr); height: 100vh; }
.main {
  margin: 8px 8px 8px 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}
.main.with-panel { grid-template-columns: minmax(0, 1fr) 340px; }
.main.with-panel .topbar { grid-column: 1 / -1; }

/* ---------- sidebar ---------- */
.sidebar { display: flex; flex-direction: column; padding: 10px 10px 12px; gap: 2px; min-height: 0; overflow-y: auto; }
.ws {
  display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 8px; border-radius: var(--r);
  text-align: left; transition: background 0.12s;
}
.ws:hover { background: var(--press); }
.ws-mark { width: 24px; height: 24px; border-radius: 7px; background: var(--ink); display: grid; place-items: center; color: #fff; font: 600 12px/1 var(--font-display); }
.ws-name { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws .chev { color: var(--faint); }
.search-btn {
  display: flex; align-items: center; gap: 8px; height: 32px; margin: 6px 0 10px; padding: 0 8px 0 10px;
  border-radius: var(--r); background: var(--surface); box-shadow: var(--sh-card); color: var(--muted); text-align: left;
}
.search-btn:hover { color: var(--ink-2); }
.search-btn span { flex: 1; }
kbd {
  font: 500 11px/1 var(--font); color: var(--faint); padding: 3px 5px; border-radius: 5px; background: var(--sunken);
  box-shadow: inset 0 0 0 1px var(--line); letter-spacing: 0.02em;
}
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 11.5px; font-weight: 500; color: var(--faint); padding: 14px 10px 5px; letter-spacing: 0.01em; }
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 10px; border-radius: var(--r);
  color: var(--ink-2); font-weight: 450; transition: background 0.12s, color 0.12s; position: relative;
}
.nav-item > span:first-of-type { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item > svg { flex: none; }
.nav-item:hover { background: var(--press); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--ink); font-weight: 550; box-shadow: var(--sh-card); }
.nav-item.active svg.i { color: var(--accent); }
.nav-item svg.i { color: var(--muted); }
.nav-item .count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; }
.nav-item.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.tree { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 3px 17px; padding-left: 8px; border-left: 1px solid var(--line-2); }
.tree .nav-item { height: 27px; font-size: 12.5px; padding: 0 8px; }
.tree .nav-item svg.i { width: 14px; height: 14px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 14px; }
.ai-status { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.storage { padding: 10px 10px 6px; }
.storage .bar { height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; margin-top: 6px; }
.storage .bar i { display: block; height: 100%; background: var(--ink-2); border-radius: 4px; }
.storage p { margin: 0; font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; }
.me { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 8px; border-radius: var(--r); text-align: left; }
.me:hover { background: var(--press); }
.me .who { flex: 1; min-width: 0; line-height: 1.25; }
.me .who b { display: block; font-weight: 550; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 11.5px; color: var(--muted); }
.viewer-note { margin: 6px 4px 2px; padding: 9px 10px; border-radius: var(--r); background: var(--surface); box-shadow: var(--sh-card); font-size: 12px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 13px; }
.crumbs a, .crumbs span { padding: 3px 6px; border-radius: var(--r-sm); white-space: nowrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { background: var(--hover); color: var(--ink); }
.crumbs a.drop { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px var(--accent); }
.crumbs .sep { color: var(--line-2); padding: 0; }
.crumbs .here { font-weight: 600; color: var(--ink); }
/* Long names shorten with an ellipsis instead of running under the page's buttons. */
.crumbs { overflow: hidden; }
.crumbs > a, .crumbs > span:not(.sep) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { flex: none; }
.crumbs .crumb-t { min-width: 0; padding: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar .grow { flex: 1; }
.presence { display: flex; align-items: center; }
.presence .av { box-shadow: 0 0 0 2px var(--surface); margin-left: -4px; }
.presence .av:first-child { margin-left: 0; }

/* ---------- shell additions ---------- */
.menu-btn { display: none; }
.me.active { background: var(--surface); box-shadow: var(--sh-card); }
.nav-item .count { min-width: 20px; text-align: center; }
.drawer-scrim { display: none; }
.topbar .btn-ghost.on { color: var(--accent); background: var(--accent-soft); }
.crumbs a.here, .crumbs .here { color: var(--ink); }
