/* ══════════════════════════════════════════
   校務系統 — UI 主題
   配色對齊屹澧餐飲系統(LINE OA Manager 風格)
   主色:#06C755（LINE Green）／白色側欄
   ══════════════════════════════════════════ */

:root {
  --green:       #06C755;
  --green-dark:  #05A847;
  --green-light: #E8F9EE;
  --green-mid:   #D0F0DC;

  --sidebar-w:   240px;
  --sidebar-bg:  #FFFFFF;
  --body-bg:     #F5F7FA;
  --panel:       #FFFFFF;
  --panel-head:  #FAFBFC;
  --border:      #E8EAED;
  --border-soft: #F3F4F6;

  --text-main:   #1C1C1C;
  --text-sub:    #6B7280;
  --text-hint:   #9CA3AF;

  --danger:      #EF4444;
  --danger-dark: #DC2626;
  --danger-soft: #FEF2F2;
  --warn:        #F59E0B;
  --warn-soft:   #FFFBEB;
  --ok:          #05A847;
  --ok-soft:     #E8F9EE;
  --info:        #3B82F6;
  --info-soft:   #EFF6FF;

  /* 中性灰:大面積區塊(說明框、頭像底、圖示底)一律用這組,
     綠色只留給主要按鈕、側欄選中項、成功狀態這些「重點」 */
  --neutral:      #64748B;
  --neutral-soft: #F1F3F6;

  --radius:      10px;
  --card-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', 'Noto Sans TC', '微軟正黑體', 'Microsoft JhengHei', sans-serif;
  background: var(--body-bg);
  color: var(--text-main);
  font-size: 0.9rem;
  line-height: 1.6;
}

a { color: var(--green-dark); text-decoration: none; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; }
code {
  background: var(--border-soft); padding: 1px 5px;
  border-radius: 4px; font-size: 0.85em; color: var(--text-sub);
}

/* ── 登入頁 ───────────────────────────── */
/* 版型對齊金研院排課系統(scheduling.yilicorp.com.tw/login):
   左半綠色品牌區 + 右半表單。1024px 以下左半收起,改在表單上方放小 logo。 */
.login-split { min-height: 100vh; display: flex; background: var(--body-bg); }

/* ── 左:品牌區 ── */
.login-hero {
  display: none;                       /* 窄螢幕不顯示,下面 media query 才打開 */
  width: 50%; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #05A847 0%, #06C755 45%, #059669 100%);
}
.hero-pattern { position: absolute; inset: 0; opacity: 0.07; }
.hero-circle { position: absolute; border-radius: 50%; }
.hero-circle.c1 {
  top: -80px; right: -80px; width: 256px; height: 256px;
  background: rgba(255, 255, 255, .10);
}
.hero-circle.c2 {
  bottom: -128px; left: -64px; width: 320px; height: 320px;
  background: rgba(255, 255, 255, .05);
}
.hero-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 4rem; width: 100%;
}
.hero-badge {
  width: 64px; height: 64px; border-radius: 16px;
  background: rgba(255, 255, 255, .20);
  border: 1px solid rgba(255, 255, 255, .10);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.5rem;
}
.hero-inner h1 {
  font-size: 2.25rem; font-weight: 800; color: #fff;
  line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 0.75rem;
}
.hero-inner .hero-sub {
  color: #D5F5D9; font-size: 1.05rem; font-weight: 500; margin-bottom: 2.5rem;
}
.hero-features { display: flex; flex-direction: column; gap: 1.25rem; }
.hero-feature { display: flex; align-items: center; gap: 1rem; color: #ECFDF3; }
.hero-feature .fi {
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255, 255, 255, .15);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.hero-feature .ft { font-weight: 600; font-size: 0.92rem; }
.hero-feature .fd { font-size: 0.8rem; color: rgba(209, 250, 229, .8); }

/* ── 右:表單區 ── */
.login-panel {
  width: 100%; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; background: #fff;
}
.login-box { width: 100%; max-width: 360px; }

.login-mobile-logo { text-align: center; margin-bottom: 2.5rem; }
.login-mobile-logo .lm-icon {
  width: 56px; height: 56px; border-radius: 16px; background: var(--green);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.login-mobile-logo h1 { font-size: 1.25rem; font-weight: 700; color: var(--text-main); }
.login-mobile-logo p { font-size: 0.8rem; color: var(--text-hint); margin: 4px 0 0; }

.login-welcome { margin-bottom: 2rem; }
.login-welcome h2 {
  font-size: 1.5rem; font-weight: 800;
  color: var(--text-main); letter-spacing: -0.02em;
}
.login-welcome p { color: var(--text-sub); font-size: 0.85rem; margin: 0.5rem 0 0; }

.login-form { display: flex; flex-direction: column; gap: 1.15rem; }
.login-form label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-sub); margin-bottom: 6px;
}
.login-form input { padding: 0.7rem 0.9rem; border-radius: 10px; font-size: 0.9rem; }
.login-form .btn.block { padding: 0.8rem; border-radius: 12px; font-size: 0.95rem; }

