/* tyn-volunter -- shared UI framework (F7-1).
   Two layout modes, chosen in base.html by whether `user` is set:
   - .auth-page  : dark card-centered layout for login/forgot/reset password
   - .app-shell  : light sidebar + content layout for everything else
*/

:root {
  --auth-bg: #0f172a;
  --auth-card-bg: #1e293b;
  --auth-border: #334155;
  --auth-title: #f1f5f9;
  --auth-subtitle: #94a3b8;
  --auth-label: #7dd3c0;
  --auth-input-bg: #0f172a;
  --auth-input-border: #334155;
  --auth-input-text: #e2e8f0;

  --shell-bg: #f8fafc;
  --sidebar-bg: #ffffff;
  --sidebar-border: #e2e8f0;
  --sidebar-active-bg: #ccfbf1;
  --sidebar-active-text: #0f766e;

  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --table-header-bg: #f1f5f9;

  --accent: #0d9488;
  --accent-hover: #0f766e;
  --error: #dc2626;
  --error-bg: #fef2f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    "PingFang TC",
    "Microsoft JhengHei",
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--text-primary);
}

h1 {
  font-size: 1.375rem;
  margin: 0 0 1rem;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: -0.75rem 0 1.25rem;
}

a {
  color: var(--accent);
}

/* ---------- auth pages (login / forgot / reset password) ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  background: var(--auth-bg);
  padding: 2rem 1rem;
}

.auth-header {
  text-align: center;
  color: var(--auth-title);
}

.auth-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.auth-logo-link {
  display: inline-block;
  flex-shrink: 0;
}

.auth-logo {
  display: block;
  height: 2.5rem;
  width: auto;
  border-radius: 0.25rem;
}

.auth-header h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.auth-header p {
  margin: 0;
  color: var(--auth-subtitle);
  font-size: 0.9rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--auth-card-bg);
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  padding: 2rem;
  color: var(--auth-title);
}

.auth-card h1 {
  color: var(--auth-title);
}

.auth-card label {
  color: var(--auth-label);
}

.auth-card input {
  background: var(--auth-input-bg);
  border: 1px solid var(--auth-input-border);
  color: var(--auth-input-text);
}

.auth-card p.error {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
  color: #fca5a5;
}

.auth-card a {
  color: var(--auth-label);
}

.auth-card button {
  /* 全站按鈕預設 align-self: flex-start（只跟內容一樣寬），但登入/
     忘記密碼/重設密碼卡片裡的按鈕要跟輸入框同寬（Andy 提供的參考截圖），
     刻意只在 .auth-card 範圍內覆蓋，不動全站其他表單的按鈕寬度。 */
  align-self: stretch;
  text-align: center;
}

/* ---------- app shell (everything else) ---------- */

.app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--shell-bg);
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
}

.sidebar-brand {
  padding: 0 0.5rem 1.25rem;
}

.sidebar-brand-logo {
  display: block;
  height: 34px;
  width: auto;
  max-width: 100%;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
}

.sidebar-nav a:hover {
  background: #f1f5f9;
}

.sidebar-nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.sidebar-user {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--sidebar-border);
  font-size: 0.85rem;
}

.sidebar-user-role {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
}

.sidebar-user-name {
  color: var(--text-primary);
  font-weight: 600;
}

.sidebar-user-tag {
  font-size: 0.78rem;
}

.sidebar-user-settings {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.sidebar-user-settings:hover,
.sidebar-user-settings.active {
  color: var(--sidebar-active-text);
}

.content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
  overflow-x: auto;
}

/* F81：頁籤多到一行放不下時（手機上帳號設定有 5 個），整列左右滑動，
   頁籤文字不拆行。底下的灰線改用 inset box-shadow 畫——overflow 容器會裁掉
   子元素凸出去的部分，舊的「border-bottom + 子元素 margin-bottom:-1px」
   會讓選中頁籤的綠線被裁掉一半。 */
