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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
}

body { font-family: 'Helvetica Neue', Arial, 'Hiragino Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── ログイン ─────────────────── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--card); border-radius: var(--radius); padding: 40px 32px; width: 100%; max-width: 380px; box-shadow: 0 4px 24px rgba(0,0,0,.1); }
.login-card h1 { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 4px; color: var(--primary); }
.login-card .company { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 28px; }

/* ── フォーム ─────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 1rem; transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); }

/* ── ボタン ─────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border: none; border-radius: 8px; font-size: .95rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-block { width: 100%; margin-top: 8px; padding: 13px; font-size: 1rem; }

/* ── ヘッダー ─────────────────── */
header { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 900px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.site-name { font-weight: 700; font-size: 1rem; }
.header-inner #headerName { flex: 1; font-size: .9rem; opacity: .9; }
.header-actions { display: flex; gap: 8px; }
.header-actions .btn { color: #fff; border-color: rgba(255,255,255,.5); font-size: .8rem; padding: 5px 12px; }
.header-actions .btn-sm { background: rgba(255,255,255,.15); }
.header-actions .btn-outline { background: transparent; }

/* ── メイン ─────────────────── */
main { max-width: 600px; margin: 0 auto; padding: 20px 16px 40px; }

/* ── 打刻エリア ─────────────────── */
.clock-section { background: var(--card); border-radius: var(--radius); padding: 28px 24px; margin-bottom: 16px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.date-display { font-size: 1rem; color: var(--muted); margin-bottom: 4px; }
.time-display { font-size: 3rem; font-weight: 700; color: var(--text); letter-spacing: 2px; margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.status-badge { display: inline-block; padding: 5px 16px; border-radius: 999px; font-size: .85rem; font-weight: 600; background: #e0f2fe; color: #0369a1; margin-bottom: 20px; }
.status-badge.clocked-in { background: #dcfce7; color: var(--success); }
.status-badge.clocked-out { background: #f3f4f6; color: var(--muted); }
.status-badge.paid { background: #fef9c3; color: #92400e; }

.clock-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.btn-clock { padding: 20px; font-size: 1.2rem; border-radius: 10px; }
.btn-in { background: var(--success); color: #fff; }
.btn-in:hover { background: #15803d; }
.btn-out { background: var(--danger); color: #fff; }
.btn-out:hover { background: #b91c1c; }
.btn-flex-in { background: #0891b2; color: #fff; font-size: 1rem !important; }
.btn-flex-in:hover { background: #0e7490; }
.btn-flex-out { background: #7c3aed; color: #fff; font-size: 1rem !important; }
.btn-flex-out:hover { background: #6d28d9; }
.btn-clock:disabled { opacity: .4; cursor: not-allowed; }
.flex-buttons { margin-top: 8px; }
.direct-buttons { margin-top: 8px; }
.btn-direct-in  { background: #0f766e; color: #fff; font-size: 1rem !important; }
.btn-direct-in:hover  { background: #115e59; }
.btn-direct-out { background: #b45309; color: #fff; font-size: 1rem !important; }
.btn-direct-out:hover { background: #92400e; }
.late-badge { display: inline-block; margin-top: 10px; background: #fef2f2; color: var(--danger); border: 1.5px solid #fecaca; padding: 5px 16px; border-radius: 999px; font-size: .9rem; font-weight: 700; }

/* ── 残業申請 ─────────────────── */
.overtime-section { background: var(--card); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.overtime-header { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.overtime-header h3 { font-size: 1rem; flex: 1; }
.toggle-icon { color: var(--muted); font-size: .8rem; transition: transform .2s; }
.toggle-icon.open { transform: rotate(180deg); }
.ot-badge { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.ot-badge.ot-none  { background: #f1f5f9; color: #94a3b8; }
.ot-badge.pending  { background: #fef9c3; color: #92400e; }
.ot-badge.approved { background: #dcfce7; color: #166534; }
.ot-badge.rejected { background: #fee2e2; color: #dc2626; }
#overtimeForm { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.ot-time-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.btn-ot-time { padding: 10px 8px; font-size: .85rem; background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px; font-weight: 600; color: var(--text); cursor: pointer; transition: all .15s; }
.btn-ot-time:hover   { border-color: var(--primary); color: var(--primary); }
.btn-ot-time.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.ot-approved { background: #dcfce7; color: #166534; border-radius: 8px; padding: 12px 16px; font-weight: 600; margin-top: 12px; }

.clock-record { font-size: .9rem; color: var(--muted); min-height: 20px; }

/* ── 特別勤務 ─────────────────── */
.special-section { background: var(--card); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.special-section h3 { font-size: 1rem; margin-bottom: 16px; color: var(--text); }
.special-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.btn-special { padding: 12px 8px; font-size: .85rem; border-radius: 8px; font-weight: 600; }
.btn-paid { background: #fef9c3; color: #92400e; border: 1.5px solid #fde68a; }
.btn-paid:hover { background: #fde68a; }
.btn-holiday { background: #e0f2fe; color: #0369a1; border: 1.5px solid #bae6fd; }
.btn-holiday:hover { background: #bae6fd; }
.btn-childcare { background: #f3e8ff; color: #7c3aed; border: 1.5px solid #ddd6fe; }
.btn-childcare:hover { background: #ddd6fe; }
.btn-holiday-work { background: #fff7ed; color: #c2410c; border: 1.5px solid #fed7aa; }
.btn-holiday-work:hover { background: #fed7aa; }
.btn-absence { background: #fef2f2; color: var(--danger); border: 1.5px solid #fecaca; }
.btn-absence:hover { background: #fecaca; }

.holiday-work-form { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.holiday-work-form input { flex: 1; }

/* ── サマリー ─────────────────── */
.my-summary-section { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.my-summary-section h3 { font-size: 1rem; margin-bottom: 16px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.summary-item { background: var(--bg); border-radius: 8px; padding: 14px; text-align: center; }
.summary-item .label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.summary-item .value { display: block; font-size: 1.5rem; font-weight: 700; color: var(--primary); }

/* ── メッセージ ─────────────────── */
.error-msg { background: #fef2f2; color: var(--danger); padding: 10px 14px; border-radius: 8px; font-size: .9rem; margin-top: 10px; }
.success-msg { background: #dcfce7; color: var(--success); padding: 10px 14px; border-radius: 8px; font-size: .9rem; margin-top: 10px; }

/* ── 管理画面共通 ─────────────────── */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1e293b; color: #fff; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar .logo { padding: 20px 16px; font-weight: 700; font-size: .95rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: rgba(255,255,255,.75); text-decoration: none; font-size: .9rem; transition: all .15s; }
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.sidebar nav a .icon { width: 20px; text-align: center; }
.sidebar-footer { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,.1); }

.admin-main { flex: 1; overflow-x: hidden; }
.admin-header { background: #fff; border-bottom: 1px solid var(--border); padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; }
.admin-header h1 { font-size: 1.2rem; }
.admin-content { padding: 28px; }

/* ── テーブル ─────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th { background: #f8fafc; padding: 12px 14px; text-align: left; font-size: .82rem; color: var(--muted); font-weight: 600; border-bottom: 1.5px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; font-size: .9rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ── モーダル ─────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal h2 { font-size: 1.1rem; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── カード ─────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.stat-card .sc-label { font-size: .78rem; color: var(--muted); margin-bottom: 6px; }
.stat-card .sc-value { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-card .sc-unit { font-size: .8rem; color: var(--muted); margin-left: 2px; }

/* ── バッジ ─────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-full { background: #dcfce7; color: #166534; }
.badge-contract { background: #dbeafe; color: #1e40af; }
.badge-part { background: #fef9c3; color: #92400e; }
.badge-exec { background: #fce7f3; color: #9d174d; }
.badge-office { background: #f3e8ff; color: #6d28d9; }
.badge-other { background: #fff7ed; color: #9a3412; }

/* ── レスポンシブ ─────────────────── */
@media (max-width: 640px) {
  .admin-layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar nav a { padding: 10px 12px; font-size: .8rem; }
  .admin-content { padding: 16px; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .clock-buttons { grid-template-columns: 1fr 1fr; }
  .time-display { font-size: 2.2rem; }
}

/* ── ユーティリティ ─────────────────── */
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--muted); font-size: .85rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px !important; }
