/** personal-workbench: styles */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --line: #e5e7eb;
  --line-soft: #eef0f3;
  --text: #171a1f;
  --text-2: #4b5563;
  --muted: #8b93a1;
  --accent: #2f6fed;
  --accent-soft: #eaf1fe;
  --accent-line: #c9dcfd;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lift: 0 4px 14px rgba(16, 24, 40, .08);

  --s-none-fg: #6b7280;   --s-none-bg: #f2f4f7;   --s-none-line: #e3e6ea;
  --s-run-fg: #2f6fed;    --s-run-bg: #eaf1fe;    --s-run-line: #c9dcfd;
  --s-done-fg: #0f7a52;   --s-done-bg: #e6f5ee;   --s-done-line: #bfe6d4;
  --s-lag-fg: #c2410c;    --s-lag-bg: #fdeee6;    --s-lag-line: #f6d2bd;
  --s-skip-fg: #8b93a1;   --s-skip-bg: #f2f4f7;   --s-skip-line: #e3e6ea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --surface: #1b1e23;
    --surface-2: #20242a;
    --line: #2c3138;
    --line-soft: #262a30;
    --text: #e9ebee;
    --text-2: #b6bcc6;
    --muted: #868f9c;
    --accent: #6f9dff;
    --accent-soft: #1e2a41;
    --accent-line: #31456b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lift: 0 6px 18px rgba(0, 0, 0, .4);

    --s-none-fg: #a2a9b4;   --s-none-bg: #23272d;   --s-none-line: #31363d;
    --s-run-fg: #8fb4ff;    --s-run-bg: #1e2a41;    --s-run-line: #31456b;
    --s-done-fg: #5fd0a0;   --s-done-bg: #14291f;   --s-done-line: #24523d;
    --s-lag-fg: #f0955f;    --s-lag-bg: #2e2016;    --s-lag-line: #5a3a24;
    --s-skip-fg: #868f9c;   --s-skip-bg: #23272d;   --s-skip-line: #31363d;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; font-size: inherit; cursor: pointer; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 1px 6px;
  word-break: break-all;
}

