/* ==================== 待办日程系统 样式 ==================== */

:root {
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --primary-light: #e3f2fd;
  --success: #2e7d32;
  --warning: #f9a825;
  --danger: #c62828;
  --bg: #f4f6f9;
  --card: #fff;
  --border: #e3e8ef;
  --text: #1f2937;
  --text1: #1f2937;
  --text2: #6b7280;
  --text3: #9ca3af;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.14);
}

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

/* ==================== 顶部菜单栏 ==================== */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  overflow-x: auto;
  min-height: 52px;
  box-shadow: var(--shadow-sm);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs { -ms-overflow-style: none; scrollbar-width: none; }

.tab {
  position: relative;
  padding: 15px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  white-space: nowrap;
  transition: color .2s, background .2s;
}
.tab:hover { color: var(--primary); background: var(--primary-light); }
.tab.on { color: var(--primary); font-weight: 600; }
.tab.on::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

/* 待办数量徽标 */
.tabs .project-badge {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 999px;
  padding: 4px 12px;
  align-self: center;
  white-space: nowrap;
}

/* 新建按钮（菜单栏最左侧） */
.tabs .btn-new {
  align-self: center;
  margin-right: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, transform .1s;
}
.tabs .btn-new:hover { background: var(--primary-dark); }
.tabs .btn-new:active { transform: translateY(1px); }

/* Exchange 来源标签 */
.task-card-tag.exchange {
  background: #efe9ff;
  color: #7b61ff;
  border: 1px solid #d9ccff;
}
.ex-status {
  margin-left: 10px;
  font-size: 13px;
  color: var(--text2);
}
/* ============ 设置页：Exchange 表单 ============ */
.sec-title {
  margin: 20px 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text1);
}
.sec-desc {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 16px;
}
.exchange-form {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.exchange-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.exchange-form .form-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text1);
}
.exchange-form .form-row input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.exchange-form .form-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}

/* 启用开关（switch） */
.exchange-form .switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.exchange-form .switch-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text1);
}
.exchange-form .switch-text small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text3);
}
.exchange-form .switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
}
.exchange-form .switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.exchange-form .switch .slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  transition: background .2s;
}
.exchange-form .switch .slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s;
}
.exchange-form .switch input:checked + .slider {
  background: var(--primary);
}
.exchange-form .switch input:checked + .slider::before {
  transform: translateX(20px);
}
.exchange-form .switch input:focus-visible + .slider {
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.25);
}

/* ==================== 面板 ==================== */
.pane { display: none; }
.pane.on { display: block; }

/* ==================== 工具栏 ==================== */
.board-toolbar {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-label {
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
}
.filter-group select,
.list-toolbar select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.filter-group select:focus,
.list-toolbar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}
.list-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ==================== 四象限看板 ==================== */
.quadrant-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 500px;
  padding-bottom:50px;
}

.quadrant {
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 250px;
  box-shadow: var(--shadow-sm);
}

