/* ============================================================
 * MatterPage — 事项页面 sidebar（NavRail 入口）
 *
 * 渲染在 WKLayout contentLeft 区域（宽度由 WKLayout 拖拽控制）。
 * 规范对齐 DEVELOPMENT.md §2 — 全部用 --wk-* token。
 * ============================================================ */

.wk-mp-page-sidebar {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--wk-bg-base);
}

/* ─── Header ─────────────────────────────────────────── */

.wk-mp-page-sidebar__header {
  height: var(--wk-height-chat-conversation-header, 48px);
  min-height: var(--wk-height-chat-conversation-header, 48px);
  padding: 0 var(--wk-sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--wk-brand-tint-08, #e4e4e7);
  box-sizing: border-box;
}

.wk-mp-page-sidebar__title {
  font-size: var(--wk-text-size-md);
  font-weight: 600;
  color: var(--wk-text-primary);
  margin: 0;
}

.wk-mp-page-sidebar__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--wk-text-tertiary);
  cursor: pointer;
  border-radius: var(--wk-r-sm);
  font-size: var(--wk-text-size-xl);
}

.wk-mp-page-sidebar__close:hover {
  background: var(--wk-bg-hover);
  color: var(--wk-text-primary);
}

.wk-mp-page-sidebar__new-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--wk-sp-1);
  font-size: var(--wk-text-size-xs);
  padding: var(--wk-sp-1) var(--wk-sp-2);
  border-radius: var(--wk-r-sm);
  background: var(--wk-brand-primary);
  color: var(--wk-text-on-brand);
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: background var(--wk-dur-fast);
}

.wk-mp-page-sidebar__new-btn:hover {
  background: var(--wk-brand-primary-hover);
}

.wk-mp-page-sidebar__new-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Tabs ─────────────────────────────────────────────── */

.wk-mp-page-sidebar__tabs {
  display: flex;
  gap: var(--wk-sp-1);
  padding: 0 var(--wk-sp-3) var(--wk-sp-2);
}

.wk-mp-page-sidebar__tab {
  padding: var(--wk-sp-1) var(--wk-sp-2);
  border: none;
  background: transparent;
  color: var(--wk-text-tertiary);
  font-size: var(--wk-text-size-xs);
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--wk-r-sm);
  transition:
    color var(--wk-dur-fast),
    background var(--wk-dur-fast);
}

.wk-mp-page-sidebar__tab:hover {
  color: var(--wk-text-primary);
}

.wk-mp-page-sidebar__tab.is-active {
  background: var(--wk-bg-elevated);
  color: var(--wk-text-primary);
  font-weight: 600;
}

.wk-mp-page-sidebar__tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: var(--wk-sp-1);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--wk-r-full);
  background: var(--wk-bg-elevated);
  color: var(--wk-text-tertiary);
}

.wk-mp-page-sidebar__tab.is-active .wk-mp-page-sidebar__tab-count {
  background: var(--wk-brand-primary);
  color: var(--wk-text-on-brand);
}

/* ─── List ─────────────────────────────────────────────── */

.wk-mp-page-sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: var(--wk-sp-1) var(--wk-sp-2);
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.3s;
}

.wk-mp-page-sidebar__list:hover {
  scrollbar-color: color-mix(in srgb, var(--wk-text-primary) 15%, transparent)
    transparent;
}

.wk-mp-page-sidebar__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--wk-sp-8) 0;
  color: var(--wk-text-tertiary);
  font-size: var(--wk-text-size-sm);
}

.wk-mp-page-sidebar__archived-toggle {
  display: flex;
  align-items: center;
  gap: var(--wk-sp-1);
  width: 100%;
  padding: var(--wk-sp-2) var(--wk-sp-3);
  margin-top: var(--wk-sp-2);
  border: none;
  background: transparent;
  color: var(--wk-text-tertiary);
  font-size: var(--wk-text-size-xs);
  cursor: pointer;
  border-radius: var(--wk-r-sm);
}

.wk-mp-page-sidebar__archived-toggle:hover {
  background: var(--wk-bg-hover);
  color: var(--wk-text-primary);
}

.wk-mp-page-sidebar__archived-chev {
  display: inline-block;
  transition: transform var(--wk-dur-fast);
}

.wk-mp-page-sidebar__archived-chev.is-open {
  transform: rotate(90deg);
}

