/* Local MVP workspace navigation. Loaded last so it owns the app chrome. */
.sidebar-topbar,
.sidebar-nav-region,
.sidebar-nav-shell,
.sidebar-card-copy {
  min-width: 0;
}

.sidebar-brand {
  width: calc(100% - 4px);
  border: 0;
  border-bottom: 1px solid var(--sidebar-border);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.sidebar-brand-copy,
.sidebar-card-copy {
  display: grid;
  min-width: 0;
}

.sidebar-nav-region {
  display: grid;
  gap: 6px;
}

.sidebar-nav-shell {
  position: relative;
}

.nav-scroll-button {
  display: none;
}

.sidebar .sync-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.sidebar .auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
}

.sidebar-card-copy > strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-card-copy > span {
  min-width: 0;
  margin-top: 4px;
  overflow: hidden;
  color: var(--sidebar-muted);
  font-size: 12px;
  line-height: 1.42;
  text-overflow: ellipsis;
}

.sidebar-status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
}

.sidebar-status-dot.is-warning {
  background: #fbbf24;
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.11);
}

.sidebar .sync-card .sidebar-action {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.sidebar .auth-card .sidebar-action {
  margin-top: 10px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-rows: auto auto;
    align-content: start;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-areas:
      "brand utility"
      "navigation navigation";
    grid-template-columns: auto minmax(0, 1fr);
    height: auto;
    gap: 0 16px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    padding: 10px 16px 0;
    background: rgba(11, 59, 54, 0.97);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(16px);
  }

  .sidebar-topbar {
    grid-area: brand;
    display: flex;
    align-items: center;
  }

  .sidebar-brand {
    width: auto;
    min-width: 190px;
    min-height: 48px;
    margin: 0;
    border: 0;
    padding: 0;
  }

  .sidebar-brand .brand-logo-mark,
  .sidebar .brand-logo-mark,
  .sidebar .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14), 0 0 0 3px rgba(94, 234, 212, 0.08);
  }

  .sidebar .brand-name {
    font-size: 16px;
  }

  .sidebar-brand-kicker {
    margin-top: 2px;
    font-size: 10px;
  }

  .sidebar-nav-region {
    grid-area: navigation;
    gap: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }

  .sidebar-section-label {
    display: none;
  }

  .sidebar-nav-shell {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    align-items: center;
    gap: 4px;
  }

  .sidebar .nav-list {
    display: flex;
    min-width: 0;
    gap: 4px;
    overflow-x: auto;
    padding: 8px 0 10px;
    overscroll-behavior-inline: contain;
    scroll-behavior: smooth;
    scroll-snap-type: none;
    scrollbar-width: none;
  }

  .sidebar .nav-list::-webkit-scrollbar {
    display: none;
  }

  .sidebar .nav-button {
    width: auto;
    min-width: max-content;
    min-height: 38px;
    flex: 0 0 auto;
    gap: 0;
    border-radius: 8px;
    padding: 0 12px;
    scroll-snap-align: start;
    text-align: center;
    transform: translateY(0);
  }

  .sidebar .nav-button::before {
    display: none;
  }

  .sidebar .nav-button::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: 3px;
    left: 10px;
    height: 2px;
    border-radius: 999px;
    background: transparent;
    transition: background 160ms ease, transform 160ms ease;
    transform: scaleX(0.45);
  }

  .sidebar .nav-button:hover,
  .sidebar .nav-button:focus-visible {
    transform: translateY(-1px);
  }

  .sidebar .nav-button.active {
    border-color: rgba(94, 234, 212, 0.2);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
  }

  .sidebar .nav-button.active::after {
    background: var(--sidebar-accent);
    transform: scaleX(1);
  }

  .sidebar .nav-icon {
    display: none;
  }

  .nav-scroll-button {
    display: grid;
    width: 30px;
    height: 34px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0;
    background: transparent;
    color: rgba(240, 253, 250, 0.82);
    font-size: 23px;
    line-height: 1;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
  }

  .nav-scroll-button:hover,
  .nav-scroll-button:focus-visible {
    border-color: rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    outline: none;
  }

  .nav-scroll-button:focus-visible {
    box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.18);
  }

  .nav-scroll-button:disabled {
    cursor: default;
    opacity: 0.26;
  }

  .sidebar-footer {
    grid-area: utility;
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 0;
    padding: 0;
  }

  .sidebar .sync-card,
  .sidebar .auth-card {
    width: auto;
    min-width: 0;
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    border-radius: 10px;
    padding: 7px 9px;
    background: rgba(255, 255, 255, 0.045);
    box-shadow: none;
  }

  .sidebar .sync-card {
    max-width: 250px;
  }

  .sidebar .auth-card {
    max-width: 320px;
  }

  .sidebar-card-copy > strong {
    font-size: 12px;
  }

  .sidebar-footer .sidebar-card-copy {
    flex: 1 1 auto;
  }

  .sidebar-card-copy > span {
    margin-top: 2px;
    font-size: 10.5px;
    line-height: 1.25;
    white-space: nowrap;
  }

  .sidebar .sync-card .sidebar-action,
  .sidebar .auth-card .sidebar-action {
    width: auto;
    min-height: 30px;
    flex: 0 0 auto;
    margin: 0 0 0 2px;
    padding: 0 10px;
  }
}

@media (max-width: 720px) {
  .sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 8px;
    padding: 8px 10px 0;
  }

  .sidebar-brand {
    min-width: 0;
    min-height: 44px;
  }

  .sidebar-brand-kicker,
  .sidebar .sync-card .sidebar-card-copy,
  .sidebar .sync-card .sidebar-action,
  .sidebar .auth-card .sidebar-card-copy {
    display: none;
  }

  .sidebar .brand-name {
    font-size: 15px;
  }

  .sidebar-footer {
    grid-template-columns: none;
    gap: 6px;
  }

  .sidebar .sync-card {
    width: 34px;
    height: 34px;
    min-height: 34px;
    justify-content: center;
    border-radius: 9px;
    padding: 0;
  }

  .sidebar .sync-card.is-warning {
    width: auto;
    padding: 0 7px;
  }

  .sidebar .sync-card.is-warning .sidebar-action {
    display: inline-flex;
  }

  .sidebar .auth-card {
    min-height: 34px;
    border-color: transparent;
    padding: 0;
    background: transparent;
  }

  .sidebar .auth-card .sidebar-action {
    min-height: 34px;
    margin: 0;
    padding: 0 10px;
  }

  .sidebar-nav-shell {
    grid-template-columns: 28px minmax(0, 1fr) 28px;
    gap: 2px;
  }

  .nav-scroll-button {
    width: 28px;
    height: 32px;
  }

  .sidebar .nav-list {
    padding: 7px 0 8px;
  }

  .sidebar .nav-button {
    min-height: 36px;
    padding: 0 10px;
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar .nav-button,
  .sidebar .nav-button::after,
  .nav-scroll-button {
    transition: none;
  }

  .sidebar .nav-list {
    scroll-behavior: auto;
  }
}
