* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

.screen { display: none; padding: 20px; max-width: 480px; margin: 0 auto; }
.screen.active { display: block; }

h1 { font-size: 1.6rem; text-align: center; margin-bottom: 6px; color: #1a5276; }
h2 { font-size: 1.2rem; text-align: center; margin-bottom: 6px; }
.sub { text-align: center; color: #666; margin-bottom: 20px; font-size: 0.95rem; }

.filter-row { margin-bottom: 14px; }
.filter-row select {
  width: 100%; padding: 10px 14px; font-size: 1rem;
  border: 1px solid #ccc; border-radius: 8px; background: #fff;
  text-align-last: center;
}
.filter-row select option { text-align: left; }

.staff-list { display: flex; flex-direction: column; gap: 10px; }
.staff-btn {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid #ddd; border-radius: 10px;
  padding: 14px 18px; text-align: left; cursor: pointer;
  font-size: 1.1rem; transition: background 0.15s; min-height: 60px; width: 100%;
}
.staff-btn:hover, .staff-btn:active { background: #eaf4fb; border-color: #2980b9; }
.staff-btn .dept-label { font-size: 0.78rem; color: #888; margin-top: 3px; }

.pin-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.pin-header h2 { flex: 1; font-size: 1.1rem; text-align: left; }

.pin-dots { display: flex; justify-content: center; gap: 20px; margin: 24px 0 8px; }
.pin-dots span {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #2980b9; background: transparent; transition: background 0.1s;
}
.pin-dots span.filled { background: #2980b9; }

.pin-error { text-align: center; color: #c0392b; font-size: 0.9rem; min-height: 20px; margin-bottom: 8px; }

.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 16px auto 0; }
.numpad button {
  background: #fff; border: 1px solid #ddd; border-radius: 12px;
  padding: 0; height: 70px; font-size: 1.5rem; font-weight: bold;
  cursor: pointer; transition: background 0.1s; width: 100%;
}
.numpad button:hover, .numpad button:active { background: #d6eaf8; }
.numpad .btn-clear { font-size: 1rem; color: #888; }
.numpad .btn-del   { font-size: 1.2rem; }

.header-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.btn-back {
  background: none; border: 1px solid #aaa; border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font-size: 0.9rem; white-space: nowrap;
}
.btn-back:hover { background: #eee; }

.pending-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 80px; }
.pending-card {
  background: #fff; border: 1px solid #ddd; border-radius: 10px;
  padding: 16px 18px; display: flex; justify-content: space-between;
  align-items: center; gap: 12px;
}
.pending-info { flex: 1; }
.pending-name { font-size: 1.05rem; font-weight: bold; }
.badge { display: inline-block; font-size: 0.72rem; padding: 2px 8px; border-radius: 20px; margin-top: 5px; margin-right: 4px; font-weight: bold; }
.badge-houtei { background: #d6eaf8; color: #1a5276; }
.badge-teiki  { background: #d5f5e3; color: #1e8449; }
.badge-any    { background: #fdebd0; color: #784212; }

.btn-attend {
  background: #2980b9; color: #fff; border: none; border-radius: 8px;
  padding: 12px 18px; font-size: 0.95rem; cursor: pointer;
  white-space: nowrap; min-width: 80px;
}
.btn-attend:hover { background: #1a6fa0; }

.no-pending { text-align: center; color: #27ae60; font-size: 1.1rem; padding: 40px 0; }
.completed-card { background: #f0faf4; border-color: #a9dfbf; opacity: 0.85; }
.completed-label { font-size: 0.82rem; color: #27ae60; margin-top: 4px; font-weight: bold; }

.deadline-label { font-size: 0.8rem; color: #888; margin-top: 4px; min-height: 1em; }
.deadline-label.deadline-warn    { color: #e67e22; font-weight: bold; }
.deadline-label.deadline-urgent  { color: #c0392b; font-weight: bold; }
.deadline-label.deadline-expired { color: #c0392b; font-weight: bold; }

.footer { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid #ddd; padding: 12px 20px; text-align: center; }
.btn-done { background: #7f8c8d; color: #fff; border: none; border-radius: 8px; padding: 12px 32px; font-size: 1rem; cursor: pointer; width: 100%; max-width: 400px; }
.btn-done:hover { background: #636e72; }

.loading { text-align: center; color: #888; padding: 30px 0; }

/* シンプルローダー（PIN認証・データ取得用）テキスト＋ラインのみ */
.simple-loader-overlay {
  position: fixed; inset: 0; background: rgba(245,245,245,.96);
  display: flex; align-items: center; justify-content: center; z-index: 999;
}
.simple-loader-box {
  background: #fff; border-radius: 16px; padding: 28px 36px;
  box-shadow: 0 2px 12px rgba(0,0,0,.1); text-align: center; width: 260px;
}
.simple-loader-text { font-size: 15px; font-weight: bold; color: #333; margin-bottom: 14px; white-space: nowrap; }
.progress-bar-track {
  width: 100%; height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: #00b09b; border-radius: 3px;
  animation: progressSlide 1.4s ease-in-out infinite;
}
@keyframes progressSlide {
  0%   { transform: translateX(-100%); width: 40%; }
  50%  { width: 60%; }
  100% { transform: translateX(300%); width: 40%; }
}

/* PIN完了時のドット演出 */
.pin-dots span.complete { background: #00b09b; border-color: #00b09b; transform: scale(1.2); transition: all 0.2s; }

/* 職員リスト：スクロール表示補助（画面下部固定） */
.scroll-hint {
  position: fixed; bottom: 60px; left: 0; right: 0;
  text-align: center; color: #666; font-size: 0.82rem;
  padding: 28px 0 8px; pointer-events: none;
  background: linear-gradient(to bottom, transparent 0%, rgba(245,245,245,0.85) 40%, rgba(245,245,245,0.98) 100%);
  animation: bounce 1.5s ease-in-out infinite;
}
.scroll-hint.hidden { display: none; }
@keyframes bounce { 0%,100%{ transform:translateY(0);} 50%{ transform:translateY(4px);} }

/* 50音ナビゲーション */
.gyou-nav {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 0 4px; margin-bottom: 4px;
}
.gyou-btn {
  min-width: 36px; height: 32px; border: 1px solid #cce5f0;
  border-radius: 6px; background: #f0f8ff; color: #2980b9;
  font-size: 0.82rem; font-weight: bold; cursor: pointer; padding: 0 6px;
  transition: background 0.1s;
}
.gyou-btn:active, .gyou-btn:hover { background: #d6eaf8; }
.gyou-btn.disabled { opacity: 0.3; pointer-events: none; }

/* 50音グループ見出し */
.gyou-header {
  font-size: 0.75rem; font-weight: bold; color: #2980b9;
  padding: 10px 4px 4px; border-bottom: 1px solid #d6eaf8; margin-bottom: 4px;
}

/* トップへ戻るボタン */
.back-to-top {
  position: fixed; bottom: 80px; right: 20px;
  background: #2980b9; color: #fff; border: none; border-radius: 50%;
  width: 44px; height: 44px; font-size: 1.2rem; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.2); display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 50;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }

/* ホーム画面のヘッダーを中央寄せ */
.screen-home-centered {
  display: flex; flex-direction: column; justify-content: center; min-height: 60vh;
}

/* タイトルをタップ可能に */
h1.tappable { cursor: pointer; }
h1.tappable:active { opacity: 0.7; }
.error-msg { text-align: center; color: #c0392b; padding: 20px 0; }
.hidden { display: none !important; }

.loader-overlay { position: fixed; inset: 0; background: rgba(245,245,245,.96); display: flex; align-items: center; justify-content: center; z-index: 999; }
.loader-box { background: #fff; border-radius: 16px; padding: 28px 36px; box-shadow: 0 2px 12px rgba(0,0,0,.1); text-align: center; width: 280px; }
.loader-spinner-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 16px; }
.loader-spinner { width: 36px; height: 36px; border: 4px solid #e0f2f1; border-top: 4px solid #00b09b; border-radius: 50%; animation: loaderSpin .9s linear infinite; flex-shrink: 0; }
@keyframes loaderSpin { to { transform: rotate(360deg); } }
.loader-main-text { font-size: 15px; font-weight: bold; color: #333; }
.loader-steps { text-align: left; margin-top: 4px; }
.loader-step { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; color: #bbb; transition: color .3s; }
.loader-step.done   { color: #00b09b; }
.loader-step.active { color: #333; font-weight: bold; }
.loader-dot { width: 18px; height: 18px; border-radius: 50%; background: #e0e0e0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; }
.loader-step.done   .loader-dot { background: #00b09b; color: #fff; }
.loader-step.active .loader-dot { background: #00b09b; color: #fff; }

.app-header { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 6px; }
.app-logo { width: 44px; height: 44px; object-fit: contain; }

.pin-guide { background: #eaf4fb; border: 1px solid #aed6f1; border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 0.88rem; color: #1a5276; }
.pin-guide-title { font-weight: bold; margin-bottom: 6px; }
.pin-guide ul { margin: 0; padding-left: 18px; line-height: 1.8; }

.app-footer { text-align: center; font-size: 0.78rem; color: #aaa; padding: 16px 0 24px; margin-top: 32px; border-top: 1px solid #eee; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.footer-logo { width: 20px; height: 20px; object-fit: contain; opacity: 0.6; }
.admin-link-row { flex-basis: 100%; text-align: center; margin-top: 8px; }
.admin-link { color: #7a8a99; font-size: 0.8rem; text-decoration: none; border: 1px solid #d8dfe4; border-radius: 14px; padding: 4px 12px; transition: background 0.15s; }
.admin-link:hover { background: #eef2f5; color: #4a5a66; }
