/* ============================================================
   云文档 - 界面样式（仿腾讯文档布局）
   设计语言：固定侧边栏 + 顶栏搜索 + 表格式文档列表
   扁平轻量 · 1px 边框分层 · 蓝色主色 #1E6CF5
   ============================================================ */

:root {
  --blue: #1E6CF5;          /* 主色 */
  --blue-hover: #3B7DFF;
  --blue-light: #F0F4FF;
  --green: #22C55E;         /* 表格 */
  --doc-blue: #2563EB;      /* 文字文档图标 */
  --orange: #F97316;        /* 导入/上传 */
  --red: #EF4444;
  --bg-sidebar: #F5F7FA;
  --paper: #FFFFFF;
  --ink: #111827;
  --ink-2: #4B5563;
  --ink-3: #9CA3AF;
  --line: #EEF0F3;
  --line-dark: #E3E5E9;
  --sel: #E9EDF3;
  --radius: 8px;
  --shadow-pop: 0 4px 16px rgba(17,24,39,.10), 0 1px 4px rgba(17,24,39,.08);
  --shadow-blue: 0 2px 4px rgba(30,108,245,.15);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font); cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: var(--font); outline: none; }
.hidden { display: none !important; }
.view { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* ============================================================
   首页：侧边栏 + 主区
   ============================================================ */
.app-shell { flex-direction: row; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.brand {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .5px;
  flex-shrink: 0;
}

.side-actions { padding: 4px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.side-actions .dd-wrap.full { width: 100%; }

.btn-primary-lg {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius);
  box-shadow: var(--shadow-blue);
  transition: background .16s, transform .1s;
}
.btn-primary-lg:hover { background: var(--blue-hover); }
.btn-primary-lg:active { transform: scale(.98); }
.btn-primary-lg .caret { margin-left: 2px; }

.btn-outline {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--paper);
  border: 1px solid var(--line-dark);
  color: var(--ink-2);
  font-size: 15px;
  border-radius: var(--radius);
  transition: border-color .16s, color .16s;
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- 侧边导航 ---------- */
.side-nav { padding: 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 15px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: #EBEEF3; color: var(--ink); }
.nav-item.active { background: var(--sel); color: var(--ink); font-weight: 500; }
.nav-item.active svg { color: var(--blue); }
.nav-item svg { flex-shrink: 0; color: var(--ink-2); }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---------- 侧边栏底部用户区 ---------- */
.side-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E6CF5, #22C55E);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.user-info b { font-size: 14px; font-weight: 600; }
.user-info span { font-size: 12px; color: var(--ink-3); }
.foot-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  transition: background .15s;
  flex-shrink: 0;
}
.foot-icon:hover { background: #EBEEF3; }

/* ---------- 移动端侧边栏遮罩 ---------- */
.side-mask {
  position: fixed; inset: 0;
  background: rgba(17,24,39,.4);
  z-index: 290;
  animation: fade-in .15s ease-out;
}
.hamburger { display: none; }

/* ============================================================
   顶栏
   ============================================================ */
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 72px;
  flex-shrink: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-sidebar);
  border-radius: 22px;
  padding: 0 18px;
  height: 46px;
  width: min(720px, 100%);
  flex: 0 1 720px;
  min-width: 140px;
  color: var(--ink-3);
  border: 1px solid transparent;
  transition: border-color .18s, background .18s;
}
.search-box:focus-within {
  background: var(--paper);
  border-color: var(--blue);
  color: var(--blue);
}
.search-box input {
  border: none; background: transparent;
  font-size: 14.5px; width: 100%; color: var(--ink);
}
.search-box input::placeholder { color: var(--ink-3); }
.topbar-actions { margin-left: auto; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: 14px;
  padding: 9px 14px; border-radius: 20px;
  border: 1px solid var(--line-dark);
  background: var(--paper);
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .16s, color .16s;
}
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- 下拉菜单 ---------- */
.dd-wrap { position: relative; }
.dd-right { margin-left: auto; }
.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 300;
  animation: pop-in .14s ease-out;
}
.dd-right .dropdown, .doc-row .dropdown { left: auto; right: 0; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.dropdown button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  font-size: 14px; padding: 10px 12px;
  border-radius: 6px; color: var(--ink);
}
.dropdown button:hover { background: var(--blue-light); color: var(--blue); }
.dropdown button.danger:hover { background: #FDEDEC; color: var(--red); }

/* ============================================================
   主内容区
   ============================================================ */
.home-main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 60px;
}

