/* ===== CSS Variables ===== */
:root,
[data-theme="mint"] {
  /* ===== 薄荷绿（默认）===== */
  --bg-page: #F0F7F4;
  --bg-white: #FFFFFF;
  --text-dark: #1A3C32;
  --text-secondary: #5A7A6E;
  --border-light: #D4E9DF;
  --accent-green: #3DAA8E;
  --accent-green-light: #A8E0CF;
  --accent-mint: #E8F5EF;
  --card-yellow: #F4E5A8;
  --card-pink: #F0C0D8;
  --card-blue: #A8D8E8;
  --card-green: #A8E0CF;
  --sidebar-bg: #1A3C32;
  --sidebar-text: #D4E9DF;
  --sidebar-active: #3DAA8E;
  --btn-hover: #2E8A73;
  --btn-secondary-hover: #E0F0E8;
}

[data-theme="ocean"] {
  /* ===== 深海蓝 ===== */
  --bg-page: #F0F4F8;
  --bg-white: #FFFFFF;
  --text-dark: #1A2A3C;
  --text-secondary: #5A6E82;
  --border-light: #D0DCE8;
  --accent-green: #3A7EC8;
  --accent-green-light: #A8C8E8;
  --accent-mint: #E8EFF5;
  --card-yellow: #E8D8A8;
  --card-pink: #E0C0D8;
  --card-blue: #A8CCE8;
  --card-green: #A8D0CC;
  --sidebar-bg: #1A2A3C;
  --sidebar-text: #D0DCE8;
  --sidebar-active: #3A7EC8;
  --btn-hover: #2E6AA8;
  --btn-secondary-hover: #DCE4F0;
}

[data-theme="sunset"] {
  /* ===== 日落橙 ===== */
  --bg-page: #FCF6F0;
  --bg-white: #FFFFFF;
  --text-dark: #3C2A1A;
  --text-secondary: #7A6A5A;
  --border-light: #E8D8C8;
  --accent-green: #D4783C;
  --accent-green-light: #E8C0A0;
  --accent-mint: #F5ECE0;
  --card-yellow: #F0D898;
  --card-pink: #E8C0B8;
  --card-blue: #B8CCE0;
  --card-green: #B8D8C0;
  --sidebar-bg: #3C2A1A;
  --sidebar-text: #E8D8C8;
  --sidebar-active: #D4783C;
  --btn-hover: #B8642E;
  --btn-secondary-hover: #F0E4D8;
}

[data-theme="lavender"] {
  /* ===== 薰衣草紫 ===== */
  --bg-page: #F5F2FA;
  --bg-white: #FFFFFF;
  --text-dark: #2A1A3C;
  --text-secondary: #6A5A7A;
  --border-light: #D8CCE8;
  --accent-green: #7A5AC8;
  --accent-green-light: #C8B0E8;
  --accent-mint: #EEE8F5;
  --card-yellow: #E8D8B0;
  --card-pink: #E0C0D8;
  --card-blue: #B0C8E8;
  --card-green: #B8D8C8;
  --sidebar-bg: #2A1A3C;
  --sidebar-text: #D8CCE8;
  --sidebar-active: #7A5AC8;
  --btn-hover: #6648B0;
  --btn-secondary-hover: #E8E0F5;
}

[data-theme="forest"] {
  /* ===== 森林绿 ===== */
  --bg-page: #F2F6F0;
  --bg-white: #FFFFFF;
  --text-dark: #1C2E1A;
  --text-secondary: #5A6E52;
  --border-light: #CCDCC4;
  --accent-green: #4A8C3C;
  --accent-green-light: #A8D898;
  --accent-mint: #E8F2E4;
  --card-yellow: #E8E0A8;
  --card-pink: #E0C8D0;
  --card-blue: #A8CCE0;
  --card-green: #A8D8B0;
  --sidebar-bg: #1C2E1A;
  --sidebar-text: #CCDCC4;
  --sidebar-active: #4A8C3C;
  --btn-hover: #3A702E;
  --btn-secondary-hover: #DCE8D4;
}

[data-theme="rose"] {
  /* ===== 玫瑰粉 ===== */
  --bg-page: #FCF4F5;
  --bg-white: #FFFFFF;
  --text-dark: #3C1A22;
  --text-secondary: #7A5A62;
  --border-light: #E8D0D4;
  --accent-green: #C8506A;
  --accent-green-light: #E8B0BC;
  --accent-mint: #F5E8EA;
  --card-yellow: #E8D8A8;
  --card-pink: #E8C0C8;
  --card-blue: #B8CCE0;
  --card-green: #B8D8C0;
  --sidebar-bg: #3C1A22;
  --sidebar-text: #E8D0D4;
  --sidebar-active: #C8506A;
  --btn-hover: #A83E56;
  --btn-secondary-hover: #F0DCE0;
}

