/* ── FLOW DETAIL PANEL · 方向 B 工具架 ── */
/* 氣質：PipoToy 黏土感（沿用既有 token，不另引 CDN） */

#flowDetailOverlay {
  padding: 24px;
}
#flowDetailOverlay .flow-panel {
  width: 100%;
  /* 撐滿可用高度（視窗扣掉 overlay 的 24px 內距，四邊各留一道邊）。
     v2.0.20 曾改成 height:auto 讓對話框縮到內容大小，實測筆記少的流會塌成一條
     窄橫幅、畫布小到不能寫，且每開一條流高度都在跳；「省掉空白」的代價比空白本身大。
     編輯區的可寫高度優先於視覺上的留白，這裡就以視窗為準，不再隨內容縮放。
     內容超出時由各區塊自己捲。手機版在 09-responsive.css 另宣告同樣的 height:100%。 */
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  padding: 24px 26px 20px;
  animation: slideUp 0.3s cubic-bezier(.16,1,.3,1);
  /* 抽屜開啟時加 class，拉開中欄 */
  transition: none;
}
#flowDetailOverlay .flow-panel.is-drawer-open {
  /* 佔位：實際由 grid 控制 */
}
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.flow-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 6px;
}
.flow-name-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-off);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  outline: 0;
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--text);
  line-height: 1.2;
  box-shadow:
    inset 0 2px 4px rgba(58, 58, 61, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.6);
  transition: box-shadow var(--tr), border-color 200ms, background 200ms;
}
.flow-name-input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow:
    inset 0 4px 8px rgba(58, 58, 61, 0.08),
    0 0 0 3px rgba(143, 184, 200, 0.12);
}
.flow-name-input::placeholder { color: var(--faint); }

.flow-detail-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* 進度：標題下安靜一條 */
.flow-progress-tracker {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 360px;
  margin-bottom: 14px;
  padding: 0;
  background: transparent;
}
.flow-progress-tracker span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.flow-progress-bar-track {
  flex: 1;
  height: 10px;
  background: var(--flow-progress-track);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(58, 58, 61, 0.06);
}
.flow-progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--pastel-sky), var(--pastel-lavender));
  transition: width 380ms cubic-bezier(0.34, 1.56, 0.64, 1), background-color var(--tr);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* 主體 grid：畫布 | (抽屜) | 工具條 */
.flow-detail-body {
  display: grid;
  grid-template-columns: 1fr 56px;
  gap: 14px;
  flex: 1;
  min-height: 0;
  transition: grid-template-columns 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.flow-panel.is-drawer-open .flow-detail-body {
  /* 240–280px 放不下附件卡那排按鈕，每張卡都被迫換行且高度各不相同 */
  grid-template-columns: 1fr minmax(300px, 340px) 56px;
}

/* 左：畫布 */
.flow-editor-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.flow-canvas {
  width: 100%;
  /* 不寫死 height:100%：由 flex:1 撐滿「這一列實際多高」，
     而那一列現在由內容決定，不再永遠等於視窗高度 */
  min-height: 280px;
  padding: 18px;
  background: var(--surface-off);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  flex: 1;
  font-size: 13px;
  color: var(--text);
  outline: none;
  resize: none;
  line-height: 1.8;
  font-family: inherit;
  box-shadow:
    inset 0 2px 4px rgba(58, 58, 61, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.6);
  transition: box-shadow var(--tr), border-color 200ms, background 200ms;
}
.flow-canvas:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow:
    inset 0 4px 8px rgba(58, 58, 61, 0.08),
    0 0 0 3px rgba(143, 184, 200, 0.12);
}
.flow-canvas::placeholder { color: var(--faint); }

/* ── 工具條 ── */
.tool-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
}
.tool-rail-btn {
  position: relative;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--tr), box-shadow var(--tr), background 200ms, color 200ms;
}
.tool-rail-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool-rail-btn:hover {
  transform: translateY(-3px) scale(1.06) rotate(-4deg);
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.tool-rail-btn:active {
  transform: translateY(2px) scale(0.96);
}
/* 防雜亂：預設同色，只有 active 上色 */
.tool-rail-btn.is-active[data-tool="stampsTab"] {
  background: var(--pastel-sky);
  color: #2a4a5a;
}
.tool-rail-btn.is-active[data-tool="attachmentsTab"] {
  background: var(--pastel-mint);
  color: var(--stamp-approved-text);
}
.tool-rail-btn.is-active[data-tool="commentsTab"] {
  background: var(--pastel-blush);
  color: var(--stamp-rejected-text);
}
.tool-rail-btn.is-active {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}
.tool-rail-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b86f76;
  box-shadow: 0 0 0 2px var(--surface);
}
.tool-rail-dot[hidden] { display: none; }

