/* ============ 像素风 + 极简原木风 UI ============ */

@import url('https://cdn.jsdelivr.net/npm/@fontsource/fusion-pixel-12px-proportional-sc@5.3.0/index.css');

:root {
  --paper: #f4eddc;        /* 背景：浅木纸色 */
  --panel: #fbf7ec;        /* 面板：奶油白 */
  --panel-dim: #efe7d2;    /* 面板次级 */
  --wood: #b08d63;         /* 原木 */
  --wood-light: #cbb08a;   /* 浅原木 */
  --line: #4a3a28;         /* 深木线条 */
  --line-soft: #d8cbb2;    /* 浅分割线 */
  --ink: #3a2e1f;          /* 正文 */
  --ink-soft: #8a7a62;     /* 次级文字 */
  --accent: #e0a83e;       /* 点缀金 */
  --green: #6f9a53;
  --blue: #6b8ca6;
  --red: #c07158;
  --purple: #8d7bb0;
  --shadow: 4px 4px 0 rgba(74, 58, 40, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Fusion Pixel 12px Proportional SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(74, 58, 40, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 58, 40, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
}

.sky-band {
  height: 6px;
  background: repeating-linear-gradient(90deg,
    var(--wood) 0 24px, var(--wood-light) 24px 48px);
  border-bottom: 2px solid var(--line);
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--panel);
  border-bottom: 3px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo h1 {
  font-size: 22px;
  font-weight: normal;
  color: var(--ink);
  letter-spacing: 2px;
}

.tabs { display: flex; gap: 8px; }

.tab-btn {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--ink-soft);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
  transition: none;
}
.tab-btn:hover { background: var(--panel-dim); }
.tab-btn.active {
  background: var(--wood);
  color: #fff;
}

.badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  background: var(--line);
  color: var(--paper);
  font-size: 12px;
  text-align: center;
}
.tab-btn.active .badge { background: var(--panel); color: var(--ink); }

.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

.zoom-ctrl { display: flex; gap: 4px; align-items: center; }
.zoom-label {
  font-family: inherit;
  font-size: 12px;
  padding: 6px 8px;
  min-width: 48px;
  cursor: pointer;
  background: transparent;
  color: var(--ink-soft);
  border: 2px solid var(--line-soft);
  border-radius: 0;
}
.zoom-label:hover { border-color: var(--line); color: var(--ink); }