/* ===== 浅色系列 ===== */
[data-theme="mint-light"] {
  --bg-page: #F7FBFA;
  --bg-white: #FFFFFF;
  --text-dark: #2C5A4A;
  --text-secondary: #7AAA96;
  --border-light: #E0F0E8;
  --accent-green: #5CC4A0;
  --accent-green-light: #C8F0E0;
  --accent-mint: #F0FAF5;
  --card-yellow: #F8F0C8;
  --card-pink: #F4D8E4;
  --card-blue: #C8E8F4;
  --card-green: #C8F0E0;
  --sidebar-bg: #E8F5EF;
  --sidebar-text: #2C5A4A;
  --sidebar-active: #5CC4A0;
  --btn-hover: #48B088;
  --btn-secondary-hover: #E8F5EE;
}

[data-theme="ocean-light"] {
  --bg-page: #F7F9FC;
  --bg-white: #FFFFFF;
  --text-dark: #2C3E50;
  --text-secondary: #7A8EA0;
  --border-light: #E0E8F0;
  --accent-green: #5C9ED8;
  --accent-green-light: #C8DCF0;
  --accent-mint: #F0F4FA;
  --card-yellow: #F0E8C8;
  --card-pink: #E8D4E0;
  --card-blue: #C8DCF0;
  --card-green: #C8E0D8;
  --sidebar-bg: #E8EFF5;
  --sidebar-text: #2C3E50;
  --sidebar-active: #5C9ED8;
  --btn-hover: #4888C0;
  --btn-secondary-hover: #E4ECF5;
}

[data-theme="sunset-light"] {
  --bg-page: #FEFAF5;
  --bg-white: #FFFFFF;
  --text-dark: #5C4028;
  --text-secondary: #A08870;
  --border-light: #F0E4D4;
  --accent-green: #E8985C;
  --accent-green-light: #F0D0B8;
  --accent-mint: #FAF2E8;
  --card-yellow: #F8E8C0;
  --card-pink: #F0D4C8;
  --card-blue: #C8DCF0;
  --card-green: #C8E4D0;
  --sidebar-bg: #F5ECE0;
  --sidebar-text: #5C4028;
  --sidebar-active: #E8985C;
  --btn-hover: #D08048;
  --btn-secondary-hover: #F5E8D8;
}

[data-theme="lavender-light"] {
  --bg-page: #F9F7FC;
  --bg-white: #FFFFFF;
  --text-dark: #3C2E50;
  --text-secondary: #8A7AA0;
  --border-light: #E8E0F0;
  --accent-green: #9C7ED8;
  --accent-green-light: #D8C8F0;
  --accent-mint: #F2EEFA;
  --card-yellow: #F0E8C8;
  --card-pink: #E8D4E4;
  --card-blue: #C8D8F0;
  --card-green: #C8E4D4;
  --sidebar-bg: #EEE8F5;
  --sidebar-text: #3C2E50;
  --sidebar-active: #9C7ED8;
  --btn-hover: #8468C0;
  --btn-secondary-hover: #ECE4F5;
}

[data-theme="forest-light"] {
  --bg-page: #F7FAF5;
  --bg-white: #FFFFFF;
  --text-dark: #2E4028;
  --text-secondary: #7A9A6E;
  --border-light: #DCE8D4;
  --accent-green: #6CAC5C;
  --accent-green-light: #C8E4B8;
  --accent-mint: #F0F5EC;
  --card-yellow: #F0E8C0;
  --card-pink: #E8D4DC;
  --card-blue: #C4D8EC;
  --card-green: #C4E4C0;
  --sidebar-bg: #E8F2E4;
  --sidebar-text: #2E4028;
  --sidebar-active: #6CAC5C;
  --btn-hover: #589448;
  --btn-secondary-hover: #E4F0DC;
}

[data-theme="rose-light"] {
  --bg-page: #FEF7F8;
  --bg-white: #FFFFFF;
  --text-dark: #5C2E38;
  --text-secondary: #A07A82;
  --border-light: #F0E0E4;
  --accent-green: #E8788C;
  --accent-green-light: #F0C8D0;
  --accent-mint: #FAEEF0;
  --card-yellow: #F4E4C0;
  --card-pink: #F0D4D8;
  --card-blue: #C8D8EC;
  --card-green: #C8E0D0;
  --sidebar-bg: #F5E8EA;
  --sidebar-text: #5C2E38;
  --sidebar-active: #E8788C;
  --btn-hover: #D06074;
  --btn-secondary-hover: #F5E4E8;
}

