* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f5f7fa; color: #1f2937; padding-bottom: 80px; -webkit-tap-highlight-color: transparent; }

.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 80vh; gap: 16px; }
.spinner { width: 40px; height: 40px; border: 4px solid #e5e7eb; border-top-color: #2563eb; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#app { padding: 16px; max-width: 480px; margin: 0 auto; }

.page-header { background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; margin: -16px -16px 16px; padding: 24px 20px; border-radius: 0 0 20px 20px; }
.page-header h1 { font-size: 22px; margin-bottom: 4px; }
.page-header p { opacity: .85; font-size: 14px; }

.user-card { display: flex; gap: 12px; align-items: center; }
.user-card .avatar { width: 60px; height: 60px; border-radius: 30px; border: 2px solid rgba(255,255,255,.4); object-fit: cover; background: #fff; }
.user-card .info h2 { font-size: 18px; margin-bottom: 2px; }
.user-card .info p { font-size: 13px; opacity: .85; }

.section { background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.section h3 { font-size: 15px; margin-bottom: 12px; color: #1f2937; display: flex; justify-content: space-between; align-items: center; }
.section h3 a { font-size: 13px; color: #2563eb; text-decoration: none; font-weight: normal; }

.btn { display: inline-block; padding: 10px 18px; background: #2563eb; color: #fff; border: 0; border-radius: 8px; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-outline { background: transparent; color: #2563eb; border: 2px solid #2563eb; }
.btn-secondary { background: #6b7280; }
.btn-danger { background: #dc2626; }
.btn-success { background: #16a34a; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-tile { background: #fff; border-radius: 12px; padding: 16px 8px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); border: 0; cursor: pointer; transition: transform .15s; }
.menu-tile:active { transform: scale(.96); }
.menu-tile .ico { font-size: 28px; display: block; margin-bottom: 4px; }
.menu-tile .label { font-size: 12px; color: #374151; font-weight: 500; }
.menu-tile .badge { background: #dc2626; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 8px; margin-left: 4px; }

.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.template-card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); cursor: pointer; border: 2px solid transparent; transition: all .2s; }
.template-card.selected { border-color: #2563eb; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37,99,235,.2); }
.template-card .thumb { height: 120px; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 30px; }
.template-card .meta { padding: 8px 12px; }
.template-card .meta .name { font-size: 13px; font-weight: 600; }
.template-card .meta .cat { font-size: 11px; color: #6b7280; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 13px; color: #374151; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; font-family: inherit;
}
.form-group input:focus { outline: none; border-color: #2563eb; }
.form-group .hint { font-size: 11px; color: #9ca3af; margin-top: 2px; }

.list-item { background: #fff; padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; display: flex; gap: 12px; align-items: center; }
.list-item .ico { font-size: 24px; flex: 0 0 36px; text-align: center; }
.list-item .body { flex: 1; }
.list-item .title { font-size: 14px; font-weight: 600; color: #1f2937; }
.list-item .sub { font-size: 12px; color: #6b7280; margin-top: 2px; }
.list-item .action { font-size: 12px; }

.stat-row { display: flex; gap: 8px; margin-bottom: 12px; }
.stat-box { flex: 1; background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; padding: 14px; border-radius: 10px; text-align: center; }
.stat-box .num { font-size: 24px; font-weight: bold; }
.stat-box .label { font-size: 11px; opacity: .85; margin-top: 2px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.badge-registered { background: #dbeafe; color: #1e40af; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-attended { background: #d1fae5; color: #065f46; }
.badge-pending_review { background: #fef3c7; color: #92400e; }
.badge-approved, .badge-running { background: #d1fae5; color: #065f46; }
.badge-rejected, .badge-exhausted { background: #fee2e2; color: #991b1b; }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid #e5e7eb; display: flex; padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 100; }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px; color: #6b7280; text-decoration: none; font-size: 10px; cursor: pointer; }
.bottom-nav a .ico { font-size: 22px; }
.bottom-nav a.active { color: #2563eb; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: rgba(17,24,39,.95); color: #fff; padding: 10px 20px; border-radius: 24px; font-size: 13px; z-index: 200; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%); } }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 16px; padding: 24px; max-width: 400px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 18px; margin-bottom: 12px; }

.empty { text-align: center; padding: 40px 16px; color: #9ca3af; }
.empty .ico { font-size: 48px; margin-bottom: 12px; }

.ai-card { background: linear-gradient(135deg, #10a37f, #047857); color: #fff; padding: 16px; border-radius: 12px; margin-bottom: 12px; }
.ai-priority { background: rgba(255,255,255,.15); padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.ai-priority .nick { font-weight: 600; }
.ai-priority .timing { font-size: 11px; opacity: .85; }
.ai-priority .opener { font-size: 13px; margin-top: 4px; }
