/* ==========================================================================
   Nava — application shell
   Sidebar + topbar + content. In RTL the sidebar sits on the right because
   the flex row follows the document direction; all offsets are logical.
   ========================================================================== */

.app {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

.shell-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline-start: var(--sidebar-w);
  transition: margin-inline-start 0s;
}

.app--rail .shell-main {
  margin-inline-start: var(--sidebar-rail-w);
}

/* ---------- sidebar ----------------------------------------------------- */

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

.app--rail .sidebar {
  width: var(--sidebar-rail-w);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-2) var(--sp-2);
  flex-shrink: 0;
}

.ws-switch {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding-inline: 6px;
  border-radius: var(--radius-input);
  color: var(--text);
  text-align: start;
  transition: background-color var(--motion-fast) var(--ease);
}
.ws-switch:hover {
  background: var(--surface-hover);
}
.ws-switch:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.ws-switch-caret {
  flex-shrink: 0;
  color: var(--text-3);
  width: 15px;
  height: 15px;
}

.ws-logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-contrast);
  font-size: 13px;
  font-weight: var(--weight-semibold);
  letter-spacing: .01em;
  overflow: hidden;
}
.ws-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ws-logo--lg {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 14px;
}

.ws-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.ws-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-sub {
  font-size: var(--text-xs);
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-collapse {
  flex-shrink: 0;
  color: var(--text-3);
}

.sidebar-search {
  margin: 2px var(--sp-2) var(--sp-2);
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-1) var(--sp-2) var(--sp-3);
  scrollbar-width: thin;
}

.nav-group + .nav-group {
  margin-block-start: var(--sp-3);
}

.nav-group-label {
  padding: 8px 10px 5px;
  font-size: 10.5px;
  font-weight: var(--weight-semibold);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}
html[lang="fa"] .nav-group-label {
  letter-spacing: 0;
  text-transform: none;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding-inline: 8px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  text-align: start;
  transition: background-color var(--motion-fast) var(--ease),
              color var(--motion-fast) var(--ease);
}
.nav-item + .nav-item {
  margin-block-start: 1px;
}
.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-3);
  transition: color var(--motion-fast) var(--ease);
}
.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.nav-item:hover svg {
  color: var(--text-2);
}
.nav-item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.nav-item[aria-current="page"] {
  background: var(--surface-active);
  color: var(--text);
  font-weight: var(--weight-medium);
}
.nav-item[aria-current="page"] svg {
  color: var(--brand);
}
.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 50%;
  width: 2px;
  height: 16px;
  transform: translateY(-50%);
  border-radius: var(--radius-pill);
  background: var(--brand);
}
.nav-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-counter {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding-inline: 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-active);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.nav-counter--active {
  background: var(--brand);
  color: var(--brand-contrast);
}
.nav-counter--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.sidebar-foot {
  flex-shrink: 0;
  padding: var(--sp-2);
  border-block-start: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: 40px;
  padding: 4px 4px;
  border-radius: var(--radius-input);
  text-align: start;
  min-width: 0;
  transition: background-color var(--motion-fast) var(--ease);
}
.user-card:hover {
  background: var(--surface-hover);
}
.user-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
  flex: 1 1 auto;
}
.user-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role {
  font-size: var(--text-xs);
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggles {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-inline: 2px;
}
.sidebar-toggles .btn-icon {
  color: var(--text-3);
}
.sidebar-toggles .btn-icon:hover {
  color: var(--text);
}
.sidebar-toggle-spacer {
  flex: 1 1 auto;
}

/* rail (collapsed) state */
.app--rail .ws-name,
.app--rail .ws-sub,
.app--rail .nav-label,
.app--rail .nav-group-label,
.app--rail .user-meta,
.app--rail .ws-switch-caret,
.app--rail .nav-counter {
  display: none;
}
.app--rail .sidebar-head {
  padding-inline: var(--sp-2);
  flex-direction: column;
  gap: var(--sp-1);
}
.app--rail .ws-switch {
  flex: 0 0 auto;
  width: 40px;
  justify-content: center;
  padding-inline: 0;
}
.app--rail .sidebar-collapse {
  display: flex;
}
.app--rail .sidebar-nav {
  padding-inline: 10px;
}
.app--rail .nav-item {
  justify-content: center;
  padding-inline: 0;
  height: 34px;
}
.app--rail .nav-item[aria-current="page"]::before {
  inset-inline-start: 0;
}
.app--rail .nav-counter {
  display: none;
}
.app--rail .user-card {
  justify-content: center;
  padding-inline: 0;
}
.app--rail .user-card > svg:last-child {
  display: none;
}
.app--rail .sidebar-toggles {
  flex-direction: column;
  padding-inline: 0;
}
.app--rail .sidebar-toggle-spacer {
  display: none;
}
.app--rail .sidebar-search .search-trigger-label,
.app--rail .sidebar-search .kbd {
  display: none;
}
.app--rail .sidebar-search .search-trigger {
  width: 40px;
  justify-content: center;
  padding-inline: 0;
}

/* rail tooltips */
.app--rail .nav-item::after {
  content: attr(data-tip);
  position: absolute;
  inset-inline-start: calc(100% + 10px);
  inset-block-start: 50%;
  transform: translateY(-50%) translateX(-2px);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--ink-1);
  color: #FFFFFF;
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-fast) var(--ease);
  z-index: var(--z-popover);
  box-shadow: var(--shadow-2);
}
.app--rail .nav-item:hover::after,
.app--rail .nav-item:focus-visible::after {
  opacity: 1;
}
[dir="rtl"] .app--rail .nav-item::after {
  transform: translateY(-50%) translateX(2px);
}
html[data-theme="dark"] .app--rail .nav-item::after {
  background: var(--surface-3);
  color: var(--text);
}

