/* 无限画布 N2 — 画布导航页（浅色主题，无第三方库）
   配色：页面底 #f5f6f8 / 卡片白底 #fff / 主色 #f05050（沿用画布） */

/* ===== C35：对齐达笔的设计 token（**页面级**，只影响本页；不动 style.css / portal.css）===== */
:root {
  --dp-green-2: #F0FFF1;
  --dp-green-3: #D9FADD;
  --dp-green-4: #78FB60;
  --dp-green-5: #71DC68;
  --dp-green-6: #1EAA2A;
  --dp-text: #222722;
  --dp-text-2: rgba(34, 39, 34, 0.8);
  --dp-text-3: rgba(34, 39, 34, 0.6);
  --dp-line: rgba(34, 39, 34, 0.08);
  --dp-line-2: #22272214;
  --dp-active: #F2FFF0;
  --dp-font: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --dp-radius: 8px;
  --dp-radius-ctl: 4px;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body { height: 100%; }

body.cl-page {
  margin: 0;
  padding: 0;
  background: #f5f6f8;
  color: #1f2329;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 骨架：左栏 + 主区 ---------- */

.cl-shell {
  display: flex;
  min-height: 100%;
}

/* G8：挂上 F1 的全局导航（fixed 220px）后，整块内容右移让位；
   ≤900px 时 sidebar.css 把侧栏收成 60px icon 栏，这里跟着收窄 */
body.has-if-sidebar .cl-shell { margin-left: 220px; }
@media (max-width: 900px) {
  body.has-if-sidebar .cl-shell { margin-left: 60px; }
}

.cl-side {
  flex: 0 0 220px;
  width: 220px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  padding: 20px 12px;
  align-self: stretch;
}

.cl-side-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 16px;
}

.cl-side-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2329;
}

