/* style.css — v5 版面（側邊欄／底部分頁列／卡片結構）＋ v7 配色調整
   淺色＝回到 v2 暖米白＋深棕字＋棕橘標題（PM 指定氛圍）；
   深色＝維持 v5 中性深灰基調，只加一點咖啡調暖度，不回到滿版金黃；
   金橘 #FFAB00 兩種模式都只做強調色（所在頁高亮／主按鈕／少量重點 badge）。
   以 CSS variables 切換主題，元件（card/btn/badge/table…）維持既有 class 名稱。 */

:root {
  /* 版面（v7：回到 v2 暖米白色系） */
  --bg: #fbf5ec;
  --surface: #ffffff;
  --surface-soft: #f3e8d8;
  --border: #e7d9c4;

  /* 文字（v7：回到 v2 深棕） */
  --text: #2a1b0e;
  --muted: #7c6450;

  /* 頁首／側邊欄（淺色沿用卡片白底＋暖邊框） */
  --header-bg: #ffffff;
  --header-bg-soft: #f3e8d8;
  --header-text: #2a1b0e;

  /* 連結／標題色（v7：回到 v2 棕橘） */
  --link: #a85a12;

  /* 品牌強調色（金橘 #FFAB00）：只用在所在頁高亮／主要 CTA／重點 badge */
  --btn-bg: #ffab00;
  --btn-bg-hover: #e8960a;
  --btn-text: #1b0f00;
  --nav-active-bg: #f3e8d8;
  --nav-active-text: #8a4a0e;

  --btn-secondary-bg: #ffffff;
  --btn-secondary-text: #a85a12;
  --btn-secondary-border: #a85a12;

  --heading: var(--link);
  --icon-tint: var(--link);

  --btn-danger-bg: #a23b1e;
  --btn-danger-text: #fff3ec;

  /* 重點面板（老師評語／作業範本下載）：暖底＋左側金橘強調條 */
  --accent-navy: var(--surface-soft);
  --accent-navy-text: var(--text);

  --danger: #a23b1e;
  --danger-bg: #fbe7de;
  --success: #3f6b2f;
  --success-bg: #e9f1e2;

  --badge-pending-bg: #f3e8d8;
  --badge-pending-text: #8a4a0e;
  --badge-done-bg: #e9f1e2;
  --badge-done-text: #3f6b2f;
  --badge-graded-bg: #f6e3b4;
  --badge-graded-text: #7a4e00;
  --badge-enabled-bg: #e9f1e2;
  --badge-enabled-text: #3f6b2f;
  --badge-disabled-bg: #fbe7de;
  --badge-disabled-text: #a23b1e;
  --badge-plan-bg: #e5e5e5;
  --badge-plan-text: #5f5f5f;
  --badge-draft-bg: #dbeafe;
  --badge-draft-text: #1d4ed8;

  --msg-staff-bg: #f3e8d8;
  --msg-staff-text: #2a1b0e;
  --msg-student-bg: #ffab00;
  --msg-student-text: #1b0f00;

  color-scheme: light;
}

[data-theme="dark"] {
  /* v7：維持 v5 中性深灰基調，只加一點咖啡調暖度（不是回到 v1～v3 的深咖啡金黃） */
  --bg: #1c1917;
  --surface: #292421;
  --surface-soft: #362f2a;
  --border: #5a4d42;

  --text: #f2ede7;
  --muted: #a89d93;

  --header-bg: #211d1a;
  --header-bg-soft: #362f2a;
  --header-text: #f2ede7;

  --link: #93b4ff;

  --btn-bg: #ffab00;
  --btn-bg-hover: #ffc15c;
  --btn-text: #1b0f00;
  --nav-active-bg: #3a2e10;
  --nav-active-text: #ffc15c;

  --btn-secondary-bg: var(--surface);
  --btn-secondary-text: var(--text);
  --btn-secondary-border: #5a4d42;

  --heading: var(--text);
  --icon-tint: var(--muted);

  --btn-danger-bg: #b91c1c;
  --btn-danger-text: #ffffff;

  --accent-navy: var(--surface-soft);
  --accent-navy-text: var(--text);

  --danger: #fca5a5;
  --danger-bg: #3a1418;
  --success: #86efac;
  --success-bg: #14261c;

  --badge-pending-bg: #362f2a;
  --badge-pending-text: #c9beb3;
  --badge-done-bg: #14261c;
  --badge-done-text: #86efac;
  --badge-graded-bg: #3a2e10;
  --badge-graded-text: #fcd34d;
  --badge-enabled-bg: #14261c;
  --badge-enabled-text: #86efac;
  --badge-disabled-bg: #3a1418;
  --badge-disabled-text: #fca5a5;
  --badge-plan-bg: #3a3a3e;
  --badge-plan-text: #b4b4bc;
  --badge-draft-bg: #16324a;
  --badge-draft-text: #8ec4ee;

  --msg-staff-bg: #362f2a;
  --msg-staff-text: #f2ede7;
  --msg-student-bg: #ffab00;
  --msg-student-text: #1b0f00;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Heiti TC",
    "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

/* ===== v5 版面骨架：桌面側邊欄／手機頂列＋底部分頁列 ===== */

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  overflow-y: auto;
  z-index: 20;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--btn-bg);
  color: var(--btn-text);
  flex-shrink: 0;
}

