/* 老師審核 UI — 簡潔功能優先,無框架 */
* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei",
               "PingFang TC", sans-serif;
  margin: 0;
  background: #f7f8fa;
  color: #2c3e50;
  line-height: 1.6;
}

header {
  background: #2c3e50;
  color: white;
  padding: 0 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
header h1 { margin: 0; font-size: 1.4rem; }
header h1 a { color: white; text-decoration: none; }

/* ─── 頂端頁籤(週觀察記錄 / 活動計畫)─── */
.site-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 4rem;
  font-weight: 500;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;               /* Firefox 隱藏卷軸 */
  -ms-overflow-style: none;            /* IE/舊 Edge */
  -webkit-overflow-scrolling: touch;   /* iOS 滑順 */
}
.site-nav::-webkit-scrollbar { display: none; }
/* !important 打敗 header h1 a 舊 rule 的 color 繼承 */
header .site-nav .site-tab {
  padding: 1.1rem 1.6rem !important;
  color: rgba(255,255,255,0.6) !important;
  font-size: 1.15rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  background: transparent;
  white-space: nowrap;      /* 不換行 */
  flex-shrink: 0;           /* 溢出時觸發 site-nav 的 overflow scroll */
}
header .site-nav .site-tab:hover {
  color: white !important;
  background: rgba(255,255,255,0.08);
}
header .site-nav .site-tab.active {
  color: white !important;
  border-bottom-color: #3498db;
  background: rgba(255,255,255,0.05);
}
.site-nav-spacer { flex: 1; min-width: 0; }
.site-nav .nav-link, .site-nav .logout {
  align-self: center;
  flex-shrink: 0;
}
@media (max-width: 700px) {
  header .site-nav .site-tab { padding: 0.75rem 0.9rem !important; font-size: 1rem !important; }
  header { padding: 0 0.5rem; }
  .site-nav { min-height: 3rem; }
  .site-nav-spacer { display: none; }   /* 讓 tabs / 齒輪 / 登出 直接橫排 + scroll */
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
}