/* search trigger (sidebar + topbar) */
.search-trigger {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  height: 32px;
  padding-inline: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--surface-3);
  color: var(--text-3);
  font-size: var(--text-sm);
  text-align: start;
  transition: border-color var(--motion-fast) var(--ease),
              background-color var(--motion-fast) var(--ease),
              color var(--motion-fast) var(--ease);
}
.search-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text-2);
}
.search-trigger:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.search-trigger svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.search-trigger-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* mobile sidebar */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-sidebar) - 1);
  background: var(--overlay);
  animation: nv-fade-in var(--motion-fast) var(--ease);
  display: none;
}

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--motion-slow) var(--ease);
    box-shadow: var(--shadow-3);
  }
  .sidebar-collapse {
    display: none;
  }
  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }
  .app--nav-open .sidebar {
    transform: translateX(0);
  }
  .app--nav-open .sidebar-scrim {
    display: block;
  }
  .shell-main {
    margin-inline-start: 0;
  }
  .app--rail .shell-main {
    margin-inline-start: 0;
  }
  .app--rail .sidebar {
    width: var(--sidebar-w);
  }
  .app--rail .nav-label,
  .app--rail .nav-group-label,
  .app--rail .ws-name,
  .app--rail .ws-sub,
  .app--rail .user-meta,
  .app--rail .ws-switch-caret,
  .app--rail .nav-counter {
    display: initial;
  }
  .app--rail .nav-counter {
    display: inline-flex;
  }
  .app--rail .nav-group-label {
    display: block;
  }
  .app--rail .nav-label {
    display: block;
  }
  .app--rail .ws-name,
  .app--rail .ws-sub,
  .app--rail .user-meta {
    display: flex;
  }
  .app--rail .sidebar-head {
    flex-direction: row;
    padding: var(--sp-3) var(--sp-2) var(--sp-2);
  }
  .app--rail .ws-switch {
    width: auto;
    justify-content: flex-start;
    padding-inline: 6px;
    flex: 1 1 auto;
  }
  .app--rail .nav-item {
    justify-content: flex-start;
    padding-inline: 8px;
  }
  .app--rail .sidebar-nav {
    padding-inline: var(--sp-2);
  }
  .app--rail .user-card {
    justify-content: flex-start;
    padding-inline: 4px;
  }
  .app--rail .sidebar-toggles {
    flex-direction: row;
    padding-inline: 2px;
  }
  .app--rail .sidebar-search .search-trigger-label,
  .app--rail .sidebar-search .kbd {
    display: inline-flex;
  }
  .app--rail .sidebar-search .search-trigger {
    width: 100%;
    justify-content: flex-start;
    padding-inline: 8px;
  }
  .app--rail .nav-item::after {
    content: none;
  }
}