/* ── 抽屜 ── */
.tool-drawer {
  display: none;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  min-width: 0;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 14px;
  overflow-x: hidden;
  animation: drawerPop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.flow-panel.is-drawer-open .tool-drawer {
  display: flex;
}
@keyframes drawerPop {
  from { opacity: 0; transform: translateX(14px) scale(0.94); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.tool-drawer-head {
  display: flex;
  align-items: center;
}
.tool-drawer-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.tool-drawer-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* tab 面板：由 JS 切 .active */
.tab-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
}
.tab-panel.active {
  display: flex;
}
#stampsTab { gap: 10px; }

/* ── 審閱蓋章 ── */
.stamp-latest-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stamp-card {
  background: var(--surface-off);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow-xs);
  --stamp-color: var(--stamp-approved);
  border-top: 1px dashed var(--stamp-color);
  border-right: 1px dashed var(--stamp-color);
  border-bottom: 1px dashed var(--stamp-color);
  border-left: 4px solid var(--stamp-color);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: var(--tr);
}
.stamp-card:hover {
  transform: translateY(-2px) rotate(-0.2deg);
  box-shadow: var(--shadow-sm);
}
.stamp-card.approved  { --stamp-color: var(--stamp-approved); }
.stamp-card.reviewing { --stamp-color: var(--stamp-reviewing); }
.stamp-card.rejected  { --stamp-color: var(--stamp-rejected); }
.stamp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stamp-user {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.stamp-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
}
.stamp-badge.approved  { background: var(--stamp-approved);  color: var(--stamp-approved-text); }
.stamp-badge.reviewing { background: var(--stamp-reviewing); color: var(--stamp-reviewing-text); }
.stamp-badge.rejected  { background: var(--stamp-rejected);  color: var(--stamp-rejected-text); }
.stamp-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.stamp-latest-empty {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 8px 0;
}

/* 印章舞台：預設淡，.is-approved 才亮 */
.stamp-graphic-container {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 12px 12px;
  background: var(--surface-off);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(58, 58, 61, 0.05);
}
.test-stamp-preview {
  display: block;
  width: 72%;
  max-width: 140px;
  height: auto;
  margin: 0 auto;
  transform: rotate(-8deg);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.12));
  opacity: 0.28;
  transition: opacity var(--tr), transform var(--tr), filter var(--tr);
}
.stamp-graphic-container.is-approved .test-stamp-preview {
  opacity: 1;
  transform: rotate(-6deg) scale(1.04);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.14));
}
.stamp-graphic-hint {
  margin: 10px 0 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.stamp-graphic-container.is-approved .stamp-graphic-hint {
  color: var(--stamp-approved-text);
}

.stamp-action-zone {
  margin-top: auto;
  flex-shrink: 0; /* 不可被 flex 壓縮裁切（手機窄高時附加說明會消失） */
  background: transparent;
  border-radius: 14px;
  padding: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: hidden; /* 只防水平溢出，垂直必須可見 */
  overflow-y: visible;
}
.stamp-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  overflow-x: hidden;
  overflow-y: visible;
  padding: 2px 0;
}
.stamp-opt-btn {
  width: 100%;
  font-size: 13px;
  font-weight: 700;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--muted);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: var(--tr);
  text-align: center;
  cursor: pointer;
  max-width: 100%;
}
.stamp-opt-btn[data-status="approved"]  { background: var(--pastel-mint); color: var(--stamp-approved-text); }
.stamp-opt-btn[data-status="reviewing"] { background: var(--pastel-butter); color: #6a5a2a; }
.stamp-opt-btn[data-status="rejected"]  { background: var(--pastel-blush); color: var(--stamp-rejected-text); }
/* 抽屜窄：hover 只上下彈，不 rotate 避免橫向溢出 */
.stamp-opt-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-sm);
}
.stamp-opt-btn:active { transform: translateY(1px) scale(0.97); }
.stamp-opt-btn.active { box-shadow: var(--shadow-md); }