.logo-mark svg {
  width: 18px;
  height: 18px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.sidebar-link-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--muted);
}

.sidebar-link-icon svg {
  width: 20px;
  height: 20px;
}

.sidebar-link:hover {
  background: var(--surface-soft);
}

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

.sidebar-link.active .sidebar-link-icon {
  color: var(--nav-active-text);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 深淺色切換鈕（icon＋文字成對切換）：側邊欄與 /more 選單頁共用同一套規則 */
.theme-toggle-btn .tt-moon,
.theme-toggle-btn .tt-sun {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn .tt-moon svg,
.theme-toggle-btn .tt-sun svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

.theme-toggle-btn .tt-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle-btn .tt-moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle-btn .tt-sun {
  display: flex;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  color: var(--muted);
}

.logout-form {
  flex-shrink: 0;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.logout-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.logout-btn svg {
  width: 18px;
  height: 18px;
}

/* 手機頂列（<900px 顯示） */
.app-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 15;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
}

.app-topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 訪客（登入頁／未登入）置中極簡頂列 */
.guest-topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 16px 0;
}

.guest-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.theme-toggle-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.theme-toggle-mini svg {
  width: 18px;
  height: 18px;
}

.theme-toggle-mini .icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle-mini .icon-sun {
  display: block;
}

html[data-theme="dark"] .theme-toggle-mini .icon-moon {
  display: none;
}

/* 主內容區
   v11 AM root cause：.app-main 的 margin-left: 240px 原本沒有條件，訪客（登入）頁
   雖然沒有側邊欄，也被硬套了這個位移，導致整體版面偏右、無法置中。
   改成只有 body 有 .has-sidebar（已登入才會加）時才留側邊欄空間。 */
.app-main {
  padding: 32px 32px 60px;
  min-height: 100vh;
}

/* v11 AM 修正：原本寫在 media query 外面的 .has-sidebar .app-main（兩個 class，
   specificity 0,2,0）會贏過下面手機版 media query 裡的 .app-main（0,1,0），
   即使手機版規則在後面也一樣蓋不掉，導致已登入使用者在手機版還是被推走 240px、
   版面被擠壓變形。改成只在桌面寬度（≥900px）才套用側邊欄留白，兩個斷點不再打架。 */
@media (min-width: 900px) {
  .has-sidebar .app-main {
    margin-left: 240px;
  }
}

.app-main-inner {
  max-width: 1100px;
  margin: 0 auto;
}

/* 手機底部固定分頁列（<900px 顯示） */
.app-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav-link {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  border-radius: 10px;
}

.bottom-nav-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
}

.bottom-nav-icon svg {
  width: 22px;
  height: 22px;
}

.bottom-nav-link.active {
  color: var(--nav-active-text);
  font-weight: 700;
}

@media (max-width: 899px) {
  .app-sidebar {
    display: none;
  }

  .app-topbar {
    display: flex;
  }

  .app-bottom-nav {
    display: flex;
  }

  .app-main {
    margin-left: 0;
    padding: 16px 16px calc(88px + env(safe-area-inset-bottom, 0px));
  }
}

.card {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
}

.card h2 {
  margin-top: 0;
  font-size: 17px;
  color: var(--heading);
}

.card h3 {
  font-size: 15px;
  color: var(--heading);
  margin-bottom: 8px;
}

/* 重點面板（老師評語／作業範本下載）：中性底＋左側金橘強調條 */
.card.panel-soft {
  background: var(--accent-navy);
  color: var(--accent-navy-text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--btn-bg);
}

.card.panel-soft h3 {
  color: var(--accent-navy-text);
}

.card.template-panel {
  background: var(--accent-navy);
  color: var(--accent-navy-text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--btn-bg);
}

.card.template-panel h2 {
  color: var(--heading);
}

/* v11 AP：桌面版「作業範本下載」按鈕太長（滿版跟著卡片拉到 1100px），
   改成固定合理寬度、置左；手機版（<900px）維持既有滿版好按。 */
@media (min-width: 900px) {
  .template-panel .btn-block {
    width: 100%;
    max-width: 320px;
  }
}

