:root {
  --bg: #f6f4ef;
  --sidebar: #fbfaf7;
  --card: #ffffff;
  --text: #2c2b28;
  --text-2: #5f5a51;
  --muted: #9b958a;
  --border: #eae5da;
  --border-2: #f1ede4;
  --primary: #2e5a4c;
  --primary-hover: #23493d;
  --primary-soft: #eaf1ec;
  --accent: #b5764a;
  --accent-soft: #f7ede3;
  --danger: #c0503a;
  --danger-soft: #fbece8;
  --dy: #fe2c55;
  --sph: #07c160;
  --shadow: 0 1px 3px rgba(60,50,35,.05), 0 8px 24px rgba(60,50,35,.04);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.icon { width: 18px; height: 18px; fill: currentColor; flex: none; }

.app { display: flex; height: 100vh; overflow: hidden; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 232px; flex: none; background: var(--sidebar);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 22px 14px 16px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: linear-gradient(145deg, var(--primary), #1f4237);
  color: #fff; font-family: 'STKaiti','KaiTi',serif; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(46,90,76,.25);
}
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-label { font-size: 11px; color: var(--muted); padding: 0 10px 8px; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border: none; background: transparent; cursor: pointer;
  border-radius: 9px; color: var(--text-2); font-size: 13.5px; text-align: left;
  font-family: inherit; transition: .15s;
}
.nav-item:hover { background: #f0ede5; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active .icon { fill: var(--primary); }
.sidebar-foot { padding: 14px 10px 0; border-top: 1px solid var(--border-2); }
.foot-platforms { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.dot.dy { background: var(--dy); }
.dot.sph { background: var(--sph); }
.foot-hint { font-size: 11px; color: var(--muted); margin-top: 7px; }

/* ---------- 主区域 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 84px; flex: none; background: var(--card);
  border-bottom: 1px solid var(--border); padding: 0 30px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.topbar p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 9px; padding: 0 12px; height: 38px;
  width: 260px; color: var(--muted); transition: .15s;
}
.search-box:focus-within { border-color: var(--primary); background: #fff; }
.search-box input { border: none; background: transparent; outline: none; font-size: 13px; width: 100%; font-family: inherit; color: var(--text); }
.search-box input::placeholder { color: var(--muted); }

.content { flex: 1; overflow-y: auto; padding: 24px 30px 40px; }
.view { display: none; animation: fade .2s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-family: inherit; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: var(--card); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #f7dcd5; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.icon-btn { border: none; background: transparent; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 6px; display: inline-flex; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.link { border: none; background: transparent; color: var(--primary); cursor: pointer; font-size: 12px; font-family: inherit; }
.link:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: 12px; font-weight: 400; }
.spacer { flex: 1; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { font-size: 15px; font-weight: 650; }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.toolbar-left { display: flex; align-items: center; gap: 10px; }
.toolbar-left h3 { font-size: 15px; font-weight: 650; }
.filter-group { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--card); color: var(--text-2); font-size: 12.5px; cursor: pointer; font-family: inherit; transition: .15s; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; right: -14px; top: -14px; width: 70px; height: 70px; border-radius: 50%; background: var(--primary-soft); opacity: .6; }
.stat-card.accent::after { background: var(--accent-soft); }
.stat-label { font-size: 12px; color: var(--muted); position: relative; z-index: 1; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 8px; position: relative; z-index: 1; line-height: 1; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat-foot { font-size: 11px; color: var(--muted); margin-top: 10px; position: relative; z-index: 1; }

/* ---------- 总览 ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dash-list { display: flex; flex-direction: column; gap: 2px; }
.dash-row { display: flex; align-items: center; gap: 10px; padding: 11px 6px; border-bottom: 1px solid var(--border-2); }
.dash-row:last-child { border-bottom: none; }
.dash-row-main { flex: 1; min-width: 0; }
.dash-row-title { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-row-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.dash-date { font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 5px; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 13px; }
.empty .empty-icon { font-size: 30px; opacity: .35; display: block; margin-bottom: 8px; }

/* ---------- 表格 ---------- */
.dash-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border-2); color: var(--text-2); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fcfbf8; }
td strong { color: var(--text); font-weight: 600; }

/* ---------- 标签 ---------- */
.tag { display: inline-flex; align-items: center; font-size: 11px; padding: 3px 9px; border-radius: 5px; font-weight: 500; white-space: nowrap; }
.tag-dy { background: #ffedf1; color: var(--dy); }
.tag-sph { background: #e8f8ef; color: #059b4d; }
.tag-status { background: var(--bg); color: var(--text-2); }
.tag-status.doing { background: #fff4e5; color: #b7791f; }
.tag-status.done { background: var(--primary-soft); color: var(--primary); }
.tag-status.idea { background: #f0ebf8; color: #7c5cbf; }
.tag-cat { background: var(--accent-soft); color: var(--accent); }

/* ---------- 日历 ---------- */
.cal-title { font-size: 17px; font-weight: 650; min-width: 110px; text-align: center; }
.calendar { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: #faf8f3; border-bottom: 1px solid var(--border); }
.cal-weekdays div { padding: 11px 8px; text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 108px; border-right: 1px solid var(--border-2); border-bottom: 1px solid var(--border-2); padding: 8px; cursor: pointer; transition: .12s; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: #fcfbf7; }
.cal-cell.out { background: #fbfaf7; }
.cal-cell.out .cal-day { color: #c9c4ba; }
.cal-day { font-size: 12px; color: var(--text-2); font-weight: 600; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.cal-cell.today .cal-day { background: var(--primary); color: #fff; }
.cal-event { font-size: 10.5px; padding: 4px 6px; border-radius: 4px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 2px solid var(--primary); background: var(--primary-soft); color: var(--primary); }
.cal-event.s2 { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.cal-event.s3 { border-color: #7c5cbf; background: #f0ebf8; color: #7c5cbf; }
.cal-event.s4 { border-color: var(--muted); background: var(--bg); color: var(--text-2); }
.cal-more { font-size: 10px; color: var(--muted); margin-top: 3px; padding-left: 4px; }

/* ---------- 卡片网格 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.item-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 11px; transition: .15s; }
.item-card:hover { border-color: #d8d2c4; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(60,50,35,.08); }
.item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item-title { font-size: 15px; font-weight: 650; line-height: 1.4; flex: 1; }
.item-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.item-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.7; white-space: pre-wrap; word-break: break-word; max-height: 100px; overflow: hidden; }
.item-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border-2); }
.item-date { font-size: 11px; color: var(--muted); }
.item-actions { display: flex; gap: 3px; }
.item-cover { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; background: var(--bg); }
.stars { color: #e0a020; font-size: 13px; letter-spacing: 1px; }

/* ---------- 图表 ---------- */
.chart-wrap { width: 100%; height: 220px; position: relative; }
.chart-wrap svg { width: 100%; height: 100%; overflow: visible; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(30,28,24,.42); display: none; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px); }
.modal-mask.show { display: flex; }
.modal { background: var(--card); width: 580px; max-width: 92vw; max-height: 88vh; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.2); display: flex; flex-direction: column; animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; font-weight: 650; }
.modal-body { padding: 22px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }
.form-row { display: flex; flex-direction: column; gap: 7px; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.form-row input, .form-row textarea, .form-row select {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  font-size: 13.5px; font-family: inherit; color: var(--text); outline: none; background: #fff; transition: .15s;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-row textarea { resize: vertical; min-height: 110px; line-height: 1.7; }
.form-row input[type=file] { padding: 8px; font-size: 12px; }
.image-preview { width: 100%; max-height: 180px; object-fit: cover; border-radius: 8px; display: none; background: var(--bg); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px); background: #2c2b28; color: #fff; padding: 11px 22px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dcd6ca; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c5bdaf; }

/* ---------- 登录 / 账号锁 ---------- */
.login-screen {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 500px at 15% 10%, #e8efe9 0%, transparent 55%),
              radial-gradient(800px 500px at 90% 90%, #f6ede3 0%, transparent 55%), var(--bg);
}
.login-card {
  width: 460px; max-width: 92vw; background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 20px 60px rgba(60,50,35,.12); padding: 32px 34px 24px;
}
.login-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 22px; border-bottom: 1px solid var(--border-2); }
.login-intro { margin: 22px 0 18px; }
.login-intro h2 { font-size: 20px; font-weight: 700; }
.login-intro p { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.account-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.account-picker:empty { display: none; }
.account-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 14px 8px 8px; border-radius: 30px;
  border: 1.5px solid var(--border); background: var(--card); cursor: pointer; font-family: inherit;
  font-size: 13px; color: var(--text-2); transition: .15s;
}
.account-item:hover { border-color: #cfd9d1; background: #fafcf9; }
.account-item.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.account-item .user-avatar { width: 30px; height: 30px; font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 15px; }
.login-form .form-row label { font-size: 12.5px; }
.login-submit { width: 100%; height: 42px; font-size: 14px; margin-top: 2px; }
.login-link { border: none; background: transparent; color: var(--primary); cursor: pointer; font-size: 12.5px; font-family: inherit; padding: 4px; align-self: center; margin-top: 6px; }
.login-link:hover { text-decoration: underline; }
.login-error { color: var(--danger); font-size: 12px; min-height: 0; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 11px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border-2); }
.login-foot .icon { width: 14px; height: 14px; }

/* ---------- 侧边栏账号 ---------- */
.user-chip {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 9px;
  border: 1px solid var(--border); background: var(--card); border-radius: 10px;
  cursor: pointer; font-family: inherit; text-align: left; margin-bottom: 12px; transition: .15s;
}
.user-chip:hover { border-color: var(--primary); background: #fafcf9; }
.user-chip .icon { width: 14px; height: 14px; color: var(--muted); }
.user-avatar {
  width: 34px; height: 34px; flex: none; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--primary), #1f4237); color: #fff; font-size: 14px; font-weight: 600;
}
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-info strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info small { font-size: 10.5px; color: var(--muted); }

/* ---------- 账号管理弹窗 ---------- */
.account-current { display: flex; align-items: center; gap: 10px; background: var(--primary-soft); padding: 12px; border-radius: 9px; }
.account-current strong { font-size: 14px; }
.account-current small { font-size: 11px; color: var(--muted); display: block; margin-top: 2px; }
.account-section-title { font-size: 11px; color: var(--muted); letter-spacing: 1px; font-weight: 600; margin-top: 8px; }
.account-ops { display: flex; flex-direction: column; gap: 8px; }
.account-ops .btn { justify-content: flex-start; }
.account-warn { font-size: 11px; color: var(--muted); line-height: 1.6; }

/* ---------- Web 版：验证码登录 ---------- */
.code-input-wrap { display: flex; gap: 8px; }
.code-input-wrap input { flex: 1; min-width: 0; letter-spacing: 3px; font-size: 15px; }
.code-input-wrap .btn { flex: none; white-space: nowrap; height: 40px; padding: 0 12px; font-size: 12px; }
.code-input-wrap .btn:disabled { opacity: .55; cursor: not-allowed; }
.login-error.success { color: var(--primary); }
.login-form .btn:disabled { opacity: .6; cursor: not-allowed; }