/* ---------- 快捷功能卡片 ---------- */
.quick-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}
.quick-card {
  height: 110px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color .16s, transform .16s;
  text-align: left;
}
.quick-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.quick-card svg { flex-shrink: 0; }
.quick-card span { font-size: 16px; font-weight: 600; color: var(--ink); }

/* ---------- 列表头部：tab + 筛选 ---------- */
.list-head {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 8px;
  min-height: 40px;
}
.list-tab {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-3);
  transition: color .15s;
  padding: 4px 0;
  position: relative;
}
.list-tab.active { color: var(--ink); }
.list-tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 3px;
  border-radius: 2px;
  background: var(--blue);
}
.list-head .filter-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 16px;
  border: 1px solid var(--line-dark);
  border-radius: 18px;
  color: var(--ink-2); font-size: 13.5px;
  transition: border-color .15s, color .15s;
}
.list-head .filter-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- 文档表格 ---------- */
.doc-table-head, .doc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 120px 150px 90px 56px;
  align-items: center;
  gap: 16px;
  padding: 0 4px;
}
.doc-table-head {
  height: 44px;
  color: var(--ink-2);
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.doc-table-head .col-name { display: flex; align-items: center; gap: 6px; }
.doc-row {
  height: 64px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .13s;
  position: relative;
}
.doc-row:hover { background: var(--bg-sidebar); }
.doc-row .col-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.doc-row .doc-icon { flex-shrink: 0; }
.doc-row .doc-name {
  font-size: 15px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-row .doc-name.untitled { color: var(--ink-3); }
.doc-row .star-btn {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.doc-row:hover .star-btn { opacity: 1; }
.doc-row .star-btn:hover { color: #F59E0B; background: #FFF7E6; }
.doc-row .star-btn.starred { opacity: 1; color: #F59E0B; }
.doc-row .cell { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .row-more {
  justify-self: end;
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  opacity: 0;
  transition: opacity .15s, background .15s;
}
.doc-row:hover .row-more { opacity: 1; }
.doc-row .row-more:hover { background: var(--line); }
.doc-row .dropdown { top: auto; bottom: calc(100% - 40px); right: 0; }

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 80px 0 40px;
  color: var(--ink-3);
}
.empty-state p { font-size: 15px; margin-top: 16px; color: var(--ink-2); }
.empty-sub { font-size: 13px !important; margin-top: 6px !important; color: var(--ink-3) !important; }

/* ---------- 回收站 ---------- */
.trash-tip {
  display: flex; align-items: center; gap: 8px;
  background: var(--blue-light);
  color: var(--ink-2);
  font-size: 13px;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
}
.trash-head, .trash-row { grid-template-columns: minmax(0, 1fr) 150px 180px; }
.trash-ops { display: flex; gap: 6px; justify-content: flex-end; }
.btn-empty-trash {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--red); font-size: 13.5px;
  border: 1px solid #FECACA;
  border-radius: 18px;
  padding: 7px 14px;
  transition: background .15s;
}
.btn-empty-trash:hover { background: #FDEDEC; }
.doc-row .link-btn {
  font-size: 13.5px;
  color: var(--blue);
  padding: 5px 10px;
  border-radius: 6px;
  transition: background .15s;
}
.doc-row .link-btn:hover { background: var(--blue-light); }
.doc-row .link-btn.danger { color: var(--red); }
.doc-row .link-btn.danger:hover { background: #FDEDEC; }

/* ---------- 存储空间视图 ---------- */
.storage-card {
  max-width: 640px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.ring { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
}
.ring .ring-text b { font-size: 20px; }
.ring .ring-text span { font-size: 11px; color: var(--ink-3); }
.storage-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.storage-info h2 { font-size: 18px; font-weight: 700; }
.storage-info .usage-line { font-size: 14px; color: var(--ink-2); }
.storage-info .usage-line b { color: var(--blue); }
.storage-info .hint { font-size: 13px; color: var(--ink-3); line-height: 1.7; }
.storage-stats { display: flex; gap: 24px; margin-top: 4px; }
.storage-stat { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.storage-stat i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ============================================================
   编辑器视图
   ============================================================ */
#view-editor { background: var(--bg-sidebar); }

.ed-topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 64px;
  flex-shrink: 0;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 8px;
  color: var(--ink-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-sidebar); color: var(--ink); }
.doc-type-icon { display: flex; }

#docTitle {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  font-size: 16px; font-weight: 600;
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
  transition: background .15s;
}
#docTitle:hover { background: var(--bg-sidebar); }
#docTitle:focus { background: var(--sel); }

/* 签名元素：自动保存呼吸指示 */
.save-status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); flex-shrink: 0; }

/* ---------- 协作徽标 / 分享按钮 ---------- */
.collab-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: #15803D;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 16px;
  padding: 5px 12px;
  flex-shrink: 0;
}
.collab-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  display: inline-block;
  animation: breathe-green 1.6s ease-in-out infinite;
}
@keyframes breathe-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
  50% { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

.btn-share {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green); color: #fff;
  font-size: 14px; font-weight: 500;
  height: 34px; padding: 0 16px;
  border-radius: 17px;
  flex-shrink: 0;
  transition: filter .16s, transform .1s;
}
.btn-share:hover { filter: brightness(1.05); }
.btn-share:active { transform: scale(.97); }

/* ---------- 分享弹窗 ---------- */
.share-modal { width: 460px; }
.share-link-row { display: flex; gap: 10px; margin: 6px 0 4px; }
.share-link-row input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--bg-sidebar);
  font-family: Consolas, Menlo, monospace;
}
.share-link-row input:focus { background: var(--paper); border-color: var(--blue); }
.share-link-row .btn-blue { flex-shrink: 0; padding: 9px 16px; }
.share-perm {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.7;
  background: var(--blue-light);
  border-radius: 8px;
  padding: 10px 12px;
}
.save-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.save-dot.saved { background: var(--green); }
.save-dot.error { background: var(--red); }
.save-dot.saving { background: #F59E0B; animation: breathe 1s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.35); }
  50% { box-shadow: 0 0 0 5px rgba(245,158,11,0); }
}

