/* ========== 知行医伴 - 全局样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-main: #F8F6F0;
  --bg-card: #FFFFFF;
  --bg-card-soft: #F3F7F2;
  --text-primary: #2D4A3E;
  --text-secondary: #5B7A6B;
  --text-light: #8FA89A;
  --accent-deep: #3D6B52;
  --accent-light: #8FBC8F;
  --accent-soft: #D4E5D4;
  --accent-bg: #E8F0E8;
  --border-color: #E5E8E2;
  --shadow-card: 0 2px 12px rgba(61, 107, 82, 0.06);
  --shadow-card-hover: 0 4px 20px rgba(61, 107, 82, 0.1);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

#app {
  max-width: 414px;
  min-height: 100vh;
  margin: 0 auto;
  background-color: var(--bg-main);
  position: relative;
  padding-bottom: 80px;
}

/* ========== 顶部标题栏 ========== */
.header {
  padding: 20px 20px 8px;
  background-color: var(--bg-main);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.title-group h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.title-group .subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 20px 20px 12px;
}

/* ========== 通用容器 ========== */
.container {
  padding: 0 20px;
}

.section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 16px;
  background: var(--accent-deep);
  border-radius: 2px;
}

/* ========== 卡片通用 ========== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-card-hover);
}

.card-soft {
  background: var(--bg-card-soft);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
}

/* ========== 首页卡片 ========== */
.home-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.home-card .card-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-bg);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.home-card .card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  margin-left: 10px;
}

.home-card .card-action {
  font-size: 12px;
  color: var(--accent-deep);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--accent-bg);
  border: none;
}

/* 今日计划内容 */
.plan-items {
  list-style: none;
}

.plan-item {
  display: flex;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-color);
}

.plan-item:last-child {
  border-bottom: none;
}

.plan-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent-light);
  border-radius: 50%;
  margin-right: 10px;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.plan-check.checked {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.plan-check.checked::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
}

.plan-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.plan-text.done {
  text-decoration: line-through;
  color: var(--text-light);
}

.plan-time {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.empty-plan {
  text-align: center;
  padding: 20px 0;
  color: var(--text-light);
  font-size: 13px;
}

/* 计时器 */
.timer-display {
  text-align: center;
  padding: 20px 0 10px;
}

.timer-time {
  font-size: 42px;
  font-weight: 600;
  color: var(--accent-deep);
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

.timer-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.timer-stats {
  display: flex;
  justify-content: space-around;
  padding: 10px 0 16px;
  border-top: 1px dashed var(--border-color);
}

.timer-stat {
  text-align: center;
}

.timer-stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.timer-stat-label {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.timer-buttons {
  display: flex;
  gap: 10px;
}

/* 进度条 */
.progress-wrap {
  margin-top: 12px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--accent-soft);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-light), var(--accent-deep));
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* 今日成长 */
.growth-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.growth-stat-card {
  background: var(--accent-bg);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.growth-stat-card .num {
  font-size: 22px;
  font-weight: 600;
  color: var(--accent-deep);
}

.growth-stat-card .label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ========== 按钮通用 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-deep);
  color: #fff;
  flex: 1;
}

.btn-primary:active {
  background: #2D5A42;
  transform: scale(0.97);
}

.btn-primary:disabled {
  background: var(--accent-soft);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--accent-bg);
  color: var(--accent-deep);
  flex: 1;
}

.btn-secondary:active {
  background: var(--accent-soft);
  transform: scale(0.97);
}

.btn-outline {
  background: transparent;
  color: var(--accent-deep);
  border: 1px solid var(--accent-light);
  flex: 1;
}

.btn-outline:active {
  background: var(--accent-bg);
  transform: scale(0.97);
}

.btn-danger {
  background: #FDEDED;
  color: #C96B6B;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
}

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-label .required {
  color: #C96B6B;
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-light);
}

.form-textarea {
  resize: none;
  min-height: 90px;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-light);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 标签选择 */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-option {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.tag-option.active {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}

/* 生成中 loading */
.loading-wrap {
  text-align: center;
  padding: 30px 0;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent-deep);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 生成的计划结果 */
.plan-result {
  margin-top: 16px;
}

.plan-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-color);
}

