/* App workspace sidebar (#workspace-nav) + command palette — pairs with terminal-shell.css */

.pitstrike-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  --app-shell-header-h: 56px;
  --app-sidebar-collapsed-w: 72px;
  --app-sidebar-expanded-w: 248px;
  --app-sidebar-accent: #00c2ff;
}

html.pitstrike-main-shell {
  --header-height: var(--app-shell-header-h);
}

/* ---- Top bar: environment + palette trigger ---- */
.topnav__center--shell {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

.pitstrike-env-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(120, 195, 255, 0.92);
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.3);
  box-shadow: 0 0 8px rgba(88, 166, 255, 0.1);
}

.pitstrike-env-badge[data-env='live'] {
  background: rgba(63, 185, 80, 0.12);
  border-color: rgba(63, 185, 80, 0.4);
  color: #aff5b4;
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.15);
}

.pitstrike-env-badge[data-env='offline'] {
  background: rgba(248, 81, 73, 0.1);
  border-color: rgba(248, 81, 73, 0.4);
  color: #ffb4b0;
  box-shadow: 0 0 8px rgba(248, 81, 73, 0.12);
}

.pitstrike-command-palette-trigger {
  flex: 0 1 260px;
  min-width: 140px;
  max-width: min(320px, 36vw);
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  border: 1px solid rgba(120, 160, 255, 0.14);
  background: rgba(22, 27, 34, 0.72);
  color: rgba(201, 209, 217, 0.9);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 135ms ease,
    background 135ms ease,
    transform 135ms ease,
    box-shadow 135ms ease;
}

.app-top-bar__zone--command .pitstrike-command-palette-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.pitstrike-command-palette-trigger:hover {
  border-color: rgba(88, 166, 255, 0.35);
  color: #e6edf3;
}

.pitstrike-command-palette-trigger__hint {
  opacity: 0.55;
  font-size: 13px;
}

.pitstrike-command-palette-trigger__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .pitstrike-command-palette-trigger__label {
    display: none;
  }
  .pitstrike-command-palette-trigger {
    max-width: 120px;
    min-width: 44px;
    justify-content: center;
  }
}

/* ---- Sidebar column ---- */
.app-sidebar {
  width: var(--app-sidebar-collapsed-w);
  flex-shrink: 0;
  height: calc(100vh - var(--app-shell-header-h));
  box-sizing: border-box;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(10, 12, 18, 0.96);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 180ms ease;
}

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

.app-sidebar__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.app-sidebar__toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(22, 27, 34, 0.72);
  color: #c9d1d9;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 120ms ease, border-color 120ms ease;
}

.app-sidebar__toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(88, 166, 255, 0.35);
}

.app-sidebar__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.app-sidebar:not(.is-expanded) .app-nav-group__title {
  display: none;
}

.app-nav-group {
  margin-bottom: 16px;
}

.app-nav-group__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 6px;
  padding: 0 4px;
}

.app-nav-group__emoji {
  font-size: 14px;
  line-height: 1;
  width: 20px;
  text-align: center;
}

.app-nav-group__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(139, 148, 158, 0.95);
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 120ms ease, width 0s linear 180ms;
}

.app-sidebar.is-expanded .app-nav-group__label {
  opacity: 1;
  width: auto;
  transition-delay: 0s;
}

.app-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  margin-bottom: 4px;
  padding: 0 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 120ms ease, color 120ms ease;
}

.app-nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.96);
}

.app-nav-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-weight: 600;
}

.app-nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 99px;
  background: var(--app-sidebar-accent);
}

.app-nav-item--link {
  color: rgba(201, 209, 217, 0.88);
}

.app-nav-item--quiet {
  color: rgba(201, 209, 217, 0.88);
}

/* Collapsed: hide long labels — show first letter in a chip */
.app-sidebar:not(.is-expanded) .app-nav-item {
  font-size: 0;
  justify-content: center;
  padding: 0 8px;
}

.app-sidebar:not(.is-expanded) .app-nav-item::after {
  content: attr(data-short);
  font-size: 11px;
  font-weight: 700;
  color: rgba(230, 237, 243, 0.88);
}