/* ---------- 编辑器工具栏 ---------- */
.toolbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 16px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }

.tb-btn {
  min-width: 32px; height: 32px;
  padding: 0 7px;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--ink-2);
  transition: background .14s, color .14s;
  flex-shrink: 0;
}
.tb-btn:hover { background: var(--bg-sidebar); color: var(--ink); }
.tb-btn.active { background: var(--blue-light); color: var(--blue); }
.tb-btn.bold-btn { font-weight: 700; }
.tb-btn.italic-btn { font-style: italic; font-family: Georgia, serif; }
.tb-btn.underline-btn { text-decoration: underline; }
.tb-btn.strike-btn { text-decoration: line-through; }
.tb-sep { width: 1px; height: 18px; background: var(--line-dark); margin: 0 7px; flex-shrink: 0; }
.tb-select {
  height: 32px; border: none; background: transparent;
  font-size: 13.5px; color: var(--ink-2);
  padding: 0 4px; border-radius: 7px; cursor: pointer; flex-shrink: 0;
}
.tb-select:hover { background: var(--bg-sidebar); }
.tb-color { position: relative; overflow: hidden; }
.tb-color input[type="color"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.color-chip { width: 15px; height: 15px; border-radius: 4px; }

/* ---------- A4 纸张编辑区 ---------- */
.edit-area { flex: 1; overflow-y: auto; padding: 34px 20px 80px; }
.paper {
  max-width: 830px;
  min-height: calc(100vh - 220px);
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 64px 76px 110px;
}

#editor {
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
  word-break: break-word;
  outline: none;
  caret-color: var(--blue);
  min-height: 400px;
}
#editor:empty::before { content: attr(data-placeholder); color: var(--ink-3); pointer-events: none; }
#editor h1 { font-size: 26px; margin: 18px 0 10px; line-height: 1.5; }
#editor h2 { font-size: 21px; margin: 16px 0 8px; line-height: 1.5; }
#editor h3 { font-size: 17.5px; margin: 14px 0 6px; line-height: 1.6; }
#editor p { margin: 0 0 8px; }
#editor blockquote {
  border-left: 3px solid var(--blue);
  background: var(--blue-light);
  padding: 8px 16px;
  margin: 10px 0;
  border-radius: 0 6px 6px 0;
  color: var(--ink-2);
}
#editor pre {
  background: #23252B; color: #E8EAF0;
  padding: 14px 16px; border-radius: 8px; margin: 10px 0;
  font-family: Consolas, Menlo, "Courier New", monospace;
  font-size: 13.5px; line-height: 1.6;
  overflow-x: auto; white-space: pre-wrap;
}
#editor ul, #editor ol { padding-left: 26px; margin: 6px 0; }
#editor hr { border: none; border-top: 1px solid var(--line-dark); margin: 18px 0; }
#editor a { color: var(--blue); }
#editor img { max-width: 100%; }

