:root {
  /* 背景 */
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #f0f4fa;

  --text: #1f2430;
  --text-2: #5a6270;
  --text-3: #9096a6;
  --line: #e8ecf4;

  /* 主色 */
  --brand: #4f6cf7;
  --brand-soft: #eef2ff;
  --brand-light: #dbe3ff;

  /* 导航彩色 */
  --nav-blue: #4f6cf7;
  --nav-blue-soft: #eef2ff;
  --nav-red: #f45c6d;
  --nav-red-soft: #fff0f2;
  --nav-pink: #ec6fae;
  --nav-pink-soft: #fff0f8;
  --nav-yellow: #f5a623;
  --nav-yellow-soft: #fff7e8;
  --nav-green: #3abf7c;
  --nav-green-soft: #e9f9f0;
  --nav-purple: #8b6cf7;
  --nav-purple-soft: #f2efff;

  /* 涨跌 */
  --red: #ef4848;
  --green: #1aad6b;
  --yellow: #f5a623;

  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --nav-w: 210px;
  --nav-w-mobile: 68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  overflow: hidden;
}

#app { position: relative; height: 100vh; height: 100dvh; }

/* =========================================================
   左侧导航 —— 彩色图标风格
   ========================================================= */
#nav {
  position: fixed;
  left: 16px; top: 16px; bottom: 16px;
  width: var(--nav-w);
  background: var(--surface);
  border-radius: 26px;
  box-shadow: 0 18px 50px rgba(31, 36, 48, .10);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 6px;
  z-index: 50;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 18px;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.brand-text { font-weight: 800; font-size: 16px; letter-spacing: .3px; color: var(--text); }

.nav-menu { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 11px; border: none; background: transparent;
  border-radius: 16px; color: var(--text-2);
  font-size: 14px; cursor: pointer; text-align: left; transition: .18s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item .nav-ico-wrap {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); transition: .18s;
}
.nav-item .nav-ico { width: 20px; height: 20px; fill: currentColor; }

/* 彩色 */
.nav-item[data-color="blue"] .nav-ico-wrap { color: var(--nav-blue); background: var(--nav-blue-soft); }
.nav-item[data-color="red"] .nav-ico-wrap { color: var(--nav-red); background: var(--nav-red-soft); }
.nav-item[data-color="pink"] .nav-ico-wrap { color: var(--nav-pink); background: var(--nav-pink-soft); }
.nav-item[data-color="yellow"] .nav-ico-wrap { color: var(--nav-yellow); background: var(--nav-yellow-soft); }
.nav-item[data-color="green"] .nav-ico-wrap { color: var(--nav-green); background: var(--nav-green-soft); }
.nav-item[data-color="purple"] .nav-ico-wrap { color: var(--nav-purple); background: var(--nav-purple-soft); }

.nav-item.active {
  background: var(--surface-2); color: var(--text); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--brand);
}
.nav-item.active .nav-ico-wrap { transform: scale(1.05); }
.nav-item.active[data-color="blue"] { box-shadow: inset 3px 0 0 var(--nav-blue); }
.nav-item.active[data-color="red"] { box-shadow: inset 3px 0 0 var(--nav-red); }
.nav-item.active[data-color="pink"] { box-shadow: inset 3px 0 0 var(--nav-pink); }
.nav-item.active[data-color="yellow"] { box-shadow: inset 3px 0 0 var(--nav-yellow); }
.nav-item.active[data-color="green"] { box-shadow: inset 3px 0 0 var(--nav-green); }
.nav-item.active[data-color="purple"] { box-shadow: inset 3px 0 0 var(--nav-purple); }

.nav-settings {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 13px; border: none; background: transparent;
  border-radius: 14px; color: var(--text-3); cursor: pointer; font-size: 13px; transition: .18s;
}
.nav-settings:hover { background: var(--surface-2); color: var(--text-2); }

/* =========================================================
   主内容区
   ========================================================= */