.cl-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cl-menu-item {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4b5563;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.cl-menu-item:hover { background: #f3f4f6; }

.cl-menu-item.active {
  background: #fdecec;
  color: #f05050;
  font-weight: 600;
}

/* E9：菜单项右侧计数 */
.cl-menu-label { flex: 1 1 auto; }
.cl-menu-count {
  flex: 0 0 auto;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.cl-menu-item.active .cl-menu-count { background: #fbd5d5; color: #b91c1c; }

/* E9：菜单项必须是 flex 让 label + count 分两边 */
.cl-menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* E9：文件夹小标题 + 新建按钮 */
.cl-folder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 4px;
  color: #9ca3af;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.cl-folder-title { font-weight: 600; }
.cl-folder-add {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.cl-folder-add:hover { background: #f3f4f6; color: #f05050; }

/* E9：文件夹列表 */
.cl-folder-list { display: flex; flex-direction: column; gap: 2px; }
.cl-folder-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #4b5563;
  font-size: 14px;
  cursor: pointer;
}
.cl-folder-item:hover { background: #f3f4f6; }
.cl-folder-item.active {
  background: #fdecec;
  color: #f05050;
  font-weight: 600;
}
.cl-folder-name {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cl-folder-ops {
  display: none;
  gap: 2px;
}
.cl-folder-item:hover .cl-folder-ops { display: inline-flex; }
.cl-folder-op {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #9ca3af;
  font-size: 12px;
  cursor: pointer;
}
.cl-folder-op:hover { background: #fff; color: #f05050; }

/* E9：置顶徽章 + 未分组徽章 */
.cl-badge-pin {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 80, 80, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  z-index: 2;
}

/* G8：工具栏面包屑（← 返回 ｜ 我的设计 / <筛选名>） */
.cl-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.cl-crumb-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4b5563;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.cl-crumb-back:hover { background: #f3f4f6; }
.cl-crumb-sep {
  width: 1px;
  height: 16px;
  background: #e5e7eb;
}
.cl-crumb-root {
  color: #1f2329;
  font-weight: 600;
}
.cl-crumb-cur {
  color: #6b7280;
}

/* E9：移动到文件夹 弹层 */
.cl-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cl-modal[hidden] { display: none; }
.cl-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
}
.cl-modal-body {
  position: relative;
  width: 320px;
  max-height: 70vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cl-modal-title {
  color: #1f2329;
  font-size: 15px;
  font-weight: 600;
}
.cl-modal-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 50vh;
  overflow-y: auto;
}
.cl-modal-item {
  padding: 8px 10px;
  border-radius: 8px;
  color: #374151;
  font-size: 14px;
  cursor: pointer;
}
.cl-modal-item:hover { background: #f3f4f6; color: #f05050; }
.cl-modal-item.active { background: #fdecec; color: #f05050; font-weight: 600; }
.cl-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #f3f4f6;
}

/* ---------- 主区 ---------- */

.cl-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 20px 24px 32px;
}

.cl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
}

.cl-toolbar-left,
.cl-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cl-toolbar-right { flex-wrap: wrap; }

.cl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

/* G6：工具栏图标统一内联 SVG（不引第三方图标 / 字体） */
.cl-ico { flex: none; }
.cl-sortarrow { margin-left: 4px; color: #9ca3af; }
.cl-sortwrap { position: relative; }
.cl-sortwrap .cl-select { padding-right: 20px; appearance: none; }
.cl-sortwrap .cl-sortarrow { position: absolute; right: 6px; top: 50%; margin-top: -6px; pointer-events: none; }

.cl-btn:hover { border-color: #c4c9d1; background: #fafafa; }
.cl-btn:disabled { opacity: 0.6; cursor: default; }

.cl-btn-primary {
  border-color: #f05050;
  background: #f05050;
  color: #fff;
  font-weight: 600;
}

.cl-btn-primary:hover { border-color: #d94242; background: #d94242; }

.cl-count {
  color: #6b7280;
  font-size: 13px;
  white-space: nowrap;
}

.cl-sortwrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #6b7280;
  font-size: 13px;
}

.cl-select {
  padding: 6px 8px;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-family: inherit;
}

.cl-search {
  width: 200px;
  padding: 7px 12px;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  background: #fff;
  color: #1f2329;
  font-size: 14px;
  font-family: inherit;
}

.cl-search:focus,
.cl-select:focus {
  outline: none;
  border-color: #f05050;
}

/* ---------- 状态区（加载 / 登录 / 错误 / 空） ---------- */

.cl-state {
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #6b7280;
  font-size: 14px;
}

.cl-state-login,
.cl-state-error {
  color: #b91c1c;
  border-color: #fbd5d5;
  background: #fef2f2;
}

.cl-state-empty { color: #6b7280; }

.cl-state .cl-link {
  margin-left: 8px;
  color: #f05050;
  font-weight: 600;
  text-decoration: none;
}

.cl-state .cl-link:hover { text-decoration: underline; }

.cl-state .cl-retry {
  margin-left: 8px;
  padding: 3px 10px;
  border: 1px solid #f05050;
  border-radius: 6px;
  background: #fff;
  color: #f05050;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

/* ---------- 卡片网格 ---------- */

.cl-grid {
  display: grid;
  /* G6：对齐达笔的卡片规格（缩略图 138×138，比原来的 240 小一档，一屏能看更多） */
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
}

.cl-card {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.cl-card:hover {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.cl-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #eef0f3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cl-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cl-cover-ph {
  font-size: 28px;
  opacity: 0.45;
}

.cl-meta { padding: 10px 12px 12px; }

.cl-name {
  color: #1f2329;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cl-time {
  margin-top: 4px;
  color: #9ca3af;
  font-size: 12px;
}

/* hover 才出现的操作按钮 */
.cl-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.cl-card:hover .cl-actions {
  opacity: 1;
  pointer-events: auto;
}

.cl-act {
  padding: 3px 9px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: #374151;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.cl-act:hover { border-color: #c4c9d1; background: #fff; }
.cl-act.cl-act-del { color: #dc2626; }
/* C20：回收站里的「恢复」 */
.cl-act.cl-act-restore { color: #15803d; }

/* ---------- toast ---------- */

.cl-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(8px);
  padding: 9px 16px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cl-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 响应式 ---------- */

@media (max-width: 860px) {
  .cl-side { flex-basis: 160px; width: 160px; }
  .cl-main { padding: 16px; }
  .cl-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .cl-search { width: 140px; }
}

/* ====================================================================
   E10：共享给我的视图 — 角色徽章
   ==================================================================== */
.cl-badge-role {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  pointer-events: none;
  z-index: 1;
}
.cl-badge-role-view { background: var(--brand, #71DC68); }
.cl-badge-role-edit { background: #059669; }

/* ================= G6：「我的设计」对齐达笔 ================= */

/* 工具栏：视图切换 */
.cl-views {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}
.cl-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: #fff;
  border: none;
  color: #6b7280;
  font-size: 13px;
  cursor: pointer;
}
.cl-view-btn:hover { background: #f9fafb; color: #111827; }
.cl-view-btn.is-active { background: var(--brand-soft, rgba(113,220,104,.14)); color: var(--brand-strong, #5BC85A); font-weight: 600; }

/* 搜索框（放大镜在框内左侧，底色 #f9f9f9，180px） */
.cl-searchwrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 180px;
  padding: 0 8px;
  background: #f9f9f9;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #9ca3af;
}
.cl-searchwrap .cl-search {
  flex: 1;
  width: auto;
  padding: 6px 0;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: #111827;
}

/* 缩略图 138×138 + 圆角 6.3px（其余卡片样式沿用原有 .cl-card） */
.cl-card .cl-cover { aspect-ratio: 1 / 1; }
.cl-card .cl-cover-img { border-radius: 6.3px; }

/* 文件夹卡：2×2 四宫格子图预览（达笔 design-floder） */
.cl-card-folder .cl-fcover {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  background: #eef0f3;
}
.cl-fcell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  overflow: hidden;
}
.cl-fcell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cl-fcell-ph { width: 20px; height: 20px; border-radius: 4px; background: #e5e7eb; }
.cl-card-folder .cl-name { font-weight: 600; }

/* 原地改名 */
.cl-rename-btn {
  margin-left: 6px;
  padding: 0 4px;
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 12px;
  cursor: pointer;
}
.cl-rename-btn:hover { color: var(--brand-strong, #5BC85A); }
.cl-rename-input {
  width: 100%;
  padding: 2px 6px;
  border: 1px solid var(--brand-strong, #5BC85A);
  border-radius: 4px;
  font-size: 13px;
  outline: none;
}

/* 列表视图 */
.cl-listwrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}
.cl-lhead,
.cl-lrow {
  display: grid;
  grid-template-columns: 52px minmax(150px, 1fr) minmax(170px, 200px) minmax(100px, 140px) 80px 260px;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
}
.cl-lhead {
  background: #f9fafb;
  color: #6b7280;
  font-size: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.cl-lrow {
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
}
.cl-lrow:hover { background: #f8faff; }
.cl-lc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #f3f4f6;
  overflow: hidden;
}
.cl-lc-icon img { width: 100%; height: 100%; object-fit: cover; }
.cl-lc-name { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.cl-lname-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: #111827;
}
.cl-lpin { font-size: 12px; }
.cl-lc-time, .cl-lc-loc, .cl-lc-size { color: #6b7280; }
.cl-lc-act { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

/* 列表视图：文件夹作树节点（可展开） */
.cl-lrow.is-folder { background: #fcfcfd; }
.cl-lrow .cl-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 4px;
  padding: 0;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.cl-lrow .cl-caret:hover { color: var(--brand-strong, #5BC85A); }
.cl-lrow .cl-caret.is-spacer { visibility: hidden; }
.cl-lrow.is-child .cl-lc-name { padding-left: 22px; }
.cl-lrow.is-child .cl-lname-text { font-weight: 400; }
.cl-lc-count { color: #6b7280; }

/* 空态插画 */
.cl-state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #9ca3af;
}
.cl-empty-art { color: #d1d5db; }
.cl-empty-text { font-size: 14px; }

/* G6：分页条（服务端分页） */
.cl-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 13px;
  color: #6b7280;
}
.cl-pager-info { margin-right: auto; }
.cl-pagesize { display: inline-flex; align-items: center; }
.cl-pager-btn { padding: 5px 12px; font-size: 13px; }
.cl-pager-num { min-width: 48px; text-align: center; color: #374151; }

/* ======================================================================
   C35：「我的设计」视觉对齐达笔（功能不动，只改呈现）
   —— 字体/字号/正文色、卡片 8px 白底描边、搜索框 180px、悬停渐变遮罩、主色绿
   ====================================================================== */

body.cl-page {
  font-family: var(--dp-font);
  font-size: 14px;
  color: var(--dp-text);
}

/* 卡片：白底 + 1px 描边 + 8px 圆角（原来是 12px / #e5e7eb） */
.cl-card {
  border: 1px solid var(--dp-line);
  border-radius: var(--dp-radius);
  background: #fff;
}

/* 悬停：底部渐变遮罩（达笔 gradient-div），配合已有的 .cl-actions 浮出 */
.cl-cover::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.cl-card:hover .cl-cover::after {
  opacity: 1;
}

/* 搜索框：达笔口径 180px + #f9f9f9 —— 外层 .cl-searchwrap 才是那个框（内层 input 透明 */
.cl-searchwrap {
  width: 180px;
  background: #f9f9f9;
  border: 1px solid var(--dp-line);
  border-radius: var(--dp-radius-ctl);
  color: var(--dp-text-3);
}

.cl-searchwrap .cl-search {
  color: var(--dp-text);
}

/* 控件圆角统一 4px（达笔：卡片 8 / 控件 2~4） */
.cl-select,
.cl-btn,
.cl-view-btn,
.cl-pager,
.cl-pager-btn {
  border-radius: var(--dp-radius-ctl);
}

/* 主色：达笔那套绿（新建画布按钮 / 选中态 / 焦点环） */
.cl-btn-primary {
  background: var(--dp-green-4);
  border-color: var(--dp-green-4);
  color: #17300f;
  font-weight: 600;
}

.cl-btn-primary:hover {
  background: var(--dp-green-5);
  border-color: var(--dp-green-5);
}

.cl-search:focus,
.cl-select:focus {
  border-color: var(--dp-green-5);
  box-shadow: 0 0 0 2px var(--dp-green-2);
}

.cl-folder-item.active,
.cl-menu-item.is-active {
  background: var(--dp-active);
}

.cl-view-btn.is-active {
  border-color: var(--dp-green-5);
  color: #17300f;
  background: var(--dp-green-2);
}

/* 次级文字统一到 60% 墨色（原来是灰蓝 #6b7280 / #9ca3af） */
.cl-state,
.cl-empty-text,
.cl-count,
.cl-sortlabel,
.cl-pager,
.cl-pager-num,
.cl-folder-name {
  color: var(--dp-text-3);
}