.tab-bar {
  display: flex;
  gap: 1.5rem;
  box-shadow: inset 0 -1px 0 var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-bar a {
  display: block;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0 0 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}

.tab-bar a:hover {
  color: var(--text-primary);
}

.tab-bar a.active {
  color: var(--sidebar-active-text);
  border-bottom-color: var(--sidebar-active-text);
}

/* ---------- in-page detail tabs (e.g. project detail: activities/members/tasks/new_task) ----------
   CSS-only radio + :checked toggle, no JS. Different mechanism from .tab-bar above
   (.tab-bar navigates to a different URL; these toggle panels within one page load). */

.detail-tabs input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.detail-tab-labels {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.detail-tab-labels label {
  display: block;
  cursor: pointer;
  padding: 0 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.detail-tab-edit-link {
  margin-left: auto;
  padding-bottom: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.detail-tab-labels label:hover {
  color: var(--text-primary);
}

.detail-tab-panel {
  display: none;
}

#tab-activities:checked ~ .detail-tab-labels label[for="tab-activities"],
#tab-members:checked ~ .detail-tab-labels label[for="tab-members"],
#tab-tasks:checked ~ .detail-tab-labels label[for="tab-tasks"],
#tab-new-task:checked ~ .detail-tab-labels label[for="tab-new-task"] {
  color: var(--sidebar-active-text);
  border-bottom-color: var(--sidebar-active-text);
}

#tab-activities:checked ~ .panel-activities,
#tab-members:checked ~ .panel-members,
#tab-tasks:checked ~ .panel-tasks,
#tab-new-task:checked ~ .panel-new-task {
  display: block;
}

/* ---------- F42: LINE 知識庫匯入頁籤（整份文件／常見問題），沿用上面同一套
   CSS-only radio + :checked 機制，只是換一組 id/panel。
   F47 加第三個頁籤「已匯入知識」（放列表/搜尋，不是匯入表單）。---------- */

#kb-tab-document:checked ~ .detail-tab-labels label[for="kb-tab-document"],
#kb-tab-qa:checked ~ .detail-tab-labels label[for="kb-tab-qa"],
#kb-tab-list:checked ~ .detail-tab-labels label[for="kb-tab-list"] {
  color: var(--sidebar-active-text);
  border-bottom-color: var(--sidebar-active-text);
}

#kb-tab-document:checked ~ .panel-kb-document,
#kb-tab-qa:checked ~ .panel-kb-qa,
#kb-tab-list:checked ~ .panel-kb-list {
  display: block;
}

/* F47：640px 這個上限是為了匯入表單（文字框/textarea）不要拉太寬，只套
   在匯入表單這兩個面板；列表面板（表格）需要全寬，不受這個上限影響。 */
.panel-kb-document,
.panel-kb-qa {
  max-width: 640px;
}

/* ---------- project members: multi-select + JS filter (F20) ---------- */

.member-add-form fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem 1rem;
}

.member-add-form legend {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0 0.3rem;
}

/* F77-3：只顯示姓名後改成多欄 grid，90 個人桌機約 15～18 列、手機 2～3 欄；
   篩選被藏掉的項目（display:none）會自動讓位。 */
.member-checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7em, 1fr));
  column-gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}

.member-checkbox-empty {
  grid-column: 1 / -1;
}

.member-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-weight: 400;
  min-width: 0;
}

.member-checkbox-name {
  overflow-wrap: anywhere;
}

.member-checkbox-hint {
  color: var(--text-secondary);
  font-size: 0.8em;
  margin-left: 0.15rem;
}