/* ---------- topbar ------------------------------------------------------ */

.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: var(--topbar-h);
  padding-inline: var(--sp-4);
  border-block-end: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  flex-shrink: 0;
}

.topbar-menu {
  display: none;
  flex-shrink: 0;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 0 1 auto;
}
.crumbs-ws {
  font-size: var(--text-xs);
  color: var(--text-3);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumbs-sep {
  color: var(--text-3);
  font-size: var(--text-xs);
  opacity: .7;
}
.crumbs-page {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-search {
  width: min(380px, 40vw);
  margin-inline: auto;
  flex-shrink: 1;
}
.topbar-search .search-trigger {
  height: 32px;
  justify-content: flex-start;
  background: var(--surface-3);
}
.topbar-search .search-trigger .kbd {
  margin-inline-start: auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-inline-start: auto;
}

.presence {
  display: flex;
  align-items: center;
  padding-inline: 4px;
  margin-inline-end: 2px;
}
.presence .avatar + .avatar {
  margin-inline-start: -6px;
}
.presence-avatar {
  position: relative;
}
.presence-avatar .presence-dot {
  position: absolute;
  inset-block-end: -1px;
  inset-inline-end: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  box-shadow: 0 0 0 2px var(--surface);
}
.presence-avatar[data-online="true"] .presence-dot {
  background: var(--success);
}

.bell-wrap {
  position: relative;
}
.bell-count {
  position: absolute;
  inset-block-start: 2px;
  inset-inline-end: 0;
  min-width: 16px;
  height: 15px;
  padding-inline: 4px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #FFFFFF;
  font-size: 9.5px;
  font-weight: var(--weight-bold);
  line-height: 15px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.topbar-avatar {
  margin-inline-start: 4px;
}

/* notification panel */
.notif-panel {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 16px));
  max-height: min(520px, calc(100vh - 80px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.notif-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 12px;
  border-block-end: 1px solid var(--border);
  flex-shrink: 0;
}
.notif-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.notif-head .btn {
  margin-inline-start: auto;
}
.notif-list {
  overflow-y: auto;
  min-height: 0;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  width: 100%;
  padding: 10px 12px;
  text-align: start;
  border-block-end: 1px solid var(--border-soft);
  transition: background-color var(--motion-fast) var(--ease);
}
.notif-item:last-child {
  border-block-end: 0;
}
.notif-item:hover {
  background: var(--surface-hover);
}
.notif-item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--brand-ring);
}
.notif-item-main {
  min-width: 0;
  flex: 1 1 auto;
}
.notif-item-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-item-body {
  font-size: var(--text-xs);
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-item-time {
  font-size: 10.5px;
  color: var(--text-3);
  margin-block-start: 2px;
  white-space: nowrap;
}
.notif-item[data-unread="true"] .notif-item-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-end: 6px;
  border-radius: 50%;
  background: var(--brand);
  vertical-align: middle;
}
.notif-foot {
  padding: 8px 12px;
  border-block-start: 1px solid var(--border);
  flex-shrink: 0;
}
.notif-empty {
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  color: var(--text-2);
  font-size: var(--text-sm);
}

/* workspace switcher panel */
.ws-panel {
  width: min(300px, calc(100vw - 16px));
  padding: 6px;
}
.ws-panel-label {
  padding: 6px 8px 4px;
  font-size: 10.5px;
  font-weight: var(--weight-semibold);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}
html[lang="fa"] .ws-panel-label {
  letter-spacing: 0;
  text-transform: none;
}
.ws-option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  text-align: start;
  color: var(--text);
  font-size: var(--text-sm);
  transition: background-color var(--motion-fast) var(--ease);
}
.ws-option:hover {
  background: var(--surface-hover);
}
.ws-option:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.ws-option[aria-current="true"] {
  background: var(--surface-3);
}
.ws-option-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.35;
}
.ws-option-name {
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-option-meta {
  font-size: var(--text-xs);
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-option-check {
  color: var(--brand);
  flex-shrink: 0;
}
.ws-option-check svg {
  width: 15px;
  height: 15px;
}

/* ---------- content ----------------------------------------------------- */

.content {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: var(--sp-5) var(--sp-5) var(--sp-7);
  min-width: 0;
}
.content:focus {
  outline: none;
}
.content:focus-visible {
  outline: none;
}

/* full-page states (fatal errors, standalone notices) */
.content--standalone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: none;
  padding: var(--sp-5);
}

.user-avatar-slot {
  display: inline-flex;
  flex-shrink: 0;
}

@media (min-width: 1440px) {
  .content {
    padding: var(--sp-6) var(--sp-6) var(--sp-8);
  }
}
@media (max-width: 639px) {
  .content {
    padding: var(--sp-4) var(--sp-4) calc(var(--sp-7) + env(safe-area-inset-bottom, 0px));
  }
  .topbar {
    padding-inline: var(--sp-3);
    gap: var(--sp-1);
  }
  .topbar-menu {
    display: inline-flex;
  }
  .topbar-search {
    width: auto;
    flex: 1 1 auto;
    margin-inline: 0;
  }
  .topbar-search .search-trigger {
    width: auto;
    justify-content: flex-start;
  }
  .topbar-search .search-trigger .kbd {
    display: none;
  }
  .topbar-search .search-trigger-label {
    display: none;
  }
  .crumbs-ws,
  .crumbs-sep {
    display: none;
  }
  .presence {
    display: none;
  }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .topbar-menu {
    display: inline-flex;
  }
  .topbar-search {
    width: min(300px, 40vw);
  }
}

/* ---------- command palette -------------------------------------------- */

.palette-ovl {
  position: fixed;
  inset: 0;
  z-index: var(--z-palette);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-block-start: 10vh;
  padding-inline: var(--sp-4);
  background: var(--overlay);
  backdrop-filter: blur(3px);
  animation: nv-fade-in var(--motion-fast) var(--ease);
}
.palette {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: min(72vh, 620px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: nv-pop-in var(--motion) var(--ease-out);
}
.palette-input-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
  height: 52px;
  border-block-end: 1px solid var(--border);
  flex-shrink: 0;
}
.palette-input-row > svg {
  width: 17px;
  height: 17px;
  color: var(--text-3);
  flex-shrink: 0;
}
.palette-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--text-md);
  outline: none;
}
.palette-input::placeholder {
  color: var(--text-3);
}
.palette-results {
  overflow-y: auto;
  min-height: 0;
  padding: 6px;
  flex: 1 1 auto;
}
.palette-group + .palette-group {
  margin-block-start: 4px;
}
.palette-group-label {
  padding: 8px 10px 4px;
  font-size: 10.5px;
  font-weight: var(--weight-semibold);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
html[lang="fa"] .palette-group-label {
  letter-spacing: 0;
  text-transform: none;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-sm);
  text-align: start;
  cursor: pointer;
  scroll-margin-block: 8px;
}
.palette-item[aria-selected="true"] {
  background: var(--brand-soft);
}
.palette-item:hover {
  background: var(--surface-hover);
}
.palette-item[aria-selected="true"]:hover {
  background: var(--brand-soft);
}
.palette-item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--brand-ring);
}
.palette-item-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
}
.palette-item-icon svg {
  width: 14px;
  height: 14px;
}
.palette-item[aria-selected="true"] .palette-item-icon {
  border-color: transparent;
  background: var(--brand);
  color: var(--brand-contrast);
}
.palette-item-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.35;
}
.palette-item-title {
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-item-sub {
  font-size: var(--text-xs);
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-item-hint {
  flex-shrink: 0;
  color: var(--text-3);
  font-size: var(--text-xs);
}
.palette-item[aria-selected="true"] .palette-item-hint {
  color: var(--brand);
}
.palette-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 8px var(--sp-4);
  border-block-start: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 10.5px;
  flex-shrink: 0;
}
.palette-foot-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.palette-foot .kbd {
  height: 16px;
  min-width: 16px;
  font-size: 9.5px;
}
.palette-spinner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  color: var(--text-3);
  font-size: var(--text-xs);
}
.palette-empty {
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  color: var(--text-2);
  font-size: var(--text-sm);
}