/* 非颜色变量（所有主题共用） */
:root {
  --radius-card: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-elevated: 0 4px 16px rgba(0,0,0,0.12);
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sidebar-width: 240px;
  --bottom-nav-height: 56px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --transition: 0.2s ease;
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-stack);
  background: var(--bg-page);
  color: var(--text-dark);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: var(--accent-green); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }

/* ===== App Layout ===== */
#app { min-height: 100vh; }

/* ===== Desktop Sidebar ===== */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 0 24px 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--sidebar-text);
  border-bottom: 1px solid rgba(128,128,128,0.15);
  margin-bottom: 12px;
}
.sidebar-logo .subtitle {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.65;
  margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: 0 12px; }
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  min-height: 40px;
}
.sidebar-nav-item:hover { background: rgba(128,128,128,0.12); }
.sidebar-nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sidebar-nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer {
  padding: 12px 24px;
  font-size: 11px;
  color: var(--text-secondary);
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 24px 32px 40px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title-group { display: flex; align-items: center; gap: 8px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text-dark); }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 12px; }

/* ===== Cards ===== */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  transition: var(--transition);
}
.card-tinted {
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.card-tinted.tint-blue { background: var(--card-blue); }
.card-tinted.tint-green { background: var(--card-green); }
.card-tinted.tint-pink { background: var(--card-pink); }
.card-tinted.tint-yellow { background: var(--card-yellow); }
.card-tinted .card-title { color: var(--text-dark); }

/* ===== Grid Layouts ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
.section { margin-bottom: 28px; }
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .count-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-page);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  min-height: 40px;
  white-space: nowrap;
}
.btn-primary { background: var(--accent-green); color: #fff; }
.btn-primary:hover { background: var(--btn-hover); }
.btn-secondary { background: var(--bg-page); color: var(--text-dark); border: 1px solid var(--border-light); }
.btn-secondary:hover { background: var(--btn-secondary-hover); }
.btn-danger { background: #D93025; color: #fff; }
.btn-ghost { color: var(--text-secondary); padding: 6px 12px; }
.btn-ghost:hover { color: var(--text-dark); }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-light); padding: 6px 14px; }
.btn-outline:hover { border-color: var(--text-secondary); color: var(--text-dark); }
.btn-sm { padding: 6px 14px; font-size: 13px; min-height: 32px; }
.btn-lg { padding: 14px 28px; font-size: 16px; min-height: 48px; }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; }

/* ===== Form Elements ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dark);
  background: var(--bg-white);
  transition: var(--transition);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(61,170,142,0.12);
}
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

/* ===== Status Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-blue { background: rgba(168,216,232,0.4); color: #3B6B7E; }
.badge-green { background: rgba(168,224,207,0.4); color: #2E7A60; }
.badge-pink { background: rgba(240,192,216,0.4); color: #9C4E72; }
.badge-yellow { background: rgba(244,229,168,0.4); color: #8A7530; }
.badge-gray { background: var(--bg-page); color: var(--text-secondary); }
.badge-red { background: rgba(217,48,37,0.15); color: #D93025; }

/* ===== Help Button ===== */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--text-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  position: relative;
}
.help-btn:hover { border-color: var(--accent-green); color: var(--accent-green); }
.help-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-dark);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  white-space: normal;
  width: 280px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  box-shadow: var(--shadow-elevated);
}
.help-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text-dark);
}
.help-btn:hover .help-tooltip { opacity: 1; pointer-events: auto; }
.help-tooltip strong { color: var(--card-yellow); }

/* ===== Progress Bar ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-page);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ===== Kanban Board ===== */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.kanban-col {
  background: var(--bg-page);
  border-radius: var(--radius-card);
  padding: 16px;
  min-height: 200px;
}
.kanban-col-header {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-item {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}
.kanban-item:hover { border-color: var(--accent-green); }
.kanban-item-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; line-height: 1.4; }
.kanban-item-meta { font-size: 11px; color: var(--text-secondary); display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== List Items ===== */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: var(--transition);
}
.list-item:hover { box-shadow: var(--shadow-elevated); }
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.list-item-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 10px; flex-wrap: wrap; }
.list-item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
}
.icon-btn:hover { background: var(--bg-page); color: var(--text-dark); }
.icon-btn svg { width: 18px; height: 18px; }

