/* The desktop navigation layouts other than classic (app/nav-layout.js), and the pickers of a layout. Every layout
   rule is under body.nav-* which is only set on the desktop interface. Loaded last, over workspace.css. */

.nav-bar, .nav-head, .nav-dock-bar, .nav-menu { font-family: var(--sans); color: var(--text); }
:is(.nav-bar, .nav-head, .nav-dock-bar, .nav-menu) svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:is(.nav-item, .nav-brand, .nav-icon, .nav-field, .nav-project, .nav-account) {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: auto; min-height: 36px; margin: 0; padding: 6px 12px;
  border: 0; border-radius: 12px; font-size: 13.5px; font-weight: 600; white-space: nowrap; color: var(--muted); box-shadow: none;
}
:is(.nav-item, .nav-icon, .nav-brand, .nav-project, .nav-account):hover { background: var(--field); color: var(--text); }
.nav-item.on { background: var(--field); color: var(--heading); }
.nav-badge { min-width: 18px; padding: 1px 5px; border-radius: 99px; background: var(--accent); color: var(--panel); font-size: 10.5px; font-weight: 700; text-align: center; }
.nav-brand { color: var(--heading); font-family: var(--serif, inherit); font-size: 17px; font-weight: 400; padding-inline: 6px; }
.nav-brand img { width: 24px; height: 24px; }
.nav-field { justify-content: flex-start; background: var(--field); font-weight: 500; }
.nav-field kbd { margin-left: auto; padding-left: 8px; border: 0; background: none; font-size: 11px; color: var(--muted); }
.nav-icon { width: 36px; padding: 0; }
.nav-account { width: 36px; padding: 0; border-radius: 50%; background: var(--field); color: var(--heading); }
.nav-menu { position: fixed; inset: auto; min-width: 210px; max-height: calc(100dvh - 16px); overflow: auto; }
.nav-menu .ws-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; }
.nav-menu .nav-badge { margin-left: auto; }
.nav-menu .on { background: var(--field); }
.nav-menu-heading { margin: 4px 0 0; padding: 8px 10px 2px; border-top: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav-menu-heading:empty { padding: 0; }

@media (min-width: 701px) {
  /* The column keeps only what belongs to its list (the Inbox's grouping and filter, a running move) under any head. */
  /* The New and More menus are the column's children too: an open one is in the top layer and must stay drawn. */
  body.nav-fixed .ws-side > :not(.nav-head, .ws-column-tools, .control-moves-job, .ws-menu:popover-open) { display: none !important; }

  /* ---------- the bar of "top" and "command" ---------- */
  .nav-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; height: 56px; padding: 6px 14px 0; }
  .nav-bar .nav-start, .nav-bar .nav-end { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .nav-bar .nav-end { justify-content: flex-end; }
  .nav-segments { display: flex; gap: 2px; padding: 3px; border-radius: 15px; background: var(--panel); }
  .nav-project { overflow: hidden; color: var(--heading); text-overflow: ellipsis; }
  .nav-field-wide { width: min(480px, 36vw); }
  .nav-bar .inbox-system { flex: none; margin: 0; }
  .nav-bar .inbox-system-line { white-space: nowrap; }
  .nav-bar .nav-end > .ws-new-button { flex: none; }
  /* A narrow window keeps the icons and counts; the names are in each button's tooltip. */
  @media (max-width: 1180px) {
    .nav-bar :is(.nav-brand, .nav-field) > :is(span, kbd), .nav-bar .inbox-system-line b { display: none; }
    .nav-bar .nav-field { width: auto; }
    .nav-bar .nav-segments .nav-item { padding-inline: 8px; }
  }
  @media (max-width: 880px) { .nav-bar .nav-segments .nav-label { display: none; } }

  body:is(.nav-top, .nav-command) .shell { height: calc(100dvh - 56px); }
  body:is(.nav-top, .nav-command).terminal-open[data-terminal-orientation="horizontal"] .shell { height: calc(100dvh - 56px - var(--terminal-dock-size, 320px)); }
  body:is(.nav-top, .nav-command):not(.focus-ui) .shell > .ws-foot { display: none; }

  /* ---------- command: the projects are picked in the search, so a chosen one leaves only its conversations ---------- */
  body.nav-command.ws-column-projects:not(.ws-picker) .shell { grid-template-columns: var(--ws-col-list) minmax(0, 1fr); grid-template-areas: "list main" "list main" "list main"; }
  body.nav-command.ws-column-projects:not(.ws-picker) .shell > :is(#projectsPanel, .ws-side, .ws-sidebar-resize) { display: none; }
  body.nav-command.ws-column-projects:not(.ws-picker) .shell > #chatsPanel { padding-left: var(--ws-gap); }
  @media (min-width: 1100px) {
    body.nav-command.browser-visible.ws-column-projects:not(.ws-picker) .shell { grid-template-columns: var(--ws-col-list) minmax(320px, 1fr) minmax(320px, 1.1fr); grid-template-areas: "list main browser" "list main browser" "list main browser"; }
  }

  /* ---------- dock and tree: a head and a foot of their own inside the left column ---------- */
  body.nav-fixed .ws-foot > :not(.nav-dock-bar) { display: none !important; }
  body.nav-fixed:not(.focus-ui) #collapseProjectsButton { display: none; }
  .nav-head { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
  .nav-head .nav-brand { flex: 1 1 0; justify-content: flex-start; min-width: 0; overflow: hidden; }
  .nav-head > .ws-new-button { flex: none; padding-inline: 12px; }
  .nav-dock-bar { display: flex; flex-direction: column; gap: 6px; width: 100%; min-width: 0; }
  .nav-dock-bar .inbox-system { margin: 0; }
  .nav-dock-items { display: flex; gap: 2px; }
  .nav-dock-items .nav-item { position: relative; flex: 1 1 0; flex-direction: column; gap: 3px; min-width: 0; padding: 6px 2px; font-size: 10.5px; }
  .nav-dock-items .nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .nav-dock-items .nav-badge { position: absolute; top: 0; right: 4px; }

  .nav-tree-places { display: flex; flex-direction: column; gap: 2px; width: 100%; margin-top: 4px; }
  .nav-tree-places .nav-item { justify-content: flex-start; width: 100%; }
  .nav-tree-places .nav-badge { margin-left: auto; }

  /* Conversations nest in this column, so it starts wider. */
  body.nav-tree:not(.focus-ui) .shell { --ws-default-col-side: clamp(300px, 23vw, 380px); }

  /* One column: the conversations are inside the project list, under the open project's row. */
  body.nav-tree.ws-column-projects:not(.focus-ui) .shell { grid-template-columns: var(--ws-col-side) minmax(0, 1fr); grid-template-areas: "side-top main" "side-body main" "side-foot main"; }
  @media (min-width: 1100px) {
    body.nav-tree.browser-visible.ws-column-projects:not(.focus-ui) .shell { grid-template-columns: var(--ws-col-side) minmax(320px, 1fr) minmax(320px, 1.1fr); grid-template-areas: "side-top main browser" "side-body main browser" "side-foot main browser"; }
  }
  body.nav-tree .shell > #chatsPanel { display: none !important; }
  body.nav-tree #projectList #chatsPanel {
    display: flex; flex-direction: column; flex: none; height: 62vh; min-height: 320px; margin: 0 0 6px; padding: 0 0 0 10px;
    border: 0; border-left: 2px solid var(--line-strong); border-radius: 0; background: none; box-shadow: none; animation: none;
  }
  body.nav-tree #projectList #chatsPanel > :is(.panel-bar, .panel-rail) { display: none; }

  /* ---------- picking a layout ---------- */
  .nav-chooser { width: min(920px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--panel); color: var(--text); }
  .nav-chooser::backdrop { background: rgb(0 0 0 / 55%); }
  .nav-chooser h2 { margin: 0 0 4px; }
  .nav-chooser p { margin: 0 0 16px; color: var(--muted); }
  .nav-chooser > button { margin-top: 14px; }
}

.nav-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; width: 100%; }
.settings-nav-layout-row { flex-wrap: wrap; }
.nav-tile { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: auto; height: auto; margin: 0; padding: 10px; border: 2px solid var(--line); border-radius: 14px; text-align: left; white-space: normal; }
.nav-tile[aria-pressed="true"] { border-color: var(--accent); }
.nav-tile small { color: var(--muted); font-weight: 400; line-height: 1.35; }
/* The pictures: a is the navigation, b the list, c the second list, d the conversation. */
.nav-preview { display: grid; gap: 3px; height: 84px; padding: 4px; border-radius: 8px; background: var(--bg); }
.nav-preview i { border-radius: 3px; background: var(--line-strong); }
.nav-preview i.a { background: var(--accent); opacity: .75; }
.nav-preview i.d { background: var(--field); }
.nav-preview-top { grid-template: "a a a" 14px "b c d" / 1fr 1fr 2.4fr; }
.nav-preview-command { grid-template: ". a ." 12px "c d d" / 1fr 2fr 1fr; }
.nav-preview-command i.b { display: none; }
.nav-preview-dock { grid-template: "b c d" "a c d" 16px / 1fr 1fr 2.4fr; }
.nav-preview-tree { grid-template: "b d" "c d" 40px "a d" 10px / 1fr 2.6fr; }
.nav-preview-tree i.c { margin-left: 7px; opacity: .6; }
.nav-preview-classic { grid-template: "a c d" 42px "b c d" / 1fr 1fr 2.4fr; }
.nav-preview i.a { grid-area: a; } .nav-preview i.b { grid-area: b; } .nav-preview i.c { grid-area: c; } .nav-preview i.d { grid-area: d; }

/* ---------- the search's tiles of places and actions ---------- */
.spotlight-goto { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; max-height: 32vh; overflow-y: auto; }
.spotlight-goto[hidden] { display: none; }
.spotlight-tile { width: auto; min-height: 40px; margin: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; line-height: 1.25; white-space: normal; }
.spotlight-tile.action { border-style: dashed; }
body.focus-ui .spotlight-goto { display: none; }
@media (max-width: 700px) { .spotlight-goto, .settings-nav-layout-row { display: none; } }