/* ---------- 在线表格 ---------- */
.sheet-wrap {
  max-width: 1080px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.sheet-table { border-collapse: collapse; width: max-content; min-width: 100%; }
.sheet-table th {
  background: var(--bg-sidebar);
  border: 1px solid var(--line);
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  min-width: 42px; height: 28px;
  padding: 0 8px;
  user-select: none;
  position: sticky;
}
.sheet-table thead th { top: 0; z-index: 5; }
.sheet-table tbody th { left: 0; z-index: 4; }
.sheet-table th.corner { left: 0; z-index: 6; }
.sheet-table td {
  border: 1px solid var(--line);
  min-width: 110px; max-width: 260px;
  height: 30px;
  padding: 2px 8px;
  font-size: 13.5px;
  background: var(--paper);
  cursor: cell;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-table td.selected { outline: 2px solid var(--blue); outline-offset: -2px; background: var(--blue-light) !important; }
.sheet-table td.formula-cell { color: #0E7323; }
.sheet-table td.error-cell { color: var(--red); background: #FDF2F1 !important; }
.sheet-cell-input {
  position: absolute;
  border: 2px solid var(--blue);
  border-radius: 2px;
  font-size: 13.5px; font-family: var(--font);
  padding: 2px 6px;
  outline: none;
  background: var(--paper);
  z-index: 10;
  box-shadow: var(--shadow-pop);
}
.sheet-toolbar { display: flex; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--line); align-items: center; overflow-x: auto; }
.formula-bar {
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 6px 12px;
}
.formula-bar .fx { color: var(--ink-3); font-style: italic; font-family: Georgia, serif; font-size: 14px; flex-shrink: 0; }
#formulaInput {
  flex: 1; border: none;
  font-size: 13.5px; color: #0E7323;
  background: transparent;
  padding: 4px 6px;
  border-radius: 4px;
}
#formulaInput:focus { background: var(--bg-sidebar); }

/* ---------- 状态栏 ---------- */
.status-bar {
  flex-shrink: 0; height: 32px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  display: flex; align-items: center;
  padding: 0 16px; gap: 18px;
  color: var(--ink-3); font-size: 12px;
  overflow: hidden; white-space: nowrap;
}

/* ============================================================
   弹窗 / Toast
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(17,24,39,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  animation: fade-in .15s ease-out;
}
.modal {
  background: var(--paper);
  border-radius: 12px;
  width: 380px; max-width: calc(100vw - 40px);
  box-shadow: 0 12px 40px rgba(17,24,39,.2);
  padding: 22px 24px 18px;
  animation: pop-in .18s ease-out;
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.modal .modal-desc { color: var(--ink-2); font-size: 13px; margin-bottom: 14px; line-height: 1.6; }
.modal input[type="text"] {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.modal input[type="text"]:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(30,108,245,.15); }
.modal-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.btn-cancel {
  padding: 9px 18px; border-radius: 8px;
  color: var(--ink-2); font-size: 14px;
  border: 1px solid var(--line-dark);
  transition: border-color .15s, color .15s;
}
.btn-cancel:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-danger {
  padding: 9px 18px; border-radius: 8px;
  background: var(--red); color: #fff; font-size: 14px;
  transition: filter .15s, transform .1s;
}
.btn-danger:hover { filter: brightness(1.08); }
.btn-blue {
  padding: 9px 20px; border-radius: 8px;
  background: var(--blue); color: #fff; font-size: 14px;
  transition: background .15s, transform .1s;
}
.btn-blue:hover { background: var(--blue-hover); }

.toast {
  position: fixed; bottom: 40px; left: 50%;
  transform: translateX(-50%);
  background: rgba(17,24,39,.9);
  color: #fff; font-size: 13.5px;
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 600;
  animation: toast-in .25s cubic-bezier(.21,1.02,.73,1);
  box-shadow: 0 6px 20px rgba(17,24,39,.3);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1080px) {
  .quick-cards { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .doc-table-head, .doc-row { grid-template-columns: minmax(0, 1fr) 90px 150px 90px 48px; }
  .doc-table-head .col-pos, .doc-row .col-pos { display: none; }
}
@media (max-width: 900px) {
  /* 侧边栏收窄为图标 */
  .sidebar { width: 64px; }
  .brand { padding: 0; justify-content: center; }
  .brand span, .nav-label, .user-info { display: none; }
  .side-actions { padding: 4px 8px 12px; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-badge { position: absolute; transform: translate(14px, -14px); margin: 0; }
  .side-nav { position: relative; }
  .user-chip { justify-content: center; }
  .foot-icon { display: none; }
  .topbar { padding: 0 16px; }
  .home-main { padding: 20px 16px 50px; }
  .quick-cards { grid-template-columns: 1fr; }
  .quick-card { height: 84px; flex-direction: row; align-items: center; gap: 14px; }
  .doc-table-head, .doc-row { grid-template-columns: minmax(0, 1fr) 120px 48px; }
  .doc-table-head .col-owner, .doc-row .col-owner,
  .doc-table-head .col-size, .doc-row .col-size { display: none; }
  .list-tab { font-size: 17px; }
}
@media (max-width: 680px) {
  .hamburger { display: inline-flex; }
  .collab-badge { display: none; }          /* 窄屏隐藏协作徽标，保留分享按钮 */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform .22s ease-out;
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 24px rgba(17,24,39,.12); }
  /* 移动端侧边栏展开时恢复完整宽度 */
  .sidebar.open { width: 240px; }
  .sidebar.open .brand { padding: 0 20px; justify-content: flex-start; }
  .sidebar.open .brand span, .sidebar.open .nav-label, .sidebar.open .user-info { display: block; }
  .sidebar.open .side-actions { padding: 4px 16px 12px; }
  .sidebar.open .nav-item { justify-content: flex-start; padding: 0 12px; }
  .sidebar.open .nav-badge { position: static; transform: none; margin-left: auto; }
  .sidebar.open .user-chip { justify-content: flex-start; }
  .sidebar.open .foot-icon { display: flex; }
  .save-status span { display: none; }
  .paper { padding: 36px 22px 80px; }
}

/* 动效偏好：减少动画 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
