:root {
  /* ============================================================
     颜色 / Colors — 你可以直接改这里的色码，也可以用 App 里的
     "外观设置" 面板即时调整（不用碰代码）。
     ============================================================ */
  --bg: #faf6f0;           /* 页面底色，暖米白 */
  --panel: #ffffff;        /* 卡片/面板底色 */
  --border: #ece2d4;       /* 边框，暖灰调 */
  --text: #2b241e;         /* 主文字，暖黑棕 */
  --text-soft: #8c8072;    /* 次要文字，暖灰 */
  --accent: #c0562c;       /* 主色调，赤陶橙——可在外观设置里换 */
  --accent-soft: #fbeee4;  /* 主色调的浅色底 */
  --danger: #d1453d;
  --success: #6b8f71;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 36, 30, 0.04), 0 6px 20px rgba(43, 36, 30, 0.05);

  /* ============================================================
     字体 / Fonts — 标题用 Baloo 2（圆润可爱），内文用 Poppins（清晰易读）
     ============================================================ */
  --font-heading: 'Baloo 2', -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: 'Poppins', -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;

  /* 封面图 / Cover image — 默认是渐变，可在外观设置里换成你自己的照片 */
  --cover-image: none;

  font-family: var(--font-body);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background:
    var(--cover-image, none),
    radial-gradient(circle at 20% 20%, #f6ddc8 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, #e7d2c0 0%, transparent 50%),
    linear-gradient(135deg, #fbeee4 0%, #faf6f0 60%);
  background-size: cover;
  background-position: center;
}
.login-screen::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(250, 246, 240, 0.35);
  backdrop-filter: blur(0px);
}
.login-card {
  position: relative;
  background: var(--panel);
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(43, 36, 30, 0.12);
  padding: 40px 36px;
  width: 320px;
  text-align: center;
}
.login-avatar {
  width: 84px; height: 84px; border-radius: 50%;
  object-fit: cover; margin: 0 auto 12px;
  border: 3px solid var(--accent-soft);
  box-shadow: 0 4px 16px rgba(43, 36, 30, 0.12);
  cursor: pointer;
  transition: transform 0.12s ease-out;
  will-change: transform;
}
@keyframes peanut-bounce {
  0% { transform: scale(1) rotate(0deg); }
  30% { transform: scale(1.12) rotate(-8deg); }
  60% { transform: scale(0.95) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.login-avatar.bounce, .sidebar-avatar.bounce { animation: peanut-bounce 0.55s ease; }
.login-logo { font-size: 40px; margin-bottom: 8px; }
.login-card h1 { margin: 0 0 4px; font-size: 24px; font-family: var(--font-heading); }
.login-sub { color: var(--text-soft); margin: 0 0 20px; font-size: 13px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:hover { opacity: 0.92; }
.login-error { color: var(--danger); font-size: 12px; min-height: 16px; margin: 8px 0 0; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0;
}
.sidebar-brand {
  font-weight: 700; font-size: 16px; padding: 0 10px 20px;
  font-family: var(--font-heading);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--accent-soft); cursor: pointer;
  transition: transform 0.18s ease;
}
.sidebar-avatar:hover { transform: scale(1.18) rotate(-8deg); }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: none; background: transparent;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
}
.nav-item:hover { background: var(--accent-soft); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 16px; }

.sidebar-footer { display: flex; flex-direction: column; gap: 4px; }
.sidebar-footer-btn {
  padding: 10px 12px; border: none; background: transparent;
  border-radius: 10px; text-align: left; font-size: 13px;
  color: var(--text-soft); cursor: pointer;
}
.sidebar-footer-btn:hover { background: var(--bg); color: var(--text); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px; border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-wrap: wrap; gap: 12px;
}
.topbar-title { font-size: 20px; font-weight: 700; font-family: var(--font-heading); }

.category-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--border); background: var(--panel);
  cursor: pointer; color: var(--text-soft); white-space: nowrap;
}
.chip.active { border-color: transparent; color: white; }

.view-root { padding: 28px 32px; flex: 1; }

/* ---------- Sections / cards ---------- */
.section { margin-bottom: 32px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 15px; margin: 0; color: var(--text-soft); font-weight: 600; }
.section-head .count { color: var(--text-soft); font-size: 12px; margin-left: 6px; }

.card-list { display: flex; flex-direction: column; gap: 8px; }