.member-selected-count {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.member-checkbox-empty {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0.4rem 0;
}

/* F49-10：待確認頁的取消小表單（次要動作，收在 details 裡） */
.pending-actions {
  white-space: nowrap;
}

.cancel-order {
  margin-top: 0.4rem;
}

.cancel-order summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.cancel-order form {
  margin-top: 0.4rem;
  min-width: 14rem;
  white-space: normal;
}

.cancel-order label {
  font-size: 0.85rem;
}

/* F49-9：回報轉帳的原地確認區 */
.report-confirm {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted, #f8fafc);
}

.report-confirm-text {
  margin: 0 0 0.6rem;
  line-height: 1.7;
}

.report-note summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.report-note label {
  margin-top: 0.5rem;
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.75rem 0 0;
}

/* F49-8：待付款頁收款人旁的補充提示 */
.payee-note {
  color: var(--text-secondary);
  font-size: 0.85em;
}

/* ---------- project task latest-activity summary (F22) ---------- */

.task-latest-activity {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.task-latest-activity-empty {
  font-style: italic;
}

/* ---------- filter pills (list pages: e.g. members/activities status filter) ---------- */

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-pills a {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.filter-pills a:hover {
  background: #e2e8f0;
}

.filter-pills a.active {
  background: var(--accent);
  color: #fff;
}

.search-form {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  max-width: none;
  margin-bottom: 1.5rem;
}

/* F49-5: 分頁列（上一頁／頁碼／下一頁） */
.pager {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* ---------- home page cards (F12-2) ---------- */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.card-title {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.card-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.card-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.card-list li:last-child {
  border-bottom: none;
}

.card-list li a {
  font-weight: 600;
  text-decoration: none;
}

.card-list li a:hover {
  text-decoration: underline;
}

.card-list-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.card-empty {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

.card-footer {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stat-card {
  text-align: center;
}

.stat-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.stat-item {
  flex: 1;
  text-align: center;
}

.stat-item-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

.stat-item-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0.15rem 0 0;
}

.announcement-text {
  white-space: pre-wrap;
  margin: 0;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

/* ---------- shared form / table / button baseline ---------- */

form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 480px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
}

label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  font-weight: 400;
}

/* F68-3：外部報名表單分「基本資料」／「自訂欄位」兩組，活動建立/編輯
   表單分出「外部報名設定」一組——用原生 fieldset/legend，不用額外 JS。 */
fieldset {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem 1rem;
  margin: 0;
}

legend {
  padding: 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.auth-card fieldset {
  border-color: var(--auth-border);
}

.auth-card legend {
  color: var(--auth-label);
}

.required-mark {
  color: var(--error);
  margin-left: 0.15rem;
}

input,
select {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-primary);
}

input[readonly] {
  background: var(--table-header-bg);
  color: var(--text-secondary);
  cursor: not-allowed;
}

button,
.link-button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  align-self: flex-start;
}

button:hover,
.link-button:hover {
  background: var(--accent-hover);
}

.link-button {
  background: none;
  color: var(--accent);
  padding: 0;
  font-weight: 400;
  text-decoration: underline;
}

.link-button:hover {
  background: none;
  color: var(--accent-hover);
}

.link-button-danger {
  background: none;
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
}

.link-button-danger:hover {
  background: var(--error-bg);
}

.edit-actions-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.edit-actions-row form {
  margin: 0;
}

p.error {
  background: var(--error-bg);
  border: 1px solid #fecaca;
  color: var(--error);
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  max-width: 480px;
}

p.notice {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  color: var(--accent-hover);
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  max-width: 480px;
}

table {
  border-collapse: collapse;
  width: 100%;
  max-width: 100%;
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  background: var(--table-header-bg);
  color: var(--text-secondary);
  font-weight: 600;
}

/* F43: LINE 知識幫手列表頁的表格固定欄寬，避免 <details> 展開內容欄
   之後把來源文件欄擠小——搭配 table-layout: fixed，欄寬只看下面設定的
   百分比，不受儲存格內容長度影響。 */
.kb-doc-table {
  table-layout: fixed;
}

.kb-doc-table th:nth-child(1),
.kb-doc-table td:nth-child(1) {
  width: 6%;
}

.kb-doc-table th:nth-child(2),
.kb-doc-table td:nth-child(2) {
  width: 22%;
  word-break: break-word;
}

.kb-doc-table th:nth-child(3),
.kb-doc-table td:nth-child(3) {
  width: 57%;
  word-break: break-word;
}

.kb-doc-table th:nth-child(4),
.kb-doc-table td:nth-child(4) {
  width: 15%;
}

/* F45：編輯/刪除原本上下堆疊，操作欄（15%）太窄時「刪除」按鈕會被壓到
   逐字換行，改橫向並排＋文字禁止換行（nowrap，寧可讓按鈕溢出儲存格
   一點點，也不要拆字）。窄螢幕（手機版）allow wrap，但以整個按鈕為
   單位換行，不會拆到按鈕內部的文字。*/
.kb-doc-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.kb-doc-actions .link-button,
.kb-doc-actions .link-button-danger {
  white-space: nowrap;
}

/* F56／F57-1：活動列表「我的狀態」欄——未報名／已報名都是連到活動詳情
   的連結，已報名用主色強調，一眼區分。 */
.reg-status {
  font-weight: 600;
}

.reg-status-yes {
  color: var(--accent);
}

.reg-status-no {
  color: var(--text-secondary);
}

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  max-width: 480px;
}

dt {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

dd {
  margin: 0;
}

@media (max-width: 720px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
  }

  .sidebar-brand {
    order: 0;
    padding-bottom: 0;
  }

  .sidebar-brand-logo {
    height: 28px;
  }

  /* F26 後續調整：帳號區塊搬到跟品牌名稱同一行的右側，改成一直顯示的
     精簡版（只留身分別，見 sidebar-user-role 的內容），不用像素較大的
     Email 那樣佔掉一整段——nav 用 order:2 + flex-basis:100% 擠到下一行，
     這樣 brand（order:0）跟 user（order:1）就會留在同一行。桌面版沒有
     這個 media query 生效範圍，維持左下角直向排列不變。 */
  .sidebar-nav {
    order: 2;
    flex-basis: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-user {
    order: 1;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .sidebar-user-role {
    margin-bottom: 0;
  }

  .sidebar-user-settings {
    margin-bottom: 0;
  }

  .content {
    padding: 1.25rem;
  }

  /* F56／F57：`.stacked-table` 在手機上從表格改成卡片——每列一個框，
     欄位標題用每個 <td data-label="…"> 的值顯示在左側，值靠右。桌機版
     維持一般表格（這段只在 max-width: 720px 生效）。
     用法：<table class="stacked-table">，每個 <td> 加 data-label；
     當主欄（標題那格）加 class="cell-title"（放大、不顯示 label）；
     空白 <td>（例如資料夾列沒有大小/時間）在手機版自動收起。 */
  .stacked-table thead {
    display: none;
  }

  .stacked-table tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    margin-bottom: 0.75rem;
  }

  .stacked-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.28rem 0;
    border-bottom: none;
  }

  .stacked-table td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-size: 0.85rem;
  }

  .stacked-table td.cell-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.15rem;
  }

  .stacked-table td.cell-title::before {
    content: none;
  }

  /* F58-4：內容較豐富的欄（含 <details>、表單、多行文字）用 cell-block——
     標題在上、內容整行在下，不要跟值擠在同一行兩端對齊。 */
  .stacked-table td.cell-block {
    display: block;
  }

  .stacked-table td.cell-block::before {
    display: block;
    margin-bottom: 0.2rem;
  }

  .stacked-table td:empty {
    display: none;
  }
}

/* ---------- F68-1: 活動說明文字 Markdown 渲染 ---------- */

.activity-description {
  line-height: 1.6;
}

.activity-description :first-child {
  margin-top: 0;
}

.activity-description :last-child {
  margin-bottom: 0;
}

.activity-description h1,
.activity-description h2,
.activity-description h3,
.activity-description h4,
.activity-description h5,
.activity-description h6 {
  font-size: 1.05rem;
  margin: 1rem 0 0.5rem;
}

.activity-description ul,
.activity-description ol {
  padding-left: 1.5rem;
}

.activity-description blockquote {
  margin: 0.5rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--border, #ddd);
  color: var(--text-secondary);
}

.activity-description pre {
  background: var(--surface-muted, #f4f4f4);
  padding: 0.75rem;
  overflow-x: auto;
  border-radius: 4px;
}

.activity-description code {
  background: var(--surface-muted, #f4f4f4);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

.activity-description pre code {
  background: none;
  padding: 0;
}

/* ---------- F73-4: 會員報名頁三張卡片（圖片＋說明／報名資訊／專屬欄位） ---------- */

.activity-card {
  margin-bottom: 1rem;
}

.activity-card > p:first-child {
  margin-top: 0;
}

.activity-card > p:last-child {
  margin-bottom: 0;
}

/* 全站 form 有 max-width: 480px，會讓報名表單裡的卡片比上面兩張窄一截。
   這頁讓卡片撐滿、改在欄位本身維持原本的輸入寬度。 */
.register-form {
  max-width: none;
}

.register-form label {
  max-width: 480px;
}

/* ---------- F73-6: 會員看得到的報名名單（預設收合，姓名做成標籤） ---------- */

.registrants-card > summary {
  cursor: pointer;
  font-weight: 600;
}

.registrant-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
}

.registrant-tag {
  background: var(--surface-muted, #f4f4f4);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.9rem;
}

.registrant-external {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ---------- F74-2: 法律頁面入口與蒐集點告知 ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--text-secondary);
}

.auth-footer {
  justify-content: center;
  border-top: none;
  margin-top: 1.5rem;
}

.consent-notice {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 480px;
}

.nowrap-cjk {
  white-space: nowrap;
}

/* F49-11：通知信的儲值確認頁（未登入版面，手機上點開） */
.review-amount {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.25rem 0 0.75rem;
}

.review-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.9rem;
  margin: 0 0 1.25rem;
}

.review-facts dt {
  color: var(--auth-subtitle);
}

.review-facts dd {
  margin: 0;
}

.review-report {
  white-space: pre-line;
}

.review-cancel {
  margin-top: 1rem;
}

.review-cancel summary {
  color: var(--auth-subtitle);
}

.review-backlink {
  margin-top: 1.25rem;
  font-size: 0.85rem;
}

/* F81：LINE 綁定／登入按鈕（LINE 品牌綠 #06C755，hover 疊 10% 黑） */
.line-button {
  display: inline-block;
  background: #06c755;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
}

.line-button:hover {
  background: #05b34c;
  color: #fff;
}

.line-unbind {
  margin-top: 1rem;
}

.line-privacy-note {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* F81-2：登入頁「用 LINE 登入」與確認綁定頁 */
.auth-card .line-button,
.auth-card .line-button:hover {
  color: #fff;
}

.line-button-block {
  display: block;
  text-align: center;
}

button.line-button {
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 1rem;
  color: var(--auth-subtitle);
  font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--auth-border);
}

.line-login-hint {
  margin: 0.6rem 0 1.25rem;
  font-size: 0.8rem;
  color: var(--auth-subtitle);
}

.line-confirm-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 1rem 0 0.5rem;
}

.line-confirm-actions form {
  margin: 0;
}

/* F87：名片印製登記公開表單（card 子網域，未登入版面） */
.form-hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.auth-card .form-hint {
  color: var(--auth-subtitle);
}

/* 擋機器人的隱藏欄位：移出畫面而不是 display:none，有些機器人會略過 display:none 的欄位。 */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* F87-2：名片預覽（templates/business_cards/_card_preview.html）。
   位置與字級照現行名片掃描檔量出來的比例；字級用 cqw（相對名片寬度），
   名片縮放時整張等比例縮放。前面的 px 值給不支援 container query 的舊瀏覽器。 */
.auth-card.auth-card-wide {
  max-width: 560px;
}

.biz-card-preview {
  margin: 1rem 0;
  max-width: 540px;
}

.biz-card-preview figcaption {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.auth-card .biz-card-preview figcaption {
  color: var(--auth-subtitle);
}

.biz-card {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 9 / 5.4;
  width: 100%;
  overflow: hidden;
  background: #fff;
  color: #111;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.2;
}

.biz-card-photo {
  position: absolute;
  left: 4.7%;
  top: 10.6%;
  width: 20.3%;
  height: 41.5%;
  background: #f4f4f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.biz-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.biz-card-photo-empty {
  font-size: 11px;
  font-size: 3cqw;
  color: #a1a1aa;
}

.biz-card.has-photo .biz-card-photo-empty {
  display: none;
}

.biz-card-logo {
  position: absolute;
  left: 30.5%;
  top: 12%;
  width: 11.5%;
}

.biz-card-org {
  position: absolute;
  left: 43.5%;
  right: 3.5%;
  top: 12.5%;
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  font-size: 15px;
  font-size: 4.3cqw;
  font-weight: 500;
}

.biz-card-org span {
  text-align: justify;
  text-align-last: justify;
  white-space: nowrap;
}

.biz-card-name {
  position: absolute;
  left: 29%;
  right: 3%;
  top: 46%;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.6em;
  white-space: nowrap;
}

.biz-card-name [data-field="name"] {
  font-family: "BiauKai", "DFKai-SB", "標楷體", "Kaiti TC", "STKaiti", "KaiTi", "AR PL UKai TW", serif;
  font-size: 20px;
  font-size: 6cqw;
  letter-spacing: 0.7em;
  margin-right: -0.7em;
}

.biz-card-name [data-field="title"] {
  font-size: 12px;
  font-size: 3.4cqw;
}

.biz-card .is-placeholder {
  color: #a1a1aa;
}

.biz-card-qr {
  position: absolute;
  left: 5.2%;
  top: 64.5%;
  width: 18%;
  image-rendering: pixelated;
}

.biz-card-contact {
  position: absolute;
  left: 29%;
  right: 3%;
  top: 64%;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45em;
  font-size: 12px;
  font-size: 3.4cqw;
}

.biz-card-contact li,
.biz-card-contact-split > span {
  display: flex;
  align-items: center;
  gap: 0.6em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.biz-card-contact-split {
  justify-content: space-between;
  padding-right: 6%;
}

.biz-card-icon {
  flex-shrink: 0;
  width: 1.15em;
  height: 1.15em;
  fill: #111;
}
