/* ============================================================================
 * R91 · 统一左侧栏（对齐图3）· R94 奶油白
 * ----------------------------------------------------------------------------
 * 结构：品牌 / 新建任务 / 自动化 / 插件市场 / 任务列表（项目分组）/ 账号
 * 说明：覆盖 home.css 的浅色侧栏，主页与业务页共用；业务页入口收进「插件市场」。
 * ========================================================================== */

.shell,
.gov-home-mode .shell { grid-template-columns: 258px 1fr; }

.sidebar.zside,
.gov-home-mode .sidebar.zside {
  background: linear-gradient(180deg, #fdf9f0 0%, #f9f2e5 58%, #f4ebda 100%);
  background-image:
    radial-gradient(320px 200px at 50% -14%, rgba(217, 164, 65, .16), transparent 70%),
    linear-gradient(180deg, #fdf9f0 0%, #f9f2e5 58%, #f4ebda 100%);
  border-right: 1px solid #e9dcc6;
  box-shadow: none;
  color: #4a3a32;
  padding: 12px 10px 8px;
  gap: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.zside .brand,
.gov-home-mode .zside .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 8px 12px;
  flex: none;
}
.zside .brand-img,
.gov-home-mode .zside .brand-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fffdf8;
  box-shadow: 0 0 0 1px rgba(176, 125, 26, .22);
  flex: none;
}
.zside .brand-text b,
.gov-home-mode .zside .brand-text b {
  display: block;
  color: #7c0a10;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
}
.zside .brand-text span,
.gov-home-mode .zside .brand-text span {
  display: block;
  color: #9a7b4a;
  font-size: 10px;
  letter-spacing: .05em;
}

.zside-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.zside-mobile-only { display: none; }
.zside-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: none;
  padding: 2px 0 10px;
  border-bottom: 1px solid #ecdfca;
}
.zside-act {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4a3a32;
  font-size: 13.5px;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.zside-act:hover { background: #f1e6d4; color: #7c0a10; text-decoration: none; }
.zside-act.active { background: #efe2cd; color: #7c0a10; box-shadow: inset 2px 0 0 var(--gold); }
.zside-act .nav-ico { color: #9a7b4a; opacity: 1; flex: none; }
.zside-act .kbd { margin-left: auto; color: #a08d76; font-size: 10px; letter-spacing: 0; }

.zside-tasks {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-top: 8px;
}
.zside-sec-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 5px 8px 4px;
  color: #8a7868;
  font-size: 11.5px;
  letter-spacing: .04em;
}
.zside-sec-tools { margin-left: auto; display: flex; align-items: center; gap: 0; }

.zside-icon-btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8a7868;
  cursor: pointer;
}
.zside-icon-btn:hover,
.zside-icon-btn.active { background: #f1e6d4; color: #7c0a10; }

.zside-filter { position: relative; }
.zside-filter > summary { list-style: none; }
.zside-filter > summary::-webkit-details-marker { display: none; }
.zside-filter-menu {
  position: absolute;
  right: 0;
  top: 28px;
  z-index: 30;
  min-width: 118px;
  padding: 4px;
  border: 1px solid #e6d9c2;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 12px 30px rgba(74, 48, 20, .16);
}
.zside-filter-item {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4a3a32;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.zside-filter-item:hover { background: #f6efe1; }
.zside-filter-item.active { background: #efe2cd; color: #7c0a10; }

.zside-search { flex: none; padding: 2px 6px 6px; }
.zside-search input {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border: 1px solid #e6d9c2;
  border-radius: 7px;
  background: #fffdf8;
  color: #2b211c;
  font-size: 12.5px;
  outline: none;
}
.zside-search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 125, 26, .12); }
.zside-search input::placeholder { color: #a08d76; }

.zside-project {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  flex: none;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8a7868;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.zside-project:hover { background: #f6efe1; color: #7c0a10; }
.zside-project .nav-ico:last-child { margin-left: auto; transition: transform .15s; }
.zside-project[aria-expanded="false"] .nav-ico:last-child { transform: rotate(-90deg); }

.zside-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 2px 8px;
}
.zside-list::-webkit-scrollbar { width: 6px; }
.zside-list::-webkit-scrollbar-thumb { background: #ddceb4; border-radius: 99px; }

.zside-group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 5px 8px 5px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8a7868;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.zside-group-head:hover { background: #f6efe1; color: #7c0a10; }
.zside-group-head .g { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zside-group-head .n { margin-left: auto; color: #b3a18a; font-size: 10.5px; }
.zside-group-head .nav-ico:last-child { transition: transform .15s; }
.zside-group-head[aria-expanded="false"] .nav-ico:last-child { transform: rotate(-90deg); }

.zside-task-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 7px;
}
.zside-task-row:hover { background: #f1e6d4; }
.zside-task-row:hover .zside-task { color: #7c0a10; }
.zside-task {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 6px 8px 6px 22px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4a3a32;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.zside-task:hover { background: transparent; }
.zside-task .nav-ico { color: var(--ok); opacity: .9; flex: none; margin-top: 2px; }
/* 任务行两行版式：标题 + “N 条消息 · 时间”（对齐参考图的任务卡）。 */
.zside-task-main { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.zside-task .t {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.zside-task .meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #a08d76;
  font-size: 10.5px;
}

/* 当前任务：与参考图一致做整行高亮，并在左侧留一道品牌色竖条。 */
.zside-task-row.is-active { background: #f3e7d5; }
.zside-task-row.is-active:hover { background: #efe0c8; }
.zside-task-row.is-active .zside-task { color: #7c0a10; }
.zside-task-row.is-active::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--brand, #c8102e);
}
/* 新建但还没发送的任务：虚线卡，点一下回到输入框继续写。 */
.zside-task-row.is-draft { border: 1px dashed #dcc9ab; background: #fbf4e8; }
.zside-task-row.is-draft:hover { background: #f6ead4; }
.zside-task-row.is-draft .zside-task { padding-right: 10px; }
.zside-task-row.is-draft .nav-ico { color: #c8102e; }

/* 行尾操作：默认收起，悬停/键盘聚焦时浮在“消息数·时间”一行上。
 * R112：不再改标题的 padding-right——悬停时标题宽度恒定，文字不会重新截断跳动。 */
.zside-task-acts {
  position: absolute;
  right: 6px;
  top: auto;
  bottom: 4px;
  transform: translateY(2px);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 1px;
  border: 1px solid rgba(150, 110, 60, .16);
  border-radius: 6px;
  background: #fffdf8;
  box-shadow: 0 2px 8px rgba(90, 60, 25, .10);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s var(--ui-ease, ease), transform .12s var(--ui-ease, ease);
}
.zside-task-row:hover .zside-task-acts,
.zside-task-row:focus-within .zside-task-acts { opacity: 1; transform: none; pointer-events: auto; }
.zside-task-row.has-acts:hover .meta,
.zside-task-row.has-acts:focus-within .meta { opacity: 0; }
.zside-task-act {
  padding: 2px 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #7a6757;
  font-size: 10.5px;
  line-height: 1.5;
  cursor: pointer;
}
.zside-task-act:hover { background: #e4d2b8; color: #7c0a10; }
.zside-task-act.danger:hover { background: #f3d9d3; color: #a3231d; }
.zside-task-row.is-archived .zside-task { color: #6f5d4e; }
.zside-arch-head { margin-top: 4px; }
.zside-arch-head .nav-ico:first-child { color: #a08d76; }

/* 触控设备没有悬停：操作常驻，标题自动让位 */
@media (hover: none) {
  .zside-task-acts {
    position: static;
    transform: none;
    padding: 0 4px 0 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    pointer-events: auto;
  }
  .zside-task-row .zside-task { width: auto; }
  /* 触屏没有浮层，操作常驻，meta 需要保持可见 */
  .zside-task-row.has-acts:hover .meta,
  .zside-task-row.has-acts:focus-within .meta { opacity: 1; }
}

.zside-more {
  display: block;
  width: 100%;
  padding: 5px 8px 5px 22px;
  border: 0;
  background: transparent;
  color: #9a8872;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}
.zside-more:hover { color: #7c0a10; }
.zside-empty { padding: 12px 10px; color: #a08d76; font-size: 11.5px; line-height: 1.8; }
.zside-collapsed { padding: 8px 10px; color: #a08d76; font-size: 11px; }

.zside-foot,
.gov-home-mode .sidebar-foot.zside-foot {
  margin-top: auto;
  flex: none;
  padding: 8px 2px 2px;
  border-top: 1px solid #ecdfca;
  color: #9a8872;
}
.zside-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 8px;
}
.zside-account:hover { background: #f1e6d4; }
.zside-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: #7c0a10;
  color: #fff8ee;
  font-size: 11px;
  font-weight: 700;
}
.zside-account-text { flex: 1; min-width: 0; }
.zside-account-text b {
  display: block;
  overflow: hidden;
  color: #2b211c;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.zside-account-text span { display: block; color: #9a8872; font-size: 10.5px; }
.zside-ico {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  flex: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9a7b4a;
  text-decoration: none;
  cursor: pointer;
}
.zside-ico:hover { background: #efe2cd; color: #7c0a10; text-decoration: none; }

@media (max-width: 900px) {
  .shell,
  .gov-home-mode .shell { grid-template-columns: 1fr; align-content: start; }
  .sidebar.zside,
  .gov-home-mode .sidebar.zside {
    position: static;
    height: auto;
    padding: 8px 10px;
    overflow: visible;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  .zside .brand,
  .gov-home-mode .zside .brand { display: none; }
  .zside-body { flex: 1; flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
  .zside-actions { flex-direction: row; gap: 2px; padding: 0; border: 0; overflow-x: auto; max-width: 100%; }
  .zside-act { width: auto; height: 32px; white-space: nowrap; }
  .zside-mobile-only { display: inline-flex; }
  .zside-act .kbd { display: none; }
  .zside-tasks { display: none; }
  .zside-foot,
  .gov-home-mode .sidebar-foot.zside-foot {
    display: block;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
  }
  .zside-account-text { display: none; }
}

html.gc-contrast .sidebar.zside,
html.gc-contrast .gov-home-mode .sidebar.zside { background: #000; border-color: #f2c94b; }
