* { box-sizing: border-box; margin: 0; }
:root {
  --navy: #14213d; --amber: #fca311; --bg: #f4f5f7; --line: #e2e5ea;
  --ok: #1e7a6f; --warn: #c14e2e; --muted: #6b7280;
}
body { font-family: -apple-system, "PingFang TC", "Noto Sans TC", sans-serif; background: var(--bg); color: #1f2937; padding-bottom: 76px; }
header { background: var(--navy); color: #fff; padding: 16px; }
header h1 { font-size: 18px; }
header .sub { font-size: 12px; opacity: .85; margin-top: 2px; }
header .sub .alert { color: #ffb84d; font-weight: 700; }
main { padding: 12px; max-width: 560px; margin: 0 auto; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.card h3 { font-size: 15px; margin-bottom: 4px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.meta { font-size: 13px; color: var(--muted); }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef2f7; color: var(--muted); white-space: nowrap; }
.badge.ok { background: #e7f5f3; color: var(--ok); }
.badge.full { background: #fdeeea; color: var(--warn); }
button { font: inherit; border: 0; border-radius: 10px; padding: 11px 16px; min-height: 44px; cursor: pointer; touch-action: manipulation; }
.btn-book { background: var(--navy); color: #fff; }
.btn-cancel { background: #fff; color: var(--warn); border: 1.5px solid var(--warn); }
button:disabled { background: #e5e7eb; color: #9ca3af; border-color: transparent; cursor: default; }
button:not(:disabled):active { transform: scale(.97); opacity: .85; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: #fff; border-top: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border-radius: 0; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); font-size: 13px; color: var(--muted); }
.tabs button.active { color: var(--navy); font-weight: 700; border-top: 2px solid var(--amber); }
.pass-num { font-size: 32px; font-weight: 800; color: var(--navy); }
.pass-num.danger { color: #dc2626; }
.toast { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 30; max-width: 90%; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; font-size: 14px; }
.date-h { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 4px 6px; }
input { font: inherit; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }

/* 日期橫條（課表頁，sticky 置頂） */
.datestrip { position: sticky; top: 0; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 10px; margin-bottom: 4px; }
.datestrip .drow { display: flex; gap: 4px; align-items: center; }
.today-pill { font-size: 12px; font-weight: 700; color: var(--navy); border: 1px solid var(--navy); padding: 6px 10px; border-radius: 999px; margin-right: 4px; white-space: nowrap; cursor: pointer; touch-action: manipulation; }
.dcell { flex: 1; text-align: center; border-radius: 10px; padding: 4px 0 6px; cursor: pointer; touch-action: manipulation; }
.dcell .wd { display: block; font-size: 10.5px; color: #6b7280; }
.dcell .dd { display: block; font-size: 15px; font-weight: 700; color: #374151; }
.dcell.sel { background: var(--amber); }
.dcell.sel .wd { color: #5b3a00; }
.dcell.sel .dd { color: #221a05; }
.dcell.dim { cursor: default; }
.dcell.dim .wd, .dcell.dim .dd { color: #d1d5db; }
.date-h { scroll-margin-top: 72px; }

/* 課程封面卡 */
.ccard { padding: 0; overflow: hidden; border-radius: 14px; }
.cover { height: 84px; display: flex; align-items: flex-end; padding: 10px 14px; position: relative; color: #fff;
  background: linear-gradient(115deg, #05070d 0%, #14213d 62%, #24427c 100%); }
.cover.alt { background: linear-gradient(115deg, #0d0505 0%, #3d1414 62%, #7c2424 100%); }
.cover .kicker { position: absolute; top: 10px; left: 14px; font-size: 9px; letter-spacing: .22em; color: rgba(255,255,255,.65); font-weight: 700; }
.cover b { font-size: 19px; letter-spacing: .06em; }
.crow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; }
.ctime { font-size: 13.5px; color: #374151; }
.ccard .wl-note { padding: 0 14px 12px; margin-top: -2px; }

/* 候補說明・請假期限・行事曆 */
.wl-note { font-size: 12px; color: #92600a; margin-top: 8px; }
.deadline { font-size: 12.5px; font-weight: 600; color: #b45309; margin-top: 8px; }
.deadline.past { color: #6b7280; font-weight: 400; }
.cal-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 12.5px; color: #1d4ed8; margin-top: 2px; text-decoration: underline; text-underline-offset: 3px; touch-action: manipulation; }

/* 課卡預警與續報 */
.warnbar { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 10px; padding: 9px 12px; font-size: 12.5px; font-weight: 600; margin-top: 10px; }
.btn-renew { display: block; text-align: center; background: var(--amber); color: #221a05; font-weight: 700; font-size: 15px; border-radius: 10px; padding: 12px 16px; margin-top: 10px; text-decoration: none; touch-action: manipulation; }
.btn-renew:active { transform: scale(.97); opacity: .85; }
.renew-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.count-chip { font-size: 11.5px; font-weight: 400; background: #eef2f7; color: #374151; border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: 1px; white-space: nowrap; }

/* 底板（取代原生 confirm） */
.sheet-overlay { position: fixed; inset: 0; background: rgba(10, 14, 24, .45); z-index: 20; display: flex; align-items: flex-end; }
.sheet { background: #fff; width: 100%; max-width: 560px; margin: 0 auto; border-radius: 22px 22px 0 0; padding: 16px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheet-up .22s ease-out; }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: #d1d5db; margin: 0 auto 14px; }
.sheet h3 { font-size: 17px; margin-bottom: 2px; }
.sheet-meta { color: var(--muted); font-size: 13.5px; margin-bottom: 10px; }
.sheet-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-top: 1px solid #eef1f5; font-size: 13.5px; }
.sheet-row b { text-align: right; }
.sheet-hint { background: #f0f6ff; border: 1px solid #d6e4ff; color: #1d4ed8; border-radius: 10px; padding: 9px 12px; font-size: 12.5px; margin: 10px 0 4px; }
.sheet-cta { display: block; width: 100%; border-radius: 12px; text-align: center; padding: 14px 0; font-size: 15.5px; font-weight: 700; margin-top: 10px; }
.sheet-cta.primary { background: var(--navy); color: #fff; }
.sheet-cta.warn { background: #fff; color: var(--warn); border: 1.5px solid var(--warn); }
.sheet-cta.amber { background: var(--amber); color: #221a05; }
.sheet-dismiss { display: block; width: 100%; background: none; color: #9ca3af; font-size: 13.5px; padding: 12px 0; min-height: 44px; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
  button:not(:disabled):active, .btn-renew:active { transform: none; }
}