/* ------------------------------- 登录 ------------------------------- */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 32px 26px 26px;
  text-align: center;
}
.login-mark {
  width: 46px; height: 46px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 5px solid var(--accent-soft);
  border-top-color: var(--accent);
  transform: rotate(-45deg);
}
.login-title { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: .02em; }
.login-sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-card input {
  width: 100%;
  padding: 11px 13px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.btn-primary {
  width: 100%;
  margin-top: 12px;
  padding: 11px 16px;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: .04em;
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.login-err {
  margin: 12px 0 0;
  color: var(--s-lag-fg);
  font-size: 13px;
  min-height: 18px;
}

/* ------------------------------ 顶栏 ------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark {
  width: 17px; height: 17px; flex: none;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  transform: rotate(-45deg);
}
.brand-text { font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
}
.chip-accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
.ghost-btn {
  padding: 5px 11px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  transition: border-color .15s, color .15s;
}
.ghost-btn:hover { border-color: var(--accent-line); color: var(--accent); }

/* ------------------------------ 页签 ------------------------------ */
.tabs {
  position: sticky;
  top: 53px;
  z-index: 19;
  display: flex;
  gap: 4px;
  padding: 8px 18px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  padding: 8px 14px 11px;
  color: var(--muted);
  background: none;
  border: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text-2); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ------------------------------ 布局 ------------------------------ */
.view { max-width: 880px; margin: 0 auto; padding: 18px 18px 64px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.card-tight { padding: 12px 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > .card { margin-bottom: 14px; }
@media (max-width: 660px) { .grid2 { grid-template-columns: 1fr; gap: 0; } }

.sec-title {
  margin: 22px 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
}
.sec-title:first-child { margin-top: 4px; }
.card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
}
.card p { margin: 0 0 8px; }
.card p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hr { height: 1px; background: var(--line-soft); margin: 14px 0; border: 0; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

/* ------------------------------ 今日 ------------------------------ */
.hero {
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 62%);
  border-color: var(--accent-line);
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-2);
}
.hero-date { font-weight: 600; color: var(--text); }
.hero-task {
  margin: 0 0 12px;
  font-size: 19px;
  line-height: 1.55;
  font-weight: 650;
  letter-spacing: .01em;
}
.hero-sub { font-size: 13.5px; color: var(--text-2); margin-bottom: 4px; }
.hero-sub strong { font-weight: 600; color: var(--text); }

/* ---------------------------- 状态按钮 ---------------------------- */
.status-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.status-row .lbl { font-size: 12.5px; color: var(--muted); margin-right: 2px; }
.st-btn {
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  transition: all .13s;
}
.st-btn:hover { border-color: var(--accent-line); }
.st-btn.on[data-s="not_started"] { background: var(--s-none-bg); border-color: var(--s-none-line); color: var(--s-none-fg); }
.st-btn.on[data-s="in_progress"] { background: var(--s-run-bg); border-color: var(--s-run-line); color: var(--s-run-fg); }
.st-btn.on[data-s="done"]        { background: var(--s-done-bg); border-color: var(--s-done-line); color: var(--s-done-fg); }
.st-btn.on[data-s="lagging"]     { background: var(--s-lag-bg); border-color: var(--s-lag-line); color: var(--s-lag-fg); }
.st-btn.on[data-s="skipped"]     { background: var(--s-skip-bg); border-color: var(--s-skip-line); color: var(--s-skip-fg); }
.st-btn[disabled] { cursor: default; opacity: .75; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.pill-p-not_started { background: var(--s-none-bg); border-color: var(--s-none-line); color: var(--s-none-fg); }
.pill-p-in_progress { background: var(--s-run-bg);  border-color: var(--s-run-line);  color: var(--s-run-fg); }
.pill-p-done        { background: var(--s-done-bg); border-color: var(--s-done-line); color: var(--s-done-fg); }
.pill-p-lagging     { background: var(--s-lag-bg);  border-color: var(--s-lag-line);  color: var(--s-lag-fg); }
.pill-p-skipped     { background: var(--s-skip-bg); border-color: var(--s-skip-line); color: var(--s-skip-fg); }
.pill-p-na          { background: var(--s-none-bg); border-color: var(--s-none-line); color: var(--s-none-fg); }

.pill-t { background: var(--surface-2); color: var(--muted); }
.pill-t::before { display: none; }

/* ------------------------------ 进度 ------------------------------ */
.prog { margin-bottom: 12px; }
.prog:last-child { margin-bottom: 0; }
.prog-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 5px;
}
.prog-head .k { color: var(--text-2); font-weight: 600; }
.prog-head .v { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar {
  height: 7px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .35s ease;
}
.bar.done > i { background: var(--s-done-fg); }
.bar.lag > i { background: var(--s-lag-fg); }

/* ---------------------------- 周计划 ---------------------------- */
.week {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.week-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.week-head:hover { background: var(--surface-2); }
.week-id {
  flex: none;
  width: 42px;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.week-main { flex: 1; min-width: 0; }
.week-dates { font-size: 12.5px; color: var(--muted); }
.week-task {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.week-right { flex: none; display: flex; align-items: center; gap: 10px; }
.week-pct { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.caret {
  width: 8px; height: 8px; flex: none;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .18s;
  margin-bottom: 3px;
}
.week.open .caret { transform: rotate(-135deg); margin-bottom: -3px; }
.week-body { display: none; border-top: 1px solid var(--line-soft); padding: 4px 16px 16px; }
.week.open .week-body { display: block; }

.kv { margin: 12px 0 0; }
.kv .k {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .03em;
  margin-bottom: 3px;
}
.kv .v { font-size: 13.5px; color: var(--text); }
.ul { margin: 0; padding-left: 18px; font-size: 13.5px; }
.ul li { margin: 2px 0; }

.day-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.day-row:first-of-type { border-top: none; }
.day-date {
  flex: none;
  width: 76px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
}
.day-body { flex: 1; min-width: 0; }
.day-task { font-size: 13.5px; margin-bottom: 3px; }
.day-extra { font-size: 12.5px; color: var(--muted); }
.day-task.dim { color: var(--muted); }
.day-row.is-today { background: var(--accent-soft); margin: 0 -10px; padding: 10px; border-radius: var(--radius-sm); }

/* ---------------------------- 里程碑 ---------------------------- */
.ms-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
}
.ms-row:first-of-type { border-top: none; }
.ms-date {
  flex: none;
  width: 92px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ms-body { flex: 1; min-width: 0; }
.ms-title { font-weight: 600; font-size: 14px; }
.ms-sub { font-size: 12.5px; color: var(--muted); }
.ms-cd { flex: none; text-align: right; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.ms-cd.soon { color: var(--s-lag-fg); }
.ms-cd.near { color: var(--accent); }
.ms-cd.past { color: var(--muted); font-weight: 500; }
.ms-row.is-past .ms-title { color: var(--muted); }

/* ------------------------------ 表格 ------------------------------ */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 8px 8px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl th { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.total td { font-weight: 700; border-top: 1px solid var(--line); }
.tbl .barcell { width: 92px; }
.tbl .barcell .bar { height: 6px; margin-top: 6px; }
.tbl-wrap { overflow-x: auto; }

/* ------------------------------ 折叠 ------------------------------ */
.acc { border-top: 1px solid var(--line-soft); }
.acc:first-child { border-top: none; }
.acc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 0;
  background: none;
  border: none;
  text-align: left;
  color: var(--text);
}
.acc-head:hover { color: var(--accent); }
.acc-id {
  flex: none;
  min-width: 34px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.acc-title { flex: 1; font-size: 13.5px; font-weight: 600; }
.acc-caret {
  flex: none;
  width: 7px; height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .18s;
}
.acc.open .acc-caret { transform: rotate(-135deg); }
.acc-body { display: none; padding: 0 0 14px 44px; }
.acc.open .acc-body { display: block; }
.acc-body .blk { margin-bottom: 8px; font-size: 13px; }
.acc-body .blk:last-child { margin-bottom: 0; }
.acc-body .blk .t { font-weight: 700; color: var(--muted); font-size: 12px; margin-bottom: 2px; }

/* ---------------------------- 数字卡 ---------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; }
.stat {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}
.stat .n { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .n .u { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ------------------------------ 其他 ------------------------------ */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: 88vw;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(23, 26, 31, .93);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-lift);
}
@media (prefers-color-scheme: dark) { .toast { background: rgba(240, 242, 245, .95); color: #12161c; } }
.toast.err { background: var(--s-lag-fg); color: #fff; }

.file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-row input[type=file] { font-size: 13px; max-width: 100%; }

@media (max-width: 560px) {
  .view { padding: 14px 12px 56px; }
  .topbar { padding: 10px 12px; }
  .tabs { padding: 6px 12px 0; top: 49px; }
  .brand-text { display: none; }
  .hero-task { font-size: 17px; }
  .day-date { width: 62px; font-size: 11.5px; }
  .acc-body { padding-left: 8px; }
  .ms-date { width: 76px; font-size: 11.5px; }
}

/* fix: author styles like .login-wrap{display:flex} override the UA rule [hidden]{display:none},
   which left the login block filling the first screen and pushed the app below the fold. */
[hidden] { display: none !important; }


body { display: flex; flex-direction: column; min-height: 100vh; }

/* site footer: ICP filing notice */
.site-foot { margin-top: auto; padding: 16px 18px 22px; text-align: center; font-size: 12.5px; line-height: 1.9; color: var(--muted); border-top: 1px solid var(--line-soft); }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--text-2); }
.site-foot img { height: 13px; width: auto; vertical-align: -2px; margin-right: 4px; }
.site-foot .sep { margin: 0 8px; color: var(--line); }
@media (max-width: 560px) { .site-foot { padding: 12px 12px 18px; font-size: 12px; } }