.item-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
}
.item-card.done { opacity: 0.5; }
.item-card .checkbox {
  width: 20px; height: 20px; border-radius: 6px;
  border: 2px solid var(--border); flex-shrink: 0; margin-top: 1px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: white;
}
.item-card .checkbox.checked { background: var(--success); border-color: var(--success); }
.item-body { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 500; }
.item-card.done .item-title { text-decoration: line-through; }
.item-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.item-notes { color: var(--text-soft); font-size: 12px; margin-top: 4px; white-space: pre-wrap; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; color: white; font-weight: 500;
}
.due-badge { font-size: 11px; color: var(--text-soft); }
.due-badge.overdue { color: var(--danger); font-weight: 600; }
.item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; color: var(--text-soft);
  font-size: 14px; padding: 4px 6px; border-radius: 6px;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

.empty-state { color: var(--text-soft); font-size: 13px; padding: 20px; text-align: center; background: var(--panel); border: 1px dashed var(--border); border-radius: var(--radius); }

.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input, .add-row select {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 13px; outline: none;
}
.add-row input[type=text] { flex: 1; }
.add-row input:focus, .add-row select:focus { border-color: var(--accent); }
.btn-primary {
  padding: 9px 16px; border-radius: 10px; border: none; background: var(--accent); color: white;
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-primary:hover { opacity: 0.92; }
.btn-secondary {
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel);
  font-size: 13px; cursor: pointer; color: var(--text);
}