/* v12 AU：學員作業頁「上傳作業」「送出留言」、許願頁「送出許願」桌面版
   比照範本下載鈕限寬置左；手機版（<900px）維持既有滿版好按。 */
@media (min-width: 900px) {
  .btn-desktop-narrow {
    width: 100%;
    max-width: 320px;
  }
}

.btn {
  display: inline-block;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn:hover {
  background: var(--btn-bg-hover);
}

.btn.secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--btn-secondary-border);
  font-weight: 600;
}

.btn.danger {
  background: var(--btn-danger-bg);
  color: var(--btn-danger-text);
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-small {
  padding: 8px 12px;
  font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  margin-bottom: 12px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
}

.field {
  margin-bottom: 14px;
}

.alert {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px;
}

.alert.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.alert.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

/* v10 AF：登入頁匯入警語改成無框純文案（原本 v9 的 .notice-banner 底色框拿掉），
   連結沿用預設 a 色（深淺色都已有足夠對比）。 */
.login-plain-notice {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 2px 0;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.pending {
  background: var(--badge-pending-bg);
  color: var(--badge-pending-text);
}

.badge.done {
  background: var(--badge-done-bg);
  color: var(--badge-done-text);
}

.badge.graded {
  background: var(--badge-graded-bg);
  color: var(--badge-graded-text);
}

.badge.disabled {
  background: var(--badge-disabled-bg);
  color: var(--badge-disabled-text);
}

.badge.enabled {
  background: var(--badge-enabled-bg);
  color: var(--badge-enabled-text);
}

.badge.plan-online {
  background: var(--badge-plan-bg);
  color: var(--badge-plan-text);
}

.badge.draft {
  background: var(--badge-draft-bg);
  color: var(--badge-draft-text);
}

/* v9 AB／AC：顯眼提示橫幅（登入頁匯入警語、草稿狀態）——沿用既有 draft 藍色系
   （深淺色都已定義好足夠對比），不新增配色，只加這個共用元件。 */
.notice-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  background: var(--badge-draft-bg);
  color: var(--badge-draft-text);
  border-left: 4px solid var(--badge-draft-text);
  margin-bottom: 14px;
}

.notice-banner .notice-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.notice-banner .notice-icon svg {
  width: 100%;
  height: 100%;
}

.notice-banner strong {
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
}

/* v10 AJ：總覽表「實體課程」欄的改選即存下拉，表格內要縮小到跟儲存格相稱，
   不能沿用表單頁那種滿版大 select。 */
.cohort-inline-form {
  margin: 0;
  display: inline-block;
}

.cohort-inline-form select {
  width: auto;
  min-width: 110px;
  padding: 6px 8px;
  margin-bottom: 0;
  font-size: 13px;
}

.cohort-saved-badge {
  margin-left: 6px;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.msg-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  max-height: 420px;
  overflow-y: auto;
}

.msg {
  padding: 10px 12px;
  border-radius: 10px;
  max-width: 85%;
}

.msg .who {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.msg.staff {
  background: var(--msg-staff-bg);
  color: var(--msg-staff-text);
  align-self: flex-start;
}

.msg.student {
  background: var(--msg-student-bg);
  color: var(--msg-student-text);
  align-self: flex-end;
}

.msg.student .who {
  color: rgba(27, 15, 0, 0.65);
}

.login-wrap {
  max-width: 380px;
  margin: 40px auto 60px;
  padding: 0 16px;
}

.login-wrap h2 {
  text-align: center;
  color: var(--heading);
}

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.search-box {
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--heading);
  margin: 24px 0 10px;
}

hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Dashboard 問候區（/me） */
.greeting-card {
  text-align: left;
}

.greeting-title {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  color: var(--heading);
}

.greeting-sub {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

/* Dashboard 卡片（/me） */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 520px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.dash-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.dash-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--icon-tint);
}

/* 粉彩 icon 磚，Dashboard 卡片專用；v10 AI 起 .section-icon（詳情頁區塊小 icon 磚）
   共用同一組 tile-* 配色，只是尺寸不同，配色只維護這一份、不重複。
   v7：淺色模式改低飽和暖色調（呼應整體暖米白氛圍）；深色模式維持 v5 原本配色。 */
.dash-icon.tile-mint,
.section-icon.tile-mint {
  background: #f3ddd0;
  color: #8f4522;
}

.dash-icon.tile-blue,
.section-icon.tile-blue {
  background: #f3e0c5;
  color: #7a4d18;
}

.dash-icon.tile-amber,
.section-icon.tile-amber {
  background: #fdecd2;
  color: #8a3f06;
}

.dash-icon.tile-violet,
.section-icon.tile-violet {
  background: #f2e0df;
  color: #7c3d36;
}