.plan-result-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-deep);
}

.ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--accent-deep);
  background: var(--accent-bg);
  padding: 3px 10px;
  border-radius: 20px;
}

.plan-detail-section {
  margin-bottom: 14px;
}

.plan-detail-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.plan-detail-section ul {
  list-style: none;
  padding-left: 16px;
}

.plan-detail-section li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
  position: relative;
  line-height: 1.7;
}

.plan-detail-section li::before {
  content: '•';
  color: var(--accent-light);
  position: absolute;
  left: -14px;
  top: 3px;
}

.plan-tip {
  background: var(--accent-bg);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 10px;
}

/* ========== 成长档案 ========== */
.profile-hero {
  background: linear-gradient(135deg, #E8F0E8 0%, #D4E5D4 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.profile-hero::after {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
}

.profile-target {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent-deep);
  margin-bottom: 6px;
}

.profile-school {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.profile-phase {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 20px;
  font-size: 12px;
  color: var(--accent-deep);
  font-weight: 500;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.profile-stat {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px 8px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.profile-stat .num {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent-deep);
}

.profile-stat .label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* 成长轨迹 - 时间轴 */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--accent-soft);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 18px;
  height: 18px;
  background: var(--bg-card);
  border: 3px solid var(--accent-deep);
  border-radius: 50%;
  z-index: 1;
}

.timeline-dot.soft {
  border-color: var(--accent-light);
}

.timeline-date {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.timeline-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.timeline-add {
  margin-top: 8px;
  text-align: center;
}

/* 成长反馈卡片 */
.feedback-card {
  background: linear-gradient(135deg, #F3F7F2 0%, #E8F0E8 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.feedback-avatar {
  width: 40px;
  height: 40px;
  background: var(--accent-deep);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}

.feedback-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.feedback-role {
  font-size: 11px;
  color: var(--text-light);
}

.feedback-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  padding: 12px 0;
}

.feedback-content p {
  margin-bottom: 8px;
}

.feedback-content p:last-child {
  margin-bottom: 0;
}

.feedback-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
  font-size: 12px;
  color: var(--accent-deep);
  cursor: pointer;
}

/* ========== 我的页面 ========== */
.profile-card {
  background: linear-gradient(135deg, var(--accent-bg) 0%, var(--bg-card-soft) 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.profile-avatar-lg {
  width: 60px;
  height: 60px;
  background: var(--accent-deep);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  flex-shrink: 0;
}

.profile-info-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-info-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.setting-list {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

.setting-item {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-item:active {
  background: var(--bg-card-soft);
}

.setting-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-right: 12px;
  flex-shrink: 0;
}

.setting-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

.setting-value {
  font-size: 12px;
  color: var(--text-light);
  margin-right: 6px;
}

.setting-arrow {
  color: var(--text-light);
  font-size: 16px;
}

.app-info {
  text-align: center;
  padding: 20px 0 10px;
}

.app-info .logo {
  font-size: 24px;
  margin-bottom: 6px;
}

.app-info .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.app-info .version {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.app-info .slogan {
  font-size: 11px;
  color: var(--accent-deep);
  margin-top: 8px;
  font-style: italic;
}

/* ========== 底部Tab导航 ========== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 414px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-color);
  z-index: 100;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-user-select: none;
  user-select: none;
}

.tab-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 2px;
  transition: transform 0.2s;
}

.tab-label {
  font-size: 11px;
  color: var(--text-light);
  transition: color 0.2s;
}

.tab-item.active .tab-icon {
  transform: translateY(-1px) scale(1.05);
}

.tab-item.active .tab-label {
  color: var(--accent-deep);
  font-weight: 500;
}

/* ========== 页面切换 ========== */
.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 弹窗 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(45, 74, 62, 0.3);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-mask.show {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 22px;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-align: center;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* Toast */
.toast {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(45, 74, 62, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 0;
}

/* 小优化：长文本截断 */
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