.app-sidebar:not(.is-expanded) .app-nav-item.active::after {
  color: #fff;
}

.app-sidebar:not(.is-expanded) .app-nav-item--link::after {
  content: '↗';
  font-size: 12px;
}

.app-sidebar:not(.is-expanded) .app-nav-item:not([data-short]):not(.app-nav-item--link)::after {
  content: '•';
  font-size: 14px;
  opacity: 0.6;
}

.app-sidebar.is-expanded .app-nav-item::after {
  content: none;
}

.app-sidebar.is-expanded .app-nav-item {
  font-size: 12px;
}

/* Embed: no duplicate chrome */
html.pitstrike-workspace-embed #workspace-nav.app-sidebar {
  display: none !important;
}

html.pitstrike-workspace-embed .pitstrike-command-palette-trigger {
  display: none !important;
}

/* Mobile drawer */
.mobile-workspace-nav-toggle {
  display: none;
}

.ps-workspace-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20035;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(1, 4, 9, 0.55);
  cursor: pointer;
}

@media (max-width: 820px) {
  .mobile-workspace-nav-toggle {
    display: inline-flex;
  }

  .app-sidebar__toggle {
    display: none;
  }

  html.ps-workspace-nav-open .app-sidebar .app-nav-group__title {
    display: flex;
  }

  html.ps-workspace-nav-open .app-sidebar .app-nav-group__label {
    opacity: 1;
    width: auto;
    transition-delay: 0s;
  }

  html.ps-workspace-nav-open .app-sidebar .app-nav-item {
    font-size: 12px;
    justify-content: flex-start;
    padding: 0 12px;
  }

  html.ps-workspace-nav-open .app-sidebar .app-nav-item::after {
    content: none !important;
  }

  .cockpit-row .app-sidebar {
    flex: 0 0 0;
    min-width: 0;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: calc(var(--app-shell-header-h) + env(safe-area-inset-top, 0px));
    bottom: 0;
    width: min(320px, 88vw) !important;
    max-width: var(--app-sidebar-expanded-w);
    z-index: 20040;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  html.ps-workspace-nav-open .app-sidebar {
    transform: translateX(0);
  }

  html.ps-workspace-nav-open .ps-workspace-nav-backdrop {
    display: block;
  }

  .app-sidebar.is-expanded {
    width: min(320px, 88vw) !important;
  }
}

/* ---- Command palette modal ---- */
.pitstrike-command-palette[hidden] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.pitstrike-command-palette {
  position: fixed;
  inset: 0;
  z-index: 22000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 9vh 16px 24px;
  box-sizing: border-box;
}

.pitstrike-command-palette__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 4, 9, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border: none;
  cursor: pointer;
}

.pitstrike-command-palette__dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: 74vh;
  margin-top: 0;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(14, 18, 26, 0.97);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 24px 64px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pitstrike-palette-in 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

@supports (backdrop-filter: blur(20px)) {
  .pitstrike-command-palette__dialog {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(14, 18, 26, 0.92);
  }
}

@keyframes pitstrike-palette-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.984);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Search bar */
.pitstrike-command-palette__search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.pitstrike-command-palette__search-ico {
  flex: 0 0 auto;
  font-size: 16px;
  opacity: 0.38;
  line-height: 1;
  color: #c9d1d9;
}

.pitstrike-command-palette__input {
  flex: 1 1 auto;
  height: 44px;
  margin: 0;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: #e6edf3;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  font-family: inherit;
  letter-spacing: 0.01em;
}

.pitstrike-command-palette__input::placeholder {
  color: rgba(139, 148, 158, 0.5);
}