#stampNoteInput {
  width: 100%;
  flex-shrink: 0;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.5;
  background: var(--surface-off);
  color: var(--text);
  outline: none;
  font-family: inherit;
  resize: vertical;
  min-height: 56px;
  box-shadow:
    inset 0 2px 4px rgba(58, 58, 61, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.6);
  transition: box-shadow var(--tr), border-color 200ms, background 200ms;
}
#stampNoteInput::placeholder { color: var(--faint); }
#stampNoteInput.approved  {
  border-color: var(--pastel-mint);
  background: color-mix(in srgb, var(--pastel-mint) 14%, var(--surface-off));
}
#stampNoteInput.reviewing {
  border-color: var(--pastel-butter);
  background: color-mix(in srgb, var(--pastel-butter) 14%, var(--surface-off));
}
#stampNoteInput.rejected  {
  border-color: var(--pastel-blush);
  background: color-mix(in srgb, var(--pastel-blush) 14%, var(--surface-off));
}
#stampNoteInput:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow:
    inset 0 4px 8px rgba(58, 58, 61, 0.08),
    0 0 0 3px rgba(143, 184, 200, 0.12);
}

/* ── 附件 ── */
.dropzone {
  border: 1.5px dashed var(--line-dash);
  border-radius: 16px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: var(--tr);
  background: var(--surface-off);
  box-shadow: var(--shadow-xs);
}
.dropzone:hover {
  border-color: var(--primary-soft);
  background: var(--surface);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.dropzone.is-dragging {
  background: var(--surface);
  color: var(--text);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.dropzone:active { transform: translateY(0) scale(0.99); }
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.attachment-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-off);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  transition: var(--tr);
}
.attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  /* 附件面板只有 ~250px：塞不下就讓按鈕整列換到下一行，
     檔名一定要留得住，不能被擠成 0 寬 */
  flex-wrap: wrap;
}
.attachment-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.attachment-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary-soft);
}
.attachment-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  /* 至少要有可讀寬度；不夠就把按鈕擠到下一行，而不是壓縮檔名 */
  flex: 1 1 140px;
}
/* 照片區：縮圖牆 + 一顆整批下載。一張照片一整列會把抽屜拉得很長，
   學校一次就上傳整本相簿——照片是用看的，排成方格才讀得快。 */
