/* ui-polish.css — 國際級工藝層（2026-07-18）
   最後載入、蓋在所有頁上。只做四件事：語意 token 收斂、互動狀態補齊、數字排版、表單統一。
   不改藝術方向（深午夜藍＋冷電藍是 Boss 定的），改的是工藝密度。 */

:root {
  --ui-accent: #7da8ff;
  --ui-accent-ink: #08101d;
  --ui-line: #3a4555;
  --ui-line-soft: #2a3240;
  /* 語意狀態色（去飽和、暗底可讀）：好/注意/待處理 */
  --ui-good: #55b382;
  --ui-warn: #d9a441;
  --ui-bad: #e0655f;
  --ui-radius: 4px;
  --ui-ease: cubic-bezier(.2, .8, .2, 1);
}

/* ── 鍵盤焦點環：所有可互動元素、只在鍵盤操作時亮 ── */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px;
  border-radius: var(--ui-radius);
}

/* ── 觸覺回饋：按下去要有感、放開要俐落 ── */
button, .action, .slot-detail, .course-toggle {
  transition: transform .15s var(--ui-ease), background-color .15s var(--ui-ease),
              border-color .15s var(--ui-ease), color .15s var(--ui-ease);
}
button:active, .action:active, .slot-detail:active { transform: scale(.98); }
button:disabled, .action:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ── 數字排版：等寬數字，帳目/名額/時間對齊不跳動 ── */
.metric, .overview-kpis strong, .stats span, .course-upcoming li,
td, .list small, time, [data-numeric] {
  font-variant-numeric: tabular-nums;
}

/* ── 表單統一：一致的框、間距、聚焦、佔位符 ── */
input, select, textarea {
  border-radius: var(--ui-radius);
  transition: border-color .15s var(--ui-ease), background-color .15s var(--ui-ease);
}
input:focus, select:focus, textarea:focus { border-color: var(--ui-accent); outline: none; }
::placeholder { opacity: .55; }
label { display: grid; gap: 6px; }

/* ── 半徑封頂：4px 專業鈍角，全站一致 ── */
button, .action, .panel, .ops-card, article, .chip, input, select { border-radius: var(--ui-radius); }

/* ── KPI 語意狀態：數字大、狀態一眼分 ── */
.overview-kpis article { border-left: 3px solid var(--ui-line); }
.overview-kpis article.kpi-good { border-left-color: var(--ui-good); }
.overview-kpis article.kpi-warn { border-left-color: var(--ui-warn); }
.overview-kpis article.kpi-warn strong { color: var(--ui-warn); }
.overview-kpis article.kpi-bad { border-left-color: var(--ui-bad); }
.overview-kpis article.kpi-bad strong { color: var(--ui-bad); }
.overview-kpis small { opacity: .75; }

/* ── Skeleton 載入（取代純文字等待；動畫只動 transform） ── */
.skeleton { position: relative; overflow: hidden; background: rgba(125,168,255,.07); border-radius: var(--ui-radius); min-height: 14px; }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(237,242,247,.08), transparent);
  transform: translateX(-100%); animation: ui-shimmer 1.4s var(--ui-ease) infinite;
}
@keyframes ui-shimmer { to { transform: translateX(100%); } }
.skeleton-row { display: grid; gap: 10px; }
.skeleton-row .skeleton { height: 40px; }

/* ── 列表列 hover：一致的可點暗示 ── */
.list li, .slot-detail.chip, .week-col .chip { transition: background-color .15s var(--ui-ease); }
.list li:hover { background: rgba(237,242,247,.03); }
.slot-detail.chip:hover { background: rgba(125,168,255,.14); border-color: var(--ui-accent); }

/* ── 文字選取與捲軸（暗底世界的一致細節） ── */
::selection { background: rgba(125,168,255,.35); }
.week-grid, .day-list, .ops-members ul { scrollbar-width: thin; scrollbar-color: var(--ui-line) transparent; }

/* ── 警示文字語意化（原本橘字散寫，收斂到 token） ── */
.course-upcoming b.warn { color: var(--ui-warn); }
#message { color: var(--ui-accent); }
#message.error { color: var(--ui-bad); }

/* ── reduced-motion：全layer動效歸零 ── */
@media (prefers-reduced-motion: reduce) {
  button, .action, .slot-detail, .course-toggle { transition: none; }
  .skeleton::after { animation: none; }
}

/* ── ghost 次要按鈕：透明底＋描邊（修總覽「管理課程」白塊） ── */
button.ghost {
  background: transparent; color: var(--ui-accent);
  border: 1px solid var(--ui-accent); padding: 12px 16px;
  font-weight: 900; font-size: 12px; letter-spacing: .06em; cursor: pointer;
}
button.ghost:hover { background: rgba(125,168,255,.12); }

/* ── hidden 屬性永遠贏：修 contrast-fix 的 display:block!important 蓋掉收起功能 ── */
[hidden] { display: none !important; }

/* ── 動態面板的 label 文字對比（原因管理/分眾等 JS 渲染區塊被吃字） ── */
body.ops label { color: #c4d0df; }
body.ops .reason-form label, body.ops .reason-head .eyebrow { color: #c4d0df; }
body.ops .fixed-reason { color: #8fa3bb; font-size: 12px; letter-spacing: .06em; align-self: center; }

/* ── 學員紀錄彈窗（2026-07-18 Boss：查看紀錄要跳視窗看全貌） ── */
dialog.member-dialog { background: #0f1722; color: #edf2f7; border: 1px solid #3a4555; border-radius: 4px; padding: 0; width: min(92vw, 760px); max-height: 84vh; }
dialog.member-dialog::backdrop { background: rgba(4, 7, 12, .72); }
.member-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px; border-bottom: 1px solid #2a3240; position: sticky; top: 0; background: #0f1722; }
.member-dialog-head h2 { margin: 0; font-size: 20px; }
#member-health-content { padding: 20px 24px; overflow-y: auto; }

/* ── 系統設定行內表單 ── */
.settings-inline { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-top: 12px; }
.settings-inline label { min-width: 150px; }
.action.danger { background: #8b3a35 !important; border-color: #8b3a35 !important; }
.action.danger:hover { background: #a34840 !important; }

/* ── 前台內容目錄卡 ── */
.content-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.content-card { border: 1px solid #2a3240; padding: 16px; display: grid; gap: 8px; align-content: start; }
.content-card.empty { opacity: .75; border-style: dashed; }
.content-card header { display: flex; justify-content: space-between; align-items: center; }
.content-card header span { font-size: 11px; letter-spacing: .08em; padding: 3px 8px; border-radius: 4px; }
.content-card header span.on { background: rgba(85,179,130,.18); color: #55b382; }
.content-card header span.off { background: rgba(217,164,65,.18); color: #d9a441; }
.content-card header span.none { background: rgba(170,180,192,.14); color: #aab4c0; }
.content-card p { margin: 0; font-weight: 700; }
.content-card small { opacity: .7; line-height: 1.5; }
.content-card .ghost { justify-self: start; }
.form-actions { display: flex; gap: 10px; }
