/* Desktop sidebar — Figma TaskDay (240px, labels + realm) */

.app-sidebar {
  display: none;
}

@media (min-width: 1025px) {
  .app-shell {
    display: flex;
    align-items: stretch;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    width: 100%;
    background: var(--bg-app);
    overflow: hidden;
  }

  .app-sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w, 240px);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    height: 100dvh;
    z-index: 140;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-subtle, var(--border));
    padding: 28px 12px 16px;
    box-sizing: border-box;
    gap: 0;
  }

  .app-sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 0 16px 20px;
    border: 0;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    color: inherit;
  }

  .app-sidebar-brand .brand-mark,
  .app-sidebar-brand .brand-ring {
    display: none;
  }

  .app-sidebar-lockup {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .app-sidebar-brand-mark {
    width: 32px;
    height: 30px;
    display: block;
    flex-shrink: 0;
  }

  .app-sidebar-brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .app-sidebar-brand .brand-word img {
    height: 19px;
  }

  .app-sidebar-brand-name {
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.1;
    text-transform: lowercase;
  }

  .app-sidebar-tagline {
    font-size: 7.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .app-sidebar-realm {
    margin: 0 8px 28px;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 4px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 11px;
    height: 42px;
    box-sizing: border-box;
  }

  body.realm-single .app-sidebar-realm {
    display: none !important;
  }

  .app-sidebar-realm .realm-opt {
    flex: 1;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
  }

  .app-sidebar-realm .realm-opt.active {
    background: #fff;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
  }

  .app-sidebar-realm .realm-opt .dot {
    display: none;
  }

  .app-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 0 8px;
  }

  .app-side-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .app-side-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    opacity: 0.85;
  }

  .app-side-btn:hover {
    background: var(--bg-card-hover);
  }

  .app-side-btn.is-active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .app-side-btn.is-active svg {
    opacity: 1;
  }

  .app-side-btn span {
    line-height: 1.2;
    text-align: left;
  }

  .app-sidebar-section {
    margin: 18px 16px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .app-sidebar-foot {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
  }

  .app-side-btn.is-foot {
    min-height: 36px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
  }

  .app-sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 4px 0;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    text-align: left;
    width: calc(100% - 8px);
    font: inherit;
    color: inherit;
  }

  .app-sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 18px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
  }

  .app-sidebar-profile-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .app-sidebar-profile-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
  }

  .app-sidebar-profile-sub {
    font-size: 10px;
    color: var(--text-muted);
  }

  .app-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-app);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  /* Brand + realm live in sidebar on desktop */
  .app-shell .topbar .brand-pill.brand-logo,
  .app-shell .topbar .brand-group > .brand-pill,
  .app-shell .topbar #realmSwitchSep,
  .app-shell .topbar #realmSwitch {
    display: none !important;
  }
}

html[data-theme="dark"] .app-sidebar {
  background: var(--bg-panel);
  border-right-color: var(--border);
}

html[data-theme="dark"] .app-sidebar-realm .realm-opt.active,
html[data-theme="dark"] .app-sidebar-profile {
  background: var(--bg-card);
}
