/* ── リセット & ベース ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:    #1a3a5c;
  --primary-lt: #e6f0f8;
  --in:         #0f6e56;
  --in-lt:      #e1f5ee;
  --out:        #a32d2d;
  --out-lt:     #fcebeb;
  --warn:       #854f0b;
  --warn-lt:    #faeeda;
  --border:     #e0ddd6;
  --text:       #1a1917;
  --text-sub:   #5f5e5a;
  --bg:         #f5f3ee;
  --white:      #ffffff;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.08);
}

html, body { height: 100%; font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.6; }

/* ── ページ ────────────────────────────────────── */
.page { min-height: 100vh; }

/* ── ログイン ───────────────────────────────────── */
.login-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; }
.login-logo { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.logo-mark { width: 52px; height: 52px; background: var(--primary); color: #fff; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.logo-title { font-size: 20px; font-weight: 700; color: var(--primary); }
.logo-sub { font-size: 12px; color: var(--text-sub); }
.login-wrap .card { width: 100%; max-width: 360px; }

/* ── カード ─────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 1rem; color: var(--primary); }

/* ── ヘッダー ───────────────────────────────────── */
.app-header { background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; position: sticky; top: 0; z-index: 100; }
.header-title { font-size: 16px; font-weight: 700; }
.header-left { display: flex; align-items: center; gap: .75rem; }
.header-right { display: flex; align-items: center; gap: .5rem; }
.header-name { font-size: 13px; opacity: .85; }

/* ── メインコンテンツ ────────────────────────────── */
.main-content { max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

/* ── セクション ─────────────────────────────────── */
.section { margin-bottom: 1.75rem; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .75rem; }
.section-title { font-size: 15px; font-weight: 700; color: var(--primary); }
.section-period { font-size: 12px; color: var(--text-sub); }

/* ── 日付・ステータス ────────────────────────────── */
.date-display { font-size: 14px; color: var(--text-sub); margin-bottom: .35rem; }
.status-display { margin-bottom: .75rem; }
.status-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 700; }
.status-not-started { background: var(--warn-lt); color: var(--warn); }
.status-working     { background: var(--in-lt);   color: var(--in); }
.status-done        { background: var(--primary-lt); color: var(--primary); }

/* ── 打刻カード ─────────────────────────────────── */
.punch-times { margin-bottom: .75rem; }
.punch-row { display: flex; justify-content: space-between; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.punch-row:last-child { border-bottom: none; }
.punch-label { font-size: 14px; color: var(--text-sub); }
.punch-time { font-size: 20px; font-weight: 700; color: var(--text); }
.punch-time.empty { font-size: 18px; color: #bbb; font-weight: 400; }

/* ── 打刻ボタン ─────────────────────────────────── */
.btn-stamp-in, .btn-stamp-out { width: 100%; padding: 1rem; font-size: 18px; font-weight: 700; border: none; border-radius: var(--radius); cursor: pointer; transition: opacity .15s, transform .1s; }
.btn-stamp-in  { background: var(--in);  color: #fff; }
.btn-stamp-out { background: var(--out); color: #fff; }
.btn-stamp-in:active, .btn-stamp-out:active { transform: scale(.97); }
.stamp-done-message { text-align: center; padding: .75rem; background: var(--primary-lt); color: var(--primary); border-radius: var(--radius); font-size: 14px; font-weight: 700; }

/* ── サマリーカード ──────────────────────────────── */
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: .75rem; }
.summary-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .5rem; text-align: center; }
.summary-num { font-size: 22px; font-weight: 700; color: var(--primary); }
.summary-label { font-size: 11px; color: var(--text-sub); margin-top: .15rem; }

/* ── 月次テーブル ────────────────────────────────── */
.monthly-table { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.monthly-row { display: grid; grid-template-columns: 90px 1fr 1fr 80px; gap: .5rem; align-items: center; padding: .55rem .75rem; border-bottom: 1px solid var(--border); font-size: 13px; }
.monthly-row:last-child { border-bottom: none; }
.monthly-row.header { background: var(--bg); font-weight: 700; font-size: 12px; color: var(--text-sub); }
.monthly-row.missing { background: #fff8f8; }
.monthly-date { font-weight: 500; }
.monthly-time { color: var(--text-sub); }
.monthly-work { font-weight: 700; text-align: right; }
.monthly-work.overtime { color: var(--out); }

/* ── フォーム ───────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 13px; font-weight: 700; color: var(--text-sub); margin-bottom: .35rem; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea { width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; font-family: inherit; background: var(--white); color: var(--text); outline: none; transition: border-color .15s; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; }
.form-row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-group { margin-bottom: 0; }
.flex1 { flex: 1; min-width: 120px; }
.align-end { align-self: flex-end; }

/* ── ボタン ─────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem 1.1rem; border-radius: 8px; font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer; border: 1px solid transparent; transition: opacity .15s, background .15s; text-decoration: none; }
.btn:active { opacity: .8; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-outline { background: var(--white); color: var(--primary); border-color: var(--primary); }
.btn-ghost   { background: transparent; color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.3); }
.btn-block   { width: 100%; }
.btn-sm      { font-size: 12px; padding: .35rem .7rem; }
.btn-danger  { background: var(--out); color: #fff; border-color: var(--out); }

/* ── アラート ───────────────────────────────────── */
.alert { padding: .65rem .9rem; border-radius: 8px; font-size: 13px; margin-bottom: 1rem; }
.alert-error   { background: var(--out-lt);  color: var(--out); }
.alert-success { background: var(--in-lt);   color: var(--in); }
.alert-warn    { background: var(--warn-lt); color: var(--warn); }

/* ── タブ ───────────────────────────────────────── */
.tab-bar { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-btn { flex-shrink: 0; padding: .65rem 1rem; background: none; border: none; font-size: 14px; font-family: inherit; cursor: pointer; color: var(--text-sub); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* ── フィルターバー ──────────────────────────────── */
.filter-bar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-bar select { padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--white); }

/* ── 管理者 本日リスト ───────────────────────────── */
.staff-row { display: flex; justify-content: space-between; align-items: center; padding: .65rem .75rem; border-bottom: 1px solid var(--border); font-size: 14px; }
.staff-row:last-child { border-bottom: none; }
.staff-name { font-weight: 700; }
.staff-times { font-size: 12px; color: var(--text-sub); margin-top: .1rem; }

/* ── 修正申請カード ──────────────────────────────── */
.correction-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: .75rem; }
.correction-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.correction-name { font-weight: 700; font-size: 14px; }
.correction-detail { font-size: 13px; color: var(--text-sub); margin-bottom: .6rem; }
.correction-btns { display: flex; gap: .5rem; }
.status-pill { padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.status-pending  { background: var(--warn-lt);     color: var(--warn); }
.status-approved { background: var(--in-lt);       color: var(--in); }
.status-rejected { background: var(--out-lt);      color: var(--out); }

/* ── メンバー一覧 ────────────────────────────────── */
.member-row { display: flex; align-items: center; justify-content: space-between; padding: .65rem .75rem; border-bottom: 1px solid var(--border); font-size: 14px; gap: .5rem; }
.member-row:last-child { border-bottom: none; }
.member-name { font-weight: 700; flex: 1; }
.member-username { color: var(--text-sub); font-size: 12px; }
.member-actions { display: flex; gap: .4rem; flex-shrink: 0; }
.inactive { opacity: .45; }

/* ── 月次管理者テーブル ─────────────────────────── */
.admin-monthly-user { margin-bottom: 1.25rem; }
.admin-monthly-user-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.admin-monthly-username { font-size: 15px; font-weight: 700; color: var(--primary); }
.admin-monthly-stats { font-size: 12px; color: var(--text-sub); }

/* ── アラート行 ─────────────────────────────────── */
.alert-row { background: var(--warn-lt); color: var(--warn); border-radius: 8px; padding: .4rem .75rem; font-size: 13px; margin-bottom: .4rem; font-weight: 700; }

/* ── レスポンシブ ────────────────────────────────── */
@media (max-width: 600px) {
  .main-content { padding: 1rem .75rem 3rem; }
  .summary-cards { grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  .summary-num { font-size: 18px; }
  .monthly-row { grid-template-columns: 80px 1fr 1fr 70px; font-size: 12px; padding: .45rem .5rem; }
  .punch-time { font-size: 18px; }
  .btn-stamp-in, .btn-stamp-out { font-size: 16px; padding: .85rem; }
  .form-row { flex-direction: column; }
  .filter-bar { gap: .4rem; }
  .tab-btn { padding: .55rem .75rem; font-size: 13px; }
}

/* ── メンバーパスワード表示 ─────────────────────────── */
.member-pw { font-size: 12px; color: var(--text-sub); margin-top: .15rem; }