.attachment-images {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-off);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.attachment-images-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.attachment-images-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
/* 這一區唯一的主要動作，比照附件卡的「編輯（下載）」用 accent */
.attachment-zip-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--btn-accent-bg);
  border: 1px solid var(--btn-accent-border);
  color: var(--btn-accent-text);
  box-shadow: var(--shadow-xs);
  transition: var(--tr);
  cursor: pointer;
  white-space: nowrap;
}
.attachment-zip-btn:hover {
  border-color: var(--primary);
  transform: translateY(-1.5px) scale(1.04);
  box-shadow: var(--shadow-sm);
}
.attachment-zip-btn:active { transform: translateY(0) scale(0.98); }
/* 三欄方格；抽屜寬度是 300–340px，一格約 90px */
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.attachment-tile {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: var(--tr);
  cursor: pointer;
  aspect-ratio: 1 / 1;
}
.attachment-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.attachment-tile:hover {
  transform: translateY(-1.5px) scale(1.04);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary-soft);
}
.attachment-tile:active { transform: translateY(0) scale(0.98); }
.attachment-tile.is-active {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
/* 點開的大圖：檔名、大小與下載／移除都收在這裡，縮圖牆本身保持乾淨 */
.attachment-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.attachment-preview[hidden] { display: none !important; }
.attachment-preview-image {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--surface-off);
}
/* 純文字，不是連結：下載一律走「編輯（下載）」，避免有人繞過鎖直接把檔案抓走 */
.attachment-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: 10px;
  color: var(--muted);
}
/* 版本資訊：v3 · 上傳者 · 日期 */
.attachment-meta {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 「編輯中」軟鎖：鎖是狀態不是錯誤，用琥珀色而非 --danger——
   跟「移除」共用同一個紅會被讀成「這個檔壞了」。自己鎖著用主色，一眼分得出來。 */
.attachment-lock {
  font-size: 10px;
  font-weight: 600;
  color: var(--lock-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-lock.is-mine { color: var(--primary); }
/* 上傳新版：次要動作，抬起面 + 細邊，不強調顏色 */
.attachment-newversion-btn,
.attachment-download-btn,
.attachment-lock-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  transition: var(--tr);
  cursor: pointer;
  white-space: nowrap;
}
.attachment-newversion-btn:hover,
.attachment-download-btn:hover,
.attachment-lock-btn:hover {
  color: var(--primary);
  border-color: var(--primary-soft);
  transform: translateY(-1.5px) scale(1.04);
  box-shadow: var(--shadow-sm);
}
.attachment-newversion-btn:active,
.attachment-download-btn:active,
.attachment-lock-btn:active { transform: translateY(0) scale(0.98); }

/* 版本數搬到 meta 那一行，動作列從四顆降到三顆。
   仍然是按鈕（有底、有邊、有圓角），只是縮成晶片尺寸——這裡要的是少一顆
   佔位的大按鈕，不是把它變成一段文字連結。 */
.attachment-metarow {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.attachment-metarow .attachment-meta { flex: 0 1 auto; }
.attachment-versions-btn {
  flex: none;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: color 200ms, border-color 200ms;
  cursor: pointer;
  white-space: nowrap;
}
.attachment-versions-btn:hover {
  color: var(--primary);
  border-color: var(--primary-soft);
}

/* 「編輯（下載）」是這張卡唯一的主要動作（取鎖 + 下載，也是唯一的下載入口），
   升到 accent 級：淡染主色、字加深。四顆按鈕全部等重時沒有一顆讀得出是主要動作。
   仍是按鈕外型，只是填色比 primary 少、比 ghost 多。 */
.attachment-lock-btn,
.attachment-download-btn {
  background: var(--btn-accent-bg);
  border-color: var(--btn-accent-border);
  color: var(--btn-accent-text);
}
.attachment-lock-btn:hover,
.attachment-download-btn:hover {
  color: var(--btn-accent-text);
  border-color: var(--primary);
}

/* 就地確認：別人編輯中還要上傳新版、或拖進同名檔案時，都用這一塊，不另開浮層 */
.attachment-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--primary-soft);
}
.attachment-confirm-text {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}
.attachment-confirm-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
/* 虛線框下方那塊要和附件清單留開一點 */
#dropzoneConfirm { margin-top: 8px; }
/* display:flex 會蓋掉瀏覽器對 [hidden] 的 display:none，一定要自己補一條，
   否則收起狀態會留下一個空外框（本檔其他可切換區塊也都是這樣寫的） */
.attachment-confirm[hidden] { display: none; }
.attachment-confirm-cancel,
.attachment-confirm-ok {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-off);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: var(--tr);
  cursor: pointer;
  white-space: nowrap;
}
.attachment-confirm-ok {
  color: #ffffff;
  background: var(--primary);
  border-color: transparent;
}
.attachment-confirm-cancel:hover,
.attachment-confirm-ok:hover {
  transform: translateY(-1.5px) scale(1.04);
  box-shadow: var(--shadow-sm);
}
.attachment-confirm-cancel:active,
.attachment-confirm-ok:active { transform: translateY(0) scale(0.98); }
.attachment-versions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.attachment-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}
.attachment-version-row a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-version-row a:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.attachment-version-row span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.attachment-versions[hidden] { display: none; }
.attachment-versions-loading {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}
/* 影音附件的播放鈕與展開式播放器 */
.attachment-play-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  transition: var(--tr);
  cursor: pointer;
  white-space: nowrap;
}
.attachment-play-btn:hover {
  color: #ffffff;
  background: var(--primary);
  border-color: transparent;
  transform: translateY(-1.5px) scale(1.04);
  box-shadow: var(--shadow-sm);
}
.attachment-play-btn:active { transform: translateY(0) scale(0.98); }
.attachment-player audio {
  display: block;
  width: 100%;
}
.attachment-player video {
  display: block;
  width: 100%;
  max-height: 320px;
  border-radius: 12px;
  background: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ── 討論 ── */
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 4px;
  padding-right: 4px;
  min-height: 80px;
}
.comment-bubble {
  display: flex;
  gap: 10px;
}
.comment-avatar { flex-shrink: 0; }
.comment-body {
  background: var(--surface-off);
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  position: relative;
  transition: var(--tr);
  min-width: 0;
}
.comment-bubble:hover .comment-body {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.comment-delete-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity var(--tr),
    transform var(--tr),
    background 200ms ease,
    color 200ms ease;
}
.comment-bubble:hover .comment-delete-btn {
  opacity: 1;
  transform: scale(1);
}
.comment-delete-btn:hover {
  background: var(--pastel-blush);
  color: #6a3030;
  transform: scale(1.15) rotate(90deg);
}
.comment-delete-btn:active {
  transform: scale(0.85) rotate(90deg);
}
.comment-author-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.comment-author {
  font-size: 11px;
  font-weight: 700;
}
.comment-time {
  font-size: 9px;
  color: var(--muted);
}
.comment-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}
.comment-visibility {
  align-self: flex-start;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--pastel-mint);
  color: var(--stamp-approved-text);
  font-size: 9px;
  font-weight: 700;
}
.comment-visibility.is-internal {
  background: var(--pastel-butter);
  color: var(--stamp-reviewing-text);
}
/* 訪客回覆：與團隊留言明確區分，且沒有刪除鈕 */
.comment-visibility.is-visitor {
  background: var(--pastel-sky);
  color: var(--stamp-reviewing-text);
}
.comment-bubble.is-visitor .comment-body {
  border: 1px dashed rgba(168, 200, 224, .75);
  background: rgba(168, 200, 224, .18);
}
.public-reply-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 11px;
  border-radius: 16px;
  border: 1px solid rgba(240, 200, 120, .45);
  background: rgba(240, 224, 168, .35);
  box-shadow: var(--shadow-xs);
}
.public-reply-panel[hidden] { display: none; }
.public-reply-panel.is-public {
  border-color: rgba(140, 190, 160, .55);
  background: rgba(184, 216, 200, .38);
}
.public-reply-hint {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.public-reply-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 252, 246, .78);
  color: var(--text);
  cursor: pointer;
}
.public-reply-option input {
  margin-top: 2px;
  accent-color: var(--primary);
}
.public-reply-option span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.public-reply-option strong { font-size: 11px; }
.public-reply-option small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}
.public-reply-status {
  margin: 0;
  min-height: 16px;
  color: var(--stamp-reviewing-text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}
.public-reply-panel.is-public .public-reply-status {
  color: var(--stamp-approved-text);
}

/* ── 蓋章公開面板：意見收集 Flow 專用 ── */
.stamp-public-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 11px;
  border-radius: 16px;
  border: 1px solid rgba(240, 200, 120, .45);
  background: rgba(240, 224, 168, .35);
  box-shadow: var(--shadow-xs);
  transition: background var(--tr), border-color var(--tr);
}
.stamp-public-panel[hidden] { display: none; }
.stamp-public-panel.is-public {
  border-color: rgba(140, 190, 160, .55);
  background: rgba(184, 216, 200, .38);
}
.stamp-public-panel.is-warning {
  border-color: rgba(224, 160, 160, .55);
  background: rgba(232, 192, 200, .38);
}
.stamp-public-preview {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.stamp-public-preview strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}
.stamp-public-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 252, 246, .78);
  color: var(--text);
  cursor: pointer;
}
.stamp-public-option input {
  margin-top: 2px;
  accent-color: var(--primary);
}
.stamp-public-option span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stamp-public-option strong { font-size: 11px; }
.stamp-public-option small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}
.stamp-public-status {
  margin: 0;
  min-height: 16px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}
.stamp-public-panel.is-public .stamp-public-status {
  color: var(--stamp-approved-text);
}
.stamp-public-panel.is-warning .stamp-public-status {
  color: var(--stamp-rejected-text);
}

.comment-input-zone {
  margin-top: auto;
  display: flex;
  gap: 8px;
  background: var(--surface-off);
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  transition: var(--tr);
}
.comment-input-zone:focus-within {
  border-color: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.comment-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
  padding: 6px 8px;
  color: var(--text);
  font-family: inherit;
  min-width: 0;
}
.comment-input::placeholder { color: var(--faint); }
#sendCommentBtn {
  padding: 6px 12px;
  font-size: 11px;
  border-radius: 10px;
  flex-shrink: 0;
}

.flow-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  gap: 12px;
}
