/* ============ Online · 样式（移动端优先）============ */
:root {
  /* 主色：由 JS 覆盖 --accent，其余色阶跟着它的 RGB 分量走 */
  --accent: #6366f1;
  --accent-rgb: 99, 102, 241;
  --accent-2: #8b5cf6;
  --accent-soft: #eef1ff;
  --accent-ink: #4338ca;

  /* 中性色阶 */
  --bg: #f6f7fb;
  --bg-sunken: #eef0f6;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --text: #171b26;
  --text-2: #616b7e;
  --text-3: #98a1b3;
  --border: #e6e9f0;
  --border-strong: #d3d9e5;

  /* 语义色 */
  --ok: #0d9f6e;
  --ok-soft: rgba(16, 185, 129, .11);
  --warn: #c2760c;
  --warn-soft: rgba(245, 158, 11, .13);
  --danger: #d93a4a;
  --danger-soft: rgba(239, 68, 68, .11);

  /* 尺度 */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --font-scale: 1;

  /* 三层阴影：静置 / 浮起 / 覆盖 */
  --shadow-sm: 0 1px 2px rgba(19, 24, 38, .05), 0 1px 3px rgba(19, 24, 38, .04);
  --shadow: 0 2px 8px rgba(19, 24, 38, .05), 0 8px 24px -12px rgba(19, 24, 38, .12);
  --shadow-lg: 0 12px 32px -8px rgba(19, 24, 38, .18), 0 2px 8px rgba(19, 24, 38, .06);
  --ring: 0 0 0 3px rgba(var(--accent-rgb), .16);
  --ease: cubic-bezier(.4, 0, .2, 1);
}
[data-theme="dark"] {
  --bg: #0f1218;
  --bg-sunken: #0a0d12;
  --surface: #171b24;
  --surface-2: #1c212c;
  --text: #eef1f6;
  --text-2: #9aa4b6;
  --text-3: #6b7688;
  --border: #262d3a;
  --border-strong: #374052;
  --accent-soft: #23243d;
  --accent-ink: #a5b4fc;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 2px 10px rgba(0, 0, 0, .34), 0 10px 28px -14px rgba(0, 0, 0, .6);
  --shadow-lg: 0 16px 40px -10px rgba(0, 0, 0, .66);
  --ring: 0 0 0 3px rgba(var(--accent-rgb), .26);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: calc(15px * var(--font-scale)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.55;
  font-feature-settings: "tnum" on, "cv11" on;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  padding-bottom: env(safe-area-inset-bottom);
  transition: background .25s var(--ease), color .25s var(--ease);
}
button, input, textarea, select { font-family: inherit; font-size: 1rem; color: var(--text); }
button { cursor: pointer; }
::selection { background: rgba(var(--accent-rgb), .22); }
/* 细滚动条，减少视觉噪音 */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }
/* 统一可见焦点，兼顾键盘可达性 */
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* 双端布局：默认移动端，桌面布局隐藏；≥900px 时切换 */
.desktop-layout { display: none; }

/* ============ 登录 ============ */
.auth-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 90% at 12% -10%, rgba(var(--accent-rgb), .18), transparent 55%),
    radial-gradient(100% 80% at 108% 108%, rgba(139, 92, 246, .14), transparent 58%),
    var(--bg);
}
[data-theme="dark"] .auth-view {
  background:
    radial-gradient(120% 90% at 12% -10%, rgba(var(--accent-rgb), .28), transparent 58%),
    radial-gradient(100% 80% at 108% 108%, rgba(139, 92, 246, .18), transparent 60%),
    var(--bg);
}
/* 背景装饰光斑，纯装饰、不参与交互 */
.auth-view::before, .auth-view::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(60px); opacity: .5;
}
.auth-view::before { width: 260px; height: 260px; top: -80px; left: -60px; background: rgba(var(--accent-rgb), .35); }
.auth-view::after { width: 220px; height: 220px; bottom: -70px; right: -50px; background: rgba(139, 92, 246, .3); }
.auth-card {
  position: relative; width: 100%; max-width: 356px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 30px 26px 26px;
  box-shadow: var(--shadow-lg);
  animation: auth-in .4s var(--ease) both;
}
@keyframes auth-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.auth-logo {
  width: 64px; height: 64px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 8px 16px rgba(var(--accent-rgb), .32));
}
.auth-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 16px; }
.auth-card h1 {
  text-align: center; margin: 0 0 22px; font-size: 1.3rem; font-weight: 700;
  letter-spacing: .16em;
  background: linear-gradient(120deg, var(--text), var(--accent-ink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-error { color: var(--danger); background: var(--danger-soft); padding: 0; border-radius: var(--radius-sm); font-size: .8rem; text-align: center; }
.auth-error:not(:empty) { padding: 8px 12px; margin-bottom: 12px; }
.auth-card label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; letter-spacing: .02em; }
.auth-card input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); outline: none; font-size: .95rem;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.auth-card input::placeholder { color: var(--text-3); }
.auth-card input:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
.btn {
  border: none; border-radius: 10px; padding: 11px 15px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease), transform .1s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-2)); color: #fff;
  width: 100%; margin-top: 18px;
  box-shadow: 0 6px 16px -6px rgba(var(--accent-rgb), .6);
}
.btn.primary:hover { box-shadow: 0 10px 22px -8px rgba(var(--accent-rgb), .7); filter: brightness(1.04); }
.btn.link { background: none; color: var(--accent-ink); width: 100%; margin-top: 10px; font-size: .88rem; font-weight: 500; }
.btn.link:hover { color: var(--accent); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn.block { width: 100%; }

/* ============ 顶部信息栏 ============ */
.app-view { max-width: 720px; margin: 0 auto; }
.topbar {
  padding: calc(env(safe-area-inset-top) + 11px) 14px 11px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-row { display: flex; align-items: center; gap: 8px; }
.brand-row { margin-bottom: 9px; }
.brand-icon { width: 28px; height: 28px; border-radius: 8px; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: .1em; flex: 1; }
.icon-btn {
  border: none; background: none; padding: 6px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: background .16s var(--ease), color .16s var(--ease);
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .84rem; font-weight: 600; letter-spacing: .02em;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 3px 10px -3px rgba(var(--accent-rgb), .6);
}
.user-menu { position: relative; }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  box-shadow: var(--shadow-lg); padding: 14px; width: 190px;
  animation: pop-in .18s var(--ease) both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.ud-name { font-weight: 600; font-size: .92rem; }
.ud-phone { color: var(--text-3); font-size: .78rem; margin-top: 1px; margin-bottom: 10px; }
.user-dropdown button {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 9px 6px; color: var(--danger); font-size: .88rem; font-weight: 500;
  border-top: 1px solid var(--border); border-radius: 0 0 8px 8px;
}
.user-dropdown button:hover { background: var(--danger-soft); }
/* 顶部信息条：一行轻量文本，细点分隔（天气/日期/周/农历） */
.info-bar { display: flex; align-items: center; flex-wrap: wrap; column-gap: 9px; row-gap: 3px; margin-top: 1px; }
.info-seg { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--text-2); white-space: nowrap; }
.info-seg:not(:last-child)::after { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); margin-left: 9px; }
.info-ico { font-size: .85rem; line-height: 1; }