/* Results scroll area */
.pitstrike-command-palette__results {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 100px;
  max-height: calc(74vh - 52px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 10px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* Section header (QUICK ACTIONS / WORKSPACES / ACTIONS / RECENT) */
.pitstrike-command-palette__section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  margin-bottom: 6px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(139, 148, 158, 0.6);
  line-height: 1;
}

.pitstrike-command-palette__section::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.pitstrike-command-palette__section--first {
  margin-top: 8px;
}

/* Workspace subsection (Trading / Intelligence / Journal / Missions) */
.pitstrike-command-palette__subsection {
  padding: 6px 4px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(88, 150, 220, 0.65);
  margin-top: 10px;
}

/* Row card */
.pitstrike-command-palette__result {
  display: grid !important;
  grid-template-columns: 36px 1fr auto !important;
  gap: 12px;
  align-items: center;
  width: 100% !important;
  min-height: 60px;
  margin-bottom: 3px;
  padding: 8px 10px;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #c9d1d9;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition:
    background 110ms ease,
    border-color 110ms ease,
    box-shadow 110ms ease;
}

.pitstrike-command-palette__result:hover,
.pitstrike-command-palette__result.is-highlighted {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 0 transparent;
  color: #e6edf3;
}

/* Quick actions: amber left border */
.pitstrike-command-palette__result[data-kind="quick"]:hover,
.pitstrike-command-palette__result[data-kind="quick"].is-highlighted {
  border-left-color: rgba(210, 153, 34, 0.7);
  background: rgba(210, 153, 34, 0.05);
}

/* Workspace: blue left border */
.pitstrike-command-palette__result[data-kind="workspace"]:hover,
.pitstrike-command-palette__result[data-kind="workspace"].is-highlighted {
  border-left-color: rgba(88, 166, 255, 0.7);
  background: rgba(88, 166, 255, 0.05);
}

/* Actions: purple left border */
.pitstrike-command-palette__result[data-kind="actions"]:hover,
.pitstrike-command-palette__result[data-kind="actions"].is-highlighted {
  border-left-color: rgba(138, 108, 220, 0.7);
  background: rgba(138, 108, 220, 0.05);
}

/* Recent: teal left border */
.pitstrike-command-palette__result[data-kind="recent"]:hover,
.pitstrike-command-palette__result[data-kind="recent"].is-highlighted {
  border-left-color: rgba(56, 189, 155, 0.6);
  background: rgba(56, 189, 155, 0.04);
}

/* Icon tile */
.pitstrike-command-palette__result-tile {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
  color: rgba(201, 209, 217, 0.82);
}

.pitstrike-command-palette__result[data-kind="quick"] .pitstrike-command-palette__result-tile {
  background: rgba(210, 153, 34, 0.1);
  border-color: rgba(210, 153, 34, 0.2);
  color: rgba(226, 179, 80, 0.9);
}

.pitstrike-command-palette__result[data-kind="workspace"] .pitstrike-command-palette__result-tile {
  background: rgba(88, 166, 255, 0.09);
  border-color: rgba(88, 166, 255, 0.18);
  color: rgba(120, 180, 255, 0.9);
}

.pitstrike-command-palette__result[data-kind="actions"] .pitstrike-command-palette__result-tile {
  background: rgba(138, 108, 220, 0.09);
  border-color: rgba(138, 108, 220, 0.18);
  color: rgba(163, 133, 240, 0.9);
}

.pitstrike-command-palette__result[data-kind="recent"] .pitstrike-command-palette__result-tile {
  background: rgba(56, 189, 155, 0.08);
  border-color: rgba(56, 189, 155, 0.16);
  color: rgba(86, 209, 175, 0.9);
}

/* Text column */
.pitstrike-command-palette__result-mid {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.pitstrike-command-palette__result-title {
  display: block !important;
  font-size: 13px;
  font-weight: 600;
  color: #dde4ee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.pitstrike-command-palette__result-sub {
  display: block !important;
  font-size: 11px;
  color: rgba(139, 148, 158, 0.82);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* kbd hint (optional shortcut label) */
.pitstrike-command-palette__result-kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  font-size: 10px;
  font-weight: 600;
  color: rgba(139, 148, 158, 0.7);
  white-space: nowrap;
  font-family: ui-monospace, monospace;
  flex-shrink: 0;
}

.pitstrike-command-palette__result-kbd:empty {
  display: none;
}

.pitstrike-command-palette__empty {
  padding: 36px 20px;
  font-size: 13px;
  color: rgba(139, 148, 158, 0.6);
  text-align: center;
  letter-spacing: 0.01em;
}