/* v10 AI：新增第 5 種 tile 配色（給詳情頁「與學員對話」區塊用），
   維持淺色低飽和暖色調的家族感（暖陶土色系，不引入冷色）。 */
.dash-icon.tile-clay,
.section-icon.tile-clay {
  background: #efe3c8;
  color: #6b5a1f;
}

/* v8 Y：深色模式改暖色深底（深咖啡～暖棕層次）＋金橘／琥珀 icon，
   四卡同色系不同深淺做區隔（取樣自商品頁深咖啡底＋金橘漸層氛圍），取代原本冷色粉彩磚。 */
[data-theme="dark"] .dash-icon.tile-mint,
[data-theme="dark"] .section-icon.tile-mint {
  background: #35220f;
  color: #ffc15c;
}

[data-theme="dark"] .dash-icon.tile-blue,
[data-theme="dark"] .section-icon.tile-blue {
  background: #2b1c10;
  color: #ffb454;
}

[data-theme="dark"] .dash-icon.tile-amber,
[data-theme="dark"] .section-icon.tile-amber {
  background: #402911;
  color: #ffab00;
}

[data-theme="dark"] .dash-icon.tile-violet,
[data-theme="dark"] .section-icon.tile-violet {
  background: #4a3014;
  color: #f5cf7a;
}

[data-theme="dark"] .dash-icon.tile-clay,
[data-theme="dark"] .section-icon.tile-clay {
  background: #3a2e18;
  color: #d9c15c;
}

.dash-icon svg {
  width: 24px;
  height: 24px;
}

.dash-icon.big {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
}

.dash-icon.big svg {
  width: 32px;
  height: 32px;
}

/* v10 AI：詳情頁區塊標題用的小 icon 磚，沿用上面 tile-* 配色但尺寸縮小、
   inline 貼在 h2/h3 文字前面。 */
.section-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  margin-right: 8px;
  vertical-align: middle;
  position: relative;
  top: -2px;
}

.section-icon svg {
  width: 16px;
  height: 16px;
}

.dash-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dash-title {
  font-weight: 700;
  font-size: 15px;
}

.dash-desc {
  font-size: 13px;
  color: var(--muted);
}

.placeholder-card {
  text-align: center;
  padding: 40px 18px;
}

/* /admin 篩選（v6：兩個下拉，AND 組合；.filter-chip 留給資源預覽頁的工作表分頁用） */
.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-filters .field {
  margin-bottom: 0;
  min-width: 160px;
  flex: 1 1 200px;
}

.admin-filters select {
  margin-bottom: 0;
}

.filter-chip {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--btn-secondary-border);
  color: var(--btn-secondary-text);
  background: var(--btn-secondary-bg);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--btn-bg);
  color: var(--btn-text);
  border-color: var(--btn-bg);
  font-weight: 700;
}

/* /admin 今日繳交 */
.today-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.today-list li {
  font-size: 14px;
}

/* v4 L：派發給老師的自訂防呆確認框 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

/* 重要：class 的 display:flex 與瀏覽器內建 [hidden]{display:none} 特異度相同，
   author stylesheet 會贏，若不加這條會導致 hidden 時整層 overlay 仍蓋住全頁、
   擋掉頁面上所有點擊（曾經實測到派發／刪除／留言按鈕全部點不到）。 */
.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.modal-box p {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn {
  flex: 1;
}

/* v4 O：登入頁密碼顯示／隱藏 */
.password-field-wrap {
  position: relative;
}

.password-field-wrap input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle.is-visible .icon-eye {
  display: none;
}

.password-toggle.is-visible .icon-eye-off {
  display: block;
}

/* v11 AQ：資源預覽改自家 HTML 包裝頁——頂部工具列＋下方 iframe 內嵌 PDF */
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-toolbar-left {
  min-width: 0;
}

.preview-back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 4px;
}

.preview-toolbar h2 {
  margin: 0;
  font-size: 17px;
  color: var(--heading);
  overflow-wrap: anywhere;
}

.preview-frame-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  height: 75vh;
  min-height: 420px;
}

.preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #fff;
}

@media (max-width: 899px) {
  .preview-frame-wrap {
    height: calc(100vh - 260px);
    min-height: 360px;
  }
}

/* v4 N：課程資源預覽頁 */
.preview-table-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
}

.preview-table-wrap table {
  border: 1px solid var(--border);
}

.preview-table-wrap th,
.preview-table-wrap td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  white-space: nowrap;
}

.sheet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.resource-list-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* v5：/more 選單頁（手機底部分頁列「更多」） */
.more-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.more-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.more-menu-link:hover {
  background: var(--surface-soft);
}

.more-menu-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--muted);
}

.more-menu-icon svg {
  width: 22px;
  height: 22px;
}