/* ===== Calendar ===== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-header {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 0;
}
.calendar-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.calendar-cell.empty { background: transparent; cursor: default; }
.calendar-cell.checked { background: var(--card-green); color: var(--text-dark); font-weight: 600; }
.calendar-cell.unchecked { background: var(--bg-page); color: var(--text-secondary); }
.calendar-cell.today { border: 2px solid var(--accent-green); font-weight: 700; }
.calendar-cell .dot {
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-green);
}

/* ===== Chart (CSS-only bar chart) ===== */
.chart-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding: 10px 0;
}
.chart-bar {
  flex: 1;
  background: var(--card-blue);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  position: relative;
  transition: var(--transition);
}
.chart-bar:hover { background: var(--accent-green); }
.chart-bar .bar-value {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-secondary);
}
.chart-labels {
  display: flex;
  gap: 4px;
  font-size: 10px;
  color: var(--text-secondary);
}
.chart-labels span { flex: 1; text-align: center; }

/* ===== Flashcard (背记) ===== */
.flashcard {
  perspective: 1000px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 300px;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  min-height: 300px;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-elevated);
}
.flashcard-front { background: var(--card-blue); }
.flashcard-back { background: var(--card-green); transform: rotateY(180deg); }
.flashcard-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; }
.flashcard-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; line-height: 1.4; }
.flashcard-content { font-size: 15px; line-height: 1.8; }
.flashcard-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
  animation: fadeIn 0.2s;
}
.modal {
  background: var(--bg-white);
  border-radius: var(--radius-card);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
  animation: slideUp 0.3s;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
}
.modal-close:hover { background: var(--bg-page); }

/* ===== Drawer ===== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 250;
  animation: fadeIn 0.2s;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 100%;
  background: var(--bg-white);
  z-index: 260;
  overflow-y: auto;
  box-shadow: -4px 0 16px rgba(0,0,0,0.15);
  animation: slideInRight 0.3s;
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--bg-white);
  z-index: 10;
}
.drawer-body { padding: 24px; }

/* ===== Toast ===== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--text-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-elevated);
  animation: slideInRight 0.3s;
  max-width: 360px;
}
.toast.success { background: var(--accent-green); }
.toast.error { background: #D93025; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 16px; opacity: 0.4; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-dark); margin-bottom: 8px; }
.empty-state-desc { font-size: 14px; margin-bottom: 20px; }

/* ===== Loading ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-secondary);
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Mobile Bottom Nav ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border-top: 1px solid var(--border-light);
  z-index: 100;
  padding-bottom: var(--safe-area-bottom);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}
.bottom-nav-items {
  display: flex;
  height: var(--bottom-nav-height);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item.active { color: var(--accent-green); }
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item.add-btn svg {
  width: 28px; height: 28px;
  background: var(--accent-green);
  color: #fff;
  border-radius: 50%;
  padding: 4px;
}

/* ===== More Menu (Mobile) ===== */
.more-menu {
  position: fixed;
  inset: 0;
  background: var(--bg-page);
  z-index: 150;
  overflow-y: auto;
  padding: 16px 16px calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 20px);
}
.more-menu.hidden { display: none; }
.more-menu-header {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.more-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.more-menu-item {
  background: var(--bg-white);
  border-radius: var(--radius-card);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}
.more-menu-item:active { transform: scale(0.97); }
.more-menu-item svg { width: 28px; height: 28px; color: var(--accent-green); }
.more-menu-item-label { font-size: 14px; font-weight: 600; }
.more-menu-item-desc { font-size: 11px; color: var(--text-secondary); }

/* ===== Bottom Sheet (Mobile Quick Add) ===== */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  animation: fadeIn 0.2s;
}
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 20px calc(20px + var(--safe-area-bottom));
  z-index: 301;
  animation: slideUpSheet 0.3s;
}
@keyframes slideUpSheet { from { transform: translateY(100%); } to { transform: translateY(0); } }
.bottom-sheet-handle {
  width: 40px; height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.bottom-sheet-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; text-align: center; }
.bottom-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}
.bottom-sheet-item:active { background: var(--bg-page); }
.bottom-sheet-item svg { width: 24px; height: 24px; color: var(--accent-green); }
.bottom-sheet-item-text { font-size: 15px; font-weight: 500; }

