/* Talaan · V2.0.1 · compact desktop sidebar and brand mark */
.sidebar .brand {
  align-items:center;
  gap:6px !important;
}

.sidebar .talaan-brand-logo {
  display:block;
  flex:0 0 25px;
  width:25px;
  height:25px;
  object-fit:contain;
}

.sidebar .brand > strong {
  font-size:25px;
  font-weight:700;
  line-height:1;
  color:var(--text);
}

/* Keep the requested brand typography authoritative over legacy visual layers. */
html body #sidebar.sidebar .brand > strong {
  font-size:25px !important;
  font-weight:700 !important;
  line-height:1 !important;
  letter-spacing:0 !important;
  color:var(--text) !important;
}

/* Keep the approved dark sidebar authoritative over the later Liquid Glass light-mode layer. */
html body #sidebar.sidebar {
  background:var(--nav) !important;
  background-image:none !important;
  color:var(--text) !important;
  border-right:0 !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
}

html body #sidebar.sidebar .sidebar-close-button {
  color:var(--text) !important;
}

html body #sidebar.sidebar .nav-button {
  background:transparent !important;
  border-color:transparent !important;
  border-radius:var(--talaan-control-radius) !important;
  box-shadow:none !important;
  color:var(--muted) !important;
}

html body #sidebar.sidebar .nav-icon {
  background:transparent !important;
  color:var(--muted) !important;
}

html body #sidebar.sidebar .nav-icon-image {
  filter:brightness(0) invert(1) !important;
  opacity:.9 !important;
}

html body #sidebar.sidebar .nav-label {
  color:var(--muted) !important;
  font-size:12px !important;
  font-weight:700 !important;
}

html body #sidebar.sidebar .nav-button:is(:hover,:focus-visible) {
  background:rgba(53,111,209,.1) !important;
  border-color:rgba(92,145,232,.18) !important;
}

html body #sidebar.sidebar .nav-button.active {
  background:rgba(53,111,209,.18) !important;
  border-color:rgba(92,145,232,.3) !important;
}

html body #sidebar.sidebar .nav-button:hover,
html body #sidebar.sidebar .nav-button:focus-visible,
html body #sidebar.sidebar .nav-button.active,
html body #sidebar.sidebar .nav-button:hover .nav-label,
html body #sidebar.sidebar .nav-button:focus-visible .nav-label,
html body #sidebar.sidebar .nav-button.active .nav-label {
  color:var(--text) !important;
}

html body #sidebar.sidebar .nav-button.active .nav-icon {
  background:var(--primary) !important;
  color:var(--primary-contrast) !important;
  border-radius:var(--talaan-control-radius) !important;
}

html body #sidebar.sidebar .nav-button.active .nav-icon-image {
  filter:brightness(0) invert(1) !important;
  opacity:1 !important;
}

/* Navigation groups share one compact rhythm while remaining easy to scan. */
html body #sidebar.sidebar .nav-group + .nav-group {
  margin-top:8px !important;
}

html body #sidebar.sidebar .sidebar-settings-bottom {
  padding-top:12px !important;
}