/* 密碼欄的預覽眼睛。按鈕疊在輸入框右側,輸入框自己留出空間避開它 */
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 2.6rem !important; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: none; background: none;
  color: var(--text-hint); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px;
}
.pw-eye:hover { background: var(--body-bg); color: var(--text-main); }
/* 預設顯示「睜眼」（代表按了會看到密碼）;按下去之後換成劃掉的眼睛 */
.pw-eye .eye-off { display: none; }
.pw-eye[aria-pressed="true"] .eye-open { display: none; }
.pw-eye[aria-pressed="true"] .eye-off { display: inline; }
.pw-eye[aria-pressed="true"] { color: var(--green-dark); }

.login-links { display: flex; justify-content: flex-end; margin-top: -0.6rem; }
.linkish {
  border: none; background: none; padding: 0;
  color: var(--green-dark); font-size: 0.82rem; font-family: inherit;
  cursor: pointer; text-decoration: underline;
}
.linkish:hover { color: var(--green); }

.forgot-box {
  margin-top: 1.1rem; padding: 0.9rem 1rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel-head);
}
.fb-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.fb-desc { font-size: 0.78rem; color: var(--text-sub); line-height: 1.7; margin: 0 0 10px; }
.fb-field { margin-bottom: 8px; }
.fb-field label {
  display: block; font-size: 0.76rem; color: var(--text-sub); margin-bottom: 3px;
}
.fb-field input {
  width: 100%; padding: 0.5rem 0.7rem; border-radius: 8px; font-size: 0.85rem;
}
.fb-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.login-foot {
  text-align: center; font-size: 0.72rem;
  color: var(--text-hint); margin-top: 2.5rem;
}

.login-hint {
  margin-top: 1.5rem; padding: 12px 14px;
  background: var(--neutral-soft); border-radius: var(--radius);
  font-size: 0.72rem; color: var(--text-sub); line-height: 1.85;
}
.login-hint b { color: var(--text-main); }

@media (min-width: 1024px) {
  .login-hero { display: flex; }
  .login-panel { width: 50%; padding: 2rem; }
  .login-mobile-logo { display: none; }
}

/* ── 版面 ─────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: width .18s ease;
}

.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  height: 64px; padding: 0 1rem;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}

/* ── 側欄摺疊（預設摺疊,狀態記在 localStorage）───────────
   老闆 2026-08-19 指定:收起就**整條收乾淨**,不留只有圖示的細軌道。
   摺疊鈕長在 topbar 裡(不在側欄內),所以收起後照樣叫得回來。 */
.sidebar.collapsed {
  width: 0; min-width: 0; overflow: hidden; border-right: none;
}

