/* 主布局：侧边栏、顶部栏 */
/* ---------- 主布局 ---------- */
.layout { display: grid; grid-template-columns: 272px 1fr; height: 100%; }
.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
  padding-top: env(safe-area-inset-top);
}
.sidebar-head { padding: 12px; display: grid; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; padding: 2px 4px; }
.brand img { width: 24px; height: 24px; }
.new-chat {
  justify-content: flex-start; background: var(--panel); border-radius: 12px; min-height: 40px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); font-weight: 600;
}
.new-chat svg { color: var(--accent); }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 32px; min-height: 34px; background: var(--panel); }
.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.conv-group { font-size: 12px; color: var(--faint); padding: 12px 8px 4px; font-weight: 600; }
.conv {
  display: flex; align-items: center; gap: 4px; padding: 0 4px 0 10px; height: 36px;
  border-radius: 8px; cursor: pointer; color: var(--text); font-size: 14px;
}
.conv:hover { background: var(--hover); }
.conv.active { background: var(--active); }
.conv .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .icon-btn { width: 28px; height: 28px; opacity: 0; }
.conv:hover .icon-btn, .conv.active .icon-btn { opacity: 1; }
/* 触屏：只在当前对话上显示重命名/删除，列表更清爽，也避免误触 */
@media (hover: none) { .conv:not(.active) .icon-btn { display: none; } }
.sidebar-foot { border-top: 1px solid var(--border); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 8px;
  border: 0; background: transparent; text-align: left; color: var(--text); width: 100%;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--active); font-weight: 600; }
.empty-list { color: var(--faint); font-size: 13px; padding: 16px 10px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }
.topbar {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; min-height: 56px;
  padding-top: calc(8px + env(safe-area-inset-top));
  position: relative; z-index: 20; border-bottom: 1px solid transparent; transition: border-color .2s, background .2s;
}
.main.scrolled .topbar {
  background: var(--glass); border-bottom-color: var(--border);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
}
.topbar .menu-btn { display: none; }
.topbar h2 { margin: 0; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 侧边栏：账户 ---------- */
.nav-item .grow { flex: 1; }
.nav-item .bal { font-size: 13px; font-weight: 600; color: var(--ok); font-variant-numeric: tabular-nums; }
.nav-item .bal.low { color: var(--danger); }
.nav-item .who-name { font-size: 12px; color: var(--faint); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px;
  padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 14px;
}

/* 外观切换按钮的图标 */
.theme-ico { display: inline-flex; width: 18px; justify-content: center; }
