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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fa;
  color: #333;
  min-height: 100vh;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 1.6rem;
  color: #2e7d32;
  margin-bottom: 16px;
  text-align: center;
  padding: 12px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

h2 {
  font-size: 1rem;
  color: #4caf50;
  margin-bottom: 12px;
  border-left: 4px solid #4caf50;
  padding-left: 8px;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #4caf50;
}

.btn-primary {
  background: #4caf50;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #388e3c;
}

.btn-secondary {
  background: #eee;
  color: #444;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #ddd;
}

/* スタッフカード */
.staff-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafafa;
}

.staff-card.expired {
  border-color: #f44336;
  background: #fff8f8;
}

.staff-card.warning {
  border-color: #ff9800;
  background: #fffbf3;
}

.staff-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.staff-name {
  font-size: 1.05rem;
  font-weight: bold;
  color: #222;
}

.badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: bold;
}

.badge-expired {
  background: #f44336;
  color: #fff;
}

.badge-warning {
  background: #ff9800;
  color: #fff;
}

.badge-ok {
  background: #4caf50;
  color: #fff;
}

.staff-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.stat-item {
  text-align: center;
  background: #fff;
  border-radius: 6px;
  padding: 8px 4px;
  border: 1px solid #eee;
}

.stat-label {
  font-size: 0.72rem;
  color: #888;
  display: block;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: bold;
  color: #2e7d32;
}

.stat-value.danger {
  color: #f44336;
}

.stat-value.warn {
  color: #ff9800;
}

/* 消化率バー */
.progress-bar-wrap {
  background: #e0e0e0;
  border-radius: 4px;
  height: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: #4caf50;
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-bar.warn {
  background: #ff9800;
}

.progress-bar.danger {
  background: #f44336;
}

.expire-info {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 10px;
}

.expire-info.expired {
  color: #f44336;
  font-weight: bold;
}

.expire-info.warning {
  color: #ff9800;
  font-weight: bold;
}

.staff-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 12px;
  border-radius: 5px;
  border: none;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-record {
  background: #4caf50;
  color: #fff;
}

.btn-record:hover {
  background: #388e3c;
}

.btn-history {
  background: #e3f2fd;
  color: #1976d2;
}

.btn-history:hover {
  background: #bbdefb;
}

.btn-delete {
  background: #fce4ec;
  color: #c62828;
}

.btn-delete:hover {
  background: #ffcdd2;
}

.no-staff {
  text-align: center;
  color: #aaa;
  padding: 24px;
  font-size: 0.9rem;
}

/* モーダル */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.modal-content h2 {
  margin-bottom: 8px;
}

.modal-staff-name {
  font-weight: bold;
  color: #333;
  margin-bottom: 14px;
  font-size: 1rem;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-buttons .btn-primary,
.modal-buttons .btn-secondary {
  flex: 1;
}

/* 履歴リスト */
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  font-size: 0.88rem;
  gap: 8px;
}

.history-item:last-child {
  border-bottom: none;
}

.history-date {
  color: #555;
  flex-shrink: 0;
}

.history-days {
  font-weight: bold;
  color: #2e7d32;
  flex-shrink: 0;
}

.history-note {
  color: #999;
  font-size: 0.8rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-del-record {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.btn-del-record:hover {
  color: #f44336;
}

.no-history {
  text-align: center;
  color: #aaa;
  padding: 16px;
  font-size: 0.88rem;
}

@media (max-width: 480px) {
  .staff-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .stat-value {
    font-size: 1rem;
  }
}