.sidebar-toggle {
  border: 1px solid var(--border); background: #fff;
  width: 30px; height: 30px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-sub); font-size: 15px;
  flex-shrink: 0; font-family: inherit;
}
.sidebar-toggle:hover { background: var(--body-bg); color: var(--text-main); }
.sidebar .brand .brand-icon {
  width: 34px; height: 34px; background: var(--green);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; flex-shrink: 0;
}
.sidebar .brand .brand-text {
  font-weight: 700; font-size: 0.88rem;
  color: var(--text-main); line-height: 1.3; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.sidebar .brand .brand-text small {
  display: block; font-weight: 400;
  color: var(--text-hint); font-size: 0.72rem;
}

.sidebar nav {
  flex: 1; overflow-y: auto; padding: 0.5rem 0;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sidebar nav::-webkit-scrollbar { width: 4px; }
.sidebar nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-group > label {
  display: block;
  padding: 1rem 1rem 0.35rem;
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.8px; color: var(--text-hint);
  white-space: nowrap;
}

.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 0.6rem 0.75rem; margin: 1px 8px;
  border-radius: 8px;
  color: var(--text-sub); font-size: 0.875rem; font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.sidebar nav a:hover { background: var(--body-bg); color: var(--text-main); }
.sidebar nav a.active {
  background: var(--green-light);
  color: var(--green-dark);
  border-left-color: var(--green);
  font-weight: 600;
}
.sidebar nav a .ic {
  font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 0.875rem 1rem; flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; background: var(--neutral-soft);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-sub); flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-info .user-name {
  font-size: 0.85rem; font-weight: 600; color: var(--text-main);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-info .user-role {
  font-size: 0.72rem; color: var(--text-hint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; gap: 12px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-weight: 600; font-size: 0.95rem; color: var(--text-main); }
.topbar .right { display: flex; align-items: center; gap: 10px; }

.content { flex: 1; padding: 1.5rem; }

/* ── 卡片 ─────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.card-head {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel-head);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-head h3 { font-size: 0.9rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.card-body.tight { padding: 0; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── 按鈕 ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.45rem 0.9rem;
  border-radius: 7px; border: 1px solid var(--border);
  background: #fff; color: var(--text-main);
  font-size: 0.84rem; font-weight: 500;
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--body-bg); border-color: #D8DBE0; }
.btn.primary {
  background: var(--green); border-color: var(--green);
  color: #fff; font-weight: 600;
}
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn.ghost { color: var(--green-dark); border-color: var(--green); background: #fff; }
.btn.ghost:hover { background: var(--green-light); }
.btn.danger { color: var(--danger-dark); border-color: #FBCFCF; }
.btn.danger:hover { background: var(--danger-soft); border-color: #F5B5B5; }
.btn.sm { padding: 0.28rem 0.6rem; font-size: 0.76rem; }
.btn.block { width: 100%; justify-content: center; padding: 0.65rem; font-size: 0.9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── 表單 ─────────────────────────────── */
.field { margin-bottom: 1rem; }
.field > label {
  display: block; font-size: 0.78rem; font-weight: 600;
  color: var(--text-sub); margin-bottom: 5px;
}
.field > label .req { color: var(--danger); }
.field .hint { font-size: 0.72rem; color: var(--text-hint); margin-top: 4px; line-height: 1.5; }

/* 少一種 type 那個欄位就完全沒樣式,掉回瀏覽器預設長相 ——
   2026-08-19 漏了 search,搜尋框跟旁邊的欄位長得不一樣。加新欄位記得補這裡。 */
input[type=text], input[type=password], input[type=number],
input[type=date], input[type=email], input[type=file], input[type=search],
input[type=tel], select, textarea {
  width: 100%; padding: 0.5rem 0.7rem;
  font-size: 0.85rem; font-family: inherit;
  border: 1px solid var(--border); border-radius: 7px;
  background: #fff; color: var(--text-main);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 0.2rem rgba(6, 199, 85, 0.15);
}
textarea { resize: vertical; min-height: 72px; line-height: 1.6; }
input[readonly] { background: var(--panel-head); color: var(--text-sub); }
input[type=checkbox] { accent-color: var(--green); }

.grid { display: grid; gap: 1rem; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }

/* ── 表格 ─────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  background: var(--panel-head); text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.8rem; font-weight: 600; color: var(--text-sub);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td {
  padding: 0.65rem 1rem; vertical-align: middle;
  border-bottom: 1px solid var(--border-soft); color: var(--text-main);
}
tbody tr:hover { background: var(--panel-head); }
tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
.subtable { font-size: 0.83rem; }
.subtable td, .subtable th { padding: 0.45rem 0.7rem; }

/* ── 標籤 ─────────────────────────────── */
.tag {
  display: inline-block; padding: 0.15rem 0.55rem;
  border-radius: 20px; font-size: 0.72rem; font-weight: 600;
  background: #EEF0F3; color: var(--text-sub); white-space: nowrap;
}
.tag.ok     { background: var(--ok-soft);     color: var(--ok); }
.tag.warn   { background: var(--warn-soft);   color: #B45309; }
.tag.danger { background: var(--danger-soft); color: var(--danger-dark); }
.tag.brand  { background: var(--green-light); color: var(--green-dark); }
.tag.info   { background: var(--info-soft);   color: #1D4ED8; }

/* 角色徽章（對齊屹澧的角色配色慣例）
   一律寫成 .tag.role-xxx —— 只寫 .role-xxx 的話特異性輸給 .tag.brand,顏色會被蓋掉 */
.tag.role-platform_admin { background: #1F2937;      color: #fff; }
.tag.role-org_admin      { background: var(--green); color: #fff; }
.tag.role-supervisor     { background: #0EA5E9;      color: #fff; }
.tag.role-campus_manager { background: #8B5CF6;      color: #fff; }
.tag.role-staff          { background: #3B82F6;      color: #fff; }
.tag.role-teacher        { background: #F59E0B;      color: #fff; }

/* ── 頭像 ─────────────────────────────── */
/* 學生頭像每列都有,用中性灰;整片綠點會讓列表很吵 */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  background: var(--neutral-soft); color: var(--text-sub);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700; flex-shrink: 0;
}
.avatar.lg { width: 60px; height: 60px; font-size: 1.25rem; }

.health-btn {
  border: none; background: var(--warn-soft); color: #B45309;
  border-radius: 6px; padding: 0.15rem 0.5rem;
  font-size: 0.75rem; font-family: inherit; font-weight: 700; cursor: pointer;
}
.health-btn:hover { background: #FDE68A; }

/* ── 統計卡 ───────────────────────────── */
.stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1rem; margin-bottom: 1.25rem;
}
.stat {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--card-shadow);
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  background: var(--neutral-soft); color: var(--neutral);
}
.stat-icon.green  { background: var(--green-light); color: var(--green-dark); }
.stat-icon.blue   { background: var(--info-soft);   color: var(--info); }
.stat-icon.purple { background: #F3E8FF;            color: #8B5CF6; }
.stat-icon.amber  { background: var(--warn-soft);   color: var(--warn); }
.stat-body { min-width: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--text-main); }
.stat-label { font-size: 0.78rem; color: var(--text-sub); margin-top: 3px; }
.stat-sub {
  font-size: 0.72rem; color: var(--text-hint); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── 提示 ─────────────────────────────── */
.empty { padding: 3rem 1.25rem; text-align: center; color: var(--text-hint); }
.empty .big { font-size: 2rem; display: block; margin-bottom: 8px; opacity: .45; }

.alert {
  padding: 0.7rem 0.95rem; border-radius: 8px;
  font-size: 0.83rem; line-height: 1.7;
  margin-bottom: 1rem; border: 1px solid transparent;
}
.alert.err  { background: var(--danger-soft); color: #991B1B; border-color: #FCA5A5; }
.alert.warn { background: var(--warn-soft);   color: #92400E; border-color: #FCD34D; }
/* .ok 才是綠的（真的成功時才出現）;.info 是每頁都有的說明框,一律中性灰 */
.alert.ok   { background: var(--ok-soft);      color: #04702F; border-color: var(--green-mid); }
.alert.info {
  background: var(--neutral-soft); color: var(--text-sub);
  border-color: var(--border); border-left: 3px solid #CBD5E1;
}

/* ── Modal ────────────────────────────── */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(28, 28, 28, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 900; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 440px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal.wide  { max-width: 760px; }
.modal.xwide { max-width: 1020px; }
.modal-head {
  padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border);
  background: var(--panel-head);
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 12px 12px 0 0;
}
.modal-head h3 { font-size: 0.95rem; font-weight: 600; }
.modal-head .x {
  border: none; background: none; font-size: 1.35rem; line-height: 1;
  color: var(--text-hint); cursor: pointer; padding: 0 4px;
}
.modal-head .x:hover { color: var(--text-main); }
.modal-body { padding: 1.25rem; overflow-y: auto; }
.modal-foot {
  padding: 0.85rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

.toast-wrap {
  position: fixed; top: 1rem; right: 1rem; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--text-main); color: #fff;
  padding: 0.65rem 1rem; border-radius: 8px;
  font-size: 0.83rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  max-width: 320px;
}
.toast.err { background: var(--danger-dark); }
.toast.ok  { background: var(--green-dark); }

/* ── 步驟列（Excel 匯入） ───────────────── */
.step-bar { display: flex; margin-bottom: 1.25rem; }
.step {
  flex: 1; padding: 0.6rem 0.75rem;
  background: #EEF0F3; color: var(--text-hint);
  font-size: 0.78rem; font-weight: 600; text-align: center;
  border-right: 2px solid #fff;
}
.step:first-child { border-radius: 8px 0 0 8px; }
.step:last-child { border-radius: 0 8px 8px 0; border-right: none; }
.step.active { background: var(--green); color: #fff; }
.step.done { background: var(--green-mid); color: var(--green-dark); }

/* ── 報到成功 ─────────────────────────── */
.checkin-hit {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.checkin-hit .ci-who { display: flex; align-items: center; gap: 1rem; }
.checkin-hit .ci-name { font-size: 1.35rem; font-weight: 700; line-height: 1.3; }
.checkin-hit .ci-time {
  text-align: right; padding-left: 1rem;
  border-left: 1px solid var(--green-mid); min-width: 150px;
}
.checkin-hit .ci-label { font-size: 0.7rem; color: var(--text-sub); }
.checkin-hit .ci-clock {
  font-size: 1.75rem; font-weight: 700; line-height: 1.2;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.checkin-hit .ci-date { font-size: 0.78rem; color: var(--text-sub); }

@media (max-width: 600px) {
  .checkin-hit .ci-time {
    text-align: left; padding-left: 0; border-left: none;
    border-top: 1px solid var(--green-mid); padding-top: 0.6rem; width: 100%;
  }
}

/* ── 課表週檢視 ───────────────────────── */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week-col { min-width: 0; }
.week-col-head {
  font-size: 0.78rem; font-weight: 700; color: var(--text-sub);
  padding-bottom: 6px; margin-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.week-col-head.today { color: var(--green-dark); border-bottom-color: var(--green); }
.week-col-head .wd { font-size: 0.7rem; font-weight: 400; color: var(--text-hint); }

.lesson-card {
  border: 1px solid var(--border); border-left: 3px solid var(--green);
  background: #fff; border-radius: 6px;
  padding: 8px 9px; margin-bottom: 7px; cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.lesson-card:hover { box-shadow: var(--card-shadow); border-color: #D8DBE0; }
.lesson-card.off { opacity: .5; background: var(--neutral-soft); }
.lesson-card .lc-time { font-size: 0.75rem; font-weight: 700; }
.lesson-card .lc-name { font-size: 0.82rem; font-weight: 600; margin: 1px 0 3px; }
.lesson-card .lc-meta { font-size: 0.7rem; color: var(--text-hint); line-height: 1.5; }
.lesson-card .lc-foot { margin-top: 5px; }

.alert-cancel { background: var(--danger-soft); color: #991B1B; border-color: #FCA5A5; }

/* ── 週／月 切換鈕 ────────────────────── */
.seg {
  display: inline-flex; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; background: #fff;
}
.seg button {
  border: none; background: none; cursor: pointer; font-family: inherit;
  padding: 0.42rem 0.95rem; font-size: 0.82rem; font-weight: 600;
  color: var(--text-sub);
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--body-bg); }
.seg button.on { background: var(--green); color: #fff; }

/* ── 月曆檢視 ─────────────────────────── */
.month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.month-head {
  background: var(--panel-head); padding: 8px 6px;
  font-size: 0.75rem; font-weight: 700; color: var(--text-sub); text-align: center;
}
.month-cell {
  background: #fff; min-height: 96px; padding: 6px;
  display: flex; flex-direction: column; gap: 3px;
}
.month-cell.outside { background: var(--neutral-soft); }
.month-cell.outside .mc-day { color: var(--text-hint); }
.month-cell.today { background: var(--green-light); }
.mc-day {
  font-size: 0.75rem; font-weight: 700; color: var(--text-sub); margin-bottom: 2px;
}
.mc-today {
  background: var(--green); color: #fff; border-radius: 10px;
  padding: 0 6px; font-size: 0.65rem; font-weight: 600;
}
.mc-item {
  display: flex; align-items: center; gap: 4px;
  background: var(--panel-head); border-radius: 4px;
  padding: 3px 5px; cursor: pointer; font-size: 0.72rem;
  border: 1px solid transparent;
}
.mc-item:hover { border-color: #C9CDDB; background: #fff; }
.mc-item.off { opacity: .45; text-decoration: line-through; }
.mc-item .dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.mc-item .t { font-weight: 700; flex-shrink: 0; }
.mc-item .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 700px) {
  .month-cell { min-height: 62px; padding: 4px; }
  .mc-item .n { display: none; }
  .month-head { font-size: 0.68rem; padding: 6px 2px; }
}

/* ── 點名按鈕組 ───────────────────────── */
.att-group { display: inline-flex; gap: 4px; }
.att-btn {
  border: 1px solid var(--border); background: #fff; color: var(--text-sub);
  border-radius: 7px; padding: 0.32rem 0.7rem;
  font-size: 0.8rem; font-family: inherit; font-weight: 600; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.att-btn:hover { background: var(--body-bg); }
.att-btn[aria-pressed="true"].att-present { background: var(--green); border-color: var(--green); color: #fff; }
.att-btn[aria-pressed="true"].att-leave   { background: var(--warn);  border-color: var(--warn);  color: #fff; }
.att-btn[aria-pressed="true"].att-absent  { background: var(--danger); border-color: var(--danger); color: #fff; }

/* 還沒點的那一列用左邊一條琥珀線標出來,一眼看得出誰漏了 */
tr.unmarked td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

.checkin-hit .ci-lesson { font-size: 0.8rem; margin-top: 4px; }

@media (max-width: 1100px) {
  .week-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 700px) {
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .att-group { flex-wrap: wrap; justify-content: flex-end; }
  .att-btn { padding: 0.3rem 0.55rem; font-size: 0.75rem; }
}

/* ── 課表方塊 ─────────────────────────── */
.day-col-title {
  font-size: 0.78rem; font-weight: 700; margin-bottom: 6px; color: var(--text-sub);
}
.day-col-title.today { color: var(--green-dark); }
.lesson-chip {
  border-left: 3px solid var(--green);
  background: var(--panel-head); border-radius: 6px;
  padding: 0.45rem 0.55rem; margin-bottom: 6px;
}
.lesson-chip .t { font-size: 0.78rem; }
.lesson-chip .m { font-size: 0.72rem; color: var(--text-hint); }

/* ── 權限設定 ─────────────────────────── */
.perm-group { margin-bottom: 16px; }
.perm-group-title {
  font-size: 0.76rem; font-weight: 700; color: var(--text-hint);
  letter-spacing: .04em; margin-bottom: 6px;
}
.perm-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 0.6rem 0.75rem; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 6px; background: #fff;
}
/* 跟隨角色預設時整區調淡,但仍看得到目前是什麼權限 */
#permBody.locked { opacity: 0.55; }
#permBody.locked .perm-btn { cursor: not-allowed; }
.perm-btn[aria-pressed="true"] {
  background: var(--green); border-color: var(--green); color: #fff;
}
.perm-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* 可勾選的膠囊(選分校、跟隨角色預設) */
.check-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.3rem 0.7rem; font-size: 0.8rem; cursor: pointer; background: #fff;
}
.check-chip input { width: auto; margin: 0; }
.check-chip:has(input:checked) {
  border-color: var(--green); background: var(--green-light); color: var(--green-dark);
}
/* 這間分校已經有同樣期限＋堂數的方案了,勾了會被擋 */
.check-chip.taken {
  border-color: var(--danger); background: var(--danger-soft); color: var(--danger-dark);
}

@media (max-width: 700px) {
  .perm-row { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ── 收費方案與帳務 ───────────────────── */
.plan-group { margin-bottom: 18px; }
.plan-group-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 0.5rem 1rem; background: var(--panel-head);
  border-bottom: 1px solid var(--border);
}
/* 停用的列調淡,但還看得到 —— 要查歷史的時候找得到 */
tr.row-off { opacity: 0.5; }
tr.row-off b { font-weight: 500; }

/* 四格摘要要**排成一行** —— 老闆 2026-08-19 指定。
   3 欄時第四格會自己掉到下一行,看起來像壞掉。 */
.bill-top {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.bill-stat {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0.6rem 0.7rem; background: #fff;
  min-width: 0;                     /* 沒有這行,長字串會把格子撐開破壞等寬 */
}
.bill-label {
  font-size: 0.7rem; color: var(--text-hint);
  font-weight: 700; letter-spacing: .04em; margin-bottom: 4px;
}
/* 格子窄了,提示字跟著收一點,才不會每格都擠成三行 */
.bill-stat .small { font-size: 0.72rem; line-height: 1.5; }
.warn-text { color: #B45309; }

/* 點名名單上「已欠費」的那一列,左邊一條紅線 —— 跟未點名的琥珀線區分開 */
tr.owed td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

/* 螢幕變窄時分兩段收,不要一次從 4 欄掉成 1 欄 */
@media (max-width: 900px) {
  .bill-top { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .bill-top { grid-template-columns: 1fr; }
}

/* ── 代辦事項 ─────────────────────────── */
.todo-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
}
.todo-tile {
  display: flex; align-items: center; gap: 10px; text-align: left;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  padding: 0.7rem 0.8rem; cursor: pointer; font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.todo-tile:hover:not([disabled]) { border-color: var(--green); }
.todo-tile.picked { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-light); }
/* 沒有待辦的那格調淡並鎖住 —— 還是要看得到,才知道「這項是零」 */
.todo-tile.done, .todo-tile[disabled] { opacity: .45; cursor: default; }
.tt-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; background: var(--body-bg); color: var(--text-sub);
}
.todo-tile.danger .tt-icon { background: var(--danger-soft); color: var(--danger-dark); }
.todo-tile.warn .tt-icon   { background: var(--warn-soft);   color: #B45309; }
.todo-tile.info .tt-icon   { background: var(--info-soft);   color: #1D4ED8; }
.tt-count { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.tt-unit { font-size: 0.7rem; font-weight: 500; color: var(--text-hint); margin-left: 2px; }
.tt-title { font-size: 0.8rem; font-weight: 600; }
.tt-sub { font-size: 0.7rem; color: var(--text-hint); }

/* ── 收款報表 ─────────────────────────── */
.rv-chart {
  display: flex; align-items: flex-end; gap: 4px;
  height: 160px; margin-top: 18px; padding: 0 2px;
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.rv-bar {
  flex: 1 0 22px; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; height: 100%;
}
.rv-fill {
  width: 70%; min-height: 2px; border-radius: 4px 4px 0 0;
  background: var(--green); transition: height .2s;
}
.rv-bar:hover .rv-fill { background: var(--green-dark); }
.rv-key {
  font-size: 0.65rem; color: var(--text-hint); margin-top: 4px;
  white-space: nowrap;
}
.rv-break {
  border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem 0.9rem;
}
.rv-break-title {
  font-size: 0.74rem; font-weight: 700; color: var(--text-hint);
  letter-spacing: .04em; margin-bottom: 6px;
}
.rv-line {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.82rem; padding: 3px 0;
}

@media (max-width: 900px) {
  .todo-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .todo-row { grid-template-columns: 1fr; }
}

/* ── 工具 ─────────────────────────────── */
.rowline { display: flex; align-items: center; gap: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.muted { color: var(--text-sub); }
.hint-text { color: var(--text-hint); }
.small { font-size: 0.78rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }

/* ── 手機 ─────────────────────────────── */
@media (max-width: 900px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* 手機:側欄改成「蓋在內容上的抽屜」,不擠壓版面。
     展開時用超大 box-shadow 當背景遮罩,收起時拿掉。
     摺疊鈕在手機上一定要看得見 —— 收乾淨之後只剩它能把選單叫回來。 */
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
  }
  .sidebar.collapsed { box-shadow: none; }
  .sidebar-toggle { display: inline-flex; }

  .topbar { padding: 0 0.75rem; height: 56px; }
  .topbar .page-title { font-size: 0.88rem; }
  .content { padding: 0.75rem; }
  .card-body { padding: 0.75rem; }
  .card-head { padding: 0.6rem 0.75rem; }
  thead th, tbody td { padding: 0.45rem 0.6rem; font-size: 0.78rem; }
  .stat { padding: 0.85rem; gap: 0.7rem; }
  .stat-icon { width: 38px; height: 38px; font-size: 16px; }
  .stat-value { font-size: 1.2rem; }
  .step { font-size: 0.68rem; padding: 0.5rem 0.3rem; }
}