@media (min-width:851px) {
  :root {
    --sidebar-rail-width:60px;
    --sidebar-compact-expanded-width:185px;
  }

  html body .sidebar {
    width:var(--sidebar-rail-width) !important;
    min-width:var(--sidebar-rail-width) !important;
    max-width:var(--sidebar-rail-width) !important;
    padding:10px 6px !important;
    background:var(--nav) !important;
    color:var(--text) !important;
    transform:none !important;
    overflow:visible !important;
    box-shadow:7px 0 20px rgba(16,24,40,.11) !important;
    transition:width .22s ease,max-width .22s ease,box-shadow .22s ease !important;
  }

  html body .sidebar.desktop-open,
  html body .sidebar.sidebar-pinned {
    width:var(--sidebar-compact-expanded-width) !important;
    min-width:var(--sidebar-compact-expanded-width) !important;
    max-width:var(--sidebar-compact-expanded-width) !important;
    padding:10px 8px !important;
    box-shadow:14px 0 32px rgba(16,24,40,.16) !important;
  }

  html body .main {
    margin-left:var(--sidebar-rail-width) !important;
    transition:margin-left .22s ease !important;
  }

  html body.sidebar-layout-pinned .main {
    margin-left:var(--sidebar-compact-expanded-width) !important;
  }

  /* Collapsed desktop rail shows the 25px Talaan logo only. */
  html body #sidebar.sidebar:not(.desktop-open):not(.sidebar-pinned) .brand {
    position:absolute !important;
    top:10px !important;
    left:6px !important;
    width:48px !important;
    min-width:48px !important;
    max-width:48px !important;
    height:44px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    gap:0 !important;
    padding:0 !important;
    overflow:hidden !important;
    pointer-events:none !important;
  }

  html body #sidebar.sidebar:not(.desktop-open):not(.sidebar-pinned) .brand > strong {
    display:none !important;
  }

  html body #sidebar.sidebar:not(.desktop-open):not(.sidebar-pinned) .talaan-brand-logo {
    display:block !important;
    flex:0 0 25px !important;
    width:25px !important;
    height:25px !important;
  }

  /* Keep the existing click target in the same top slot while the logo is visible. */
  html body #sidebar.sidebar:not(.desktop-open):not(.sidebar-pinned) .sidebar-close-button {
    left:6px !important;
    right:auto !important;
    top:10px !important;
    width:48px !important;
    min-width:48px !important;
    max-width:48px !important;
    height:44px !important;
    min-height:44px !important;
    max-height:44px !important;
    z-index:2 !important;
    border-color:transparent !important;
    background:transparent !important;
  }

  html body #sidebar.sidebar:not(.desktop-open):not(.sidebar-pinned) .sidebar-close-button
  :is(.sidebar-pin-icon,.sidebar-unpin-icon,.sidebar-mobile-close-icon) {
    opacity:0 !important;
  }

  /* Open or pinned desktop rail: logo + title first, pin control at the end. */
  html body #sidebar.sidebar.desktop-open .brand,
  html body #sidebar.sidebar.sidebar-pinned .brand {
    position:absolute !important;
    top:10px !important;
    left:18px !important;
    right:44px !important;
    height:42px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:6px !important;
    padding:0 !important;
    overflow:hidden !important;
    white-space:nowrap !important;
    pointer-events:auto !important;
  }

  html body #sidebar.sidebar.desktop-open .sidebar-close-button,
  html body #sidebar.sidebar.sidebar-pinned .sidebar-close-button {
    left:auto !important;
    right:8px !important;
  }

  html body #sidebar.sidebar.desktop-open .talaan-brand-logo,
  html body #sidebar.sidebar.sidebar-pinned .talaan-brand-logo {
    display:block !important;
    flex:0 0 25px !important;
    width:25px !important;
    height:25px !important;
  }

  html body #sidebar.sidebar.desktop-open .brand > strong,
  html body #sidebar.sidebar.sidebar-pinned .brand > strong {
    display:block !important;
    min-width:0 !important;
    max-width:100% !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    white-space:nowrap !important;
    font-size:25px !important;
    font-weight:700 !important;
    line-height:1 !important;
    letter-spacing:0 !important;
    color:var(--text) !important;
  }

  html body .sidebar .sidebar-navigation,
  html body .sidebar.desktop-open .sidebar-navigation,
  html body .sidebar.sidebar-pinned .sidebar-navigation {
    margin-top:48px !important;
    gap:4px !important;
  }

  html body .sidebar .nav-button {
    position:relative !important;
    box-sizing:border-box !important;
    width:48px !important;
    min-width:48px !important;
    max-width:48px !important;
    min-height:44px !important;
    padding:8px 10px !important;
    gap:9px !important;
    overflow:visible !important;
    color:var(--muted) !important;
  }

  html body .sidebar.desktop-open .nav-button,
  html body .sidebar.sidebar-pinned .nav-button {
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
    padding:8px 10px !important;
  }

  html body .sidebar .nav-icon {
    flex:0 0 28px !important;
    width:28px !important;
    min-width:28px !important;
    max-width:28px !important;
    height:28px !important;
    min-height:28px !important;
    max-height:28px !important;
  }

  html body .sidebar .nav-icon-image {
    display:block !important;
    width:16px !important;
    min-width:16px !important;
    max-width:16px !important;
    height:16px !important;
    min-height:16px !important;
    max-height:16px !important;
    object-fit:contain !important;
  }

  html body .sidebar .nav-label {
    width:0 !important;
    max-width:0 !important;
    opacity:0 !important;
    overflow:hidden !important;
    pointer-events:none !important;
    transform:none !important;
    font-size:12px !important;
    font-weight:700 !important;
    color:var(--muted) !important;
  }

  html body .sidebar.desktop-open .nav-label,
  html body .sidebar.sidebar-pinned .nav-label {
    width:auto !important;
    max-width:120px !important;
    opacity:1 !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    white-space:nowrap !important;
    pointer-events:auto !important;
    transition:opacity .16s ease .04s !important;
  }

  html body .sidebar .nav-button:hover,
  html body .sidebar .nav-button:focus-visible,
  html body .sidebar .nav-button.active,
  html[data-theme="dark"] body .sidebar .nav-button.active,
  html body .sidebar.desktop-open .nav-button.active,
  html body .sidebar.sidebar-pinned .nav-button.active {
    color:var(--text) !important;
  }

  html body .sidebar .nav-button:hover .nav-label,
  html body .sidebar .nav-button:focus-visible .nav-label,
  html body .sidebar .nav-button.active .nav-label,
  html[data-theme="dark"] body .sidebar .nav-button.active .nav-label {
    color:var(--text) !important;
  }

  /* Keep Insights available in both collapsed and expanded states. */
  html body .sidebar .insights-nav-button,
  html body .sidebar.desktop-open .insights-nav-button,
  html body .sidebar.sidebar-pinned .insights-nav-button {
    display:flex !important;
    padding-inline-start:10px !important;
  }

  /* Keep every selected destination visible across the full compact row. */
  html body .sidebar .nav-button.active,
  html[data-theme="dark"] body .sidebar .nav-button.active,
  html body .sidebar.desktop-open .nav-button.active,
  html body .sidebar.sidebar-pinned .nav-button.active {
    background:rgba(53,111,209,.18) !important;
    border-color:rgba(92,145,232,.3) !important;
    box-shadow:none !important;
  }

  html body .sidebar .nav-button.active .nav-icon,
  html[data-theme="dark"] body .sidebar .nav-button.active .nav-icon,
  html body .sidebar.desktop-open .nav-button.active .nav-icon,
  html body .sidebar.sidebar-pinned .nav-button.active .nav-icon {
    display:grid !important;
    place-items:center !important;
    background:var(--primary) !important;
    color:var(--primary-contrast) !important;
    border-radius:var(--talaan-control-radius) !important;
  }

  html body .sidebar .nav-button.active .nav-icon-image,
  html[data-theme="dark"] body .sidebar .nav-button.active .nav-icon-image,
  html body .sidebar.desktop-open .nav-button.active .nav-icon-image,
  html body .sidebar.sidebar-pinned .nav-button.active .nav-icon-image {
    filter:brightness(0) invert(1) !important;
    opacity:1 !important;
  }

  /* Tooltips are only needed while the desktop rail is collapsed. */
  html body .sidebar:not(.desktop-open):not(.sidebar-pinned) .nav-button::after {
    content:attr(data-nav-label) !important;
    position:absolute !important;
    left:calc(100% + 9px) !important;
    top:50% !important;
    z-index:120 !important;
    transform:translate(5px,-50%) !important;
    padding:7px 10px !important;
    border:1px solid rgba(255,255,255,.18) !important;
    border-radius:var(--talaan-control-radius) !important;
    background:#1F2937 !important;
    color:var(--text) !important;
    box-shadow:0 8px 22px rgba(15,23,42,.28) !important;
    font-size:13px !important;
    font-weight:700 !important;
    line-height:1.2 !important;
    letter-spacing:0 !important;
    white-space:nowrap !important;
    opacity:0 !important;
    visibility:hidden !important;
    pointer-events:none !important;
    transition:opacity .14s ease,transform .14s ease,visibility .14s !important;
  }

  html body .sidebar:not(.desktop-open):not(.sidebar-pinned) .nav-button:hover::after,
  html body .sidebar:not(.desktop-open):not(.sidebar-pinned) .nav-button:focus-visible::after {
    opacity:1 !important;
    visibility:visible !important;
    transform:translate(0,-50%) !important;
  }

  html body .sidebar.desktop-open .nav-button::after,
  html body .sidebar.sidebar-pinned .nav-button::after {
    content:none !important;
  }
}