/* ---------- 像素按钮 ---------- */
.sv-btn {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.sv-btn:hover { background: var(--panel-dim); }
.sv-btn:active { transform: translate(3px, 3px); box-shadow: none; }

.sv-btn-gold { background: var(--accent); }
.sv-btn-gold:hover { background: #d19a30; }
.sv-btn-danger { background: var(--red); color: #fff; }
.sv-btn-danger:hover { background: #a95f48; }
.sv-btn-small { font-size: 12px; padding: 5px 10px; }

.icon-btn {
  font-family: inherit;
  font-size: 12px;
  width: 26px; height: 26px;
  cursor: pointer;
  background: transparent;
  color: var(--panel);
  border: 2px solid transparent;
  border-radius: 0;
  line-height: 1;
}
.icon-btn:hover { border-color: var(--panel); }

/* ---------- 侧边导航栏 ---------- */
.sidebar {
  position: fixed;
  left: 0;
  top: 62px;
  bottom: 0;
  width: 200px;
  background: var(--panel);
  border-right: 3px solid var(--line);
  overflow-y: auto;
  z-index: 40;
  padding: 14px 0 20px;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: var(--panel-dim); }
.sidebar::-webkit-scrollbar-thumb { background: var(--wood); border: 1px solid var(--line); }
.sidebar { scrollbar-width: thin; scrollbar-color: var(--wood) var(--panel-dim); }

.sidebar-title {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 0 14px 10px;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 8px;
}

.side-biz {
  font-size: 14px;
  color: var(--ink);
  padding: 7px 14px;
  cursor: pointer;
  border-left: 4px solid var(--wood);
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.side-biz:hover { background: var(--panel-dim); }

.side-proj {
  font-size: 13px;
  color: var(--ink-soft);
  padding: 5px 14px 5px 26px;
  cursor: pointer;
  border-left: 4px solid transparent;
  overflow-wrap: anywhere;
}
.side-proj::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--wood-light);
  border: 1px solid var(--line);
  margin-right: 8px;
  vertical-align: 2px;
}
.side-proj:hover { background: var(--panel-dim); color: var(--ink); }

.sidebar-empty {
  font-size: 12px;
  color: #bfb097;
  padding: 10px 14px;
}

/* ---------- 拖拽排序 ---------- */
.drag-handle {
  cursor: grab;
  font-size: 13px;
  color: #c8b795;
  user-select: none;
  padding: 2px 3px;
  line-height: 1;
  align-self: center;
}
.drag-handle:hover { color: var(--ink-soft); }
.drag-handle:active { cursor: grabbing; }
.business-header .drag-handle { color: rgba(255, 255, 255, 0.65); }
.business-header .drag-handle:hover { color: #fff; }
.task .drag-handle { align-self: start; margin-top: 6px; }

.dragging { opacity: 0.4; }

/* 插入位置指示：任务在上方，项目在左侧，业务分上/下方 */
.task.drop-before { box-shadow: 0 -4px 0 var(--accent); }
.project.drop-before { box-shadow: -6px 0 0 var(--accent); }
.business.drop-before {
  box-shadow: 0 -8px 0 var(--accent), 6px 6px 0 rgba(0, 0, 0, 0.25) !important;
}
.business.drop-after {
  box-shadow: 0 8px 0 var(--accent), 6px 6px 0 rgba(0, 0, 0, 0.25) !important;
}
.side-biz.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.side-biz.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
/* 拖入容器（跨项目/跨业务追加） */
.drop-into { outline: 3px dashed var(--accent); outline-offset: -3px; }

/* 导航定位后的闪烁高亮 */
.nav-flash { animation: nav-flash 1.2s steps(4); }
@keyframes nav-flash {
  0%, 50% { outline: 3px solid var(--accent); outline-offset: 2px; }
  25%, 75%, 100% { outline: 3px solid transparent; outline-offset: 2px; }
}

/* ---------- 看板布局 ---------- */
.view {
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

@media (min-width: 1024px) {
  .view { margin-left: 224px; max-width: none; }
}
@media (max-width: 1023.9px) {
  .sidebar { display: none; }
}

.board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
}

/* ---------- 业务窗口 ---------- */
.business {
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 6px 6px 0 rgba(74, 58, 40, 0.18);
  min-width: 0; /* 允许收缩，项目横排在窗口内滚动而非撑宽页面 */
  scroll-margin-top: 76px; /* 定位滚动时避开吸顶栏 */
}

.business-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--wood);
  border-bottom: 3px solid var(--line);
}

.business-title {
  font-size: 17px;
  color: #fff;
  flex: 1;
  overflow-wrap: anywhere;
}

.business-meta {
  padding: 14px 14px 6px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.meta-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: start;
  gap: 10px;
}

.meta-label {
  font-size: 13px;
  padding: 6px 0;
  color: var(--ink);
  text-align: center;
  background: var(--panel-dim);
  border: 2px solid var(--line);
  border-left-width: 6px;
}
.meta-label.focus { border-left-color: var(--green); }
.meta-label.goal { border-left-color: var(--blue); }
.meta-label.problem { border-left-color: var(--red); }

.meta-input {
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line-soft);
  border-radius: 0;
  padding: 7px 9px;
  width: 100%;
  resize: vertical;
  min-height: 34px;
  line-height: 1.5;
}
.meta-input:focus { outline: none; border-color: var(--line); }
.meta-input::placeholder { color: #bfb097; }

/* ---------- 项目分栏（横向排列） ---------- */
.projects-wrap { position: relative; }

/* 横向滚动指示箭头 */
.scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 40px;
  border: 2px solid var(--line);
  background: var(--accent);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  z-index: 5;
  box-shadow: 2px 2px 0 rgba(74, 58, 40, 0.25);
  animation: arrow-nudge 1.2s steps(2) infinite;
}
.scroll-arrow:hover { background: #d19a30; animation: none; }
.scroll-arrow.left { left: 4px; }
.scroll-arrow.right { right: 4px; }
@keyframes arrow-nudge {
  0%, 100% { transform: translateY(-50%); }
  50% { transform: translateY(-50%) translateX(2px); }
}
.scroll-arrow.left { animation-name: arrow-nudge-l; }
@keyframes arrow-nudge-l {
  0%, 100% { transform: translateY(-50%); }
  50% { transform: translateY(-50%) translateX(-2px); }
}

.projects {
  padding: 12px 14px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  overflow-x: auto;
}

/* 像素风横向滚动条 */
.projects::-webkit-scrollbar { height: 10px; }
.projects::-webkit-scrollbar-track { background: var(--panel-dim); border: 1px solid var(--line-soft); }
.projects::-webkit-scrollbar-thumb { background: var(--wood); border: 1px solid var(--line); }
.projects { scrollbar-width: thin; scrollbar-color: var(--wood) var(--panel-dim); }

.project {
  flex: 0 0 330px;
  width: 330px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: var(--panel);
}

.project-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--panel-dim);
  border-bottom: 2px solid var(--line);
}