/* ---------- Calendar ---------- */
.calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-head h2 { margin: 0; font-size: 19px; font-family: var(--font-heading); }
.calendar-nav { display: flex; gap: 8px; }
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-dow { text-align: center; font-size: 12px; color: var(--text-soft); padding: 6px 0; font-weight: 600; }
.calendar-cell {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  min-height: 92px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
}
.calendar-cell:hover { border-color: var(--accent); }
.calendar-cell.other-month { opacity: 0.35; }
.calendar-cell.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.calendar-date { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.calendar-cell.today .calendar-date { color: var(--accent); }
.calendar-dot { font-size: 10px; padding: 1px 6px; border-radius: 6px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-more { font-size: 10px; color: var(--text-soft); }

/* ---------- Goals ---------- */
.period-tabs { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.period-tabs .btn-secondary.active { background: var(--accent); color: white; border-color: var(--accent); }
.period-select { display: flex; gap: 6px; align-items: center; }
.period-select select, .period-select input { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px; }

.goal-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.goal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.goal-title { font-weight: 600; font-size: 15px; font-family: var(--font-heading); }
.goal-desc { color: var(--text-soft); font-size: 12px; margin-top: 4px; white-space: pre-wrap; }
.status-select { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 12px; font-weight: 600; cursor: pointer; }
.status-select.not_started { color: var(--text-soft); }
.status-select.in_progress { color: #d97706; }
.status-select.done { color: var(--success); }

/* ---------- Notes ---------- */
.notes-layout { display: flex; gap: 20px; }
.notes-list { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.notes-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.notes-toolbar input { flex: 1; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 13px; }
.note-list-item {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; cursor: pointer;
}
.note-list-item:hover { border-color: var(--accent); }
.note-list-item.active { border-color: var(--accent); background: var(--accent-soft); }
.note-list-item .title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.note-list-item .preview { font-size: 12px; color: var(--text-soft); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-list-item .meta { font-size: 11px; color: var(--text-soft); margin-top: 4px; }

.note-editor { flex: 1; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; }
.note-editor input[type=text], .note-editor textarea, .note-editor select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 14px; margin-bottom: 10px; font-family: inherit; outline: none;
}
.note-editor input:focus, .note-editor textarea:focus, .note-editor select:focus { border-color: var(--accent); }
.note-editor textarea { min-height: 200px; resize: vertical; }
.note-field-row { display: flex; gap: 10px; }
.note-field-row > * { flex: 1; }
.note-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.note-toolbar-actions { display: flex; gap: 8px; }
.meeting-fields { background: var(--bg); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.meeting-fields-label { font-size: 12px; color: var(--text-soft); margin-bottom: 8px; font-weight: 600; }
.field-label { font-size: 12px; color: var(--text-soft); margin-bottom: 4px; display: block; }

/* ---------- Quick panel ---------- */
.quick-panel-toggle {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--accent); color: white; font-size: 20px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(43, 36, 30, 0.2);
  transition: transform 0.15s ease;
}
.quick-panel-toggle:hover { transform: scale(1.08); }
.quick-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 300px; z-index: 70;
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(43, 36, 30, 0.08);
  padding: 20px; overflow-y: auto;
  transform: translateX(0); transition: transform 0.2s ease;
}
.quick-panel.hidden { transform: translateX(100%); display: block !important; }
.quick-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.quick-panel-head h3 { margin: 0; font-size: 16px; font-family: var(--font-heading); }
.quick-panel-section { margin-bottom: 24px; }
.quick-panel-section input[type=text], .quick-panel-section select, .quick-panel-section input[type=date] {
  width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 13px; margin-bottom: 6px; outline: none; font-family: inherit;
}
.quick-add-row { display: flex; gap: 6px; }
.quick-add-row select { margin-bottom: 0; }
.quick-add-row input[type=date] { margin-bottom: 0; }
.quick-link-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; font-size: 13px;
}
.quick-link-item a { flex: 1; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-link-item a:hover { color: var(--accent); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 22, 40, 0.35);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-content {
  background: var(--panel); border-radius: 16px; padding: 24px; width: 400px;
  max-height: 80vh; overflow-y: auto;
}
.modal-content h3 { margin: 0 0 16px; font-size: 18px; font-family: var(--font-heading); }
.modal-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
.modal-row input[type=text] { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); }
.modal-row input[type=color] { width: 36px; height: 34px; border: none; border-radius: 8px; padding: 0; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.cat-swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.cat-name { flex: 1; font-size: 13px; }

.mobile-menu-toggle {
  display: none;
  border: none; background: transparent; font-size: 20px; cursor: pointer;
  padding: 4px 8px; color: var(--text); border-radius: 8px; margin-right: 4px;
}
.sidebar-backdrop { display: none; }

@media (max-width: 860px) {
  .mobile-menu-toggle { display: inline-block; }
  .sidebar { position: fixed; z-index: 50; height: 100vh; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open {
    display: block; position: fixed; inset: 0; background: rgba(20, 15, 10, 0.3); z-index: 49;
  }
  .view-root { padding: 20px 16px; }
  .topbar { padding: 14px 16px; }
  .notes-layout { flex-direction: column; }
  .notes-list { width: 100%; }
  .quick-panel { width: 85vw; }
}

/* ---------- Cuter touches ---------- */
.sidebar::after {
  content: '';
  display: block;
  height: 40px;
  margin-top: 8px;
  background-image: radial-gradient(var(--border) 1.5px, transparent 1.5px);
  background-size: 14px 14px;
  opacity: 0.5;
  border-radius: 10px;
}

.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 20px;
}
.empty-state .empty-icon { font-size: 26px; }
.empty-state .empty-text { color: var(--text-soft); font-size: 13px; }

.item-card { transition: transform 0.12s ease, box-shadow 0.12s ease; }
.item-card:hover { box-shadow: var(--shadow); }
.checkbox { transition: transform 0.15s ease; }
.checkbox.checked { animation: check-pop 0.3s ease; }
@keyframes check-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Peanut animation style variants — chosen in Appearance settings */
@keyframes peanut-wag {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}
@keyframes peanut-heart {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(0.95); }
  75% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes peanut-spin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}
.login-avatar.anim-wag.bounce, .sidebar-avatar.anim-wag.bounce { animation: peanut-wag 0.5s ease; }
.login-avatar.anim-heart.bounce, .sidebar-avatar.anim-heart.bounce { animation: peanut-heart 0.6s ease; }
.login-avatar.anim-spin.bounce, .sidebar-avatar.anim-spin.bounce { animation: peanut-spin 0.6s ease; }
.login-avatar.anim-none.bounce, .sidebar-avatar.anim-none.bounce { animation: none; }

/* Confetti burst on completion */
.confetti-piece {
  position: fixed; top: 0; left: 0; width: 8px; height: 8px;
  border-radius: 2px; pointer-events: none; z-index: 200;
  animation: confetti-fall 900ms ease-out forwards;
}
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: var(--confetti-end) rotate(var(--confetti-spin)); opacity: 0; }
}

/* Peanut Corner card (Personal) */
.peanut-corner {
  background: linear-gradient(135deg, var(--accent-soft), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px;
}
.peanut-corner img {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--panel); box-shadow: var(--shadow); flex-shrink: 0;
}
.peanut-corner-body { flex: 1; min-width: 0; }
.peanut-corner-title { font-family: var(--font-heading); font-weight: 600; font-size: 15px; }
.peanut-corner-sub { color: var(--text-soft); font-size: 12px; margin-top: 2px; }

/* Goal progress bar */
.goal-progress { margin-top: 10px; }
.goal-progress-bar { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.goal-progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.2s ease; }
.goal-progress-label { font-size: 11px; color: var(--text-soft); margin-top: 4px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.goal-progress-label input { width: 60px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); font-size: 11px; }

/* Google Drive panel */
.drive-connect { text-align: center; padding: 40px 20px; }
.drive-connect .empty-icon { font-size: 36px; margin-bottom: 8px; }
.drive-file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.drive-file-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; text-align: center; position: relative;
}
.drive-file-card img { width: 32px; height: 32px; margin-bottom: 8px; }
.drive-file-card a { color: var(--text); text-decoration: none; font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-file-card a:hover { color: var(--accent); }
.drive-file-card .icon-btn { position: absolute; top: 6px; right: 6px; }