@media (max-width:850px) {
  html body #sidebar.sidebar {
    width:min(320px,calc(100vw - 24px)) !important;
    min-width:0 !important;
    max-width:calc(100vw - 24px) !important;
    padding:max(18px,calc(env(safe-area-inset-top) + 12px)) 12px max(18px,calc(env(safe-area-inset-bottom) + 12px)) !important;
  }

  .sidebar .talaan-brand-logo {
    flex-basis:25px;
    width:25px;
    height:25px;
  }

  html body #sidebar.sidebar .brand > strong {
    font-size:25px !important;
    font-weight:700 !important;
    line-height:1 !important;
    letter-spacing:0 !important;
    color:var(--text) !important;
  }

  html body #sidebar.sidebar .sidebar-navigation {
    gap:4px !important;
  }

  html body #sidebar.sidebar .nav-button {
    width:100% !important;
    min-height:48px !important;
    padding:10px !important;
    gap:10px !important;
    border-radius:var(--talaan-control-radius) !important;
  }

  html body #sidebar.sidebar .nav-icon {
    flex:0 0 28px !important;
    width:28px !important;
    height:28px !important;
  }

  html body #sidebar.sidebar .nav-label {
    width:auto !important;
    max-width:none !important;
    opacity:1 !important;
    font-size:12px !important;
    font-weight:700 !important;
    line-height:1.2 !important;
  }
}

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

