/* ==========================================================================
 * FOS v2 · staff/portal.css — 員工 Portal 專屬樣式（手機優先；疊在 tokens.css + store.css 上）
 * ========================================================================== */

body { background: var(--bg-1, #F4F7FB); }
.sp-frame { max-width: var(--frame-mobile, 448px); margin: 0 auto; padding: 0 14px 84px; }

/* ---- 頂欄 ---- */
.sp-topbar { position: sticky; top: 0; z-index: var(--z-header, 60); background: linear-gradient(135deg, var(--ink-2, #14304d) 0%, var(--ink, #0A2540) 100%); color: #FFF; padding: 13px 16px; display: flex; align-items: center; gap: 10px; }
.sp-title { font-size: 17px; font-weight: 900; letter-spacing: -.01em; flex: 1; }
.sp-user { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.sp-user b { font-weight: 900; }
.sp-role { font-family: var(--font-mono); font-size: 12.5px; font-weight: 800; background: var(--gold, #E8C97A); color: var(--ink, #0A2540); border-radius: 6px; padding: 1px 7px; }

/* ---- 底部 tab 導覽 ---- */
.sp-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-header, 60); background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--border, #DCE5EF); display: flex; max-width: var(--frame-mobile, 448px); margin: 0 auto; }
.sp-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 10px; text-decoration: none; color: var(--text-muted-strong, #5f7590); font-size: 12.5px; font-weight: 800; }
.sp-tab-ic { font-size: 17px; line-height: 1; }
.sp-tab.active { color: var(--ink, #0A2540); }
.sp-tab.active .sp-tab-ic { color: var(--gold-dark, #B9922F); }

/* ---- 區段標題 ---- */
.sp-sec { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 9px; }
.sp-sec h2 { margin: 0; font-size: 15px; font-weight: 900; color: var(--text-1, #0A2540); letter-spacing: -.01em; }
.sp-sec .cnt { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; color: var(--text-muted-strong); }
.sp-sec .r { margin-left: auto; font-size: 12.5px; font-weight: 800; color: var(--info, #1F5A8C); text-decoration: none; }

/* ---- 課卡（手機大卡） ---- */
.sp-lesson { display: block; background: #FFF; border: 1px solid var(--border, #DCE5EF); border-radius: 14px; padding: 13px 14px; margin-bottom: 10px; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(10,37,64,.05); }
.sp-lesson:active { transform: scale(.99); }
.sp-l-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp-l-time { font-family: var(--font-mono); font-size: 13.5px; font-weight: 850; color: var(--ink); }
.sp-l-badges { margin-left: auto; display: flex; gap: 5px; }
.sp-l-title { font-size: 15.5px; font-weight: 900; margin: 6px 0 3px; color: var(--text-1); }
.sp-l-meta { font-size: 13px; color: var(--text-2, #33475F); font-weight: 600; line-height: 1.55; }
.sp-l-meta .mono { font-family: var(--font-mono); }
.sp-l-students { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.sp-stu { font-size: 12.5px; font-weight: 800; background: var(--surface-1, #F0F4F9); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; color: var(--text-1); }
.sp-l-coach { font-size: 12.5px; color: var(--gold-text, #7A5A20); font-weight: 800; margin-top: 6px; }
.sp-day-hd { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 8px; }
.sp-day-hd .d { font-family: var(--font-mono); font-size: 14px; font-weight: 900; color: var(--ink); }
.sp-day-hd .w { font-size: 12.5px; font-weight: 700; color: var(--text-muted-strong); }
.sp-day-hd .n { margin-left: auto; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted-strong); font-weight: 700; }

/* 狀態 chips */
.sp-chip { font-size: 12.5px; font-weight: 800; border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.sp-chip.ok { background: var(--ok-soft, #E4F1EA); color: var(--ok, #2F7A5A); }
.sp-chip.warn { background: var(--warn-soft, #F7EDD6); color: var(--warn-strong, #A67A1C); }
.sp-chip.danger { background: var(--danger-soft, #F6E1E1); color: var(--danger-strong, #B14A4A); }
.sp-chip.info { background: var(--info-soft, #E2EDF7); color: var(--info, #1F5A8C); }
.sp-chip.muted { background: var(--surface-1, #F0F4F9); color: var(--text-muted-strong); }

/* ---- 登入 ---- */
.sp-login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; max-width: var(--frame-mobile, 448px); margin: 0 auto; padding: 24px 22px; }
.sp-login .logo { text-align: center; margin-bottom: 26px; }
.sp-login .logo .mk { font-size: 40px; }
.sp-login .logo h1 { margin: 8px 0 4px; font-size: 22px; font-weight: 900; color: var(--ink); }
.sp-login .logo p { margin: 0; font-size: 13.5px; color: var(--text-muted-strong); font-weight: 600; }
.sp-login .fos-field-input { font-size: 17px; padding: 14px 15px; }
.sp-pinbox { display: flex; gap: 8px; justify-content: center; }
.sp-pinbox input { width: 100%; text-align: center; letter-spacing: .5em; font-family: var(--font-mono); font-size: 24px; font-weight: 900; }
.sp-login-err { min-height: 22px; color: var(--danger-strong, #B14A4A); font-size: 13.5px; font-weight: 800; text-align: center; margin-top: 10px; }

/* ---- 空狀態 ---- */
.sp-empty { text-align: center; color: var(--text-muted-strong); font-size: 13.5px; font-weight: 600; padding: 26px 10px; background: #FFF; border: 1px dashed var(--border); border-radius: 14px; }

/* ---- bottom sheet（日視圖 / 學生資料共用） ---- */
.sp-sheet-bg { position: fixed; inset: 0; background: rgba(6,16,27,.55); z-index: var(--z-modal, 300); display: none; }
.sp-sheet-bg.open { display: block; }
.sp-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-modal, 300) + 1); max-width: var(--frame-mobile, 448px); margin: 0 auto; background: #FFF; border-radius: 18px 18px 0 0; max-height: 88vh; overflow-y: auto; transform: translateY(105%); transition: transform .24s ease-out; padding: 8px 16px 24px; }
.sp-sheet.open { transform: translateY(0); }
.sp-sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 6px auto 12px; }
.sp-sheet-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 12px; }
.sp-sheet-head h3 { margin: 0; font-size: 17px; font-weight: 900; color: var(--ink); flex: 1; }
.sp-sheet-head .x { border: 0; background: var(--surface-1); border-radius: 50%; width: 30px; height: 30px; font-size: 15px; cursor: pointer; color: var(--text-2); }

/* ---- 月曆 ---- */
.sp-cal-nav { display: flex; align-items: center; gap: 8px; margin: 14px 0 10px; }
.sp-cal-nav .m { flex: 1; text-align: center; font-family: var(--font-mono); font-size: 16px; font-weight: 900; color: var(--ink); }
.sp-cal-nav button { border: 1px solid var(--border); background: #FFF; border-radius: 9px; padding: 7px 13px; font-size: 14px; font-weight: 800; cursor: pointer; color: var(--text-1); }
.sp-cal { background: #FFF; border: 1px solid var(--border); border-radius: 14px; padding: 10px; }
.sp-cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 12.5px; font-weight: 800; color: var(--text-muted-strong); text-align: center; margin-bottom: 5px; }
.sp-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.sp-cal-day { position: relative; aspect-ratio: 1 / 1.15; border: 1px solid var(--border); border-radius: 9px; padding: 4px 0 3px; text-align: center; cursor: pointer; background: #FFF; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sp-cal-day.out { opacity: .35; }
.sp-cal-day.today { border-color: var(--gold-dark); box-shadow: 0 0 0 1.5px var(--gold); }
.sp-cal-day .dn { font-family: var(--font-mono); font-size: 13px; font-weight: 800; color: var(--text-1); }
.sp-cal-day .dn.wknd { color: var(--danger-strong); }
.sp-cal-day .lp { font-family: var(--font-mono); font-size: 12.5px; font-weight: 900; background: var(--ink); color: var(--gold); border-radius: 6px; padding: 0 5px; line-height: 1.5; }
.sp-cal-day .mk { font-size: 12.5px; line-height: 1; }
.sp-cal-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 9px; font-size: 12.5px; color: var(--text-muted-strong); font-weight: 700; }

/* ---- 打卡 / 核銷 ---- */
.sp-ck { border: 1.5px dashed var(--gold-dark); background: var(--gold-soft, #FCF6E5); border-radius: 14px; padding: 13px 14px; margin: 12px 0; }
.sp-ck h4 { margin: 0 0 7px; font-size: 14.5px; font-weight: 900; color: var(--gold-text, #7A5A20); }
.sp-ck .hint { font-size: 12.5px; color: var(--text-muted-strong); font-weight: 600; line-height: 1.55; }
.sp-ck-photo { width: 100%; border-radius: 10px; margin-top: 9px; max-height: 220px; object-fit: cover; }
.sp-numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.sp-numpad button { border: 1px solid var(--border); background: #FFF; border-radius: 11px; font-family: var(--font-mono); font-size: 20px; font-weight: 900; padding: 12px 0; cursor: pointer; color: var(--ink); }
.sp-numpad button:active { background: var(--surface-1); }
.sp-pin-view { text-align: center; font-family: var(--font-mono); font-size: 30px; font-weight: 900; letter-spacing: .4em; color: var(--ink); margin: 6px 0; min-height: 40px; }

/* ---- recap 表單 ---- */
.sp-stu-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin: 12px 0; }
.sp-stu-tab { flex-shrink: 0; border: 1.5px solid var(--border); background: #FFF; border-radius: 999px; padding: 7px 15px; font-size: 13.5px; font-weight: 800; cursor: pointer; color: var(--text-1); white-space: nowrap; }
.sp-stu-tab.active { border-color: var(--ink); background: var(--ink); color: #FFF; }
.sp-stu-tab .done { color: var(--ok); margin-left: 4px; }
.sp-stu-tab.active .done { color: var(--gold); }
.sp-recap-sec { background: #FFF; border: 1px solid var(--border); border-radius: 14px; padding: 13px 14px; margin-bottom: 11px; }
.sp-recap-sec h4 { margin: 0 0 3px; font-size: 14.5px; font-weight: 900; color: var(--text-1); }
.sp-recap-sec .must { color: var(--danger-strong); }
.sp-recap-sec .sub { font-size: 12.5px; color: var(--text-muted-strong); font-weight: 600; margin-bottom: 9px; }
.sp-lv-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.sp-lv { border: 1.5px solid var(--border); background: #FFF; border-radius: 9px; padding: 6px 11px; font-family: var(--font-mono); font-size: 13.5px; font-weight: 850; cursor: pointer; color: var(--text-1); }
.sp-lv.on { border-color: var(--gold-dark); background: var(--gold-soft); color: var(--gold-text); }
.sp-recap-sec textarea { width: 100%; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; line-height: 1.6; resize: vertical; min-height: 74px; }
.sp-vid-zone { border: 1.5px dashed var(--border); border-radius: 11px; padding: 13px; text-align: center; font-size: 13px; font-weight: 700; color: var(--text-muted-strong); cursor: pointer; margin-top: 8px; }
.sp-vid-zone.has { border-style: solid; border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.sp-vid-thumb { position: relative; display: inline-block; margin-top: 8px; }
.sp-vid-thumb img { max-width: 160px; border-radius: 9px; display: block; }
.sp-vid-thumb .play { position: absolute; inset: 0; display: grid; place-items: center; color: #FFF; font-size: 26px; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.sp-submitbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-header); max-width: var(--frame-mobile, 448px); margin: 0 auto; background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--border); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 9px; }
.sp-submitbar .fos-btn { flex: 1; }

/* ---- 我的 / 統計 ---- */
.sp-stat { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sp-stat .card { background: #FFF; border: 1px solid var(--border); border-radius: 14px; padding: 13px 14px; }
.sp-stat .n { font-family: var(--font-mono); font-size: 24px; font-weight: 900; color: var(--ink); }
.sp-stat .l { font-size: 12.5px; color: var(--text-muted-strong); font-weight: 700; margin-top: 2px; }

/* ---- 學生歷史 timeline ---- */
.sp-tl { border-left: 2px solid var(--border); margin-left: 7px; padding-left: 15px; }
.sp-tl-item { position: relative; margin-bottom: 15px; }
.sp-tl-item::before { content: ''; position: absolute; left: -21px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); border: 2px solid #FFF; box-shadow: 0 0 0 1.5px var(--gold-dark); }
.sp-tl-date { font-family: var(--font-mono); font-size: 12.5px; font-weight: 800; color: var(--text-muted-strong); }
.sp-tl-main { font-size: 14px; font-weight: 800; color: var(--text-1); margin: 2px 0; }
.sp-tl-lv { font-family: var(--font-mono); font-size: 12.5px; font-weight: 900; color: var(--gold-text); background: var(--gold-soft); border-radius: 6px; padding: 1px 7px; }
.sp-tl-comment { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-top: 4px; white-space: pre-wrap; }
.sp-tl-video { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; font-weight: 800; color: var(--info); background: var(--info-soft); border-radius: 8px; padding: 4px 10px; }