#content {
  margin-left: calc(var(--nav-w) + 32px);
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px 6px;
}
#pageTitle { font-size: 22px; font-weight: 800; margin: 0; flex: 1; color: var(--text); letter-spacing: .3px; }
.clock { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-toggle { display: none; }
.top-right { display: flex; align-items: center; gap: 10px; }
.sync-pill {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
  white-space: nowrap; font-weight: 600;
}
.sync-pill.pill-ok { color: var(--green); background: #e9f9f0; border-color: #c8f0da; }
.sync-pill.pill-sync { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-light); }
.sync-pill.pill-err { color: var(--red); background: #fff0f0; border-color: #f9d2d2; }
#accountBtn {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--line);
  cursor: pointer; font-weight: 600;
}
#accountBtn:hover { background: var(--surface-2); }

.page-root { flex: 1; overflow-y: auto; padding: 10px 24px 40px; -webkit-overflow-scrolling: touch; }
.page-root::-webkit-scrollbar { width: 8px; }
.page-root::-webkit-scrollbar-thumb { background: #dfe3ea; border-radius: 8px; }

/* =========================================================
   卡片
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 4px 18px rgba(31, 36, 48, .04);
  margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 800; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.card-sub { font-size: 12px; color: var(--text-3); font-weight: 500; }
.src-tag { font-size: 12px; color: var(--text-3); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.live-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(26,173,107,.18); }
.live-dot.off { background: #b9bfca; }
.live-dot.wait { background: var(--yellow); animation: liveblink 1s infinite; }
@keyframes liveblink { 50% { opacity: .3; } }

/* =========================================================
   统计卡片 / 指标
   ========================================================= */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  transition: .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(31,36,48,.06); }
.stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-unit { font-size: 12px; color: var(--text-3); margin-left: 2px; }

/* =========================================================
   表单控件
   ========================================================= */
.btn {
  border: none; border-radius: var(--radius-xs); padding: 11px 16px; font-size: 14px;
  cursor: pointer; background: var(--brand); color: #fff; font-weight: 700; transition: .15s;
  box-shadow: 0 4px 12px rgba(79,108,247,.28);
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 8px 13px; font-size: 13px; border-radius: 10px; }
.btn.xs { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.danger { background: var(--red); box-shadow: 0 4px 12px rgba(239,72,72,.25); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .textarea, select.input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-xs);
  padding: 11px 14px; font-size: 14px; background: var(--surface-2); color: var(--text);
  font-family: inherit; outline: none; transition: .15s;
}
.input:focus, .textarea:focus, select.input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-3); font-size: 13px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 999px; font-size: 12px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
  cursor: pointer; user-select: none; font-weight: 600;
}
.tag:hover { background: var(--surface-3); }
.tag.active { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 3px 10px rgba(79,108,247,.25); }
.tag.removable::after { content: "×"; margin-left: 2px; font-weight: 700; }
.tag.hot { background: #fff0e8; color: #d46b1b; border-color: transparent; }
.tag.done { background: #e9f9f0; color: var(--green); border-color: transparent; }

/* 优先级底色 */
.pri-high { background: #fff0f0 !important; border-color: #f9d2d2 !important; }
.pri-mid  { background: #fff7e8 !important; border-color: #f8e5c2 !important; }
.pri-low  { background: var(--surface-2) !important; border-color: var(--line) !important; }

/* =========================================================
   进度
   ========================================================= */
.progress-wrap { display: flex; align-items: center; gap: 14px; }
.progress-bar { flex: 1; height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #7d97fb, var(--brand)); border-radius: 999px; transition: width .3s; }
.progress-text { font-size: 14px; font-weight: 700; color: var(--text-2); white-space: nowrap; }

/* 待办项 */
.todo { display: flex; align-items: center; gap: 12px; padding: 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); margin-bottom: 10px; background: var(--surface); transition: .15s; }
.todo:hover { box-shadow: 0 4px 14px rgba(31,36,48,.05); }
.todo.done { opacity: .55; }
.todo.done .todo-name { text-decoration: line-through; color: var(--text-3); }
.todo .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.checkbox { width: 24px; height: 24px; border-radius: 8px; border: 2px solid #d7dbe2; flex: 0 0 24px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .15s; background: var(--surface-2); }
.checkbox.on { background: var(--brand); border-color: var(--brand); }
.checkbox.on svg { display: block; }
.checkbox svg { display: none; width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; }
.todo-name { flex: 1; font-size: 14px; font-weight: 600; }
.icon-btn { border: none; background: transparent; color: var(--text-3); cursor: pointer; padding: 5px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-3); color: var(--red); }
.star { color: var(--text-3); cursor: pointer; font-size: 16px; transition: .15s; }
.star.on { color: var(--yellow); }

/* 网格 */
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .grid.c3 { grid-template-columns: 1fr; } .grid.c2 { grid-template-columns: 1fr; } }

/* 金融行情 */
.quote-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.quote-row:last-child { border-bottom: none; }
.up { color: var(--red); }
.down { color: var(--green); }

/* 列表空态 */
.empty { text-align: center; color: var(--text-3); padding: 32px 0; font-size: 14px; }

/* 筛选栏 */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-bar .input { width: auto; min-width: 120px; flex: 1; }

/* =========================================================
   弹窗
   ========================================================= */
.modal-mask { position: fixed; inset: 0; background: rgba(28,32,40,.32); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto; padding: 22px; box-shadow: 0 20px 60px rgba(31,36,48,.18); }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.modal .field { margin-bottom: 12px; }
.modal label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }

/* Toast */
.toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: rgba(42,47,55,.9); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; animation: pop .25s ease; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 提醒弹窗 */
.notify-root { position: fixed; top: 0; right: 0; z-index: 300; padding: 16px; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.notify { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 14px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(31,36,48,.12); animation: slidein .3s ease; }
.notify.warn { border-left-color: var(--yellow); }
.notify h4 { margin: 0 0 6px; font-size: 15px; }
.notify p { margin: 0 0 10px; font-size: 13px; color: var(--text-2); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* 计时器 */
.timer { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; letter-spacing: 1px; color: var(--text); }

.demo-badge { font-size: 11px; background: #fff7e8; color: #9a6b1f; padding: 2px 8px; border-radius: 6px; }

/* =========================================================
   移动端
   ========================================================= */
@media (max-width: 760px) {
  :root { --nav-w: var(--nav-w-mobile); }
  #nav {
    left: 10px; top: 10px; bottom: 10px; padding: 14px 6px;
    align-items: center; border-radius: 22px; gap: 8px;
    box-shadow: 0 14px 40px rgba(31,36,48,.12);
  }
  .brand-text { display: none; }
  .nav-item {
    flex-direction: column; gap: 4px;
    justify-content: center; padding: 9px 2px;
    font-size: 11px; text-align: center;
  }
  .nav-item .nav-ico-wrap { width: 36px; height: 36px; border-radius: 12px; }
  .nav-item .nav-ico { width: 18px; height: 18px; }
  .nav-brand { justify-content: center; padding: 2px 0 10px; }
  .nav-settings {
    flex-direction: column; gap: 3px;
    justify-content: center; font-size: 10px; padding: 10px 2px;
  }
  .nav-settings .nav-ico { width: 18px; height: 18px; }
  #content { margin-left: calc(var(--nav-w) + 18px); }
  .page-root { padding: 6px 14px 32px; }
  #topbar { padding: 14px 14px 6px; }
  #pageTitle { font-size: 19px; }
  .stat-value { font-size: 20px; }
}

@media (max-width: 420px) {
  :root { --nav-w: 78px; --nav-w-mobile: 78px; }
  #nav { left: 8px; top: 8px; bottom: 8px; padding: 12px 4px; border-radius: 18px; }
  .nav-item { padding: 8px 1px; font-size: 10px; }
  .nav-item .nav-ico-wrap { width: 32px; height: 32px; border-radius: 10px; }
  .nav-item .nav-ico { width: 16px; height: 16px; }
  .nav-settings { font-size: 9px; padding: 8px 1px; }
  #content { margin-left: calc(var(--nav-w) + 14px); }
  .page-root { padding: 4px 12px 28px; }
}

/* ---------- 登录 / 云端同步 ---------- */
.hidden { display: none !important; }
.login-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(243,246,251,.7); backdrop-filter: blur(8px); padding: 20px; }
.login-card { width: 100%; max-width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(31,36,48,.16); padding: 24px 22px; }
.login-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); justify-content: center; }
.login-tip { font-size: 12.5px; color: var(--text-2); text-align: center; margin: 10px 0 16px; }
.login-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.ltab { flex: 1; padding: 10px 0; border-radius: var(--radius-xs); border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 14px; cursor: pointer; font-weight: 600; }
.ltab.active { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 3px 10px rgba(79,108,247,.25); }
.inp { width: 100%; box-sizing: border-box; padding: 12px 14px; margin-bottom: 10px; border-radius: var(--radius-xs); border: 1px solid var(--line); background: var(--surface-2); font-size: 15px; color: var(--text); outline: none; }
.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.btn-primary { width: 100%; padding: 13px; border-radius: var(--radius-xs); border: none; background: var(--brand); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(79,108,247,.28); }
.btn-primary:active { transform: translateY(1px); }
.login-msg { font-size: 12.5px; color: var(--red); min-height: 16px; margin: 8px 2px 0; text-align: center; }
.login-foot { font-size: 11.5px; color: var(--text-3); text-align: center; margin-top: 10px; }