/* Approved flat theme-aware sidebar specification. Liquid Glass remains available elsewhere. */
html[data-theme="light"] body #sidebar.sidebar,
html[data-theme="dark"] body #sidebar.sidebar {
  background-image:none !important;
  border-right:0 !important;
  box-shadow:none !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
}

html[data-theme="light"] body #sidebar.sidebar {
  background:#FFFFFF !important;
  color:var(--text) !important;
}

html[data-theme="dark"] body #sidebar.sidebar {
  background:#080B10 !important;
  color:#FFFFFF !important;
}

html[data-theme="light"] body #sidebar.sidebar .brand > strong,
html[data-theme="dark"] body #sidebar.sidebar .brand > strong,
html[data-theme="light"] body #sidebar.sidebar.desktop-open .brand > strong,
html[data-theme="light"] body #sidebar.sidebar.sidebar-pinned .brand > strong,
html[data-theme="dark"] body #sidebar.sidebar.desktop-open .brand > strong,
html[data-theme="dark"] body #sidebar.sidebar.sidebar-pinned .brand > strong {
  font-size:20px !important;
  font-weight:700 !important;
  line-height:1 !important;
  letter-spacing:0 !important;
}

html[data-theme="light"] body #sidebar.sidebar .brand > strong,
html[data-theme="light"] body #sidebar.sidebar .sidebar-close-button {
  color:var(--text) !important;
}

html[data-theme="dark"] body #sidebar.sidebar .brand > strong,
html[data-theme="dark"] body #sidebar.sidebar .sidebar-close-button {
  color:#FFFFFF !important;
}

html[data-theme="light"] body #sidebar.sidebar :is(.sidebar-close-button,.nav-button),
html[data-theme="dark"] body #sidebar.sidebar :is(.sidebar-close-button,.nav-button) {
  background:transparent !important;
  background-image:none !important;
  border-color:transparent !important;
  box-shadow:none !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
}

html[data-theme="light"] body #sidebar.sidebar .nav-button,
html[data-theme="light"] body #sidebar.sidebar .nav-label {
  color:var(--text) !important;
}

html[data-theme="dark"] body #sidebar.sidebar .nav-button,
html[data-theme="dark"] body #sidebar.sidebar .nav-label {
  color:#FFFFFF !important;
}

html[data-theme="light"] body #sidebar.sidebar .nav-label,
html[data-theme="dark"] body #sidebar.sidebar .nav-label {
  font-size:12px !important;
  font-weight:700 !important;
}

html[data-theme="light"] body #sidebar.sidebar .nav-icon,
html[data-theme="dark"] body #sidebar.sidebar .nav-icon {
  background:transparent !important;
  box-shadow:none !important;
}

html[data-theme="light"] body #sidebar.sidebar .nav-icon {
  color:var(--text) !important;
}

html[data-theme="dark"] body #sidebar.sidebar .nav-icon {
  color:#FFFFFF !important;
}

html[data-theme="light"] body #sidebar.sidebar .nav-icon-image {
  filter:brightness(0) saturate(100%) !important;
  opacity:.9 !important;
}