.project-title {
  font-size: 15px;
  flex: 1;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.project-title::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--wood);
  border: 1px solid var(--line);
  margin-right: 8px;
}

.project .icon-btn { color: var(--ink-soft); }
.project .icon-btn:hover { border-color: var(--line); color: var(--ink); }

.task-list { display: grid; }

/* ---------- 任务行 ---------- */
.task {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 4px 6px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.1s;
}
.task:last-child { border-bottom: none; }
.task:hover { background: var(--panel-dim); }

.task.leaving { animation: harvest 0.35s steps(6) forwards; }
@keyframes harvest {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(48px); }
}

.task-name {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  border: 2px solid transparent;
  border-radius: 0;
  padding: 4px 6px;
  width: 100%;
  resize: none;
  overflow: hidden;
  line-height: 1.45;
  display: block;
}
.task-name:hover { border-color: var(--line-soft); }
.task-name:focus { outline: none; border-color: var(--line); background: #fff; }

.task-controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.status-select {
  font-family: inherit;
  font-size: 12px;
  padding: 4px 6px;
  border: 2px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  color: #fff;
}
.status-select option { color: var(--ink); background: var(--panel); }
.status-未开始 { background: #a09585; }
.status-等待   { background: #c99b3f; }
.status-进行中 { background: var(--green); }
.status-暂停   { background: #8d7bb0; }
.status-完成   { background: var(--blue); }

.ddl-input {
  font-family: inherit;
  font-size: 12px;
  padding: 3px 6px;
  border: 2px solid var(--line-soft);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
}
.ddl-input:focus { outline: none; border-color: var(--line); }
.ddl-input.overdue { border-color: var(--red); color: var(--red); }

/* 优先级选择：默认无色，P1 红 / P2 黄 / P3 蓝 */
.priority-select {
  font-family: inherit;
  font-size: 12px;
  padding: 4px 6px;
  border: 2px solid var(--line-soft);
  border-radius: 0;
  cursor: pointer;
  background: #fff;
  color: var(--ink-soft);
}
.priority-select:focus { outline: none; border-color: var(--line); }
.priority-select option { color: var(--ink); background: var(--panel); }
.priority-select.priority-P1 { background: #c0504a; color: #fff; border-color: var(--line); }
.priority-select.priority-P2 { background: #d4a017; color: #fff; border-color: var(--line); }
.priority-select.priority-P3 { background: #5b84a8; color: #fff; border-color: var(--line); }

.ddl-tag {
  font-size: 11px;
  color: #fff;
  background: var(--red);
  border: 1px solid var(--line);
  padding: 2px 6px;
}

.note-input {
  font-family: inherit;
  font-size: 12px;
  flex: 1;
  min-width: 120px;
  padding: 4px 6px;
  border: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
}
.note-input:hover { border-color: var(--line-soft); }
.note-input:focus { outline: none; border-color: var(--line); background: #fff; color: var(--ink); }
.note-input::placeholder { color: #bfb097; }

/* 详情按钮：空白时淡，有内容时重 */
.detail-btn {
  align-self: start;
  font-family: inherit;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 0;
  background: transparent;
  color: #bfb097;
  border: 2px solid var(--line-soft);
}
.detail-btn:hover { color: var(--ink-soft); border-color: var(--ink-soft); }
.detail-btn.has-detail {
  background: var(--wood);
  color: #fff;
  border-color: var(--line);
}
.detail-btn.has-detail:hover { background: #9a7a53; }

.detail-textarea {
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  min-height: 220px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  resize: vertical;
  line-height: 1.7;
}
.detail-textarea:focus { outline: none; border-color: var(--wood); }

.detail-hint {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 8px;
  line-height: 1.5;
}

/* 详情查看模式：段落 + 可打勾方框 */
.detail-view {
  font-size: 14px;
  min-height: 220px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 10px 12px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  line-height: 1.7;
}
.detail-view .dline { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.2em; }

.dcheck-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 0;
}
.dcheck {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 4px;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  position: relative;
}
.dcheck:hover { background: var(--panel-dim); }
.dcheck.checked { background: var(--green); }
.dcheck.checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  color: #fff;
  font-size: 12px;
  line-height: 12px;
  text-align: center;
}
.dcheck-text { overflow-wrap: anywhere; }
.dcheck-row.checked .dcheck-text { color: var(--ink-soft); text-decoration: line-through; }

.modal-wide { max-width: 560px; }

.task-del {
  align-self: start;
  width: 24px; height: 24px;
  font-size: 12px;
  cursor: pointer;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 0;
  color: #bfb097;
}
.task-del:hover { color: #fff; background: var(--red); border-color: var(--line); }

.add-task-btn, .add-project-btn {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  cursor: pointer;
  color: var(--ink-soft);
  background: transparent;
  border: 2px dashed var(--wood-light);
  border-radius: 0;
}
.add-task-btn { margin: 8px 10px 10px; }
.add-project-btn {
  flex: 0 0 auto;
  min-width: 120px;
  min-height: 44px;
}
.add-task-btn:hover, .add-project-btn:hover {
  border-color: var(--line);
  color: var(--ink);
  background: var(--panel-dim);
}

.project-empty {
  font-size: 12px;
  color: #bfb097;
  padding: 12px;
  text-align: center;
}

/* ---------- 优先级分类视图 ---------- */
.prio-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .prio-row { grid-template-columns: 1fr; }
}

.prio-sec-empty {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: #bfb097;
}

.prio-section {
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 6px 6px 0 rgba(74, 58, 40, 0.18);
}

.prio-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 15px;
  color: #fff;
  border-bottom: 3px solid var(--line);
}
.prio-sec-P1 .prio-header { background: #c0504a; }
.prio-sec-P2 .prio-header { background: #d4a017; }
.prio-sec-P3 .prio-header { background: #5b84a8; }
.prio-sec-none .prio-header { background: #a09585; }

.prio-count {
  margin-left: auto;
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 8px;
  font-size: 12px;
}

.prio-groups { padding: 12px 14px 14px; display: grid; gap: 12px; }

.prio-biz {
  border: 2px solid var(--line);
  background: var(--panel);
}
.prio-biz-name {
  padding: 6px 10px;
  font-size: 14px;
  color: var(--ink);
  background: var(--wood-light);
  border-bottom: 2px solid var(--line);
}

.prio-proj-name {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 8px 10px 2px;
}
.prio-proj-name::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  background: var(--wood);
  border: 1px solid var(--line);
  margin-right: 7px;
}

.prio-empty {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: #bfb097;
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 6px 6px 0 rgba(74, 58, 40, 0.18);
}

/* ---------- 已完成视图 ---------- */
.done-list { display: grid; gap: 20px; max-width: 900px; margin: 0 auto; }

.done-group {
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 6px 6px 0 rgba(74, 58, 40, 0.18);
}

.done-group-header {
  padding: 9px 14px;
  font-size: 15px;
  color: #fff;
  background: var(--wood);
  border-bottom: 3px solid var(--line);
}

.done-task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.done-task:last-child { border-bottom: none; }

.done-star { font-size: 14px; color: var(--accent); }
.done-name { font-size: 14px; flex: 1; min-width: 140px; overflow-wrap: anywhere; }
.done-info { font-size: 11px; color: var(--ink-soft); }
.done-note { font-size: 11px; color: var(--ink-soft); max-width: 240px; overflow-wrap: anywhere; }

/* ---------- 空状态 ---------- */
.empty-hint { display: flex; justify-content: center; padding: 60px 0; }
.empty-card {
  text-align: center;
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 6px 6px 0 rgba(74, 58, 40, 0.18);
  padding: 36px 48px;
  font-size: 14px;
  line-height: 2.1;
  color: var(--ink-soft);
}
.empty-icon { font-size: 36px; margin-bottom: 8px; }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 46, 31, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.sv-panel {
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 6px 6px 0 rgba(74, 58, 40, 0.3);
}

.modal { width: 100%; max-width: 420px; padding: 20px; animation: pop 0.12s steps(3); }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-title { font-size: 16px; margin-bottom: 14px; text-align: center; }
.modal-body p { font-size: 14px; line-height: 1.7; text-align: center; }

.sv-input {
  font-family: inherit;
  font-size: 15px;
  width: 100%;
  padding: 9px 12px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
}
.sv-input:focus { outline: none; border-color: var(--wood); }

.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

/* ---------- 密码验证 ---------- */
.login-tip {
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 12px;
}
.login-error {
  font-size: 13px;
  color: var(--red);
  text-align: center;
  margin-top: 10px;
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  background: var(--line);
  color: var(--paper);
  border: 2px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: 10px 20px;
  font-size: 13px;
  z-index: 200;
  animation: toast-in 0.15s steps(3);
}
@keyframes toast-in { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
  padding: 20px 0 30px;
}

.footer-link {
  font-family: inherit;
  font-size: 12px;
  background: none;
  border: none;
  color: var(--ink-soft);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.footer-link:hover { color: var(--ink); }

/* ---------- 项目已完成任务弹窗 ---------- */
.history-list { display: grid; gap: 6px; max-height: 55vh; overflow-y: auto; }

.history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid var(--line-soft);
  background: var(--field-bg, #fff);
  flex-wrap: wrap;
}
.history-star { font-size: 13px; color: var(--accent); }
.history-name { font-size: 14px; flex: 1; min-width: 140px; color: var(--ink); overflow-wrap: anywhere; }
.history-note { font-size: 11px; color: var(--ink-soft); max-width: 200px; overflow-wrap: anywhere; }
.history-time { font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.history-empty { font-size: 13px; color: var(--ink-soft); text-align: center; padding: 16px; }
[data-theme="dark"] .history-row { background: var(--field-bg); }

/* ---------- 已连接设备 ---------- */
.devices-list { display: grid; gap: 8px; max-height: 50vh; overflow-y: auto; }

.device-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid var(--line-soft);
  background: var(--field-bg, #fff);
}
.device-icon { font-size: 18px; }
.device-info { flex: 1; min-width: 0; }
.device-name { font-size: 14px; color: var(--ink); }
.device-time { font-size: 11px; color: var(--ink-soft); }
.device-self {
  font-size: 11px;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--line);
  padding: 1px 6px;
}
.devices-empty { font-size: 13px; color: var(--ink-soft); text-align: center; padding: 12px; }

/* ---------- 深色模式 ---------- */
[data-theme="dark"] {
  --paper: #241e16;
  --panel: #322a21;
  --panel-dim: #3c3328;
  --wood: #7d6142;
  --wood-light: #5c4a35;
  --line: #14100a;
  --line-soft: #4d4234;
  --ink: #e8ddc6;
  --ink-soft: #a3927a;
  --field-bg: #262019;
}

[data-theme="dark"] body {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
}

[data-theme="dark"] .meta-input,
[data-theme="dark"] .ddl-input,
[data-theme="dark"] .note-input:focus,
[data-theme="dark"] .task-name:focus,
[data-theme="dark"] .sv-input,
[data-theme="dark"] .detail-textarea,
[data-theme="dark"] .detail-view,
[data-theme="dark"] .priority-select,
[data-theme="dark"] .dcheck {
  background: var(--field-bg);
  color: var(--ink);
}
[data-theme="dark"] .priority-select.priority-P1,
[data-theme="dark"] .priority-select.priority-P2,
[data-theme="dark"] .priority-select.priority-P3 { color: #fff; }
[data-theme="dark"] .priority-select.priority-P1 { background: #c0504a; }
[data-theme="dark"] .priority-select.priority-P2 { background: #d4a017; }
[data-theme="dark"] .priority-select.priority-P3 { background: #5b84a8; }
[data-theme="dark"] .dcheck.checked { background: var(--green); }
[data-theme="dark"] .status-select option { color: var(--ink); background: var(--panel); }
[data-theme="dark"] .meta-input::placeholder,
[data-theme="dark"] .note-input::placeholder { color: #6e604d; }
[data-theme="dark"] .sv-btn { color: var(--ink); }
[data-theme="dark"] .sv-btn-gold { color: #2a2115; }
[data-theme="dark"] .sv-btn-danger { color: #fff; }
[data-theme="dark"] .business,
[data-theme="dark"] .prio-section,
[data-theme="dark"] .done-group,
[data-theme="dark"] .empty-card,
[data-theme="dark"] .prio-empty {
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .sv-btn,
[data-theme="dark"] .tab-btn { box-shadow: inset 0 2px 0 rgba(255,255,255,0.06), 0 3px 0 rgba(0,0,0,0.4); }
[data-theme="dark"] .business-title,
[data-theme="dark"] .done-group-header,
[data-theme="dark"] .prio-header { color: #f3ead6; }
[data-theme="dark"] .tab-btn { color: var(--ink-soft); }
[data-theme="dark"] .tab-btn.active { background: var(--wood); color: #f3ead6; }
[data-theme="dark"] .badge { background: var(--wood); color: #f3ead6; }
[data-theme="dark"] .tab-btn.active .badge { background: var(--line); color: var(--accent); }
[data-theme="dark"] .footer { color: var(--ink-soft); }
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.65); }
[data-theme="dark"] .device-row { background: var(--field-bg); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .business-meta { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 700px) {
  /* 窄屏回退为纵向堆叠，避免手机上横向滚动 */
  .projects { flex-direction: column; overflow-x: visible; }
  .project { flex: 1 1 auto; width: 100%; }
  .add-project-btn { min-height: 0; }
}

@media (max-width: 520px) {
  .topbar-inner { gap: 10px; }
  .topbar-actions { margin-left: 0; }
  .meta-row { grid-template-columns: 84px 1fr; }
}
