:root {
  --brand: #8B5FA8;
  --brand-dark: #6E4A87;
  --bg-light: #FBF6FC;
  --bg-light-2: #F3E8F5;
  --pink-bg: #FDECEF;
  --pink-accent: #B6537A;
  --grad-start: #B57FC7;
  --grad-end: #8B5FA8;
  --text-main: #3A2E42;
  --text-sub: #7A6B85;
  --white: #FFFFFF;
  --radius: 16px;
  --radius-sm: 10px;
  --green: #2E9E5B;
  --yellow: #E0A82E;
  --red: #D64545;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-light);
  color: var(--text-main);
  line-height: 1.5;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 100px;
}

/* ---------- 頁首 ---------- */
/* max-width+margin:auto 令頁首喺闊屏(例如摺疊屏展開態)同 .container 對齊置中,唔會拉到成個螢幕咁闊 */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(139,95,168,0.08);
  max-width: 480px;
  margin: 0 auto;
}
.topbar img.mascot-mini { width: 32px; height: 32px; }
.topbar .brand-name { font-weight: 700; font-size: 18px; color: var(--brand); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(139,95,168,0.08);
}
.card h3 { margin: 0 0 10px; font-size: 16px; color: var(--brand-dark); }
.card .hint { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: linear-gradient(90deg, var(--grad-start), var(--grad-end)); color: #fff; width: 100%; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ---------- 表單 ---------- */
label.field-label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=number], input[type=date], input[type=month], input[type=password], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #E4D9EA;
  font-size: 15px;
  background: var(--white);
  color: var(--text-main);
}
textarea { resize: vertical; min-height: 60px; }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid #E4D9EA;
  background: var(--white);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.chip.selected { background: var(--brand); color: #fff; border-color: var(--brand); }

.err-msg { color: var(--red); font-size: 13px; margin-top: 6px; }

/* ---------- 進度條 ---------- */
.progress-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-light-2);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--grad-start), var(--grad-end));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ---------- 狀態燈(語意色,唔可以改紫色) ---------- */
.status-light { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.status-light.green { background: #E7F6EC; color: var(--green); }
.status-light.yellow { background: #FDF3DD; color: var(--yellow); }
.status-light.red { background: #FCEAEA; color: var(--red); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.red { background: var(--red); }

/* ---------- 里程碑路線圖 ---------- */
.milestone-track { display: flex; justify-content: space-between; margin: 16px 0 6px; }
.milestone { text-align: center; flex: 1; font-size: 11px; color: var(--text-sub); }
.milestone .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--bg-light-2); margin: 0 auto 6px; }
.milestone.reached .dot { background: var(--brand); }
.milestone.reached { color: var(--brand-dark); font-weight: 600; }

/* ---------- 清單 ---------- */
.checklist-group { margin-bottom: 12px; }
.checklist-group h4 { font-size: 14px; color: var(--text-sub); margin: 16px 0 8px; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-light-2);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.checklist-item.done { background: #E9F7EE; }
.checklist-item.done label { text-decoration: line-through; color: var(--text-sub); }
.checklist-item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); }
.checklist-item label { flex: 1; font-size: 14px; }
.guide-tag {
  font-size: 11px;
  background: var(--pink-bg);
  color: var(--pink-accent);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- 底部導航 ---------- */
/* left:50%+translateX 令底部導航喺闊屏(摺疊屏展開態)都同頁首、.container 對齊置中 */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--white);
  display: flex;
  box-shadow: 0 -1px 6px rgba(139,95,168,0.1);
  z-index: 20;
}
.tabbar a {
  flex: 1;
  text-align: center;
  padding: 10px 0 8px;
  font-size: 12px;
  color: var(--text-sub);
  text-decoration: none;
}
.tabbar a.active { color: var(--brand); font-weight: 700; }
.tab-section { display: none; }
.tab-section.active { display: block; }

/* ---------- 案例卡 ---------- */
.case-card { border-left: 3px solid var(--brand); padding-left: 12px; margin-bottom: 12px; }
.case-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.case-card .tag { font-size: 11px; background: var(--bg-light-2); color: var(--brand-dark); padding: 2px 8px; border-radius: 999px; }
.case-card .tag.warn { background: var(--pink-bg); color: var(--pink-accent); }

/* ---------- 空狀態 ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-sub); }
.empty-state img { width: 80px; margin-bottom: 12px; opacity: 0.8; }

/* ---------- 導流 footer ---------- */
.footer-cta {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: var(--bg-light-2);
  border-radius: var(--radius);
  margin-top: 20px;
}
.footer-cta img { width: 44px; height: 44px; border-radius: 50%; }
.footer-cta p { margin: 0; font-size: 13px; color: var(--text-main); }

/* ---------- 分享圖預覽 ---------- */
#shareCanvas { width: 100%; max-width: 340px; border-radius: var(--radius); display: block; margin: 0 auto; box-shadow: 0 4px 20px rgba(139,95,168,0.2); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(58,46,66,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-box { background: #fff; border-radius: var(--radius); padding: 24px; max-width: 360px; width: 100%; text-align: center; }
.modal-box img.mascot-celebrate { width: 100px; margin-bottom: 12px; }

/* ---------- 後台專用(廣東話繁體) ---------- */
.admin-body { background: #F5F5F7; position: relative; }
.admin-body::before {
  content: '';
  position: fixed;
  /* 闊屏(摺疊屏展開態)時 .container 置中喺480px欄,呢度令背景圖跟返個欄嘅右邊,唔會飄到去畫面最右 */
  right: max(0px, calc(50% - 240px));
  bottom: 0;
  width: 340px;
  height: 251px;
  background-image: url('/assets/images/admin-bg.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom right;
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
}
.admin-body > * { position: relative; z-index: 1; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin-table th, table.admin-table td { padding: 8px; border-bottom: 1px solid #eee; text-align: left; }
table.admin-table th { color: var(--text-sub); font-weight: 600; }