html[data-theme="dark"] body #sidebar.sidebar .nav-icon-image {
  filter:brightness(0) invert(1) !important;
  opacity:1 !important;
}

html[data-theme="light"] body #sidebar.sidebar .nav-button:hover,
html[data-theme="light"] body #sidebar.sidebar .nav-button:focus-visible,
html[data-theme="light"] body #sidebar.sidebar .nav-button.active,
html[data-theme="light"] body #sidebar.sidebar .nav-button:hover .nav-label,
html[data-theme="light"] body #sidebar.sidebar .nav-button:focus-visible .nav-label,
html[data-theme="light"] body #sidebar.sidebar .nav-button.active .nav-label {
  color:var(--text) !important;
}

html[data-theme="dark"] body #sidebar.sidebar .nav-button:hover,
html[data-theme="dark"] body #sidebar.sidebar .nav-button:focus-visible,
html[data-theme="dark"] body #sidebar.sidebar .nav-button.active,
html[data-theme="dark"] body #sidebar.sidebar .nav-button:hover .nav-label,
html[data-theme="dark"] body #sidebar.sidebar .nav-button:focus-visible .nav-label,
html[data-theme="dark"] body #sidebar.sidebar .nav-button.active .nav-label {
  color:#FFFFFF !important;
}

html[data-theme="light"] body #sidebar.sidebar .nav-button.active .nav-icon,
html[data-theme="dark"] body #sidebar.sidebar .nav-button.active .nav-icon {
  display:grid !important;
  place-items:center !important;
  background:var(--primary) !important;
  color:var(--primary-contrast) !important;
  border-radius:var(--talaan-control-radius) !important;
}

html[data-theme="light"] body #sidebar.sidebar .nav-button.active .nav-icon-image,
html[data-theme="dark"] body #sidebar.sidebar .nav-button.active .nav-icon-image {
  filter:brightness(0) invert(1) !important;
  opacity:1 !important;
}

/* Full-row selection is the final authoritative sidebar state in both themes. */
html[data-theme="light"] body #sidebar.sidebar .nav-button:is(:hover,:focus-visible) {
  background:rgba(53,111,209,.07) !important;
  border-color:rgba(53,111,209,.12) !important;
}

html[data-theme="dark"] body #sidebar.sidebar .nav-button:is(:hover,:focus-visible) {
  background:rgba(53,111,209,.12) !important;
  border-color:rgba(92,145,232,.2) !important;
}

html[data-theme="light"] body #sidebar.sidebar .nav-button.active {
  background:rgba(53,111,209,.12) !important;
  border-color:rgba(53,111,209,.22) !important;
}

html[data-theme="dark"] body #sidebar.sidebar .nav-button.active {
  background:rgba(53,111,209,.22) !important;
  border-color:rgba(92,145,232,.36) !important;
}

html[data-theme="light"] body #sidebar.sidebar .sidebar-settings-bottom {
  border-block-start-color:rgba(8,11,16,.12) !important;
}

html[data-theme="dark"] body #sidebar.sidebar .sidebar-settings-bottom {
  border-block-start-color:rgba(255,255,255,.14) !important;
}

/* Collapsed desktop rail: the Talaan logo owns the expand/pin affordance. */
@media (min-width:851px) {
  html body #sidebar.sidebar:not(.desktop-open):not(.sidebar-pinned) .sidebar-close-button {
    display:grid !important;
    visibility:visible !important;
    opacity:1 !important;
    pointer-events:auto !important;
    cursor:pointer !important;
  }

  html body #sidebar.sidebar:not(.desktop-open):not(.sidebar-pinned) .sidebar-close-button:is(:hover,:focus-visible) .sidebar-pin-icon {
    opacity:1 !important;
  }

  html body #sidebar.sidebar:not(.desktop-open):not(.sidebar-pinned) .sidebar-close-button:is(:hover,:focus-visible) :is(.sidebar-unpin-icon,.sidebar-mobile-close-icon) {
    opacity:0 !important;
  }

  html body #sidebar.sidebar:not(.desktop-open):not(.sidebar-pinned) .sidebar-close-button:is(:hover,:focus-visible) + .brand .talaan-brand-logo {
    opacity:0 !important;
  }

  html body #sidebar.sidebar:not(.desktop-open):not(.sidebar-pinned) :is(.talaan-brand-logo,.sidebar-pin-icon) {
    transition:opacity .14s ease !important;
  }
}
