/* 我的工作台 - 样式 */
:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2430;
  --text2: #6b7280;
  --text3: #9ca3af;
  --line: #e8eaf0;
  --primary: #4f6ef7;
  --primary-weak: #eef1fe;
  --danger: #e8536f;
  --ok: #10b981;
  --warn: #f59e0b;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(31, 36, 48, .06), 0 4px 16px rgba(31, 36, 48, .05);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}
.hidden { display: none !important; }
button { font-family: inherit; }

/* ---------- 登录 ---------- */
.auth-layer {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(160deg, #4f6ef7 0%, #7a5cf0 55%, #9d64ec 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  background: #fff; border-radius: 20px; padding: 36px 30px; width: 100%; max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); text-align: center;
}
.auth-logo { font-size: 44px; }
.auth-card h1 { margin: 8px 0 2px; font-size: 22px; }
.auth-sub { color: var(--text3); margin: 0 0 22px; font-size: 13px; }
.auth-card input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 15px; margin-bottom: 12px; outline: none; text-align: center;
}
.auth-card input:focus { border-color: var(--primary); }
.auth-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0 0; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
  padding: 18px 12px;
}
.brand { font-weight: 700; font-size: 17px; padding: 6px 12px 18px; }
#nav-side { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--text2); cursor: pointer; font-size: 14.5px; border: none; background: none; text-align: left;
}
.nav-item.active { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.nav-item:hover { background: #f2f4f9; }
.sidebar-foot { padding: 12px; font-size: 12px; color: var(--text3); display: flex; align-items: center; gap: 6px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.sync-dot.off { background: var(--danger); }

.main { flex: 1; margin-left: 220px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(245,246,250,.92); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 19px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.view { padding: 20px 22px 90px; max-width: 980px; width: 100%; margin: 0 auto; }

/* 底部 Tab（手机） */
.tabbar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar .nav-item { flex-direction: column; gap: 2px; flex: 1; align-items: center; font-size: 11px; padding: 6px 2px; border-radius: 10px; }
.tabbar .nav-icon { font-size: 20px; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 15.5px; }
.card h3 .sub { font-weight: 400; color: var(--text3); font-size: 12.5px; margin-left: 6px; }
.quick-add-bar { display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 10px; margin-bottom: 16px; }
.quick-add-bar input { border: none; background: transparent; font-size: 14px; outline: none; }
.quick-add-bar select { font-size: 12.5px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.quick-add-bar .btn.sm { padding: 4px 14px; font-size: 16px; line-height: 1; }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 10px; font-size: 14px; cursor: pointer;
}
.btn:hover { background: #f6f7fa; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #3d5bee; }
.btn.danger { color: var(--danger); border-color: #f5c8d1; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text2); }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=week], input[type=month], select, textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 14.5px; font-family: inherit; outline: none; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 74px; }
label.field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--text2); }
label.field > span { display: block; margin-bottom: 5px; font-weight: 600; color: var(--text); font-size: 13.5px; }
.row { display: flex; gap: 12px; } .row > * { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; background: #f2f4f9; color: var(--text2); white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.tag-mini { font-size: 11px; padding: 1px 8px; border-radius: 999px; color: #fff; white-space: nowrap; }

/* todo 列表 */
.todo-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line); margin-bottom: 8px; background: #fff;
}
.todo-item.done { opacity: .58; }
.todo-item.done .todo-title { text-decoration: line-through; }
.todo-check {
  width: 21px; height: 21px; min-width: 21px; border-radius: 7px; border: 2px solid #c6cbd8;
  background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; margin-top: 2px;
}
.todo-check.checked { background: var(--ok); border-color: var(--ok); }
.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: 14.5px; word-break: break-word; }
.todo-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; align-items: center; }
.todo-actions { display: flex; gap: 2px; opacity: .35; }
.todo-item:hover .todo-actions { opacity: 1; }

/* 统计块 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { font-size: 12.5px; color: var(--text2); }

/* 进度条 */
.progress { height: 8px; background: #edeef4; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }

/* 项目卡片 */
.proj-card { cursor: pointer; transition: transform .12s; }
.proj-card:hover { transform: translateY(-2px); }
.proj-status { font-size: 11px; padding: 2px 9px; border-radius: 999px; color: #fff; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }

/* 表格 */
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th { text-align: left; color: var(--text3); font-weight: 500; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
table.tb td { padding: 8px; border-bottom: 1px solid #f2f3f7; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 60; background: rgba(20, 24, 36, .42);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
}
@media (min-width: 700px) {
  .modal-mask { align-items: center; padding: 24px; }
  .modal { border-radius: 18px; }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 16.5px; }

/* toast */
.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 90;
  background: rgba(31,36,48,.92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; max-width: 86vw; text-align: center;
}

/* ---------- 日历 ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head .cal-title { font-weight: 700; font-size: 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wk { text-align: center; font-size: 11.5px; color: var(--text3); padding: 4px 0; }
.cal-cell {
  min-height: 54px; border-radius: 10px; padding: 4px 5px; cursor: pointer; border: 1.5px solid transparent;
  display: flex; flex-direction: column; gap: 2px; background: #fafbfd;
}
.cal-cell:hover { background: #f0f2f8; }
.cal-cell.dim { opacity: .38; }
.cal-cell.sel { border-color: var(--primary); background: var(--primary-weak); }
.cal-cell.today .cal-num { color: #fff; background: var(--primary); }
.cal-num { font-size: 12.5px; font-weight: 600; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 2px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; }

/* ---------- 时间轴（时间块） ---------- */
.tl-item { display: flex; gap: 12px; padding: 8px 4px; border-bottom: 1px dashed var(--line); align-items: flex-start; }
.tl-item:last-child { border-bottom: none; }
.tl-time { width: 92px; min-width: 92px; text-align: right; }
.tl-time .t1 { font-weight: 700; font-size: 14px; }
.tl-time .t2 { font-size: 11px; color: var(--text3); }
.tl-bar { width: 4px; min-width: 4px; border-radius: 999px; align-self: stretch; }
.tl-done .tl-title { text-decoration: line-through; opacity: .6; }
.tl-title { font-size: 14.5px; }

/* ---------- 日历式时间轴（刻度尺 + 时间块） ---------- */
.tlc { position: relative; display: flex; margin-top: 6px; }
.tlc-ruler { width: 46px; min-width: 46px; position: relative; }
.tlc-hour { position: absolute; right: 8px; font-size: 11px; color: var(--text3); font-variant-numeric: tabular-nums; }
.tlc-body { position: relative; flex: 1; border-left: 1px solid var(--line); }
.tlc-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); opacity: .55; }
.tlc-block { position: absolute; background: var(--card2, #f1f3f9); border-radius: 8px; padding: 5px 8px; overflow: hidden; cursor: pointer; transition: filter .15s; }
.tlc-block:hover { filter: brightness(.96); }
.tlc-block .tlc-title { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.tlc-block .tlc-meta { font-size: 11px; color: var(--text3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.tlc-block .tlc-btns { margin-top: 4px; }
.tlc-block.done { opacity: .55; }
.tlc-block.done .tlc-title { text-decoration: line-through; }
.tlc-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--danger); z-index: 3; }
.tlc-now i { position: absolute; left: -5px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.tlc-now span { position: absolute; right: 2px; top: -8px; font-size: 10px; color: var(--danger); font-weight: 700; }
.tlc-empty { position: absolute; left: 12px; right: 12px; font-size: 12.5px; color: var(--text3); background: var(--primary-weak); border: 1px dashed #c3cdfa; border-radius: 8px; padding: 8px 12px; z-index: 1; }

/* ---------- 灵感 ---------- */
.idea-preview { font-size: 13.5px; color: var(--text2); white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: hidden; position: relative; }
.idea-preview::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 34px; background: linear-gradient(transparent, var(--card)); }
.idea-refined { font-size: 13.5px; margin-top: 8px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 12px; white-space: pre-wrap; word-break: break-word; }
.btn.danger-ghost { border-color: transparent; background: transparent; color: var(--danger); }

/* 报表 tabs */
.rep-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.rep-tabs .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.section-title { font-size: 14px; font-weight: 700; margin: 18px 0 10px; color: var(--text); display: flex; align-items: center; justify-content: space-between; }
.empty { color: var(--text3); text-align: center; padding: 26px 10px; font-size: 13.5px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; font-size: 12.5px; }
.bar-row .bar-lbl { width: 110px; min-width: 110px; text-align: right; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-track { flex: 1; background: #edeef4; border-radius: 999px; height: 16px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; border-radius: 999px; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; min-width: 20px; }
.bar-row .bar-num { width: 34px; color: var(--text3); }

/* 手机适配 */
@media (max-width: 899px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .tabbar { display: flex; }
  .view { padding: 14px 14px 96px; }
  .topbar { padding: 12px 16px; }
  .row { flex-direction: column; gap: 0; }
  .proj-grid { grid-template-columns: 1fr; }
}