a { color: #3498db; }
code {
  background: #ecf0f1;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: "Consolas", monospace;
  white-space: nowrap;   /* I-1-1 不要被切成一字一行 */
}

/* index page */
.summary {
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  border-left: 4px solid #3498db;
}
.pending-count { color: #e67e22; }

.draft-list {
  width: 100%;
  background: white;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.draft-list th, .draft-list td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid #ecf0f1;
}
.draft-list th { background: #ecf0f1; font-weight: 600; }
.draft-list tr.pending { background: #fffbe6; }
.draft-list tr.confirmed { color: #95a5a6; }

.badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.85em;
  white-space: nowrap;
  display: inline-block;
}
.badge.pending { background: #f39c12; color: white; }
.badge.confirmed { background: #27ae60; color: white; }
.badge.diary-warn {
  background: #eaf6ff;
  color: #2874a6;
  border: 1px solid #b3d9ef;
  cursor: help;
}
.diary-ok { color: #7f8c8d; font-size: 0.9em; }

.empty { color: #95a5a6; padding: 2rem; text-align: center; }

.cumul-link, .final-link {
  margin-left: 0.7rem;
  font-size: 0.85em;
  color: #7f8c8d;
}

.week-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
}
.week-heading-row h2 { margin: 0; }
.batch-link {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  background: #3498db;
  color: white !important;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9em;
}
.batch-link:hover { background: #2980b9; }

/* final view page */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.print-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
}
.print-btn:hover { background: #2980b9; }
.print-btn.alt {
  background: #16a085;
  margin-left: 0.5rem;
}
.print-btn.alt:hover { background: #138a72; }
.print-btn:disabled {
  background: #95a5a6;
  cursor: wait;
}

.final-doc {
  background: white;
  padding: 2rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.md-content h1 { margin-top: 0; }
.md-content h2 {
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 0.3rem;
  margin-top: 1.5rem;
}
.md-content h3 { color: #34495e; }
.md-content blockquote {
  border-left: 3px solid #3498db;
  margin: 0.5rem 0;
  padding: 0.3rem 1rem;
  color: #7f8c8d;
  background: #f8f9fa;
}

.cumul-summary {
  margin: 1rem 0 1.5rem 0;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 6px;
  font-size: 1.1em;
}
.cumul-summary .total-num {
  color: #27ae60;
  font-size: 1.4em;
  display: inline-block;
  margin: 0 0.3rem;
  vertical-align: baseline;
}
.cumul-summary .total-sub {
  color: #7f8c8d;
  font-size: 0.9em;
  margin-left: 0.3rem;
}

.achieved-list-inline {
  margin-left: 7em;
  margin-top: 0.7rem;
  padding: 0.5rem 0;
}
.achieved-list-inline .achieved-item {
  display: grid;
  grid-template-columns: 6em 1fr 9em;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-size: 0.9em;
  border-bottom: 1px dashed #ecf0f1;
}
.achieved-list-inline .first-week { color: #95a5a6; text-align: right; }

/* 成就樹 */
.growth-tree-wrap {
  text-align: center;
  margin: 2rem 0 1rem;
  padding: 1.5rem;
  background: linear-gradient(180deg, #fbfdf9 0%, #f3f9ef 100%);
  border-radius: 12px;
  border: 1px solid #e2eed9;
  position: relative;
}
.growth-tree-wrap.has-photos {
  padding: 145px 130px 40px;
  min-height: 830px;            /* 只用上、左、右 8 個位置,不再需要下排空間 */
}
.growth-tree { width: 100%; max-width: 480px; height: auto; }

/* ── 拍立得散落(高度固定,寬度隨照片比例)── */
.photo-scatter { position: absolute; inset: 0; pointer-events: none; }
.polaroid {
  position: absolute;
  padding: 8px 8px 26px;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  border: 1px solid #eee;
  transform-origin: center center;
}
.polaroid img {
  display: block;
  max-width: 160px;            /* 橫照:寬度上限 160,高度自然縮成 4:3 → 160×120 */
  max-height: 160px;           /* 直照:高度上限 160,寬度自然縮成 3:4 → 120×160 */
  width: auto;
  height: auto;                /* 兩者面積都相等(19200),長邊都 160 */
  background: #f5f5f5;
}
/* 8 個固定位置:上排 4 個 + 左側 2 個 + 右側 2 個(不再有下排)*/
/* 上排:corner 在 left:10,inner 在 left:190(photo 最寬 160,gap 20px) */
.zone-1  { top: 5px;    left: 10px; }
.zone-2  { top: 5px;    left: 190px; }
.zone-3  { top: 5px;    right: 190px; }
.zone-4  { top: 5px;    right: 10px; }
/* 中上排:205px(gap 200)*/
.zone-5  { top: 205px;  left: 10px; }
.zone-6  { top: 205px;  right: 10px; }
/* 中下排:405px */
.zone-7  { top: 405px;  left: 10px; }
.zone-8  { top: 405px;  right: 10px; }

@media (max-width: 700px) {
  .growth-tree-wrap.has-photos {
    padding: 130px 15px 40px;
    min-height: 700px;
  }
  /* 手機只留上排 4 個,左右兩側 4 個藏起來 */
  .zone-5, .zone-6, .zone-7, .zone-8 { display: none; }
  .polaroid { padding: 6px 6px 20px; }
  .polaroid img { max-width: 110px; max-height: 110px; }
}
@media print {
  .polaroid { box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
  /* PDF/A4 頁寬窄(~700px),縮小拍立得 + 拉近側邊距,避免上排重疊 */
  .polaroid img { max-width: 130px; max-height: 130px; }
  .growth-tree-wrap.has-photos {
    padding: 130px 90px 30px;
    min-height: 720px;
  }
  .zone-2 { left: 150px; }
  .zone-3 { right: 150px; }
  .zone-5, .zone-7 { left: 5px; }
  .zone-6, .zone-8 { right: 5px; }
  .zone-5, .zone-6 { top: 175px; }
  .zone-7, .zone-8 { top: 345px; }
}
.tree-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 0.6rem 0;
  font-size: 0.85em;
  color: #555;
}
.tree-legend .leg-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.tree-legend .leg-dot {
  width: 11px; height: 11px; border-radius: 50%;
  display: inline-block;
}
.tree-caption { color: #2c3e50; font-size: 1.05em; margin-top: 0.5rem; }
.tree-caption .tree-sub {
  font-size: 0.82em; color: #7f8c8d; margin-top: 0.4rem; line-height: 1.6;
}

/* 頁尾版號 */
.site-footer {
  text-align: center;
  padding: 1rem;
  color: #95a5a6;
  font-size: 0.78em;
  margin-top: 2rem;
}

/* 登入頁 */
body.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(135deg, #f8fbfd 0%, #eef5f1 100%);
}
.login-card {
  background: white;
  padding: 2.5rem 2.2rem;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.08);
  width: 320px;
  text-align: center;
}
.login-card h1 { font-size: 1.15em; margin: 0 0 0.4rem; color: #2c3e50; }
.login-sub { color: #7f8c8d; margin: 0 0 1.5rem; font-size: 0.95em; }
.login-card input[type="password"] {
  width: 100%; padding: 0.7rem; font-size: 1.3em;
  border: 1px solid #bdc3c7; border-radius: 6px; text-align: center;
  letter-spacing: 0.3em;
}
.login-card button {
  width: 100%; padding: 0.7rem; margin-top: 1rem;
  background: #3498db; color: white;
  border: none; border-radius: 6px; font-size: 1.05em; cursor: pointer;
}
.login-card button:hover { background: #2980b9; }
.login-error { color: #c0392b; margin-top: 0.7rem; font-size: 0.9em; }
.login-footer { color: #95a5a6; font-size: 0.78em; margin-top: 1.5rem; }

/* header 登出 */
header .logout {
  color: rgba(255,255,255,0.7);
  font-size: 0.85em;
  text-decoration: none;
  margin-left: 1em;
  padding: 0.3em 0.5em;
}
header .logout:hover { color: white; }

/* 補勾頁 */
.stage-section { background:white; padding:1.2rem 1.5rem; border-radius:6px;
                  margin-bottom:1.5rem; box-shadow:0 1px 3px rgba(0,0,0,0.05); }
.stage-section h3 { margin-top:0; padding-bottom:0.4rem; border-bottom:2px solid #ecf0f1; }
.domain-block-marks { margin-bottom:1rem; }
.domain-block-marks h4 { margin:0.7rem 0 0.3rem; color:#34495e; font-size:1em; }
.marks-table { width:100%; border-collapse:collapse; font-size:0.93em; }
.marks-table tr { border-bottom:1px dashed #ecf0f1; }
.marks-table tr:hover { background:#fafafa; }
.marks-table td { padding:0.35rem 0.4rem; vertical-align:middle; }
.marks-table .cell-toggle { width:2.4em; text-align:center; }
.marks-table .cell-code { width:5em; }
.marks-table .cell-code code { font-size:0.85em; }
.marks-table .cell-title { color:#2c3e50; }
.marks-table .cell-source select { padding:0.2rem; font-size:0.85em; max-width:11em; }
.marks-table .cell-note input { width:95%; padding:0.2rem 0.4rem; font-size:0.85em;
                                  border:1px solid #ddd; border-radius:3px; }
.marks-table .cell-source select:disabled,
.marks-table .cell-note input:disabled { background:#f5f5f5; color:#bbb; }
.marks-table .cell-meta { width:6em; text-align:right; }
.marks-table .row-diary { background:#eef5ff; }
.marks-table .row-diary .cell-title { color:#1864ab; }
.marks-table .row-manual .cell-title { color:#0c6e3e; font-weight:500; }
.lock-mark { font-size:0.9em; }
.src-tag { font-size:0.78em; padding:1px 6px; border-radius:8px; }
.src-tag.diary { background:#d0e3fd; color:#1864ab; }
.src-tag.manual { background:#d6f0e0; color:#0c6e3e; }

/* 月報「本月點亮的能力」chip */
.ability-chip {
  display: inline-block;
  margin: 0.25rem 0.3rem 0.25rem 0;
  padding: 0.35rem 0.85rem;
  background: #eafaf1;
  color: #1e7e4f;
  border: 1px solid #abe6c8;
  border-radius: 16px;
  font-size: 0.95em;
  line-height: 1.5;
}
.ability-chip.super {
  background: #fff6e0;
  color: #b8860b;
  border-color: #f0d28a;
  font-weight: 600;
}

/* 月報審核:雙欄 */
.monthly-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.monthly-edit section { margin-bottom: 1rem; padding: 1rem; }
.monthly-edit textarea {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95em;
  line-height: 1.7;
  resize: vertical;
}
.monthly-preview {
  background: white;
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: sticky;
  top: 1rem;
  align-self: start;
  max-height: 85vh;
  overflow-y: auto;
}
.preview-label {
  font-weight: 600;
  color: #16a085;
  margin-bottom: 0.7rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid #ecf0f1;
}
@media (max-width: 900px) {
  .monthly-grid { grid-template-columns: 1fr; }
  .monthly-preview { position: static; max-height: none; }
}

/* 批次下載:每個 doc 之間有分頁 */
.batch-doc {
  margin-bottom: 1.5rem;
}
.batch-doc + .batch-doc {
  border-top: 3px double #bdc3c7;
  padding-top: 2rem;
}

/* 列印樣式 — 把 PDF 印出來時用 */
/* ───── 手機 / 窄螢幕適配(< 700px)───── */
@media print {
  body { background: white; }
  header, .action-bar, .no-print { display: none !important; }
  main { max-width: 100%; padding: 0; }
  .final-doc {
    box-shadow: none;
    padding: 1cm 1.5cm;     /* 內側留白:上下 1cm,兩邊 1.5cm */
    border-radius: 0;
    margin: 0;
  }
  .domain-block { break-inside: avoid; }
  .domain-bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .stage-chip { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  h2, h3 { break-after: avoid; }
  .achieved-item { break-inside: avoid; }
  .ability-chip { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .growth-tree-wrap, .growth-tree, .tree-legend .leg-dot {
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
  .growth-tree-wrap { break-inside: avoid; }
  @page { margin: 0.5cm; }   /* 外層列印機保留小邊距,實際留白靠 .final-doc 的 padding */

  /* 批次模式:每位孩子強制分頁 */
  .batch-doc {
    break-before: page;
    padding: 1cm 1.5cm !important;
    border-top: none !important;
  }
  .batch-doc:first-of-type { break-before: auto; }
}

/* 班級篩選 chip */
.filter-bar {
  margin-bottom: 1rem;
  color: #7f8c8d;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.filter-group { display: inline-flex; align-items: center; gap: 0.3rem; }
.filter-bar select {
  padding: 0.3rem 0.7rem;
  border: 1px solid #bdc3c7;
  border-radius: 6px;
  background: white;
  font-size: 0.95em;
  color: #34495e;
  cursor: pointer;
}
.filter-bar select:hover { border-color: #3498db; }
.filter-chip {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  margin: 0 0.2rem;
  background: white;
  border: 1px solid #bdc3c7;
  border-radius: 16px;
  text-decoration: none;
  font-size: 0.9em;
  color: #34495e;
  transition: all 0.15s;
}
.filter-chip:hover { background: #ecf0f1; }
.filter-chip.active {
  background: #3498db;
  color: white;
  border-color: #3498db;
  font-weight: 600;
}

/* 姓名 / 代號 / 暱稱 顯示 */
.child-name { font-size: 1.05em; }
.nickname { color: #7f8c8d; font-weight: normal; font-size: 0.9em; margin-left: 0.3rem; }
.child-code {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 1px 7px;
  background: #ecf0f1;
  color: #95a5a6;
  border-radius: 3px;
  font-family: "Consolas", monospace;
  font-size: 0.75em;
  vertical-align: middle;
}

/* draft page */
.back {
  display: inline-block;
  margin-bottom: 1rem;
  text-decoration: none;
}

.draft-header {
  background: white;
  padding: 1.5rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.draft-header h2 { margin: 0 0 0.3rem 0; }
.draft-header .age-info {
  color: #34495e;
  font-size: 0.95em;
  margin-bottom: 0.5rem;
  padding: 0.3rem 0.7rem;
  background: #ecf0f1;
  display: inline-block;
  border-radius: 4px;
}
.draft-header .stats { color: #7f8c8d; }
.warn {
  background: #fff3cd;
  padding: 0.7rem;
  border-radius: 4px;
  border-left: 3px solid #f39c12;
  margin: 0.5rem 0;
}

.info-note {
  background: #eaf6ff;
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  border-left: 3px solid #3498db;
  margin: 0.5rem 0;
  color: #2c3e50;
  font-size: 0.92em;
}
.info-note strong { color: #2874a6; }

/* 月報照片上傳區 */
.photo-panel {
  border: 1px solid #d5dbdb;
  border-radius: 6px;
  background: #fdfdfd;
  padding: 1rem 1.2rem 1.2rem;
  margin: 1rem 0 1.5rem;
  transition: background 0.15s, border-color 0.15s;
}
.photo-panel.drag-over {
  background: #eaf5ff;
  border-color: #3498db;
}
.photo-panel-head h3 {
  margin: 0 0 0.3rem 0;
  font-size: 1.05rem;
}
.photo-count {
  color: #7f8c8d;
  font-weight: normal;
  font-size: 0.9em;
  margin-left: 0.5rem;
}
.photo-batch-btn {
  margin-left: 0.8rem;
  padding: 0.25rem 0.7rem;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 3px;
  font-size: 0.85em;
  cursor: pointer;
  font-family: inherit;
  font-weight: normal;
}
.photo-batch-btn:hover { background: #2980b9; }
.photo-batch-status {
  margin-left: 0.6rem;
  color: #27ae60;
  font-size: 0.85em;
  font-weight: normal;
}
.photo-hint {
  color: #7f8c8d;
  font-size: 0.85em;
  margin: 0 0 0.8rem 0;
}
.photo-hint strong { color: #c0392b; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
}
.photo-slot {
  aspect-ratio: 4 / 3;
  position: relative;
}
.photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: 2px dashed #bdc3c7;
  border-radius: 4px;
  color: #95a5a6;
  cursor: pointer;
  position: relative;
  background: #fafafa;
  transition: background 0.15s, border-color 0.15s;
}
.photo-empty:hover {
  background: #f0f8ff;
  border-color: #3498db;
  color: #3498db;
}
.photo-plus {
  font-size: 1.8em;
  font-weight: 300;
}
.photo-slot-num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.75em;
  color: #bdc3c7;
}
.photo-filled {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
}
.photo-filled img {
  width: 100%;
  height: 100%;
  object-fit: contain;    /* 保留原比例:直照顯示直、橫照顯示橫,不切臉 */
  background: #f5f5f5;
  display: block;
}
.photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.85em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.photo-del:hover { background: #e74c3c; }

@media (max-width: 700px) {
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
}

section {
  background: white;
  padding: 1.5rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
section h3 {
  margin-top: 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #ecf0f1;
}

/* hit card */
.hit-card {
  border: 1px solid #ecf0f1;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: all 0.2s;
}
.hit-card[data-action="confirm"] { border-left: 4px solid #27ae60; }
.hit-card[data-action="modify"] { border-left: 4px solid #3498db; background: #f0f8ff; }
.hit-card[data-action="remove"] {
  border-left: 4px solid #e74c3c;
  background: #fff0f0;
  opacity: 0.6;
}

.hit-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.hit-header .domain { color: #7f8c8d; font-size: 0.9em; }
.hit-header .date { margin-left: auto; color: #95a5a6; font-size: 0.85em; }

.strength-badge.strong { background: #d4edda; color: #155724; }
.strength-badge.medium { background: #fff3cd; color: #856404; }
.strength-badge {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: 600;
}

.hit-evidence {
  background: #f8f9fa;
  padding: 0.7rem 1rem;
  border-radius: 4px;
  margin: 0.5rem 0;
  font-size: 0.95em;
}
.hit-evidence .evidence-item {
  padding: 0.4rem 0;
  border-bottom: 1px dashed #ecf0f1;
}
.hit-evidence .evidence-item:last-child { border-bottom: none; }
.hit-evidence .evidence-item.excluded {
  opacity: 0.45;
  background: #fdf0f0;
}
.hit-evidence .ev-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}
.hit-evidence .ev-exclude {
  font-size: 0.82em;
  color: #c0392b;
  cursor: pointer;
  user-select: none;
}
.hit-evidence .ev-date {
  display: inline-block;
  font-size: 0.8em;
  color: #95a5a6;
  background: white;
  padding: 1px 6px;
  border-radius: 3px;
  margin-bottom: 0.2rem;
}
.hit-evidence .quote {
  color: #2c3e50;
  font-style: italic;
  border-left: 2px solid #bdc3c7;
  padding-left: 0.7rem;
  margin: 0.2rem 0;
}
.hit-evidence .summary { color: #7f8c8d; font-size: 0.9em; }
.hit-header .evidence-count {
  margin-left: auto;
  font-size: 0.85em;
  color: #27ae60;
  background: #d4edda;
  padding: 1px 8px;
  border-radius: 10px;
}

.hit-actions {
  display: flex;
  gap: 1rem;
  margin: 0.7rem 0;
}
.hit-actions label { cursor: pointer; user-select: none; }

.modify-area, .note-area {
  margin-top: 0.5rem;
}
.note-area input[type="text"], .modify-area textarea {
  width: 100%;
  padding: 0.4rem 0.7rem;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95em;
  margin-top: 0.2rem;
}

/* uncertain */
.uncertain-card {
  border: 1px solid #f39c12;
  background: #fff8e1;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: all 0.2s;
}
.uncertain-card[data-action="remove"] {
  border-color: #e74c3c;
  background: #fff0f0;
  opacity: 0.7;
}
.uncertain-actions {
  display: flex;
  gap: 1rem;
  margin: 0.7rem 0;
  padding-top: 0.5rem;
  border-top: 1px dashed #f39c12;
}
.uncertain-actions label { cursor: pointer; user-select: none; }
.uncertain-card[data-action="remove"] .uncertain-actions {
  border-top-color: #e74c3c;
}
.uncertain-card .quote {
  font-style: italic;
  border-left: 3px solid #f39c12;
  padding-left: 0.7rem;
  margin-bottom: 0.5rem;
}
.uncertain-card .meta { font-size: 0.9em; color: #7f8c8d; margin-bottom: 0.5rem; }
.uncertain-card .related-section { margin-bottom: 0.7rem; }
.uncertain-card .related-label {
  color: #7f8c8d;
  font-size: 0.9em;
  margin-bottom: 0.3rem;
}
.uncertain-card .related-indicator {
  display: grid;
  grid-template-columns: 5.5em 6em 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.95em;
}
.uncertain-card .ind-code {
  text-align: left;
}
.uncertain-card .ind-domain {
  color: #95a5a6;
  font-size: 0.88em;
}
.uncertain-card .ind-title {
  color: #2c3e50;
}
.uncertain-card .ind-missing {
  color: #c0392b;
  font-size: 0.9em;
  font-style: italic;
}
.uncertain-card .summary { margin-bottom: 0.7rem; }
.judgments {
  border: 1px dashed #f39c12;
  padding: 0.7rem;
  border-radius: 4px;
}
.judgments legend { padding: 0 0.5rem; font-weight: 600; }
.judgments label { display: block; margin: 0.2rem 0; cursor: pointer; }

/* 移除原因(reason chips) */
.reason-chips {
  border: 1px dashed #e74c3c;
  padding: 0.7rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}
.reason-chips legend { padding: 0 0.5rem; font-weight: 600; color: #c0392b; }
.reason-chips label { display: block; margin: 0.2rem 0; cursor: pointer; font-size: 0.95em; }

/* untouched */
.untouched ul { list-style: none; padding: 0; }
.untouched li {
  padding: 0.5rem 1rem;
  background: #fdf3f3;
  border-left: 3px solid #e74c3c;
  margin-bottom: 0.5rem;
  border-radius: 3px;
}
.untouched-domain {
  background: #fdf3f3;
  border-left: 3px solid #e74c3c;
  padding: 0.7rem 1rem;
  margin-bottom: 0.7rem;
  border-radius: 3px;
}
.untouched-header { margin-bottom: 0.5rem; }
.suggestions { margin-top: 0.3rem; }
.suggestion-item {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.4rem 0.6rem;
  background: #fff;
  border: 1px solid #f5cccc;
  border-radius: 3px;
  margin-bottom: 0.4rem;
}
.sug-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.85em;
  color: #999;
  white-space: nowrap;
  padding-top: 0.2rem;
}
.sug-body { flex: 1; }
.sug-meta {
  font-size: 0.8em;
  color: #7f8c8d;
  margin-bottom: 0.2rem;
}
.sug-meta .sug-type { color: #2c3e50; font-weight: 600; margin-right: 0.5rem; }
.sug-meta .sug-codes { color: #999; }
.suggestion-item textarea {
  width: 100%;
  font-size: 0.9em;
  padding: 0.35rem;
  border: 1px solid #ddd;
  border-radius: 3px;
  resize: vertical;
  min-height: 40px;
  font-family: inherit;
}

/* writing feedback */
.feedback-item {
  background: #f0f8ff;
  border-left: 3px solid #3498db;
  padding: 0.7rem 1rem;
  margin-bottom: 0.7rem;
  border-radius: 3px;
}
.feedback-item .date { color: #7f8c8d; font-size: 0.85em; }
.feedback-item .suggestion { margin-top: 0.3rem; color: #2c3e50; }

/* signature */
.signature label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.signature input[type="text"] {
  flex: 1;
  padding: 0.5rem 0.8rem;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 1em;
}
.submit-btn {
  background: #27ae60;
  color: white;
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 6px;
  font-size: 1.05em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.submit-btn:hover { background: #229954; }

/* cumulative page */
.cumul-header {
  background: white;
  padding: 1.5rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.cumul-header h2 { margin: 0 0 0.3rem 0; }
.cumul-header .total-stat {
  margin-top: 0.7rem;
  font-size: 1.1em;
  color: #34495e;
}
.cumul-header .total-num {
  color: #27ae60;
  font-size: 1.4em;
  display: inline-block;
  margin: 0 0.3rem;
  vertical-align: baseline;
}
.cumul-header .total-sub {
  color: #7f8c8d;
  font-size: 0.9em;
  margin-left: 0.3rem;
}

.domain-progress { /* uses default section */ }
.domain-block {
  margin-bottom: 1.8rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #ecf0f1;
}
.domain-block:last-child { border-bottom: none; }

.domain-row {
  display: grid;
  grid-template-columns: 6em 1fr 5em;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.domain-name {
  font-weight: 600;
  color: #2c3e50;
}
.domain-bar-wrap {
  background: #ecf0f1;
  border-radius: 12px;
  height: 24px;
  position: relative;
  overflow: visible;
}
.domain-bar {
  background: linear-gradient(90deg, #3498db 0%, #27ae60 100%);
  height: 100%;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0.7rem;
  min-width: 0;
  transition: width 0.3s;
}
.bar-label {
  color: white;
  font-size: 0.85em;
  font-weight: 600;
}
.bar-label-outside {
  position: absolute;
  right: -3em;
  top: 50%;
  transform: translateY(-50%);
  color: #7f8c8d;
  font-size: 0.85em;
}
.domain-stat {
  color: #34495e;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stage-breakdown {
  margin-left: 7em;
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.stage-chip {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  background: #ecf0f1;
  border-radius: 12px;
  font-size: 0.85em;
  color: #34495e;
}
.stage-chip.primary {
  background: #d4edda;
  color: #155724;
  font-weight: 600;
}
.stage-chip.empty {
  color: #95a5a6;
  background: #f8f9fa;
}

.achieved-detail {
  margin-left: 7em;
  margin-top: 0.5rem;
}
.achieved-detail summary {
  cursor: pointer;
  color: #3498db;
  font-size: 0.9em;
}
.achieved-detail summary:hover { text-decoration: underline; }
.achieved-detail ul {
  list-style: none;
  padding: 0.5rem 0 0 0;
  margin: 0;
}
.achieved-detail li {
  padding: 0.3rem 0;
  display: grid;
  grid-template-columns: 6em 1fr 9em;
  gap: 0.5rem;
  align-items: center;
  border-bottom: 1px solid #f8f9fa;
}
.achieved-detail .ind-title { color: #2c3e50; }
.achieved-detail .first-week {
  color: #95a5a6;
  font-size: 0.85em;
  text-align: right;
}

/* ═══════════════════════════════════════════
   手機 / 窄螢幕適配(< 700px)
   放在檔尾確保壓過所有桌機定義
   ═══════════════════════════════════════════ */
@media (max-width: 700px) {
  main { padding: 1rem 0.8rem; }
  header { padding: 0.8rem 1rem; }
  header h1 { font-size: 1.1rem; }

  /* 累計頁:領域進度條 */
  .domain-row {
    grid-template-columns: 1fr auto !important;
    row-gap: 0.3rem;
  }
  .domain-name { grid-column: 1 / -1 !important; font-size: 1em; }
  .domain-bar-wrap { grid-column: 1 / 2 !important; height: 22px; }
  .domain-stat { grid-column: 2 / 3 !important; }
  .bar-label-outside { right: 0; top: -1.3em; }

  /* 領域內細項清單 — 用 flex 簡單可靠 */
  .stage-breakdown,
  .achieved-detail,
  .achieved-list-inline { margin-left: 0 !important; }

  .achieved-detail li,
  .achieved-list-inline .achieved-item {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0;
    grid-template-columns: none;  /* 取消桌機的 grid */
  }
  .achieved-detail li > code,
  .achieved-list-inline .achieved-item > code {
    flex: 0 0 auto;
  }
  .achieved-detail li > .ind-title,
  .achieved-list-inline .achieved-item > .ind-title {
    flex: 1 1 0;
    min-width: 0;
  }
  .achieved-detail li > .first-week,
  .achieved-list-inline .achieved-item > .first-week {
    flex-basis: 100%;
    text-align: right;
    font-size: 0.78em;
  }

  /* 補勾頁:表格改卡片式 */
  .marks-table, .marks-table tbody, .marks-table tr, .marks-table td {
    display: block;
  }
  .marks-table tr {
    padding: 0.6rem 0;
    border-bottom: 1px solid #ecf0f1;
  }
  .marks-table td { padding: 0.2rem 0; }
  .marks-table .cell-toggle,
  .marks-table .cell-code,
  .marks-table .cell-meta {
    display: inline-block;
    width: auto;
    margin-right: 0.5rem;
  }
  .marks-table .cell-title { display: block; margin: 0.2rem 0; }
  .marks-table .cell-source select { width: 100%; max-width: 100%; }
  .marks-table .cell-note input { width: 100%; }

  /* index 清單 */
  .draft-list { font-size: 0.9em; }
  .draft-list td, .draft-list th { padding: 0.4rem 0.4rem; }
  .draft-list td:nth-child(2) { white-space: nowrap; }
  /* 動作欄連結每連結獨立一行,寬度緊湊 */
  .draft-list td a {
    display: block;
    margin: 0.1rem 0;
    white-space: nowrap;
  }
  /* 月成長報告:月份已改放在區段標題,表格僅 3 欄(孩子/狀態/動作) */
}

/* ───── 排程設定頁 ───── */
.nav-link {
  font-size: 0.85em;
  font-weight: normal;
  margin-left: 1em;
  color: #7f8c8d;
  text-decoration: none;
}
.nav-link:hover { color: #2c3e50; text-decoration: underline; }

/* 齒輪圖示專用(在深藍 header 上,所以走白色色階) */
header .nav-gear {
  font-size: 1.3em;
  line-height: 1;
  display: inline-block;
  color: rgba(255,255,255,0.7);
  transition: transform 0.3s ease, color 0.2s ease;
}
header .nav-gear:hover {
  color: white;
  text-decoration: none;
  transform: rotate(60deg);
}

/* 彩色 emoji(例如 👥)對 CSS color 無效。用 text-shadow 陰影當顏色,
   把原字變透明 → 視覺上只剩陰影 → 變成單色白,跟齒輪一致 */
header .nav-icon-mono {
  color: transparent;
  text-shadow: 0 0 0 rgba(255,255,255,0.7);
  transition: text-shadow 0.2s ease;
}
header .nav-icon-mono:hover {
  text-shadow: 0 0 0 white;
  transform: none;  /* 不要繼承 nav-gear 的旋轉 */
}

.admin-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1.2em 1.5em;
  margin: 1.5em 0;
  background: #fafafa;
}
.admin-card h3 { margin-top: 0; }

.schedule-form { display: flex; flex-direction: column; gap: 0.8em; max-width: 30em; }
.schedule-row { display: flex; align-items: center; gap: 0.5em; }
.schedule-row select { padding: 0.3em 0.5em; font-size: 1em; }

.btn-primary {
  background: #3498db;
  color: white;
  border: none;
  padding: 0.5em 1.2em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  align-self: flex-start;
  margin-top: 0.5em;
}
.btn-primary:hover { background: #2980b9; }

.admin-actions {
  display: inline-block;
  margin-right: 0.8em;
  margin-bottom: 0.5em;
}

.schedule-preview {
  background: #fef9e7;
  border: 1px solid #f7dc6f;
  border-radius: 6px;
  padding: 0.9em 1.2em;
  margin-top: 1.2em;
  font-size: 0.95em;
}
.schedule-preview .preview-row {
  margin: 0.4em 0 0 0;
  color: #4a5568;
}
.schedule-preview .preview-row code {
  background: #fff;
  padding: 0.1em 0.5em;
  border-radius: 3px;
  border: 1px solid #f1c40f;
  font-size: 0.95em;
}
.schedule-preview .preview-warn {
  background: #fdebd0;
  border-left: 3px solid #e67e22;
  padding: 0.5em 0.8em;
  margin-top: 0.7em;
  color: #6e2c00;
  font-size: 0.9em;
  line-height: 1.5;
}

.run-card {
  border-left: 3px solid #3498db;
  padding: 0.6em 0 0.6em 1em;
  margin: 1em 0;
  background: #fafbfc;
}
.run-card .hint {
  color: #5d6d7e;
  font-size: 0.9em;
  margin: 0.4em 0 0 0;
  padding-left: 0.3em;
}
.run-card .hint code {
  background: #ecf0f1;
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.95em;
}
.admin-actions button {
  padding: 0.6em 1.2em;
  font-size: 1em;
  cursor: pointer;
  border: 1px solid #aaa;
  background: white;
  border-radius: 4px;
}
.admin-actions button:hover:not(:disabled) { background: #ecf0f1; }
.admin-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.banner {
  padding: 0.6em 1em;
  border-radius: 4px;
  margin: 1em 0;
}
.banner-ok  { background: #d5f4e6; color: #1e6e3e; }
.banner-err { background: #fadbd8; color: #922b21; }
.banner-info { background: #d6eaf8; color: #1b4f72; }

.job-summary {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 0.6em 1em;
  border-radius: 4px;
  font-size: 0.85em;
  overflow-x: auto;
  white-space: pre-wrap;
}

.muted { color: #7f8c8d; font-size: 0.92em; }

/* ───── Tab Navigation (index page) ───── */
.tab-nav {
  display: flex;
  gap: 0.3rem;
  border-bottom: 2px solid #ecf0f1;
  margin-bottom: 1.5rem;
}
.tab-nav .tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.4rem;
  font-size: 1.05em;
  color: #7f8c8d;
  text-decoration: none;
  border-radius: 6px 6px 0 0;
  position: relative;
  bottom: -2px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab-nav .tab:hover {
  background: #f8f9fa;
  color: #2c3e50;
}
.tab-nav .tab.active {
  color: #2c3e50;
  font-weight: 600;
  border-bottom-color: #3498db;
  background: white;
}
.tab-nav .tab-badge {
  background: #e67e22;
  color: white;
  font-size: 0.75em;
  font-weight: 600;
  padding: 0.1em 0.5em;
  border-radius: 10px;
  min-width: 1.4em;
  text-align: center;
}
.tab-nav .tab.active .tab-badge {
  background: #d35400;
}

@media (max-width: 700px) {
  .tab-nav .tab { padding: 0.6rem 0.9rem; font-size: 0.95em; }
}

/* ═══════════════════════════════════════════════════════════
   活動計畫(Phase 1)
   ═══════════════════════════════════════════════════════════ */
.ap-page, .ap-edit-page {
  max-width: 900px;
  margin: 0 auto;
}
.ap-intro {
  color: #7f8c8d;
  line-height: 1.7;
  background: #f8fbfd;
  padding: 0.8rem 1rem;
  border-left: 3px solid #3498db;
  border-radius: 3px;
  margin: 1rem 0 1.5rem;
}
.ap-quick-add {
  margin: 1rem 0 1.5rem;
  padding: 0.8rem 1rem;
  background: #f0f8ec;
  border-radius: 4px;
}
.ap-quick-label {
  color: #34495e;
  margin-right: 0.5rem;
  font-weight: 600;
}
.ap-quick-btn {
  display: inline-block;
  padding: 0.35em 0.9em;
  margin-right: 0.5rem;
  background: #27ae60;
  color: white !important;
  border-radius: 3px;
  text-decoration: none;
  font-size: 0.95em;
}
.ap-quick-btn:hover { background: #229954; }

.ap-week-list {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
.ap-week-list th, .ap-week-list td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid #ecf0f1;
  text-align: left;
}
.ap-week-list th {
  background: #f8fbfd;
  color: #7f8c8d;
  font-weight: 600;
  font-size: 0.9em;
}
.ap-updated {
  color: #95a5a6;
  font-size: 0.88em;
  font-family: monospace;
}

.ap-help { margin-top: 2rem; color: #7f8c8d; }
.ap-help summary { cursor: pointer; padding: 0.4rem 0; }
.ap-jump-form { margin: 0.6rem 0; }
.ap-jump-form input {
  padding: 0.35em 0.6em;
  border: 1px solid #bdc3c7;
  border-radius: 3px;
  margin: 0 0.5rem;
}
.ap-hint {
  color: #7f8c8d;
  font-size: 0.88em;
  margin: 0.3rem 0;
}

/* ── 編輯頁 ── */
.ap-header {
  margin-bottom: 1rem;
}
.ap-header h2 { margin: 0.3rem 0; }
.ap-week-range { color: #7f8c8d; font-weight: normal; font-size: 0.7em; }
.ap-flash {
  padding: 0.7rem 1rem;
  background: #fef5e7;
  border-left: 3px solid #f39c12;
  border-radius: 3px;
  margin: 1rem 0;
  color: #7d6608;
}
.ap-existing, .ap-add, .ap-import, .ap-kb-lookup {
  margin: 2rem 0;
}
.ap-existing h3, .ap-add h3, .ap-import h3, .ap-kb-lookup summary {
  color: #2c3e50;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 0.3rem;
  margin-bottom: 1rem;
}
.ap-activity-card {
  background: #fff;
  border: 1px solid #e0e6ed;
  border-radius: 5px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}
.ap-inline-form .ap-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.ap-inline-form label {
  min-width: 90px;
  font-weight: 600;
  color: #34495e;
  padding-top: 0.4rem;
}
.ap-inline-form input[type=text],
.ap-inline-form textarea,
.ap-inline-form input[type=file] {
  flex: 1;
  padding: 0.4em 0.6em;
  border: 1px solid #bdc3c7;
  border-radius: 3px;
  font-size: 0.95em;
  font-family: inherit;
}
.ap-inline-form textarea { resize: vertical; }
.ap-radio {
  min-width: 0 !important;
  padding-top: 0.4rem !important;
  font-weight: normal !important;
  margin-right: 1rem;
}
.ap-actions {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.5rem;
  padding-left: 100px;
}
.ap-actions .btn-primary {
  background: #3498db; color: white; border: none;
  padding: 0.45em 1em; border-radius: 3px; cursor: pointer;
  font-size: 0.92em;
}
.ap-actions .btn-primary:hover { background: #2980b9; }
.ap-actions .btn-danger {
  background: #e74c3c; color: white; border: none;
  padding: 0.45em 1em; border-radius: 3px; cursor: pointer;
  font-size: 0.92em;
}
.ap-actions .btn-danger:hover { background: #c0392b; }

.ap-ind-preview {
  padding-left: 100px;
  margin: 0.5rem 0 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.ap-ind-chip {
  display: inline-block;
  padding: 0.15em 0.55em;
  background: #eaf6fd;
  border: 1px solid #a9d0e8;
  border-radius: 3px;
  font-size: 0.82em;
  color: #21618c;
}
.ap-ind-chip.invalid {
  background: #fadbd8; border-color: #e6b0aa; color: #922b21;
}

.ap-new-form {
  background: #f8fbfd;
  border: 1px solid #d5dbdb;
  border-radius: 5px;
  padding: 1rem 1.2rem;
}

/* ── 指標速查 ── */
.ap-kb-search input {
  width: 100%;
  padding: 0.5em 0.8em;
  border: 1px solid #bdc3c7;
  border-radius: 3px;
  margin-bottom: 0.6rem;
}
.ap-kb-scroll {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #ecf0f1;
  padding: 0.6rem;
  background: #fbfcfc;
}
.ap-kb-domain {
  color: #2c3e50;
  margin: 1rem 0 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px dashed #bdc3c7;
}
.ap-kb-domain:first-child { border-top: none; padding-top: 0; }
.ap-kb-stage {
  margin: 0.6rem 0 0.8rem;
  padding-left: 0.6rem;
}
.ap-kb-stage-label {
  display: inline-block;
  padding: 0.1em 0.5em;
  background: #ecf0f1;
  border-radius: 2px;
  font-size: 0.82em;
  color: #566573;
  margin-bottom: 0.35rem;
}
.ap-kb-item {
  padding: 0.15rem 0.3rem;
  font-size: 0.9em;
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}
.ap-kb-code {
  background: #eaeded;
  padding: 0.1em 0.4em;
  border-radius: 2px;
  font-family: monospace;
  cursor: pointer;
  color: #2c3e50;
  user-select: none;
  transition: background 0.15s;
}
.ap-kb-code:hover { background: #d5dbdb; }
.ap-kb-title { color: #34495e; }

@media (max-width: 700px) {
  .ap-inline-form .ap-row { flex-direction: column; gap: 0.2rem; }
  .ap-inline-form label { padding-top: 0; }
  .ap-actions, .ap-ind-preview { padding-left: 0; }
}

/* ── M2:活動計畫頁面 header 匯出按鈕 ── */
.ap-header-actions { margin-top: 0.6rem; display: flex; gap: 0.6rem; }
.ap-btn-secondary {
  display: inline-block;
  padding: 0.4em 0.9em;
  background: #fff;
  color: #2c3e50 !important;
  border: 1px solid #bdc3c7;
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.92em;
}
.ap-btn-secondary:hover { background: #ecf0f1; border-color: #95a5a6; }

/* ── 省思 textarea ── */
.ap-reflection {
  background: #fef9e7;
  border-color: #f7dc6f !important;
}
.ap-reflection:focus { background: #fefbf1; }

/* ── 照片區(在活動卡片下方,獨立於 update form)── */
.ap-photos-section {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px dashed #ecf0f1;
}
.ap-photos-label { color: #34495e; font-weight: 600; margin-bottom: 0.4rem; }
.ap-photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-start;
}
.ap-photo-thumb {
  position: relative;
  width: 110px;
  height: 110px;
  border: 1px solid #d5dbdb;
  border-radius: 3px;
  overflow: hidden;
  background: #f8fbfd;
}
.ap-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ap-photo-del-form {
  position: absolute;
  top: 2px; right: 2px;
  margin: 0;
}
.ap-photo-del {
  background: rgba(0, 0, 0, 0.55);
  color: white;
  border: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}
.ap-photo-del:hover { background: #e74c3c; }

.ap-photo-upload-form {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.ap-photo-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 110px;
  border: 2px dashed #bdc3c7;
  border-radius: 3px;
  color: #7f8c8d;
  cursor: pointer;
  font-size: 0.9em;
  background: #fbfcfc;
  transition: background 0.15s, border-color 0.15s;
}
.ap-photo-upload-btn:hover {
  background: #ecf0f1;
  border-color: #7f8c8d;
  color: #2c3e50;
}
.ap-photo-count {
  color: #95a5a6;
  font-size: 0.85em;
}
.ap-photo-full {
  padding: 0.5rem 0.8rem;
  color: #95a5a6;
  font-size: 0.9em;
  background: #ecf0f1;
  border-radius: 3px;
}

/* Top nav 待審 badge */
header .site-tab-badge {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0.05em 0.55em;
  background: #e67e22;
  color: white !important;
  font-size: 0.72em;
  font-weight: 700;
  border-radius: 10px;
  vertical-align: middle;
  line-height: 1.6;
}
header .site-tab.active .site-tab-badge { background: #d35400; }

/* ── M2:分星期 group ── */
.ap-day-group { margin: 1.5rem 0 2rem; }
.ap-day-title {
  background: #2c3e50;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 5px 5px 0 0;
  margin: 0 0 0.6rem;
  font-size: 1.05em;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.ap-day-title .ap-day-count {
  font-size: 0.82em;
  color: rgba(255, 255, 255, 0.7);
  font-weight: normal;
}
.ap-day-empty {
  padding: 0.7rem 1rem;
  color: #bdc3c7;
  font-size: 0.9em;
  background: #fafbfc;
  border: 1px dashed #ecf0f1;
  border-radius: 3px;
  text-align: center;
}

/* 所有 dropdown 統一格式(星期 / 班級)*/
.ap-inline-form select {
  padding: 0.4em 0.6em;
  border: 1px solid #bdc3c7;
  border-radius: 3px;
  font-size: 0.95em;
  font-family: inherit;
  background: white;
  min-width: 130px;
}

/* M2:5 個新欄位 UI */
.ap-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  padding-top: 0.35rem;
  flex: 1;
}
.ap-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15em 0.5em;
  background: #f8fbfd;
  border: 1px solid #d5dbdb;
  border-radius: 3px;
  font-weight: normal !important;
  cursor: pointer;
  min-width: 0 !important;
  color: #2c3e50;
  font-size: 0.92em;
}
.ap-checkbox:hover { background: #eaf6fd; border-color: #a9d0e8; }
.ap-checkbox input[type=checkbox] { margin: 0; cursor: pointer; }
.ap-checkbox input[type=checkbox]:checked + span,
.ap-checkbox:has(input[type=checkbox]:checked) {
  background: #eaf6fd;
  border-color: #3498db;
  color: #21618c;
  font-weight: 600 !important;
}

.ap-short-input {
  max-width: 200px !important;
  flex: 0 1 200px !important;
}

/* ═══ 活動計畫月曆 ═══ */
.ap-cal-page { max-width: 1200px; margin: 0 auto; }
.ap-cal-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0 0.4rem;
}
.ap-cal-nav h2 { margin: 0; color: #2c3e50; }
.ap-cal-navbtn {
  padding: 0.4em 1em;
  background: #ecf0f1;
  color: #2c3e50 !important;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.95em;
}
.ap-cal-navbtn:hover { background: #d5dbdb; }
.ap-cal-today {
  margin-left: auto;
  padding: 0.4em 1em;
  background: #3498db;
  color: white !important;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9em;
}
.ap-cal-today:hover { background: #2980b9; }
.ap-cal-intro {
  color: #7f8c8d;
  font-size: 0.9em;
  margin: 0.3rem 0 1rem;
  padding: 0.5rem 0.8rem;
  background: #f8fbfd;
  border-left: 3px solid #3498db;
  border-radius: 3px;
}

.ap-cal-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.ap-cal-table th {
  padding: 0.6rem 0;
  background: #2c3e50;
  color: white;
  text-align: center;
  font-weight: 600;
  border: 1px solid #34495e;
}
.ap-cal-table th.ap-cal-weekend-head { background: #c0392b; }

.ap-cal-cell {
  vertical-align: top;
  height: 110px;
  width: calc(100% / 7);
  border: 1px solid #ecf0f1;
  padding: 0;
  background: white;
  transition: background 0.15s;
}
.ap-cal-cell.other-month { background: #fafbfc; color: #bdc3c7; }
.ap-cal-cell.weekend { background: #fef5f3; }
.ap-cal-cell.today { background: #e8f5fd; }
.ap-cal-cell.has-acts { background: #f0f8ec; }

.ap-cal-cell-link {
  display: block;
  padding: 0.4rem 0.5rem;
  height: 100%;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.ap-cal-cell-link:hover { background: rgba(52, 152, 219, 0.1); }

.ap-cal-date {
  font-weight: 700;
  color: #2c3e50;
  font-size: 1rem;
  margin-bottom: 0.3rem;
}
.ap-cal-cell.weekend .ap-cal-date { color: #c0392b; }
.ap-cal-cell.other-month .ap-cal-date { color: #bdc3c7; }
.ap-cal-weekend-label {
  color: #c0392b;
  font-size: 0.75em;
  padding: 0 0.5rem;
}
.ap-cal-today-badge {
  display: inline-block;
  background: #3498db;
  color: white;
  font-size: 0.65em;
  padding: 0.05em 0.4em;
  border-radius: 2px;
  vertical-align: middle;
  margin-left: 0.3em;
  font-weight: normal;
}

.ap-cal-acts {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ap-cal-act {
  padding: 0.12em 0.35em;
  margin-bottom: 0.15em;
  background: #27ae60;
  color: white;
  border-radius: 2px;
  font-size: 0.78em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-cal-more {
  color: #7f8c8d;
  font-size: 0.78em;
  padding: 0.1em 0.35em;
  font-style: italic;
}
.ap-cal-empty {
  color: #bdc3c7;
  font-size: 0.82em;
  padding: 0.5rem 0.3rem;
  text-align: center;
  border: 1px dashed transparent;
  border-radius: 3px;
}
.ap-cal-cell-link:hover .ap-cal-empty {
  color: #3498db;
  border-color: #a9d0e8;
}

/* 從月曆點過來時 highlight 的日組 */
.ap-day-focused .ap-day-title {
  background: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

@media (max-width: 700px) {
  .ap-cal-cell { height: 80px; }
  .ap-cal-act { font-size: 0.7em; }
}

/* 5 個新欄位:inline row(兩欄並排)*/
.ap-row-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem !important;
}
.ap-row-inline .ap-inline-label {
  min-width: auto !important;
  padding-top: 0 !important;
  margin-left: 0.8rem;
}
.ap-tiny-input { max-width: 200px !important; flex: 0 1 200px !important; }
.ap-row-inline .ap-inline-label { padding-top: 0.4rem !important; }
@media (max-width: 700px) {
  /* 手機上一列改直排(flex-direction: column),flex 的 200px 會變成「高度」→ 格子變很大;改回一般寬度 */
  .ap-short-input, .ap-tiny-input { flex: none !important; width: 100%; }
  .ap-ind-picker { flex: none; width: 100%; max-width: 100%; }   /* 指標選單的字很長,不限寬會把整頁撐寬 */
  .ap-row-inline .ap-inline-label { margin-left: 0; }
}

/* 參與孩子(0.7.0)*/
.ap-row-participants { align-items: flex-start; }
.ap-participant-mode {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding-top: 0.35rem;
}
.ap-participants-list {
  margin: 0 0 0.8rem 6.5rem;   /* 對齊到 label 右側 */
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.ap-participant-hint { font-size: 0.9em; }
.ap-participant-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.35rem 1rem;
  margin-top: 0.4rem;
}
.ap-participant-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.92em;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
  cursor: pointer;
}
.ap-participant-check:hover { background: rgba(52,152,219,0.08); }
.ap-participant-check input[type=checkbox] { margin: 0; }
.ap-participant-summary {
  margin-top: 0.5rem;
  font-size: 0.85em;
}
@media (max-width: 700px) {
  .ap-participants-list { margin-left: 0; }
}

/* 快速加入指標下拉 */
.ap-ind-picker {
  flex: 1 1 auto;
  max-width: 520px;
  padding: 0.4rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  font-size: 0.9em;
}
.ap-ind-picker-hint {
  font-size: 0.8em;
  color: #94a3b8;
}

/* 班級 chip + 班級 filter tabs */
.ap-class-chip {
  display: inline-block;
  padding: 0.15em 0.6em;
  background: #16a085;
  color: white;
  border-radius: 3px;
  font-size: 0.82em;
  margin-bottom: 0.5rem;
}
.ap-class-filter {
  margin: 1rem 0;
  padding: 0.6rem 0.9rem;
  background: #f8fbfd;
  border-radius: 4px;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.ap-class-filter-label { color: #7f8c8d; font-size: 0.9em; margin-right: 0.5rem; }
.ap-class-tab {
  padding: 0.3em 0.9em;
  background: white;
  color: #2c3e50 !important;
  border: 1px solid #d5dbdb;
  border-radius: 3px;
  text-decoration: none;
  font-size: 0.92em;
}
.ap-class-tab:hover { background: #ecf0f1; }
.ap-class-tab.active { background: #3498db; color: white !important; border-color: #2980b9; }

/* KB 標題附註 hint */
.ap-kb-hint {
  font-size: 0.82em;
  color: #7f8c8d;
  font-weight: normal;
}

/* 月曆內活動的班級小 tag */
.ap-cal-classtag {
  background: #16a085;
  padding: 0 0.3em;
  border-radius: 2px;
  font-size: 0.9em;
  margin-right: 0.2em;
}

.ap-day-title .ap-day-date {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.85);
  font-weight: normal;
  font-family: monospace;
}

/* 活動卡摺疊 details/summary UI */
details.ap-activity-card {
  background: #fff;
  border: 1px solid #e0e6ed;
  border-radius: 5px;
  padding: 0;
  margin-bottom: 0.8rem;
  overflow: hidden;
}
details.ap-activity-card summary.ap-activity-summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  background: #f8fbfd;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
  user-select: none;
  transition: background 0.15s;
}
details.ap-activity-card summary.ap-activity-summary::-webkit-details-marker {
  display: none;
}
details.ap-activity-card summary.ap-activity-summary::before {
  content: "▶";
  color: #7f8c8d;
  font-size: 0.75em;
  transition: transform 0.15s;
  display: inline-block;
}
details.ap-activity-card[open] summary.ap-activity-summary::before {
  transform: rotate(90deg);
}
details.ap-activity-card summary.ap-activity-summary:hover {
  background: #eaf6fd;
}
details.ap-activity-card[open] summary.ap-activity-summary {
  background: #eaf6fd;
  border-bottom: 1px solid #d5dbdb;
}
.ap-summary-name {
  font-weight: 600;
  color: #2c3e50;
  flex: 1;
}
.ap-summary-badge {
  padding: 0.1em 0.55em;
  background: #16a085;
  color: white;
  border-radius: 3px;
  font-size: 0.82em;
}
.ap-summary-count {
  color: #7f8c8d;
  font-size: 0.85em;
}
details.ap-activity-card > form,
details.ap-activity-card > .ap-photos-section {
  padding: 1rem 1.2rem;
}

/* 儲存 + 刪除 按鈕同寬同高 */
.ap-actions .btn-primary,
.ap-actions .btn-danger {
  width: 9em !important;
  min-width: 9em !important;
  text-align: center;
  padding: 0.55em 0 !important;
  flex: 0 0 9em;
  margin: 0 !important;      /* 打敗 .btn-primary { margin-top: 0.5em } */
  align-self: stretch !important;   /* 打敗 .btn-primary { align-self: flex-start } */
  line-height: 1.4;
}

/* AI 反思 source badge */
.ap-refl-badge {
  display: inline-block;
  margin-left: 0.6em;
  padding: 0.1em 0.55em;
  border-radius: 3px;
  font-size: 0.75em;
  font-weight: 500;
  vertical-align: middle;
}
.ap-refl-badge-ai { background: #fef5e7; color: #b7791f; border: 1px solid #f6dc94; }
.ap-refl-badge-teacher { background: #e6f7ee; color: #257242; border: 1px solid #a9dcbf; }

/* 週報 §5 本週適性活動計畫 —— 兩種 context 各自套樣式:
   - Draft(審核)頁:外層 .week-activities-section → 內部維持原本卡片式(和 §3-§4 一致)
   - Final(已審)頁:外層 .md-content 內直接放 → 純 markdown 文字流
*/
.week-activities { margin: 0.5rem 0; }

/* 共用:reflection / 徽章 / 提示(兩種 context 都一樣)*/
.wact-refl-label { color: #7f8c8d; font-weight: 600; font-size: 0.88em; margin-right: 0.4em; }
.wact-refl-hint { color: #b7791f; font-size: 0.78em; margin-left: 0.5em; font-style: italic; }
.wact-badge { display: inline-block; padding: 0.1em 0.55em; border-radius: 3px;
              font-size: 0.75em; font-weight: 500; }
.wact-badge-ai { background: #fef5e7; color: #b7791f; border: 1px solid #f6dc94; }
.wact-badge-teacher { background: #e6f7ee; color: #257242; border: 1px solid #a9dcbf; }
.wact-hint { margin-top: 0.6rem; color: #7f8c8d; font-size: 0.85em; }
.wact-participants { font-size: 0.85em; margin-bottom: 0.35rem; }
.wact-indicators { font-size: 0.85em; color: #5b6b7a; margin-bottom: 0.35rem; line-height: 1.55; }
.wact-ind-chip { display: inline; }

/* Draft view:卡片式(和其他 §3-§4 evidence 卡片同視覺重量)*/
.week-activities-section .wact-day-group {
  margin: 1rem 0 1.5rem; padding: 0.8rem 1rem;
  background: #fafbfc; border-left: 3px solid #16a085; border-radius: 3px;
}
.week-activities-section .wact-day-title { margin: 0 0 0.5rem; color: #2c3e50; font-size: 1em; font-weight: 600; }
.week-activities-section .wact-card {
  padding: 0.7rem 0.9rem; background: white; border: 1px solid #e0e6ed;
  border-radius: 4px; margin-bottom: 0.6rem;
}
.week-activities-section .wact-card:last-child { margin-bottom: 0; }
.week-activities-section .wact-name { font-weight: 600; color: #2c3e50; margin-bottom: 0.3rem; }
.week-activities-section .wact-content { color: #566573; font-size: 0.92em; line-height: 1.6; }
.week-activities-section .wact-reflection { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px dashed #ecf0f1; }
.week-activities-section .wact-refl-text { color: #34495e; line-height: 1.65; margin-top: 0.3rem; padding-left: 0.5rem; }

/* Final view:純文字流(和 markdown 產出的 §3、§4 一致)*/
.md-content .week-activities .wact-day-group { margin: 0.9rem 0 1rem; }
.md-content .week-activities .wact-day-title { margin: 0 0 0.35rem; color: #2c3e50; font-size: 1em; font-weight: 600; }
.md-content .week-activities .wact-card { padding: 0.2rem 0 0.5rem 1.2rem; }
.md-content .week-activities .wact-card + .wact-card { margin-top: 0.4rem; }
.md-content .week-activities .wact-name { font-weight: 600; color: #2c3e50; margin-bottom: 0.15rem; }
.md-content .week-activities .wact-content { color: #566573; font-size: 0.94em; line-height: 1.65; margin-bottom: 0.35rem; }
.md-content .week-activities .wact-reflection { margin-top: 0.35rem; }
.md-content .week-activities .wact-refl-text { color: #34495e; line-height: 1.65; margin-top: 0.2rem; padding-left: 0.5rem; }

.wact-missing { color: #b7791f; font-size: 0.82em; font-weight: normal; margin-left: 0.4em; }

.ap-summary-badge-empty { background: #fef5e7 !important; color: #b7791f !important; }

/* 放假日活動:整張卡 dim + badge 米黃 + 反思區變灰字提示 */
.ap-summary-badge-holiday {
  background: #fff3e0 !important;
  color: #d35400 !important;
  border: 1px solid #f5c381 !important;
}
details.ap-activity-holiday { background: #fafbfc; }
details.ap-activity-holiday > summary { opacity: 0.88; }
.ap-refl-holiday-note {
  color: #7f8c8d;
  font-style: italic;
  padding: 0.6rem 0.9rem;
  background: #f5f7fa;
  border-radius: 4px;
  border: 1px dashed #d5dbe0;
  margin-top: 0.3rem;
}
.ap-row-holiday {
  background: #fff8ec;
  border-radius: 5px;
  padding: 0.4rem 0.7rem;
  border: 1px solid #f5e3b8;
  margin-bottom: 0.6rem;
}
.ap-checkbox-holiday {
  font-weight: 500;
  color: #d35400;
  cursor: pointer;
}
.ap-checkbox-holiday input { margin-right: 0.4em; vertical-align: middle; }

/* 週報 §5 放假日卡片樣式 */
.wact-card-holiday {
  background: #fafbfc !important;
  border-left: 3px solid #f5c381 !important;
  opacity: 0.85;
}
.wact-card-holiday .wact-name { color: #d35400; }
.wact-holiday-note {
  font-size: 0.82em;
  color: #95a5a6;
  font-style: italic;
  padding: 0.1rem 0 0.2rem 1.4rem;
}

/* 活動卡 view / edit 模式切換 */
/* View 模式:欄位看起來像純文字 */
.ap-inline-form.ap-mode-view input[type=text],
.ap-inline-form.ap-mode-view input[type=number],
.ap-inline-form.ap-mode-view textarea,
.ap-inline-form.ap-mode-view select {
  background: transparent !important;
  border-color: transparent !important;
  cursor: default !important;
  color: #2c3e50;
  pointer-events: none;
  box-shadow: none;
}
.ap-inline-form.ap-mode-view input[type=checkbox] { pointer-events: none; }
.ap-inline-form.ap-mode-view .ap-checkbox {
  pointer-events: none;
  background: transparent !important;
  border-color: transparent !important;
}
.ap-inline-form.ap-mode-view .ap-checkbox:has(input:checked) {
  background: #eaf6fd !important;
  border-color: #3498db !important;
}
.ap-inline-form.ap-mode-view .ap-btn-save,
.ap-inline-form.ap-mode-view .ap-btn-cancel { display: none !important; }
.ap-inline-form.ap-mode-view .ap-btn-edit { display: inline-block !important; }

/* Edit 模式:一般可編輯樣式(預設)*/
.ap-inline-form.ap-mode-edit .ap-btn-edit { display: none !important; }
.ap-inline-form.ap-mode-edit .ap-btn-save,
.ap-inline-form.ap-mode-edit .ap-btn-cancel { display: inline-block !important; }
/* Edit 模式時給整卡加藍色外框提示 */
.ap-inline-form.ap-mode-edit { background: #fefefe; border-left: 4px solid #3498db; padding-left: 0.8rem; }

/* Cancel 按鈕(灰色) */
.ap-actions .btn-secondary {
  background: #95a5a6 !important; color: white; border: none;
  padding: 0.55em 0 !important; border-radius: 3px; cursor: pointer;
  width: 9em !important; min-width: 9em !important;
  text-align: center; margin: 0 !important;
  align-self: stretch !important; line-height: 1.4;
}
.ap-actions .btn-secondary:hover { background: #7f8c8d !important; }

/* 反思確認按鈕 */
.ap-refl-confirm-form { margin: 0.6rem 0 0; padding: 0.5rem 0.9rem;
                        background: #fef9e7; border-radius: 4px;
                        border-left: 3px solid #f39c12; }
.ap-btn-refl-confirm {
  background: #27ae60; color: white; border: none;
  padding: 0.4em 1em; border-radius: 3px; cursor: pointer;
  font-size: 0.92em; font-weight: 500;
}
.ap-btn-refl-confirm:hover { background: #229954; }

/* 反思在 view 模式 + source=ai 時:主表單反思欄隱藏,下方 AI 草擬區顯示 */
details.ap-activity-card[data-refl-source="ai"] form.ap-mode-view .ap-refl-row { display: none; }
details.ap-activity-card:not([data-refl-source="ai"]) .ap-refl-ai-box,
details.ap-activity-card form.ap-mode-edit ~ .ap-refl-ai-box { display: none; }

/* AI 草擬待確認框樣式 */
.ap-refl-ai-box {
  margin: 0.8rem 1.2rem;
  padding: 1rem 1.2rem;
  background: #fef9e7;
  border: 1px solid #f7dc6f;
  border-left: 4px solid #f39c12;
  border-radius: 5px;
}
.ap-refl-ai-header { margin-bottom: 0.6rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.ap-refl-ai-hint { color: #7d6608; font-size: 0.85em; }
.ap-refl-ai-text {
  padding: 0.6rem 0.8rem; background: white; border-radius: 3px;
  color: #34495e; line-height: 1.7; margin-bottom: 0.7rem; white-space: pre-wrap;
}
.ap-refl-confirm-form-inline { margin: 0; }

/* AI 反思 textarea(可直接編輯)*/
.ap-refl-ai-textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: white;
  border: 1px solid #e0d7a6;
  border-radius: 3px;
  color: #34495e;
  font-family: inherit;
  font-size: 0.95em;
  line-height: 1.7;
  margin-bottom: 0.7rem;
  resize: vertical;
  box-sizing: border-box;
}
.ap-refl-ai-textarea:focus { border-color: #f39c12; outline: none; box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.15); }

/* ── 本月月報操作區(cumulative 頁,方案 A:手動觸發月報) ── */
.monthly-generate-box {
  background: #f8fbfd;
  border: 1px solid #d5dfe6;
  border-left: 4px solid #3498db;
  padding: 1rem 1.2rem;
  border-radius: 4px;
  margin: 1rem 0 1.5rem;
}
.monthly-generate-box .mg-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.monthly-generate-box .mg-title {
  font-weight: 600;
  color: #2c3e50;
  font-size: 1.05em;
}
.monthly-generate-box .mg-grad-badge {
  background: #f39c12;
  color: white;
  padding: 0.1em 0.5em;
  border-radius: 3px;
  font-size: 0.85em;
}
.monthly-generate-box .mg-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 3px;
  font-size: 0.95em;
  cursor: pointer;
  font-family: inherit;
}
.monthly-generate-box .mg-btn-primary {
  background: #3498db;
  color: white;
}
.monthly-generate-box .mg-btn-primary:hover:not(:disabled) { background: #2980b9; }
.monthly-generate-box .mg-btn-disabled {
  background: #bdc3c7;
  color: #7f8c8d;
  cursor: not-allowed;
}
.monthly-generate-box .mg-btn:disabled { opacity: 0.7; cursor: wait; }
.monthly-generate-box .mg-link {
  display: inline-block;
  color: #2980b9;
  text-decoration: none;
  font-weight: 500;
  padding: 0.3rem 0;
}
.monthly-generate-box .mg-link:hover { text-decoration: underline; }
.monthly-generate-box .mg-hint {
  margin: 0.4rem 0 0;
  color: #7f8c8d;
  font-size: 0.88em;
}
.monthly-generate-box .mg-hint.muted { color: #95a5a6; font-style: italic; }
.monthly-generate-box .mg-flash {
  padding: 0.5rem 0.8rem;
  border-radius: 3px;
  margin-bottom: 0.6rem;
  font-size: 0.92em;
}
.monthly-generate-box .mg-flash-error {
  background: #fdecea;
  color: #c0392b;
  border-left: 3px solid #c0392b;
}
.monthly-generate-box .mg-flash-success {
  background: #eafaf1;
  color: #27ae60;
  border-left: 3px solid #27ae60;
}

/* 表格裡的小提醒(.warn 是整塊的提示框,放在格子裡會蓋到上一行) */
.warn-tag {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 0.1rem 0.45rem;
  background: #fff3cd;
  border-radius: 4px;
  color: #b9770e;
  font-size: 0.85em;
  white-space: nowrap;
}

/* 頁內分頁(托育名冊、設定共用) */
.roster-tabs { display: flex; gap: 0; border-bottom: 2px solid #ecf0f1; margin: 1rem 0; }
.roster-tab {
  padding: 0.6rem 1.2rem; color: #7f8c8d; text-decoration: none;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.roster-tab.active { color: #2c3e50; border-color: #3498db; font-weight: 600; }
.roster-tab:hover { background: #f8fbfd; }
@media (max-width: 600px) { .roster-tab { padding: 0.6rem 0.6rem; } }

/* header 的線條圖示(SVG,跟齒輪同色) */
header .nav-svg { display: inline-flex; align-items: center; color: rgba(255,255,255,0.7); }
header .nav-svg:hover { color: white; text-decoration: none; }
header .nav-svg svg { width: 1.35em; height: 1.35em; }
header .nav-svg.active { color: white; }
