/* 全站樣式 4/16：班級出席總覽、表單、按鈕、庫存分段鈕、頁面切換、列表、點名、Toast／空狀態、課程學生管理 */
/* ============================================
   班級出席總覽 —— Apple 風格
   ============================================ */
/* 標頭：大標題獨立一行、永不跨行，日期選擇器移到下方整條 */
.ao-head { margin-bottom: 16px; }
.ao-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--text);
  margin: 0 0 12px;
}
/* 摘要卡 */
.ao-summary { padding: 20px 18px; margin-bottom: 12px; }
.ao-stats { display: flex; text-align: center; }
.ao-stat { flex: 1; position: relative; }
.ao-stat + .ao-stat::before {
  content: ""; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%); height: 34px; width: 1px;
  background: var(--separator);
}
.ao-stat .n { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.ao-stat .l { font-size: 0.75rem; color: var(--text-secondary); margin-top: 3px; font-weight: 600; }
.ao-bar-wrap { margin-top: 18px; }
.ao-bar { height: 8px; border-radius: 99px; background: rgba(231,76,60,0.14); overflow: hidden; }
.ao-bar > i { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.ao-bar-cap { font-size: 0.75rem; color: var(--text-secondary); margin-top: 6px; text-align: right; font-weight: 600; }
.ao-pending {
  margin-top: 16px; padding: 10px 14px; border-radius: 12px;
  background: rgba(244,162,97,0.12); color: var(--accent-dark);
  font-size: 0.8125rem; font-weight: 600;
}
/* 今日未到 */
.ao-absent { padding: 16px 18px; margin-bottom: 12px; }
.ao-absent h3 { margin: 0 0 12px; font-size: 0.8125rem; font-weight: 700; color: var(--red); }
.ao-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.ao-chip { padding: 6px 11px; border-radius: 12px; background: rgba(231,76,60,0.07); font-size: 0.8125rem; line-height: 1.2; }
.ao-chip b { font-weight: 600; }
.ao-chip i { font-style: normal; color: var(--text-secondary); font-size: 0.75rem; margin-left: 3px; }
/* 各班列表 */
.ao-cls {
  margin-bottom: 8px; border-radius: 16px; overflow: hidden;
  background: var(--card); box-shadow: 0 1px 3px rgba(60,40,20,.08);
  border-left: 3px solid transparent;
}
.ao-cls.pend { border-left-color: var(--orange); background: rgba(244,162,97,0.05); }
.ao-cls.done { border-left-color: var(--green); background: rgba(106,176,123,0.045); }
.ao-cls-row { padding: 15px 16px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: background .15s; }
.ao-cls-row:hover { background: rgba(0,0,0,0.015); }
.ao-cls-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ao-cls-name { font-weight: 700; font-size: 1.0625rem; }
.ao-tag { font-size: 0.75rem; padding: 2px 8px; border-radius: 8px; background: rgba(244,162,97,0.16); color: var(--accent-dark); font-weight: 700; }
.ao-cls-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.ao-cls-info { font-size: 0.8125rem; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ao-cls-info .g { color: var(--green); font-weight: 600; }
.ao-cls-info .r { color: var(--red); font-weight: 600; }
.ao-cls-info .rn { color: var(--red); font-size: 0.8125rem; }
.ao-cls-info .o { color: var(--accent-dark); font-weight: 600; }
.ao-chev { color: var(--text-secondary); font-size: 0.8125rem; flex-shrink: 0; transition: transform .15s; }

/* ---- 2026-09-16 改版：寬螢幕多欄卡片，缺席名單直接印在卡片上（class-att-overview.js）---- */
.ao-head-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ao-head-row .ao-title { margin: 0; flex: 1 1 auto; }
.ao-summary-wide { padding: 14px 18px; }
.ao-pending.ok { background: rgba(106,176,123,0.12); color: var(--green); }
@media (min-width: 900px) {
  .ao-summary-wide { display: flex; align-items: center; gap: 22px; }
  .ao-summary-wide .ao-stats { flex: 0 0 auto; min-width: 320px; }
  .ao-summary-wide .ao-bar-wrap { flex: 1 1 auto; margin-top: 0; }
  .ao-summary-wide .ao-pending { flex: 0 1 34%; margin-top: 0; }
}
.ao-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; align-items: start; }
.ao-card {
  background: var(--card); border-radius: 16px; box-shadow: 0 1px 3px rgba(60,40,20,.08);
  border-left: 3px solid transparent; padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.ao-card.pend { border-left-color: var(--orange); background: rgba(244,162,97,0.06); }
.ao-card.done { border-left-color: var(--red); }
.ao-card.full { border-left-color: var(--green); }
.ao-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ao-card-num { margin-left: auto; font-size: 0.9375rem; font-weight: 700; white-space: nowrap; }
.ao-card-num .g { color: var(--green); }
.ao-card-num .o { color: var(--accent-dark); }
.ao-card-num .sl { color: var(--text-secondary); font-weight: 500; }
.ao-tag.ok { background: rgba(106,176,123,0.16); color: var(--green); }
.ao-tag.bad { background: rgba(231,76,60,0.12); color: var(--red); }
.ao-card-abs { display: flex; flex-wrap: wrap; gap: 6px; }
.ao-abs-chip { padding: 4px 9px; border-radius: 8px; background: rgba(231,76,60,0.08); font-size: 0.8125rem; font-weight: 600; }
.ao-abs-chip i { font-style: normal; font-size: 0.75rem; font-weight: 700; margin-left: 4px; }
.ao-card-note { font-size: 0.8125rem; color: var(--text-secondary); }
.ao-card-more { align-self: flex-start; background: none; border: none; padding: 2px 0; font-size: 0.75rem; color: var(--text-secondary); cursor: pointer; font-weight: 600; }
.ao-card-more:hover { color: var(--accent-dark); }
.ao-card-detail:empty { display: none; }
.ao-card-detail { border-top: 1px solid var(--separator); padding-top: 6px; }
.ao-det-title { font-size: 0.75rem; font-weight: 700; margin: 6px 0 4px; }
.ao-det-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ao-det-chips span { padding: 3px 8px; border-radius: 8px; font-size: 0.8125rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

/* ============================================
   表單
   ============================================ */
.form-row {
  display: flex;
  flex-direction: column;
}

.form-row input,
.form-row select {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-bottom: 0.33px solid var(--separator);
  border-radius: 0;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.2s;
}

.form-row input:last-child,
.form-row select:last-child { border-bottom: none; }

.form-row select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%23c7c7cc' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 36px;
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  background: rgba(244, 162, 97, 0.04);
}

.form-row input::placeholder { color: var(--text-secondary); opacity: 0.6; }

/* 欄位小標題（日期框沒有 placeholder，看不出來是要填什麼）*/
.form-row .form-row-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 10px 16px 2px;
  letter-spacing: 0.3px;
}

/* ============================================
   按鈕
   ============================================ */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, #E07B35, #C9652A); color: white; box-shadow: 0 3px 12px rgba(244, 162, 97, 0.25); }
.btn-success { background: linear-gradient(135deg, #3E8E57, #3E8E57); color: white; box-shadow: 0 3px 12px rgba(106, 176, 123, 0.25); }

.btn-danger {
  background: rgba(231, 76, 60, 0.08);
  color: var(--red);
  padding: 6px 0;
  font-size: 0.9375rem;
  font-weight: 500;
  width: auto;
  display: inline;
}

/* ============================================
   庫存登記管理：狀態切換 segmented control
   ============================================ */
.inv-seg {
  display: flex;
  flex: 1;
  min-width: 0;
  max-width: 460px;
  background: rgba(120, 120, 128, 0.08);
  border-radius: 8px;
  padding: 3px;
}

.inv-seg-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 2px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.inv-seg-btn.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(60,40,20,.08);
}

/* 代辦物品：學期消耗總覽的表格（inventory-records.js）
   手機上欄位塞不下會把最重要的「夠不夠」擠出畫面，所以窄螢幕縮字級並藏掉
   「比較學期出」那欄（同一個數字在卡片標題已經有了） */
.invu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}
.invu-table th,
.invu-table td {
  padding: 5px 6px;
}
.invu-table th {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
}
@media (max-width: 520px) {
  .invu-table { font-size: 0.75rem; }
  .invu-table th,
  .invu-table td { padding: 4px 3px; }
  .invu-narrow-hide { display: none; }
}

.inv-seg-n {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0 5px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  border-radius: 8px;
  text-align: center;
}

.inv-seg-n.n-ordered { background: rgba(255, 149, 0, 0.14); color: var(--orange); }
.inv-seg-n.n-delivered { background: rgba(88, 86, 214, 0.12); color: #3872B8; }
.inv-seg-n.n-confirmed { background: rgba(52, 199, 89, 0.12); color: var(--green); }

/* 登記管理操作列的小按鈕 */
.inv-act-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* ============================================
   頁面切換
   ============================================ */
.page { display: none; }
.page.active { display: block; }

/* 收費設定頁分頁：用 class 藏，不動元素自己的 inline display
   （#fs-assign-area / #ri-apply-area 的 display 由 JS 管，直接改 style 會打架） */
.fs-tab-hide { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   列表
   ============================================ */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 0.33px solid var(--separator);
}

.list-item:last-child { border-bottom: none; }
.list-item-info { flex: 1; }
.list-item-info .name { font-weight: 500; font-size: 0.9375rem; }
.list-item-info .detail { color: var(--text-secondary); font-size: 0.8125rem; margin-top: 2px; }

/* ============================================
   點名
   ============================================ */
.att-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 0.33px solid var(--separator);
  gap: 10px;
}

.att-row:last-child { border-bottom: none; }
.att-row .name { flex: 1; font-size: 0.9375rem; }

.att-status { display: flex; gap: 8px; }

.att-status button {
  width: 38px; height: 38px;
  border: none; border-radius: 50%;
  background: var(--bg);
  font-size: 0.75rem; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}

.att-status button:active { transform: scale(0.85); }
.att-status button.present.selected { background: var(--green); color: white; box-shadow: 0 2px 10px rgba(106,176,123,0.35); }
.att-status button.absent.selected { background: var(--red); color: white; box-shadow: 0 2px 10px rgba(231,76,60,0.3); }
.att-status button.late.selected { background: var(--orange); color: white; box-shadow: 0 2px 10px rgba(244,162,97,0.35); }

/* ============================================
   Toast / Empty
   ============================================ */
.empty-msg { text-align: center; color: var(--text-secondary); padding: 24px 16px; font-size: 0.9375rem; }

.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(45,52,54,0.9); backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: white; padding: 13px 26px; border-radius: 16px;
  font-size: 0.9375rem; font-weight: 500; z-index: 9999;
  animation: toastAnim 2s ease forwards;
}
.toast--error { background: var(--kd-danger); animation-duration: 4s; }

@keyframes toastAnim {
  0% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-6px); }
}

/* ============================================
   課程學生管理
   ============================================ */
.course-expand {
  margin-top: 10px; padding: 14px 16px;
  background: var(--bg); border-radius: 8px;
}

.course-expand select {
  padding: 10px 12px; border: none; border-radius: 8px;
  font-family: inherit; font-size: 0.9375rem; background: var(--card); margin-right: 8px;
  transition: background 0.2s;
}

.course-student-tag {
  display: inline-flex; align-items: center;
  background: rgba(0,122,255,0.1); color: var(--accent);
  padding: 6px 14px; border-radius: 50px; margin: 3px;
  font-size: 0.8125rem; font-weight: 500;
}

.course-student-tag .remove { cursor: pointer; margin-left: 6px; color: var(--text-secondary); font-size: 0.75rem; }
.course-student-tag .remove:hover { color: var(--red); }