/* ============ 待办卡片 ============ */
.board { padding: 16px 14px 24px; }
.board-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.board-head h2 { font-size: 1.02rem; font-weight: 700; margin: 0; letter-spacing: .01em; }
.add-btn {
  border: none; color: #fff; border-radius: 10px; padding: 9px 15px; font-weight: 600; font-size: .86rem;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px -8px rgba(var(--accent-rgb), .7);
  transition: filter .16s var(--ease), transform .1s var(--ease), box-shadow .16s var(--ease);
}
.add-btn:hover { filter: brightness(1.05); box-shadow: 0 8px 20px -8px rgba(var(--accent-rgb), .8); }
.add-btn:active { transform: scale(.97); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 12px; }
.todo-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 13px 10px; box-shadow: var(--shadow-sm);
  position: relative; min-height: 118px; display: flex; flex-direction: column;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.todo-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.todo-card.done { opacity: .58; background: var(--surface-2); }
.todo-card.done:hover { opacity: .72; }
.todo-card .card-top { display: flex; align-items: flex-start; gap: 9px; }
.todo-card .chk {
  width: 19px; height: 19px; border: 1.8px solid var(--border-strong); border-radius: 6px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; margin-top: 1px;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .12s var(--ease);
}
.todo-card .chk:hover { border-color: var(--accent); transform: scale(1.06); }
.todo-card.done .chk { background: var(--accent); border-color: var(--accent); }
.todo-card.done .chk::after { content: "✓"; color: #fff; font-size: .72rem; font-weight: 700; }
.todo-card .card-text { flex: 1; font-size: .89rem; line-height: 1.55; word-break: break-word; white-space: pre-wrap; overflow: auto; }
.todo-card.done .card-text { text-decoration: line-through; color: var(--text-2); }
.todo-card .card-actions { display: flex; gap: 5px; margin-top: auto; padding-top: 9px; }
.todo-card .card-actions button {
  border: 1px solid transparent; background: var(--bg-sunken); border-radius: 7px;
  padding: 4px 9px; font-size: .73rem; color: var(--text-2); font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.todo-card .card-actions button:hover { background: var(--accent-soft); color: var(--accent-ink); }
/* 移动端卡片为流式布局，无自由缩放 */
.todo-card .resize { display: none; }
@media (max-width: 899px) {
  .todo-card { min-height: 0; }
  .todo-card .card-actions { padding-top: 10px; }
}
.todo-card.dragging { opacity: .85; box-shadow: var(--shadow-lg); z-index: 30; transform: rotate(.4deg); }
.empty-hint { text-align: center; color: var(--text-3); padding: 44px 16px; font-size: .86rem; }
.empty-hint::before {
  content: "○"; display: block; font-size: 1.6rem; line-height: 1;
  color: var(--border-strong); margin-bottom: 10px;
}

/* ============ 顶部收缩导航（抽屉）============ */
.drawer-toggle {
  width: 34px; height: 34px; flex: none; margin-right: 2px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); display: inline-flex; align-items: center; justify-content: center;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .1s var(--ease);
}
.drawer-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.drawer-toggle:hover { background: var(--bg-sunken); border-color: var(--border-strong); }
.drawer-toggle:active { transform: scale(.94); }
.drawer-mask {
  position: fixed; inset: 0; z-index: 44;
  background: rgba(12, 16, 26, .44);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .22s var(--ease), visibility .22s;
}
.drawer-mask.open { opacity: 1; visibility: visible; }
.drawer-nav {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 45;
  width: min(74vw, 282px); background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(-101%); transition: transform .26s var(--ease);
  padding: calc(env(safe-area-inset-top) + 16px) 10px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
}
.drawer-nav.open { transform: translateX(0); }
.drawer-title {
  display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.02rem;
  letter-spacing: .08em; padding: 0 10px 16px;
}
.drawer-title img { width: 26px; height: 26px; border-radius: 7px; }
.drawer-ver { margin-left: auto; font-size: .72rem; font-weight: 500; letter-spacing: 0; color: var(--text-3); }
.drawer-item {
  position: relative;
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: none; background: none; color: var(--text);
  padding: 11px 12px; border-radius: 10px; font-size: .91rem; font-weight: 500; text-align: left;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.drawer-item .dn-ico { display: inline-flex; color: var(--text-3); flex: none; transition: color .16s var(--ease); }
.drawer-item .dn-ico svg { width: 19px; height: 19px; }
.drawer-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.drawer-item.active .dn-ico { color: var(--accent); }
.drawer-item.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.drawer-item:not(.active):hover { background: var(--bg-sunken); }
.drawer-item:not(.active):hover .dn-ico { color: var(--text-2); }
.drawer-sep { height: 1px; background: var(--border); margin: 10px 10px; }

/* ============ 覆盖层 / 面板 ============ */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(12, 16, 26, .46);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in .2s var(--ease) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 600px) { .overlay { align-items: center; } }
.sheet, .modal {
  background: var(--surface); width: 100%; max-width: 560px; max-height: 88vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: sheet-up .26s var(--ease) both;
}
@keyframes sheet-up { from { transform: translateY(18px); opacity: .7; } to { transform: none; opacity: 1; } }
@media (min-width: 600px) {
  .sheet, .modal { border-radius: var(--radius-lg); max-height: 85vh; animation: modal-in .22s var(--ease) both; }
  @keyframes modal-in { from { transform: scale(.97) translateY(6px); opacity: .6; } to { transform: none; opacity: 1; } }
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.sheet-head h2 { margin: 0; font-size: 1.04rem; font-weight: 700; letter-spacing: .01em; }
/* 设置：左侧导航 + 右侧内容 */
.settings-sheet { max-width: 1000px; height: 88vh; }
.settings-layout { display: flex; flex: 1; min-height: 0; }
.settings-nav {
  width: 200px; flex: none; display: flex; flex-direction: column; gap: 3px;
  padding: 14px 10px; border-right: 1px solid var(--border); background: var(--bg-sunken); overflow: auto;
}
.set-nav {
  text-align: left; border: none; background: none; color: var(--text-2);
  padding: 9px 13px; border-radius: 9px; font-size: .88rem; font-weight: 500; white-space: nowrap;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.set-nav:hover { background: var(--surface); color: var(--text); }
.set-nav.active { background: var(--surface); color: var(--accent-ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.settings-content { flex: 1; overflow: auto; padding: 22px 26px calc(24px + env(safe-area-inset-bottom)); }
.set-section { display: none; }
.set-section.active { display: block; animation: fade-in .2s var(--ease) both; }
.set-section h3 { font-size: .98rem; font-weight: 700; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-size: .89rem; }
/* 手机端设置也保持竖版（左导航 + 右内容），与网页端一致 */
@media (max-width: 599px) {
  .settings-sheet { height: 92vh; border-radius: 14px 14px 0 0; }
  .settings-nav { width: 116px; padding: 12px 8px; gap: 2px; }
  .set-nav { padding: 9px 10px; font-size: .81rem; white-space: normal; }
  .settings-content { padding: 16px 14px calc(24px + env(safe-area-inset-bottom)); }
  .set-row { flex-wrap: wrap; }
  .set-row input[type="range"] { width: 62%; }
}
.set-row input[type="text"], .set-row input[type="date"] {
  border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px;
  background: var(--surface-2); width: 60%; outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.set-row input[type="text"]:focus, .set-row input[type="date"]:focus { border-color: var(--accent); box-shadow: var(--ring); }
.set-row input[type="range"] { width: 55%; accent-color: var(--accent); }
.seg { display: flex; background: var(--bg-sunken); border-radius: 9px; padding: 3px; }
.seg button {
  border: none; background: none; padding: 6px 14px; border-radius: 7px;
  font-size: .84rem; color: var(--text-2); font-weight: 500;
  transition: background .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
}
.seg button.active { background: var(--surface); color: var(--accent-ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.color-dots { display: flex; gap: 10px; flex-wrap: wrap; }
.color-dots .dot {
  position: relative; width: 26px; height: 26px; border-radius: 50%; border: none;
  cursor: pointer;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease);
}
.color-dots .dot:hover { transform: scale(1.1); }
.color-dots .dot.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--text); }
.color-dots .dot.active::after {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}
/* 窄屏下 8 个色点排进一行，避免落单换行 */
@media (max-width: 599px) {
  .color-dots { gap: 6px; }
  .color-dots .dot { width: 22px; height: 22px; }
  .color-dots .dot.active::after { background-size: 12px 12px; }
}
/* 代码检查 */
.cc-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cc-summary { font-size: .84rem; color: var(--text-2); }
.cc-summary.good { color: var(--ok); font-weight: 600; }
.cc-summary.warn { color: var(--warn); font-weight: 600; }
.cc-summary.bad { color: var(--danger); font-weight: 600; }
.cc-list { display: flex; flex-direction: column; gap: 8px; }
.cc-item {
  display: grid; grid-template-columns: 52px 150px 1fr; gap: 10px; align-items: start;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); font-size: .84rem;
}
.cc-level { font-weight: 600; }
.cc-item.pass .cc-level { color: var(--ok); }
.cc-item.warn .cc-level { color: var(--warn); }
.cc-item.fail .cc-level { color: var(--danger); }
.cc-name { font-weight: 600; }
.cc-detail { color: var(--text-2); word-break: break-word; }

/* 版本日志 */
.rel-current {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--accent-soft); border-radius: var(--radius-sm);
}
.rel-current-label { font-size: .79rem; color: var(--text-2); }
.rel-current-ver { font-size: .95rem; font-weight: 700; color: var(--accent-ink); letter-spacing: .02em; }
.rel-current-date { font-size: .77rem; color: var(--text-3); margin-left: auto; }
.rel-list { display: flex; flex-direction: column; gap: 9px; }
.rel-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); overflow: hidden;
}
.rel-item[open] { background: var(--surface); box-shadow: var(--shadow-sm); }
.rel-head {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 11px 14px; cursor: pointer; list-style: none;
  transition: background .14s var(--ease);
}
.rel-head::-webkit-details-marker { display: none; }
.rel-head:hover { background: var(--bg-sunken); }
.rel-ver { font-size: .87rem; font-weight: 700; color: var(--text); letter-spacing: .02em; }
.rel-tag {
  font-size: .68rem; font-weight: 600; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 99px; padding: 2px 8px;
}
.rel-title { font-size: .84rem; color: var(--text-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-date { font-size: .75rem; color: var(--text-3); flex: none; }
.rel-body { padding: 4px 14px 14px; }
.rel-group { margin-top: 10px; }
.rel-group-name {
  display: inline-block; font-size: .73rem; font-weight: 600; color: var(--text-2);
  background: var(--bg-sunken); border-radius: 5px; padding: 2px 8px; margin-bottom: 6px;
}
.rel-items { margin: 0; padding-left: 18px; }
.rel-items li { font-size: .82rem; color: var(--text); line-height: 1.62; }
.rel-items li::marker { color: var(--text-3); }
.rel-empty { font-size: .83rem; color: var(--text-3); padding: 14px 2px; }
@media (max-width: 599px) {
  .rel-date { display: none; }
  .rel-current-date { margin-left: 0; }
}
@media (max-width: 599px) {
  .cc-item { grid-template-columns: 1fr; gap: 4px; }
}
.switch { position: relative; width: 44px; height: 25px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 99px; transition: background .2s var(--ease); }
.switch span::before {
  content: ""; position: absolute; width: 19px; height: 19px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .2s var(--ease);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(19px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }
.export-list { display: flex; flex-direction: column; gap: 8px; }
.export-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.export-item button {
  border: none; background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 7px; padding: 7px 14px; font-size: .8rem; font-weight: 600;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.export-item button:hover { background: var(--accent); color: #fff; }
.danger-zone { opacity: .9; }

/* ============ 成员权限 ============ */
.perm-layout { display: flex; gap: 16px; align-items: flex-start; }
.perm-member-list {
  width: 152px; flex: none; display: flex; flex-direction: column; gap: 5px;
  max-height: 460px; overflow: auto; border-right: 1px solid var(--border); padding-right: 8px;
}
.perm-member {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 9px;
  background: var(--surface-2); cursor: pointer; border: 1px solid transparent;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.perm-member:hover { background: var(--bg-sunken); }
.perm-member.active { border-color: var(--accent); background: var(--accent-soft); }
.perm-member.admin .pm-badge { margin-left: auto; font-size: .66rem; font-weight: 600; color: var(--accent-ink); }
.perm-avatar {
  width: 26px; height: 26px; flex: none; border-radius: 50%; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .74rem; font-weight: 600;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
}
.perm-member .pm-name { font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-matrix { flex: 1; min-width: 0; }
.perm-matrix-head, .perm-row { display: grid; grid-template-columns: 1fr repeat(3, 52px); align-items: center; gap: 4px; }
.perm-matrix-head { font-size: .77rem; font-weight: 600; color: var(--text-3); padding: 0 4px 9px; letter-spacing: .02em; }
.perm-matrix-head span:not(:first-child) { text-align: center; }
.perm-row { padding: 11px 4px; border-top: 1px solid var(--border); font-size: .85rem; }
.perm-row:hover { background: var(--surface-2); }
.perm-row .pm-mod-name { padding-left: 4px; font-weight: 500; }
.perm-row .pm-cell { display: flex; justify-content: center; }
.perm-row .pm-cell input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.perm-row .pm-cell.off { opacity: .3; pointer-events: none; }
.perm-save-tip { color: var(--text-2); font-size: .79rem; margin-bottom: 12px; }
.perm-matrix .btn.primary { margin-top: 18px; }
@media (max-width: 599px) {
  .perm-layout { flex-direction: column; gap: 12px; }
  .perm-member-list {
    width: 100%; flex-direction: row; max-height: none; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--border); padding: 0 0 9px;
  }
  .perm-member { flex: none; min-width: 96px; }
  .perm-matrix-head, .perm-row { grid-template-columns: 1fr repeat(3, 44px); }
}

/* 弹窗正文通用表单 */
.modal-body { padding: 20px 22px; overflow: auto; }
.modal-body label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.modal-body label:first-child { margin-top: 0; }
.modal-body textarea, .modal-body input[type="text"], .modal-body input[type="password"], .modal-body input[type="date"], .modal-body select {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px;
  background: var(--surface-2); outline: none; font-size: .92rem;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.modal-body textarea { resize: vertical; min-height: 78px; line-height: 1.6; }
.modal-body textarea:focus, .modal-body input:focus, .modal-body select:focus {
  border-color: var(--accent); background: var(--surface); box-shadow: var(--ring);
}
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { flex: 1; width: auto; margin-top: 0; min-height: 44px; }

/* ============ 资料库（双端共用）============ */
.library-view { padding: 16px 14px 24px; }
.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.lib-head h2 { margin: 0; font-size: 1.02rem; font-weight: 700; letter-spacing: .01em; }
.lib-head .icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 9px; padding: 6px 10px; }
.lib-head .icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.lib-tools { display: flex; gap: 8px; margin-bottom: 13px; align-items: center; }
.lib-tools input {
  flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px;
  background: var(--surface); outline: none; min-width: 0; font-size: .9rem;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.lib-tools input::placeholder { color: var(--text-3); }
.lib-tools input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.lib-admin { display: flex; gap: 8px; align-items: center; }
.lib-tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 9px; padding: 9px 14px; font-size: .84rem; font-weight: 500; white-space: nowrap;
  transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), transform .1s var(--ease), box-shadow .16s var(--ease);
}
.lib-tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lib-tool:hover { background: var(--surface-2); border-color: var(--border-strong); }
.lib-tool:active { transform: scale(.97); }
.lib-tool.primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 5px 14px -6px rgba(var(--accent-rgb), .65);
}
.lib-tool.primary:hover { filter: brightness(1.06); box-shadow: 0 8px 18px -6px rgba(var(--accent-rgb), .75); }
.lib-tool.primary svg { stroke: #fff; }

/* ============ 连接状态（双端共用）============ */
.head-actions { display: flex; align-items: center; gap: 8px; }
.status-view { padding: 16px 14px 24px; }
.status-groups { display: flex; flex-direction: column; gap: 22px; }
.status-group-title {
  font-size: .9rem; font-weight: 700; margin: 0 0 11px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.status-group-title::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--accent); }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 11px; align-items: stretch; }
.status-card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px; box-shadow: var(--shadow-sm); min-height: 132px;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.status-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
@media (max-width: 899px) {
  .status-grid { grid-template-columns: 1fr; }
  .status-card { min-height: 0; }
  .status-badge-wrap { flex: 0 0 auto; }
}
.status-card-top { display: flex; align-items: center; gap: 10px; }
.status-icon {
  width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-size: 1.12rem; flex: none;
}
.status-name { font-size: .89rem; font-weight: 600; }
.status-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: .73rem; font-weight: 500;
  padding: 3px 9px; border-radius: 99px; background: var(--bg-sunken); color: var(--text-2);
}
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.ok { color: var(--ok); background: var(--ok-soft); }
.status-badge.bad { color: var(--danger); background: var(--danger-soft); }
/* 徽章 / 说明占用中间弹性空间，操作区统一贴卡片底部，保证同一行卡片按钮对齐 */
.status-badge-wrap { display: flex; align-items: flex-start; flex: 1; }
.status-card button {
  margin-top: auto; border: 1px solid var(--border); background: transparent; color: var(--text-2);
  border-radius: 8px; padding: 8px 12px; font-size: .79rem; font-weight: 500; width: 100%;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.status-card button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }

/* ============ 日报（双端共用）============ */
.report-view { padding: 16px 14px 24px; }
.report-filters { display: flex; gap: 8px; margin-bottom: 13px; }
.report-filters input, .report-filters select {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px;
  background: var(--surface); outline: none; min-width: 0; font-size: .88rem;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.report-filters input { flex: 1; }
.report-filters select { flex: none; }
.report-filters input:focus, .report-filters select:focus { border-color: var(--accent); box-shadow: var(--ring); }
.report-list { display: flex; flex-direction: column; gap: 11px; }
.report-table-wrap {
  width: 100%; overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
}
.report-table { width: 100%; min-width: 760px; border-collapse: collapse; table-layout: fixed; font-size: .81rem; }
.report-table th {
  text-align: left; padding: 11px 10px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
.report-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; word-break: break-word; }
.report-table tbody tr:last-child td { border-bottom: none; }
.report-table tbody tr { transition: background .14s var(--ease); }
.report-table tbody tr:hover { background: var(--accent-soft); }
.report-table .rt-date { width: 92px; }
.report-table .rt-seq { width: 42px; text-align: center; }
.report-table .rt-project { width: 66px; }
.report-table .rt-item { width: 150px; }
.report-table .rt-progress { width: 168px; }
.report-table .rt-todo { width: 150px; }
.report-table .rt-status { width: 62px; }
.report-table .rt-owner { width: 70px; }
.report-table .rt-ops { width: 108px; }
.report-table td.rt-date { color: var(--text-2); white-space: nowrap; }
.report-table .rt-ops-btns { display: flex; gap: 6px; }
.report-table .rt-ops-btns button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 7px; padding: 5px 10px; font-size: .77rem; white-space: nowrap;
  transition: background .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.report-table .rt-ops-btns button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.report-table .rt-ops-btns button.danger { color: var(--danger); }
.report-table .rt-ops-btns button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
@media (max-width: 899px) {
  .report-table { min-width: 660px; font-size: .78rem; }
  .report-table th, .report-table td { padding: 9px 8px; }
  .report-table .rt-date { width: 86px; }
  .report-table .rt-item { width: 128px; }
  .report-table .rt-progress { width: 150px; }
  .report-table .rt-todo { width: 128px; }
  .report-table .rt-ops { width: 96px; }
}
.rp-status {
  display: inline-block; font-size: .71rem; font-weight: 600; border-radius: 99px;
  padding: 3px 9px; background: var(--ok-soft); color: var(--ok);
}
.rp-status.open { background: var(--danger-soft); color: var(--danger); }
.report-form input, .report-form select, .report-form textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px;
  background: var(--surface-2); outline: none; font-size: .9rem;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.report-form input:focus, .report-form select:focus, .report-form textarea:focus {
  border-color: var(--accent); background: var(--surface); box-shadow: var(--ring);
}
.report-form-row { display: flex; gap: 10px; }
.report-form-row > div { flex: 1; min-width: 0; }

/* ============ 工时模块（双端共用）============ */
.timesheet-view { padding: 16px 14px 24px; }
.wps-status { font-size: .85rem; font-weight: 600; color: var(--text-2); word-break: break-word; }
.wps-status.ok { color: var(--ok); }
.wps-status.bad { color: var(--danger); }
.wps-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wps-actions .btn { min-height: 36px; }
.wps-form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow-sm);
}
.wps-field { margin-bottom: 13px; }
.wps-field label { display: block; font-size: .81rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.wps-field input, .wps-field select {
  width: 100%; box-sizing: border-box; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); border-radius: 9px; padding: 10px 12px; font-size: .9rem; outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.wps-field input:focus, .wps-field select:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
.wps-hint { font-size: .81rem; margin-top: 6px; }
.wps-hint.exists { color: var(--warn); font-weight: 600; }
.wps-hint.free { color: var(--ok); }
.wps-result { margin-top: 12px; font-size: .85rem; word-break: break-word; }
.wps-result a { color: var(--accent-ink); font-weight: 500; }
.timesheet-panel .wps-form { width: 100%; max-width: none; }

/* 工时数据录入（双端共用） */
.wh-entry {
  margin-top: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow-sm);
}
.wh-title { font-size: .91rem; font-weight: 700; margin: 0 0 13px; }
.wh-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.wh-field { flex: 1 1 120px; min-width: 100px; }
.wh-field label { display: block; font-size: .81rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.wh-field input {
  width: 100%; box-sizing: border-box; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); border-radius: 9px; padding: 10px 12px; font-size: .9rem; outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.wh-field input:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
.wh-form > .btn { flex: none; min-height: 38px; }
.wh-table-wrap {
  margin-top: 15px; overflow-x: auto; max-height: 420px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px;
}
.wh-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.wh-table th, .wh-table td { border-bottom: 1px solid var(--border); padding: 9px 10px; text-align: left; white-space: nowrap; }
.wh-table th {
  font-weight: 600; color: var(--text-2); background: var(--surface-2);
  position: sticky; top: 0; z-index: 1;
}
.wh-table tbody tr:nth-child(even) { background: var(--surface-2); }
.wh-table tbody tr:hover { background: var(--accent-soft); }
.wh-table tbody tr:last-child td { border-bottom: none; }
.wh-table .wh-ops { white-space: nowrap; }
.wh-table .wh-ops button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 7px; padding: 4px 9px; font-size: .74rem; margin-right: 4px;
  transition: background .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.wh-table .wh-ops button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.wh-table .wh-ops button.del { color: var(--danger); }
.wh-table .wh-ops button.del:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.wh-empty { color: var(--text-3); font-size: .84rem; padding: 12px 0; }
.wh-actions { margin-top: 11px; }
.status-card-wps .wps-status { font-size: .79rem; line-height: 1.45; word-break: break-word; min-height: 18px; }
.status-card-wps .wps-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.status-card-wps .wps-actions .btn { margin-top: 0; }

/* 钉钉连接卡片 */
.status-card-dt .status-icon.dt-icon { background: none; }
.status-card-dt .dt-icon svg { width: 30px; height: 30px; display: block; }
.status-card-dt .dt-status { font-size: .79rem; line-height: 1.45; word-break: break-word; min-height: 18px; color: var(--text-2); }
.status-card-dt .dt-status.ok { color: var(--ok); font-weight: 600; }
.status-card-dt .dt-status.bad { color: var(--danger); }
.status-card-dt .dt-caps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.status-card-dt .dt-caps .dt-cap {
  border: 1px solid var(--border); background: var(--bg-sunken); color: var(--text-3);
  border-radius: 99px; padding: 3px 9px; font-size: .71rem; font-weight: 500; line-height: 1.4;
  width: auto; margin-top: 0; flex: 0 0 auto; cursor: default;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.status-card-dt .dt-caps .dt-cap.on { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.status-card-dt .dt-caps .dt-cap.editable { cursor: pointer; }
.status-card-dt .dt-caps .dt-cap.editable:hover { border-color: var(--accent); color: var(--accent-ink); }
.status-card-dt .dt-caps .dt-cap.on.editable:hover { color: var(--ok); border-color: var(--ok); }
.status-card-dt .dt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.status-card-dt .dt-actions .btn { margin-top: 0; min-width: 76px; min-height: 36px; }
/* 授权主按钮：蓝色更贴合「连接钉钉」的语义，与钉钉图标同源。
   宽度不单独覆盖，跟随 .status-card button 的 100%（窄屏）/ .btn.sm 的 auto（桌面），
   保证与 WPS 卡片按钮同宽同排列。 */
.status-card-dt .dt-actions .dt-connect {
  background: linear-gradient(145deg, #1677ff, #2f8bff); color: #fff; border-color: transparent;
}
.status-card-dt .dt-actions .dt-connect:hover {
  background: linear-gradient(145deg, #1677ff, #2f8bff); color: #fff;
  border-color: transparent; filter: brightness(1.08);
}

/* 钉钉配置弹窗引导 */
.dt-guide {
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 14px;
}
.dt-guide-t { font-size: .8rem; line-height: 1.6; color: var(--text-2); margin: 0 0 9px; }
.dt-guide-steps { margin: 0; padding-left: 17px; display: flex; flex-direction: column; gap: 6px; }
.dt-guide-steps li { font-size: .78rem; line-height: 1.55; color: var(--text-2); }
.dt-guide-steps code {
  display: inline-block; background: var(--surface); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px; font-size: .74rem; color: var(--accent-ink);
  word-break: break-all;
}
.dt-guide-sub { color: var(--text-3); font-size: .74rem; }

.lib-list { display: flex; flex-direction: column; gap: 9px; }
.lib-row {
  display: flex; align-items: center; gap: 12px; padding: 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.lib-row:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.lib-icon { font-size: 1.35rem; flex: none; width: 30px; text-align: center; }
.lib-meta { flex: 1; min-width: 0; }
.lib-name { font-size: .89rem; font-weight: 500; word-break: normal; overflow-wrap: break-word; line-height: 1.45; }
.lib-sub { font-size: .74rem; color: var(--text-3); margin-top: 3px; }
.lib-ops { display: flex; gap: 6px; flex: none; }
.lib-ops button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 7px; padding: 5px 10px; font-size: .77rem;
  transition: background .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.lib-ops button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.lib-ops button.danger { color: var(--danger); }
.lib-ops button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

/* ============ 外部连接 ============ */
.link-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.link-head h2 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.link-form {
  display: flex; flex-direction: column; gap: 11px; padding: 15px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 12px;
}
.link-field { display: flex; flex-direction: column; gap: 6px; }
.link-field label { font-size: .81rem; font-weight: 600; color: var(--text-2); }
.link-field input, .link-field select {
  width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px;
  background: var(--surface-2); outline: none; font-size: .89rem;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.link-field input::placeholder { color: var(--text-3); }
.link-field input:focus, .link-field select:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
.link-form-actions { display: flex; gap: 10px; margin-bottom: 15px; }
/* 直接挂在 .btn 上的 width:100% 会覆盖这里，用同等特异性 + 后置规则压住 */
.link-form-actions .btn,
.link-form-actions .btn.primary,
.link-form-actions .btn.ghost {
  width: auto; flex: 0 1 auto; min-width: 92px;
  margin: 0; padding: 10px 18px; font-size: .89rem; min-height: 42px;
}
.link-list { display: flex; flex-direction: column; gap: 9px; }
.link-row {
  display: flex; align-items: center; gap: 12px; padding: 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.link-row:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.link-row .lk-icon { font-size: 1.3rem; flex: none; width: 28px; text-align: center; }
.link-row .lk-meta { flex: 1; min-width: 0; }
.link-row .lk-name { font-size: .91rem; font-weight: 600; color: var(--text); text-decoration: none; cursor: pointer; word-break: break-all; }
.link-row .lk-name:hover { color: var(--accent-ink); }
.link-row .lk-url { font-size: .74rem; color: var(--text-3); margin-top: 3px; word-break: break-all; }
.link-row .lk-ops { display: flex; gap: 6px; flex: none; }
.link-row .lk-ops button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 7px; padding: 5px 10px; font-size: .77rem;
  transition: background .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.link-row .lk-ops button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.link-row .lk-ops button.danger { color: var(--danger); }
.link-row .lk-ops button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
/* 行内编辑：单行内展开为 图标 + 名称 + 网址 + 图标下拉 + 保存/取消 */
.link-row.editing {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-color: var(--accent); box-shadow: var(--ring);
}
.link-row.editing:hover { transform: none; }
.link-row.editing .lk-icon { width: 24px; }
.link-row.editing .lke-name { flex: 1 1 130px; min-width: 110px; }
.link-row.editing .lke-url { flex: 2 1 240px; min-width: 160px; }
.link-row.editing .lke-icon { flex: none; width: 58px; }
.link-row.editing input, .link-row.editing select {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  background: var(--surface-2); outline: none; font-size: .84rem; min-width: 0; color: var(--text);
}
.link-row.editing input:focus, .link-row.editing select:focus { border-color: var(--accent); box-shadow: var(--ring); }
.link-row.editing .lk-ops button.save { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (max-width: 599px) {
  .link-row.editing .lk-icon { display: none; }
  .link-row.editing .lke-name, .link-row.editing .lke-url { flex: 1 1 100%; min-width: 0; }
  .link-row.editing .lke-icon { flex: 1 1 100%; width: auto; }
}
.modal-body input[type="file"] {
  width: 100%; border: 1px dashed var(--border-strong); border-radius: 10px;
  padding: 14px; background: var(--surface-2); font-size: .85rem; color: var(--text-2);
}
.cat-add { display: flex; gap: 8px; margin-bottom: 16px; }
.cat-add input {
  flex: 1; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px;
  background: var(--surface-2); outline: none; min-width: 0;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.cat-add input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.cat-add .btn { width: auto; margin: 0; white-space: nowrap; min-height: 42px; }
.cat-list { display: flex; flex-direction: column; gap: 10px; }
.cat-item { border: 1px solid var(--border); border-radius: 10px; padding: 13px; background: var(--surface-2); }
.cat-item-head { display: flex; align-items: center; justify-content: space-between; }
.cat-item-head b { font-size: .91rem; }
.cat-item-head button {
  border: none; background: transparent; color: var(--danger); font-size: .79rem;
  padding: 4px 8px; border-radius: 6px; transition: background .14s var(--ease);
}
.cat-item-head button:hover { background: var(--danger-soft); }
/* 成员权限内的资料库分类授权 */
.perm-cat-access { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.perm-cat-title { font-size: .84rem; font-weight: 600; margin-bottom: 10px; }
.perm-cat-list { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.perm-cat-list label { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--text); cursor: pointer; }
.perm-cat-list input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.toast {
  position: fixed; bottom: calc(80px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); z-index: 100;
  background: rgba(23, 27, 38, .94); color: #fff;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: 11px 20px; border-radius: 99px; font-size: .85rem; font-weight: 500;
  box-shadow: var(--shadow-lg); max-width: 84vw; text-align: center;
  animation: toast-in .24s var(--ease) both;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============ 电脑端布局（≥900px）参考工作台三栏结构 ============ */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .app-view { max-width: none; margin: 0; padding: 0; }
  .mobile-layout { display: none; }
  .desktop-layout { display: block; }

  /* 顶部横向栏 */
  .desk-topbar {
    height: 52px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    background: color-mix(in srgb, var(--surface) 84%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
  }
  .desk-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: .98rem; letter-spacing: .08em; }
  .desk-brand img { width: 26px; height: 26px; border-radius: 7px; }
  .desk-info { display: flex; align-items: center; gap: 12px; font-size: .79rem; color: var(--text-2); }
  .desk-info .di { white-space: nowrap; }
  .desk-info .di b { color: var(--text); font-weight: 600; }
  .role-tag {
    background: var(--accent-soft); color: var(--accent-ink);
    border-radius: 6px; padding: 3px 9px; font-size: .73rem; font-weight: 600; letter-spacing: .02em;
  }
  .btn.sm { width: auto; margin: 0; padding: 6px 13px; font-size: .79rem; font-weight: 500; border-radius: 9px; min-height: 32px; }

  /* 主体：左侧导航 + 右侧内容 */
  .desk-body { display: flex; min-height: calc(100vh - 52px); }
  .desk-sidebar {
    width: 196px; flex: none;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 12px 10px;
    /* 侧栏独立固定：右侧内容再长也不跟着滚 */
    position: sticky; top: 52px; align-self: flex-start;
    height: calc(100vh - 52px); overflow-y: auto; overscroll-behavior: contain;
  }
  .desk-sidebar nav { flex: 1; }
  .nav-item {
    position: relative;
    padding: 10px 13px; margin-bottom: 2px; border-radius: 9px; cursor: pointer; font-size: .88rem;
    display: flex; align-items: center; justify-content: space-between; color: var(--text); user-select: none;
    font-weight: 500;
    transition: background .16s var(--ease), color .16s var(--ease);
  }
  .nav-item:hover { background: var(--bg-sunken); }
  .nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
  .nav-item.active::before {
    content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 17px; border-radius: 0 3px 3px 0; background: var(--accent);
  }
  .desk-side-foot {
    border-top: 1px solid var(--border); padding-top: 11px; margin-top: 11px;
    display: flex; align-items: center; justify-content: space-between; font-size: .78rem; color: var(--text-3);
  }
  .desk-side-foot button {
    border: none; background: none; color: var(--text-2); font-size: .79rem; padding: 5px 7px;
    border-radius: 7px; transition: background .16s var(--ease), color .16s var(--ease);
  }
  .desk-side-foot button:hover { background: var(--bg-sunken); color: var(--text); }

  /* 右侧主内容区（可调整卡片位置大小）
     固定为一屏高并内部滚动，保证侧栏与顶栏不随内容上下移动 */
  .desk-main {
    flex: 1; position: relative; padding: 18px;
    height: calc(100vh - 52px); overflow-y: auto; overscroll-behavior: contain;
  }
  .panel {
    position: absolute; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; min-height: 200px; min-width: 300px; overflow: hidden;
    transition: box-shadow .2s var(--ease);
  }
  .panel:hover { box-shadow: var(--shadow); }
  .panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px; border-bottom: 1px solid var(--border);
  }
  .panel-head h2 { margin: 0; font-size: .96rem; font-weight: 700; letter-spacing: .01em; }
  .panel-head button, .panel-head select {
    border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
    border-radius: 8px; padding: 6px 11px; font-size: .78rem; font-weight: 500;
    transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
  }
  .panel-head button:hover, .panel-head select:hover { background: var(--bg-sunken); border-color: var(--border-strong); color: var(--text); }
  .ph-actions { display: flex; gap: 8px; align-items: center; }

  /* 调整模式：虚线提示 + 拖拽把手 + 缩放手柄 */
  .desk-main.adjusting .panel { outline: 1.5px dashed var(--accent); outline-offset: -2px; box-shadow: var(--shadow); }
  .desk-main.adjusting .panel-head { cursor: move; background: var(--accent-soft); }
  .panel-resize {
    display: none; position: absolute; right: 0; bottom: 0; width: 18px; height: 18px;
    cursor: nwse-resize; color: var(--accent); font-size: 13px; line-height: 16px;
    text-align: center; user-select: none;
  }
  .desk-main.adjusting .panel-resize { display: block; }

  /* 调整模式：左侧导航项可拖拽排序 */
  .desk-sidebar.adjusting #desk-nav > [data-nav-item] { cursor: grab; outline: 1px dashed var(--accent); outline-offset: -2px; }
  .desk-sidebar.adjusting #desk-nav > [data-nav-item]:active { cursor: grabbing; }
  .desk-sidebar.adjusting #desk-nav > [data-nav-item].nav-dragging { opacity: .4; }
  .desk-sidebar.adjusting #desk-nav > [data-nav-item].nav-drop-before { box-shadow: 0 -2px 0 var(--accent); }
  .desk-sidebar.adjusting #desk-nav > [data-nav-item].nav-drop-after { box-shadow: 0 2px 0 var(--accent); }

  /* AI 助手 */
  .ai-body { flex: 1; padding: 16px; overflow: auto; background: var(--surface-2); }
  /* 没有任何消息时给一条引导，避免大片空白 */
  .ai-body:empty::before {
    content: "问点什么，或直接点下面的快捷按钮";
    display: flex; align-items: center; justify-content: center;
    height: 100%; min-height: 140px;
    color: var(--text-3); font-size: .86rem; text-align: center;
  }
  .ai-msg {
    margin-bottom: 11px; padding: 11px 15px; border-radius: 13px; font-size: .885rem;
    line-height: 1.65; white-space: pre-wrap; word-break: break-word; max-width: 92%;
  }
  .ai-msg.user {
    background: linear-gradient(145deg, var(--accent), var(--accent-2)); color: #fff;
    margin-left: auto; border-bottom-right-radius: 5px;
    box-shadow: 0 4px 12px -5px rgba(var(--accent-rgb), .6);
  }
  .ai-msg.sys { background: var(--surface); border: 1px solid var(--border); color: var(--text); margin-right: auto; border-bottom-left-radius: 5px; }
  .ai-msg.err { background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); margin-right: auto; }
  .ai-quick { display: flex; gap: 8px; padding: 11px 16px 0; }
  .ai-quick button {
    flex: 1; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
    border-radius: 9px; padding: 8px 6px; font-size: .8rem; cursor: pointer;
    transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
  }
  .ai-quick button:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
  .ai-input { display: flex; gap: 8px; padding: 11px 16px 16px; }
  .ai-input input {
    flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px;
    background: var(--surface-2); outline: none; font-size: .885rem;
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
  }
  .ai-input input:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
  .ai-input button, .todo-add button {
    border: none; color: #fff; border-radius: 10px; padding: 0 20px; font-weight: 600; white-space: nowrap;
    background: linear-gradient(145deg, var(--accent), var(--accent-2));
    box-shadow: 0 5px 14px -7px rgba(var(--accent-rgb), .7);
    transition: filter .16s var(--ease), transform .1s var(--ease);
  }
  .ai-input button:hover, .todo-add button:hover { filter: brightness(1.06); }
  .ai-input button:active, .todo-add button:active { transform: scale(.97); }

  /* 资料库面板 */
  .desk-library, .desk-links, .desk-status, .desk-report, .desk-timesheet { display: flex; }
  .lib-panel, .link-panel, .status-panel, .report-panel, .timesheet-panel {
    width: 100%; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; padding: 22px 26px; min-height: 420px;
    /* 面板限制在一屏内，超出部分由内部列表滚动，避免整页与内层双滚动条 */
    max-height: calc(100vh - 52px - 36px);
  }
  .lib-panel .lib-list, .link-panel .link-list, .status-panel .status-groups, .report-panel .report-list { flex: 1; min-height: 0; overflow: auto; }
  .status-panel .status-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .link-panel .link-form { flex-direction: row; align-items: flex-end; }
  .link-panel .link-field { flex: 1; }
  .link-panel .link-form-actions { max-width: 420px; }

  /* 待办事项列表 */
  .todo-add { display: flex; gap: 8px; padding: 13px 16px; }
  .todo-add input {
    flex: 1; border: 1px solid var(--border); border-radius: 9px; padding: 10px 13px;
    background: var(--surface-2); outline: none; font-size: .885rem;
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
  }
  .todo-add input:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
  .todo-list { flex: 1; overflow: auto; padding: 0 16px 16px; }
  .todo-group-title { font-size: .78rem; font-weight: 600; color: var(--text-3); margin: 12px 0 6px; letter-spacing: .03em; }
  .todo-row { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
  .todo-row:last-child { border-bottom: none; }
  .todo-row .chk {
    width: 18px; height: 18px; border: 1.8px solid var(--border-strong); border-radius: 6px; flex: none;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: background .16s var(--ease), border-color .16s var(--ease), transform .12s var(--ease);
  }
  .todo-row .chk:hover { border-color: var(--accent); transform: scale(1.06); }
  .todo-row.done .chk { background: var(--accent); border-color: var(--accent); }
  .todo-row.done .chk::after { content: "✓"; color: #fff; font-size: .7rem; font-weight: 700; }
  .todo-row .txt { flex: 1; font-size: .875rem; word-break: break-word; }
  .todo-row.done .txt { text-decoration: line-through; color: var(--text-3); }
  .todo-row .ops { display: flex; gap: 6px; }
  .todo-row .ops button {
    border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
    border-radius: 7px; padding: 4px 10px; font-size: .74rem;
    transition: background .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
  }
  .todo-row .ops button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
  .todo-panel.no-edit .ops { display: none; }
  .todo-empty { color: var(--text-3); font-size: .84rem; padding: 10px 4px; }

  /* 设置面板桌面端加宽 */
  .modal { max-width: 680px; }
  .settings-sheet { max-width: 1000px; height: min(85vh, 760px); }
  .set-row input[type="text"], .set-row input[type="date"] { width: 50%; max-width: 320px; }
  .drawer-toggle, .drawer-mask, .drawer-nav { display: none; }
}
