/* 工作小宇宙 —— 视觉风格：温暖、友好、清晰易读（成人工作生活效率平台） */
:root {
  --bg: #fff7f0;
  --bg2: #ffeef6;
  --card: #ffffff;
  --ink: #3a3340;
  --ink-soft: #7a7283;
  --primary: #ff9aa2;
  --primary-deep: #ff7e89;
  --accent: #ffd166;
  --accent2: #6fb1ff;
  --ok: #5fbf8f;
  --line: #f0e3da;
  --shadow: 0 8px 24px rgba(180, 120, 120, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg2) 100%);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.6;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* 布局 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--card);
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 20;
  border-bottom: 3px solid var(--primary);
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 30% 30%, #fff, var(--primary));
  box-shadow: 0 0 0 4px var(--bg2);
}
.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-title { font-weight: 900; font-size: 17px; line-height: 1.2; color: var(--ink); }
.brand-sub { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.container { max-width: 980px; margin: 0 auto; padding: 20px; }

/* 状态标签（已开通 / 未开通） */
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 800;
  white-space: nowrap; flex-shrink: 0;
}
.status-pill.ok { background: #e8f8ef; color: #16a34a; }
.status-pill.ok .dot {
  width: 16px; height: 16px; border-radius: 50%; background: #16a34a; color: #fff;
  display: grid; place-items: center; font-size: 10px;
}

/* 按钮 */
.btn {
  display: inline-block; border: none; border-radius: var(--radius-sm); padding: 12px 18px;
  font-weight: 700; font-size: 15px; background: var(--primary);
  color: #fff; box-shadow: var(--shadow); transition: transform .12s ease, background .2s;
  min-height: 44px; text-align: center;
}
.btn:hover { background: var(--primary-deep); }
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--primary-deep); border: 2px solid var(--primary); box-shadow: none; }
.btn.soft { background: var(--bg2); color: var(--ink); box-shadow: none; }
.btn.accent { background: var(--accent); color: #6b4e00; }
.btn.accent:hover { background: #f5c33b; }
.btn.small { padding: 8px 12px; min-height: 38px; font-size: 13px; }
.btn:disabled { background: #e7ddd6; color: #b3a89f; cursor: not-allowed; box-shadow: none; }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); border: 1px solid var(--line); margin-bottom: 16px;
}
.card h3 { margin: 0 0 6px; font-size: 17px; }
.muted { color: var(--ink-soft); font-size: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.badge { display: inline-block; background: var(--bg2); color: var(--primary-deep); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 700; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px; border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: #fffdfb; color: var(--ink); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 80px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin-top: 2px; }

/* 认证页 */
.auth-wrap { max-width: 420px; margin: 40px auto; }
.auth-wrap .card { padding: 26px; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs .btn { flex: 1; }
.tabs .btn.active { background: var(--primary-deep); }
.ref-hint { font-size: 13px; color: #cf8a1f; background: #fff7e6; border: 1px solid #ffd591; padding: 9px 12px; border-radius: 10px; margin-top: 6px; }

/* 用户端顶部操作按钮分组：右对齐、可换行、整齐 */
.topbar-actions {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  justify-content: flex-end; flex-shrink: 0; max-width: 60%;
}
.topbar-actions .btn.small { padding: 7px 12px; min-height: 34px; font-size: 13px; }

/* 模块/任务 */
.module { border-left: 5px solid var(--accent); border-radius: var(--radius-sm); margin-bottom: 14px; overflow: hidden; }
.task-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #f0ece8; background: transparent; min-height: 44px; }
.task-item:last-child { border-bottom: none; }
.task-item.done { background: #f8faf8; }
.task-l { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.task-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-r { flex-shrink: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.task-points { font-weight: 800; color: var(--accent2); white-space: nowrap; }
.done-tag { color: var(--ok); font-weight: 800; font-size: 13px; }

/* 任务详情弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(60,40,50,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: var(--radius); padding: 22px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 4px; }
.close-x { float: right; border: none; background: none; font-size: 22px; color: var(--ink-soft); }

/* 互动控件 */
.quiz-q { margin: 14px 0; padding: 12px; background: var(--bg2); border-radius: var(--radius-sm); }
.quiz-q .q { font-weight: 700; margin-bottom: 8px; }
.quiz-q input { width: 140px; padding: 10px; border: 2px solid var(--line); border-radius: 10px; }
.feedback { margin-top: 8px; font-weight: 700; }
.feedback.right { color: var(--ok); }
.feedback.wrong { color: var(--primary-deep); }
.flip { perspective: 800px; }
.flip-card { width: 100%; min-height: 120px; border-radius: var(--radius-sm); border: 2px solid var(--line); display: grid; place-items: center; padding: 16px; text-align: center; cursor: pointer; transition: transform .4s; transform-style: preserve-3d; background: #fffdfb; }
.flip-card.back { background: var(--bg2); }
.timer-box { font-size: 40px; font-weight: 800; text-align: center; padding: 18px; color: var(--accent2); }
.counter-box { font-size: 40px; font-weight: 800; text-align: center; color: var(--primary-deep); }
.counter-ctrl { display: flex; gap: 12px; justify-content: center; margin: 10px 0; }
.circle-btn { width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--primary); color: #fff; font-size: 26px; font-weight: 800; box-shadow: var(--shadow); }
.circle-btn.minus { background: var(--accent2); }

/* 提示条 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-weight: 700; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.section-title { font-size: 15px; font-weight: 800; color: var(--ink-soft); margin: 22px 0 10px; letter-spacing: .5px; }
.empty { text-align: center; color: var(--ink-soft); padding: 30px; }
.consent-note { font-size: 13px; color: var(--ink-soft); background: var(--bg2); padding: 12px; border-radius: var(--radius-sm); margin-top: 10px; }

/* ========== 工作台仪表盘（默认首页：卡片式模块展示） ========== */

/* 统计卡片区 */
.ws-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.ws-stat-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.ws-stat-card .ws-stat-num {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.2;
}
.ws-stat-card .ws-stat-label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
  font-weight: 600;
}
.ws-stat-card.stars .ws-stat-num { color: #f59e0b; }
.ws-stat-card.tasks .ws-stat-num { color: var(--primary-deep); }
.ws-stat-card.habits .ws-stat-num { color: #16a34a; }

/* 工作区头部（名称 + 描述） */
.ws-header {
  text-align: center;
  padding: 20px 0 8px;
}
.ws-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
}
.ws-header .ws-tagline {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0;
}

/* 模块卡片网格 */
.module-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 16px;
}
.module-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
  overflow: hidden;
}
.module-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(180,120,120,.18); }
.module-card:active { transform: scale(.98); }
.module-card .mc-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 22px;
  margin-bottom: 10px;
  color: #fff;
}
.module-card .mc-title {
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 4px;
  color: var(--ink);
}
.module-card .mc-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 进度条 */
.mc-progress {
  height: 6px;
  background: var(--bg2);
  border-radius: 999px;
  overflow: hidden;
}
.mc-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--ok);
  transition: width .35s ease;
}
.mc-progress-text {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px;
  font-weight: 600;
}

/* 空状态引导 */
.ws-empty {
  text-align: center;
  padding: 40px 20px;
}
.ws-empty-icon {
  font-size: 56px;
  margin-bottom: 12px;
}
.ws-empty h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--ink);
}
.ws-empty p {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 14px;
}

/* 仪表盘顶栏操作 */
.ws-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 配置页视图容器 */
.config-view {
  animation: fadeIn .25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* AI 生成开关 */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg2); border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 700; cursor: pointer; }
.switch-row input[type=checkbox] { width: 22px; height: 22px; }

/* 用户端：我的分享与业绩（分销）卡片 */
.referral-card { border-left: 4px solid var(--primary); }
.ref-head { margin-bottom: 12px; }
.ref-title { font-weight: 800; font-size: 16px; }
.ref-share { display: flex; gap: 8px; margin: 4px 0 14px; }
.ref-share input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; background: var(--bg2); color: var(--ink); }
.ref-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.ref-stat { background: var(--bg2); border-radius: 12px; padding: 12px 6px; text-align: center; }
.ref-stat .n { font-size: 18px; font-weight: 900; color: var(--primary-deep); line-height: 1.2; }
.ref-stat .l { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.ref-detail-title { font-size: 14px; font-weight: 700; margin: 4px 0 8px; }
.ref-list { display: flex; flex-direction: column; gap: 8px; }
.ref-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg2); border-radius: 10px; }
.ref-name { font-weight: 700; font-size: 14px; }
.ref-amt { font-weight: 800; color: #16a34a; font-size: 15px; }

@media (max-width: 760px) {
  .ref-stats { grid-template-columns: repeat(2, 1fr); }
  .ref-share { flex-wrap: wrap; }
  .ref-share input { flex: 1 1 100%; }
  .container { padding: 14px; }
  .topbar { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .topbar-actions { max-width: 100%; flex: 1 1 auto; }
  .brand-title { font-size: 16px; }
  .status-pill { padding: 5px 10px; font-size: 12px; }

  /* 仪表盘移动端适配 */
  .ws-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .ws-stat-card { padding: 12px 6px; }
  .ws-stat-card .ws-stat-num { font-size: 20px; }
  .module-grid { grid-template-columns: 1fr; gap: 12px; }
  .ws-header h2 { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
