:root {
  --primary:       #3B82F6;
  --primary-dark:  #2563EB;
  --success:       #22C55E;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --bg:            #F1F5F9;
  --card:          #FFFFFF;
  --text:          #1E293B;
  --text-muted:    #64748B;
  --border:        #E2E8F0;
  --radius:        12px;
  --shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans',
               'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
}

.view { min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ── Header ─────────────────────────────── */
.header {
  background: var(--primary);
  color: #fff;
  padding: 16px 20px;
  box-shadow: var(--shadow-md);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-title  { font-size: 22px; font-weight: 700; }
.header-sub { font-size: 13px; opacity: .85; margin-top: 2px; }
.header h2  { font-size: 18px; font-weight: 600; }
.w32 { width: 32px; }

.btn-back {
  background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; padding: 4px 6px;
  border-radius: 6px; line-height: 1;
  transition: background .15s;
}
.btn-back:hover { background: rgba(255,255,255,.2); }

/* ── Content ─────────────────────────────── */
.content { padding: 20px; flex: 1; }

/* ── Home – user list ────────────────────── */
.section-label { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 12px; }

.user-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }

.user-card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px 20px; cursor: pointer;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  transition: transform .1s, box-shadow .1s;
}
.user-card:hover  { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.user-card:active { transform: translateY(0); }
.user-card-name  { font-size: 16px; font-weight: 600; }
.user-card-arrow { color: var(--text-muted); font-size: 20px; }

.admin-section { text-align: center; padding-top: 16px; border-top: 1px solid var(--border); }
.btn-admin {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); padding: 10px 28px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
  transition: all .15s;
}
.btn-admin:hover { background: var(--text-muted); color: #fff; border-color: var(--text-muted); }

/* ── Clock display ───────────────────────── */
.clock-display { text-align: center; padding: 24px 0 20px; }
.clock-time {
  font-size: 54px; font-weight: 200; letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}
.clock-date { font-size: 14px; color: var(--text-muted); margin-top: 6px; }

/* ── Status badge ────────────────────────── */
.status-badge {
  display: flex; width: fit-content; margin: 0 auto 20px;
  padding: 6px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
}
.status-none  { background: #F1F5F9; color: #64748B; }
.status-in    { background: #DCFCE7; color: #15803D; }
.status-break { background: #FEF3C7; color: #B45309; }
.status-out   { background: #DBEAFE; color: #1D4ED8; }

/* ── Time record card ────────────────────── */
.time-record-card {
  background: var(--card); border-radius: var(--radius);
  padding: 4px 20px; box-shadow: var(--shadow);
  border: 1px solid var(--border); margin-bottom: 24px;
}
.time-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.time-row:last-child { border-bottom: none; }
.time-label { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.time-value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.total-row .time-label { font-weight: 700; color: var(--text); }
.total-row .time-value { color: var(--primary); font-size: 16px; }

/* ── Action buttons ──────────────────────── */
.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-action {
  border: none; border-radius: var(--radius);
  padding: 22px 16px; font-size: 17px; font-weight: 700;
  cursor: pointer; line-height: 1.4;
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.btn-action:disabled { opacity: .35; cursor: not-allowed; }
.btn-action:not(:disabled):hover  { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-action:not(:disabled):active { transform: translateY(0); }

.btn-clockin  { background: #22C55E; color: #fff; }
.btn-break    { background: #F59E0B; color: #fff; }
.btn-breakend { background: #FBBF24; color: #fff; }
.btn-clockout { background: #EF4444; color: #fff; }

/* ── Tabs ────────────────────────────────── */
.tabs { display: flex; background: var(--card); border-bottom: 2px solid var(--border); }
.tab {
  flex: 1; padding: 14px; border: none; background: none;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: all .15s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* ── Admin user list ─────────────────────── */
.admin-user-item {
  background: var(--card); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  border: 1px solid var(--border); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.admin-user-info h4 { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.admin-user-info p  { font-size: 12px; color: var(--text-muted); }
.admin-user-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-icon {
  background: none; border: 1px solid var(--border);
  border-radius: 7px; padding: 5px 12px;
  font-size: 12px; cursor: pointer; transition: all .15s;
}
.btn-icon:hover        { background: var(--bg); }
.btn-icon.danger:hover { background: #FEE2E2; border-color: var(--danger); color: var(--danger); }

/* ── Report controls ─────────────────────── */
.report-controls {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 20px;
}

/* ── Forms ───────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-group input,
.form-group select {
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; color: var(--text);
  background: #fff; outline: none; transition: border-color .15s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

/* ── Buttons ─────────────────────────────── */
.btn-primary {
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px; padding: 10px 20px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: none; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 20px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.btn-secondary:hover { background: var(--bg); }

.btn-full { width: 100%; }
.mt16 { margin-top: 16px; }

/* ── Report table ────────────────────────── */
.report-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.report-header h3 { font-size: 15px; font-weight: 700; }

.report-table-wrapper { overflow-x: auto; margin-bottom: 16px; }
.report-table {
  width: 100%; border-collapse: collapse;
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  font-size: 13px; min-width: 460px;
}
.report-table th {
  background: #F8FAFC; padding: 10px 10px;
  text-align: center; font-weight: 600; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.report-table td {
  padding: 10px 10px; border-bottom: 1px solid var(--border);
  text-align: center; white-space: nowrap;
}
.report-table tr:last-child td { border-bottom: none; }
.report-table tr:hover td { background: #F8FAFC; }
.report-table .td-actions { display: flex; gap: 6px; justify-content: center; }

/* ── Report summary ──────────────────────── */
.report-summary {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.summary-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--text-muted); letter-spacing: .05em; }
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--text-muted); font-weight: 500; }
.summary-value { font-weight: 600; }
.summary-row.total-pay {
  border-top: 2px solid var(--border); padding-top: 14px; margin-top: 4px;
  font-size: 16px; font-weight: 700;
}
.summary-row.total-pay .summary-label { color: var(--text); }
.summary-row.total-pay .summary-value { color: var(--primary); font-size: 18px; }

/* ── Modal ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal {
  background: var(--card); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 25px rgba(0,0,0,.15);
}
.modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 20px; }
.modal .form-group { margin-bottom: 14px; }
.modal-buttons { display: flex; gap: 12px; justify-content: flex-end; margin-top: 22px; }

/* ── Empty state ─────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state p { font-size: 14px; line-height: 1.7; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 400px) {
  .clock-time { font-size: 42px; }
  .action-buttons { gap: 8px; }
  .btn-action { font-size: 15px; padding: 18px 12px; }
}

/* ── ログイン ─────────────────────────────────────────────── */
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  min-height: 1.4em;
  margin-bottom: 8px;
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: .6;
  cursor: default;
}