.quadrant.q1 { background: #fff5f5; border: 1px solid #ffcdd2; }
.quadrant.q2 { background: #fffde7; border: 1px solid #ffe082; }
.quadrant.q3 { background: #fff3e0; border: 1px solid #ffcc80; }
.quadrant.q4 { background: #f1f8e9; border: 1px solid #c5e1a5; }

.quadrant-header {
  padding: 3px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.quadrant.q1 .quadrant-header { background: #ffebee; }
.quadrant.q2 .quadrant-header { background: #fff9c4; }
.quadrant.q3 .quadrant-header { background: #ffe0b2; }
.quadrant.q4 .quadrant-header { background: #dcedc8; }

.quadrant-icon { font-size: 20px; }
.quadrant-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
}
.quadrant-sub {
  font-size: 12px;
  color: #666;
  margin-left: auto;
}
.quadrant-count {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}
.q1 .quadrant-count { background: #ef5350; }
.q2 .quadrant-count { background: #fbc02d; }
.q3 .quadrant-count { background: #fb8c00; }
.q4 .quadrant-count { background: #7cb342; }

.quadrant-body {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
}

/* ==================== 任务卡片 ==================== */
.task-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  border-left: 4px solid transparent;
}
.task-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}
.task-card.completed { opacity: 0.55; }
.task-card.completed .task-card-title { text-decoration: line-through; }

.q1 .task-card { border-left-color: #e53935; }
.q2 .task-card { border-left-color: #fbc02d; }
.q3 .task-card { border-left-color: #fb8c00; }
.q4 .task-card { border-left-color: #7cb342; }

.task-card-row { display: flex; align-items: flex-start; gap: 8px; }
.task-card-check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 1px;
  padding: 0;
  border: 2px solid var(--primary);
  border-radius: 50%;
  background: #fff;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.task-card-check.done {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.task-card-body { flex: 1; min-width: 0; }
.task-card-headline {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.task-card-title {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.task-card-note {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-card-topmeta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.task-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.task-card-tag.work { background: #e3f2fd; color: #1565c0; }
/* 工作分类直接显示完整工程名（不再截断长度） */
.task-card-tag.proj {
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: 600;
}
.task-card-tag.life { background: #f3e5f5; color: #7b1fa2; }
.task-card-tag.due { background: #fce4ec; color: #c62828; }
.task-card-tag.due.overdue { background: #e53935; color: #fff; }
.task-card-tag.remind { background: #e8f5e9; color: #2e7d32; }

.task-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-self: flex-start;
  margin-left: auto;
}

/* 空状态 */
.quadrant-empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--text3);
  font-size: 13px;
}

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
.btn-pri { background: var(--primary); color: #fff; }
.btn-pri:hover { background: var(--primary-dark); }
.btn-ok { background: var(--success); color: #fff; }
.btn-ok:hover { background: #1b5e20; }
.btn-err { background: var(--danger); color: #fff; }
.btn-err:hover { background: #b71c1c; }
.btn-out { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-out:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 6px;
}
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ==================== 表单 ==================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form-grid .grp { display: flex; flex-direction: column; gap: 5px; }
.form-grid .grp.full { grid-column: 1 / -1; }
.form-grid .grp label {
  display: block;
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}
.form-grid .grp input,
.form-grid .grp textarea,
.form-grid .grp select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.form-grid .grp input:focus,
.form-grid .grp textarea:focus,
.form-grid .grp select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}
.form-grid .grp textarea { resize: vertical; }
/* select 之前没进上面那条规则，一直是浏览器默认样式（矮、字号小） */
.form-grid .grp select {
  height: 40px;
  padding: 8px 12px;
  background: #fff;
  cursor: pointer;
  line-height: 1.4;
}
/* 关联工程：工程名普遍较长，单独再抬高一点 */
#f-project {
  height: 46px;
  font-size: 15px;
  padding: 10px 12px;
}

.radio-group,
.checkbox-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chk-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
}
.chk-item:hover { border-color: var(--primary); color: var(--primary); }
.chk-item input { margin: 0; cursor: pointer; accent-color: var(--primary); }
.chk-item:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.remind-row {
  display: flex;
  gap: 8px;
}
.remind-row select {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.remind-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}

.req { color: #e53935; }

/* ==================== 搜索输入 & 表格 ==================== */
.search-input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  min-width: 220px;
  transition: border-color .2s, box-shadow .2s;
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}

.tbl-wrap {
  overflow: auto;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 5px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
thead th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text2);
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: center;
  border-bottom: 2px solid var(--border);
}
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--primary-light); }

/* 可排序表头：点击整列排序，箭头指示当前方向 */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.sort-ind {
  font-size: 10px;
  color: var(--primary);
  margin-left: 2px;
}

#tbl-list td.col-proj { font-size: 12px; color: var(--text2); }
#tbl-list tr.overdue { background: #fff5f5; }
#tbl-list tr.completed-row { opacity: 0.55; }
#tbl-list tr.completed-row td { text-decoration: line-through; }

.status-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.status-tag.pending { background: #fff3e0; color: #e65100; }
.status-tag.completed { background: #e8f5e9; color: #2e7d32; }

/* ==================== 对话框 ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 200;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal.on { display: flex; animation: modalFade .2s ease; }
@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.mdl {
  background: #fff;
  border-radius: 14px;
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-md);
}
.modal.on .mdl { animation: mdlIn .24s cubic-bezier(.16, 1, .3, 1); }
@keyframes mdlIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.mdl h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.mdl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.mdl-head h3 { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.mdl-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text3);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  transition: all .15s;
}
.mdl-close:hover { background: #f1f5f9; color: var(--text); }
.mdl-foot {
  margin-top: 20px;
  justify-content: flex-end;
}

/* ==================== 详情对话框内容 ==================== */
.detail-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
  line-height: 1.4;
}
.detail-quadrant-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
}
.detail-quadrant-tag.q1 { background: #ffebee; color: #c62828; }
.detail-quadrant-tag.q2 { background: #fff9c4; color: #f57f17; }
.detail-quadrant-tag.q3 { background: #ffe0b2; color: #e65100; }
.detail-quadrant-tag.q4 { background: #dcedc8; color: #33691e; }

.detail-section {
  margin-bottom: 16px;
}
.detail-label {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 4px;
  font-weight: 500;
  letter-spacing: .3px;
}
.detail-value {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.5;
}
.detail-note {
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

/* ==================== Toast 提示 ==================== */
.toast {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 300;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: toastIn .25s ease;
  max-width: 88vw;
  white-space: nowrap;
}
.toast.ok { background: rgba(46, 125, 50, 0.95); }
.toast.warn { background: rgba(230, 81, 0, 0.95); }
.toast.info { background: rgba(21, 101, 192, 0.95); }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -10px); }
}

/* ==================== 我的项目 ==================== */
.proj-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.proj-toolbar h2 { margin: 0; }

/* 项目表整体风格：参考 tldb 的 #tbl-wire —— 紧凑 12px 字号 + 全边框 + sticky 表头 */
#p-project .tbl-wrap { max-height: 70vh; }
#tbl-project { font-size: 12px; }
#tbl-project th,
#tbl-project td {
  padding: 4px 6px;
  border: 1px solid var(--border);
}
/* 每行内容垂直居中：序号(纯文本) / input / textarea / 操作按钮 统一按行的垂直中点对齐 */
#tbl-project td,
#project-body td { vertical-align: middle; }
#tbl-project thead th {
  background: #f5f5f5;
  color: var(--text);
  font-weight: 600;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}
#tbl-project .cell-input,
#tbl-project .cell-area {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
#tbl-project .cell-area {
  display: block;          /* 块级化：消除 inline-block 基线间隙，配合 td 垂直居中更精确 */
  min-height: 46px;
  resize: vertical;
  line-height: 1.5;
}
#tbl-project .cell-input:focus,
#tbl-project .cell-area:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}
#tbl-project tbody tr:hover td { background: #eef5fb; }

/* 表单辅助提示 */
.grp-hint {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
}
.sec-desc b { color: var(--primary); }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .tabs { padding: 0 12px; }
  .tab { padding: 14px 14px; }
  .quadrant-board { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