.wk-mp-page-sidebar__loadmore {
  display: block;
  width: 100%;
  padding: var(--wk-sp-2) 0;
  margin-top: var(--wk-sp-2);
  border: none;
  background: transparent;
  color: var(--wk-text-tertiary);
  font-size: var(--wk-text-size-xs);
  cursor: pointer;
  text-align: center;
}

.wk-mp-page-sidebar__loadmore:hover {
  color: var(--wk-text-primary);
}

/* ─── Sidebar Card ─────────────────────────────────────── */

.wk-mp-sidebar-card {
  width: 100%;
  text-align: left;
  padding: var(--wk-sp-3);
  border-radius: var(--wk-r-md);
  margin-bottom: var(--wk-sp-1);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition:
    background var(--wk-dur-fast),
    border-color var(--wk-dur-fast),
    box-shadow var(--wk-dur-fast);
}

.wk-mp-sidebar-card:hover {
  background: var(--wk-bg-hover);
  border-color: var(--wk-border-default);
}

.wk-mp-sidebar-card.is-selected {
  background: var(--wk-bg-selected);
  border-color: var(--wk-border-strong);
  box-shadow: var(--wk-shadow-sm);
}

.wk-mp-sidebar-card__row1 {
  display: flex;
  align-items: center;
  gap: var(--wk-sp-2);
  margin-bottom: var(--wk-sp-1);
}

.wk-mp-sidebar-card__id {
  font-family: var(--wk-font-mono);
  font-size: var(--wk-text-size-xs);
  color: var(--wk-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.wk-mp-sidebar-card__status {
  display: inline-flex;
  align-items: center;
  gap: var(--wk-sp-0-5);
  font-size: var(--wk-text-size-tiny);
  font-weight: 500;
  padding: 1px var(--wk-sp-1-5);
  border-radius: var(--wk-r-full);
}

.wk-mp-sidebar-card__status--active {
  background: var(--wk-color-info-bg);
  color: var(--wk-color-info);
  border: 1px solid var(--wk-color-info);
}

.wk-mp-sidebar-card__status--done {
  background: var(--wk-color-success-bg);
  color: var(--wk-color-success);
  border: 1px solid var(--wk-color-success);
}

.wk-mp-sidebar-card__status--archived {
  background: var(--wk-bg-elevated);
  color: var(--wk-text-tertiary);
  border: 1px solid var(--wk-border-default);
}

.wk-mp-sidebar-card__status-dot {
  width: 4px;
  height: 4px;
  border-radius: var(--wk-r-circle);
  background: currentColor;
}

.wk-mp-sidebar-card__ddl {
  margin-left: auto;
  font-size: var(--wk-text-size-tiny);
  color: var(--wk-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.wk-mp-sidebar-card__title {
  font-size: var(--wk-text-size-sm);
  font-weight: 500;
  color: var(--wk-text-primary);
  line-height: 1.4;
  margin-bottom: var(--wk-sp-1-5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wk-mp-sidebar-card__meta {
  display: flex;
  align-items: center;
  gap: var(--wk-sp-1-5);
  font-size: var(--wk-text-size-xs);
  color: var(--wk-text-tertiary);
}

.wk-mp-sidebar-card__creator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--wk-text-secondary);
}

.wk-mp-sidebar-card__sep {
  color: var(--wk-border-default);
}

.wk-mp-sidebar-card__channel {
  color: var(--wk-text-tertiary);
}

.wk-mp-sidebar-card__meta-label {
  color: var(--wk-text-tertiary);
  font-size: var(--wk-text-size-xs);
}

.wk-mp-sidebar-card__owners {
  display: flex;
  align-items: center;
  gap: var(--wk-sp-1);
  font-size: var(--wk-text-size-xs);
  color: var(--wk-text-tertiary);
  margin-top: var(--wk-sp-1);
}

.wk-mp-sidebar-card__owners-avatars {
  display: inline-flex;
  align-items: center;
}

.wk-mp-sidebar-card__owners-avatars > span {
  position: relative;
  display: inline-flex;
}

.wk-mp-sidebar-card__owners-names {
  color: var(--wk-text-tertiary);
}

.wk-mp-sidebar-card__owners-more {
  color: var(--wk-border-default);
}

.wk-mp-sidebar-card__owners-label {
  color: var(--wk-text-tertiary);
}