/* ===== Filter Chips ===== */
.chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
  flex-wrap: nowrap;
  cursor: grab;
  max-width: 100%;
  -ms-overflow-style: none;
}
.chips-row:active { cursor: grabbing; }
.chips-row::-webkit-scrollbar { height: 4px; }
.chips-row::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
.chips-row::-webkit-scrollbar-track { background: transparent; }
.chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.chip.active { background: var(--accent-green); color: #fff; border-color: var(--accent-green); }

/* ===== Search ===== */
.search-bar {
  position: relative;
  width: 100%;
  max-width: 500px;
}
.search-bar svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-secondary); }
.search-bar input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-white);
}
.search-bar input:focus { outline: none; border-color: var(--accent-green); }
.search-results-group { margin-bottom: 24px; }
.search-results-group-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ===== Settings ===== */
.settings-section { margin-bottom: 32px; }
.settings-section-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.settings-item-label { font-size: 14px; font-weight: 500; }
.settings-item-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.settings-item-value { font-size: 14px; color: var(--text-secondary); }
.settings-doc {
  background: var(--bg-white);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
  line-height: 1.8;
  font-size: 14px;
}
.settings-doc h3 { font-size: 15px; font-weight: 700; margin: 20px 0 8px; color: var(--accent-green); }
.settings-doc h3:first-child { margin-top: 0; }
.settings-doc p { margin-bottom: 8px; color: var(--text-dark); }
.settings-doc ul { padding-left: 20px; margin-bottom: 12px; }
.settings-doc li { margin-bottom: 4px; }
.settings-doc .warn { color: #D93025; font-weight: 600; }
.settings-doc .note { background: rgba(244,229,168,0.2); padding: 10px 14px; border-radius: var(--radius-sm); margin: 12px 0; }

/* ===== Theme Selector ===== */
.theme-group-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 16px 0 8px;
  padding-left: 4px;
}
.theme-group-label:first-of-type { margin-top: 0; }
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.theme-card {
  background: var(--bg-white);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-card);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}
.theme-card:hover { border-color: var(--accent-green); transform: translateY(-2px); box-shadow: var(--shadow-elevated); }
.theme-card.active { border-color: var(--accent-green); background: var(--accent-mint); }
.theme-preview {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.theme-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.theme-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 2px;
}
.theme-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== Update Log Table ===== */
.update-log-table { width: 100%; border-collapse: collapse; }
.update-log-table th, .update-log-table td {
  border: 1px solid var(--border-light);
  padding: 10px 14px;
  font-size: 13px;
  text-align: left;
}
.update-log-table th { background: var(--bg-page); font-weight: 700; }

/* ===== Streak Display ===== */
.streak-display {
  text-align: center;
  padding: 16px;
}
.streak-number { font-size: 32px; font-weight: 700; color: var(--accent-green); line-height: 1; }
.streak-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.streak-dots { display: flex; justify-content: center; gap: 5px; margin: 12px 0; }
.streak-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-light); }
.streak-dot.active { background: var(--accent-green); }

/* ===== Quick Add FAB (Desktop) ===== */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-elevated);
  z-index: 90;
  transition: var(--transition);
}
.fab:hover { transform: scale(1.05); background: var(--btn-hover); }
.fab svg { width: 28px; height: 28px; }

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content {
    margin-left: 0;
    padding: 16px 16px calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 20px);
  }
  .bottom-nav { display: block; }
  .page-title { font-size: 18px; }
  .grid-2, .grid-3, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .kanban-col { min-height: auto; }
  .more-menu-grid { grid-template-columns: 1fr 1fr; }
  .modal { max-width: 100%; max-height: 90vh; border-radius: var(--radius-card); }
  .drawer { width: 100%; }
  .fab { display: none; }
  .page-header { margin-bottom: 16px; }
  .card, .card-tinted { padding: 16px; }
  .section { margin-bottom: 20px; }
  .streak-number { font-size: 28px; }
  .flashcard-front, .flashcard-back { min-height: 240px; padding: 24px; }
  .flashcard-title { font-size: 17px; }
  .flashcard-content { font-size: 14px; }
  #toast-container { top: 10px; right: 10px; left: 10px; }
  .toast { max-width: 100%; }
  .help-tooltip { display: none; }
  .more-menu-grid { gap: 10px; }
  .more-menu-item { padding: 16px; min-height: 72px; }
}

/* ===== Responsive: Small Mobile ===== */
@media (max-width: 380px) {
  .main-content { padding: 12px 12px calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 16px); }
  .page-title { font-size: 17px; }
  .card, .card-tinted { padding: 14px; }
  .bottom-nav-item { font-size: 9px; }
  .more-menu-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .more-menu-item { padding: 14px; min-height: 64px; }
  .more-menu-item-label { font-size: 13px; }
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.no-data { color: var(--text-secondary); font-size: 14px; text-align: center; padding: 24px; }