@media (max-width: 639px) {
  .palette-ovl {
    padding-block-start: 0;
    padding-inline: 0;
    align-items: stretch;
  }
  .palette {
    width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    border: 0;
  }
}

/* ---------- shortcuts help --------------------------------------------- */

.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5) var(--sp-6);
}
.shortcut-section-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-2);
  margin-block-end: var(--sp-2);
}
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-block: 5px;
  border-block-end: 1px solid var(--border-soft);
  font-size: var(--text-sm);
  color: var(--text-2);
}
.shortcut-row:last-child {
  border-block-end: 0;
}
.shortcut-keys {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .shortcut-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- not found --------------------------------------------------- */

.notfound {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-4);
  min-height: 50vh;
}
.notfound-code {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--text-3);
  letter-spacing: .02em;
  line-height: 1;
}
.notfound-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}
.notfound-text {
  color: var(--text-2);
  font-size: var(--text-sm);
  max-width: 44ch;
}
.notfound-actions {
  display: flex;
  gap: var(--sp-2);
  margin-block-start: var(--sp-3);
}

/* ---------- offline / install banner ----------------------------------- */

.shell-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 7px var(--sp-4);
  background: var(--warning-soft);
  border-block-end: 1px solid var(--warning-border);
  color: var(--warning);
  font-size: var(--text-xs);
  flex-shrink: 0;
}
.shell-banner--offline {
  background: var(--danger-soft);
  border-block-end-color: var(--danger-border);
  color: var(--danger);
}
.shell-banner .btn {
  margin-inline-start: auto;
  flex-shrink: 0;
}
.shell-banner svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.install-card {
  position: fixed;
  inset-block-end: var(--sp-4);
  inset-inline-end: var(--sp-4);
  z-index: var(--z-toast);
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  width: min(360px, calc(100vw - 32px));
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-2);
  animation: nv-slide-up var(--motion-slow) var(--ease-out);
}
.install-card-main {
  flex: 1 1 auto;
  min-width: 0;
}
.install-card-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.install-card-text {
  font-size: var(--text-xs);
  color: var(--text-2);
  line-height: 1.5;
}
.install-card-actions {
  display: flex;
  gap: var(--sp-2);
  margin-block-start: var(--sp-2);
}

/* ---------- boot screen ------------------------------------------------ */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 100;
}
.boot-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.boot-mark .spinner {
  width: 22px;
  height: 22px;
  color: var(--brand);
}
.boot-label {
  font-size: var(--text-sm);
  color: var(--text-3);
}

/* ---------- print ------------------------------------------------------- */

@media print {
  .sidebar,
  .topbar,
  .sidebar-scrim,
  .palette-ovl,
  .toast-stack,
  .install-card {
    display: none !important;
  }
  .shell-main {
    margin-inline-start: 0 !important;
  }
  .content {
    max-width: none;
    padding: 0;
  }
}
